Compare commits

..

11 Commits

Author SHA1 Message Date
Neil
b7d12fde4d Merge pull request #23 from AzureDoom/azuredoom-plugin
Some checks failed
Verifying Everything Compiles / build (push) Has been cancelled
Fixes for VSCode and Jar Name not updating when building
2026-06-19 23:03:15 +05:30
AzureDoom
887468221e Fix: Changing mod_name not updating build jar. 2026-06-19 13:21:06 -04:00
AzureDoom
0d554ed8f3 Fix: Ignore .vscode 2026-06-19 13:20:38 -04:00
Neil
7ce4389085 feat: Adds branch for Hytale-Tools plugin example (#21) 2026-06-08 23:39:18 +05:30
AzureDoom
6985b56930 Adds missing imports (I blame Neil :P) 2026-06-08 14:06:12 -04:00
AzureDoom
8476b14e4e Merge branch 'HytaleModding:main' into azuredoom-plugin 2026-06-08 14:03:13 -04:00
AzureDoom
b7a10d305b Adds an example github action that confirms the mod is building and working. 2026-06-08 14:02:34 -04:00
AzureDoom
3a5f053940 Revert "Update ExampleEvent for changes needed to work latest version"
This reverts commit 314ff77855.
2026-06-08 09:30:54 -04:00
AzureDoom
f0f2476f06 Add example of config as well 2026-06-08 09:28:46 -04:00
AzureDoom
314ff77855 Update ExampleEvent for changes needed to work latest version 2026-06-08 09:28:32 -04:00
Neil
bb19417b47 chore: update to 0.5.0 2026-06-08 02:44:50 +05:30
6 changed files with 80 additions and 5 deletions

22
.github/workflows/gradle.yml vendored Normal file
View File

@@ -0,0 +1,22 @@
name: Verifying Everything Compiles
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@v6
- name: Set up JDK 25
uses: actions/setup-java@v5
with:
java-version: '25'
distribution: 'temurin'
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v5
- name: Verify build is not broken
run: ./gradlew build

1
.gitignore vendored
View File

@@ -9,3 +9,4 @@ run/
.classpath
.project
.settings/
.vscode

View File

@@ -41,6 +41,11 @@ repositories {
mavenCentral()
}
tasks.named<Jar>("jar") {
archiveBaseName.set(project.property("mod_name").toString())
archiveVersion.set(project.property("version").toString())
}
// Uncomment if you are using IntelliJ.
// idea {
// module {

View File

@@ -3,20 +3,32 @@ package dev.hytalemodding;
import com.hypixel.hytale.server.core.event.events.player.PlayerReadyEvent;
import com.hypixel.hytale.server.core.plugin.JavaPlugin;
import com.hypixel.hytale.server.core.plugin.JavaPluginInit;
import com.hypixel.hytale.server.core.util.Config;
import dev.hytalemodding.commands.ExampleCommand;
import dev.hytalemodding.config.ExampleConfig;
import dev.hytalemodding.events.ExampleEvent;
import javax.annotation.Nonnull;
public class ExamplePlugin extends JavaPlugin {
private static Config<ExampleConfig> config = null;
public ExamplePlugin(@Nonnull JavaPluginInit init) {
super(init);
config = this.withConfig("example_config", ExampleConfig.CODEC);
}
@Override
protected void setup() {
config.save();
this.getCommandRegistry().registerCommand(new ExampleCommand("example", "An example command"));
if (getConfig().get().isEnabledWelcomeMessage()) {
this.getEventRegistry().registerGlobal(PlayerReadyEvent.class, ExampleEvent::onPlayerReady);
}
}
public static Config<ExampleConfig> getConfig() {
return config;
}
}

View File

@@ -0,0 +1,25 @@
package dev.hytalemodding.config;
import com.hypixel.hytale.codec.Codec;
import com.hypixel.hytale.codec.KeyedCodec;
import com.hypixel.hytale.codec.builder.BuilderCodec;
public class ExampleConfig {
public static final BuilderCodec<ExampleConfig> CODEC = BuilderCodec.builder(ExampleConfig.class, ExampleConfig::new)
.append(
new KeyedCodec<>("EnableWelcomeMessage", Codec.BOOLEAN),
(exConfig, aBoolean, extraInfo) -> exConfig.enabledWelcomeMessage = aBoolean,
(exConfig, extraInfo) -> exConfig.enabledWelcomeMessage
)
.add()
.build();
private boolean enabledWelcomeMessage;
private ExampleConfig() {}
public boolean isEnabledWelcomeMessage() {
return enabledWelcomeMessage;
}
}

View File

@@ -1,14 +1,24 @@
package dev.hytalemodding.events;
import com.hypixel.hytale.component.Ref;
import com.hypixel.hytale.component.Store;
import com.hypixel.hytale.server.core.Message;
import com.hypixel.hytale.server.core.entity.entities.Player;
import com.hypixel.hytale.server.core.event.events.player.PlayerReadyEvent;
import com.hypixel.hytale.server.core.universe.PlayerRef;
import com.hypixel.hytale.server.core.universe.world.storage.EntityStore;
public class ExampleEvent {
public static void onPlayerReady(PlayerReadyEvent event) {
Player player = event.getPlayer();
player.sendMessage(Message.raw("Welcome " + player.getDisplayName()));
Ref<EntityStore> ref = event.getPlayerRef();
if (ref.isValid()) {
Store<EntityStore> store = ref.getStore();
PlayerRef playerRef = store.getComponent(ref, PlayerRef.getComponentType());
if (playerRef != null) {
playerRef.sendMessage(Message.raw("Welcome " + playerRef.getUsername()));
}
}
}
}