Record Class InstancedPluginAPI

java.lang.Object
java.lang.Record
com.zenith.plugin.api.InstancedPluginAPI
All Implemented Interfaces:
PluginAPI

public record InstancedPluginAPI(ZenithProxyPlugin pluginInstance, PluginInfo pluginInfo) extends Record implements PluginAPI
  • Constructor Details

    • InstancedPluginAPI

      public InstancedPluginAPI(ZenithProxyPlugin pluginInstance, PluginInfo pluginInfo)
      Creates an instance of a InstancedPluginAPI record class.
      Parameters:
      pluginInstance - the value for the pluginInstance record component
      pluginInfo - the value for the pluginInfo record component
  • Method Details

    • registerConfig

      public <T> T registerConfig(String fileName, Class<T> configClass)
      Description copied from interface: PluginAPI
      Initializes and loads a configuration file for your plugin.
      Specified by:
      registerConfig in interface PluginAPI
      Parameters:
      fileName - The name of the file to save and load. Example: "example-config" would have its config at: "plugins/config/example-config.json"
      configClass - The configuration POJO class that is saved and loaded
      Returns:
      Configuration instance. This instance must be used for access and modifications to the configuration. If no configuration file exists yet, a new instance will still be created and returned.
    • registerModule

      public void registerModule(Module module)
      Description copied from interface: PluginAPI
      Registers a Module. Modules can listen to events, be toggled on and off, and register packet handlers
      Specified by:
      registerModule in interface PluginAPI
    • registerCommand

      public void registerCommand(Command command)
      Description copied from interface: PluginAPI
      Registers a Command. Commands can be executed in the terminal, by players in-game, and in discord.
      Specified by:
      registerCommand in interface PluginAPI
    • getLogger

      public net.kyori.adventure.text.logger.slf4j.ComponentLogger getLogger()
      Description copied from interface: PluginAPI
      Gets a logger configured for the plugin instance.
      Specified by:
      getLogger in interface PluginAPI
    • getPluginInfo

      public PluginInfo getPluginInfo()
      Description copied from interface: PluginAPI
      Gets the PluginInfo for the plugin instance. This is the data encoded in the @Plugin annotation.
      Specified by:
      getPluginInfo in interface PluginAPI
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • pluginInstance

      public ZenithProxyPlugin pluginInstance()
      Returns the value of the pluginInstance record component.
      Returns:
      the value of the pluginInstance record component
    • pluginInfo

      public PluginInfo pluginInfo()
      Returns the value of the pluginInfo record component.
      Returns:
      the value of the pluginInfo record component