Package org.geysermc.geyser.extension
Class GeyserExtension
java.lang.Object
org.geysermc.geyser.extension.GeyserExtension
All GeyserExtensions extend from this
-
Constructor Summary
ConstructorDescriptionGeyserExtension(ExtensionManager extensionManager, ExtensionClassLoader extensionClassLoader)
-
Method Summary
Modifier and TypeMethodDescriptionvoid
disable()
Disable Extension Override this to catch when the extension is disabledvoid
enable()
Enable Extension Override this to catch when the extension is enabledReturn our dataFolder based upon the extension nameReturn our Event ManagerList<EventHandler<?>>
getName()
getResourceAsStream(String name)
Return an InputStream for a resource file<T extends GeyserEvent>
ExtensionLambdaEventHandler<T>on(Class<T> cls, BiConsumer<T,EventHandler<T>> consumer)
<T extends GeyserEvent>
ExtensionLambdaEventHandler<T>Create a new EventHandler using a lambda<T extends GeyserEvent>
voidregister(EventHandler<T> handler)
Register an event handlervoid
registerEvents(Object obj)
Register all Events contained in an instantiated class.<T extends GeyserEvent>
voidunregister(EventHandler<T> handler)
Unregister an event handlervoid
Unregister all events for a extension
-
Constructor Details
-
GeyserExtension
public GeyserExtension(ExtensionManager extensionManager, ExtensionClassLoader extensionClassLoader)
-
-
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 awaitconsumer
- code to execute- Returns:
- The event handler
-
on
public <T extends GeyserEvent> ExtensionLambdaEventHandler<T> on(Class<T> cls, BiConsumer<T,EventHandler<T>> consumer) -
register
Register an event handler- Type Parameters:
T
- Event class- Parameters:
handler
- EventHandler to register
-
unregister
Unregister an event handler- Type Parameters:
T
- Event class- Parameters:
handler
- EventHandler to unregister
-
registerEvents
Register all Events contained in an instantiated class. The methods must be annotated byGeyserEventHandler
- 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
-
getName
-
getDescription
-
getVersion
-
getEventManager
Return our Event Manager- Returns:
- Event Manager
-
getDataFolder
Return our dataFolder based upon the extension name- Returns:
- File to datafolder
-
getResourceAsStream
Return an InputStream for a resource file- Parameters:
name
- Name of file- Returns:
- InputStream to resource or null
-
getExtensionEventHandlers
-
getExtensionManager
-
getExtensionClassLoader
-
getLogger
-