Merge branch 'main' of https://github.com/Avellea/hytale-template-plugin into Avellea-main
This commit is contained in:
34
.gitignore
vendored
34
.gitignore
vendored
@@ -1,14 +1,15 @@
|
||||
### Gradle ###
|
||||
.gradle
|
||||
# Gradle
|
||||
.gradle/
|
||||
build/
|
||||
!gradle/wrapper/gradle-wrapper.jar
|
||||
!**/src/main/**/build/
|
||||
!**/src/test/**/build/
|
||||
.kotlin/
|
||||
|
||||
### Hytale ###
|
||||
# Server testing directory
|
||||
run/
|
||||
|
||||
### IntelliJ IDEA ###
|
||||
# IntelliJ IDEA
|
||||
.idea/
|
||||
*.iws
|
||||
*.iml
|
||||
@@ -17,7 +18,7 @@ out/
|
||||
!**/src/main/**/out/
|
||||
!**/src/test/**/out/
|
||||
|
||||
### Eclipse ###
|
||||
# Eclipse
|
||||
.apt_generated
|
||||
.classpath
|
||||
.factorypath
|
||||
@@ -29,15 +30,32 @@ bin/
|
||||
!**/src/main/**/bin/
|
||||
!**/src/test/**/bin/
|
||||
|
||||
### NetBeans ###
|
||||
# NetBeans
|
||||
/nbproject/private/
|
||||
/nbbuild/
|
||||
/dist/
|
||||
/nbdist/
|
||||
/.nb-gradle/
|
||||
|
||||
### VS Code ###
|
||||
# VS Code
|
||||
.vscode/
|
||||
|
||||
### Mac OS ###
|
||||
# Mac OS
|
||||
.DS_Store
|
||||
|
||||
# Windows
|
||||
Thumbs.db
|
||||
desktop.ini
|
||||
|
||||
# Logs
|
||||
*.log
|
||||
|
||||
# Temporary files
|
||||
*.tmp
|
||||
*.bak
|
||||
*.swp
|
||||
*~
|
||||
|
||||
# Template specific
|
||||
libs/HytaleServer.jar
|
||||
buildSrc/
|
||||
80
build.gradle.kts
Normal file
80
build.gradle.kts
Normal file
@@ -0,0 +1,80 @@
|
||||
plugins {
|
||||
id("java-library")
|
||||
id("com.gradleup.shadow") version "9.3.1"
|
||||
}
|
||||
|
||||
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")
|
||||
}
|
||||
|
||||
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))
|
||||
}
|
||||
}
|
||||
0
libs/.gitkeep
Normal file
0
libs/.gitkeep
Normal file
88
src/main/java/com/example/templateplugin/TemplatePlugin.java
Normal file
88
src/main/java/com/example/templateplugin/TemplatePlugin.java
Normal file
@@ -0,0 +1,88 @@
|
||||
package com.example.templateplugin;
|
||||
|
||||
import com.hypixel.hytale.server.core.plugin.JavaPlugin;
|
||||
import com.hypixel.hytale.server.core.plugin.JavaPluginInit;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.logging.Level;
|
||||
|
||||
/**
|
||||
* Main plugin class.
|
||||
*
|
||||
* TODO: Implement your plugin logic here.
|
||||
*
|
||||
* @author YourName
|
||||
* @version 1.0.0
|
||||
*/
|
||||
public class TemplatePlugin extends JavaPlugin {
|
||||
|
||||
private static TemplatePlugin instance;
|
||||
|
||||
/**
|
||||
* Constructor - Called when plugin is loaded.
|
||||
*/
|
||||
public TemplatePlugin(@Nonnull JavaPluginInit init) {
|
||||
super(init);
|
||||
instance = this;
|
||||
getLogger().at(Level.INFO).log("[TemplatePlugin] Plugin loaded!");
|
||||
}
|
||||
|
||||
/**
|
||||
* Get plugin instance.
|
||||
*/
|
||||
public static TemplatePlugin getInstance() {
|
||||
return instance;
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when plugin is set up.
|
||||
*/
|
||||
@Override
|
||||
protected void setup() {
|
||||
getLogger().at(Level.INFO).log("[TemplatePlugin] Plugin setup!");
|
||||
|
||||
// TODO: Initialize your plugin here
|
||||
// - Load configuration
|
||||
// - Register event listeners
|
||||
// - Register commands
|
||||
// - Start services
|
||||
registerEvents();
|
||||
registerCommands();
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when plugin is enabled.
|
||||
*/
|
||||
@Override
|
||||
protected void start() {
|
||||
getLogger().at(Level.INFO).log("[TemplatePlugin] Plugin enabled!");
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when plugin is disabled.
|
||||
*/
|
||||
@Override
|
||||
public void shutdown() {
|
||||
getLogger().at(Level.INFO).log("[TemplatePlugin] Plugin disabled!");
|
||||
|
||||
// TODO: Cleanup your plugin here
|
||||
// - Save data
|
||||
// - Stop services
|
||||
// - Close connections
|
||||
}
|
||||
|
||||
/**
|
||||
* Register your commands here.
|
||||
*/
|
||||
private void registerEvents() {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Register your commands here.
|
||||
*/
|
||||
private void registerCommands() {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user