99import com .hypixel .hytale .component .Store ;
1010import com .hypixel .hytale .server .core .command .system .AbstractCommand ;
1111import com .hypixel .hytale .server .core .command .system .CommandContext ;
12+ import com .hypixel .hytale .server .core .command .system .CommandRegistration ;
1213import com .hypixel .hytale .server .core .command .system .CommandSender ;
1314import com .hypixel .hytale .server .core .command .system .arguments .system .Argument ;
1415import com .hypixel .hytale .server .core .command .system .arguments .system .OptionalArg ;
@@ -58,6 +59,7 @@ public static ScriptCommandBuilder create(int commandType, SkriptLogger logger)
5859 private final Map <String , CommandArg > args = new LinkedHashMap <>();
5960 private final Map <String , Argument <?, ?>> argsFromCommand = new LinkedHashMap <>();
6061 private AbstractCommand hyCommand ;
62+ private CommandRegistration commandRegistration ;
6163
6264 private final SectionConfiguration sec = new SectionConfiguration .Builder ()
6365 .addOptionalLiteral ("can-generate-permission" , Boolean .class )
@@ -279,6 +281,12 @@ private void createLocalVariables(CommandContext ctx, TriggerContext triggerCont
279281 });
280282 }
281283
284+ public void unregister () {
285+ if (this .commandRegistration != null ) {
286+ this .commandRegistration .unregister ();
287+ }
288+ }
289+
282290 public String getCommandName () {
283291 return this .commandName ;
284292 }
@@ -291,7 +299,7 @@ public void build(ScriptCommandBuilder parent) {
291299 if (this .hyCommand == null ) return ;
292300
293301 if (parent == null ) {
294- HySk .getInstance ().getCommandRegistry ().registerCommand (this .hyCommand );
302+ this . commandRegistration = HySk .getInstance ().getCommandRegistry ().registerCommand (this .hyCommand );
295303 } else {
296304 parent .hyCommand .addSubCommand (this .hyCommand );
297305 }
0 commit comments