@@ -203,31 +203,73 @@ Say we have a command to spawn mobs:
203203
204204Now say that we don't want non-op players to spawn bosses. To do this, we'll create a ` List<EntityType> ` which is the list of all mobs that non-ops are allowed to spawn:
205205
206+ <div class =" paper " >
207+
206208::: tabs
207209===Java
208- <<< @/../reference-code/bukkit /src/main/java/createcommands/arguments/suggestions/SafeSuggestions.java#createForbiddenMobsList
210+ <<< @/../reference-code/paper /src/main/java/createcommands/arguments/suggestions/SafeSuggestions.java#createForbiddenMobsList
209211===Kotlin
210- <<< @/../reference-code/bukkit /src/main/kotlin/createcommands/arguments/suggestions/SafeSuggestions.kt#createForbiddenMobsList
212+ <<< @/../reference-code/paper /src/main/kotlin/createcommands/arguments/suggestions/SafeSuggestions.kt#createForbiddenMobsList
211213:::
212214
215+ </div >
216+ <div class =" spigot " >
217+
218+ ::: tabs
219+ ===Java
220+ <<< @/../reference-code/spigot/src/main/java/createcommands/arguments/suggestions/SafeSuggestions.java#createForbiddenMobsList
221+ ===Kotlin
222+ <<< @/../reference-code/spigot/src/main/kotlin/createcommands/arguments/suggestions/SafeSuggestions.kt#createForbiddenMobsList
223+ :::
224+
225+ </div >
226+
213227We then use our safe arguments to return an ` EntityType[] ` as the list of values that are suggested to the player. In this example, we use the ` sender() ` method to determine if the sender has permissions to view the suggestions:
214228
229+ <div class =" paper " >
230+
231+ ::: tabs
232+ ===Java
233+ <<< @/../reference-code/paper/src/main/java/createcommands/arguments/suggestions/SafeSuggestions.java#createSafeArguments
234+ ===Kotlin
235+ <<< @/../reference-code/paper/src/main/kotlin/createcommands/arguments/suggestions/SafeSuggestions.kt#createSafeArguments
236+ :::
237+
238+ </div >
239+ <div class =" spigot " >
240+
215241::: tabs
216242===Java
217- <<< @/../reference-code/bukkit /src/main/java/createcommands/arguments/suggestions/SafeSuggestions.java#createSafeArguments
243+ <<< @/../reference-code/spigot /src/main/java/createcommands/arguments/suggestions/SafeSuggestions.java#createSafeArguments
218244===Kotlin
219- <<< @/../reference-code/bukkit /src/main/kotlin/createcommands/arguments/suggestions/SafeSuggestions.kt#createSafeArguments
245+ <<< @/../reference-code/spigot /src/main/kotlin/createcommands/arguments/suggestions/SafeSuggestions.kt#createSafeArguments
220246:::
221247
248+ </div >
249+
222250Now we register our command as normal:
223251
252+ <div class =" paper " >
253+
254+ ::: tabs
255+ ===Java
256+ <<< @/../reference-code/paper/src/main/java/createcommands/arguments/suggestions/SafeSuggestions.java#registerSpawnMobCommand
257+ ===Kotlin
258+ <<< @/../reference-code/paper/src/main/kotlin/createcommands/arguments/suggestions/SafeSuggestions.kt#registerSpawnMobCommand
259+ :::
260+
261+ </div >
262+ <div class =" spigot " >
263+
224264::: tabs
225265===Java
226- <<< @/../reference-code/bukkit /src/main/java/createcommands/arguments/suggestions/SafeSuggestions.java#registerSpawnMobCommand
266+ <<< @/../reference-code/spigot /src/main/java/createcommands/arguments/suggestions/SafeSuggestions.java#registerSpawnMobCommand
227267===Kotlin
228- <<< @/../reference-code/bukkit /src/main/kotlin/createcommands/arguments/suggestions/SafeSuggestions.kt#registerSpawnMobCommand
268+ <<< @/../reference-code/spigot /src/main/kotlin/createcommands/arguments/suggestions/SafeSuggestions.kt#registerSpawnMobCommand
229269:::
230270
271+ </div >
272+
231273::::
232274
233275::::tip Example – Removing a potion effect from a player
@@ -240,20 +282,48 @@ Say we wanted to remove a potion effect from a player. To do this, we'll use the
240282
241283Now, we don't want to remove a potion effect that doesn't exist on a player, so instead we'll use the safe arguments to find a list of potion effects on the target player and then only suggest those potion effects. To do this, we'll use the ` previousArguments() ` method, as it allows us to access the previously defined ` <player> ` argument.
242284
285+ <div class =" paper " >
286+
287+ ::: tabs
288+ ===Java
289+ <<< @/../reference-code/paper/src/main/java/createcommands/arguments/suggestions/SafeSuggestions.java#createSafePotionEffectArguments
290+ ===Kotlin
291+ <<< @/../reference-code/paper/src/main/kotlin/createcommands/arguments/suggestions/SafeSuggestions.kt#createSafePotionEffectArguments
292+ :::
293+
294+ </div >
295+ <div class =" spigot " >
296+
243297::: tabs
244298===Java
245- <<< @/../reference-code/bukkit /src/main/java/createcommands/arguments/suggestions/SafeSuggestions.java#createSafePotionEffectArguments
299+ <<< @/../reference-code/spigot /src/main/java/createcommands/arguments/suggestions/SafeSuggestions.java#createSafePotionEffectArguments
246300===Kotlin
247- <<< @/../reference-code/bukkit /src/main/kotlin/createcommands/arguments/suggestions/SafeSuggestions.kt#createSafePotionEffectArguments
301+ <<< @/../reference-code/spigot /src/main/kotlin/createcommands/arguments/suggestions/SafeSuggestions.kt#createSafePotionEffectArguments
248302:::
249303
304+ </div >
305+
250306And then we can register our command as normal:
251307
308+ <div class =" paper " >
309+
252310::: tabs
253311===Java
254- <<< @/../reference-code/bukkit /src/main/java/createcommands/arguments/suggestions/SafeSuggestions.java#registerRemoveEffectCommand
312+ <<< @/../reference-code/paper /src/main/java/createcommands/arguments/suggestions/SafeSuggestions.java#registerRemoveEffectCommand
255313===Kotlin
256- <<< @/../reference-code/bukkit /src/main/kotlin/createcommands/arguments/suggestions/SafeSuggestions.kt#registerRemoveEffectCommand
314+ <<< @/../reference-code/paper /src/main/kotlin/createcommands/arguments/suggestions/SafeSuggestions.kt#registerRemoveEffectCommand
257315:::
258316
317+ </div >
318+ <div class =" spigot " >
319+
320+ ::: tabs
321+ ===Java
322+ <<< @/../reference-code/spigot/src/main/java/createcommands/arguments/suggestions/SafeSuggestions.java#registerRemoveEffectCommand
323+ ===Kotlin
324+ <<< @/../reference-code/spigot/src/main/kotlin/createcommands/arguments/suggestions/SafeSuggestions.kt#registerRemoveEffectCommand
325+ :::
326+
327+ </div >
328+
259329::::
0 commit comments