From 401e57955aa5d6700324d33aab8e68b059b242e4 Mon Sep 17 00:00:00 2001 From: md_5 Date: Sat, 3 Aug 2013 19:09:09 +1000 Subject: [PATCH] Add more async safeguards --- .../0012-Async-Operation-Catching.patch | 22 ++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/CraftBukkit-Patches/0012-Async-Operation-Catching.patch b/CraftBukkit-Patches/0012-Async-Operation-Catching.patch index 73fa118cf..6f1c1d397 100644 --- a/CraftBukkit-Patches/0012-Async-Operation-Catching.patch +++ b/CraftBukkit-Patches/0012-Async-Operation-Catching.patch @@ -1,10 +1,30 @@ -From 02576518418792080a11f4f648156fb819ae1c72 Mon Sep 17 00:00:00 2001 +From 11dc47b80c3d35e079fabff8953334708d3cf798 Mon Sep 17 00:00:00 2001 From: md_5 Date: Thu, 7 Mar 2013 20:12:46 +1100 Subject: [PATCH] Async Operation Catching Catch and throw an exception when a potentially unsafe operation occurs on a thread other than the main server thread. +diff --git a/src/main/java/net/minecraft/server/Block.java b/src/main/java/net/minecraft/server/Block.java +index afe8735..8fc6c12 100644 +--- a/src/main/java/net/minecraft/server/Block.java ++++ b/src/main/java/net/minecraft/server/Block.java +@@ -342,9 +342,13 @@ public class Block { + return 10; + } + +- public void onPlace(World world, int i, int j, int k) {} ++ public void onPlace(World world, int i, int j, int k) { ++ if (Thread.currentThread() != MinecraftServer.getServer().primaryThread) throw new IllegalStateException("Asynchronous block onPlace!"); // Spigot ++ } + +- public void remove(World world, int i, int j, int k, int l, int i1) {} ++ public void remove(World world, int i, int j, int k, int l, int i1) { ++ if (Thread.currentThread() != MinecraftServer.getServer().primaryThread) throw new IllegalStateException("Asynchronous block remove!"); // Spigot ++ } + + public int a(Random random) { + return 1; diff --git a/src/main/java/net/minecraft/server/EntityTracker.java b/src/main/java/net/minecraft/server/EntityTracker.java index 1d9203b..ebbef6a 100644 --- a/src/main/java/net/minecraft/server/EntityTracker.java