SteamWar/BauSystem2.0
Archiviert
12
0

Script System Lua #178

Zusammengeführt
YoyoNow hat 16 Commits von lua nach master 2023-07-17 16:44:04 +02:00 zusammengeführt
3 geänderte Dateien mit 4 neuen und 4 gelöschten Zeilen
Nur Änderungen aus Commit 706eb17362 werden angezeigt - Alle Commits anzeigen

Datei anzeigen

@ -58,7 +58,7 @@ public class ScriptGUI implements Listener {
Script.list(user).forEach(script -> { Script.list(user).forEach(script -> {
try { try {
globals.load(script.getScript()).call(); globals.load(script.getCode()).call();
} catch (Exception e) { } catch (Exception e) {
String[] sp = e.getMessage().split(":"); String[] sp = e.getMessage().split(":");
lore.add(BauSystem.MESSAGE.parse("SCRIPT_ERROR_GUI", player, String.join(":", Arrays.copyOfRange(sp, 1, sp.length)))); lore.add(BauSystem.MESSAGE.parse("SCRIPT_ERROR_GUI", player, String.join(":", Arrays.copyOfRange(sp, 1, sp.length))));

Datei anzeigen

@ -38,7 +38,7 @@ public class ScriptHelper {
BookMeta meta = (BookMeta) itemStack.getItemMeta(); BookMeta meta = (BookMeta) itemStack.getItemMeta();
if(!writeable) { if(!writeable) {
meta.setTitle(script.getName()); meta.setTitle(script.getName());
meta.setAuthor(SteamwarUser.get(script.getUser()).getUserName()); meta.setAuthor(SteamwarUser.get(script.getUserId()).getUserName());
} }
meta.setPages(getScriptPages(script)); meta.setPages(getScriptPages(script));
itemStack.setItemMeta(meta); itemStack.setItemMeta(meta);
@ -46,7 +46,7 @@ public class ScriptHelper {
} }
public static List<String> getScriptPages(Script script) { public static List<String> getScriptPages(Script script) {
return Arrays.stream(script.getScript().split(PAGE_SEPARATOR)).collect(Collectors.toList()); return Arrays.stream(script.getCode().split(PAGE_SEPARATOR)).collect(Collectors.toList());
} }
public static String getScriptString(List<String> pages) { public static String getScriptString(List<String> pages) {

Datei anzeigen

@ -61,7 +61,7 @@ public class ScriptRunner {
public static void updateGlobalScript(Player player) { public static void updateGlobalScript(Player player) {
SteamwarUser user = SteamwarUser.get(player.getUniqueId()); SteamwarUser user = SteamwarUser.get(player.getUniqueId());
ScriptRunner.createGlobalScript(Script.list(user).stream().map(Script::getScript).collect(Collectors.toList()), player); ScriptRunner.createGlobalScript(Script.list(user).stream().map(Script::getCode).collect(Collectors.toList()), player);
} }
public static void createGlobalScript(List<String> scripts, Player player) { public static void createGlobalScript(List<String> scripts, Player player) {