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>

public final class BukkitImperat extends studio.mevera.imperat.BaseImperat<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 Type
    Method
    Description
    builder(org.bukkit.plugin.Plugin plugin)
    Creates a new configuration builder for BukkitImperat.
    builder(org.bukkit.plugin.Plugin plugin, boolean integrateWithBrigadier)
    Creates a new configuration builder for BukkitImperat.
     
    org.bukkit.plugin.Plugin
     
    void
    registerSimpleCommand(studio.mevera.imperat.command.Command<BukkitCommandSource> command)
    Registering a command into the dispatcher
    void
     
    void
    Unregisters all commands from the internal registry
    void
    Unregisters a command from the internal registry
    Wraps the sender into a built-in command-sender valueType

    Methods 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, setAnnotationParser

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface studio.mevera.imperat.AnnotationInjector

    registerGlobalExceptionHandlers

    Methods inherited from interface studio.mevera.imperat.CommandRegistrar

    getCommand, registerCommands, registerCommands, registerCommands

    Methods inherited from interface studio.mevera.imperat.events.EventListener

    listen, listen
  • Method Details

    • builder

      public static BukkitConfigBuilder builder(org.bukkit.plugin.Plugin plugin)
      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 instance
      integrateWithBrigadier - whether to enable Brigadier integration (Paper only)
      Returns:
      a new BukkitConfigBuilder for further configuration
    • createDummySender

      public BukkitCommandSource createDummySender()
    • wrapSender

      public BukkitCommandSource wrapSender(Object sender)
      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:
      registerSimpleCommand in interface studio.mevera.imperat.CommandRegistrar<BukkitCommandSource>
      Overrides:
      registerSimpleCommand in class studio.mevera.imperat.BaseImperat<BukkitCommandSource>
      Parameters:
      command - the command to register
    • unregisterCommand

      public void unregisterCommand(String name)
      Unregisters a command from the internal registry
      Specified by:
      unregisterCommand in interface studio.mevera.imperat.CommandRegistrar<BukkitCommandSource>
      Overrides:
      unregisterCommand in class studio.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:
      unregisterAllCommands in interface studio.mevera.imperat.CommandRegistrar<BukkitCommandSource>
      Overrides:
      unregisterAllCommands in class studio.mevera.imperat.BaseImperat<BukkitCommandSource>