From dbf809ea5b1ff9cdfb7adaeea7ecaa877e82dc80 Mon Sep 17 00:00:00 2001 From: Eric Date: Sat, 12 Nov 2016 15:55:36 +0100 Subject: [PATCH] Only show help messages of commands a player can enter --- .../de/epiceric/shopchest/ShopCommand.java | 23 +++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/src/main/java/de/epiceric/shopchest/ShopCommand.java b/src/main/java/de/epiceric/shopchest/ShopCommand.java index 08ca2b5..1c0b75b 100644 --- a/src/main/java/de/epiceric/shopchest/ShopCommand.java +++ b/src/main/java/de/epiceric/shopchest/ShopCommand.java @@ -427,13 +427,28 @@ class ShopCommand extends BukkitCommand { private void sendBasicHelpMessage(Player player) { plugin.debug("Sending basic help message to " + player.getName()); - player.sendMessage(ChatColor.GREEN + "/" + plugin.getShopChestConfig().main_command_name + " create [normal|admin] - " + LanguageUtils.getMessage(LocalizedMessage.Message.COMMAND_DESC_CREATE)); + if (player.hasPermission("shopchest.create.admin")) { + player.sendMessage(ChatColor.GREEN + "/" + plugin.getShopChestConfig().main_command_name + " create [normal|admin] - " + LanguageUtils.getMessage(LocalizedMessage.Message.COMMAND_DESC_CREATE)); + } else { + player.sendMessage(ChatColor.GREEN + "/" + plugin.getShopChestConfig().main_command_name + " create - " + LanguageUtils.getMessage(LocalizedMessage.Message.COMMAND_DESC_CREATE)); + } + player.sendMessage(ChatColor.GREEN + "/" + plugin.getShopChestConfig().main_command_name + " remove - " + LanguageUtils.getMessage(LocalizedMessage.Message.COMMAND_DESC_REMOVE)); player.sendMessage(ChatColor.GREEN + "/" + plugin.getShopChestConfig().main_command_name + " info - " + LanguageUtils.getMessage(LocalizedMessage.Message.COMMAND_DESC_INFO)); - player.sendMessage(ChatColor.GREEN + "/" + plugin.getShopChestConfig().main_command_name + " reload - " + LanguageUtils.getMessage(LocalizedMessage.Message.COMMAND_DESC_RELOAD)); - player.sendMessage(ChatColor.GREEN + "/" + plugin.getShopChestConfig().main_command_name + " update - " + LanguageUtils.getMessage(LocalizedMessage.Message.COMMAND_DESC_UPDATE)); + + if (player.hasPermission("shopchest.reload")) { + player.sendMessage(ChatColor.GREEN + "/" + plugin.getShopChestConfig().main_command_name + " reload - " + LanguageUtils.getMessage(LocalizedMessage.Message.COMMAND_DESC_RELOAD)); + } + + if (player.hasPermission("shopchest.update")) { + player.sendMessage(ChatColor.GREEN + "/" + plugin.getShopChestConfig().main_command_name + " update - " + LanguageUtils.getMessage(LocalizedMessage.Message.COMMAND_DESC_UPDATE)); + } + player.sendMessage(ChatColor.GREEN + "/" + plugin.getShopChestConfig().main_command_name + " limits - " + LanguageUtils.getMessage(LocalizedMessage.Message.COMMAND_DESC_LIMITS)); - player.sendMessage(ChatColor.GREEN + "/" + plugin.getShopChestConfig().main_command_name + " config - " + LanguageUtils.getMessage(LocalizedMessage.Message.COMMAND_DESC_CONFIG)); + + if (player.hasPermission("shopchest.config")) { + player.sendMessage(ChatColor.GREEN + "/" + plugin.getShopChestConfig().main_command_name + " config - " + LanguageUtils.getMessage(LocalizedMessage.Message.COMMAND_DESC_CONFIG)); + } } }