mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-03 01:10:37 +01:00
e6f8284125
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: d43a1e72 SPIGOT-2450: Improve scoreboard criteria API, add missing DisplaySlots 9d6e4847 SPIGOT-7122: New Allay Methods from 1.19.1 CraftBukkit Changes: c379a6b4e SPIGOT-2450: Improve scoreboard criteria API, add missing DisplaySlots 051fcced1 SPIGOT-7122: New Allay Methods from 1.19.1
40 lines
1.4 KiB
Diff
40 lines
1.4 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:34:50 +1100
|
|
Subject: [PATCH] Add getOfflinePlayerIfCached(String)
|
|
|
|
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
|
index 72e545e9aa01ad7ae4180d5421e16e330b4c9934..f5ed17af815f2e7da523e80319dc4021556376b2 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
|
@@ -1803,6 +1803,28 @@ public final class CraftServer implements Server {
|
|
return result;
|
|
}
|
|
|
|
+ // Paper start
|
|
+ @Override
|
|
+ @Nullable
|
|
+ public OfflinePlayer getOfflinePlayerIfCached(String name) {
|
|
+ Validate.notNull(name, "Name cannot be null");
|
|
+ Validate.notEmpty(name, "Name cannot be empty");
|
|
+
|
|
+ OfflinePlayer result = getPlayerExact(name);
|
|
+ if (result == null) {
|
|
+ GameProfile profile = console.getProfileCache().getProfileIfCached(name);
|
|
+
|
|
+ if (profile != null) {
|
|
+ result = getOfflinePlayer(profile);
|
|
+ }
|
|
+ } else {
|
|
+ offlinePlayers.remove(result.getUniqueId());
|
|
+ }
|
|
+
|
|
+ return result;
|
|
+ }
|
|
+ // Paper end
|
|
+
|
|
@Override
|
|
public OfflinePlayer getOfflinePlayer(UUID id) {
|
|
Validate.notNull(id, "UUID cannot be null");
|