Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-11-15 12:30:06 +01:00
bc127ea819
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: eec4aab0 SPIGOT-6657: Add getPlayer to SheepDyeWoolEvent 205213c6 SPIGOT-6656: CauldronLevelChangeEvent is not fired correctly when dripstone fills the cauldron CraftBukkit Changes: b8c522d5 SPIGOT-6657: Add getPlayer to SheepDyeWoolEvent f04a77dc SPIGOT-6656: CauldronLevelChangeEvent is not fired correctly when dripstone fills the cauldron d1dbcebc SPIGOT-6653: Canceling snow bucket placement removes snow from bucket 4f34a67b #891: Fix scheduler task ID overflow and duplication issues Spigot Changes: d03d7f12 BUILDTOOLS-604: Rebuild patches
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 c6648e84f762ae4b2d06e2a5cd08ff1f7739f49a..cf7138a9251e92065fef8b0090eaaf779064e2fc 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 bc7bfb56bd0291c3ab1d74970057d4b0c52b3075..724a32e4a4861f9f9a8ffc5b5a497b458efffc0f 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.
|