geforkt von Mirrors/Paper
3aae7ef01a
Upstream has released updates that appear to apply and compile correctly. This update has not been tested by PaperMC and as with ANY update, please do your own testing Bukkit Changes: 214b9f14 SPIGOT-6605: Add method to access value of enforce-whitelist CraftBukkit Changes: b121d3b9 SPIGOT-6605: Add method to access value of enforce-whitelist
69 Zeilen
2.6 KiB
Diff
69 Zeilen
2.6 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: oxygencraft <21054297+oxygencraft@users.noreply.github.com>
|
|
Date: Sun, 25 Oct 2020 18:35:58 +1100
|
|
Subject: [PATCH] Add getOfflinePlayerIfCached(String)
|
|
|
|
|
|
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
|
|
index e73025fcc60f251d7c8c0c961d92e13aeeb49197..eeba408c5942c6cd71739c5d3a5c53f02137cc41 100644
|
|
--- a/src/main/java/org/bukkit/Bukkit.java
|
|
+++ b/src/main/java/org/bukkit/Bukkit.java
|
|
@@ -986,6 +986,27 @@ public final class Bukkit {
|
|
return server.getOfflinePlayer(name);
|
|
}
|
|
|
|
+ // Paper start
|
|
+ /**
|
|
+ * Gets the player by the given name, regardless if they are offline or
|
|
+ * online.
|
|
+ * <p>
|
|
+ * This will not make a web request to get the UUID for the given name,
|
|
+ * thus this method will not block. However this method will return
|
|
+ * {@code null} if the player is not cached.
|
|
+ * </p>
|
|
+ *
|
|
+ * @param name the name of the player to retrieve
|
|
+ * @return an offline player if cached, {@code null} otherwise
|
|
+ * @see #getOfflinePlayer(String)
|
|
+ * @see #getOfflinePlayer(java.util.UUID)
|
|
+ */
|
|
+ @Nullable
|
|
+ public static OfflinePlayer getOfflinePlayerIfCached(@NotNull String name) {
|
|
+ return server.getOfflinePlayerIfCached(name);
|
|
+ }
|
|
+ // Paper end
|
|
+
|
|
/**
|
|
* Gets the player by the given UUID, regardless if they are offline or
|
|
* online.
|
|
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
|
|
index d3b2188cd2a5d2b597965a216afb08b2c093aab2..55b1cf6b92ac386f3ce50593ee12216a48597437 100644
|
|
--- a/src/main/java/org/bukkit/Server.java
|
|
+++ b/src/main/java/org/bukkit/Server.java
|
|
@@ -828,6 +828,25 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
|
|
@NotNull
|
|
public OfflinePlayer getOfflinePlayer(@NotNull String name);
|
|
|
|
+ // Paper start
|
|
+ /**
|
|
+ * Gets the player by the given name, regardless if they are offline or
|
|
+ * online.
|
|
+ * <p>
|
|
+ * This will not make a web request to get the UUID for the given name,
|
|
+ * thus this method will not block. However this method will return
|
|
+ * {@code null} if the player is not cached.
|
|
+ * </p>
|
|
+ *
|
|
+ * @param name the name of the player to retrieve
|
|
+ * @return an offline player if cached, {@code null} otherwise
|
|
+ * @see #getOfflinePlayer(String)
|
|
+ * @see #getOfflinePlayer(java.util.UUID)
|
|
+ */
|
|
+ @Nullable
|
|
+ public OfflinePlayer getOfflinePlayerIfCached(@NotNull String name);
|
|
+ // Paper end
|
|
+
|
|
/**
|
|
* Gets the player by the given UUID, regardless if they are offline or
|
|
* online.
|