SPIGOT-915: Remove the getEntities filter

Didn't fix the issue like i'd hoped and broke a few plugins in the process.
Ideally though plugins shouldn't be using it for large ranges because it
is inefficient
This commit is contained in:
Thinkofdeath 2015-07-08 22:42:08 +01:00
parent e91aed81b3
commit e3b5669be1

View File

@ -533,21 +533,7 @@
return false; return false;
} else { } else {
int i = 0; int i = 0;
@@ -2024,6 +2296,13 @@ @@ -2042,7 +2314,7 @@
int k = MathHelper.floor((axisalignedbb.c - 2.0D) / 16.0D);
int l = MathHelper.floor((axisalignedbb.f + 2.0D) / 16.0D);
+ // CraftBukkit start - filter out large ranges
+ if (j - i > 10 || l - k > 10) {
+ getServer().getLogger().log(java.util.logging.Level.WARNING, "Filtered out large getEntities call {0},{1} {2},{3}", new Object[]{i, j, k, j});
+ return arraylist;
+ }
+ // CraftBukkit end
+
for (int i1 = i; i1 <= j; ++i1) {
for (int j1 = k; j1 <= l; ++j1) {
if (this.isChunkLoaded(i1, j1, true)) {
@@ -2042,7 +2321,7 @@
while (iterator.hasNext()) { while (iterator.hasNext()) {
Entity entity = (Entity) iterator.next(); Entity entity = (Entity) iterator.next();
@ -556,7 +542,7 @@
arraylist.add(entity); arraylist.add(entity);
} }
} }
@@ -2057,7 +2336,7 @@ @@ -2057,7 +2329,7 @@
while (iterator.hasNext()) { while (iterator.hasNext()) {
Entity entity = (Entity) iterator.next(); Entity entity = (Entity) iterator.next();
@ -565,7 +551,7 @@
arraylist.add(entity); arraylist.add(entity);
} }
} }
@@ -2105,7 +2384,7 @@ @@ -2105,7 +2377,7 @@
} }
} }
@ -574,7 +560,7 @@
} }
public Entity a(int i) { public Entity a(int i) {
@@ -2125,8 +2404,17 @@ @@ -2125,8 +2397,17 @@
while (iterator.hasNext()) { while (iterator.hasNext()) {
Entity entity = (Entity) iterator.next(); Entity entity = (Entity) iterator.next();
@ -594,7 +580,7 @@
++i; ++i;
} }
} }
@@ -2135,12 +2423,18 @@ @@ -2135,12 +2416,18 @@
} }
public void b(Collection<Entity> collection) { public void b(Collection<Entity> collection) {
@ -614,7 +600,7 @@
this.a(entity); this.a(entity);
} }
@@ -2154,7 +2448,13 @@ @@ -2154,7 +2441,13 @@
Block block1 = this.getType(blockposition).getBlock(); Block block1 = this.getType(blockposition).getBlock();
AxisAlignedBB axisalignedbb = flag ? null : block.a(this, blockposition, block.getBlockData()); AxisAlignedBB axisalignedbb = flag ? null : block.a(this, blockposition, block.getBlockData());
@ -629,7 +615,7 @@
} }
public int F() { public int F() {
@@ -2253,6 +2553,11 @@ @@ -2253,6 +2546,11 @@
for (int i = 0; i < this.players.size(); ++i) { for (int i = 0; i < this.players.size(); ++i) {
EntityHuman entityhuman1 = (EntityHuman) this.players.get(i); EntityHuman entityhuman1 = (EntityHuman) this.players.get(i);
@ -641,7 +627,7 @@
if (IEntitySelector.d.apply(entityhuman1)) { if (IEntitySelector.d.apply(entityhuman1)) {
double d5 = entityhuman1.e(d0, d1, d2); double d5 = entityhuman1.e(d0, d1, d2);
@@ -2369,6 +2674,16 @@ @@ -2369,6 +2667,16 @@
public void everyoneSleeping() {} public void everyoneSleeping() {}
@ -658,7 +644,7 @@
public float h(float f) { public float h(float f) {
return (this.q + (this.r - this.q) * f) * this.j(f); return (this.q + (this.r - this.q) * f) * this.j(f);
} }
@@ -2592,6 +2907,6 @@ @@ -2592,6 +2900,6 @@
int l = j * 16 + 8 - blockposition.getZ(); int l = j * 16 + 8 - blockposition.getZ();
short short0 = 128; short short0 = 128;