Optimize block physics event

This commit is contained in:
boy0001
2015-07-17 14:54:07 +10:00
parent e4154f74b7
commit 1564b58a3d
2 changed files with 28 additions and 34 deletions

View File

@ -122,12 +122,15 @@ public class FlagManager {
}
public static Flag getSettingFlag(final String world, final PlotSettings settings, final String id) {
Flag flag = settings.flags.get(id);
if (flag == null) {
Flag flag;
if (settings.flags.size() == 0 || (flag = settings.flags.get(id)) == null) {
PlotWorld plotworld = PS.get().getPlotWorld(world);
if (plotworld == null) {
return null;
}
if (plotworld.DEFAULT_FLAGS.size() == 0) {
return null;
}
return ((HashMap<String, Flag>) plotworld.DEFAULT_FLAGS.clone()).get(id);
}
return flag;
@ -160,13 +163,10 @@ public class FlagManager {
return false;
}
final Flag flag = getPlotFlag(plot, strFlag);
if (flag == null) {
if (flag == null || !((Boolean) flag.getValue())) {
return false;
}
if (flag.getValue() instanceof Boolean) {
return (boolean) flag.getValue();
}
return false;
return true;
}
public static boolean isPlotFlagFalse(final Plot plot, final String strFlag) {
@ -174,12 +174,9 @@ public class FlagManager {
return false;
}
final Flag flag = getPlotFlag(plot, strFlag);
if (flag == null) {
if (flag == null || ((Boolean) flag.getValue())) {
return false;
}
if (flag.getValue() instanceof Boolean) {
return !(boolean) flag.getValue();
}
return false;
}