11package de .pascalpex .pexnpc ;
22
3- import com .mojang .brigadier .arguments .IntegerArgumentType ;
43import com .mojang .brigadier .arguments .LongArgumentType ;
54import com .mojang .brigadier .arguments .StringArgumentType ;
65import com .mojang .brigadier .tree .LiteralCommandNode ;
7- import de .pascalpex .pexnpc .commands .IDSuggestionProvider ;
6+ import de .pascalpex .pexnpc .commands .IDArgument ;
87import de .pascalpex .pexnpc .commands .NPCSlotArgument ;
98import de .pascalpex .pexnpc .commands .subcommands .*;
109import io .papermc .paper .command .brigadier .CommandSourceStack ;
@@ -21,7 +20,7 @@ public class PexNPCBootstrap implements PluginBootstrap {
2120 @ Override
2221 public void bootstrap (BootstrapContext context ) {
2322 context .getLifecycleManager ().registerEventHandler (LifecycleEvents .COMMANDS , commands -> {
24- IDSuggestionProvider idSuggestionProvider = new IDSuggestionProvider ();
23+ IDArgument idArgument = new IDArgument ();
2524 HelpSubcommand helpSubcommand = new HelpSubcommand ();
2625
2726 LiteralCommandNode <CommandSourceStack > advancedCommandRoot = Commands .literal ("pexnpc" )
@@ -36,22 +35,17 @@ public void bootstrap(BootstrapContext context) {
3635 .then (Commands .literal ("list" )
3736 .executes (new ListSubcommand ()))
3837 .then (Commands .literal ("delete" )
39- .then (Commands .argument ("id" , LongArgumentType .longArg (1 ))
40- .suggests (idSuggestionProvider ::getSuggestions )))
38+ .then (Commands .argument ("npc" , idArgument )))
4139 .then (Commands .literal ("name" )
42- .then (Commands .argument ("id" , LongArgumentType .longArg (1 ))
43- .suggests (idSuggestionProvider ::getSuggestions )
40+ .then (Commands .argument ("npc" , idArgument )
4441 .then (Commands .argument ("name" , StringArgumentType .greedyString ()))))
4542 .then (Commands .literal ("movehere" )
46- .then (Commands .argument ("id" , LongArgumentType .longArg (1 ))
47- .suggests (idSuggestionProvider ::getSuggestions )))
43+ .then (Commands .argument ("npc" , idArgument )))
4844 .then (Commands .literal ("tp" )
49- .then (Commands .argument ("id" , LongArgumentType .longArg (1 ))
50- .suggests (idSuggestionProvider ::getSuggestions )
45+ .then (Commands .argument ("npc" , idArgument )
5146 .executes (new TpSubcommand ())))
5247 .then (Commands .literal ("skin" )
53- .then (Commands .argument ("id" , LongArgumentType .longArg (1 ))
54- .suggests (idSuggestionProvider ::getSuggestions )
48+ .then (Commands .argument ("npc" , idArgument )
5549 .then (Commands .argument ("skin" , StringArgumentType .greedyString ())
5650 .suggests ((cmdContext , builder ) -> {
5751 for (Player player : Bukkit .getOnlinePlayers ()) {
@@ -60,20 +54,16 @@ public void bootstrap(BootstrapContext context) {
6054 return builder .buildFuture ();
6155 }))))
6256 .then (Commands .literal ("cmd" )
63- .then (Commands .argument ("id" , LongArgumentType .longArg (1 ))
64- .suggests (idSuggestionProvider ::getSuggestions )
57+ .then (Commands .argument ("npc" , idArgument )
6558 .then (Commands .argument ("cmd" , StringArgumentType .greedyString ()))))
6659 .then (Commands .literal ("msg" )
67- .then (Commands .argument ("id" , LongArgumentType .longArg (1 ))
68- .suggests (idSuggestionProvider ::getSuggestions )
60+ .then (Commands .argument ("npc" , idArgument )
6961 .then (Commands .argument ("msg" , StringArgumentType .greedyString ()))))
7062 .then (Commands .literal ("item" )
71- .then (Commands .argument ("id" , LongArgumentType .longArg (1 ))
72- .suggests (idSuggestionProvider ::getSuggestions )
63+ .then (Commands .argument ("npc" , idArgument )
7364 .then (Commands .argument ("slot" , new NPCSlotArgument ()))))
7465 .then (Commands .literal ("clear" )
75- .then (Commands .argument ("id" , LongArgumentType .longArg (1 ))
76- .suggests (idSuggestionProvider ::getSuggestions )))
66+ .then (Commands .argument ("npc" , idArgument )))
7767 .executes (helpSubcommand )
7868 .build ();
7969
0 commit comments