aboutsummaryrefslogtreecommitdiffhomepage
path: root/patches/server/0098-Async-GameProfileCache-saving.patch
diff options
context:
space:
mode:
authorSpottedleaf <[email protected]>2023-09-22 13:13:57 -0700
committerSpottedleaf <[email protected]>2023-09-22 13:13:57 -0700
commite88856dd75de742fa10099af4fe06a07500b34fd (patch)
treed06086449e85f9b65949e65b5c11f836a9328d36 /patches/server/0098-Async-GameProfileCache-saving.patch
parent896aa8b54acd288703bdc973aafdb176b8578095 (diff)
downloadPaper-e88856dd75de742fa10099af4fe06a07500b34fd.tar.gz
Paper-e88856dd75de742fa10099af4fe06a07500b34fd.zip
Chunk system patch
Diffstat (limited to 'patches/server/0098-Async-GameProfileCache-saving.patch')
-rw-r--r--patches/server/0098-Async-GameProfileCache-saving.patch86
1 files changed, 0 insertions, 86 deletions
diff --git a/patches/server/0098-Async-GameProfileCache-saving.patch b/patches/server/0098-Async-GameProfileCache-saving.patch
deleted file mode 100644
index 441d547b12..0000000000
--- a/patches/server/0098-Async-GameProfileCache-saving.patch
+++ /dev/null
@@ -1,86 +0,0 @@
-From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
-From: Aikar <[email protected]>
-Date: Mon, 16 May 2016 20:47:41 -0400
-Subject: [PATCH] Async GameProfileCache saving
-
-
-diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
-index c6802d54fcd594f2fc7bd8615f8a95e5cfe9e1c0..8ef6e39e4711d2147e5ad97e9f8028e005588ac5 100644
---- a/src/main/java/net/minecraft/server/MinecraftServer.java
-+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
-@@ -933,7 +933,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
- } catch (java.lang.InterruptedException ignored) {} // Paper
- if (org.spigotmc.SpigotConfig.saveUserCacheOnStopOnly) {
- MinecraftServer.LOGGER.info("Saving usercache.json");
-- this.getProfileCache().save();
-+ this.getProfileCache().save(false); // Paper
- }
- // Spigot end
-
-diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
-index 8d4fadc9c65636259bdbdba28bb8a3f8f4e25768..6cc085cf212994cd00dbabd4dd363fc5b3c97281 100644
---- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
-+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
-@@ -242,7 +242,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
- }
-
- if (this.convertOldUsers()) {
-- this.getProfileCache().save();
-+ this.getProfileCache().save(false); // Paper
- }
-
- if (!OldUsersConverter.serverReadyAfterUserconversion(this)) {
-diff --git a/src/main/java/net/minecraft/server/players/GameProfileCache.java b/src/main/java/net/minecraft/server/players/GameProfileCache.java
-index 7170f8cfd733708089495b51647659237bd10385..322e07adc556ee8131d40d89856574b185ee4c94 100644
---- a/src/main/java/net/minecraft/server/players/GameProfileCache.java
-+++ b/src/main/java/net/minecraft/server/players/GameProfileCache.java
-@@ -115,7 +115,7 @@ public class GameProfileCache {
- GameProfileCache.GameProfileInfo usercache_usercacheentry = new GameProfileCache.GameProfileInfo(profile, date);
-
- this.safeAdd(usercache_usercacheentry);
-- if( !org.spigotmc.SpigotConfig.saveUserCacheOnStopOnly ) this.save(); // Spigot - skip saving if disabled
-+ if( !org.spigotmc.SpigotConfig.saveUserCacheOnStopOnly ) this.save(true); // Spigot - skip saving if disabled // Paper - async
- }
-
- private long getNextOperation() {
-@@ -148,7 +148,7 @@ public class GameProfileCache {
- }
-
- if (flag && !org.spigotmc.SpigotConfig.saveUserCacheOnStopOnly) { // Spigot - skip saving if disabled
-- this.save();
-+ this.save(true); // Paper
- }
-
- return optional;
-@@ -260,7 +260,7 @@ public class GameProfileCache {
- return arraylist;
- }
-
-- public void save() {
-+ public void save(boolean asyncSave) { // Paper
- JsonArray jsonarray = new JsonArray();
- DateFormat dateformat = GameProfileCache.createDateFormat();
-
-@@ -268,6 +268,7 @@ public class GameProfileCache {
- jsonarray.add(GameProfileCache.writeGameProfile(usercache_usercacheentry, dateformat));
- });
- String s = this.gson.toJson(jsonarray);
-+ Runnable save = () -> { // Paper
-
- try {
- BufferedWriter bufferedwriter = Files.newWriter(this.file, StandardCharsets.UTF_8);
-@@ -292,6 +293,14 @@ public class GameProfileCache {
- } catch (IOException ioexception) {
- ;
- }
-+ // Paper start
-+ };
-+ if (asyncSave) {
-+ io.papermc.paper.util.MCUtil.scheduleAsyncTask(save);
-+ } else {
-+ save.run();
-+ }
-+ // Paper end
-
- }
-