Paper/CraftBukkit-Patches/0124-Prevent-getOfflinePlayer-UUID-on-main-thread.patch

22 lines
1003 B
Diff

From 3f5a0704fe6de51b06e554c07f37237240d4022e 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 707410b..446b046 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -1341,6 +1341,7 @@ public final class CraftServer implements Server {
// TODO: In 1.7.6+ this should just lookup the UUID-based player data filename
public OfflinePlayer getOfflinePlayer(UUID id) {
+ com.google.common.base.Preconditions.checkState(!Bukkit.isPrimaryThread(), "Cannot call getOfflinePlayer(UUID) on main thread, this operation is blocking!"); // Spigot
String name = MojangNameLookup.lookupName(id);
if (name == null) {
// This is completely wrong
--
1.8.3.2