Fix premature player kicks on shutdown

When the server is stopping, the default execution handler method will throw a
RejectedExecutionException in order to prevent further execution, this causes
us to lose the actual kick reason. To mitigate this, we'll use a seperate marked
class in order to gracefully ignore these.
This commit is contained in:
Shane Freeder
2024-04-11 16:37:44 +01:00
parent bc5dd992ab
commit 26fe3d0cff
3 changed files with 57 additions and 23 deletions

View File

@@ -1232,6 +1232,15 @@
}
public boolean isReady() {
@@ -1593,7 +2127,7 @@
@Override
public void executeIfPossible(Runnable runnable) {
if (this.isStopped()) {
- throw new RejectedExecutionException("Server already shutting down");
+ throw new io.papermc.paper.util.ServerStopRejectedExecutionException("Server already shutting down"); // Paper - do not prematurely disconnect players on stop
} else {
super.executeIfPossible(runnable);
}
@@ -1632,13 +2166,19 @@
return this.functionManager;
}
@@ -1312,22 +1321,19 @@
try {
arraylist = Lists.newArrayList(NativeModuleLister.listModules());
@@ -2105,9 +2650,24 @@
if (bufferedwriter != null) {
bufferedwriter.close();
}
+
+ }
+
@@ -2108,6 +2653,21 @@
}
+ // CraftBukkit start
+ public boolean isDebugging() {
+ return false;
+ }
+
+ public static MinecraftServer getServer() {
+ return SERVER; // Paper
}
+ }
+
+ @Deprecated
+ public static RegistryAccess getDefaultRegistryAccess() {
+ return CraftRegistry.getMinecraftRegistry();
@@ -1366,11 +1372,13 @@
}
public boolean logIPs() {
@@ -2379,4 +2945,30 @@
public static record ServerResourcePackInfo(UUID id, String url, String hash, boolean isRequired, @Nullable Component prompt) {
@@ -2377,6 +2943,32 @@
}
public static record ServerResourcePackInfo(UUID id, String url, String hash, boolean isRequired, @Nullable Component prompt) {
+
+ }
+ // Paper start - Add tick times API and /mspt command
+ public static class TickTimes {
+ private final long[] times;
@@ -1394,6 +1402,6 @@
+ }
+ return ((double) total / (double) times.length) * 1.0E-6D;
+ }
+ }
}
+ // Paper end - Add tick times API and /mspt command
}