Class SimplePlugin

java.lang.Object
com.hypixel.hytale.server.core.plugin.PluginBase
com.hypixel.hytale.server.core.plugin.JavaPlugin
fr.hytale.loader.plugin.SimplePlugin
All Implemented Interfaces:
com.hypixel.hytale.server.core.command.system.CommandOwner, SimpleListener

public abstract class SimplePlugin extends com.hypixel.hytale.server.core.plugin.JavaPlugin implements SimpleListener
Base class for HytaleLoader plugins.

This class provides a simplified API for creating Hytale server mods. It automatically handles event registration, command registration, and provides lifecycle hooks through onEnable() and onDisable().

Since:
1.0.0
Version:
1.0.4
Author:
HytaleLoader
  • Field Summary

    Fields inherited from class com.hypixel.hytale.server.core.plugin.PluginBase

    METRICS_REGISTRY
  • Constructor Summary

    Constructors
    Constructor
    Description
    SimplePlugin(com.hypixel.hytale.server.core.plugin.JavaPluginInit init)
    Constructs a new SimplePlugin instance.
  • Method Summary

    Modifier and Type
    Method
    Description
    Gets the plugin's configuration.
    Gets the preferred configuration format.
    Gets the plugin's data folder.
    Gets the scheduler for this plugin.
    abstract void
    Called when the plugin is disabled.
    abstract void
    Called when the plugin is enabled.
    void
    registerCommand(Object commandContainer)
     
    void
     
    void
    Reloads the plugin's configuration from disk.
    void
    Saves the plugin's configuration to disk.
    void
    Saves the default config from resources.
    protected void
     
    protected void
     

    Methods inherited from class com.hypixel.hytale.server.core.plugin.JavaPlugin

    getClassLoader, getFile, getType, start0

    Methods inherited from class com.hypixel.hytale.server.core.plugin.PluginBase

    getAssetRegistry, getBasePermission, getBlockStateRegistry, getChunkStoreRegistry, getClientFeatureRegistry, getCodecRegistry, getCodecRegistry, getCodecRegistry, getCommandRegistry, getDataDirectory, getEntityRegistry, getEntityStoreRegistry, getEventRegistry, getIdentifier, getLogger, getManifest, getName, getState, getTaskRegistry, isDisabled, isEnabled, preLoad, setup, setup0, shutdown0, withConfig, withConfig

    Methods inherited from class Object

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

    • SimplePlugin

      public SimplePlugin(com.hypixel.hytale.server.core.plugin.JavaPluginInit init)
      Constructs a new SimplePlugin instance.
      Parameters:
      init - the plugin initialization data provided by the Hytale server
  • Method Details

    • start

      protected void start()
      Overrides:
      start in class com.hypixel.hytale.server.core.plugin.PluginBase
    • shutdown

      protected void shutdown()
      Overrides:
      shutdown in class com.hypixel.hytale.server.core.plugin.PluginBase
    • onEnable

      public abstract void onEnable()
      Called when the plugin is enabled.

      Override this method to perform initialization tasks when your plugin starts.

    • onDisable

      public abstract void onDisable()
      Called when the plugin is disabled.

      Override this method to perform cleanup tasks when your plugin stops.

    • registerListener

      public void registerListener(SimpleListener listener)
    • registerCommand

      public void registerCommand(Object commandContainer)
    • getScheduler

      public Scheduler getScheduler()
      Gets the scheduler for this plugin.

      The scheduler can be used to run tasks asynchronously, with delays, or repeatedly.

      Returns:
      the plugin's scheduler
    • getConfigFormat

      public ConfigFormat getConfigFormat()
      Gets the preferred configuration format. Override this to use JSON instead of YAML.
      Returns:
      the config format (default: YAML)
    • getConfig

      public Config getConfig()
      Gets the plugin's configuration.

      The config file is automatically loaded from the plugin's data folder. If the file doesn't exist, it will be created on first save.

      Returns:
      the plugin's config
    • saveConfig

      public void saveConfig() throws IOException
      Saves the plugin's configuration to disk.
      Throws:
      IOException - if save fails
    • reloadConfig

      public void reloadConfig() throws IOException
      Reloads the plugin's configuration from disk.
      Throws:
      IOException - if reload fails
    • saveDefaultConfig

      public void saveDefaultConfig()
      Saves the default config from resources. This is useful for creating a config template on first run.
    • getDataFolder

      public File getDataFolder()
      Gets the plugin's data folder. Creates it if it doesn't exist.
      Returns:
      the data folder