Cache on fail as well

This commit is contained in:
Jesse Boyd 2016-08-07 04:43:41 +10:00
parent facd43700d
commit 395d6364be

View File

@ -1414,15 +1414,42 @@ public class PlayerEvents extends PlotListener implements Listener {
if (mobs == null) {
mobs = plot.countEntities();
}
if (mobs[i]++ >= cap) {
if (mobs[i] >= cap) {
plot.setMeta("EntityCount", mobs);
plot.setMeta("EntityCountTime", System.currentTimeMillis());
return true;
}
}
for (IntegerFlag flag : flags) {
int i;
switch (flag.getName()) {
case "entity-cap":
i = 0;
break;
case "mob-cap":
i = 3;
break;
case "hostile-cap":
i = 2;
break;
case "animal-cap":
i = 1;
break;
case "vehicle-cap":
i = 4;
break;
case "misc-cap":
i = 5;
break;
default:
i = 0;
}
mobs[i]++;
}
if (mobs != null) {
plot.setMeta("EntityCount", mobs);
plot.setMeta("EntityCountTime", System.currentTimeMillis());
}
return false;
}