mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-01 20:50:41 +01:00
Don't allow plugins to create scoreboards async - this can crash the server.
This commit is contained in:
parent
3420b081e9
commit
53f2f7499c
1 changed files with 14 additions and 2 deletions
|
@ -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 <md_5@live.com.au>
|
||||
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
|
||||
|
||||
|
|
Loading…
Reference in a new issue