Skip to content

Commit fe9570c

Browse files
committed
add a simple form to the example of statistic value provider
1 parent 2a9a5ee commit fe9570c

File tree

1 file changed

+39
-71
lines changed

1 file changed

+39
-71
lines changed

src/topper/provider/statistic/index.md

Lines changed: 39 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,23 @@
22
title: Statistic
33
---
44

5+
<script setup>
6+
import { ref } from 'vue';
7+
8+
const spigotFormData = ref({
9+
name: 'jump',
10+
statistic: 'JUMP',
11+
material: [],
12+
entity: [],
13+
});
14+
15+
const fabricFormData = ref({
16+
name: 'jump',
17+
statisticType: 'minecraft:custom',
18+
statistic: ['minecraft:jump'],
19+
});
20+
</script>
21+
522
# Statistic
623

724
This is a provider that provides statistic values of a player to the Top Holder.
@@ -103,86 +120,37 @@ entity:
103120
:::tabs key:platform
104121
== SpigotMC
105122

106-
```yaml
123+
<Vueform v-model="spigotFormData" sync>
124+
<TextElement name="name" label="Holder Name" description="The name of the holder" />
125+
<TextElement name="statistic" label="Statistic" description="The name of the statistic" />
126+
<ListElement name="material" label="Material" description="The name of the material. Used for some statistics that require an item." :element="{ type: 'text' }" />
127+
<ListElement name="entity" label="Entity" description="The name of the entity. Used for some statistics that require an entity." :element="{ type: 'text' }" />
128+
</Vueform>
129+
130+
```yaml-vue
107131
holders:
108-
# Holder that shows the number of times a player has jumped
109-
jump:
110-
type: statistic
111-
statistic: JUMP
112-
# Holder that shows the number of blocks mined by a player
113-
mine:
114-
type: statistic
115-
statistic: MINE_BLOCK
116-
# Holder that shows the number of times a player has killed a zombie
117-
zombie:
118-
type: statistic
119-
statistic: KILL_ENTITY
120-
entity: ZOMBIE
121-
# Holder that shows the number of times a player has mined diamond ore
122-
diamond:
123-
type: statistic
124-
statistic: MINE_BLOCK
125-
material: DIAMOND_ORE
126-
# Holder that shows the number of times a player has mined diamond ore or gold ore
127-
diamond_or_gold:
128-
type: statistic
129-
statistic: MINE_BLOCK
130-
material:
131-
- DIAMOND_ORE
132-
- GOLD_ORE
133-
# Holder that shows the number of times a player has killed a zombie or a skeleton
134-
zombie_or_skeleton:
132+
{{ spigotFormData.name }}:
135133
type: statistic
136-
statistic: KILL_ENTITY
137-
entity:
138-
- ZOMBIE
139-
- SKELETON
134+
statistic: {{ spigotFormData.statistic }}
135+
{{ spigotFormData.material.length ? (spigotFormData.material.length === 1 ? ' material: ' + spigotFormData.material[0] : ' material:\n - ' + spigotFormData.material.join('\n - ')) : '' }}
136+
{{ spigotFormData.entity.length ? (spigotFormData.entity.length === 1 ? ' entity: ' + spigotFormData.entity[0] : ' entity:\n - ' + spigotFormData.entity.join('\n - ')) : '' }}
140137
```
141138

142139
== FabricMC
143140

144-
```json
141+
<Vueform v-model="fabricFormData" sync>
142+
<TextElement name="name" label="Holder Name" description="The name of the holder" />
143+
<TextElement name="statisticType" label="Statistic Type" description="The type of the statistic (e.g., minecraft:custom, minecraft:mined, minecraft:killed)" />
144+
<ListElement name="statistic" label="Statistic" description="The name of the statistic" :element="{ type: 'text' }" />
145+
</Vueform>
146+
147+
```json-vue
145148
{
146149
"holders": {
147-
// Holder that shows the number of times a player has jumped
148-
"jump": {
149-
"type": "statistic",
150-
"statistic": "minecraft:jump"
151-
},
152-
// Holder that shows the number of times a player has mined a block
153-
"mine": {
154-
"type": "statistic",
155-
"statistic-type": "minecraft:mined"
156-
},
157-
// Holder that shows the number of times a player has killed a zombie
158-
"zombie": {
159-
"type": "statistic",
160-
"statistic-type": "minecraft:killed",
161-
"statistic": "minecraft:zombie"
162-
},
163-
// Holder that shows the number of times a player has mined diamond ore
164-
"diamond": {
165-
"type": "statistic",
166-
"statistic-type": "minecraft:mined",
167-
"statistic": "minecraft:diamond_ore"
168-
},
169-
// Holder that shows the number of times a player has mined diamond ore or gold ore
170-
"diamond_or_gold": {
171-
"type": "statistic",
172-
"statistic-type": "minecraft:mined",
173-
"statistic": [
174-
"minecraft:diamond_ore",
175-
"minecraft:gold_ore"
176-
]
177-
},
178-
// Holder that shows the number of times a player has killed a zombie or a skeleton
179-
"zombie_or_skeleton": {
150+
"{{ fabricFormData.name }}": {
180151
"type": "statistic",
181-
"statistic-type": "minecraft:killed",
182-
"statistic": [
183-
"minecraft:zombie",
184-
"minecraft:skeleton"
185-
]
152+
"statistic-type": "{{ fabricFormData.statisticType }}"{{ fabricFormData.statistic.length ? ',' : '' }}
153+
{{ fabricFormData.statistic.length ? (' "statistic": ' + (fabricFormData.statistic.length === 1 ? '"' + fabricFormData.statistic[0] + '"' : JSON.stringify(fabricFormData.statistic))) : '' }}
186154
}
187155
}
188156
}

0 commit comments

Comments
 (0)