Skip to content

Commit

Permalink
String.valueOf(null) is inconvenient
Browse files Browse the repository at this point in the history
  • Loading branch information
GnomeffinWay committed Mar 25, 2013
1 parent cc8faa5 commit a9f30d6
Showing 1 changed file with 7 additions and 4 deletions.
Expand Up @@ -28,8 +28,6 @@ public void parseArgs(ScriptEntry scriptEntry) throws InvalidArgumentsException
for (String arg : scriptEntry.getArguments()) {
if (aH.matchesArg("ADD, REMOVE", arg)) {
action = Action.valueOf(aH.getStringFrom(arg).toUpperCase());
} else if (aH.matchesValueArg("PLAYER", arg, ArgumentType.String)) {
player = aH.getPlayerFrom(arg);
} else if (aH.matchesValueArg("GROUP", arg, ArgumentType.String)) {
group = aH.getStringFrom(arg);
} else if (aH.matchesValueArg("WORLD", arg, ArgumentType.String)) {
Expand All @@ -54,6 +52,11 @@ public void execute(ScriptEntry scriptEntry) throws CommandExecutionException {
String permission = String.valueOf(scriptEntry.getObject("permission"));
String group = String.valueOf(scriptEntry.getObject("group"));
String world = String.valueOf(scriptEntry.getObject("world"));

if(group.equals("null"))
group = null;
if(world.equals("null"))
world = null;

// Report to dB
dB.report(getName(),
Expand All @@ -65,7 +68,7 @@ public void execute(ScriptEntry scriptEntry) throws CommandExecutionException {

switch (action) {
case ADD:
if(group != null && !group.equals("null")) {
if(group != null) {
if(Depends.permissions.groupHas(world, group, permission)) {
dB.echoDebug("Group " + group + " already has permission " + permission);
} else Depends.permissions.groupAdd(world, group, permission);
Expand All @@ -76,7 +79,7 @@ public void execute(ScriptEntry scriptEntry) throws CommandExecutionException {
}
return;
case REMOVE:
if(group != null&& !group.equals("null")) {
if(group != null) {
if(!Depends.permissions.groupHas(world, group, permission)) {
dB.echoDebug("Group " + group + " does not have access to permission " + permission);
} else Depends.permissions.groupRemove(world, group, permission);
Expand Down

0 comments on commit a9f30d6

Please sign in to comment.