fix file conversion

This commit is contained in:
Jake Potrebic 2021-01-04 19:49:50 -08:00 committed by MiniDigger | Martin
parent 674d8f7f7e
commit aaef1d5cca

View file

@ -0,0 +1,74 @@
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/DedicatedPlayerList.java b/src/main/java/net/minecraft/server/DedicatedPlayerList.java
index a8cb602be410fb269f4d7e19e40ee07a84ea86e5..73b1022e192d2cc4a953a784408ef909a3192c59 100644
--- a/src/main/java/net/minecraft/server/DedicatedPlayerList.java
+++ b/src/main/java/net/minecraft/server/DedicatedPlayerList.java
@@ -15,6 +15,11 @@ 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 5504facd2e453238caa71d98743be5416d4dd4fe..d4793a1d476d8d6687ec8782501c31265f284daa 100644
--- a/src/main/java/net/minecraft/server/DedicatedServer.java
+++ b/src/main/java/net/minecraft/server/DedicatedServer.java
@@ -159,6 +159,12 @@ 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"));
@@ -221,10 +227,6 @@ 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 c970b8bec13741fcd4d5ce71fd77d0f9ed633088..610613c2dbea18e1064c5f29cc36cf39aece2277 100644
--- a/src/main/java/net/minecraft/server/PlayerList.java
+++ b/src/main/java/net/minecraft/server/PlayerList.java
@@ -98,6 +98,7 @@ 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 aa1b18ffa1e2b7f865f63b7df81d8f3b3d5aa966..8c3aa47a28914fd69a7f2e55a8c8f91d8e02371e 100644
--- a/src/main/java/net/minecraft/server/UserCache.java
+++ b/src/main/java/net/minecraft/server/UserCache.java
@@ -239,6 +239,7 @@ 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();