diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/listeners/PlayerEvents.java b/Bukkit/src/main/java/com/plotsquared/bukkit/listeners/PlayerEvents.java index bd81c5b01..99eb2cf84 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/listeners/PlayerEvents.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/listeners/PlayerEvents.java @@ -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; }