Interface PlatformInjector<C>
public interface PlatformInjector<C>
The global interface of all the Platform Injectors. The injector can be used for various things.
It is used internally for getting Floodgate data out of the handshake packet and for debug mode,
but there is also an option to add your own addons. Note that every Floodgate platform that
supports netty should implement this, but the platform implementation isn't required to implement
this.
-
Method Summary
Modifier and TypeMethodDescriptionvoidaddAddon(InjectorAddon<C> addon) Adds an addon to the addon list of the Floodgate Injector (the addon is called when Floodgate injects a channel).default booleanSome platforms may not be able to remove their injection process.voidinject()Injects the server connection.booleanIf the server connection is currently injected.<T extends InjectorAddon<C>>
TremoveAddon(Class<T> addon) Removes an addon from the addon list of the Floodgate Injector (the addon is called when Floodgate injects a channel).voidRemoves the injection from the server.
-
Method Details
-
inject
Injects the server connection. This will allow various addons (like getting the Floodgate data and debug mode) to work.- Throws:
Exception- if the platform couldn't be injected
-
canRemoveInjection
default boolean canRemoveInjection()Some platforms may not be able to remove their injection process. If so, this method will return false.- Returns:
- true if it is safe to attempt to remove our injection performed in
inject().
-
removeInjection
Removes the injection from the server. Please note that this function should only be used internally (on plugin shutdown). This method will also remove every added addon.- Throws:
Exception- if the platform injection could not be removed
-
isInjected
boolean isInjected()If the server connection is currently injected.- Returns:
- true if the server connection is currently injected, returns false otherwise
-
addAddon
Adds an addon to the addon list of the Floodgate Injector (the addon is called when Floodgate injects a channel). SeeInjectorAddonfor more info.- Parameters:
addon- the addon to add to the addon list
-
removeAddon
Removes an addon from the addon list of the Floodgate Injector (the addon is called when Floodgate injects a channel). SeeInjectorAddonfor more info.- Type Parameters:
T- the addon type- Parameters:
addon- the class of the addon to remove from the addon list- Returns:
- the removed addon instance
-