Interface PlatformInjector


public interface PlatformInjector
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 Type
    Method
    Description
    boolean
    Adds an addon to the addon list of the Floodgate Injector (the addon is called when Floodgate injects a channel).
    default boolean
    Some platforms may not be able to remove their injection process.
    void
    Injects the server connection.
    boolean
    If the server connection is currently injected.
    <T extends InjectorAddon>
    T
    removeAddon(Class<T> addon)
    Removes an addon from the addon list of the Floodgate Injector (the addon is called when Floodgate injects a channel).
    void
    Removes the injection from the server.
  • Method Details

    • inject

      void inject() throws Exception
      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

      void removeInjection() throws Exception
      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

      boolean addAddon(InjectorAddon addon)
      Adds an addon to the addon list of the Floodgate Injector (the addon is called when Floodgate injects a channel). See InjectorAddon for more info.
      Parameters:
      addon - the addon to add to the addon list
      Returns:
      true if the addon has been added, false if the addon is already present
    • removeAddon

      <T extends InjectorAddon> T removeAddon(Class<T> addon)
      Removes an addon from the addon list of the Floodgate Injector (the addon is called when Floodgate injects a channel). See InjectorAddon for 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