From 1ae694ff5b83ffaff51d66d45499773fbb158902 Mon Sep 17 00:00:00 2001 From: Jesse Boyd Date: Sun, 7 Aug 2016 03:52:37 +1000 Subject: [PATCH] Tweak entity counting --- .../java/com/plotsquared/bukkit/listeners/PlayerEvents.java | 3 +++ .../java/com/plotsquared/bukkit/util/BukkitChunkManager.java | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) 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 cf47f39a6..6297fe1b5 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/listeners/PlayerEvents.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/listeners/PlayerEvents.java @@ -1408,6 +1408,9 @@ public class PlayerEvents extends PlotListener implements Listener { if (cap == Integer.MAX_VALUE) { continue; } + if (cap == 0) { + return false; + } if (mobs == null) { mobs = plot.countEntities(); } diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/util/BukkitChunkManager.java b/Bukkit/src/main/java/com/plotsquared/bukkit/util/BukkitChunkManager.java index fef2434e0..ba16915b4 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/util/BukkitChunkManager.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/util/BukkitChunkManager.java @@ -449,9 +449,9 @@ public class BukkitChunkManager extends ChunkManager { boolean doWhole = false; List entities = null; - if (size > 200) { + if (size > 200 && chunks.size() > 200) { entities = world.getEntities(); - if (entities.size() < 16 + size * size / 64) { + if (entities.size() < 16 + size / 8) { doWhole = true; } }