Signed-off-by: Chaoscaot <chaoscaot@zohomail.eu>
Dieser Commit ist enthalten in:
Ursprung
9598838d2e
Commit
586e94d50a
@ -112,7 +112,12 @@ public class ScriptRunner {
|
|||||||
});
|
});
|
||||||
|
|
||||||
for (LuaFunction luaFunction : luaFunctions) {
|
for (LuaFunction luaFunction : luaFunctions) {
|
||||||
|
try {
|
||||||
luaFunction.call(eventValue);
|
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();
|
return cancelled.get();
|
||||||
@ -124,12 +129,22 @@ public class ScriptRunner {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
commandRegister.getFunction().call(args);
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void callHotkey(int mods, int key, Player player, boolean pressed) {
|
public static void callHotkey(int mods, int key, Player player, boolean pressed) {
|
||||||
Hotkey hotkey = Hotkey.fromChar(key, mods);
|
Hotkey hotkey = Hotkey.fromChar(key, mods);
|
||||||
|
try {
|
||||||
HOTKEY_MAP.getOrDefault(player, Collections.emptyMap()).getOrDefault(hotkey, Collections.emptyList()).forEach(luaFunction -> luaFunction.call(LuaValue.valueOf(pressed)));
|
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)));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren