diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/string/Substring.java b/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/string/Substring.java index 33591596..74202855 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/string/Substring.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/string/Substring.java @@ -74,10 +74,14 @@ public class Substring implements SpecialCommand { } Value result; - if (v2.asLong() < 0) { - result = new Value.StringValue(v1.asString().substring(v1.asString().length() - 1 - (int) v2.asLong())); - } else { - result = new Value.StringValue(v1.asString().substring((int) v2.asLong())); + try { + if (v2.asLong() < 0) { + result = new Value.StringValue(v1.asString().substring(v1.asString().length() - 1 - (int) v2.asLong())); + } else { + result = new Value.StringValue(v1.asString().substring((int) v2.asLong())); + } + } catch (ArrayIndexOutOfBoundsException e) { + result = new Value.StringValue(""); } scriptExecutor.getLocalVariables().putValue(resultName, result); return true; diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/world/ClipboardListener.java b/BauSystem_Main/src/de/steamwar/bausystem/features/world/ClipboardListener.java index 43e7bc80..3d3ca140 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/world/ClipboardListener.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/world/ClipboardListener.java @@ -50,7 +50,7 @@ public class ClipboardListener implements Listener { SchematicNode schematic = SchematicNode.getSchematicNode(SteamwarUser.get(e.getPlayer().getUniqueId()).getId(), CLIPBOARD_SCHEMNAME, (Integer) null); boolean newSchem = false; if (schematic == null) { - schematic = SchematicNode.createSchematic(SteamwarUser.get(e.getPlayer().getUniqueId()).getId(), CLIPBOARD_SCHEMNAME, (Integer) null); + schematic = SchematicNode.createSchematic(SteamwarUser.get(e.getPlayer().getUniqueId()).getId(), CLIPBOARD_SCHEMNAME, null); newSchem = true; }