From eed4a67069d8b27d9a511d3c1ea9483bc6eb4800 Mon Sep 17 00:00:00 2001 From: DaemonicKing Date: Sun, 10 May 2020 15:59:17 +0800 Subject: [PATCH] added permission --- .../java/net/teamonster/tealimit/Main.java | 23 ++++++++++++------- src/main/resources/plugin.yml | 2 ++ 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/src/main/java/net/teamonster/tealimit/Main.java b/src/main/java/net/teamonster/tealimit/Main.java index e490858..165567e 100644 --- a/src/main/java/net/teamonster/tealimit/Main.java +++ b/src/main/java/net/teamonster/tealimit/Main.java @@ -149,15 +149,22 @@ public class Main extends JavaPlugin implements Listener, CommandExecutor public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args){ if(cmd.getName().equalsIgnoreCase("tealimit")){ - if(args.length == 0){ - sender.sendMessage("Invalid argument!"); - return false; + + if(sender.hasPermission("tealimit.admin")){ + if(args.length == 0){ + sender.sendMessage("Invalid argument!"); + return false; + } + if(args.length == 1 && args[0].equalsIgnoreCase("reload")){ + sender.sendMessage("Reloading Configuration"); + reloadConfig(); + sender.sendMessage("Configuration Reloaded"); + return true; + } } - if(args.length == 1 && args[0].equalsIgnoreCase("reload")){ - sender.sendMessage("Reloading Configuration"); - reloadConfig(); - sender.sendMessage("Configuration Reloaded"); - return true; + else{ + sender.sendMessage("Insufficient Permission!"); + return false; } } return false; diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index 537e4e0..b67d8c5 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -7,4 +7,6 @@ description: Limit entity spawns commands: tealimit: + permission: tealimit.admin description: Basic Command + usage: / - usage