From 4c24cd0ef3f35c886f62f835141cc5e7f3625482 Mon Sep 17 00:00:00 2001 From: Jake Potrebic Date: Mon, 4 Jan 2021 19:49:50 -0800 Subject: [PATCH] fix file conversion --- .../fix-converting-txt-to-json-file.patch | 74 +++++++++++++++++++ 1 file changed, 74 insertions(+) create mode 100644 Spigot-Server-Patches/fix-converting-txt-to-json-file.patch diff --git a/Spigot-Server-Patches/fix-converting-txt-to-json-file.patch b/Spigot-Server-Patches/fix-converting-txt-to-json-file.patch new file mode 100644 index 0000000000..a1b657aae2 --- /dev/null +++ b/Spigot-Server-Patches/fix-converting-txt-to-json-file.patch @@ -0,0 +1,74 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jake Potrebic +Date: Mon, 4 Jan 2021 19:49:15 -0800 +Subject: [PATCH] fix converting txt to json file + + +diff --git a/src/main/java/net/minecraft/server/DedicatedPlayerList.java b/src/main/java/net/minecraft/server/DedicatedPlayerList.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/server/DedicatedPlayerList.java ++++ b/src/main/java/net/minecraft/server/DedicatedPlayerList.java +@@ -0,0 +0,0 @@ public class DedicatedPlayerList extends PlayerList { + + this.a(dedicatedserverproperties.viewDistance); + super.setHasWhitelist((Boolean) dedicatedserverproperties.whiteList.get()); ++ // Paper start - moved from constructor ++ } ++ @Override ++ public void loadAndSaveFiles() { ++ // Paper end + this.y(); + this.w(); + this.x(); +diff --git a/src/main/java/net/minecraft/server/DedicatedServer.java b/src/main/java/net/minecraft/server/DedicatedServer.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/server/DedicatedServer.java ++++ b/src/main/java/net/minecraft/server/DedicatedServer.java +@@ -0,0 +0,0 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer + org.spigotmc.SpigotConfig.init((java.io.File) options.valueOf("spigot-settings")); + org.spigotmc.SpigotConfig.registerCommands(); + // Spigot end ++ // Paper start - moved up to right after PlayerList creation but before file load/save ++ if (this.convertNames()) { ++ this.getUserCache().save(false); // Paper ++ } ++ this.getPlayerList().loadAndSaveFiles(); // Must be after convertNames ++ // Paper end + // Paper start + try { + com.destroystokyo.paper.PaperConfig.init((java.io.File) options.valueOf("paper-settings")); +@@ -0,0 +0,0 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer + DedicatedServer.LOGGER.warn("To change this, set \"online-mode\" to \"true\" in the server.properties file."); + } + +- if (this.convertNames()) { +- this.getUserCache().b(false); // Paper +- } +- + if (!NameReferencingFileConverter.e(this)) { + return false; + } else { +diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/server/PlayerList.java ++++ b/src/main/java/net/minecraft/server/PlayerList.java +@@ -0,0 +0,0 @@ public abstract class PlayerList { + this.maxPlayers = i; + this.playerFileData = worldnbtstorage; + } ++ abstract public void loadAndSaveFiles(); // Paper - moved from DedicatedPlayerList constructor + + public void a(NetworkManager networkmanager, EntityPlayer entityplayer) { + EntityPlayer prev = pendingPlayers.put(entityplayer.getUniqueID(), entityplayer);// Paper +diff --git a/src/main/java/net/minecraft/server/UserCache.java b/src/main/java/net/minecraft/server/UserCache.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/server/UserCache.java ++++ b/src/main/java/net/minecraft/server/UserCache.java +@@ -0,0 +0,0 @@ public class UserCache { + return arraylist; + } + ++ public void save(boolean asyncSave) { b(asyncSave); } // Paper - OBFHELPER + public void b(boolean asyncSave) { // Paper + JsonArray jsonarray = new JsonArray(); + DateFormat dateformat = e();