Paper/patches/server/0509-fix-converting-txt-to-json-file.patch

62 lines
3.9 KiB
Diff
Raw Normal View History

2021-06-11 14:02:28 +02: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
index 929f59bce01c8e6ed4b0b551744d42e131b8fc80..22c4f8dea99f92a1eb3da2baf0a15bf9d2ca0462 100644
2021-06-11 14:02:28 +02:00
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedPlayerList.java
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedPlayerList.java
2022-12-07 21:16:54 +01:00
@@ -18,6 +18,11 @@ public class DedicatedPlayerList extends PlayerList {
2021-06-15 04:59:31 +02:00
this.setViewDistance(dedicatedServerProperties.viewDistance);
2021-11-24 21:15:19 +01:00
this.setSimulationDistance(dedicatedServerProperties.simulationDistance);
2021-06-15 04:59:31 +02:00
super.setUsingWhiteList(dedicatedServerProperties.whiteList.get());
+ // Paper start - fix converting txt to json file; moved from constructor
2021-06-11 14:02:28 +02:00
+ }
+ @Override
+ public void loadAndSaveFiles() {
+ // Paper end - fix converting txt to json file
2021-06-11 14:02:28 +02:00
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
2024-04-24 15:46:45 +02:00
index 4d7c2832a9cd9a88b99c837a02df7fa91e572658..4b00c14332f3d514f402fc82345a02d51c3ac58a 100644
2021-06-11 14:02:28 +02:00
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
2024-04-24 15:46:45 +02:00
@@ -212,6 +212,12 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
this.paperConfigurations.initializeGlobalConfiguration(this.registryAccess());
this.paperConfigurations.initializeWorldDefaultsConfiguration(this.registryAccess());
// Paper end - initialize global and world-defaults configuration
+ // Paper start - fix converting txt to json file; convert old users earlier after PlayerList creation but before file load/save
2021-06-11 14:02:28 +02:00
+ if (this.convertOldUsers()) {
+ this.getProfileCache().save(false); // Paper
+ }
+ this.getPlayerList().loadAndSaveFiles(); // Must be after convertNames
+ // Paper end - fix converting txt to json file
org.spigotmc.WatchdogThread.doStart(org.spigotmc.SpigotConfig.timeoutTime, org.spigotmc.SpigotConfig.restartOnCrash); // Paper - start watchdog thread
io.papermc.paper.command.PaperCommands.registerCommands(this); // Paper - setup /paper command
com.destroystokyo.paper.Metrics.PaperMetrics.startMetrics(); // Paper - start metrics
2024-04-24 15:46:45 +02:00
@@ -266,9 +272,6 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
2021-06-11 14:02:28 +02:00
DedicatedServer.LOGGER.warn("To change this, set \"online-mode\" to \"true\" in the server.properties file.");
}
- if (this.convertOldUsers()) {
- this.getProfileCache().save(false); // Paper - Perf: Async GameProfileCache saving
2021-06-11 14:02:28 +02:00
- }
2021-06-15 04:59:31 +02:00
2021-06-11 14:02:28 +02: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
2024-04-25 22:34:46 +02:00
index d5071f9f2d433706fc378f77906bb5f04fca0540..130a50380232b67a50e5a6923dad4a6e67858550 100644
2021-06-11 14:02:28 +02:00
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
2024-04-24 15:46:45 +02:00
@@ -179,6 +179,7 @@ public abstract class PlayerList {
2021-06-11 14:02:28 +02:00
this.maxPlayers = maxPlayers;
this.playerIo = saveHandler;
}
+ abstract public void loadAndSaveFiles(); // Paper - fix converting txt to json file; moved from DedicatedPlayerList constructor
2021-06-11 14:02:28 +02:00
2023-09-22 07:41:27 +02:00
public void placeNewPlayer(Connection connection, ServerPlayer player, CommonListenerCookie clientData) {
Rewrite chunk system (#8177) Patch documentation to come Issues with the old system that are fixed now: - World generation does not scale with cpu cores effectively. - Relies on the main thread for scheduling and maintaining chunk state, dropping chunk load/generate rates at lower tps. - Unreliable prioritisation of chunk gen/load calls that block the main thread. - Shutdown logic is utterly unreliable, as it has to wait for all chunks to unload - is it guaranteed that the chunk system is in a state on shutdown that it can reliably do this? Watchdog shutdown also typically failed due to thread checks, which is now resolved. - Saving of data is not unified (i.e can save chunk data without saving entity data, poses problems for desync if shutdown is really abnormal. - Entities are not loaded with chunks. This caused quite a bit of headache for Chunk#getEntities API, but now the new chunk system loads entities with chunks so that they are ready whenever the chunk loads in. Effectively brings the behavior back to 1.16 era, but still storing entities in their own separate regionfiles. The above list is not complete. The patch documentation will complete it. New chunk system hard relies on starlight and dataconverter, and most importantly the new concurrent utilities in ConcurrentUtil. Some of the old async chunk i/o interface (i.e the old file io thread reroutes _some_ calls to the new file io thread) is kept for plugin compat reasons. It will be removed in the next major version of minecraft. The old legacy chunk system patches have been moved to the removed folder in case we need them again.
2022-09-26 10:02:51 +02:00
player.isRealPlayer = true; // Paper