From aa682e00ac0863b53d72745b5fb38d3ae7e656b2 Mon Sep 17 00:00:00 2001 From: ShaneBeee Date: Sat, 28 Feb 2026 13:58:45 -0800 Subject: [PATCH] Add a mod version of an addon --- README.md | 52 ++++++++++++++----- build.gradle.kts | 8 +-- .../skriptdev/addon/SampleAddonPlugin.java | 37 +++++++++++++ src/main/resources/manifest.json | 18 +++++-- 4 files changed, 94 insertions(+), 21 deletions(-) create mode 100644 src/main/java/com/github/skriptdev/addon/SampleAddonPlugin.java diff --git a/README.md b/README.md index 8d5cdc3..69c68ce 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,9 @@ # SampleAddon A sample HySkript addon. +This version of the addon is made as a Plugin. +The build will go in your `mods` folder. + You can dig through the code to learn how to make an addon. This addon demonstrates how to create a basic HySkript addon with type registration and syntax registration. @@ -8,36 +11,57 @@ This addon demonstrates how to create a basic HySkript addon with type registrat You can structure your addon however you want. You do however have to make sure to follow the simple steps in the main SampleAddon class to ensure your addon works properly. -## Manifest -The addon manifest is located in `src/main/resources/manifest.json`. -This file tells HySkript how to load your addon. +## Hytale Plugin Manifest +The plugin manifest is located in `src/main/resources/manifest.json`. +This file tells Hytale how to load your plugin. The format is as follows: ```json { - "Main": "com.github.skriptdev.addon.SampleAddon", + "Main": "com.github.skriptdev.addon.SampleAddonPlugin", + "Group": "MyAddon", "Name": "SampleAddon", "Version": "$addonVersion", + "ServerVersion": "$serverVersion", "Description": "A sample addon", "Website": "https://github.com/SkriptDev/SampleAddon", "Authors": [ - "ShaneBee" - ] + { + "Name": "ShaneBee", + "Url": "https://github.com/ShaneBeee" + } + ], + "LoadBefore": { + "skript:HySkript": "*" + }, + "Dependencies": {}, + "OptionalDependencies": {}, + "DisabledByDefault": false, + "IncludesAssetPack": false } ``` -- `Main` = The main class of your addon (Required). -- `Name` = The name of your addon (Required). -- `Version` = The version of your addon (Required). -- `Description` = A short description of your addon [Optional]. -- `Website` = A link to your addon's website [Optional]. -- `Authors` = A list of authors of your addon [Optional]. +- `Main` = The main class of your plugin (Required). +- `Group` = The group of your plugin (Required). +- `Name` = The name of your plugin (Required). +- `Version` = The version of your plugin (Required). +- `ServerVersion` = The version of Hytale your plugin is compatible with [Optional - But is recommended]. +- `Description` = A short description of your plugin [Optional]. +- `Website` = A link to your plugin's website [Optional]. +- `Authors` = A list of authors of your plugin [Optional]. +- `LoadBefore` = A list of plugins that your plugin will load before (you are required to include "skript:HySkript" or your addon may not load correctly) [Optional]. +- `Dependencies` = A list of dependencies for this plugin [Optional]. +- `OptionalDependencies` = A list of optional dependencies for this plugin [Optional]. +- `DisabledByDefault` = Whether this plugin is disabled by default [Optional]. +- `IncludesAssetPack` = Whether this plugin includes an asset pack [Optional]. + +See [HytaleDocs](https://hytale-docs.pages.dev/modding/plugins/plugin-system/#manifest-file) for further information. ## Build -Simply run `./gradlew build` to build your addon. +Simply run `./gradlew build` to build your plugin. It will output a jar file in `build/libs`. ## Usage -To use this addon, place the jar file in your HySkript addons folder and restart your server. +To use this addon, place the jar file in your Hytale mods folder and restart your server. ## License You can use whichever license you want, as long as you follow the terms of the license you choose. diff --git a/build.gradle.kts b/build.gradle.kts index be4f924..bf5bef8 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -8,7 +8,7 @@ group = "com.github.skriptdev" version = "1.0.0" // Version of HyTale you'll build against -val hytaleVersion = "2026.01.29-301e13929" +val hytaleVersion = "2026.02.19-1a311a592" // You can find Hytale versions on their maven repo: // https://maven.hytale.com/release/com/hypixel/hytale/Server/maven-metadata.xml @@ -21,7 +21,7 @@ repositories { } dependencies { - compileOnly("com.github.SkriptDev:HySkript:1.0.0-beta5") // TODO change before release + compileOnly("com.github.SkriptDev:HySkript:dev~addon-loader-SNAPSHOT") // TODO change to 1.3.0 (on release) compileOnly("com.hypixel.hytale:Server:${hytaleVersion}") } @@ -32,13 +32,13 @@ tasks { from("build/libs") { include("SampleAddon-*.jar") // Change this to wherever your server is located - destinationDir = file("/Users/ShaneBee/Desktop/Server/Hytale/Creative/mods/skript_HySkript/addons") + destinationDir = file("/Users/ShaneBee/Desktop/Server/Hytale/Creative/mods/") } } processResources { // This is used to replace the version in your addon's manifest.json file filesNotMatching("assets/**") { - expand("addonVersion" to project.version) + expand("addonVersion" to project.version, "serverVersion" to hytaleVersion) } } } diff --git a/src/main/java/com/github/skriptdev/addon/SampleAddonPlugin.java b/src/main/java/com/github/skriptdev/addon/SampleAddonPlugin.java new file mode 100644 index 0000000..442b45f --- /dev/null +++ b/src/main/java/com/github/skriptdev/addon/SampleAddonPlugin.java @@ -0,0 +1,37 @@ +package com.github.skriptdev.addon; + +import com.github.skriptdev.skript.plugin.Skript; +import com.hypixel.hytale.server.core.plugin.JavaPlugin; +import com.hypixel.hytale.server.core.plugin.JavaPluginInit; + +@SuppressWarnings("unused") +public class SampleAddonPlugin extends JavaPlugin { + + private SampleAddon sampleAddon; + + public SampleAddonPlugin(JavaPluginInit init) { + super(init); + } + + @Override + protected void setup() { + // Do any Hytale mod setup logic here + } + + @Override + protected void start() { + // Register your addon here + if (!Skript.getInstance().isAcceptingRegistrations()) { + // If HySkript has already started, you cannot register + // This shouldn't happen, but it's a safety measure + return; + } + this.sampleAddon = Skript.getInstance().registerAddon(this, SampleAddon.class); + // HySkript will automatically load your addon when the time is right + } + + public SampleAddon getAddon() { + return this.sampleAddon; + } + +} diff --git a/src/main/resources/manifest.json b/src/main/resources/manifest.json index 4664485..c1de7a0 100644 --- a/src/main/resources/manifest.json +++ b/src/main/resources/manifest.json @@ -1,10 +1,22 @@ { - "Main": "com.github.skriptdev.addon.SampleAddon", + "Main": "com.github.skriptdev.addon.SampleAddonPlugin", + "Group": "MyAddon", "Name": "SampleAddon", "Version": "$addonVersion", + "ServerVersion": "$serverVersion", "Description": "A sample addon", "Website": "https://github.com/SkriptDev/SampleAddon", "Authors": [ - "ShaneBee" - ] + { + "Name": "ShaneBee", + "Url": "https://github.com/ShaneBeee" + } + ], + "LoadBefore": { + "skript:HySkript": "*" + }, + "Dependencies": {}, + "OptionalDependencies": {}, + "DisabledByDefault": false, + "IncludesAssetPack": false }