Skip to content

Commit b2789ea

Browse files
committed
fix: update command API arguments to use new types; refactor related tests
1 parent 2d96d39 commit b2789ea

File tree

3 files changed

+11
-7
lines changed

3 files changed

+11
-7
lines changed

surf-api-bukkit/surf-api-bukkit-plugin-test/src/main/java/dev/slne/surf/surfapi/bukkit/test/command/subcommands/entity/ShowHidePacketEntity.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import dev.jorel.commandapi.CommandAPICommand;
44
import dev.jorel.commandapi.arguments.BooleanArgument;
5-
import dev.jorel.commandapi.arguments.PlayerArgument;
5+
import dev.jorel.commandapi.arguments.PlayerProfileArgument;
66
import dev.jorel.commandapi.arguments.UUIDArgument;
77
import java.util.UUID;
88
import org.bukkit.entity.Player;
@@ -14,7 +14,7 @@ public ShowHidePacketEntity(String commandName) {
1414

1515
withArguments(new UUIDArgument("entityUuid"),
1616
// .replaceSuggestions(ArgumentSuggestions.stringCollection(info -> CreatePacketEntity.getEntityMap().keySet().stream().map(UUID::toString).toList())),
17-
new PlayerArgument("player"),
17+
new PlayerProfileArgument("player"),
1818
new BooleanArgument("show"));
1919

2020
executes((commandSender, commandArguments) -> {

surf-api-bukkit/surf-api-bukkit-plugin-test/src/main/kotlin/dev/slne/surf/surfapi/bukkit/test/command/subcommands/glowing/GlowingBlockTest.kt

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
package dev.slne.surf.surfapi.bukkit.test.command.subcommands.glowing
22

33
import dev.jorel.commandapi.CommandAPICommand
4+
import dev.jorel.commandapi.arguments.ChatColorArgument
45
import dev.jorel.commandapi.arguments.LocationType
5-
import dev.jorel.commandapi.kotlindsl.*
6+
import dev.jorel.commandapi.kotlindsl.booleanArgument
7+
import dev.jorel.commandapi.kotlindsl.getValue
8+
import dev.jorel.commandapi.kotlindsl.locationArgument
9+
import dev.jorel.commandapi.kotlindsl.playerExecutor
610
import dev.slne.surf.surfapi.bukkit.api.glow.glowingApi
711
import net.kyori.adventure.text.format.NamedTextColor
812
import org.bukkit.Location
@@ -11,7 +15,7 @@ class GlowingBlockTest(name: String) : CommandAPICommand(name) {
1115
init {
1216
booleanArgument("glow")
1317
locationArgument("location", LocationType.BLOCK_POSITION)
14-
adventureChatColorArgument("color")
18+
ChatColorArgument("color")
1519

1620
playerExecutor { sender, args ->
1721
val glow: Boolean by args

surf-api-bukkit/surf-api-bukkit-plugin-test/src/main/kotlin/dev/slne/surf/surfapi/bukkit/test/command/subcommands/visualizer/SingleLocationVisualizerTest.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
package dev.slne.surf.surfapi.bukkit.test.command.subcommands.visualizer
44

5-
import dev.jorel.commandapi.CommandAPIBukkit
65
import dev.jorel.commandapi.CommandAPICommand
6+
import dev.jorel.commandapi.CommandAPIPaper
77
import dev.jorel.commandapi.arguments.ArgumentSuggestions
88
import dev.jorel.commandapi.arguments.LocationType
99
import dev.jorel.commandapi.kotlindsl.*
@@ -61,7 +61,7 @@ class SingleLocationVisualizerTest(name: String) : CommandAPICommand(name) {
6161
val visualizer = visualizers[uid]
6262

6363
if (visualizer == null) {
64-
throw CommandAPIBukkit.failWithAdventureComponent(buildText {
64+
throw CommandAPIPaper.failWithAdventureComponent(buildText {
6565
append(Component.text("Visualizer with UID "))
6666
append(Component.text(uid.toString(), Colors.VARIABLE_VALUE))
6767
append(Component.text(" not found!"))
@@ -89,7 +89,7 @@ class SingleLocationVisualizerTest(name: String) : CommandAPICommand(name) {
8989
val visualizer = visualizers.remove(uid)
9090

9191
if (visualizer == null) {
92-
throw CommandAPIBukkit.failWithAdventureComponent(buildText {
92+
throw CommandAPIPaper.failWithAdventureComponent(buildText {
9393
append(Component.text("Visualizer with UID "))
9494
append(Component.text(uid.toString(), Colors.VARIABLE_VALUE))
9595
append(Component.text(" not found!"))

0 commit comments

Comments
 (0)