mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-23 19:15:32 +01:00
Add getOfflinePlayerIfCached(UUID)
This commit is contained in:
parent
817550c520
commit
91ef82c99a
@ -1,14 +1,14 @@
|
||||
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)
|
||||
Subject: [PATCH] Add getOfflinePlayerIfCached()
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
|
||||
index 1a671331ec4ab21430d7d52e9a4f45510ef39944..e0f652117e585882693736de8165ae9c689e1d68 100644
|
||||
index 1393e4b146bdbf55004b54a5fc96e88a7dd7b8f6..a470a9ad8ee10da53d7fc62c46263a562d2b457b 100644
|
||||
--- a/src/main/java/org/bukkit/Bukkit.java
|
||||
+++ b/src/main/java/org/bukkit/Bukkit.java
|
||||
@@ -1374,6 +1374,27 @@ public final class Bukkit {
|
||||
@@ -1374,6 +1374,41 @@ public final class Bukkit {
|
||||
return server.getOfflinePlayer(name);
|
||||
}
|
||||
|
||||
@ -31,16 +31,30 @@ index 1a671331ec4ab21430d7d52e9a4f45510ef39944..e0f652117e585882693736de8165ae9c
|
||||
+ public static OfflinePlayer getOfflinePlayerIfCached(@NotNull String name) {
|
||||
+ return server.getOfflinePlayerIfCached(name);
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the player by the given UUID, regardless if they are offline or
|
||||
+ * online.
|
||||
+ *
|
||||
+ * @param id the UUID 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 UUID id) {
|
||||
+ return server.getOfflinePlayerIfCached(id);
|
||||
+ }
|
||||
+ // 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 7dbd9b32e96c015e3ed757ea0fa7e2bfcf4af85e..90111a9ae0b7bdd6e46e869398dc6b9898b5f87e 100644
|
||||
index 89e51b10bd8d89e4bab608a7fb9b491e4e147c0a..6a2a22bdbb15f23a20f3a7bd1aed83fd10d1454c 100644
|
||||
--- a/src/main/java/org/bukkit/Server.java
|
||||
+++ b/src/main/java/org/bukkit/Server.java
|
||||
@@ -1161,6 +1161,25 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
|
||||
@@ -1161,6 +1161,37 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
|
||||
@NotNull
|
||||
public OfflinePlayer getOfflinePlayer(@NotNull String name);
|
||||
|
||||
@ -61,6 +75,18 @@ index 7dbd9b32e96c015e3ed757ea0fa7e2bfcf4af85e..90111a9ae0b7bdd6e46e869398dc6b98
|
||||
+ */
|
||||
+ @Nullable
|
||||
+ public OfflinePlayer getOfflinePlayerIfCached(@NotNull String name);
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the player by the given UUID, regardless if they are offline or
|
||||
+ * online.
|
||||
+ *
|
||||
+ * @param id the UUID 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 UUID id);
|
||||
+ // Paper end
|
||||
+
|
||||
/**
|
@ -191,10 +191,10 @@ index 80e3e64f47ac55a4978c9e5b430e2f2d1c871d1b..ac68dfce754dc7e014bb31bba32d9b24
|
||||
final RegistryKey<T> registryKey = createInternal(key);
|
||||
REGISTRY_KEYS.add(registryKey);
|
||||
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
|
||||
index 3470755c65a2db38e679adc35d3d43f7fef5468d..1fe3a5e2f5c15fddfbcd503a061ebf7502907b8c 100644
|
||||
index a470a9ad8ee10da53d7fc62c46263a562d2b457b..d250f7c49ffc1499132ba40452067995ea9b68b1 100644
|
||||
--- a/src/main/java/org/bukkit/Bukkit.java
|
||||
+++ b/src/main/java/org/bukkit/Bukkit.java
|
||||
@@ -2434,8 +2434,11 @@ public final class Bukkit {
|
||||
@@ -2448,8 +2448,11 @@ public final class Bukkit {
|
||||
* @param tClass of the registry to get
|
||||
* @param <T> type of the registry
|
||||
* @return the corresponding registry or null if not present
|
||||
@ -429,10 +429,10 @@ index b4f297f90e3c1deaa1fc3f4418418588ab19b6c5..46dce7c2a543f6b165975565ea9d4065
|
||||
* Get the object by its key.
|
||||
*
|
||||
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
|
||||
index 6bc43f3a5748a1b83aa4c4d462df3cbc9220c267..cad9c18dbe56ffcef377f0b1162bc880fc56aa6c 100644
|
||||
index 6a2a22bdbb15f23a20f3a7bd1aed83fd10d1454c..749e9528e3f900a31f36cce4314dfa9d5ca13d87 100644
|
||||
--- a/src/main/java/org/bukkit/Server.java
|
||||
+++ b/src/main/java/org/bukkit/Server.java
|
||||
@@ -2077,8 +2077,11 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
|
||||
@@ -2089,8 +2089,11 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
|
||||
* @param tClass of the registry to get
|
||||
* @param <T> type of the registry
|
||||
* @return the corresponding registry or null if not present
|
||||
|
@ -206,7 +206,7 @@ index 0000000000000000000000000000000000000000..0dfd101f01d16cc38f21831ca8736334
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
|
||||
index 885c83ba1d94460cb72b177c2cff1afdaa8696bc..f81250ff8fd0fe8caa780719624b8d9c731fe188 100644
|
||||
index 1fb53975d868b79b58e37ca29727298532ccf4d0..2b9ea42ecc464a102c32a85c9e78c2862c226b7c 100644
|
||||
--- a/src/main/java/org/bukkit/Bukkit.java
|
||||
+++ b/src/main/java/org/bukkit/Bukkit.java
|
||||
@@ -328,9 +328,11 @@ public final class Bukkit {
|
||||
@ -221,7 +221,7 @@ index 885c83ba1d94460cb72b177c2cff1afdaa8696bc..f81250ff8fd0fe8caa780719624b8d9c
|
||||
public static DataPackManager getDataPackManager() {
|
||||
return server.getDataPackManager();
|
||||
}
|
||||
@@ -2641,6 +2643,14 @@ public final class Bukkit {
|
||||
@@ -2655,6 +2657,14 @@ public final class Bukkit {
|
||||
public static com.destroystokyo.paper.entity.ai.MobGoals getMobGoals() {
|
||||
return server.getMobGoals();
|
||||
}
|
||||
@ -249,7 +249,7 @@ index 39277b3113a3bd0736330773e3c5c1f747773b55..c18fb0c9a6635a67041ba7499e8b2f97
|
||||
if (isItem()) {
|
||||
return Bukkit.getDataPackManager().isEnabledByFeature(asItemType(), world);
|
||||
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
|
||||
index a85281b4099fe26b8e27b76d3dac6ee917c48c75..5b0aee3b7956d07a45eefa24e57dac674882f8ff 100644
|
||||
index 53bb16f6d70e8087b6ee5919fe9cb5d196ba96e7..49474020131bc1d38b3fcf2bfdb83c2dbb9d497d 100644
|
||||
--- a/src/main/java/org/bukkit/Server.java
|
||||
+++ b/src/main/java/org/bukkit/Server.java
|
||||
@@ -267,9 +267,11 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
|
||||
@ -264,7 +264,7 @@ index a85281b4099fe26b8e27b76d3dac6ee917c48c75..5b0aee3b7956d07a45eefa24e57dac67
|
||||
public DataPackManager getDataPackManager();
|
||||
|
||||
/**
|
||||
@@ -2302,5 +2304,11 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
|
||||
@@ -2314,5 +2316,11 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
|
||||
*/
|
||||
@NotNull
|
||||
com.destroystokyo.paper.entity.ai.MobGoals getMobGoals();
|
||||
|
@ -5,10 +5,10 @@ Subject: [PATCH] API for creating command sender which forwards feedback
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
|
||||
index be68351555bde59a4e55bf1bad261e9f6bc9f704..e2d3e42b403dce454988c3ae3e44bcd89337b1cf 100644
|
||||
index 2b9ea42ecc464a102c32a85c9e78c2862c226b7c..2bda73858f1192dc47de094808bb95794e1fffd4 100644
|
||||
--- a/src/main/java/org/bukkit/Bukkit.java
|
||||
+++ b/src/main/java/org/bukkit/Bukkit.java
|
||||
@@ -1595,6 +1595,20 @@ public final class Bukkit {
|
||||
@@ -1609,6 +1609,20 @@ public final class Bukkit {
|
||||
return server.getConsoleSender();
|
||||
}
|
||||
|
||||
@ -30,10 +30,10 @@ index be68351555bde59a4e55bf1bad261e9f6bc9f704..e2d3e42b403dce454988c3ae3e44bcd8
|
||||
* Gets the folder that contains all of the various {@link World}s.
|
||||
*
|
||||
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
|
||||
index 45693e6c02eac37eb609cd3c59253a949a6ca4c0..5dd7ce5c008c852dbeb0474a70e9357230406318 100644
|
||||
index 49474020131bc1d38b3fcf2bfdb83c2dbb9d497d..efb52959894a3b164b03c7875090f971212fb221 100644
|
||||
--- a/src/main/java/org/bukkit/Server.java
|
||||
+++ b/src/main/java/org/bukkit/Server.java
|
||||
@@ -1349,6 +1349,18 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
|
||||
@@ -1361,6 +1361,18 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
|
||||
@NotNull
|
||||
public ConsoleCommandSender getConsoleSender();
|
||||
|
||||
|
@ -152,10 +152,10 @@ index 0000000000000000000000000000000000000000..c252b432a9df5fd7da71a5eecba37a88
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
|
||||
index 391088f214f21d23c2cbd81d3406a41d21f7665a..a7c42a10aee3d71203d25f522a1d304ccffd168b 100644
|
||||
index 2bda73858f1192dc47de094808bb95794e1fffd4..b3aeaf9dc9a039773d7d2ba85adea4abe9ff4e04 100644
|
||||
--- a/src/main/java/org/bukkit/Bukkit.java
|
||||
+++ b/src/main/java/org/bukkit/Bukkit.java
|
||||
@@ -2665,6 +2665,15 @@ public final class Bukkit {
|
||||
@@ -2679,6 +2679,15 @@ public final class Bukkit {
|
||||
public static io.papermc.paper.datapack.DatapackManager getDatapackManager() {
|
||||
return server.getDatapackManager();
|
||||
}
|
||||
@ -172,10 +172,10 @@ index 391088f214f21d23c2cbd81d3406a41d21f7665a..a7c42a10aee3d71203d25f522a1d304c
|
||||
|
||||
@NotNull
|
||||
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
|
||||
index 372be75058eb39ee9123e53462af4586a4b512f2..9a9f7ff35d3958c3156d66bc5f3906c65b0696d9 100644
|
||||
index efb52959894a3b164b03c7875090f971212fb221..161310c71442f0b44df1178c14125b1e927f7e77 100644
|
||||
--- a/src/main/java/org/bukkit/Server.java
|
||||
+++ b/src/main/java/org/bukkit/Server.java
|
||||
@@ -2322,5 +2322,12 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
|
||||
@@ -2334,5 +2334,12 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
|
||||
*/
|
||||
@NotNull
|
||||
io.papermc.paper.datapack.DatapackManager getDatapackManager();
|
||||
|
@ -499,10 +499,10 @@ index 0000000000000000000000000000000000000000..a6b50c9d8af589cc4747e14d343d2045
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
|
||||
index 7919a001e5b5886a3d0fb64913064bc9607a2102..0f0b5b69a6cf7aac62a9802f2778cce4f08cfb88 100644
|
||||
index 75fd382f24dc4ff3687cbefe856ae130f11e6c28..b2cb9c36516b6af1834be8c019af4524eebf47aa 100644
|
||||
--- a/src/main/java/org/bukkit/Bukkit.java
|
||||
+++ b/src/main/java/org/bukkit/Bukkit.java
|
||||
@@ -2696,6 +2696,141 @@ public final class Bukkit {
|
||||
@@ -2710,6 +2710,141 @@ public final class Bukkit {
|
||||
}
|
||||
// Paper end
|
||||
|
||||
@ -645,10 +645,10 @@ index 7919a001e5b5886a3d0fb64913064bc9607a2102..0f0b5b69a6cf7aac62a9802f2778cce4
|
||||
public static Server.Spigot spigot() {
|
||||
return server.spigot();
|
||||
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
|
||||
index 2801f4b27bb77e2d5698f82dd14c4a92d2f4392c..01b1aa2af1aac83ac8b341e7ba2803317373056b 100644
|
||||
index 23dec39c157158f0afcf5f0a351a60e70487b7fa..d68f36250c1ba423c5d8d4b5eaa320a08672dbc8 100644
|
||||
--- a/src/main/java/org/bukkit/Server.java
|
||||
+++ b/src/main/java/org/bukkit/Server.java
|
||||
@@ -2351,4 +2351,119 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
|
||||
@@ -2363,4 +2363,119 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
|
||||
*/
|
||||
@NotNull org.bukkit.potion.PotionBrewer getPotionBrewer();
|
||||
// Paper end
|
||||
|
@ -70,10 +70,10 @@ index a77c0411a68a9bad33ddfb335b7a996a843e478c..739d9d3ec789e58c10c8d818a9ca59ce
|
||||
/**
|
||||
* Banned player names
|
||||
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
|
||||
index c8fa12acaf52cd3923a7a8702ccc50cfdc9170a2..e20e4239a5a1f952e1c70e899549989d5e42f73c 100644
|
||||
index 92a349cbebd689dcc07f6504865a2a0df9fe6d01..1a3841ed7e354e5f5a1d8821dc2cf05dd8edf416 100644
|
||||
--- a/src/main/java/org/bukkit/Bukkit.java
|
||||
+++ b/src/main/java/org/bukkit/Bukkit.java
|
||||
@@ -1663,11 +1663,27 @@ public final class Bukkit {
|
||||
@@ -1677,11 +1677,27 @@ public final class Bukkit {
|
||||
* @param <T> The ban target
|
||||
*
|
||||
* @return a ban list of the specified type
|
||||
@ -102,10 +102,10 @@ index c8fa12acaf52cd3923a7a8702ccc50cfdc9170a2..e20e4239a5a1f952e1c70e899549989d
|
||||
/**
|
||||
* Gets a set containing all player operators.
|
||||
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
|
||||
index 50ffca9bccfb582d58ccb13f0decf66e5d91aef3..6246251caf2c6f025c824b8e7a944b8d48751fa1 100644
|
||||
index 4fbc8fa671ffabca96263590933f95a2d7861f91..df02f448604b49cfef33c405cd87732b1966b5e4 100644
|
||||
--- a/src/main/java/org/bukkit/Server.java
|
||||
+++ b/src/main/java/org/bukkit/Server.java
|
||||
@@ -1425,10 +1425,25 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
|
||||
@@ -1437,10 +1437,25 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
|
||||
* @param <T> The ban target
|
||||
*
|
||||
* @return a ban list of the specified type
|
||||
|
@ -5,10 +5,10 @@ Subject: [PATCH] API to check if the server is sleeping
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
|
||||
index 0b78564256ebc647ebac402e549d86ab6e307c8d..ba366576a571214e67bcc529dc1bca19e1d59ef8 100644
|
||||
index df02f448604b49cfef33c405cd87732b1966b5e4..89bbb1678537fc0e3cd8051296bd554fbb85a3ff 100644
|
||||
--- a/src/main/java/org/bukkit/Server.java
|
||||
+++ b/src/main/java/org/bukkit/Server.java
|
||||
@@ -2572,4 +2572,11 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
|
||||
@@ -2584,4 +2584,11 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
|
||||
*/
|
||||
boolean isOwnedByCurrentRegion(@NotNull Entity entity);
|
||||
// Paper end - Folia region threading API
|
||||
|
@ -5,10 +5,10 @@ Subject: [PATCH] API to allow/disallow tick sleeping
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
|
||||
index ba366576a571214e67bcc529dc1bca19e1d59ef8..f55638eb8b315864052f9fe17ab4846e5e9d8dbb 100644
|
||||
index 89bbb1678537fc0e3cd8051296bd554fbb85a3ff..e613b3480b1c662ae5239bdbbeedac48c6c67a89 100644
|
||||
--- a/src/main/java/org/bukkit/Server.java
|
||||
+++ b/src/main/java/org/bukkit/Server.java
|
||||
@@ -2578,5 +2578,14 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
|
||||
@@ -2590,5 +2590,14 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
|
||||
* Returns whether the server is sleeping/paused.
|
||||
*/
|
||||
boolean isPaused();
|
||||
|
@ -604,10 +604,10 @@ index 7399358f18dc7869fbfe414186cf18414c1eaafc..a9dadd106ff0ac0f788c16048a73dfc3
|
||||
String s = (String) Optional.ofNullable((String) optionset.valueOf("world")).orElse(dedicatedserversettings.getProperties().levelName);
|
||||
LevelStorageSource convertable = LevelStorageSource.createDefault(file.toPath());
|
||||
diff --git a/src/main/java/net/minecraft/server/players/GameProfileCache.java b/src/main/java/net/minecraft/server/players/GameProfileCache.java
|
||||
index 416b26c2ab62b29d640169166980e398d5824b14..774d81c702edb76a2f6184d4dc53687de6734a79 100644
|
||||
index 416b26c2ab62b29d640169166980e398d5824b14..87f664e6a6645b3d3214c7773009b28f3bb8422e 100644
|
||||
--- a/src/main/java/net/minecraft/server/players/GameProfileCache.java
|
||||
+++ b/src/main/java/net/minecraft/server/players/GameProfileCache.java
|
||||
@@ -126,6 +126,17 @@ public class GameProfileCache {
|
||||
@@ -126,6 +126,26 @@ public class GameProfileCache {
|
||||
return this.operationCount.incrementAndGet();
|
||||
}
|
||||
|
||||
@ -620,6 +620,15 @@ index 416b26c2ab62b29d640169166980e398d5824b14..774d81c702edb76a2f6184d4dc53687d
|
||||
+ entry.setLastAccess(this.getNextOperation());
|
||||
+ return entry.getProfile();
|
||||
+ }
|
||||
+
|
||||
+ public @Nullable GameProfile getProfileIfCached(UUID id) {
|
||||
+ GameProfileCache.GameProfileInfo entry = this.profilesByUUID.get(id);
|
||||
+ if (entry == null) {
|
||||
+ return null;
|
||||
+ }
|
||||
+ entry.setLastAccess(this.getNextOperation());
|
||||
+ return entry.getProfile();
|
||||
+ }
|
||||
+ // Paper end
|
||||
+
|
||||
public Optional<GameProfile> get(String name) {
|
||||
|
@ -1,14 +1,14 @@
|
||||
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)
|
||||
Subject: [PATCH] Add getOfflinePlayerIfCached()
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
index 9905555f249db72649bde8401835dd816ed7b428..f75d73402cf633254fe1ef4e919f09db48165190 100644
|
||||
index 9905555f249db72649bde8401835dd816ed7b428..95d9c8ee1327cbe920b85f4f4ba28057abe10837 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
@@ -1968,6 +1968,28 @@ public final class CraftServer implements Server {
|
||||
@@ -1968,6 +1968,47 @@ public final class CraftServer implements Server {
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -32,6 +32,25 @@ index 9905555f249db72649bde8401835dd816ed7b428..f75d73402cf633254fe1ef4e919f09db
|
||||
+
|
||||
+ return result;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ @Nullable
|
||||
+ public OfflinePlayer getOfflinePlayerIfCached(UUID id) {
|
||||
+ Preconditions.checkArgument(id != null, "UUID cannot be null");
|
||||
+
|
||||
+ OfflinePlayer result = getPlayer(id);
|
||||
+ if (result == null) {
|
||||
+ GameProfile profile = console.getProfileCache().getProfileIfCached(id);
|
||||
+
|
||||
+ if (profile != null) {
|
||||
+ result = getOfflinePlayer(profile);
|
||||
+ }
|
||||
+ } else {
|
||||
+ offlinePlayers.remove(result.getUniqueId());
|
||||
+ }
|
||||
+
|
||||
+ return result;
|
||||
+ }
|
||||
+ // Paper end
|
||||
+
|
||||
@Override
|
@ -886,7 +886,7 @@ index 0d091c7b328fb70a82f5b5ded7dec61b7cd3d59a..249f0dcad04a35244da6dab837a461bb
|
||||
@Override
|
||||
public B get(NamespacedKey namespacedKey) {
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
index f75d73402cf633254fe1ef4e919f09db48165190..5ae8f646083fb580ac8d28fcbfe8ed2208b45d09 100644
|
||||
index 95d9c8ee1327cbe920b85f4f4ba28057abe10837..908b166955e29a1df88784c9c9c991eefbbf7731 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
@@ -284,7 +284,7 @@ public final class CraftServer implements Server {
|
||||
@ -906,7 +906,7 @@ index f75d73402cf633254fe1ef4e919f09db48165190..5ae8f646083fb580ac8d28fcbfe8ed22
|
||||
ConfigurationSection compatibilities = this.configuration.getConfigurationSection("settings.compatibility");
|
||||
if (compatibilities == null) {
|
||||
this.activeCompatibilities = Collections.emptySet();
|
||||
@@ -2754,7 +2755,7 @@ public final class CraftServer implements Server {
|
||||
@@ -2773,7 +2774,7 @@ public final class CraftServer implements Server {
|
||||
|
||||
@Override
|
||||
public <T extends Keyed> Registry<T> getRegistry(Class<T> aClass) {
|
||||
|
@ -176,7 +176,7 @@ index 0000000000000000000000000000000000000000..caa41c525d2b36b5a9f9942380f06c97
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
index 3cfacacd1d8fd17ec4b54936afd8124823b1a00b..b4af066a21e4893b5ec146d109b5146b6996a0cf 100644
|
||||
index f2c9d529702f03fac1f878196647bffecb20bb16..8377f4d0eb2fbaad9a9861cdeeab8402dae4ac16 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
@@ -308,6 +308,7 @@ public final class CraftServer implements Server {
|
||||
@ -195,7 +195,7 @@ index 3cfacacd1d8fd17ec4b54936afd8124823b1a00b..b4af066a21e4893b5ec146d109b5146b
|
||||
}
|
||||
|
||||
public boolean getCommandBlockOverride(String command) {
|
||||
@@ -3036,5 +3038,11 @@ public final class CraftServer implements Server {
|
||||
@@ -3055,5 +3057,11 @@ public final class CraftServer implements Server {
|
||||
public com.destroystokyo.paper.entity.ai.MobGoals getMobGoals() {
|
||||
return mobGoals;
|
||||
}
|
||||
|
@ -7,7 +7,7 @@ Separate lookup and state access locks prevent lookups
|
||||
from stalling simple state access/write calls
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/players/GameProfileCache.java b/src/main/java/net/minecraft/server/players/GameProfileCache.java
|
||||
index 774d81c702edb76a2f6184d4dc53687de6734a79..34b4166adfae8ff7d1eb73d56a72931b005330a7 100644
|
||||
index 87f664e6a6645b3d3214c7773009b28f3bb8422e..b5c89bef6bf240be488c8dd55590a1be341f0e44 100644
|
||||
--- a/src/main/java/net/minecraft/server/players/GameProfileCache.java
|
||||
+++ b/src/main/java/net/minecraft/server/players/GameProfileCache.java
|
||||
@@ -60,6 +60,11 @@ public class GameProfileCache {
|
||||
@ -36,7 +36,7 @@ index 774d81c702edb76a2f6184d4dc53687de6734a79..34b4166adfae8ff7d1eb73d56a72931b
|
||||
}
|
||||
|
||||
private static Optional<GameProfile> lookupGameProfile(GameProfileRepository repository, String name) {
|
||||
@@ -128,17 +135,20 @@ public class GameProfileCache {
|
||||
@@ -128,12 +135,14 @@ public class GameProfileCache {
|
||||
|
||||
// Paper start
|
||||
public @Nullable GameProfile getProfileIfCached(String name) {
|
||||
@ -49,7 +49,9 @@ index 774d81c702edb76a2f6184d4dc53687de6734a79..34b4166adfae8ff7d1eb73d56a72931b
|
||||
return entry.getProfile();
|
||||
+ } finally { this.stateLock.unlock(); } // Paper - Fix GameProfileCache concurrency
|
||||
}
|
||||
// Paper end
|
||||
|
||||
public @Nullable GameProfile getProfileIfCached(UUID id) {
|
||||
@@ -148,6 +157,7 @@ public class GameProfileCache {
|
||||
|
||||
public Optional<GameProfile> get(String name) {
|
||||
String s1 = name.toLowerCase(Locale.ROOT);
|
||||
@ -57,7 +59,7 @@ index 774d81c702edb76a2f6184d4dc53687de6734a79..34b4166adfae8ff7d1eb73d56a72931b
|
||||
GameProfileCache.GameProfileInfo usercache_usercacheentry = (GameProfileCache.GameProfileInfo) this.profilesByName.get(s1);
|
||||
boolean flag = false;
|
||||
|
||||
@@ -154,8 +164,12 @@ public class GameProfileCache {
|
||||
@@ -163,8 +173,12 @@ public class GameProfileCache {
|
||||
if (usercache_usercacheentry != null) {
|
||||
usercache_usercacheentry.setLastAccess(this.getNextOperation());
|
||||
optional = Optional.of(usercache_usercacheentry.getProfile());
|
||||
@ -70,7 +72,7 @@ index 774d81c702edb76a2f6184d4dc53687de6734a79..34b4166adfae8ff7d1eb73d56a72931b
|
||||
if (optional.isPresent()) {
|
||||
this.add((GameProfile) optional.get());
|
||||
flag = false;
|
||||
@@ -167,6 +181,7 @@ public class GameProfileCache {
|
||||
@@ -176,6 +190,7 @@ public class GameProfileCache {
|
||||
}
|
||||
|
||||
return optional;
|
||||
@ -78,7 +80,7 @@ index 774d81c702edb76a2f6184d4dc53687de6734a79..34b4166adfae8ff7d1eb73d56a72931b
|
||||
}
|
||||
|
||||
public CompletableFuture<Optional<GameProfile>> getAsync(String username) {
|
||||
@@ -191,6 +206,7 @@ public class GameProfileCache {
|
||||
@@ -200,6 +215,7 @@ public class GameProfileCache {
|
||||
}
|
||||
|
||||
public Optional<GameProfile> get(UUID uuid) {
|
||||
@ -86,7 +88,7 @@ index 774d81c702edb76a2f6184d4dc53687de6734a79..34b4166adfae8ff7d1eb73d56a72931b
|
||||
GameProfileCache.GameProfileInfo usercache_usercacheentry = (GameProfileCache.GameProfileInfo) this.profilesByUUID.get(uuid);
|
||||
|
||||
if (usercache_usercacheentry == null) {
|
||||
@@ -199,6 +215,7 @@ public class GameProfileCache {
|
||||
@@ -208,6 +224,7 @@ public class GameProfileCache {
|
||||
usercache_usercacheentry.setLastAccess(this.getNextOperation());
|
||||
return Optional.of(usercache_usercacheentry.getProfile());
|
||||
}
|
||||
@ -94,7 +96,7 @@ index 774d81c702edb76a2f6184d4dc53687de6734a79..34b4166adfae8ff7d1eb73d56a72931b
|
||||
}
|
||||
|
||||
public void setExecutor(Executor executor) {
|
||||
@@ -279,7 +296,7 @@ public class GameProfileCache {
|
||||
@@ -288,7 +305,7 @@ public class GameProfileCache {
|
||||
JsonArray jsonarray = new JsonArray();
|
||||
DateFormat dateformat = GameProfileCache.createDateFormat();
|
||||
|
||||
@ -103,7 +105,7 @@ index 774d81c702edb76a2f6184d4dc53687de6734a79..34b4166adfae8ff7d1eb73d56a72931b
|
||||
jsonarray.add(GameProfileCache.writeGameProfile(usercache_usercacheentry, dateformat));
|
||||
});
|
||||
String s = this.gson.toJson(jsonarray);
|
||||
@@ -320,8 +337,19 @@ public class GameProfileCache {
|
||||
@@ -329,8 +346,19 @@ public class GameProfileCache {
|
||||
}
|
||||
|
||||
private Stream<GameProfileCache.GameProfileInfo> getTopMRUProfiles(int limit) {
|
||||
|
@ -278,10 +278,10 @@ index 606a60fe273974b71ed2bd40be819d848627e777..bf943feca387b77a3154773a59da7190
|
||||
BlockPos blockposition = NaturalSpawner.getRandomPosWithin(world, chunk);
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
index 45d887f4143444321f563cdd7d084b2b9ccf911e..33d9f3778996eedc83064332a2fbbdc7c6a8ba90 100644
|
||||
index e4845e40c36c24fdf5b6cb0597fdb9c1cc35a1ac..c08c3085360ec2304aa740635d014aa74166fea9 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
@@ -2334,6 +2334,11 @@ public final class CraftServer implements Server {
|
||||
@@ -2353,6 +2353,11 @@ public final class CraftServer implements Server {
|
||||
|
||||
@Override
|
||||
public int getSpawnLimit(SpawnCategory spawnCategory) {
|
||||
|
@ -122,10 +122,10 @@ index 0000000000000000000000000000000000000000..e3a5f1ec376319bdfda87fa27ae217bf
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
index 62ab88e022230d25ffb359981ce7da4e64a9be5a..3b01907bc119853e0676e912e9a29b05d9aa5763 100644
|
||||
index 373d0f2b0c8912b342bdba173ac1244ba3bbb438..9dad0cca4ee1f461334feed0a5cce05afc231be2 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
@@ -2165,6 +2165,13 @@ public final class CraftServer implements Server {
|
||||
@@ -2184,6 +2184,13 @@ public final class CraftServer implements Server {
|
||||
return this.console.console;
|
||||
}
|
||||
|
||||
|
@ -6,10 +6,10 @@ Subject: [PATCH] Add missing Validate calls to CraftServer#getSpawnLimit
|
||||
Copies appropriate checks from CraftWorld#getSpawnLimit
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
index 3b01907bc119853e0676e912e9a29b05d9aa5763..188e3066d6659b5e45cec0b50dcbd5d20659830a 100644
|
||||
index 9dad0cca4ee1f461334feed0a5cce05afc231be2..fe5d0bbfc0ec7dd820408d5f487602c9135a6732 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
@@ -2342,6 +2342,8 @@ public final class CraftServer implements Server {
|
||||
@@ -2361,6 +2361,8 @@ public final class CraftServer implements Server {
|
||||
@Override
|
||||
public int getSpawnLimit(SpawnCategory spawnCategory) {
|
||||
// Paper start - Add mobcaps commands
|
||||
|
@ -46,10 +46,10 @@ index 0000000000000000000000000000000000000000..874c420e60b6be09c806d64f40cf6366
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
index 188e3066d6659b5e45cec0b50dcbd5d20659830a..72f8d3a89396f9289f5b451b24cc181e7ac3222e 100644
|
||||
index fe5d0bbfc0ec7dd820408d5f487602c9135a6732..454c726222ccef31a6b26f98fd52ac64bd25795a 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
@@ -2709,6 +2709,15 @@ public final class CraftServer implements Server {
|
||||
@@ -2728,6 +2728,15 @@ public final class CraftServer implements Server {
|
||||
return (org.bukkit.Tag<T>) new CraftDamageTag(damageRegistry, damageTagKey);
|
||||
}
|
||||
}
|
||||
@ -65,7 +65,7 @@ index 188e3066d6659b5e45cec0b50dcbd5d20659830a..72f8d3a89396f9289f5b451b24cc181e
|
||||
default -> throw new IllegalArgumentException();
|
||||
}
|
||||
|
||||
@@ -2746,6 +2755,13 @@ public final class CraftServer implements Server {
|
||||
@@ -2765,6 +2774,13 @@ public final class CraftServer implements Server {
|
||||
net.minecraft.core.Registry<DamageType> damageTags = CraftRegistry.getMinecraftRegistry(Registries.DAMAGE_TYPE);
|
||||
return damageTags.getTags().map(pair -> (org.bukkit.Tag<T>) new CraftDamageTag(damageTags, pair.key())).collect(ImmutableList.toImmutableList());
|
||||
}
|
||||
|
@ -282,7 +282,7 @@ index e167c2834f1b7899a7d11cef782940deeb739a9c..2bafacd7bc56186d9105d2031180f8c4
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
index 75bd9617164c63a641602bf772a5e0f15a322c7e..82e1c4713e043c4903b1f0154609da4558f90aef 100644
|
||||
index 8c64ea13e6afc6558f30e193bd44df4c13e9f199..dc0d4eab0b7b6251b9d8224119f5879bfb9f3d4e 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
@@ -311,6 +311,7 @@ public final class CraftServer implements Server {
|
||||
@ -301,7 +301,7 @@ index 75bd9617164c63a641602bf772a5e0f15a322c7e..82e1c4713e043c4903b1f0154609da45
|
||||
datapackManager = new io.papermc.paper.datapack.PaperDatapackManager(console.getPackRepository()); // Paper
|
||||
}
|
||||
|
||||
@@ -3076,5 +3078,9 @@ public final class CraftServer implements Server {
|
||||
@@ -3095,5 +3097,9 @@ public final class CraftServer implements Server {
|
||||
return datapackManager;
|
||||
}
|
||||
|
||||
|
@ -5,10 +5,10 @@ Subject: [PATCH] improve BanList types
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
index 7cc96d03472a4cb94e679251f0969995284f7eaa..54ef70eff81194c85d6433d00382a5909b6d797f 100644
|
||||
index 8ff49414a392590cda4aed6a6e3628d1e6e74dc7..b350c588521c02331bfe909cf109b514381afc6d 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
@@ -2260,6 +2260,21 @@ public final class CraftServer implements Server {
|
||||
@@ -2279,6 +2279,21 @@ public final class CraftServer implements Server {
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -1599,10 +1599,10 @@ index 5fc9e8e969debb3e15ed474b36a1c48b086d0449..f65cc95ab28e8a3b21eac2b16bd9ebe9
|
||||
private static final byte[] EMPTY_LIGHT = new byte[2048];
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
index c65a4bb7f1818378a5e571d39a5aabe8ad87d16c..758d86865136e5ef58f401f00c5e62fbb8cf25a3 100644
|
||||
index ebdc27d340034224c35cd662cd0b3da0b82bd48e..55445fbf02a2bc4c03341723f45a67afea2288a4 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
@@ -2702,7 +2702,7 @@ public final class CraftServer implements Server {
|
||||
@@ -2721,7 +2721,7 @@ public final class CraftServer implements Server {
|
||||
public ChunkGenerator.ChunkData createChunkData(World world) {
|
||||
Preconditions.checkArgument(world != null, "World cannot be null");
|
||||
ServerLevel handle = ((CraftWorld) world).getHandle();
|
||||
|
@ -36027,7 +36027,7 @@ index f65cc95ab28e8a3b21eac2b16bd9ebe97e56e571..0074bc0e7147dc3a8c538e796f14ac9b
|
||||
|
||||
@Override
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
index 758d86865136e5ef58f401f00c5e62fbb8cf25a3..6323738fe96c8e815a0835e6d8b03125c36ecf90 100644
|
||||
index 55445fbf02a2bc4c03341723f45a67afea2288a4..785439c86efe6af8a041e584e74b296bdccfd3fa 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
@@ -1432,7 +1432,7 @@ public final class CraftServer implements Server {
|
||||
@ -36048,7 +36048,7 @@ index 758d86865136e5ef58f401f00c5e62fbb8cf25a3..6323738fe96c8e815a0835e6d8b03125
|
||||
handle.convertable.close();
|
||||
} catch (Exception ex) {
|
||||
this.getLogger().log(Level.SEVERE, null, ex);
|
||||
@@ -2515,7 +2515,7 @@ public final class CraftServer implements Server {
|
||||
@@ -2534,7 +2534,7 @@ public final class CraftServer implements Server {
|
||||
|
||||
@Override
|
||||
public boolean isPrimaryThread() {
|
||||
|
@ -20,10 +20,10 @@ index 64b56abf8900d0424100da460fc68ac964394793..5d070f036dae6d93f863c55192b55741
|
||||
+ // Paper end - API to check if the server is sleeping
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
index 806e56cb60235a99f468d36a059fdbd54c2d46e3..605662917a7720a6c5134fd1d93aa2d26116b76d 100644
|
||||
index db73b602190c554786a502c9f4d47a40893ca8db..a9fb8565f2bd5dd378266bd4995437c2a6e068a5 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
@@ -3246,4 +3246,11 @@ public final class CraftServer implements Server {
|
||||
@@ -3265,4 +3265,11 @@ public final class CraftServer implements Server {
|
||||
return this.potionBrewer;
|
||||
}
|
||||
// Paper end
|
||||
|
@ -51,10 +51,10 @@ index 5d070f036dae6d93f863c55192b557419634456d..663b4ecd520e82aa108d44f2d5c2a20c
|
||||
// Paper end - API to check if the server is sleeping
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
index 605662917a7720a6c5134fd1d93aa2d26116b76d..cac8592e3a2f438fe9ca167a4fdcd65152bbb2de 100644
|
||||
index a9fb8565f2bd5dd378266bd4995437c2a6e068a5..015c7a13a7cb10823da7b171c4ade896562ba368 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
@@ -3252,5 +3252,10 @@ public final class CraftServer implements Server {
|
||||
@@ -3271,5 +3271,10 @@ public final class CraftServer implements Server {
|
||||
public boolean isPaused() {
|
||||
return this.console.isTickPaused();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user