Package jss.commandapi
Class CommandApi
- java.lang.Object
-
- jss.commandapi.CommandApi
-
public final class CommandApi extends Object
CommandAPI provides global utilities and configuration options for the CommandAPI framework.This class is responsible for:
- Managing debug and logging configuration
- Providing centralized command execution logs
- Measuring command performance
- Handling and reporting command execution errors
This class is static-only and must be initialized once during the plugin
onEnable()lifecycle.- Version:
- 0.0.9-alpha
- Author:
- jonagamerpro1234
-
-
Constructor Summary
Constructors Constructor Description CommandApi()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voiddebug(@NotNull String message)Logs a debug message if debug mode is enabled.static voidhandleError(@NotNull String command, @NotNull org.bukkit.command.CommandSender sender, @NotNull Throwable throwable)Handles and logs an error that occurred during command execution.static voidinit(@NotNull org.bukkit.plugin.java.JavaPlugin javaPlugin)Initializes the CommandAPI.static booleanisDebug()Checks whether debug mode is enabled.static voidlog(@NotNull String message)Logs an informational message using the plugin logger.static voidlogCommandExecution(@NotNull String command, @NotNull org.bukkit.command.CommandSender sender, long executionTimeMs)Logs information about a command execution.static voidsetDebug(boolean enabled)Enables or disables debug mode.static voidsetLogExecution(boolean enabled)Enables or disables command execution logging.static voidsetLogPerformance(boolean enabled)Enables or disables command performance logging.
-
-
-
Method Detail
-
init
public static void init(@NotNull @NotNull org.bukkit.plugin.java.JavaPlugin javaPlugin)Initializes the CommandAPI.This method must be called once in
onEnable()before using any CommandAPI features.- Parameters:
javaPlugin- the plugin instance- Since:
- 0.0.9-alpha
-
setDebug
public static void setDebug(boolean enabled)
Enables or disables debug mode.When enabled, additional debug information and stack traces will be printed to the console.
- Parameters:
enabled- true to enable debug mode- Since:
- 0.0.9-alpha
-
isDebug
public static boolean isDebug()
Checks whether debug mode is enabled.- Returns:
- true if debug mode is enabled
- Since:
- 0.0.9-alpha
-
setLogExecution
public static void setLogExecution(boolean enabled)
Enables or disables command execution logging.- Parameters:
enabled- true to enable execution logging- Since:
- 0.0.9-alpha
-
setLogPerformance
public static void setLogPerformance(boolean enabled)
Enables or disables command performance logging.This option only has effect if execution logging is enabled.
- Parameters:
enabled- true to enable performance logging- Since:
- 0.0.9-alpha
-
log
public static void log(@NotNull @NotNull String message)Logs an informational message using the plugin logger.- Parameters:
message- the message to log- Since:
- 0.0.9-alpha
-
debug
public static void debug(@NotNull @NotNull String message)Logs a debug message if debug mode is enabled.- Parameters:
message- the debug message- Since:
- 0.0.9-alpha
-
logCommandExecution
public static void logCommandExecution(@NotNull @NotNull String command, @NotNull @NotNull org.bukkit.command.CommandSender sender, long executionTimeMs)Logs information about a command execution.- Parameters:
command- the executed command namesender- the command senderexecutionTimeMs- execution time in milliseconds- Since:
- 0.0.9-alpha
-
handleError
public static void handleError(@NotNull @NotNull String command, @NotNull @NotNull org.bukkit.command.CommandSender sender, @NotNull @NotNull Throwable throwable)Handles and logs an error that occurred during command execution.- Parameters:
command- the command being executedsender- the command senderthrowable- the thrown exception or error- Since:
- 0.0.9-alpha
-
-