Class GeyserExtension

java.lang.Object
org.geysermc.geyser.extension.GeyserExtension

public abstract class GeyserExtension extends Object
All GeyserExtensions extend from this
  • Constructor Details

  • Method Details

    • on

      public <T extends GeyserEvent> ExtensionLambdaEventHandler<T> on(Class<T> cls, Consumer<T> consumer)
      Create a new EventHandler using a lambda
      Type Parameters:
      T - Event class
      Parameters:
      cls - Event class to await
      consumer - code to execute
      Returns:
      The event handler
    • on

      public <T extends GeyserEvent> ExtensionLambdaEventHandler<T> on(Class<T> cls, BiConsumer<T,​EventHandler<T>> consumer)
    • register

      public <T extends GeyserEvent> void register(EventHandler<T> handler)
      Register an event handler
      Type Parameters:
      T - Event class
      Parameters:
      handler - EventHandler to register
    • unregister

      public <T extends GeyserEvent> void unregister(EventHandler<T> handler)
      Unregister an event handler
      Type Parameters:
      T - Event class
      Parameters:
      handler - EventHandler to unregister
    • registerEvents

      public void registerEvents(Object obj)
      Register all Events contained in an instantiated class. The methods must be annotated by GeyserEventHandler
      Parameters:
      obj - Class to register events
    • unregisterAllEvents

      public void unregisterAllEvents()
      Unregister all events for a extension
    • enable

      public void enable()
      Enable Extension Override this to catch when the extension is enabled
    • disable

      public void disable()
      Disable Extension Override this to catch when the extension is disabled
    • getConnector

      public GeyserImpl getConnector()
    • getName

      public String getName()
    • getDescription

      public String getDescription()
    • getVersion

      public String getVersion()
    • getEventManager

      public EventManager getEventManager()
      Return our Event Manager
      Returns:
      Event Manager
    • getDataFolder

      public File getDataFolder()
      Return our dataFolder based upon the extension name
      Returns:
      File to datafolder
    • getResourceAsStream

      public InputStream getResourceAsStream(String name)
      Return an InputStream for a resource file
      Parameters:
      name - Name of file
      Returns:
      InputStream to resource or null
    • getExtensionEventHandlers

      public List<EventHandler<?>> getExtensionEventHandlers()
    • getExtensionManager

      public ExtensionManager getExtensionManager()
    • getExtensionClassLoader

      public ExtensionClassLoader getExtensionClassLoader()
    • getLogger

      public ExtensionLogger getLogger()