Add async check we potentially missed

This commit is contained in:
md_5 2013-05-01 16:39:55 +10:00
parent 7d52532fd2
commit b27b79c7ac

View File

@ -1,4 +1,4 @@
From a7ba30126f1319ecf227bf7b83384c7c77494ea6 Mon Sep 17 00:00:00 2001 From 2e912ff97691c86ff0778304e3428423b57fc266 Mon Sep 17 00:00:00 2001
From: md_5 <md_5@live.com.au> From: md_5 <md_5@live.com.au>
Date: Thu, 7 Mar 2013 20:12:46 +1100 Date: Thu, 7 Mar 2013 20:12:46 +1100
Subject: [PATCH] Async Operation Catching Subject: [PATCH] Async Operation Catching
@ -26,7 +26,7 @@ index 9e2b76f..d7efe3e 100644
EntityPlayer entityplayer = (EntityPlayer) entity; EntityPlayer entityplayer = (EntityPlayer) entity;
Iterator iterator = this.b.iterator(); Iterator iterator = this.b.iterator();
diff --git a/src/main/java/net/minecraft/server/EntityTrackerEntry.java b/src/main/java/net/minecraft/server/EntityTrackerEntry.java diff --git a/src/main/java/net/minecraft/server/EntityTrackerEntry.java b/src/main/java/net/minecraft/server/EntityTrackerEntry.java
index 65cc4e8..970a834 100644 index 5c03732..5f3c780 100644
--- a/src/main/java/net/minecraft/server/EntityTrackerEntry.java --- a/src/main/java/net/minecraft/server/EntityTrackerEntry.java
+++ b/src/main/java/net/minecraft/server/EntityTrackerEntry.java +++ b/src/main/java/net/minecraft/server/EntityTrackerEntry.java
@@ -286,6 +286,7 @@ public class EntityTrackerEntry { @@ -286,6 +286,7 @@ public class EntityTrackerEntry {
@ -46,7 +46,7 @@ index 65cc4e8..970a834 100644
this.trackedPlayers.remove(entityplayer); this.trackedPlayers.remove(entityplayer);
entityplayer.removeQueue.add(Integer.valueOf(this.tracker.id)); entityplayer.removeQueue.add(Integer.valueOf(this.tracker.id));
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index f5730d3..af85d8b 100644 index 319170a..69ef160 100644
--- a/src/main/java/net/minecraft/server/World.java --- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java
@@ -918,6 +918,7 @@ public abstract class World implements IBlockAccess { @@ -918,6 +918,7 @@ public abstract class World implements IBlockAccess {
@ -65,8 +65,16 @@ index f5730d3..af85d8b 100644
entity.die(); entity.die();
if (entity instanceof EntityHuman) { if (entity instanceof EntityHuman) {
this.players.remove(entity); this.players.remove(entity);
@@ -2440,6 +2442,7 @@ public abstract class World implements IBlockAccess {
}
public void a(List list) {
+ if (Thread.currentThread() != MinecraftServer.getServer().primaryThread) throw new IllegalStateException("Asynchronous entity world add!"); // Spigot
// CraftBukkit start
Entity entity = null;
for (int i = 0; i < list.size(); ++i) {
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
index a303090..f5e63f8 100644 index 68fd274..9e7d8ab 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -235,6 +235,7 @@ public class CraftWorld implements World { @@ -235,6 +235,7 @@ public class CraftWorld implements World {