testserver/patches/server/0595-fix-converting-txt-to-...

62 lines
3.4 KiB
Diff
Raw Normal View History

2021-06-11 12:02:28 +00:00
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
2022-03-01 05:43:03 +00:00
index d83bed436d2ad51cef83ecbf0c7df227a67ff404..dc96b30c70cd79d7b2a0322f32b9399a0f2faa41 100644
2021-06-11 12:02:28 +00:00
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedPlayerList.java
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedPlayerList.java
2021-11-24 20:15:19 +00:00
@@ -17,6 +17,11 @@ public class DedicatedPlayerList extends PlayerList {
2021-06-15 02:59:31 +00:00
this.setViewDistance(dedicatedServerProperties.viewDistance);
2021-11-24 20:15:19 +00:00
this.setSimulationDistance(dedicatedServerProperties.simulationDistance);
2021-06-15 02:59:31 +00:00
super.setUsingWhiteList(dedicatedServerProperties.whiteList.get());
2021-06-11 12:02:28 +00:00
+ // 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 b9d65e77734129664057c26881204494ccc57de2..7b78b8edb0c5e544d0cc136fc7b84d1867f20ab6 100644
2021-06-11 12:02:28 +00:00
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
2022-06-08 07:40:34 +00:00
@@ -199,6 +199,12 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
2021-06-11 12:02:28 +00:00
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
io.papermc.paper.util.ObfHelper.INSTANCE.getClass(); // Paper - load mappings for stacktrace deobf and etc.
paperConfigurations.initializeGlobalConfiguration();
@@ -257,9 +263,6 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
2021-06-11 12:02:28 +00:00
DedicatedServer.LOGGER.warn("To change this, set \"online-mode\" to \"true\" in the server.properties file.");
}
- if (this.convertOldUsers()) {
2021-06-15 02:59:31 +00:00
- this.getProfileCache().save(false); // Paper
2021-06-11 12:02:28 +00:00
- }
2021-06-15 02:59:31 +00:00
2021-06-11 12:02:28 +00:00
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 42b2f5c61e2bd07c3c86d889949c5f24345680d6..2266e4608ff5ed11cbd76767365fe74742b8bc63 100644
2021-06-11 12:02:28 +00:00
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
2022-06-08 07:40:34 +00:00
@@ -176,6 +176,7 @@ public abstract class PlayerList {
2021-06-11 12:02:28 +00:00
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