Package studio.mevera.imperat
Class BukkitImperat
java.lang.Object
studio.mevera.imperat.BaseImperat<BukkitCommandSource>
studio.mevera.imperat.BukkitImperat
- All Implemented Interfaces:
studio.mevera.imperat.AnnotationInjector<BukkitCommandSource>,studio.mevera.imperat.CommandRegistrar<BukkitCommandSource>,studio.mevera.imperat.events.EventListener,studio.mevera.imperat.events.EventPublisher,studio.mevera.imperat.Imperat<BukkitCommandSource>,studio.mevera.imperat.SourceWrapper<BukkitCommandSource>
Main Imperat implementation for Bukkit/Spigot/Paper servers.
This class serves as the primary entry point for integrating the Imperat command framework
with Bukkit-based server platforms, providing comprehensive command management capabilities.
Key Features:
- Full integration with Bukkit's command system
- Adventure API support for rich text messaging
- Brigadier integration for Paper servers (optional)
- Built-in parameter types for Bukkit objects (Players, Locations, etc.)
- Entity selector support (@p, @a, @e, @r)
- Automatic command registration and cleanup
Usage Example:
public class MyPlugin extends JavaPlugin {
private BukkitImperat imperat;
@Override
public void onEnable() {
imperat = BukkitImperat.builder(this)
.applyBrigadier(true) // Enable for Paper
.build();
imperat.registerCommand(MyCommand.class);
}
@Override
public void onDisable() {
if (imperat != null) {
imperat.shutdownPlatform();
}
}
}
- Since:
- 1.0
- See Also:
-
Field Summary
Fields inherited from class studio.mevera.imperat.BaseImperat
config -
Method Summary
Modifier and TypeMethodDescriptionstatic BukkitConfigBuilderbuilder(org.bukkit.plugin.Plugin plugin) Creates a new configuration builder for BukkitImperat.static BukkitConfigBuilderbuilder(org.bukkit.plugin.Plugin plugin, boolean integrateWithBrigadier) Creates a new configuration builder for BukkitImperat.org.bukkit.plugin.PluginvoidregisterSimpleCommand(studio.mevera.imperat.command.Command<BukkitCommandSource> command) Registering a command into the dispatchervoidvoidUnregisters all commands from the internal registryvoidunregisterCommand(String name) Unregisters a command from the internal registrywrapSender(Object sender) Wraps the sender into a built-in command-sender valueTypeMethods inherited from class studio.mevera.imperat.BaseImperat
autoComplete, canBeSender, config, debug, execute, execute, execute, execute, execute, getAnnotationParser, getCommand, getRegisteredCommands, getSubCommand, listen, publishEvent, registerAnnotationReplacer, registerAnnotations, registerCommand, registerCommand, removeListener, setAnnotationParserMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface studio.mevera.imperat.AnnotationInjector
registerGlobalExceptionHandlersMethods inherited from interface studio.mevera.imperat.CommandRegistrar
getCommand, registerCommands, registerCommands, registerCommandsMethods inherited from interface studio.mevera.imperat.events.EventListener
listen, listen
-
Method Details
-
builder
Creates a new configuration builder for BukkitImperat. This is the recommended way to create and configure a BukkitImperat instance.- Parameters:
plugin- the plugin instance that will own this Imperat instance- Returns:
- a new BukkitConfigBuilder for further configuration
-
builder
public static BukkitConfigBuilder builder(org.bukkit.plugin.Plugin plugin, boolean integrateWithBrigadier) Creates a new configuration builder for BukkitImperat. This is the recommended way to create and configure a BukkitImperat instance.- Parameters:
plugin- the plugin instance that will own this Imperat instanceintegrateWithBrigadier- whether to enable Brigadier integration (Paper only)- Returns:
- a new BukkitConfigBuilder for further configuration
-
createDummySender
-
wrapSender
Wraps the sender into a built-in command-sender valueType- Parameters:
sender- the sender's actual value- Returns:
- the wrapped command-sender valueType
-
getPlatform
public org.bukkit.plugin.Plugin getPlatform()- Returns:
- the platform of the module
-
shutdownPlatform
public void shutdownPlatform() -
registerSimpleCommand
public void registerSimpleCommand(studio.mevera.imperat.command.Command<BukkitCommandSource> command) Registering a command into the dispatcher- Specified by:
registerSimpleCommandin interfacestudio.mevera.imperat.CommandRegistrar<BukkitCommandSource>- Overrides:
registerSimpleCommandin classstudio.mevera.imperat.BaseImperat<BukkitCommandSource>- Parameters:
command- the command to register
-
unregisterCommand
Unregisters a command from the internal registry- Specified by:
unregisterCommandin interfacestudio.mevera.imperat.CommandRegistrar<BukkitCommandSource>- Overrides:
unregisterCommandin classstudio.mevera.imperat.BaseImperat<BukkitCommandSource>- Parameters:
name- the name of the command to unregister
-
unregisterAllCommands
public void unregisterAllCommands()Unregisters all commands from the internal registry- Specified by:
unregisterAllCommandsin interfacestudio.mevera.imperat.CommandRegistrar<BukkitCommandSource>- Overrides:
unregisterAllCommandsin classstudio.mevera.imperat.BaseImperat<BukkitCommandSource>
-