diff options
author | Necrodoom <doomed.war@gmail.com> | 2013-02-17 19:09:04 +0200 |
---|---|---|
committer | Necrodoom <doomed.war@gmail.com> | 2013-02-17 19:09:04 +0200 |
commit | 880fb29b44c2caee6d325ff17e7596631c1c877b (patch) | |
tree | 2659805e40e61de10f1f1e2326e4050f1b17d46c /EssentialsGroupManager/src/org/anjocaido | |
parent | 3740f200f8dc99c05e42201d8b23ffc279cbd6a6 (diff) | |
download | Essentials-880fb29b44c2caee6d325ff17e7596631c1c877b.tar Essentials-880fb29b44c2caee6d325ff17e7596631c1c877b.tar.gz Essentials-880fb29b44c2caee6d325ff17e7596631c1c877b.tar.lz Essentials-880fb29b44c2caee6d325ff17e7596631c1c877b.tar.xz Essentials-880fb29b44c2caee6d325ff17e7596631c1c877b.zip |
if variable is inside ' ', strip them
Diffstat (limited to 'EssentialsGroupManager/src/org/anjocaido')
-rw-r--r-- | EssentialsGroupManager/src/org/anjocaido/groupmanager/GroupManager.java | 34 |
1 files changed, 26 insertions, 8 deletions
diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/GroupManager.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/GroupManager.java index c395b9eec..9b7cfeba7 100644 --- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/GroupManager.java +++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/GroupManager.java @@ -719,6 +719,11 @@ public class GroupManager extends JavaPlugin { sender.sendMessage(ChatColor.RED + "Review your arguments count! (/<command> <player> <permission>)"); return false; } + String auxString = args[1]; + if (auxString.startsWith("'") && auxString.endsWith("'")) + { + auxString = auxString.substring(1, auxString.length() - 1) + } if ((validateOnlinePlayer) && ((match = validatePlayer(args[0], sender)) == null)) { return false; } @@ -740,13 +745,13 @@ public class GroupManager extends JavaPlugin { } // Validating permissions of user permissionResult = permissionHandler.checkUserOnlyPermission(auxUser, args[1]); - if (args[1].startsWith("+")) { + if (auxString.startsWith("+")) { if (permissionResult.resultType.equals(PermissionCheckResult.Type.EXCEPTION)) { sender.sendMessage(ChatColor.RED + "The user already has direct access to that permission."); sender.sendMessage(ChatColor.RED + "Node: " + permissionResult.accessLevel); return false; } - } else if (args[1].startsWith("-")) { + } else if (auxString.startsWith("-")) { if (permissionResult.resultType.equals(PermissionCheckResult.Type.EXCEPTION)) { sender.sendMessage(ChatColor.RED + "The user already has an exception for this node."); sender.sendMessage(ChatColor.RED + "Node: " + permissionResult.accessLevel); @@ -764,8 +769,8 @@ public class GroupManager extends JavaPlugin { } } // Seems OK - auxUser.addPermission(args[1]); - sender.sendMessage(ChatColor.YELLOW + "You added '" + args[1] + "' to player '" + auxUser.getName() + "' permissions."); + auxUser.addPermission(auxString); + sender.sendMessage(ChatColor.YELLOW + "You added '" + auxString + "' to player '" + auxUser.getName() + "' permissions."); targetPlayer = this.getServer().getPlayer(auxUser.getName()); if (targetPlayer != null) @@ -955,6 +960,11 @@ public class GroupManager extends JavaPlugin { sender.sendMessage(ChatColor.RED + "Review your arguments count! (/<command> <group> <permission>)"); return false; } + String auxString = args[1]; + if (auxString.startsWith("'") && auxString.endsWith("'")) + { + auxString = auxString.substring(1, auxString.length() - 1) + } auxGroup = dataHolder.getGroup(args[0]); if (auxGroup == null) { sender.sendMessage(ChatColor.RED + "The specified group does not exist!"); @@ -968,13 +978,13 @@ public class GroupManager extends JavaPlugin { } // Validating permissions of user permissionResult = permissionHandler.checkGroupOnlyPermission(auxGroup, args[1]); - if (args[1].startsWith("+")) { + if (auxString.startsWith("+")) { if (permissionResult.resultType.equals(PermissionCheckResult.Type.EXCEPTION)) { sender.sendMessage(ChatColor.RED + "The group already has direct access to that permission."); sender.sendMessage(ChatColor.RED + "Node: " + permissionResult.accessLevel); return false; } - } else if (args[1].startsWith("-")) { + } else if (auxString.startsWith("-")) { if (permissionResult.resultType.equals(PermissionCheckResult.Type.EXCEPTION)) { sender.sendMessage(ChatColor.RED + "The group already has an exception for this node."); sender.sendMessage(ChatColor.RED + "Node: " + permissionResult.accessLevel); @@ -992,8 +1002,8 @@ public class GroupManager extends JavaPlugin { } } // Seems OK - auxGroup.addPermission(args[1]); - sender.sendMessage(ChatColor.YELLOW + "You added '" + args[1] + "' to group '" + auxGroup.getName() + "' permissions."); + auxGroup.addPermission(auxString); + sender.sendMessage(ChatColor.YELLOW + "You added '" + auxString + "' to group '" + auxGroup.getName() + "' permissions."); BukkitPermissions.updateAllPlayers(); @@ -1235,6 +1245,10 @@ public class GroupManager extends JavaPlugin { auxString += " "; } } + if (auxString.startsWith("'") && auxString.endsWith("'")) + { + auxString = auxString.substring(1, auxString.length() - 1) + } auxUser.getVariables().addVar(args[1], Variables.parseVariableValue(auxString)); sender.sendMessage(ChatColor.YELLOW + "Variable " + ChatColor.GOLD + args[1] + ChatColor.YELLOW + ":'" + ChatColor.GREEN + auxString + ChatColor.YELLOW + "' added to the user " + auxUser.getName()); @@ -1383,6 +1397,10 @@ public class GroupManager extends JavaPlugin { auxString += " "; } } + if (auxString.startsWith("'") && auxString.endsWith("'")) + { + auxString = auxString.substring(1, auxString.length() - 1) + } auxGroup.getVariables().addVar(args[1], Variables.parseVariableValue(auxString)); sender.sendMessage(ChatColor.YELLOW + "Variable " + ChatColor.GOLD + args[1] + ChatColor.YELLOW + ":'" + ChatColor.GREEN + auxString + ChatColor.YELLOW + "' added to the group " + auxGroup.getName()); |