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

62 lines
3.5 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
2022-03-01 06:43:03 +01:00
index d83bed436d2ad51cef83ecbf0c7df227a67ff404..dc96b30c70cd79d7b2a0322f32b9399a0f2faa41 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
2021-11-24 21:15:19 +01:00
@@ -17,6 +17,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());
2021-06-11 14:02:28 +02: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
2022-11-03 22:03:31 +01:00
index a8e18a168e8288ebea95bacd61a38039b3427d5e..b32820ead6d5f9c78f3b6dee3c598060e371dbd6 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
@@ -203,6 +203,12 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
io.papermc.paper.util.ObfHelper.INSTANCE.getClass(); // Paper - load mappings for stacktrace deobf and etc.
paperConfigurations.initializeGlobalConfiguration();
paperConfigurations.initializeWorldDefaultsConfiguration();
2021-06-11 14:02:28 +02:00
+ // 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 - moved up
org.spigotmc.WatchdogThread.doStart(org.spigotmc.SpigotConfig.timeoutTime, org.spigotmc.SpigotConfig.restartOnCrash);
io.papermc.paper.command.PaperCommands.registerCommands(this);
com.destroystokyo.paper.Metrics.PaperMetrics.startMetrics();
2022-06-09 23:43:27 +02:00
@@ -258,9 +264,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()) {
2021-06-15 04:59:31 +02:00
- this.getProfileCache().save(false); // Paper
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
2022-11-03 22:03:31 +01:00
index 6868fc701d032295858bdd15d55f290e0bc9d537..4b8dc6c6c24774df4dbc1b38611152ac7a3b2fa6 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
2022-07-27 22:55:55 +02:00
@@ -177,6 +177,7 @@ public abstract class PlayerList {
2021-06-11 14:02:28 +02:00
this.maxPlayers = maxPlayers;
this.playerIo = saveHandler;
}
+ abstract public void loadAndSaveFiles(); // Paper - moved from DedicatedPlayerList constructor
public void placeNewPlayer(Connection connection, ServerPlayer player) {
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