Class ModuleHelper

java.lang.Object
eu.cloudnetservice.driver.impl.module.ModuleHelper

@Singleton @Deprecated public final class ModuleHelper extends Object
Deprecated.
This module helper class provides helper methods for cloudnet modules that also operate as a plugin on the services.
Since:
4.0
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private final eu.cloudnetservice.driver.event.EventManager
    Deprecated.
     
    private static final org.slf4j.Logger
    Deprecated.
     
    private final eu.cloudnetservice.driver.network.NetworkClient
    Deprecated.
     
    private final eu.cloudnetservice.driver.network.rpc.handler.RPCHandlerRegistry
    Deprecated.
     
    private final eu.cloudnetservice.driver.registry.ServiceRegistry
    Deprecated.
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    ModuleHelper(@NonNull eu.cloudnetservice.driver.event.EventManager eventManager, @NonNull eu.cloudnetservice.driver.network.NetworkClient networkClient, @NonNull eu.cloudnetservice.driver.registry.ServiceRegistry serviceRegistry, @NonNull eu.cloudnetservice.driver.network.rpc.handler.RPCHandlerRegistry rpcHandlerRegistry)
    Deprecated.
     
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Deprecated.
    Copies the caller class location from the class path to the given target path.
    void
    copyPluginConfigurationFileForEnvironment(@NonNull Class<?> clazz, @NonNull eu.cloudnetservice.driver.service.ServiceEnvironmentType type, @NonNull Path file)
    Deprecated.
    Copies the appropriate plugin configuration file for the given service environment type.
    void
    Deprecated.
    Unregisters all kind of listeners and bindings: Registered events in the EventManager Registered services in the ServiceRegistry Registered bindings for the DefaultObjectMapper.DEFAULT_MAPPER Registered rpc handlers in the RPCHandlerRegistry Registered packet listeners in the PacketListenerRegistry

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • LOGGER

      private static final org.slf4j.Logger LOGGER
      Deprecated.
    • eventManager

      private final eu.cloudnetservice.driver.event.EventManager eventManager
      Deprecated.
    • networkClient

      private final eu.cloudnetservice.driver.network.NetworkClient networkClient
      Deprecated.
    • serviceRegistry

      private final eu.cloudnetservice.driver.registry.ServiceRegistry serviceRegistry
      Deprecated.
    • rpcHandlerRegistry

      private final eu.cloudnetservice.driver.network.rpc.handler.RPCHandlerRegistry rpcHandlerRegistry
      Deprecated.
  • Constructor Details

    • ModuleHelper

      @Inject public ModuleHelper(@NonNull @NonNull eu.cloudnetservice.driver.event.EventManager eventManager, @NonNull @NonNull eu.cloudnetservice.driver.network.NetworkClient networkClient, @NonNull @NonNull eu.cloudnetservice.driver.registry.ServiceRegistry serviceRegistry, @NonNull @NonNull eu.cloudnetservice.driver.network.rpc.handler.RPCHandlerRegistry rpcHandlerRegistry)
      Deprecated.
  • Method Details

    • copyJarContainingClass

      public boolean copyJarContainingClass(@NonNull @NonNull Class<?> clazz, @NonNull @NonNull Path target)
      Deprecated.
      Copies the caller class location from the class path to the given target path.
      Parameters:
      clazz - the class of which the associated class path entry should get copied.
      target - the target file to copy the file into - the file is not required to exist.
      Returns:
      true if the entry was copied successfully, false otherwise.
      Throws:
      NullPointerException - if clazz or target is null.
    • copyPluginConfigurationFileForEnvironment

      public void copyPluginConfigurationFileForEnvironment(@NonNull @NonNull Class<?> clazz, @NonNull @NonNull eu.cloudnetservice.driver.service.ServiceEnvironmentType type, @NonNull @NonNull Path file)
      Deprecated.
      Copies the appropriate plugin configuration file for the given service environment type. All the listed files will be copied and renamed to plugin.yml:
      • plugin.bungee.yml if the given environment is BUNGEECORD.
      • plugin.waterdogpe.yml if the given environment is WATERDOG_PE.
      • plugin.nukkit.yml if the given environment is NUKKIT.
      • plugin.limboloohp.yml if the given environment is LIMBO_LOOHP.
      • plugin.bukkit.yml is used as a fallback - if the file does not exist it will not be used.
      Parameters:
      clazz - the class of which the associated class path entry should get copied.
      type - the current ServiceEnvironmentType of the service the file gets copied for.
      file - the target file of the plugin to copy the file for.
      Throws:
      NullPointerException - if clazz, type or file is null.
    • unregisterAll

      public void unregisterAll(@NonNull @NonNull ClassLoader classLoader)
      Deprecated.
      Unregisters all kind of listeners and bindings:
      • Registered events in the EventManager
      • Registered services in the ServiceRegistry
      • Registered bindings for the DefaultObjectMapper.DEFAULT_MAPPER
      • Registered rpc handlers in the RPCHandlerRegistry
      • Registered packet listeners in the PacketListenerRegistry
      Parameters:
      classLoader - the class loader that registered all the mentioned listeners and bindings.
      Throws:
      NullPointerException - if the given class loader is null.