diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/script/ScriptSyntaxSender.java b/BauSystem_Main/src/de/steamwar/bausystem/features/script/ScriptSyntaxSender.java
new file mode 100644
index 00000000..4c73b143
--- /dev/null
+++ b/BauSystem_Main/src/de/steamwar/bausystem/features/script/ScriptSyntaxSender.java
@@ -0,0 +1,104 @@
+/*
+ * This file is a part of the SteamWar software.
+ *
+ * Copyright (C) 2022 SteamWar.de-Serverteam
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see .
+ */
+
+package de.steamwar.bausystem.features.script;
+
+import de.steamwar.bausystem.BauSystem;
+import de.steamwar.bausystem.features.script.expression.Expression;
+import de.steamwar.linkage.Linked;
+import lombok.SneakyThrows;
+import org.bukkit.Bukkit;
+import org.bukkit.event.EventHandler;
+import org.bukkit.event.Listener;
+import org.bukkit.event.player.PlayerJoinEvent;
+import yapion.hierarchy.output.StringOutput;
+import yapion.hierarchy.types.YAPIONArray;
+import yapion.hierarchy.types.YAPIONObject;
+
+import java.util.Arrays;
+
+@Linked
+public class ScriptSyntaxSender implements Listener {
+
+ private byte[] syntax;
+
+ {
+ Bukkit.getServer().getMessenger().registerOutgoingPluginChannel(BauSystem.getInstance(), "sw:script_syntax");
+
+ // Whole Syntax object
+ YAPIONObject yapionObject = new YAPIONObject();
+
+ ScriptExecutor.SPECIAL_COMMANDS.toString();
+
+ // Operators
+ YAPIONArray operators = new YAPIONArray();
+ yapionObject.add("@operators", operators);
+ Expression.OPERATORS.forEach((s, operator) -> {
+ operators.add(s);
+ });
+
+ // Headers
+ YAPIONArray headers = new YAPIONArray();
+ yapionObject.add("@headers", headers);
+ headers.add("CMD /.*");
+ headers.add("EVENT " + Arrays.stream(EventType.values()).map(Enum::name).reduce((s, s2) -> s + "|" + s2).map(s -> "(" + s + ")").orElse("") + "( .+)?");
+ headers.add("HOTKEY .+");
+
+ // Variable prefixes
+ YAPIONArray prefixes = new YAPIONArray();
+ yapionObject.add("@prefixes", prefixes);
+ prefixes.add("global");
+ prefixes.add("const");
+ prefixes.add("local");
+
+ // Variable suffixes
+ YAPIONArray suffixes = new YAPIONArray();
+ yapionObject.add("@suffixes", suffixes);
+ suffixes.add("isset");
+ suffixes.add("type");
+ suffixes.add("length");
+
+ // Commands
+ ScriptExecutor.SPECIAL_COMMANDS.forEach(specialCommand -> {
+ YAPIONArray yapionArray = new YAPIONArray();
+ yapionObject.add(specialCommand.command(), yapionArray);
+ if (specialCommand.repeating()) {
+ yapionArray.add(true);
+ } else {
+ yapionArray.add(false);
+ }
+ for (SpecialCommand.TokenType[] types : specialCommand.getSyntax()) {
+ YAPIONArray syntax = new YAPIONArray();
+ yapionArray.add(syntax);
+ for (SpecialCommand.TokenType type : types) {
+ syntax.add(type.ordinal());
+ }
+ }
+ });
+ syntax = yapionObject.toJSONLossy(new StringOutput()).getResult().getBytes();
+ }
+
+ @EventHandler
+ @SneakyThrows
+ public void onPlayerJoin(PlayerJoinEvent event) {
+ Bukkit.getScheduler().runTaskLater(BauSystem.getInstance(), () -> {
+ event.getPlayer().sendPluginMessage(BauSystem.getInstance(), "sw:script_syntax", syntax);
+ }, 5);
+ }
+}
diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/script/SpecialCommand.java b/BauSystem_Main/src/de/steamwar/bausystem/features/script/SpecialCommand.java
index f8b5f1ae..3cb32f9b 100644
--- a/BauSystem_Main/src/de/steamwar/bausystem/features/script/SpecialCommand.java
+++ b/BauSystem_Main/src/de/steamwar/bausystem/features/script/SpecialCommand.java
@@ -16,6 +16,12 @@ public interface SpecialCommand {
boolean execute(String[] command, ScriptExecutor scriptExecutor);
+ default boolean repeating() {
+ return false;
+ }
+
+ TokenType[][] getSyntax();
+
default long asLong(String value) {
try {
return Long.parseLong(value);
@@ -65,4 +71,16 @@ public interface SpecialCommand {
}
scriptExecutor.setIndex(scriptExecutor.getReturnStack().pop());
}
+
+ enum TokenType {
+ any, // This does not include jump_point and variable
+ expression,
+ jump_point,
+ variable,
+
+ text_type,
+ number_type,
+ floating_number_type,
+ boolean_type,
+ }
}
diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/Call.java b/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/Call.java
index 9a1f65d8..4cb22c65 100644
--- a/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/Call.java
+++ b/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/Call.java
@@ -37,4 +37,13 @@ public class Call implements SpecialCommand {
jumpToIndexWithMessageAndReturnStack(scriptExecutor, command[1], BauSystem.MESSAGE.parse("SCRIPT_COMMAND_CALL_ERROR", scriptExecutor.getPlayer(), command[1]));
return true;
}
+
+ private TokenType[][] syntax = {
+ { TokenType.jump_point },
+ };
+
+ @Override
+ public TokenType[][] getSyntax() {
+ return syntax;
+ }
}
diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/Exit.java b/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/Exit.java
index 925d900b..c274d252 100644
--- a/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/Exit.java
+++ b/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/Exit.java
@@ -31,4 +31,11 @@ public class Exit implements SpecialCommand {
public boolean execute(String[] command, ScriptExecutor scriptExecutor) {
return false;
}
+
+ private TokenType[][] syntax = {};
+
+ @Override
+ public TokenType[][] getSyntax() {
+ return syntax;
+ }
}
diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/If.java b/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/If.java
index 04fcea0b..e2a2ac44 100644
--- a/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/If.java
+++ b/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/If.java
@@ -53,4 +53,16 @@ public class If implements SpecialCommand {
}
return true;
}
+
+ private TokenType[][] syntax = {
+ { TokenType.boolean_type, TokenType.jump_point },
+ { TokenType.boolean_type, TokenType.jump_point, TokenType.jump_point },
+ { TokenType.expression, TokenType.jump_point },
+ { TokenType.expression, TokenType.jump_point, TokenType.jump_point }
+ };
+
+ @Override
+ public TokenType[][] getSyntax() {
+ return syntax;
+ }
}
diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/Jump.java b/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/Jump.java
index bab023e4..10ff4ab1 100644
--- a/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/Jump.java
+++ b/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/Jump.java
@@ -37,4 +37,13 @@ public class Jump implements SpecialCommand {
jumpToIndexWithMessage(scriptExecutor, command[1], BauSystem.MESSAGE.parse("SCRIPT_COMMAND_JUMP_ERROR", scriptExecutor.getPlayer(), command[1]));
return true;
}
+
+ private TokenType[][] syntax = {
+ { TokenType.jump_point }
+ };
+
+ @Override
+ public TokenType[][] getSyntax() {
+ return syntax;
+ }
}
diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/Return.java b/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/Return.java
index 742c58dc..0d9e6492 100644
--- a/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/Return.java
+++ b/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/Return.java
@@ -33,4 +33,11 @@ public class Return implements SpecialCommand {
returnFromStackWithMessage(scriptExecutor, BauSystem.MESSAGE.parse("SCRIPT_COMMAND_RETURN_ERROR", scriptExecutor.getPlayer()));
return true;
}
+
+ private TokenType[][] syntax = {};
+
+ @Override
+ public TokenType[][] getSyntax() {
+ return syntax;
+ }
}
diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/Sleep.java b/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/Sleep.java
index 94dd38e6..3cb0f025 100644
--- a/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/Sleep.java
+++ b/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/Sleep.java
@@ -46,4 +46,13 @@ public class Sleep implements SpecialCommand {
Bukkit.getScheduler().runTaskLater(BauSystem.getInstance(), scriptExecutor::resume, sleepTime);
return false;
}
+
+ private TokenType[][] syntax = {
+ { TokenType.number_type }
+ };
+
+ @Override
+ public TokenType[][] getSyntax() {
+ return syntax;
+ }
}
diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/arithmetic/other/Ceil.java b/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/arithmetic/other/Ceil.java
index b138b9ea..da87c9f9 100644
--- a/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/arithmetic/other/Ceil.java
+++ b/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/arithmetic/other/Ceil.java
@@ -90,4 +90,18 @@ public class Ceil implements SpecialCommand {
}
return true;
}
+
+ private TokenType[][] syntax = {
+ { TokenType.variable, TokenType.variable },
+ { TokenType.variable, TokenType.floating_number_type },
+ { TokenType.variable, TokenType.variable, TokenType.number_type },
+ { TokenType.variable, TokenType.floating_number_type, TokenType.number_type },
+ { TokenType.variable, TokenType.variable, TokenType.variable },
+ { TokenType.variable, TokenType.floating_number_type, TokenType.variable },
+ };
+
+ @Override
+ public TokenType[][] getSyntax() {
+ return syntax;
+ }
}
diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/arithmetic/other/Floor.java b/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/arithmetic/other/Floor.java
index bebf209b..ce5d0730 100644
--- a/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/arithmetic/other/Floor.java
+++ b/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/arithmetic/other/Floor.java
@@ -90,4 +90,18 @@ public class Floor implements SpecialCommand {
}
return true;
}
+
+ private TokenType[][] syntax = {
+ { TokenType.variable, TokenType.variable },
+ { TokenType.variable, TokenType.floating_number_type },
+ { TokenType.variable, TokenType.variable, TokenType.number_type },
+ { TokenType.variable, TokenType.floating_number_type, TokenType.number_type },
+ { TokenType.variable, TokenType.variable, TokenType.variable },
+ { TokenType.variable, TokenType.floating_number_type, TokenType.variable },
+ };
+
+ @Override
+ public TokenType[][] getSyntax() {
+ return syntax;
+ }
}
diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/arithmetic/other/Round.java b/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/arithmetic/other/Round.java
index 31a00aec..2af5d261 100644
--- a/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/arithmetic/other/Round.java
+++ b/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/arithmetic/other/Round.java
@@ -90,4 +90,18 @@ public class Round implements SpecialCommand {
}
return true;
}
+
+ private TokenType[][] syntax = {
+ { TokenType.variable, TokenType.variable },
+ { TokenType.variable, TokenType.floating_number_type },
+ { TokenType.variable, TokenType.variable, TokenType.number_type },
+ { TokenType.variable, TokenType.floating_number_type, TokenType.number_type },
+ { TokenType.variable, TokenType.variable, TokenType.variable },
+ { TokenType.variable, TokenType.floating_number_type, TokenType.variable },
+ };
+
+ @Override
+ public TokenType[][] getSyntax() {
+ return syntax;
+ }
}
diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/io/Echo.java b/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/io/Echo.java
index e403edd8..8c12cf30 100644
--- a/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/io/Echo.java
+++ b/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/io/Echo.java
@@ -45,4 +45,18 @@ public class Echo implements SpecialCommand {
BauSystem.MESSAGE.send("SCRIPT_COMMAND_IO_ECHO_MESSAGE", scriptExecutor.getPlayer(), ChatColor.translateAlternateColorCodes('&', st.toString()));
return true;
}
+
+ @Override
+ public boolean repeating() {
+ return true;
+ }
+
+ private TokenType[][] syntax = {
+ { TokenType.any },
+ };
+
+ @Override
+ public TokenType[][] getSyntax() {
+ return syntax;
+ }
}
diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/io/Echoactionbar.java b/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/io/Echoactionbar.java
index 000e1eec..c5c99240 100644
--- a/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/io/Echoactionbar.java
+++ b/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/io/Echoactionbar.java
@@ -45,4 +45,18 @@ public class Echoactionbar implements SpecialCommand {
SWUtils.sendToActionbar(scriptExecutor.getPlayer(), ChatColor.translateAlternateColorCodes('&', st.toString()));
return true;
}
+
+ @Override
+ public boolean repeating() {
+ return true;
+ }
+
+ private TokenType[][] syntax = {
+ { TokenType.any },
+ };
+
+ @Override
+ public TokenType[][] getSyntax() {
+ return syntax;
+ }
}
diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/io/Input.java b/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/io/Input.java
index 8b0234b8..4ecb4237 100644
--- a/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/io/Input.java
+++ b/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/io/Input.java
@@ -62,4 +62,18 @@ public class Input implements SpecialCommand {
swAnvilInv.open();
return false;
}
+
+ @Override
+ public boolean repeating() {
+ return true;
+ }
+
+ private TokenType[][] syntax = {
+ { TokenType.variable, TokenType.any },
+ };
+
+ @Override
+ public TokenType[][] getSyntax() {
+ return syntax;
+ }
}
diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/string/Insert.java b/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/string/Insert.java
index 5405ad42..00dbf597 100644
--- a/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/string/Insert.java
+++ b/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/string/Insert.java
@@ -77,7 +77,7 @@ public class Insert implements SpecialCommand {
BauSystem.MESSAGE.send("SCRIPT_COMMAND_ERROR_ONLY_STRINGS_ALLOWED", scriptExecutor.getPlayer());
return true;
}
- if (!(v3 instanceof Value.StringValue)) {
+ if (!(v3 instanceof Value.LongValue)) {
BauSystem.MESSAGE.send("SCRIPT_COMMAND_ERROR_ONLY_NUMBERS_ALLOWED", scriptExecutor.getPlayer());
return true;
}
@@ -85,4 +85,14 @@ public class Insert implements SpecialCommand {
scriptExecutor.getLocalVariables().putValue(resultName, new Value.StringValue(new StringBuilder(v1.asString()).insert((int) v3.asLong(), v2.asString()).toString()));
return true;
}
+
+ private TokenType[][] syntax = {
+ { TokenType.variable, TokenType.variable, TokenType.number_type },
+ { TokenType.variable, TokenType.variable, TokenType.variable, TokenType.number_type },
+ };
+
+ @Override
+ public TokenType[][] getSyntax() {
+ return syntax;
+ }
}
diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/string/Remove.java b/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/string/Remove.java
index b1ed2e14..002fd3c5 100644
--- a/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/string/Remove.java
+++ b/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/string/Remove.java
@@ -76,4 +76,14 @@ public class Remove implements SpecialCommand {
scriptExecutor.getLocalVariables().putValue(resultName, new Value.StringValue(v1.asString().replace(v2.asString(), "")));
return true;
}
+
+ private TokenType[][] syntax = {
+ { TokenType.variable, TokenType.variable },
+ { TokenType.variable, TokenType.variable, TokenType.variable },
+ };
+
+ @Override
+ public TokenType[][] getSyntax() {
+ return syntax;
+ }
}
diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/string/Replace.java b/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/string/Replace.java
index ec3b6f13..a7a5716f 100644
--- a/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/string/Replace.java
+++ b/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/string/Replace.java
@@ -85,4 +85,14 @@ public class Replace implements SpecialCommand {
scriptExecutor.getLocalVariables().putValue(resultName, new Value.StringValue(v1.asString().replace(v2.asString(), v3.asString())));
return true;
}
+
+ private TokenType[][] syntax = {
+ { TokenType.variable, TokenType.variable, TokenType.variable },
+ { TokenType.variable, TokenType.variable, TokenType.variable, TokenType.variable },
+ };
+
+ @Override
+ public TokenType[][] getSyntax() {
+ return syntax;
+ }
}
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 ab5fd935..33591596 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
@@ -82,4 +82,14 @@ public class Substring implements SpecialCommand {
scriptExecutor.getLocalVariables().putValue(resultName, result);
return true;
}
+
+ private TokenType[][] syntax = {
+ { TokenType.variable, TokenType.number_type },
+ { TokenType.variable, TokenType.variable, TokenType.number_type },
+ };
+
+ @Override
+ public TokenType[][] getSyntax() {
+ return syntax;
+ }
}
diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/variable/Const.java b/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/variable/Const.java
index 838601da..850a6642 100644
--- a/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/variable/Const.java
+++ b/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/variable/Const.java
@@ -70,4 +70,18 @@ public class Const implements SpecialCommand {
Constants.getConstant(varName, scriptExecutor.getPlayer()).fromValue(Value.parse(varValue.toString()));
return true;
}
+
+ @Override
+ public boolean repeating() {
+ return true;
+ }
+
+ private TokenType[][] syntax = {
+ { TokenType.variable, TokenType.any },
+ };
+
+ @Override
+ public TokenType[][] getSyntax() {
+ return syntax;
+ }
}
diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/variable/Convert.java b/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/variable/Convert.java
index 8abe3afc..a99c0bb6 100644
--- a/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/variable/Convert.java
+++ b/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/variable/Convert.java
@@ -62,4 +62,13 @@ public class Convert implements SpecialCommand {
scriptExecutor.getLocalVariables().putValue(command[1], Value.parse(command[2]));
return true;
}
+
+ private TokenType[][] syntax = {
+ { TokenType.variable, TokenType.any },
+ };
+
+ @Override
+ public TokenType[][] getSyntax() {
+ return syntax;
+ }
}
diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/variable/Global.java b/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/variable/Global.java
index b8a8e662..ae3f33a7 100644
--- a/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/variable/Global.java
+++ b/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/variable/Global.java
@@ -50,4 +50,18 @@ public class Global implements SpecialCommand {
scriptExecutor.getGlobalVariables().putValue(varName, Value.parse(varValue.toString()));
return true;
}
+
+ @Override
+ public boolean repeating() {
+ return true;
+ }
+
+ private TokenType[][] syntax = {
+ { TokenType.variable, TokenType.any },
+ };
+
+ @Override
+ public TokenType[][] getSyntax() {
+ return syntax;
+ }
}
diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/variable/Unglobal.java b/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/variable/Unglobal.java
index 3fbc712b..06e9e7b1 100644
--- a/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/variable/Unglobal.java
+++ b/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/variable/Unglobal.java
@@ -37,4 +37,13 @@ public class Unglobal implements SpecialCommand {
scriptExecutor.getGlobalVariables().removeValue(command[1]);
return true;
}
+
+ private TokenType[][] syntax = {
+ { TokenType.variable },
+ };
+
+ @Override
+ public TokenType[][] getSyntax() {
+ return syntax;
+ }
}
diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/variable/Unvar.java b/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/variable/Unvar.java
index 016ac170..76230f87 100644
--- a/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/variable/Unvar.java
+++ b/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/variable/Unvar.java
@@ -37,4 +37,13 @@ public class Unvar implements SpecialCommand {
scriptExecutor.getLocalVariables().removeValue(command[1]);
return true;
}
+
+ private TokenType[][] syntax = {
+ { TokenType.variable, TokenType.any },
+ };
+
+ @Override
+ public TokenType[][] getSyntax() {
+ return syntax;
+ }
}
diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/variable/Var.java b/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/variable/Var.java
index 41b948fe..6cda1236 100644
--- a/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/variable/Var.java
+++ b/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/variable/Var.java
@@ -50,4 +50,18 @@ public class Var implements SpecialCommand {
scriptExecutor.getLocalVariables().putValue(varName, Value.parse(varValue.toString()));
return true;
}
+
+ @Override
+ public boolean repeating() {
+ return true;
+ }
+
+ private TokenType[][] syntax = {
+ { TokenType.variable, TokenType.any },
+ };
+
+ @Override
+ public TokenType[][] getSyntax() {
+ return syntax;
+ }
}
diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/world/GetMaterial.java b/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/world/GetMaterial.java
index 29b7807f..e5511e98 100644
--- a/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/world/GetMaterial.java
+++ b/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/world/GetMaterial.java
@@ -77,4 +77,13 @@ public class GetMaterial implements SpecialCommand {
scriptExecutor.getLocalVariables().putValue(command[1], new Value.StringValue(world.getBlockAt(x, y, z).getType().name()));
return true;
}
+
+ private TokenType[][] syntax = {
+ { TokenType.variable, TokenType.number_type, TokenType.number_type, TokenType.number_type }
+ };
+
+ @Override
+ public TokenType[][] getSyntax() {
+ return syntax;
+ }
}
diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/world/SetMaterial.java b/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/world/SetMaterial.java
index 0c4ac8b2..1411c708 100644
--- a/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/world/SetMaterial.java
+++ b/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/world/SetMaterial.java
@@ -80,4 +80,13 @@ public class SetMaterial implements SpecialCommand {
}
return true;
}
+
+ private TokenType[][] syntax = {
+ { TokenType.variable, TokenType.number_type, TokenType.number_type, TokenType.number_type }
+ };
+
+ @Override
+ public TokenType[][] getSyntax() {
+ return syntax;
+ }
}
diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/script/expression/Expression.java b/BauSystem_Main/src/de/steamwar/bausystem/features/script/expression/Expression.java
index 7cde325a..f1bca91c 100644
--- a/BauSystem_Main/src/de/steamwar/bausystem/features/script/expression/Expression.java
+++ b/BauSystem_Main/src/de/steamwar/bausystem/features/script/expression/Expression.java
@@ -30,7 +30,7 @@ public class Expression {
private static int highestPrecedence = 1;
- private static final Map OPERATORS = new HashMap<>();
+ public static final Map OPERATORS = new HashMap<>();
public static void registerOperator(Operator operator) {
highestPrecedence = Math.max(highestPrecedence, operator.getPriority()) + 1;