Class ScriptCommandRegistrar
java.lang.Object
org.skriptlang.skript.bukkit.command.custom.ScriptCommandRegistrar
Utility class for registering Brigadier commands at runtime through reflection.
This avoids a full reload via
Bukkit.reloadData().
However, that approach will be used if the reflection-based approach fails to load.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic @Nullable ScriptBrigadierCommandgetCommand(String command) Obtains a script command by its name.static Set<ScriptBrigadierCommand> static voidinit(org.bukkit.plugin.java.JavaPlugin plugin) static voidProcesses all pending registrations, synchronizing them with the server's command dispatcher.static voidProcesses all pending unregistrations, synchronizing them with the server's command dispatcher.static voidregister(ScriptBrigadierCommand command) Adds thecommandto the registration queue.static voidunregister(ScriptBrigadierCommand command) Adds thecommandto the unregistration queue.
-
Constructor Details
-
ScriptCommandRegistrar
public ScriptCommandRegistrar()
-
-
Method Details
-
init
@Internal public static void init(org.bukkit.plugin.java.JavaPlugin plugin) -
register
Adds thecommandto the registration queue. To finalize registration, the queue must be processed usingprocessRegistrations().- Parameters:
command- The command to register.- See Also:
-
processRegistrations
public static void processRegistrations()Processes all pending registrations, synchronizing them with the server's command dispatcher.- See Also:
-
unregister
Adds thecommandto the unregistration queue. To finalize unregistration, the queue must be processed usingprocessUnregistrations().- Parameters:
command- The command to unregister.- See Also:
-
processUnregistrations
public static void processUnregistrations()Processes all pending unregistrations, synchronizing them with the server's command dispatcher.- See Also:
-
getCommand
Obtains a script command by its name.- Parameters:
command- The name of the command.- Returns:
- The script command named
command, or null if no script command with that name exists.
-
getCommands
- Returns:
- All commands registered with this registrar.
-