From 808ff6c84e9296dc7d4a14e60c38cb40e09f3b7a Mon Sep 17 00:00:00 2001 From: DieGurke Date: Tue, 17 Nov 2020 17:35:01 +0100 Subject: [PATCH] Basic command structure for setspawnflyarea command --- .../java/dev/kske/spawnfly/SpawnCommand.java | 18 ++++++++++++++++++ src/main/java/dev/kske/spawnfly/SpawnFly.java | 1 + src/main/resources/plugin.yml | 7 +++++-- 3 files changed, 24 insertions(+), 2 deletions(-) create mode 100644 src/main/java/dev/kske/spawnfly/SpawnCommand.java diff --git a/src/main/java/dev/kske/spawnfly/SpawnCommand.java b/src/main/java/dev/kske/spawnfly/SpawnCommand.java new file mode 100644 index 0000000..6c88927 --- /dev/null +++ b/src/main/java/dev/kske/spawnfly/SpawnCommand.java @@ -0,0 +1,18 @@ +package dev.kske.spawnfly; + +import org.bukkit.command.*; + +public class SpawnCommand implements CommandExecutor { + public SpawnCommand() {} + + @Override + public boolean onCommand(CommandSender sender, org.bukkit.command.Command command, String label, + String[] args) { + if(command.getName().equals("setspawnflyarea")) { + sender.sendMessage("Hello this works!"); + return true; + } + return false; + } + +} diff --git a/src/main/java/dev/kske/spawnfly/SpawnFly.java b/src/main/java/dev/kske/spawnfly/SpawnFly.java index 91f0538..d53da15 100644 --- a/src/main/java/dev/kske/spawnfly/SpawnFly.java +++ b/src/main/java/dev/kske/spawnfly/SpawnFly.java @@ -9,6 +9,7 @@ public final class SpawnFly extends JavaPlugin { public void onEnable() { getLogger().info("onEnable has been invoked!"); Bukkit.getPluginManager().registerEvents(new SpawnListener(), this); + getCommand("setspawnflyarea").setExecutor(new SpawnCommand()); } @Override diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index d65f1c0..c0e979c 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -1,3 +1,6 @@ -name: spawn-fly +name: spawn-fly main: dev.kske.spawnfly.SpawnFly -version: 0.0.1 \ No newline at end of file +version: 0.0.1 +commands: + setspawnflyarea: + usage: /setspawnflyarea