Move logic from last patch into correct place

This commit is contained in:
Shane Freeder 2021-01-13 21:31:51 +00:00
parent 9668118fdf
commit 6bafeb5a96
9 changed files with 36 additions and 36 deletions

View File

@ -113,7 +113,7 @@ index bc15da4640a4a6107c9c186a01ce76df87511b41..27db247aa40e0516302c74b9bf00c631
}
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 0c469ad1fd477fdb6181c657b7b9e193c790246d..fe88179037f1a56cec3543910cfab67b0e2ebbe4 100644
index 0c469ad1fd477fdb6181c657b7b9e193c790246d..ce27c4c905d9bfcdf983dd8ca6e60de00087f607 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -159,7 +159,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
@ -142,7 +142,7 @@ index 0c469ad1fd477fdb6181c657b7b9e193c790246d..fe88179037f1a56cec3543910cfab67b
private final Object stopLock = new Object();
public final boolean hasStopped() {
synchronized (stopLock) {
@@ -745,6 +748,19 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
@@ -745,6 +748,23 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
if (hasStopped) return;
hasStopped = true;
}
@ -157,12 +157,16 @@ index 0c469ad1fd477fdb6181c657b7b9e193c790246d..fe88179037f1a56cec3543910cfab67b
+ Thread.sleep(1);
+ } catch (InterruptedException e) {}
+ }
+ // We've just obliterated the main thread, this will prevent stop from dying when removing players
+ MinecraftServer.getServer().getWorlds().forEach(world -> {
+ world.tickingEntities = false;
+ });
+ }
+ // Paper end
// CraftBukkit end
MinecraftServer.LOGGER.info("Stopping server");
MinecraftTimings.stopServer(); // Paper
@@ -810,7 +826,18 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
@@ -810,7 +830,18 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
this.getUserCache().b(false); // Paper
}
// Spigot end
@ -181,7 +185,7 @@ index 0c469ad1fd477fdb6181c657b7b9e193c790246d..fe88179037f1a56cec3543910cfab67b
}
public String getServerIp() {
@@ -903,6 +930,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
@@ -903,6 +934,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
protected void w() {
try {
@ -189,7 +193,7 @@ index 0c469ad1fd477fdb6181c657b7b9e193c790246d..fe88179037f1a56cec3543910cfab67b
if (this.init()) {
this.nextTick = SystemUtils.getMonotonicMillis();
this.serverPing.setMOTD(new ChatComponentText(this.motd));
@@ -910,6 +938,18 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
@@ -910,6 +942,18 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
this.a(this.serverPing);
// Spigot start
@ -208,7 +212,7 @@ index 0c469ad1fd477fdb6181c657b7b9e193c790246d..fe88179037f1a56cec3543910cfab67b
org.spigotmc.WatchdogThread.hasStarted = true; // Paper
Arrays.fill( recentTps, 20 );
long start = System.nanoTime(), curTime, tickSection = start; // Paper - Further improve server tick loop
@@ -965,6 +1005,12 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
@@ -965,6 +1009,12 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
this.a((CrashReport) null);
}
} catch (Throwable throwable) {
@ -221,7 +225,7 @@ index 0c469ad1fd477fdb6181c657b7b9e193c790246d..fe88179037f1a56cec3543910cfab67b
MinecraftServer.LOGGER.error("Encountered an unexpected exception", throwable);
// Spigot Start
if ( throwable.getCause() != null )
@@ -996,14 +1042,14 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
@@ -996,14 +1046,14 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
} catch (Throwable throwable1) {
MinecraftServer.LOGGER.error("Exception stopping the server", throwable1);
} finally {
@ -239,7 +243,7 @@ index 0c469ad1fd477fdb6181c657b7b9e193c790246d..fe88179037f1a56cec3543910cfab67b
}
}
@@ -1059,6 +1105,12 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
@@ -1059,6 +1109,12 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
@Override
protected TickTask postToMainThread(Runnable runnable) {
@ -252,7 +256,7 @@ index 0c469ad1fd477fdb6181c657b7b9e193c790246d..fe88179037f1a56cec3543910cfab67b
return new TickTask(this.ticks, runnable);
}
@@ -1301,6 +1353,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
@@ -1301,6 +1357,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
try {
crashreport = CrashReport.a(throwable, "Exception ticking world");
} catch (Throwable t) {
@ -260,7 +264,7 @@ index 0c469ad1fd477fdb6181c657b7b9e193c790246d..fe88179037f1a56cec3543910cfab67b
throw new RuntimeException("Error generating crash report", t);
}
// Spigot End
@@ -1758,7 +1811,8 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
@@ -1758,7 +1815,8 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
this.resourcePackRepository.a(collection);
this.saveData.a(a(this.resourcePackRepository));
datapackresources.i();
@ -508,7 +512,7 @@ index aefea3a9a8b9b75c62bd20018be7cd166a213001..123de5ac9026508e21cdc225f0962f5c
String[] split = restartScript.split( " " );
if ( split.length > 0 && new File( split[0] ).isFile() )
diff --git a/src/main/java/org/spigotmc/WatchdogThread.java b/src/main/java/org/spigotmc/WatchdogThread.java
index 9c1fc19851817a842779ab89bc9300e1adf3d2a2..95d5b226c4289a463515e03fcc1a43458ea6b37d 100644
index 9c1fc19851817a842779ab89bc9300e1adf3d2a2..ae8903ee1decd22e2ad6138f29fbc757b807e0a7 100644
--- a/src/main/java/org/spigotmc/WatchdogThread.java
+++ b/src/main/java/org/spigotmc/WatchdogThread.java
@@ -13,6 +13,7 @@ import org.bukkit.Bukkit;
@ -553,7 +557,7 @@ index 9c1fc19851817a842779ab89bc9300e1adf3d2a2..95d5b226c4289a463515e03fcc1a4345
log.log( Level.SEVERE, "------------------------------" );
//
// Paper start - Only print full dump on long timeouts
@@ -139,9 +142,28 @@ public class WatchdogThread extends Thread
@@ -139,9 +142,24 @@ public class WatchdogThread extends Thread
if ( isLongTimeout )
{
@ -575,10 +579,6 @@ index 9c1fc19851817a842779ab89bc9300e1adf3d2a2..95d5b226c4289a463515e03fcc1a4345
+ e.printStackTrace();
+ }
+ if (!server.hasStopped()) {
+ // We've just obliterated the main thread, this will prevent stop from dying when removing players
+ MinecraftServer.getServer().getWorlds().forEach(world -> {
+ world.tickingEntities = false;
+ });
+ server.close();
+ }
}

