testserver/CraftBukkit-Patches/0123-Prevent-getOfflinePlay...

22 lines
982 B
Diff
Raw Normal View History

2014-04-12 04:18:37 +00:00
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