Package me.yleoft.zAPI.managers
Class PluginYAMLManager
java.lang.Object
me.yleoft.zAPI.managers.PluginYAMLManager
PluginYAMLManager class to manage commands and permissions for a Bukkit plugin.
It allows registering and unregistering commands and permissions dynamically.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final org.bukkit.command.TabExecutorCommandExecutor that does nothing and returns false. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidregisterCommand(@NotNull String command, @NotNull org.bukkit.command.CommandExecutor ce, @NotNull String description, @NotNull String... aliases) Registers a command with the specified name, executor, description, and aliases.static voidregisterCommand(@NotNull String command, @NotNull org.bukkit.command.CommandExecutor ce, @NotNull org.bukkit.command.TabCompleter completer, @NotNull String description, @NotNull String... aliases) Registers a command with the specified name, executor, tab completer, description, and aliases.static voidregisterEvent(@NotNull org.bukkit.event.Listener l) Registers a Listener for the plugin.static voidregisterPermission(@NotNull String permission) static voidregisterPermission(@NotNull String permission, @NotNull String description) static voidregisterPermission(@NotNull String permission, @NotNull String description, @NotNull org.bukkit.permissions.PermissionDefault def) static voidregisterPermission(@NotNull String permission, @NotNull String description, @NotNull org.bukkit.permissions.PermissionDefault def, @NotNull Map<String, Boolean> children) static voidregisterPermission(@NotNull String permission, @NotNull org.bukkit.permissions.PermissionDefault def) static voidregisterTabCompleter(@NotNull String command, @NotNull org.bukkit.command.TabCompleter tc) Registers a TabCompleter for the specified command.static voidSyncs the commands registered in the server.static voidUnregisters all commands registered by this plugin.static voidunregisterPermission(@NotNull String permission) static voidunregisterPermission(@NotNull org.bukkit.permissions.Permission permission) static voidUnregisters all permissions registered by this plugin.
-
Field Details
-
emptyExec
public static final org.bukkit.command.TabExecutor emptyExecCommandExecutor that does nothing and returns false. This is used as a placeholder for commands that are not registered.
-
-
Constructor Details
-
PluginYAMLManager
public PluginYAMLManager()
-
-
Method Details
-
syncCommands
public static void syncCommands()Syncs the commands registered in the server. This method is used to ensure that all commands are properly registered. -
unregisterCommands
public static void unregisterCommands()Unregisters all commands registered by this plugin. This method is used to clean up commands when the plugin is disabled or reloaded. -
registerCommand
public static void registerCommand(@NotNull @NotNull String command, @NotNull @NotNull org.bukkit.command.CommandExecutor ce, @NotNull @NotNull String description, @NotNull @NotNull String... aliases) Registers a command with the specified name, executor, description, and aliases.- Parameters:
command- The name of the command.ce- The CommandExecutor for the command.description- The description of the command.aliases- The aliases for the command.
-
registerCommand
public static void registerCommand(@NotNull @NotNull String command, @NotNull @NotNull org.bukkit.command.CommandExecutor ce, @NotNull @NotNull org.bukkit.command.TabCompleter completer, @NotNull @NotNull String description, @NotNull @NotNull String... aliases) Registers a command with the specified name, executor, tab completer, description, and aliases.- Parameters:
command- The name of the command.ce- The CommandExecutor for the command.completer- The TabCompleter for the command.description- The description of the command.aliases- The aliases for the command.
-
unregisterPermissions
public static void unregisterPermissions()Unregisters all permissions registered by this plugin. -
unregisterPermission
-
unregisterPermission
public static void unregisterPermission(@NotNull @NotNull org.bukkit.permissions.Permission permission) -
registerPermission
-
registerPermission
-
registerPermission
public static void registerPermission(@NotNull @NotNull String permission, @NotNull @NotNull org.bukkit.permissions.PermissionDefault def) -
registerPermission
-
registerPermission
-
registerTabCompleter
public static void registerTabCompleter(@NotNull @NotNull String command, @NotNull @NotNull org.bukkit.command.TabCompleter tc) Registers a TabCompleter for the specified command.- Parameters:
command- The name of the command.tc- The TabCompleter for the command.
-
registerEvent
public static void registerEvent(@NotNull @NotNull org.bukkit.event.Listener l) Registers a Listener for the plugin.- Parameters:
l- The Listener to register.
-