Made the permission option baby also stand for setbaby

This commit is contained in:
Andrew 2013-11-14 10:43:24 +13:00
parent 49347b6a46
commit 68d16995e0

View File

@ -35,9 +35,11 @@ public abstract class BaseDisguiseCommand implements CommandExecutor {
for (DisguiseType type : DisguiseType.values()) { for (DisguiseType type : DisguiseType.values()) {
String name = type.name().toLowerCase(); String name = type.name().toLowerCase();
if (perm.split("//.")[0].equals("*") && permission.getValue()) { if (perm.split("//.")[0].equals("*") && permission.getValue()) {
if (!names.contains(name))
names.add(name); names.add(name);
} else if (perm.split("//.")[0].equals(name)) { } else if (perm.split("//.")[0].equals(name)) {
if (permission.getValue()) { if (permission.getValue()) {
if (!names.contains(name))
names.add(name); names.add(name);
} else { } else {
forbiddenDisguises.add(name); forbiddenDisguises.add(name);
@ -46,6 +48,7 @@ public abstract class BaseDisguiseCommand implements CommandExecutor {
} }
} }
} }
// This does the disguises for ops.
for (DisguiseType type : DisguiseType.values()) { for (DisguiseType type : DisguiseType.values()) {
if (!names.contains(type.name().toLowerCase())) { if (!names.contains(type.name().toLowerCase())) {
if (sender.hasPermission(permissionNode + "*") if (sender.hasPermission(permissionNode + "*")
@ -97,7 +100,11 @@ public abstract class BaseDisguiseCommand implements CommandExecutor {
if (s.length() == 0) if (s.length() == 0)
return new HashSet<HashSet<String>>(); return new HashSet<HashSet<String>>();
HashSet<String> p = new HashSet<String>(); HashSet<String> p = new HashSet<String>();
p.addAll(Arrays.asList(s.split("\\."))); for (String str : s.split("\\.")) {
if (str.equals("baby"))
str = "setbaby";
p.add(str);
}
perms.add(p); perms.add(p);
} }
} }