booleans aren't numbers

This commit is contained in:
Sleaker 2012-02-01 08:05:04 -08:00
parent 4b7f9cdc99
commit 730e881c75
4 changed files with 22 additions and 30 deletions

View File

@ -192,13 +192,11 @@ public class Chat_bPermissions extends Chat {
@Override
public boolean getPlayerInfoBoolean(String world, String player, String node, boolean defaultValue) {
String s = getPlayerInfoString(world, player, node, null);
if (s == null)
return defaultValue;
try {
boolean b = Boolean.valueOf(s);
return b;
} catch (NumberFormatException e) {
if (s == null) {
return defaultValue;
} else {
Boolean val = Boolean.valueOf(s);
return val != null ? val : defaultValue;
}
}
@ -212,11 +210,9 @@ public class Chat_bPermissions extends Chat {
String s = getGroupInfoString(world, group, node, null);
if (s == null)
return defaultValue;
try {
boolean b = Boolean.valueOf(s);
return b;
} catch (NumberFormatException e) {
return defaultValue;
else {
Boolean val = Boolean.valueOf(s);
return val != null ? val : defaultValue;
}
}

View File

@ -194,11 +194,9 @@ public class Chat_bPermissions2 extends Chat {
String s = getPlayerInfoString(world, player, node, null);
if (s == null)
return defaultValue;
try {
boolean b = Boolean.valueOf(s);
return b;
} catch (NumberFormatException e) {
return defaultValue;
else {
Boolean val = Boolean.valueOf(s);
return val != null ? val : defaultValue;
}
}
@ -210,13 +208,11 @@ public class Chat_bPermissions2 extends Chat {
@Override
public boolean getGroupInfoBoolean(String world, String group, String node, boolean defaultValue) {
String s = getGroupInfoString(world, group, node, null);
if (s == null)
return defaultValue;
try {
boolean b = Boolean.valueOf(s);
return b;
} catch (NumberFormatException e) {
if (s == null) {
return defaultValue;
} else {
Boolean val = Boolean.valueOf(s);
return val != null ? val : defaultValue;
}
}

View File

@ -198,8 +198,10 @@ public class Chat_iChat extends Chat {
String val = getPlayerInfoString(world, player, node, null);
if (val == null)
return defaultValue;
return Boolean.valueOf(val);
else {
Boolean v = Boolean.valueOf(val);
return v != null ? v : defaultValue;
}
}
@Override

View File

@ -183,13 +183,11 @@ public class Chat_mChat extends Chat {
@Override
public boolean getPlayerInfoBoolean(String world, String player, String node, boolean defaultValue) {
String s = getPlayerInfoString(world, player, node, null);
if (s == null)
return defaultValue;
try {
return Boolean.valueOf(s);
} catch (NumberFormatException e) {
if (s == null) {
return defaultValue;
} else {
Boolean val = Boolean.valueOf(s);
return val != null ? val : defaultValue;
}
}