13
0
geforkt von Mirrors/Paper
Paper/CraftBukkit-Patches/0121-Prevent-getOfflinePlayer-UUID-on-main-thread.patch
Spigot be34265a1f Nearly done, testing time.
By: md_5 <git@md-5.net>
2014-04-12 14:38:17 +10:00

22 Zeilen
982 B
Diff

From 3ca585448f331bc7961ad0579e3cb5f8e6314215 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 2645c97..17ebcce 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -1304,6 +1304,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