feat: Опции для контроля поведения серверных ошибок тика
- Добавлены опции `display-ticking-errors-to-players`, `stop-on-critical-ticking-error`, обе по умолчанию включены и предпочтительны. - Уточнения по поводу команды `/profilecallback [enabled] [showParameters]`.
This commit is contained in:
@@ -45,7 +45,6 @@ import java.io.*;
|
||||
import java.net.URI;
|
||||
import java.net.URISyntaxException;
|
||||
import java.nio.file.*;
|
||||
import java.nio.file.FileSystem;
|
||||
import java.util.ArrayList;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
import java.util.Enumeration;
|
||||
@@ -484,6 +483,14 @@ public class InnerCoreServer {
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean shouldStoppedOnCriticalTickingError() {
|
||||
return getPropertyBoolean("stop-on-critical-ticking-error", true);
|
||||
}
|
||||
|
||||
public static boolean shouldPlayersReceiveExceptionForms() {
|
||||
return getPropertyBoolean("display-ticking-errors-to-players", true);
|
||||
}
|
||||
|
||||
public static String getName() {
|
||||
return getPropertyString("pack", "Inner Core Test");
|
||||
}
|
||||
|
||||
@@ -98,7 +98,7 @@ public class PlayerHooks implements HookClass {
|
||||
}
|
||||
|
||||
public static void showExceptionForm(Player player, String title, String message, Throwable exc) {
|
||||
if (!EntityMethod.isValid(player)) {
|
||||
if (!InnerCoreServer.shouldPlayersReceiveExceptionForms() || !EntityMethod.isValid(player)) {
|
||||
return;
|
||||
}
|
||||
FormWindowSimple form = new FormWindowSimple(title, message, Arrays.asList(new ElementButton("Rejoin")));
|
||||
|
||||
@@ -385,7 +385,8 @@ public class NativeCallback {
|
||||
ICLog.e("INNERCORE-CALLBACK", "error occurred in server tick callback", e);
|
||||
|
||||
if (serverTickDisabledDueToErrorMillis
|
||||
+ 15000 >= (serverTickDisabledDueToErrorMillis = System.currentTimeMillis())) {
|
||||
+ 15000 >= (serverTickDisabledDueToErrorMillis = System.currentTimeMillis())
|
||||
&& InnerCoreServer.shouldStoppedOnCriticalTickingError()) {
|
||||
Server.getInstance().shutdown();
|
||||
} else {
|
||||
for (long playerUid : Network.getSingleton().getServer().getConnectedPlayers()) {
|
||||
|
||||
@@ -44,3 +44,11 @@ pack-version-code: 152
|
||||
# Server socket port, usually should be between 10000 and 24999.
|
||||
# But keep in mind that the client uses port 2304 by default.
|
||||
# socket-port: 19131
|
||||
|
||||
# Sends form to players when ticking exception happens,
|
||||
# contains only script stacktrace (without sensitive properties).
|
||||
# display-ticking-errors-to-players: false
|
||||
|
||||
# If ticking callback interrupts too often, server will be stopped;
|
||||
# otherwise it will continue trying restart itself continiously.
|
||||
# stop-on-critical-ticking-error: false
|
||||
|
||||
Reference in New Issue
Block a user