From 6789c757e1bec31d5a0219e4ef5fb55015ef6208 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beatrice=20Dellac=C3=A0?= Date: Sat, 22 Oct 2022 00:47:57 +0200 Subject: [PATCH] Implement basic command --- .../wtf/beatrice/nounspicker/NounsPicker.java | 5 +++ .../nounspicker/commands/NounsCommand.java | 34 +++++++++++++++++++ 2 files changed, 39 insertions(+) create mode 100644 src/main/java/wtf/beatrice/nounspicker/commands/NounsCommand.java diff --git a/src/main/java/wtf/beatrice/nounspicker/NounsPicker.java b/src/main/java/wtf/beatrice/nounspicker/NounsPicker.java index 3fd28f0..c75da8b 100644 --- a/src/main/java/wtf/beatrice/nounspicker/NounsPicker.java +++ b/src/main/java/wtf/beatrice/nounspicker/NounsPicker.java @@ -3,6 +3,7 @@ package wtf.beatrice.nounspicker; import org.bukkit.Bukkit; import org.bukkit.plugin.PluginManager; import org.bukkit.plugin.java.JavaPlugin; +import wtf.beatrice.nounspicker.commands.NounsCommand; import wtf.beatrice.nounspicker.objects.PAPIManager; import wtf.beatrice.nounspicker.utils.ConsoleLogger; @@ -31,6 +32,10 @@ public class NounsPicker extends JavaPlugin return; } + logger.log("Registering commands..."); + getCommand("nouns").setExecutor(new NounsCommand(this)); + logger.log("Commands registered!"); + logger.log("Plugin loaded!"); } diff --git a/src/main/java/wtf/beatrice/nounspicker/commands/NounsCommand.java b/src/main/java/wtf/beatrice/nounspicker/commands/NounsCommand.java new file mode 100644 index 0000000..718980b --- /dev/null +++ b/src/main/java/wtf/beatrice/nounspicker/commands/NounsCommand.java @@ -0,0 +1,34 @@ +package wtf.beatrice.nounspicker.commands; + +import org.bukkit.command.Command; +import org.bukkit.command.CommandExecutor; +import org.bukkit.command.CommandSender; +import org.jetbrains.annotations.NotNull; +import wtf.beatrice.nounspicker.NounsPicker; + +public class NounsCommand implements CommandExecutor +{ + + private NounsPicker plugin; + public NounsCommand(NounsPicker plugin) + { + this.plugin = plugin; + } + + @Override + public boolean onCommand(@NotNull CommandSender sender, + @NotNull Command cmd, + @NotNull String label, + @NotNull String[] args) + { + + if(args.length == 0) + { + sender.sendMessage("Please specify an argument!"); + return true; + } + + + return false; + } +}