summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTravis Watkins <amaranth@ubuntu.com>2012-08-04 17:32:34 -0500
committerTravis Watkins <amaranth@ubuntu.com>2012-08-04 18:02:30 -0500
commitfdd01feb8c3468176c4a2fc312c37da34cc0152c (patch)
tree13e5d7b7d92850be328d3c97e66c33e479b288a9 /src
parenta5da834258c68bfaef6bf9fc02e5786346661cee (diff)
downloadcraftbukkit-fdd01feb8c3468176c4a2fc312c37da34cc0152c.tar
craftbukkit-fdd01feb8c3468176c4a2fc312c37da34cc0152c.tar.gz
craftbukkit-fdd01feb8c3468176c4a2fc312c37da34cc0152c.tar.lz
craftbukkit-fdd01feb8c3468176c4a2fc312c37da34cc0152c.tar.xz
craftbukkit-fdd01feb8c3468176c4a2fc312c37da34cc0152c.zip
Avoid CME when lightning strikes by making a copy. Fixes BUKKIT-2055
Diffstat (limited to 'src')
-rw-r--r--src/main/java/net/minecraft/server/EntityLightning.java6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/main/java/net/minecraft/server/EntityLightning.java b/src/main/java/net/minecraft/server/EntityLightning.java
index c65f92c4..28aee4cf 100644
--- a/src/main/java/net/minecraft/server/EntityLightning.java
+++ b/src/main/java/net/minecraft/server/EntityLightning.java
@@ -107,8 +107,10 @@ public class EntityLightning extends EntityWeather {
if (this.lifeTicks >= 0 && !this.isEffect) { // CraftBukkit
double d0 = 3.0D;
- List list = this.world.getEntities(this, AxisAlignedBB.a().a(this.locX - d0, this.locY - d0, this.locZ - d0, this.locX + d0, this.locY + 6.0D + d0, this.locZ + d0));
- Iterator iterator = list.iterator();
+ // CraftBukkit start - switch to array copy of list to avoid CMEs
+ Object[] array = this.world.getEntities(this, AxisAlignedBB.a().a(this.locX - d0, this.locY - d0, this.locZ - d0, this.locX + d0, this.locY + 6.0D + d0, this.locZ + d0)).toArray();
+ Iterator iterator = com.google.common.collect.Iterators.forArray(array);
+ // CraftBukkit end
while (iterator.hasNext()) {
Entity entity = (Entity) iterator.next();