aboutsummaryrefslogtreecommitdiffhomepage
path: root/patches/server/0610-fix-converting-txt-to-json-file.patch
blob: de3c433c6619d905a34bf5753c00f699d93b1ae3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Jake Potrebic <jake.m.potrebic@gmail.com>
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/dedicated/DedicatedPlayerList.java b/src/main/java/net/minecraft/server/dedicated/DedicatedPlayerList.java
index 04d2ed6ae4c2f250bb13ea732280108f91dc5660..21613cd49ebcccfd3837991dba1df0a188c42760 100644
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedPlayerList.java
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedPlayerList.java
@@ -17,6 +17,11 @@ public class DedicatedPlayerList extends PlayerList {
         this.setViewDistance(dedicatedServerProperties.viewDistance);
         this.setSimulationDistance(dedicatedServerProperties.simulationDistance);
         super.setUsingWhiteList(dedicatedServerProperties.whiteList.get());
+        // Paper start - moved from constructor
+    }
+    @Override
+    public void loadAndSaveFiles() {
+        // Paper end
         this.loadUserBanList();
         this.saveUserBanList();
         this.loadIpBanList();
diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
index e968b880e435b8753314d85b919a0abc4f35be25..02d7b16f81ebf9f902a36d4f31802b20d1820d6e 100644
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
@@ -203,6 +203,12 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
         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.convertOldUsers()) {
+            this.getProfileCache().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"));
@@ -265,9 +271,6 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
             DedicatedServer.LOGGER.warn("To change this, set \"online-mode\" to \"true\" in the server.properties file.");
         }
 
-        if (this.convertOldUsers()) {
-            this.getProfileCache().save(false); // Paper
-        }
 
         if (!OldUsersConverter.serverReadyAfterUserconversion(this)) {
             return false;
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index 52f8e91462b9f605aa529bc3ec4d55c9a006e472..f4966251d35323d526479a8a9c1fb552ad1709e9 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -174,6 +174,7 @@ public abstract class PlayerList {
         this.maxPlayers = maxPlayers;
         this.playerIo = saveHandler;
     }
+    abstract public void loadAndSaveFiles(); // Paper - moved from DedicatedPlayerList constructor
 
     public void placeNewPlayer(Connection connection, ServerPlayer player) {
         player.isRealPlayer = true; // Paper - Chunk priority