From 209744fab3707e049f833d39e60a3bd0c1cd01c5 Mon Sep 17 00:00:00 2001 From: Andrew Date: Tue, 19 Nov 2013 00:53:22 +1300 Subject: [PATCH] Fix incorrect permission nodes --- src/me/libraryaddict/disguise/BaseDisguiseCommand.java | 7 +++++-- .../libraryaddict/disguise/commands/DisguiseCommand.java | 2 +- .../disguise/commands/DisguiseEntityCommand.java | 2 +- .../disguise/commands/DisguisePlayerCommand.java | 4 ++-- .../disguise/commands/DisguiseRadiusCommand.java | 4 ++-- 5 files changed, 11 insertions(+), 8 deletions(-) diff --git a/src/me/libraryaddict/disguise/BaseDisguiseCommand.java b/src/me/libraryaddict/disguise/BaseDisguiseCommand.java index b2281871..ac3409e4 100644 --- a/src/me/libraryaddict/disguise/BaseDisguiseCommand.java +++ b/src/me/libraryaddict/disguise/BaseDisguiseCommand.java @@ -23,6 +23,10 @@ import org.bukkit.permissions.PermissionAttachmentInfo; import org.bukkit.potion.PotionEffectType; public abstract class BaseDisguiseCommand implements CommandExecutor { + protected ArrayList getAllowedDisguises(CommandSender sender) { + String permissionNode = "libsdisguises." + getClass().getSimpleName().replace("Command", "").toLowerCase() + "."; + return getAllowedDisguises(sender, permissionNode); + } protected ArrayList getAllowedDisguises(CommandSender sender, String permissionNode) { ArrayList names = new ArrayList(); @@ -117,8 +121,7 @@ public abstract class BaseDisguiseCommand implements CommandExecutor { * disguise has been feed a proper disguisetype. */ protected Disguise parseDisguise(CommandSender sender, String[] args) throws Exception { - String permissionNode = "libsdisguises." + getClass().getSimpleName().replace("Command", "").toLowerCase() + "."; - ArrayList allowedDisguises = getAllowedDisguises(sender, permissionNode); + ArrayList allowedDisguises = getAllowedDisguises(sender); if (allowedDisguises.isEmpty()) { throw new Exception(ChatColor.RED + "You are forbidden to use this command."); } diff --git a/src/me/libraryaddict/disguise/commands/DisguiseCommand.java b/src/me/libraryaddict/disguise/commands/DisguiseCommand.java index 7f403644..557cbb42 100644 --- a/src/me/libraryaddict/disguise/commands/DisguiseCommand.java +++ b/src/me/libraryaddict/disguise/commands/DisguiseCommand.java @@ -38,7 +38,7 @@ public class DisguiseCommand extends BaseDisguiseCommand { * Send the player the information */ protected void sendCommandUsage(CommandSender sender) { - ArrayList allowedDisguises = getAllowedDisguises(sender, "disguise"); + ArrayList allowedDisguises = getAllowedDisguises(sender); sender.sendMessage(ChatColor.DARK_GREEN + "Choose a disguise to become the disguise!"); sender.sendMessage(ChatColor.DARK_GREEN + "You can use the disguises: " + ChatColor.GREEN + StringUtils.join(allowedDisguises, ChatColor.RED + ", " + ChatColor.GREEN)); diff --git a/src/me/libraryaddict/disguise/commands/DisguiseEntityCommand.java b/src/me/libraryaddict/disguise/commands/DisguiseEntityCommand.java index 29c41860..247ee96d 100644 --- a/src/me/libraryaddict/disguise/commands/DisguiseEntityCommand.java +++ b/src/me/libraryaddict/disguise/commands/DisguiseEntityCommand.java @@ -44,7 +44,7 @@ public class DisguiseEntityCommand extends BaseDisguiseCommand { * Send the player the information */ protected void sendCommandUsage(CommandSender sender) { - ArrayList allowedDisguises = getAllowedDisguises(sender, "disguiseentity"); + ArrayList allowedDisguises = getAllowedDisguises(sender); sender.sendMessage(ChatColor.DARK_GREEN + "Choose a disguise then slap a entity to disguise it!"); sender.sendMessage(ChatColor.DARK_GREEN + "You can use the disguises: " + ChatColor.GREEN + StringUtils.join(allowedDisguises, ChatColor.RED + ", " + ChatColor.GREEN)); diff --git a/src/me/libraryaddict/disguise/commands/DisguisePlayerCommand.java b/src/me/libraryaddict/disguise/commands/DisguisePlayerCommand.java index c8d7880d..13e00f38 100644 --- a/src/me/libraryaddict/disguise/commands/DisguisePlayerCommand.java +++ b/src/me/libraryaddict/disguise/commands/DisguisePlayerCommand.java @@ -15,7 +15,7 @@ public class DisguisePlayerCommand extends BaseDisguiseCommand { @Override public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) { - ArrayList allowedDisguises = getAllowedDisguises(sender, "disguiseplayer"); + ArrayList allowedDisguises = getAllowedDisguises(sender); if (allowedDisguises.isEmpty()) { sender.sendMessage(ChatColor.RED + "You are forbidden to use this command."); return true; @@ -58,7 +58,7 @@ public class DisguisePlayerCommand extends BaseDisguiseCommand { * Send the player the information */ protected void sendCommandUsage(CommandSender sender) { - ArrayList allowedDisguises = getAllowedDisguises(sender, "disguiseplayer"); + ArrayList allowedDisguises = getAllowedDisguises(sender); sender.sendMessage(ChatColor.DARK_GREEN + "Disguise another player!"); sender.sendMessage(ChatColor.DARK_GREEN + "You can use the disguises: " + ChatColor.GREEN + StringUtils.join(allowedDisguises, ChatColor.RED + ", " + ChatColor.GREEN)); diff --git a/src/me/libraryaddict/disguise/commands/DisguiseRadiusCommand.java b/src/me/libraryaddict/disguise/commands/DisguiseRadiusCommand.java index f75b7040..1d0cefd1 100644 --- a/src/me/libraryaddict/disguise/commands/DisguiseRadiusCommand.java +++ b/src/me/libraryaddict/disguise/commands/DisguiseRadiusCommand.java @@ -24,7 +24,7 @@ public class DisguiseRadiusCommand extends BaseDisguiseCommand { sender.sendMessage(ChatColor.RED + "You may not use this command from the console!"); return true; } - ArrayList allowedDisguises = getAllowedDisguises(sender, "disguiseplayer"); + ArrayList allowedDisguises = getAllowedDisguises(sender); if (allowedDisguises.isEmpty()) { sender.sendMessage(ChatColor.RED + "You are forbidden to use this command."); return true; @@ -76,7 +76,7 @@ public class DisguiseRadiusCommand extends BaseDisguiseCommand { * Send the player the information */ protected void sendCommandUsage(CommandSender sender) { - ArrayList allowedDisguises = getAllowedDisguises(sender, "disguiseradius"); + ArrayList allowedDisguises = getAllowedDisguises(sender); sender.sendMessage(ChatColor.DARK_GREEN + "Disguise all entities in a radius! Caps at 30 blocks!"); sender.sendMessage(ChatColor.DARK_GREEN + "You can use the disguises: " + ChatColor.GREEN + StringUtils.join(allowedDisguises, ChatColor.RED + ", " + ChatColor.GREEN));