From 53f2f7499c8dcfaf755e1bbc0bda930c6e01d1f5 Mon Sep 17 00:00:00 2001 From: md_5 Date: Sat, 25 Jan 2014 15:23:21 +1100 Subject: [PATCH] Don't allow plugins to create scoreboards async - this can crash the server. --- .../0010-Async-Operation-Catching.patch | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/CraftBukkit-Patches/0010-Async-Operation-Catching.patch b/CraftBukkit-Patches/0010-Async-Operation-Catching.patch index 79ab4f5992..2459721376 100644 --- a/CraftBukkit-Patches/0010-Async-Operation-Catching.patch +++ b/CraftBukkit-Patches/0010-Async-Operation-Catching.patch @@ -1,4 +1,4 @@ -From ced3cd552e738dec0752a8355dad90b30a73e986 Mon Sep 17 00:00:00 2001 +From 896de729f459ebbc7cfc3884e8d8de4ce2fb587e Mon Sep 17 00:00:00 2001 From: md_5 Date: Thu, 7 Mar 2013 20:12:46 +1100 Subject: [PATCH] Async Operation Catching @@ -122,7 +122,7 @@ index c16413a..468a4e1 100644 if (generate) { // Use the default variant of loadChunk when generate == true. diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index 83f51ab..ef74879 100644 +index 6b7fcfc..2542d56 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -230,6 +230,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player { @@ -133,6 +133,18 @@ index 83f51ab..ef74879 100644 if (getHandle().playerConnection == null) return; getHandle().playerConnection.disconnect(message == null ? "" : message); +diff --git a/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftScoreboardManager.java b/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftScoreboardManager.java +index 84091a4..2f30d66 100644 +--- a/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftScoreboardManager.java ++++ b/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftScoreboardManager.java +@@ -42,6 +42,7 @@ public final class CraftScoreboardManager implements ScoreboardManager { + } + + public CraftScoreboard getNewScoreboard() { ++ if (Thread.currentThread() != MinecraftServer.getServer().primaryThread) throw new IllegalStateException("Asynchronous scoreboard creation"); // Spigot + CraftScoreboard scoreboard = new CraftScoreboard(new ScoreboardServer(server)); + scoreboards.add(scoreboard); + return scoreboard; -- 1.8.3.2