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
|
2024-04-12 21:14:06 +02:00
|
|
|
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());
|
2024-01-19 22:13:42 +01:00
|
|
|
+ // Paper start - fix converting txt to json file; moved from constructor
|
2021-06-11 14:02:28 +02:00
|
|
|
+ }
|
|
|
|
+ @Override
|
|
|
|
+ public void loadAndSaveFiles() {
|
2024-01-19 22:13:42 +01:00
|
|
|
+ // 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-10-27 18:11:15 +01:00
|
|
|
index 9a3e73a5c206b78dfcf6f41a47b614342e52acc8..9d05e998d6df1069c2de69478a1f9688ac435e67 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-10-27 18:11:15 +01:00
|
|
|
@@ -213,6 +213,12 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
|
2024-01-13 21:31:02 +01:00
|
|
|
this.paperConfigurations.initializeGlobalConfiguration(this.registryAccess());
|
|
|
|
this.paperConfigurations.initializeWorldDefaultsConfiguration(this.registryAccess());
|
|
|
|
// Paper end - initialize global and world-defaults configuration
|
2024-01-19 22:13:42 +01:00
|
|
|
+ // 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
|
2024-01-19 22:13:42 +01:00
|
|
|
+ // Paper end - fix converting txt to json file
|
2024-01-13 21:31:02 +01:00
|
|
|
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-10-27 18:11:15 +01:00
|
|
|
@@ -267,9 +273,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()) {
|
2024-01-23 14:34:17 +01:00
|
|
|
- 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
|
Rework async chunk api implementation
Firstly, the old methods all routed to the CompletableFuture method.
However, the CF method could not guarantee that if the caller
was off-main that the future would be "completed" on-main. Since
the callback methods used the CF one, this meant that the callback
methods did not guarantee that the callbacks were to be called on
the main thread.
Now, all methods route to getChunkAtAsync(x, z, gen, urgent, cb)
so that the methods with the callback are guaranteed to invoke
the callback on the main thread. The CF behavior remains unchanged;
it may still appear to complete on main if invoked off-main.
Secondly, remove the scheduleOnMain invocation in the async
chunk completion. This unnecessarily delays the callback
by 1 tick.
Thirdly, add getChunksAtAsync(minX, minZ, maxX, maxZ, ...) which
will load chunks within an area. This method is provided as a helper
as keeping all chunks loaded within an area can be complicated to
implement for plugins (due to the lacking ticket API), and is
already implemented internally anyways.
Fourthly, remove the ticket addition that occured with getChunkAt
and getChunkAtAsync. The ticket addition may delay the unloading
of the chunk unnecessarily. It also fixes a very rare timing bug
where the future/callback would be completed after the chunk
unloads.
2024-11-19 07:34:32 +01:00
|
|
|
index 061bba184c8bc2569ce1d413435ec1360fa14007..e80e6e402ae286358b7f26073329b2e10604153b 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-10-27 18:11:15 +01:00
|
|
|
@@ -179,6 +179,7 @@ public abstract class PlayerList {
|
2021-06-11 14:02:28 +02:00
|
|
|
this.maxPlayers = maxPlayers;
|
|
|
|
this.playerIo = saveHandler;
|
|
|
|
}
|
2024-01-19 22:13:42 +01:00
|
|
|
+ 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) {
|
2022-09-26 10:02:51 +02:00
|
|
|
player.isRealPlayer = true; // Paper
|