Added ability to disable setInvisible on disguise commands

This commit is contained in:
libraryaddict
2016-12-01 06:56:11 +13:00
parent 24f88338c8
commit 0f0b0b820f
8 changed files with 54 additions and 50 deletions

View File

@@ -97,25 +97,9 @@ public abstract class DisguiseBaseCommand implements CommandExecutor {
}
}
public boolean passesCheck(HashMap<ArrayList<String>, Boolean> theirPermissions, ArrayList<String> usedOptions) {
boolean hasPermission = false;
for (ArrayList<String> list : theirPermissions.keySet()) {
boolean myPerms = true;
for (String option : usedOptions) {
if (!(theirPermissions.get(list) && list.contains("*"))
&& (list.contains(option) != theirPermissions.get(list))) {
myPerms = false;
break;
}
}
if (myPerms) {
hasPermission = true;
}
}
return hasPermission;
public boolean passesCheck(CommandSender sender, HashMap<ArrayList<String>, Boolean> theirPermissions,
ArrayList<String> usedOptions) {
return DisguiseParser.passesCheck(sender, theirPermissions, usedOptions);
}
protected abstract void sendCommandUsage(CommandSender sender,

View File

@@ -114,7 +114,7 @@ public class DisguiseCommand extends DisguiseBaseCommand implements TabCompleter
}
}
if (passesCheck(perms.get(disguiseType), usedOptions)) {
if (passesCheck(sender, perms.get(disguiseType), usedOptions)) {
boolean addMethods = true;
if (args.length > 1) {

View File

@@ -98,7 +98,7 @@ public class DisguiseEntityCommand extends DisguiseBaseCommand implements TabCom
}
}
if (passesCheck(perms.get(disguiseType), usedOptions)) {
if (passesCheck(sender, perms.get(disguiseType), usedOptions)) {
boolean addMethods = true;
if (args.length > 1) {

View File

@@ -150,7 +150,7 @@ public class DisguisePlayerCommand extends DisguiseBaseCommand implements TabCom
}
}
if (passesCheck(perms.get(disguiseType), usedOptions)) {
if (passesCheck(sender, perms.get(disguiseType), usedOptions)) {
boolean addMethods = true;
if (args.length > 2) {

View File

@@ -261,7 +261,7 @@ public class DisguiseRadiusCommand extends DisguiseBaseCommand implements TabCom
}
}
if (passesCheck(perms.get(disguiseType), usedOptions)) {
if (passesCheck(sender, perms.get(disguiseType), usedOptions)) {
boolean addMethods = true;
if (args.length > 1 + starting) {