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
ConstructorsConstructorDescriptionSimplePlugin(com.hypixel.hytale.server.core.plugin.JavaPluginInit init) Constructs a new SimplePlugin instance. -
Method Summary
Modifier and TypeMethodDescriptionGets the plugin's configuration.Gets the preferred configuration format.Gets the plugin's data folder.Gets the scheduler for this plugin.abstract voidCalled when the plugin is disabled.abstract voidonEnable()Called when the plugin is enabled.voidregisterCommand(Object commandContainer) voidregisterListener(SimpleListener listener) voidReloads the plugin's configuration from disk.voidSaves the plugin's configuration to disk.voidSaves the default config from resources.protected voidshutdown()protected voidstart()Methods inherited from class com.hypixel.hytale.server.core.plugin.JavaPlugin
getClassLoader, getFile, getType, start0Methods 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
-
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:
startin classcom.hypixel.hytale.server.core.plugin.PluginBase
-
shutdown
protected void shutdown()- Overrides:
shutdownin classcom.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
-
registerCommand
-
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
Gets the preferred configuration format. Override this to use JSON instead of YAML.- Returns:
- the config format (default: YAML)
-
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
Saves the plugin's configuration to disk.- Throws:
IOException- if save fails
-
reloadConfig
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
Gets the plugin's data folder. Creates it if it doesn't exist.- Returns:
- the data folder
-