Merge upstream Changes #2
20
README.md
20
README.md
@@ -6,7 +6,7 @@ A minimal, ready-to-use template for creating Hytale plugins with modern build t
|
|||||||
|
|
||||||
## Features
|
## Features
|
||||||
|
|
||||||
✅ **Modern Build System** - Gradle with Kotlin DSL
|
✅ **Modern Build System** - Gradle with Groovy DSL
|
||||||
✅ **Automated Testing** - Custom Gradle plugin for one-command server testing
|
✅ **Automated Testing** - Custom Gradle plugin for one-command server testing
|
||||||
✅ **Java 25** - Latest Java features
|
✅ **Java 25** - Latest Java features
|
||||||
✅ **ShadowJar** - Automatic dependency bundling
|
✅ **ShadowJar** - Automatic dependency bundling
|
||||||
@@ -51,9 +51,9 @@ Your plugin JAR will be in: `build/libs/TemplatePlugin-1.0.0.jar`
|
|||||||
|
|
||||||
When ready to customize, edit these files:
|
When ready to customize, edit these files:
|
||||||
|
|
||||||
**`settings.gradle.kts`:**
|
**`settings.gradle`:**
|
||||||
|
|
||||||
```kotlin
|
```groovy
|
||||||
rootProject.name = "your-plugin-name"
|
rootProject.name = "your-plugin-name"
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -139,9 +139,9 @@ TemplatePlugin/
|
|||||||
│ └── resources/
|
│ └── resources/
|
||||||
│ └── manifest.json # Plugin metadata
|
│ └── manifest.json # Plugin metadata
|
||||||
├── .gitignore # Git ignore rules
|
├── .gitignore # Git ignore rules
|
||||||
├── build.gradle.kts # Build configuration
|
├── build.gradle # Build configuration
|
||||||
├── gradle.properties # Project properties
|
├── gradle.properties # Project properties
|
||||||
├── settings.gradle.kts # Project settings
|
├── settings.gradle # Project settings
|
||||||
├── LICENSE # MIT License
|
├── LICENSE # MIT License
|
||||||
└── README.md # This file
|
└── README.md # This file
|
||||||
```
|
```
|
||||||
@@ -200,9 +200,9 @@ rm -rf run/
|
|||||||
|
|
||||||
### Adding Dependencies
|
### Adding Dependencies
|
||||||
|
|
||||||
Edit `build.gradle.kts`:
|
Edit `build.gradle`:
|
||||||
|
|
||||||
```kotlin
|
```groovy
|
||||||
dependencies {
|
dependencies {
|
||||||
// Hytale API (provided by server)
|
// Hytale API (provided by server)
|
||||||
compileOnly(files("./HytaleServer.jar"))
|
compileOnly(files("./HytaleServer.jar"))
|
||||||
@@ -221,9 +221,9 @@ dependencies {
|
|||||||
|
|
||||||
**Usage:**
|
**Usage:**
|
||||||
|
|
||||||
Edit `build.gradle.kts`:
|
Edit `build.gradle`:
|
||||||
|
|
||||||
```kotlin
|
```groovy
|
||||||
runHytale {
|
runHytale {
|
||||||
jarUrl = "url to hytale server jar"
|
jarUrl = "url to hytale server jar"
|
||||||
}
|
}
|
||||||
@@ -322,7 +322,7 @@ GitHub Actions will automatically build and create a release with your plugin JA
|
|||||||
|
|
||||||
### Server Won't Start
|
### Server Won't Start
|
||||||
|
|
||||||
1. Check that `jarUrl` in `build.gradle.kts` is correct
|
1. Check that `jarUrl` in `build.gradle` is correct
|
||||||
2. Verify Java 25 is installed: `java -version`
|
2. Verify Java 25 is installed: `java -version`
|
||||||
3. Check logs in `run/logs/`
|
3. Check logs in `run/logs/`
|
||||||
|
|
||||||
|
|||||||
27
build.gradle
27
build.gradle
@@ -121,6 +121,33 @@ if (hasHytaleHome) {
|
|||||||
return programParameters
|
return programParameters
|
||||||
}
|
}
|
||||||
|
|
||||||
|
def serverJar = file("$hytaleHome/install/$patchline/package/game/latest/Server/HytaleServer.jar")
|
||||||
|
def assetsZip = file("$hytaleHome/install/$patchline/package/game/latest/Assets.zip")
|
||||||
|
def shadowJarTask = tasks.named('shadowJar')
|
||||||
|
|
||||||
|
tasks.register('runServerJar', JavaExec) {
|
||||||
|
dependsOn shadowJarTask
|
||||||
|
mainClass = 'com.hypixel.hytale.Main'
|
||||||
|
classpath = files(serverJar)
|
||||||
|
workingDir = serverRunDir.absolutePath
|
||||||
|
doFirst {
|
||||||
|
def modPaths = [shadowJarTask.get().archiveFile.get().asFile.absolutePath]
|
||||||
|
if (load_user_mods.toBoolean()) {
|
||||||
|
modPaths << "${hytaleHome}/UserData/Mods"
|
||||||
|
}
|
||||||
|
setArgs([
|
||||||
|
'--allow-op',
|
||||||
|
'--disable-sentry',
|
||||||
|
"--assets=${assetsZip}",
|
||||||
|
"--mods=${modPaths.join(',')}"
|
||||||
|
])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
tasks.register('runServer') {
|
||||||
|
dependsOn 'runServerJar'
|
||||||
|
}
|
||||||
|
|
||||||
// Creates a run configuration in IDEA that will run the Hytale server with
|
// Creates a run configuration in IDEA that will run the Hytale server with
|
||||||
// your plugin and the default assets.
|
// your plugin and the default assets.
|
||||||
idea.project.settings.runConfigurations {
|
idea.project.settings.runConfigurations {
|
||||||
|
|||||||
@@ -1,87 +0,0 @@
|
|||||||
plugins {
|
|
||||||
id("java-library")
|
|
||||||
id("com.gradleup.shadow") version "9.3.1"
|
|
||||||
id("run-hytale")
|
|
||||||
}
|
|
||||||
|
|
||||||
group = findProperty("pluginGroup") as String? ?: "com.example"
|
|
||||||
version = findProperty("pluginVersion") as String? ?: "1.0.0"
|
|
||||||
description = findProperty("pluginDescription") as String? ?: "A Hytale plugin template"
|
|
||||||
|
|
||||||
repositories {
|
|
||||||
mavenLocal()
|
|
||||||
mavenCentral()
|
|
||||||
}
|
|
||||||
|
|
||||||
dependencies {
|
|
||||||
// Hytale Server API (provided by server at runtime)
|
|
||||||
compileOnly(files("./libs/HytaleServer.jar"))
|
|
||||||
|
|
||||||
// Common dependencies (will be bundled in JAR)
|
|
||||||
implementation("com.google.code.gson:gson:2.10.1")
|
|
||||||
implementation("org.jetbrains:annotations:24.1.0")
|
|
||||||
|
|
||||||
// Test dependencies
|
|
||||||
testImplementation("org.junit.jupiter:junit-jupiter:5.10.0")
|
|
||||||
testRuntimeOnly("org.junit.platform:junit-platform-launcher")
|
|
||||||
}
|
|
||||||
|
|
||||||
// Configure server testing
|
|
||||||
runHytale {
|
|
||||||
jarUrl = "./libs/HytaleServer.jar"
|
|
||||||
assetsPath = "./libs/Assets.zip"
|
|
||||||
}
|
|
||||||
|
|
||||||
tasks {
|
|
||||||
// Configure Java compilation
|
|
||||||
compileJava {
|
|
||||||
options.encoding = Charsets.UTF_8.name()
|
|
||||||
options.release = 25
|
|
||||||
}
|
|
||||||
|
|
||||||
// Configure resource processing
|
|
||||||
processResources {
|
|
||||||
filteringCharset = Charsets.UTF_8.name()
|
|
||||||
|
|
||||||
// Replace placeholders in manifest.json
|
|
||||||
val props = mapOf(
|
|
||||||
"group" to project.group,
|
|
||||||
"version" to project.version,
|
|
||||||
"description" to project.description
|
|
||||||
)
|
|
||||||
inputs.properties(props)
|
|
||||||
|
|
||||||
filesMatching("manifest.json") {
|
|
||||||
expand(props)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Configure ShadowJar (bundle dependencies)
|
|
||||||
shadowJar {
|
|
||||||
archiveBaseName.set(rootProject.name)
|
|
||||||
archiveClassifier.set("")
|
|
||||||
|
|
||||||
// Relocate dependencies to avoid conflicts
|
|
||||||
relocate("com.google.gson", "com.yourplugin.libs.gson")
|
|
||||||
|
|
||||||
// Minimize JAR size (removes unused classes)
|
|
||||||
minimize()
|
|
||||||
}
|
|
||||||
|
|
||||||
// Configure tests
|
|
||||||
test {
|
|
||||||
useJUnitPlatform()
|
|
||||||
}
|
|
||||||
|
|
||||||
// Make build depend on shadowJar
|
|
||||||
build {
|
|
||||||
dependsOn(shadowJar)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Configure Java toolchain
|
|
||||||
java {
|
|
||||||
toolchain {
|
|
||||||
languageVersion.set(JavaLanguageVersion.of(25))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"Group": "Example",
|
"Group": "Example",
|
||||||
"Name": "ExamplePlugin",
|
"Name": "ExamplePlugin",
|
||||||
"Version": "0.0.2",
|
"Version": "0.0.3",
|
||||||
"Description": "An example plugin for HyTale!",
|
"Description": "An example plugin for HyTale!",
|
||||||
"Authors": [
|
"Authors": [
|
||||||
{
|
{
|
||||||
@@ -9,7 +9,7 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"Website": "example.org",
|
"Website": "example.org",
|
||||||
"ServerVersion": "*",
|
"ServerVersion": "2026.02.17-255364b8e",
|
||||||
"Dependencies": {
|
"Dependencies": {
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user