13
0
geforkt von Mirrors/Paper
Paper/CraftBukkit-Patches/0123-Prevent-getOfflinePlayer-UUID-on-main-thread.patch
2014-04-12 14:18:37 +10:00

22 Zeilen
982 B
Diff

From 60bd33f0f7cb963b7e6eb8387bbfd8e20a53ba40 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