SteamWar/BauSystem2.0
Archiviert
12
0

Fix Error Messages
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful

Signed-off-by: Chaoscaot <chaoscaot@zohomail.eu>
Dieser Commit ist enthalten in:
Chaoscaot 2023-07-17 16:57:39 +02:00
Ursprung 9598838d2e
Commit 586e94d50a
Signiert von: Chaoscaot
GPG-Schlüssel-ID: BDF8FADD7D5EDB7A

Datei anzeigen

@ -112,7 +112,12 @@ public class ScriptRunner {
});
for (LuaFunction luaFunction : luaFunctions) {
try {
luaFunction.call(eventValue);
} catch (Exception e) {
String[] sp = e.getMessage().split(":");
BauSystem.MESSAGE.send("SCRIPT_ERROR_GLOBAL", player, String.join(":", Arrays.copyOfRange(sp, 1, sp.length)));
}
}
return cancelled.get();
@ -124,12 +129,22 @@ public class ScriptRunner {
return false;
}
try {
commandRegister.getFunction().call(args);
} catch (Exception e) {
String[] sp = e.getMessage().split(":");
BauSystem.MESSAGE.send("SCRIPT_ERROR_GLOBAL", player, String.join(":", Arrays.copyOfRange(sp, 1, sp.length)));
}
return true;
}
public static void callHotkey(int mods, int key, Player player, boolean pressed) {
Hotkey hotkey = Hotkey.fromChar(key, mods);
try {
HOTKEY_MAP.getOrDefault(player, Collections.emptyMap()).getOrDefault(hotkey, Collections.emptyList()).forEach(luaFunction -> luaFunction.call(LuaValue.valueOf(pressed)));
} catch (Exception e) {
String[] sp = e.getMessage().split(":");
BauSystem.MESSAGE.send("SCRIPT_ERROR_GLOBAL", player, String.join(":", Arrays.copyOfRange(sp, 1, sp.length)));
}
}
}