mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-30 16:19:03 +01:00
74 lines
3.9 KiB
Diff
74 lines
3.9 KiB
Diff
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 b13e6f9923a9c5703f4eaeab2d0c112e4726b496..a762cf4c4a52bcbc8dbfd60b3ad7fef5489ba5c5 100644
|
|
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedPlayerList.java
|
|
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedPlayerList.java
|
|
@@ -18,6 +18,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/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
|
index a5b1f33473e8c82511fdd0c218f4fe744f584de8..cac3df2ca054b3b2fb5b6437ab2950afc3ace8fb 100644
|
|
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
|
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
|
@@ -198,6 +198,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"));
|
|
@@ -260,10 +266,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/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
|
|
index 1358993217e601e3bab6e0a4e8c55d555865a13e..484c7cea458dda38e4816fe5f1c05c6836fa38b9 100644
|
|
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
|
|
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
|
|
@@ -175,6 +175,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/players/UserCache.java b/src/main/java/net/minecraft/server/players/UserCache.java
|
|
index 692d95c94df85d752a3ddc66e1f2af765565b160..c617b7dd5a992770fc87113987807947ae68be81 100644
|
|
--- a/src/main/java/net/minecraft/server/players/UserCache.java
|
|
+++ b/src/main/java/net/minecraft/server/players/UserCache.java
|
|
@@ -243,6 +243,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();
|