diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..b2eea27 --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/.idea/workspace.xml b/.idea/workspace.xml new file mode 100644 index 0000000..5a386dc --- /dev/null +++ b/.idea/workspace.xml @@ -0,0 +1,105 @@ + + + + + + + + + + + + + { + "associatedIndex": 0 +} + + + + + + + { + "keyToString": { + "ModuleVcsDetector.initialDetectionPerformed": "true", + "RunOnceActivity.ShowReadmeOnStart": "true", + "RunOnceActivity.git.unshallow": "true", + "SHARE_PROJECT_CONFIGURATION_FILES": "true", + "git-widget-placeholder": "main", + "kotlin-language-version-configured": "true", + "last_opened_file_path": "/home/neil/IdeaProjects/ExamplePlugin", + "node.js.detected.package.eslint": "true", + "node.js.detected.package.tslint": "true", + "node.js.selected.package.eslint": "(autodetect)", + "node.js.selected.package.tslint": "(autodetect)", + "nodejs_package_manager_path": "npm", + "onboarding.tips.debug.path": "/home/neil/IdeaProjects/ExamplePlugin/src/main/java/dev/hytalemodding/Main.java", + "project.structure.last.edited": "Libraries", + "project.structure.proportion": "0.15", + "project.structure.side.proportion": "0.0", + "settings.editor.selected.configurable": "preferences.customizations", + "vue.rearranger.settings.migration": "true" + } +} + + + + + + + + + + + + + + + + 1768315349216 + + + + + + + + + + file://$PROJECT_DIR$/src/main/java/dev/hytalemodding/ExamplePlugin.java + 13 + + + + + + + + + + + \ No newline at end of file diff --git a/src/main/java/dev/hytalemodding/ExamplePlugin.java b/src/main/java/dev/hytalemodding/ExamplePlugin.java index 02065e4..4a5c988 100644 --- a/src/main/java/dev/hytalemodding/ExamplePlugin.java +++ b/src/main/java/dev/hytalemodding/ExamplePlugin.java @@ -1,8 +1,10 @@ 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 dev.hytalemodding.commands.ExampleCommand; +import dev.hytalemodding.events.ExampleEvent; import javax.annotation.Nonnull; @@ -15,6 +17,7 @@ public class ExamplePlugin extends JavaPlugin { @Override protected void setup() { this.getCommandRegistry().registerCommand(new ExampleCommand("example", "An example command")); + this.getEventRegistry().registerGlobal(PlayerReadyEvent.class, ExampleEvent::onPlayerReady); } @Override diff --git a/src/main/java/dev/hytalemodding/events/ExampleEvent.java b/src/main/java/dev/hytalemodding/events/ExampleEvent.java new file mode 100644 index 0000000..c156966 --- /dev/null +++ b/src/main/java/dev/hytalemodding/events/ExampleEvent.java @@ -0,0 +1,14 @@ +package dev.hytalemodding.events; + +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; + +public class ExampleEvent { + + public static void onPlayerReady(PlayerReadyEvent event) { + Player player = event.getPlayer(); + player.sendMessage(Message.raw("Welcome " + player.getDisplayName())); + } + +} \ No newline at end of file