Paper/CraftBukkit-Patches/0122-Prevent-getOfflinePlayer-UUID-on-main-thread.patch
2014-04-12 14:27:04 +10:00

22 Zeilen
982 B
Diff

From e64d7c0ca438aa60ac1e545928ba2b0c83f5aa6d Mon Sep 17 00:00:00 2001
From: md_5 <git@md-5.net>
Date: Sun, 30 Mar 2014 09:15:35 +1100
Subject: [PATCH] Prevent getOfflinePlayer(UUID) on main thread.
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index ff13c51..7b2242a 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -1306,6 +1306,7 @@ public final class CraftServer implements Server {
public OfflinePlayer getOfflinePlayer(String name) {
Validate.notNull(name, "Name cannot be null");
+ com.google.common.base.Preconditions.checkState(!Bukkit.isPrimaryThread(), "Cannot call getOfflinePlayer(UUID) on main thread, this operation is blocking!"); // Spigot
// This is potentially blocking :(
GameProfile profile = MinecraftServer.getServer().getUserCache().a(name);
--
1.8.3.2