# Example Hytale Plugin This is an example Hytale server plugin demonstrating the basic structure and setup. ## Project Structure ``` example-mod/ ├── app/ │ ├── src/ │ │ ├── main/ │ │ │ ├── java/org/example/ │ │ │ │ └── ExamplePlugin.java │ │ │ └── resources/ │ │ │ └── plugin.json │ │ └── test/ │ ├── build.gradle.kts ├── gradle/ ├── server/ ├── build.gradle.kts ├── settings.gradle.kts └── gradlew / gradlew.bat ``` ## Setup ### Pre-setup ```bash # Download the hytale-downloader & cfr (DO IT ONCE) ./setup --download ``` ### Setup ```bash # Download the HytaleServer, finally located here ./server/HytaleServer.jar ./setup --setup ``` ### Decompile ```bash # Decompile ./server/HytaleServer.jar to get the source, finally located here ./src-ref ./setup --decompile ``` ## Building ```bash # Build the plugin ./gradlew build # The JAR will be in app/build/libs/ExamplePlugin-1.0.0.jar ``` ## Installation 1. Build the plugin with `./gradlew build` 2. Copy `app/build/libs/ExamplePlugin-1.0.0.jar` to your Hytale server's `mods/` folder 3. Start the server ## Plugin Structure ### manifest.json The plugin manifest file defines metadata about your plugin: ```json { "Group": "org.example", "Name": "ExamplePlugin", "Version": "1.0.0", "Description": "An example Hytale server plugin", "Authors": [ { "Name": "Your Name" } ], "Main": "org.example.ExamplePlugin", "ServerVersion": "*", "Dependencies": {}, "OptionalDependencies": {}, "DisabledByDefault": false, "IncludesAssetPack": false, "SubPlugins": [] } ``` ### Main Plugin Class Your plugin class extends `JavaPlugin` and implements lifecycle methods: - `setup()` - Called during server setup, register configs here - `start()` - Called when plugin starts, register commands/events here - `shutdown()` - Called when plugin stops, cleanup resources here ## Requirements - Java 25 or later