View File

@ -6,7 +6,7 @@ Subject: [PATCH] Use distance map to optimise entity tracker
Use the distance map to find candidate players for tracking.
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
index 60dae06ff5c016aecba23afd7a4152fcd3234616..d883da1e9101607209148a28aef8741407f13433 100644
index 2361c2d40f3f53d26c398676b0a1b6ec832f29fc..48373bf947fc19a34caa34daeed980cc433bc600 100644
--- a/src/main/java/net/minecraft/server/Entity.java
+++ b/src/main/java/net/minecraft/server/Entity.java
@@ -206,6 +206,21 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
@ -44,10 +44,10 @@ index e9bc1d22825850a1f1ef3267428c19847d4c8ab8..4965d0fbc123071a2f2f44f559336f7a
List<Entity> list = this.tracker.getPassengers();
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index fe88179037f1a56cec3543910cfab67b0e2ebbe4..a91a581b25b19d62949f641847b633208672fb1e 100644
index ce27c4c905d9bfcdf983dd8ca6e60de00087f607..13c22c4c712fac2f2cda3146df17547c0f6f8f12 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -1527,6 +1527,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
@@ -1531,6 +1531,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
}
}

View File

@ -10,10 +10,10 @@ Adds a 5 second grace period for any async tasks to finish and warns
if any are still running after that delay just as reload does.
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index a91a581b25b19d62949f641847b633208672fb1e..450c04c5a1153ea9d11d005f3be623bbf8b26ce6 100644
index 13c22c4c712fac2f2cda3146df17547c0f6f8f12..319740c0256a6ad2544b4997c835235e4d3a4a9a 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -767,6 +767,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
@@ -771,6 +771,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
// CraftBukkit start
if (this.server != null) {
this.server.disablePlugins();

View File

@ -39,10 +39,10 @@ index f5792b999ce42acb13ae9a62ceb2ddec39abe209..5504facd2e453238caa71d98743be541
@Override
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 450c04c5a1153ea9d11d005f3be623bbf8b26ce6..157f8f5e5255312b916aef200810ad387fac915f 100644
index 319740c0256a6ad2544b4997c835235e4d3a4a9a..820c680f1039f747797a758cece5014f3159e508 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -1520,11 +1520,14 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
@@ -1524,11 +1524,14 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
}
}
@ -63,7 +63,7 @@ index 450c04c5a1153ea9d11d005f3be623bbf8b26ce6..157f8f5e5255312b916aef200810ad38
}
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
index 5240af35fcec03f350596cecc74a4230f257e7b4..9b54d690e09f719a18ba321a0c927bb31c71bf01 100644
index 2d2fd9a45bcfd2b1da8b7dd109eb50257ab394c9..d9911b214e83e4046b4ad82be904600a00955384 100644
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
@@ -2882,7 +2882,7 @@ public class PlayerConnection implements PacketListenerPlayIn {

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Incremental player saving
diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java
index fc03df234fc641f72b4d4a79535860300006ff50..d86474a1a97597c14ea8a28444e2a5d82fcda2a7 100644
index fd3b4a01c84da110d41b7224ebb38ae78b389f79..deb77934dcba8c9209c942a6521dd8486cb5a48d 100644
--- a/src/main/java/com/destroystokyo/paper/PaperConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java
@@ -435,4 +435,15 @@ public class PaperConfig {
@ -37,10 +37,10 @@ index 66920fa15720976a84a33ce498b8ca6f5ad5dee3..59d47a9f75450573b26b82b6f432af7b
public NetworkManager networkManager; // Paper
public final MinecraftServer server;
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 157f8f5e5255312b916aef200810ad387fac915f..dd34782b85ccf7f9f4dedd72f9220f12475a46d2 100644
index 820c680f1039f747797a758cece5014f3159e508..84b304b4998f682688be26b9402da8eed8c265a8 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -1222,9 +1222,15 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
@@ -1226,9 +1226,15 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
//if (autosavePeriod > 0 && this.ticks % autosavePeriod == 0) { // CraftBukkit // Paper - move down
//MinecraftServer.LOGGER.debug("Autosave started"); // Paper
serverAutoSave = (autosavePeriod > 0 && this.ticks % autosavePeriod == 0); // Paper

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Cache block data strings
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index dd34782b85ccf7f9f4dedd72f9220f12475a46d2..c214f32af5723b9b0f6f6e0e768fb653962b8043 100644
index 84b304b4998f682688be26b9402da8eed8c265a8..3d4ecddcbfedb54d26888ff464bd0e6c7eec82e3 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -1827,6 +1827,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
@@ -1831,6 +1831,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
this.getPlayerList().reload();
this.customFunctionData.a(this.dataPackResources.a());
this.ak.a(this.dataPackResources.h());

View File

@ -6,10 +6,10 @@ Subject: [PATCH] Fix deop kicking non-whitelisted player when white list is
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index c214f32af5723b9b0f6f6e0e768fb653962b8043..0108a1a68572df562349688e93f8134cb14d6116 100644
index 3d4ecddcbfedb54d26888ff464bd0e6c7eec82e3..057f49ac7cbe6f866beec18e0c2fb5323f10791b 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -1892,6 +1892,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
@@ -1896,6 +1896,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
if (this.aN()) {
PlayerList playerlist = commandlistenerwrapper.getServer().getPlayerList();
WhiteList whitelist = playerlist.getWhitelist();

View File

@ -59,7 +59,7 @@ index 0000000000000000000000000000000000000000..c6ea429819c07e7f4bc257cad73463a0
+ }
+}
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 0108a1a68572df562349688e93f8134cb14d6116..172fc9ef9c0d3444eb99f750a17d42f130d94f73 100644
index 057f49ac7cbe6f866beec18e0c2fb5323f10791b..4d7e8e8eed7786c602e54786cb142972f75ca65d 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -69,6 +69,7 @@ import org.bukkit.craftbukkit.Main;
@ -70,7 +70,7 @@ index 0108a1a68572df562349688e93f8134cb14d6116..172fc9ef9c0d3444eb99f750a17d42f1
import org.spigotmc.SlackActivityAccountant; // Spigot
public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTask> implements IMojangStatistics, ICommandListener, AutoCloseable {
@@ -950,6 +951,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
@@ -954,6 +955,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
LOGGER.info("Done ({})! For help, type \"help\"", doneTime);
// Paper end

View File

@ -34,7 +34,7 @@ index 08e472b71cf85b854eaa831881577ce2c3c03b11..4558147a51be6713c11bda6a60fd5ca3
// CraftBukkit end
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 172fc9ef9c0d3444eb99f750a17d42f130d94f73..a7cd98a7cd7fed95e37a178f732339e204650b10 100644
index 4d7e8e8eed7786c602e54786cb142972f75ca65d..c3fb69b18bf66ac8532196d953d9729ffb394721 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -2,9 +2,6 @@ package net.minecraft.server;
@ -62,7 +62,7 @@ index 172fc9ef9c0d3444eb99f750a17d42f130d94f73..a7cd98a7cd7fed95e37a178f732339e2
import org.spigotmc.SlackActivityAccountant; // Spigot
public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTask> implements IMojangStatistics, ICommandListener, AutoCloseable {
@@ -1808,7 +1803,13 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
@@ -1812,7 +1807,13 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
return this.customFunctionData;
}
@ -76,7 +76,7 @@ index 172fc9ef9c0d3444eb99f750a17d42f130d94f73..a7cd98a7cd7fed95e37a178f732339e2
CompletableFuture<Void> completablefuture = CompletableFuture.supplyAsync(() -> {
Stream<String> stream = collection.stream(); // CraftBukkit - decompile error
ResourcePackRepository resourcepackrepository = this.resourcePackRepository;
@@ -1824,6 +1825,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
@@ -1828,6 +1829,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
this.resourcePackRepository.a(collection);
this.saveData.a(a(this.resourcePackRepository));
datapackresources.i();