diff --git a/BauSystem_Linkage/src/de/steamwar/linkage/types/Operator_GENERIC.java b/BauSystem_Linkage/src/de/steamwar/linkage/types/Operator_GENERIC.java
new file mode 100644
index 00000000..8a1916a8
--- /dev/null
+++ b/BauSystem_Linkage/src/de/steamwar/linkage/types/Operator_GENERIC.java
@@ -0,0 +1,40 @@
+/*
+ * 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.linkage.types;
+
+import de.steamwar.linkage.LinkageType;
+import de.steamwar.linkage.plan.BuildPlan;
+import de.steamwar.linkage.plan.MethodBuilder;
+
+import javax.lang.model.element.TypeElement;
+
+public class Operator_GENERIC implements LinkageType {
+
+ @Override
+ public String method() {
+ return "linkScriptCommands";
+ }
+
+ @Override
+ public void generateCode(BuildPlan buildPlan, MethodBuilder methodBuilder, String s, TypeElement typeElement) {
+ buildPlan.addImport("de.steamwar.bausystem.features.script.expression.Expression");
+ methodBuilder.addLine("Expression.registerOperator(" + s + ");");
+ }
+}
diff --git a/BauSystem_Main/src/BauSystem.properties b/BauSystem_Main/src/BauSystem.properties
index 4e48968d..72b0a128 100644
--- a/BauSystem_Main/src/BauSystem.properties
+++ b/BauSystem_Main/src/BauSystem.properties
@@ -217,45 +217,42 @@ GUI_EDITOR_TITLE_MORE=Select item
# Script
## Errors
SCRIPT_SLEEP_ERROR = §cInsert a sleep into your script
+SCRIPT_COMMAND_ERROR_UNKNOWN_VAR = §cUnknown variable {0}
+SCRIPT_COMMAND_ERROR_EXPRESSION = §cExpression error with: {0}
SCRIPT_COMMAND_ERROR_FIRST_ARG_NOVAR = §cThe first argument is missing and should be a variable
SCRIPT_COMMAND_ERROR_FIRST_ARG_NONUMER = §cThe first argument is missing and should be a number
SCRIPT_COMMAND_ERROR_FIRST_ARG_NOVAR_OR_VALUE = §cThe first argument is missing and should be a variable or a number
SCRIPT_COMMAND_ERROR_FIRST_ARG_NOJUMPPOINT = §cThe first argument is missing and should be a jump-point
SCRIPT_COMMAND_ERROR_SECOND_ARG_NOVAR = §cThe second argument is missing and should be a variable
-SCRIPT_COMMAND_ERROR_SECOND_ARG_NOVAR_OR_VALUE = §cThe second argument is missing and should be a variable or a number
SCRIPT_COMMAND_ERROR_SECOND_ARG_NOVALUE = §cThe econd argument is missing and should be a value
+SCRIPT_COMMAND_ERROR_SECOND_ARG_NOJUMPPOINT = §cThe second argument is missing and should be a jump-point
SCRIPT_COMMAND_ERROR_THIRD_ARG_NOVAR = §cThe third argument is missing and should be a variable
SCRIPT_COMMAND_ERROR_THIRD_ARG_NOVALUE = §cThe third argument is missing and should be a value
SCRIPT_COMMAND_ERROR_THIRD_ARG_NOVAR_OR_NUMBER = §cThe third argument is missing and should be a variable or a number
-SCRIPT_COMMAND_ERROR_THIRD_ARG_NOJUMPPOINT = §cThe third argument is missing and should be a jump-point
SCRIPT_COMMAND_ERROR_FOURTH_ARG_NOVALUE = §cThe fourth argument is missing and should be a value
SCRIPT_COMMAND_ERROR_BOOLEAN_COMPARE = §cOnly booleans can be compared
SCRIPT_COMMAND_ERROR_NUMBER_COMPARE = §cOnly numbers can be compared
+SCRIPT_COMMAND_ERROR_NO_BOOLEAN = §cThe value is not a boolean
SCRIPT_COMMAND_ERROR_ONLY_STRINGS_ALLOWED = §cOnly strings are allowed
SCRIPT_COMMAND_ERROR_ONLY_NUMBERS_ALLOWED = §cOnly numbers are allowed
+SCRIPT_COMMAND_ERROR_UNKNOWN_OPERATION = §cUnknown operation: {0}
+
## Commands
-SCRIPT_COMMAND_ARITHMETIC_ADD_HELP_1 = §eadd §8<§7variable§8> §8<§7variable§8|§7value§8>
-SCRIPT_COMMAND_ARITHMETIC_ADD_HELP_2 = §eadd §8<§7variable§8> §8<§7variable§8§8|§7value> §8<§7variable§8|§7value§8>
-SCRIPT_COMMAND_ARITHMETIC_ADD_HELP_3 = Addition between the two last variables and writes the result in the first one
-SCRIPT_COMMAND_ARITHMETIC_ADD_ERROR = §cOnly numbers can be added
-
-SCRIPT_COMMAND_ARITHMETIC_DIV_HELP_1 = §ediv §8<§7variable§8> §8<§7variable§8|§7value§8>
-SCRIPT_COMMAND_ARITHMETIC_DIV_HELP_2 = §ediv §8<§7variable§8> §8<§7variable§8|§7value§8> §8<§7variable§8|§7value§8>
-SCRIPT_COMMAND_ARITHMETIC_DIV_HELP_3 = Division between the two last variables and writes the result in the first one
+SCRIPT_COMMAND_ARITHMETIC_ADD_ERROR = §cOnly numbers or strings can be added
SCRIPT_COMMAND_ARITHMETIC_DIV_ERROR = §cOnly numbers can be divided
-
-SCRIPT_COMMAND_ARITHMETIC_MUL_HELP_1 = §emul §8<§7variable§8> §8<§7variable§8|§7value§8>
-SCRIPT_COMMAND_ARITHMETIC_MUL_HELP_2 = §emul §8<§7variable§8> §8<§7variable§8|§7value§8> §8<§7variable§8|§7value§8>
-SCRIPT_COMMAND_ARITHMETIC_MUL_HELP_3 = Multiplication between the two last variables and writes the result in the first one
SCRIPT_COMMAND_ARITHMETIC_MUL_ERROR = §cOnly numbers can be multiplied
-
-SCRIPT_COMMAND_ARITHMETIC_SUB_HELP_1 = §esub §8<§7variable§8> §8<§7variable§8|§7value§8>
-SCRIPT_COMMAND_ARITHMETIC_SUB_HELP_2 = §esub §8<§7variable§8> §8<§7variable§8§8|§7value§8> §8<§7variable§8|§7value§8>
-SCRIPT_COMMAND_ARITHMETIC_SUB_HELP_3 = Subtraction between the two last variables and writes the result in the first one
SCRIPT_COMMAND_ARITHMETIC_SUB_ERROR = §cOnly numbers can be subtracted
+SCRIPT_COMMAND_ARITHMETIC_POW_ERROR = §cOnly numbers can be raised to a power
+SCRIPT_COMMAND_ARITHMETIC_MOD_ERROR = §cOnly whole numbers can be used for modulo
+SCRIPT_COMMAND_ARITHMETIC_BIT_AND_ERROR = §cOnly whole numbers and booleans can be used for and
+SCRIPT_COMMAND_ARITHMETIC_BIT_OR_ERROR = §cOnly whole numbers and booleans can be used for or
+SCRIPT_COMMAND_ARITHMETIC_BIT_XOR_ERROR = §cOnly whole numbers and booleans can be used for xor
+SCRIPT_COMMAND_ARITHMETIC_BIT_LEFT_ERROR = §cOnly whole numbers can be used for left shift value
+SCRIPT_COMMAND_ARITHMETIC_BIT_RIGHT_ERROR = §cOnly whole numbers can be used for right shift value
+SCRIPT_COMMAND_ARITHMETIC_BIT_RIGHT_LOGIC_ERROR = §cOnly whole numbers can be used for logic right shift value
SCRIPT_COMMAND_ARITHMETIC_OTHER_CEIL_HELP_1 = §eceil §8<§7variable§8> §8<§7variable§8|§7value§8>
SCRIPT_COMMAND_ARITHMETIC_OTHER_CEIL_HELP_2 = §eceil §8<§7variable§8> §8<§7variable§8|§7value§8> §8<§7variable§8|§7value§8>
@@ -285,38 +282,10 @@ SCRIPT_COMMAND_IO_ECHOACTIONBAR_HELP_2 = §7Send a message to the player to the
SCRIPT_COMMAND_IO_INPUT_HELP_1 = §einput §8<§7variable§8> §8<§7text§8>
SCRIPT_COMMAND_IO_INPUT_HELP_2 = §7Request an input from the player, which will be written in the variable. The text is optional
-SCRIPT_COMMAND_LOGIC_AND_HELP_1 = §eand §8<§7variable§8> §8<§7variable§8>
-SCRIPT_COMMAND_LOGIC_AND_HELP_2 = §eand §8<§7variable§8> §8<§7variable§8> §8<§7variable§8>
-SCRIPT_COMMAND_LOGIC_AND_HELP_3 = The logic and between the last two variables and writes it in the first
-
-SCRIPT_COMMAND_LOGIC_EQUAL_HELP_1 = §eequal §8<§7variable§8> §8<§7variable§8>
-SCRIPT_COMMAND_LOGIC_EQUAL_HELP_2 = §eequal §8<§7variable§8> §8<§7variable§8> §8<§7variable§8>
-SCRIPT_COMMAND_LOGIC_EQUAL_HELP_3 = Compares the last two variables and writes it in the first
-
-SCRIPT_COMMAND_LOGIC_GREATER_HELP_1 = §egreater §8<§7variable§8> §8<§7variable§8>
-SCRIPT_COMMAND_LOGIC_GREATER_HELP_2 = §egreater §8<§7variable§8> §8<§7variable§8> §8<§7variable§8>
-SCRIPT_COMMAND_LOGIC_GREATER_HELP_3 = Compares the last two variables and writes it in the first
-
-SCRIPT_COMMAND_LOGIC_LESS_HELP_1 = §eless §8<§7variable§8> §8<§7variable§8>
-SCRIPT_COMMAND_LOGIC_LESS_HELP_2 = §eless §8<§7variable§8> §8<§7variable§8> §8<§7variable§8>
-SCRIPT_COMMAND_LOGIC_LESS_HELP_3 = Compares the last two variables and writes it in the first
-
-SCRIPT_COMMAND_LOGIC_NOT_HELP_1 = §enot §8<§7variable§8>
-SCRIPT_COMMAND_LOGIC_NOT_HELP_2 = §enot §8<§7variable§8> §8<§7variable§8>
-SCRIPT_COMMAND_LOGIC_NOT_HELP_3 = The logic not of the last variable and writes it in the first
-
-SCRIPT_COMMAND_LOGIC_OR_HELP_1 = §eor §8<§7variable§8> §8<§7variable§8>
-SCRIPT_COMMAND_LOGIC_OR_HELP_2 = §eor §8<§7variable§8> §8<§7variable§8> §8<§7variable§8>
-SCRIPT_COMMAND_LOGIC_OR_HELP_3 = The logic or between the last two variables and writes it in the first
-
SCRIPT_COMMAND_STRING_INSERT_HELP_1 = §einsert §8<§7variable§8> §8<§7variable§8> §8<§7number§8>
SCRIPT_COMMAND_STRING_INSERT_HELP_2 = §einsert §8<§7variable§8> §8<§7variable§8> §8<§7variable§8> §8<§7number§8>
SCRIPT_COMMAND_STRING_INSERT_HELP_3 = Insert something into a String at a given index. The number is the index and the variable is the string. Optionally the result can be written in another or a new variable
-SCRIPT_COMMAND_STRING_LENGTH_HELP_1 = §elength §8<§7variable§8>
-SCRIPT_COMMAND_STRING_LENGTH_HELP_2 = §elength §8<§7variable§8> §8<§7variable§8>
-SCRIPT_COMMAND_STRING_LENGTH_HELP_3 = Returns the text length.
-
SCRIPT_COMMAND_STRING_REMOVE_HELP_1 = §eremove §8<§7variable§8> §8<§7from variable§8>
SCRIPT_COMMAND_STRING_REMOVE_HELP_2 = §eremove §8<§7variable§8> §8<§7variable§8> §8<§7from variable§8>
SCRIPT_COMMAND_STRING_REMOVE_HELP_3 = Removes all occurrences of a string from another string.
@@ -338,9 +307,6 @@ SCRIPT_COMMAND_VARIABLE_CONVERT_HELP_2 = Converts a value to 'number' if it's a
SCRIPT_COMMAND_VARIABLE_GLOBAL_HELP_1 = §eglobal §8<§7variable§8> §8[§7value§8(§7s§8)§8]
SCRIPT_COMMAND_VARIABLE_GLOBAL_HELP_2 = Writes a value in a variable, which can be a number, a boolean or a string
-SCRIPT_COMMAND_VARIABLE_ISSET_HELP_1 = §eisset §8<§7variable§8> §8<§7variable§8>
-SCRIPT_COMMAND_VARIABLE_ISSET_HELP_2 = Writes true/false in a variable, depending on whether the second variable exists
-
SCRIPT_COMMAND_VARIABLE_UNGLOBAL_HELP_1 = §eunglobal §8<§7variable§8>
SCRIPT_COMMAND_VARIABLE_UNGLOBAL_HELP_2 = Deletes a global variable.
@@ -350,9 +316,6 @@ SCRIPT_COMMAND_VARIABLE_UNVAR_HELP_2 = Deletes a local variable.
SCRIPT_COMMAND_VARIABLE_VAR_HELP_1 = §evar §8<§7variable§8> §8[§7value§8(§7s§8)§8]
SCRIPT_COMMAND_VARIABLE_VAR_HELP_2 = Writes a value in a variable, which can be a number, a boolean or a string
-SCRIPT_COMMAND_VARIABLE_VARTYPE_HELP_1 = §evartype §8<§7variable§8> §8<§7variable§8>
-SCRIPT_COMMAND_VARIABLE_VARTYPE_HELP_2 = Writes the type of the second variable in the first. If the second variable does not exist, the first variable will have the value 'false'. Otherwise it will have any of the following types: 'number', 'boolean', 'text'
-
SCRIPT_COMMAND_WORLD_GETMATERIAL_HELP_1 = §egetmaterial §8<§7variable§8> §8<§7number§8> §8<§7number§8> §8<§7number§8>
SCRIPT_COMMAND_WORLD_GETMATERIAL_HELP_2 = Writes the material of a block in the world in the variable
@@ -362,8 +325,8 @@ SCRIPT_COMMAND_WORLD_SETMATERIAL_HELP_2 = Sets a block in the world with the giv
SCRIPT_COMMAND_EXIT_HELP_1 = §eexit
SCRIPT_COMMAND_EXIT_HELP_2 = Exits the script
-SCRIPT_COMMAND_IF_HELP_1 = §eif §8<§7variable§8/§7value§8> §8<§7variable§8/§7value§8> §8<§7jump-point§8>
-SCRIPT_COMMAND_IF_HELP_2 = §eif §8<§7variable§8/§7value§8> §8<§7variable§8/§7value§8> §8<§7jump-point§8> §8<§7jump-point§8>
+SCRIPT_COMMAND_IF_HELP_1 = §eif §8<§7true/false§8> §8<§7jump-point§8>
+SCRIPT_COMMAND_IF_HELP_2 = §eif §8<§7true/false§8> §8<§7jump-point§8> §8<§7jump-point§8>
SCRIPT_COMMAND_IF_HELP_3 = §7Jump to a jump-point if the given values are equal or another jump-point otherwise.
SCRIPT_COMMAND_JUMP_HELP_1 = §ejump §8<§7jump-point§8>
@@ -429,14 +392,28 @@ SCRIPT_GUI_CUSTOM_EVENTS_LORE_13 = §eTNTExplodeInBuild §8-§7 x, y, z
SCRIPT_GUI_CUSTOM_EVENTS_LORE_14 = §eSelfJoin §8-§7 x, y, z, playerName
SCRIPT_GUI_CUSTOM_EVENTS_LORE_15 = §eSelfLeave §8-§7 x, y, z, playerName
SCRIPT_GUI_CUSTOM_EVENTS_LORE_16 = §eDropItem §8-§7 material, x, y, z
+SCRIPT_GUI_CUSTOM_EVENTS_LORE_17 = §eEntityDeath §8-§7 entityType, x, y, z
SCRIPT_GUI_CUSTOM_EVENTS_LORE_STAR_1 = §e* §8-§7 Everything in brackets is only set if the variable before is set on §etrue§7.
SCRIPT_GUI_OTHER = §eOther
-SCRIPT_GUI_OTHER_LORE_1 = §7comments start with §e#§7.
+SCRIPT_GUI_OTHER_LORE_1 = §7Comments start with §e#§7.
SCRIPT_GUI_OTHER_LORE_2 = §7Jump_Points start with §e.§7.
-SCRIPT_GUI_OTHER_LORE_3 = §7A variable name encased in '<>' is replaced, up to two times.
-SCRIPT_GUI_OTHER_LORE_4 = §7A variable in '<>' can be prefixed with 'const.', 'local.' or 'global.' for the exact type where it should be searched for.
-SCRIPT_GUI_OTHER_LORE_5 = §7If it is suffixed by '.type', the type of the variable will be returned.
+SCRIPT_GUI_OTHER_LORE_3 = §7A variable name enclosed in '§e{}§7' is replaced by its value. A variable can be prefixed with '§econst.§7' or '§elocal.§7' or '§eglobal.§7'.
+SCRIPT_GUI_OTHER_LORE_4 = §7The following applies:
+SCRIPT_GUI_OTHER_LORE_5 = §7- Local variables are only available in the script book.
+SCRIPT_GUI_OTHER_LORE_6 = §7- Global variables are available in every script book.
+SCRIPT_GUI_OTHER_LORE_7 = §7- Constant variables are variables from the server (e.g. player name, TPS, etc.)
+SCRIPT_GUI_OTHER_LORE_8 = §7A variable can be appended with '§e.length§7' or '§e.type§7' or '§e.isset§7'.
+SCRIPT_GUI_OTHER_LORE_9 = §7The following applies:
+SCRIPT_GUI_OTHER_LORE_10 = §7- Length returns the length of the variable as a number.
+SCRIPT_GUI_OTHER_LORE_11 = §7- Type returns the type (number, floating_number, text or boolean) as text.
+SCRIPT_GUI_OTHER_LORE_12 = §7- Isset returns as a boolean whether the variable exists.
+SCRIPT_GUI_OTHER_LORE_13 = §7Mathematical as well as logical operations can be specified in '§e{}§7'.
+SCRIPT_GUI_OTHER_LORE_14 = §7The following applies:
+SCRIPT_GUI_OTHER_LORE_15 = §7- arithmetic operators: §e+ * - /§7 as well as §e%§7 for modulo
+SCRIPT_GUI_OTHER_LORE_16 = §7- Logical operators: §e==§7; §e!=§7; §e<=§7; §e>=§7; §e<§7; §e>§7; §e&&§7; §e||§7 (this is the character for or)
+SCRIPT_GUI_OTHER_LORE_17 = §7- Bitwise operators: §e&§7; §e|§7; §e^
+SCRIPT_GUI_OTHER_LORE_18 = §7- Shift operators: §e<<§7; §e>>§7; §e>>>§7
SCRIPT_GUI_COMMAND_NAME = §7Command: §e{0}
@@ -453,7 +430,7 @@ SCRIPT_GUI_CONSTANT_AUTO_TRACE_LORE = §etrue§7 if the auto trace is activated.
SCRIPT_GUI_CONSTANT_TNT_NAME = §7Constant §etnt
SCRIPT_GUI_CONSTANT_TNT_LORE = §etrue§7 if tnt is not deactivated.
-SCRIPT_GUI_CONSTANT_ONLY_TB_NAME = §7Constant §etnt-onlytb
+SCRIPT_GUI_CONSTANT_ONLY_TB_NAME = §7Constant §etnt_onlytb
SCRIPT_GUI_CONSTANT_ONLY_TB_LORE = §etrue§7 if tnt no build is activated.
SCRIPT_GUI_CONSTANT_FREEZE_NAME = §7Constant §efreeze
@@ -498,9 +475,15 @@ SCRIPT_GUI_CONSTANT_SLOT_MATERIAL_DISPLAY_LORE = §eName§7 of the item in the c
SCRIPT_GUI_CONSTANT_OFF_HAND_MATERIAL_DISPLAY_NAME = §7Constant §eoffmaterialname
SCRIPT_GUI_CONSTANT_OFF_HAND_MATERIAL_DISPLAY_LORE = §eName§7 of the item in the off hand
-SCRIPT_GUI_CONSTANT_REGION_TYPE_NAME = §7Constant §eregion-type
+SCRIPT_GUI_CONSTANT_REGION_TYPE_NAME = §7Constant §eregion_type
SCRIPT_GUI_CONSTANT_REGION_TYPE_LORE = §eregion type§7 of the current region
+SCRIPT_GUI_CONSTANT_TPS_NAME = §7Constant §etps
+SCRIPT_GUI_CONSTANT_TPS_LORE = §etps§7 of the server
+
+SCRIPT_GUI_CONSTANT_TPS_LIMIT_NAME = §7Constant §etps_limit
+SCRIPT_GUI_CONSTANT_TPS_LIMIT_LORE = §etps_limit§7 of the server
+
# Unsign Book
UNSIGN_HELP=§8/§eunsign §8- §7Make a signed book writable again
diff --git a/BauSystem_Main/src/BauSystem_de.properties b/BauSystem_Main/src/BauSystem_de.properties
index 6c9896f2..555ba5f3 100644
--- a/BauSystem_Main/src/BauSystem_de.properties
+++ b/BauSystem_Main/src/BauSystem_de.properties
@@ -215,17 +215,18 @@ GUI_EDITOR_TITLE_MORE=Item auswählen
# Script
## Errors
SCRIPT_SLEEP_ERROR = §cFüge ein sleep in dein Script ein
+SCRIPT_COMMAND_ERROR_UNKNOWN_VAR = §cUnbekannte Variable {0}
+SCRIPT_COMMAND_ERROR_EXPRESSION = §cExpression fehler in: {0}
SCRIPT_COMMAND_ERROR_FIRST_ARG_NOVAR = §cDas erste Argument fehlt und sollte eine Variable sein
SCRIPT_COMMAND_ERROR_FIRST_ARG_NONUMER = §cDas erste Argument fehlt und sollte eine Zahl sein
SCRIPT_COMMAND_ERROR_FIRST_ARG_NOVAR_OR_VALUE = §cDas erste Argument fehlt und sollte eine Variable oder ein Wert sein
SCRIPT_COMMAND_ERROR_FIRST_ARG_NOJUMPPOINT = §cDas erste Argument fehlt und sollte ein Jump-Point sein
SCRIPT_COMMAND_ERROR_SECOND_ARG_NOVAR = §cDas zweite Argument fehlt und sollte eine Variable sein
-SCRIPT_COMMAND_ERROR_SECOND_ARG_NOVAR_OR_VALUE = §cDas zweite Argument fehlt und sollte eine Variable oder ein Wert sein
SCRIPT_COMMAND_ERROR_SECOND_ARG_NOVALUE = §cDas zweite Argument fehlt und sollte ein Wert sein
+SCRIPT_COMMAND_ERROR_SECOND_ARG_NOJUMPPOINT = §cDas dritte Argument fehlt und sollte ein Jump-Point sein
SCRIPT_COMMAND_ERROR_THIRD_ARG_NOVAR = §cDas dritte Argument fehlt und sollte eine Variable sein
SCRIPT_COMMAND_ERROR_THIRD_ARG_NOVALUE = §cDas dritte Argument fehlt und sollte ein Wert sein
SCRIPT_COMMAND_ERROR_THIRD_ARG_NOVAR_OR_NUMBER = §cDas dritte Argument fehlt und sollte eine Variable/Zahl sein
-SCRIPT_COMMAND_ERROR_THIRD_ARG_NOJUMPPOINT = §cDas dritte Argument fehlt und sollte ein Jump-Point sein
SCRIPT_COMMAND_ERROR_FOURTH_ARG_NOVALUE = §cDas vierte Argument fehlt und sollte ein Wert sein
SCRIPT_COMMAND_ERROR_BOOLEAN_COMPARE = §cNur Booleans können verglichen werden
@@ -234,26 +235,18 @@ SCRIPT_COMMAND_ERROR_NUMBER_COMPARE = §cNur Zahlen können verglichen werden
SCRIPT_COMMAND_ERROR_ONLY_STRINGS_ALLOWED = §cNur Strings können verwendet werden
SCRIPT_COMMAND_ERROR_ONLY_NUMBERS_ALLOWED = §cNur Zahlen können verwendet werden
+SCRIPT_COMMAND_ERROR_UNKNOWN_OPERATION = §cUnbekannte Operation: {0}
+
## Commands
-SCRIPT_COMMAND_ARITHMETIC_ADD_HELP_1 = §eadd §8<§7Variable§8> §8<§7Variable§8|§7Wert§8>
-SCRIPT_COMMAND_ARITHMETIC_ADD_HELP_2 = §eadd §8<§7Variable§8> §8<§7Variable§8§8|§7Wert> §8<§7Variable§8|§7Wert§8>
-SCRIPT_COMMAND_ARITHMETIC_ADD_HELP_3 = Addition zwischen den letzten beiden Variablen und schreibt es in die erste.
SCRIPT_COMMAND_ARITHMETIC_ADD_ERROR = §cNur Zahlen können addiert werden
-
-SCRIPT_COMMAND_ARITHMETIC_DIV_HELP_1 = §ediv §8<§7Variable§8> §8<§7Variable§8|§7Wert§8>
-SCRIPT_COMMAND_ARITHMETIC_DIV_HELP_2 = §ediv §8<§7Variable§8> §8<§7Variable§8§8|§7Wert> §8<§7Variable§8|§7Wert§8>
-SCRIPT_COMMAND_ARITHMETIC_DIV_HELP_3 = Division zwischen den letzten beiden Variablen und schreibt es in die erste.
SCRIPT_COMMAND_ARITHMETIC_DIV_ERROR = §cNur Zahlen können dividiert werden
-
-SCRIPT_COMMAND_ARITHMETIC_MUL_HELP_1 = §emul §8<§7Variable§8> §8<§7Variable§8|§7Wert§8>
-SCRIPT_COMMAND_ARITHMETIC_MUL_HELP_2 = §emul §8<§7Variable§8> §8<§7Variable§8§8|§7Wert§8> §8<§7Variable§8|§7Wert§8>
-SCRIPT_COMMAND_ARITHMETIC_MUL_HELP_3 = Multiplikation zwischen den letzten beiden Variablen und schreibt es in die erste.
SCRIPT_COMMAND_ARITHMETIC_MUL_ERROR = §cNur Zahlen können multipliziert werden
-
-SCRIPT_COMMAND_ARITHMETIC_SUB_HELP_1 = §esub §8<§7Variable§8> §8<§7Variable§8|§7Wert§8>
-SCRIPT_COMMAND_ARITHMETIC_SUB_HELP_2 = §esub §8<§7Variable§8> §8<§7Variable§8§8|§7Wert> §8<§7Variable§8|§7Wert§8>
-SCRIPT_COMMAND_ARITHMETIC_SUB_HELP_3 = Subtraktion zwischen den letzten beiden Variablen und schreibt es in die erste.
SCRIPT_COMMAND_ARITHMETIC_SUB_ERROR = §cNur Zahlen können subtrahiert werden
+SCRIPT_COMMAND_ARITHMETIC_POW_ERROR = §cNur Zahlen können potenziert werden
+SCRIPT_COMMAND_ARITHMETIC_MOD_ERROR = §cNur ganze Zahlen können für modulo verwendet werden
+SCRIPT_COMMAND_ARITHMETIC_BIT_AND_ERROR = §cNur ganze Zahlen und booleans können für und verwendet werden
+SCRIPT_COMMAND_ARITHMETIC_BIT_OR_ERROR = §cNur ganze Zahlen und booleans können für oder verwendet werden
+SCRIPT_COMMAND_ARITHMETIC_BIT_XOR_ERROR = §cNur ganze Zahlen und booleans können für xor verwendet werden
SCRIPT_COMMAND_ARITHMETIC_OTHER_CEIL_HELP_1 = §eceil §8<§7Variable§8> §8<§7Variable§8|§7Wert§8>
SCRIPT_COMMAND_ARITHMETIC_OTHER_CEIL_HELP_2 = §eceil §8<§7Variable§8> §8<§7Variable§8|§7Wert§8> §8<§7Variable§8|§7Wert§8>
@@ -283,38 +276,10 @@ SCRIPT_COMMAND_IO_ECHOACTIONBAR_HELP_2 = §7Schreibe etwas dem Spieler in der Ac
SCRIPT_COMMAND_IO_INPUT_HELP_1 = §einput §8<§7Variable§8> §8<§7Text§8>
SCRIPT_COMMAND_IO_INPUT_HELP_2 = §7Fordere eine Eingabe von dem Spieler, welche in die Variable geschrieben wird. Der Text ist optional.
-SCRIPT_COMMAND_LOGIC_AND_HELP_1 = §eand §8<§7Variable§8> §8<§7Variable§8>
-SCRIPT_COMMAND_LOGIC_AND_HELP_2 = §eand §8<§7Variable§8> §8<§7Variable§8> §8<§7Variable§8>
-SCRIPT_COMMAND_LOGIC_AND_HELP_3 = Das logische Und zwischen den letzten beiden Variablen und schreibt es in die erste.
-
-SCRIPT_COMMAND_LOGIC_EQUAL_HELP_1 = §eequal §8<§7Variable§8> §8<§7Variable§8>
-SCRIPT_COMMAND_LOGIC_EQUAL_HELP_2 = §eequal §8<§7Variable§8> §8<§7Variable§8> §8<§7Variable§8>
-SCRIPT_COMMAND_LOGIC_EQUAL_HELP_3 = Vergleiche die letzten beiden Variablen und schreibt es in die erste.
-
-SCRIPT_COMMAND_LOGIC_GREATER_HELP_1 = §egreater §8<§7Variable§8> §8<§7Variable§8>
-SCRIPT_COMMAND_LOGIC_GREATER_HELP_2 = §egreater §8<§7Variable§8> §8<§7Variable§8> §8<§7Variable§8>
-SCRIPT_COMMAND_LOGIC_GREATER_HELP_3 = Vergleiche die letzten beiden Variablen und schreibt es in die erste.
-
-SCRIPT_COMMAND_LOGIC_LESS_HELP_1 = §eless §8<§7Variable§8> §8<§7Variable§8>
-SCRIPT_COMMAND_LOGIC_LESS_HELP_2 = §eless §8<§7Variable§8> §8<§7Variable§8> §8<§7Variable§8>
-SCRIPT_COMMAND_LOGIC_LESS_HELP_3 = Vergleiche die letzten beiden Variablen und schreibt es in die erste.
-
-SCRIPT_COMMAND_LOGIC_NOT_HELP_1 = §enot §8<§7Variable§8>
-SCRIPT_COMMAND_LOGIC_NOT_HELP_2 = §enot §8<§7Variable§8> §8<§7Variable§8>
-SCRIPT_COMMAND_LOGIC_NOT_HELP_3 = Das logische Nicht von der letzten Variable und schreibt es in die erste.
-
-SCRIPT_COMMAND_LOGIC_OR_HELP_1 = §eor §8<§7Variable§8> §8<§7Variable§8>
-SCRIPT_COMMAND_LOGIC_OR_HELP_2 = §eor §8<§7Variable§8> §8<§7Variable§8> §8<§7Variable§8>
-SCRIPT_COMMAND_LOGIC_OR_HELP_3 = Das logische Oder zwischen den letzten beiden Variablen und schreibt es in die erste.
-
SCRIPT_COMMAND_STRING_INSERT_HELP_1 = §einsert §8<§7Variable§8> §8<§7Variable§8> §8<§7Zahl§8>
SCRIPT_COMMAND_STRING_INSERT_HELP_2 = §einsert §8<§7Variable§8> §8<§7Variable§8> §8<§7Variable§8> §8<§7Zahl§8>
SCRIPT_COMMAND_STRING_INSERT_HELP_3 = Füge etwas in einen String an einer Stelle ein. Die Zahl ist für die Position und die Variable davor für was. Schreibe optional dies in eine neue oder andere Variable.
-SCRIPT_COMMAND_STRING_LENGTH_HELP_1 = §elength §8<§7Variable§8>
-SCRIPT_COMMAND_STRING_LENGTH_HELP_2 = §elength §8<§7Variable§8> §8<§7Variable§8>
-SCRIPT_COMMAND_STRING_LENGTH_HELP_3 = Ermittle die Länge eines Textes.
-
SCRIPT_COMMAND_STRING_REMOVE_HELP_1 = §eremove §8<§7Variable§8> §8<§7Von Variable§8>
SCRIPT_COMMAND_STRING_REMOVE_HELP_2 = §eremove §8<§7Variable§8> §8<§7Variable§8> §8<§7Von Variable§8>
SCRIPT_COMMAND_STRING_REMOVE_HELP_3 = Lösche eine Zeichenkette aus dem Ursprung. Dies ersetzt nicht nur die erste Stelle sondern alle.
@@ -336,9 +301,6 @@ SCRIPT_COMMAND_VARIABLE_CONVERT_HELP_2 = Konvertiere den Value zu 'number' wenn
SCRIPT_COMMAND_VARIABLE_GLOBAL_HELP_1 = §eglobal §8<§7Variable§8> §8[§7Value§8(§7s§8)§8]
SCRIPT_COMMAND_VARIABLE_GLOBAL_HELP_2 = Schreibt in eine Variable einen Wert rein, welcher eine Zahl sein kann, ein Boolscher Wert oder ein Text.
-SCRIPT_COMMAND_VARIABLE_ISSET_HELP_1 = §eisset §8<§7Variable§8> §8<§7Variable§8>
-SCRIPT_COMMAND_VARIABLE_ISSET_HELP_2 = Schreibt in eine Variable true/false rein, ob in die zweiten Variable existiert.
-
SCRIPT_COMMAND_VARIABLE_UNGLOBAL_HELP_1 = §eunglobal §8<§7Variable§8>
SCRIPT_COMMAND_VARIABLE_UNGLOBAL_HELP_2 = Lösche eine Globale variable.
@@ -348,9 +310,6 @@ SCRIPT_COMMAND_VARIABLE_UNVAR_HELP_2 = Lösche eine Locale variable.
SCRIPT_COMMAND_VARIABLE_VAR_HELP_1 = §evar §8<§7Variable§8> §8[§7Value§8(§7s§8)§8]
SCRIPT_COMMAND_VARIABLE_VAR_HELP_2 = Schreibt in eine Variable einen Wert rein, welcher eine Zahl sein kann, ein Boolscher Wert oder ein Text.
-SCRIPT_COMMAND_VARIABLE_VARTYPE_HELP_1 = §evartype §8<§7Variable§8> §8<§7Variable§8>
-SCRIPT_COMMAND_VARIABLE_VARTYPE_HELP_2 = Schreibt in eine Variable den Type der zweiten Variable rein. Wenn die zweite Variable nicht gesetzt ist wird false in die erste geschrieben. Ansonsten gibt es die Werte: 'text', 'number' und 'boolean'
-
SCRIPT_COMMAND_WORLD_GETMATERIAL_HELP_1 = §egetmaterial §8<§7Variable§8> §8<§7Zahl§8> §8<§7Zahl§8> §8<§7Zahl§8>
SCRIPT_COMMAND_WORLD_GETMATERIAL_HELP_2 = Schreibt das material von einem Block in der Welt in die Variable.
@@ -427,14 +386,28 @@ SCRIPT_GUI_CUSTOM_EVENTS_LORE_13 = §eTNTExplodeInBuild §8-§7 x, y, z
SCRIPT_GUI_CUSTOM_EVENTS_LORE_14 = §eSelfJoin §8-§7 x, y, z, playerName
SCRIPT_GUI_CUSTOM_EVENTS_LORE_15 = §eSelfLeave §8-§7 x, y, z, playerName
SCRIPT_GUI_CUSTOM_EVENTS_LORE_16 = §eDropItem §8-§7 material, x, y, z
+SCRIPT_GUI_CUSTOM_EVENTS_LORE_17 = §eEntityDeath §8-§7 entityType, x, y, z
SCRIPT_GUI_CUSTOM_EVENTS_LORE_STAR_1 = §e* §8-§7 Alles in den Klammern ist nur gesetzt, wenn die Variable davor auf §etrue§7 gesetzt ist.
SCRIPT_GUI_OTHER = §eOther
SCRIPT_GUI_OTHER_LORE_1 = §7Kommentare fangen mit §e#§7 an.
SCRIPT_GUI_OTHER_LORE_2 = §7Jump_Points fangen mit §e.§7 an.
-SCRIPT_GUI_OTHER_LORE_3 = §7Eine Variablen Namen in '<>' eingeschlossen wird ersetzt, bis zu zwei mal.
-SCRIPT_GUI_OTHER_LORE_4 = §7Eine Variable in '<>' kann mit 'const.' oder 'local.' oder 'global.' prefixed werden für den genauen type wo nach geguckt werden soll.
-SCRIPT_GUI_OTHER_LORE_5 = §7Wenn man nach dem namen noch ein '.type' schreibt wird direkt der Type der Variable ausgegeben.
+SCRIPT_GUI_OTHER_LORE_3 = §7Einen Variablennamen, der in '§e{}§7' eingeschlossen ist wird durch seinen Wert ersetzt. Eine Variable kann mit den Präfixen '§econst.§7' oder '§elocal.§7' oder '§eglobal.§7' versehen werden.
+SCRIPT_GUI_OTHER_LORE_4 = §7Dabei gilt:
+SCRIPT_GUI_OTHER_LORE_5 = §7- Lokalevariablen sind nur in dem Script-Buch verfügbar.
+SCRIPT_GUI_OTHER_LORE_6 = §7- Gloablevariablen sind in jedem Script-Buch verfügbar.
+SCRIPT_GUI_OTHER_LORE_7 = §7- Konstantevariablen sind Variablen vom Server (z.B. Spielername, TPS usw.)
+SCRIPT_GUI_OTHER_LORE_8 = §7Eine Variable kann mit den Appendixen '§e.length§7' oder '§e.type§7' oder '§e.isset§7' versehen werden.
+SCRIPT_GUI_OTHER_LORE_9 = §7Dabei gilt:
+SCRIPT_GUI_OTHER_LORE_10 = §7- Length gibt die Länge der variable als Zahl zurück.
+SCRIPT_GUI_OTHER_LORE_11 = §7- Type gibt den typen (number, floating number, text oder boolean) als Text zurück.
+SCRIPT_GUI_OTHER_LORE_12 = §7- Isset gibt als boolean zurück, ob die Variable existiert.
+SCRIPT_GUI_OTHER_LORE_13 = §7Mathematische sowie logische Operationsvorgänge können in '§e{}§7' angegeben werden.
+SCRIPT_GUI_OTHER_LORE_14 = §7Dabei gilt:
+SCRIPT_GUI_OTHER_LORE_15 = §7- Rechenoperatoren: §e+ * - /§7 sowie §e%§7 für Modulo
+SCRIPT_GUI_OTHER_LORE_16 = §7- Logische Operatoren: §e==§7; §e!=§7; §e<=§7; §e>=§7; §e<§7; §e>§7; §e&&§7; §e||§7 (Dies ist das Zeichen für oder)
+SCRIPT_GUI_OTHER_LORE_17 = §7- Bitweise Operatoren: §e&§7; §e|§7; §e^
+SCRIPT_GUI_OTHER_LORE_18 = §7- Shift Operatoren: §e<<§7; §e>>§7; §e>>>§7
SCRIPT_GUI_COMMAND_NAME = §7Command: §e{0}
@@ -451,7 +424,7 @@ SCRIPT_GUI_CONSTANT_AUTO_TRACE_LORE = §etrue§7 wenn gerade der AutoTracer an i
SCRIPT_GUI_CONSTANT_TNT_NAME = §7Constant §etnt
SCRIPT_GUI_CONSTANT_TNT_LORE = §etrue§7 wenn TNT nicht ausgeschaltet ist.
-SCRIPT_GUI_CONSTANT_ONLY_TB_NAME = §7Constant §etnt-onlytb
+SCRIPT_GUI_CONSTANT_ONLY_TB_NAME = §7Constant §etnt_onlytb
SCRIPT_GUI_CONSTANT_ONLY_TB_LORE = §etrue§7 wenn TNT Nur Testblock an ist.
SCRIPT_GUI_CONSTANT_FREEZE_NAME = §7Constant §efreeze
@@ -496,9 +469,15 @@ SCRIPT_GUI_CONSTANT_SLOT_MATERIAL_DISPLAY_LORE = §eName§7 des Items im Slot
SCRIPT_GUI_CONSTANT_OFF_HAND_MATERIAL_DISPLAY_NAME = §7Constant §eoffmaterialname
SCRIPT_GUI_CONSTANT_OFF_HAND_MATERIAL_DISPLAY_LORE = §eName§7 des Items in der Off Hand
-SCRIPT_GUI_CONSTANT_REGION_TYPE_NAME = §7Constant §eregion-type
+SCRIPT_GUI_CONSTANT_REGION_TYPE_NAME = §7Constant §eregion_type
SCRIPT_GUI_CONSTANT_REGION_TYPE_LORE = §eRegionstype§7 der jetztigen Region
+SCRIPT_GUI_CONSTANT_TPS_NAME = §7Constant §etps
+SCRIPT_GUI_CONSTANT_TPS_LORE = §etps§7 vom Server
+
+SCRIPT_GUI_CONSTANT_TPS_LIMIT_NAME = §7Constant §etps_limit
+SCRIPT_GUI_CONSTANT_TPS_LIMIT_LORE = §etps_limit§7 vom Server
+
# Unsign Book
UNSIGN_HELP=§8/§eunsign §8- §7Mache ein Buch beschreibbar
diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/OrientableAttribute.java b/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/OrientableAttribute.java
index d11e6558..e70d8ab3 100644
--- a/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/OrientableAttribute.java
+++ b/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/OrientableAttribute.java
@@ -20,7 +20,6 @@
package de.steamwar.bausystem.features.attributescopy.impl;
import de.steamwar.bausystem.features.attributescopy.BlockAttribute;
-import de.steamwar.bausystem.features.script.command.logic.Or;
import de.steamwar.linkage.Linked;
import org.bukkit.Axis;
import org.bukkit.block.data.Orientable;
diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/script/EventType.java b/BauSystem_Main/src/de/steamwar/bausystem/features/script/EventType.java
index 5aad2069..73d2f19e 100644
--- a/BauSystem_Main/src/de/steamwar/bausystem/features/script/EventType.java
+++ b/BauSystem_Main/src/de/steamwar/bausystem/features/script/EventType.java
@@ -25,6 +25,7 @@ import org.bukkit.Location;
import org.bukkit.event.Event;
import org.bukkit.event.block.BlockBreakEvent;
import org.bukkit.event.block.BlockPlaceEvent;
+import org.bukkit.event.entity.EntityDeathEvent;
import org.bukkit.event.entity.EntityExplodeEvent;
import org.bukkit.event.entity.EntitySpawnEvent;
import org.bukkit.event.player.*;
@@ -98,7 +99,14 @@ public enum EventType {
valueMap.put("material", new Value.StringValue(event.getItemDrop().getItemStack().getType().name()));
addXYZ(valueMap, event.getItemDrop().getLocation());
return valueMap;
- });
+ }),
+ EntityDeath(EntityDeathEvent.class, event -> {
+ Map valueMap = new HashMap<>();
+ valueMap.put("entityType", new Value.StringValue(event.getEntityType().name()));
+ addXYZ(valueMap, event.getEntity().getLocation());
+ return valueMap;
+ }),
+ ;
private static void addXYZ(Map valueMap, Location location) {
valueMap.put("x", new Value.DoubleValue(location.getX()));
diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/script/ScriptCommand.java b/BauSystem_Main/src/de/steamwar/bausystem/features/script/ScriptCommand.java
index 1d19575f..13cc741c 100644
--- a/BauSystem_Main/src/de/steamwar/bausystem/features/script/ScriptCommand.java
+++ b/BauSystem_Main/src/de/steamwar/bausystem/features/script/ScriptCommand.java
@@ -38,11 +38,11 @@ public class ScriptCommand extends SWCommand {
List> swItems = new ArrayList<>();
addEmptyItems(swItems, 3);
swItems.add(new SWListInv.SWListEntry<>(createItem(p, Material.BOOK, "SCRIPT_GUI_CUSTOM_COMMANDS", loreBuilder(p, "SCRIPT_GUI_CUSTOM_COMMANDS_LORE_1", "SCRIPT_GUI_CUSTOM_COMMANDS_LORE_2")), null));
- swItems.add(new SWListInv.SWListEntry<>(createItem(p, Material.BOOK, "SCRIPT_GUI_CUSTOM_EVENTS", loreBuilder(p, "SCRIPT_GUI_CUSTOM_EVENTS_LORE_1", "SCRIPT_GUI_CUSTOM_EVENTS_LORE_2", "SCRIPT_GUI_CUSTOM_EVENTS_LORE_3", "SCRIPT_GUI_CUSTOM_EVENTS_LORE_4", "SCRIPT_GUI_CUSTOM_EVENTS_LORE_5", "SCRIPT_GUI_CUSTOM_EVENTS_LORE_6", "SCRIPT_GUI_CUSTOM_EVENTS_LORE_7", "SCRIPT_GUI_CUSTOM_EVENTS_LORE_8", "SCRIPT_GUI_CUSTOM_EVENTS_LORE_9", "SCRIPT_GUI_CUSTOM_EVENTS_LORE_10", "SCRIPT_GUI_CUSTOM_EVENTS_LORE_11", "SCRIPT_GUI_CUSTOM_EVENTS_LORE_12", "SCRIPT_GUI_CUSTOM_EVENTS_LORE_13", "SCRIPT_GUI_CUSTOM_EVENTS_LORE_14", "SCRIPT_GUI_CUSTOM_EVENTS_LORE_15", "SCRIPT_GUI_CUSTOM_EVENTS_LORE_16", "SCRIPT_GUI_CUSTOM_EVENTS_LORE_STAR_1")), null));
- swItems.add(new SWListInv.SWListEntry<>(createItem(p, Material.BOOK, "SCRIPT_GUI_OTHER", loreBuilder(p, "SCRIPT_GUI_OTHER_LORE_1", "SCRIPT_GUI_OTHER_LORE_2", "SCRIPT_GUI_OTHER_LORE_3", "SCRIPT_GUI_OTHER_LORE_4", "SCRIPT_GUI_OTHER_LORE_5")), null));
+ swItems.add(new SWListInv.SWListEntry<>(createItem(p, Material.BOOK, "SCRIPT_GUI_CUSTOM_EVENTS", loreBuilder(p, "SCRIPT_GUI_CUSTOM_EVENTS_LORE_1", "SCRIPT_GUI_CUSTOM_EVENTS_LORE_2", "SCRIPT_GUI_CUSTOM_EVENTS_LORE_3", "SCRIPT_GUI_CUSTOM_EVENTS_LORE_4", "SCRIPT_GUI_CUSTOM_EVENTS_LORE_5", "SCRIPT_GUI_CUSTOM_EVENTS_LORE_6", "SCRIPT_GUI_CUSTOM_EVENTS_LORE_7", "SCRIPT_GUI_CUSTOM_EVENTS_LORE_8", "SCRIPT_GUI_CUSTOM_EVENTS_LORE_9", "SCRIPT_GUI_CUSTOM_EVENTS_LORE_10", "SCRIPT_GUI_CUSTOM_EVENTS_LORE_11", "SCRIPT_GUI_CUSTOM_EVENTS_LORE_12", "SCRIPT_GUI_CUSTOM_EVENTS_LORE_13", "SCRIPT_GUI_CUSTOM_EVENTS_LORE_14", "SCRIPT_GUI_CUSTOM_EVENTS_LORE_15", "SCRIPT_GUI_CUSTOM_EVENTS_LORE_16", "SCRIPT_GUI_CUSTOM_EVENTS_LORE_17", "SCRIPT_GUI_CUSTOM_EVENTS_LORE_STAR_1")), null));
+ swItems.add(new SWListInv.SWListEntry<>(createItem(p, Material.BOOK, "SCRIPT_GUI_OTHER", loreBuilder(p, "SCRIPT_GUI_OTHER_LORE_1", "SCRIPT_GUI_OTHER_LORE_2", "SCRIPT_GUI_OTHER_LORE_3", "SCRIPT_GUI_OTHER_LORE_4", "SCRIPT_GUI_OTHER_LORE_5", "SCRIPT_GUI_OTHER_LORE_6", "SCRIPT_GUI_OTHER_LORE_7", "SCRIPT_GUI_OTHER_LORE_8", "SCRIPT_GUI_OTHER_LORE_9", "SCRIPT_GUI_OTHER_LORE_10", "SCRIPT_GUI_OTHER_LORE_11", "SCRIPT_GUI_OTHER_LORE_12", "SCRIPT_GUI_OTHER_LORE_13", "SCRIPT_GUI_OTHER_LORE_14", "SCRIPT_GUI_OTHER_LORE_15", "SCRIPT_GUI_OTHER_LORE_16", "SCRIPT_GUI_OTHER_LORE_17", "SCRIPT_GUI_OTHER_LORE_18")), null));
addEmptyItems(swItems, 3);
addCustomScriptsItems(swItems, p);
- addEmptyItems(swItems, 44 + 4);
+ addEmptyItems(swItems, 16);
swItems.add(new SWListInv.SWListEntry<>(createItem(p, Material.BOOK, "SCRIPT_GUI_CUSTOM_VARIABLES", new ArrayList<>()), null));
addEmptyItems(swItems, 4);
addConstantItem(swItems, p, Material.TNT_MINECART, "SCRIPT_GUI_CONSTANT_TRACE_NAME", "SCRIPT_GUI_CONSTANT_TRACE_LORE", false);
@@ -64,7 +64,9 @@ public class ScriptCommand extends SWCommand {
addConstantItem(swItems, p, Material.BIRCH_SIGN, "SCRIPT_GUI_CONSTANT_SLOT_MATERIAL_DISPLAY_NAME", "SCRIPT_GUI_CONSTANT_SLOT_MATERIAL_DISPLAY_LORE", false);
addConstantItem(swItems, p, Material.ACACIA_SIGN, "SCRIPT_GUI_CONSTANT_OFF_HAND_MATERIAL_DISPLAY_NAME", "SCRIPT_GUI_CONSTANT_OFF_HAND_MATERIAL_DISPLAY_LORE", false);
addConstantItem(swItems, p, Material.MAP, "SCRIPT_GUI_CONSTANT_REGION_TYPE_NAME", "SCRIPT_GUI_CONSTANT_REGION_TYPE_LORE", false);
- addEmptyItems(swItems, 2 * 9 - 2);
+ addConstantItem(swItems, p, Material.COMPASS, "SCRIPT_GUI_CONSTANT_TPS_NAME", "SCRIPT_GUI_CONSTANT_TPS_LORE", false);
+ addConstantItem(swItems, p, Material.COMPASS, "SCRIPT_GUI_CONSTANT_TPS_LIMIT_NAME", "SCRIPT_GUI_CONSTANT_TPS_LIMIT_LORE", false);
+ addEmptyItems(swItems, 2 * 9 - 3);
SWListInv swListInv = new SWListInv<>(p, BauSystem.MESSAGE.parse("SCRIPT_GUI_NAME", p), swItems, (clickType, o) -> {
if (o != null) {
diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/script/ScriptEventListener.java b/BauSystem_Main/src/de/steamwar/bausystem/features/script/ScriptEventListener.java
index c0852437..57e39d70 100644
--- a/BauSystem_Main/src/de/steamwar/bausystem/features/script/ScriptEventListener.java
+++ b/BauSystem_Main/src/de/steamwar/bausystem/features/script/ScriptEventListener.java
@@ -33,6 +33,7 @@ import org.bukkit.event.Listener;
import org.bukkit.event.block.Action;
import org.bukkit.event.block.BlockBreakEvent;
import org.bukkit.event.block.BlockPlaceEvent;
+import org.bukkit.event.entity.EntityDeathEvent;
import org.bukkit.event.entity.EntityExplodeEvent;
import org.bukkit.event.entity.EntitySpawnEvent;
import org.bukkit.event.player.*;
@@ -133,4 +134,11 @@ public class ScriptEventListener implements Listener {
ignore.add(event.getPlayer());
customScriptManager.callEvent(EventType.DropItem, event.getPlayer(), event);
}
+
+ @EventHandler
+ public void onEntityDeath(EntityDeathEvent event) {
+ for (Player player : Bukkit.getOnlinePlayers()) {
+ customScriptManager.callEvent(EventType.EntityDeath, player, event);
+ }
+ }
}
diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/script/ScriptExecutor.java b/BauSystem_Main/src/de/steamwar/bausystem/features/script/ScriptExecutor.java
index 5e7239a5..1ce3c6eb 100644
--- a/BauSystem_Main/src/de/steamwar/bausystem/features/script/ScriptExecutor.java
+++ b/BauSystem_Main/src/de/steamwar/bausystem/features/script/ScriptExecutor.java
@@ -1,10 +1,22 @@
package de.steamwar.bausystem.features.script;
+import com.sk89q.worldedit.EditSession;
+import com.sk89q.worldedit.WorldEdit;
+import com.sk89q.worldedit.bukkit.BukkitAdapter;
+import com.sk89q.worldedit.event.platform.CommandEvent;
+import com.sk89q.worldedit.extension.platform.Actor;
+import com.sk89q.worldedit.function.operation.Operations;
+import com.sk89q.worldedit.session.SessionKey;
import de.steamwar.bausystem.BauSystem;
+import de.steamwar.bausystem.features.script.expression.Expression;
+import de.steamwar.bausystem.features.script.expression.UnknownOperatorException;
+import de.steamwar.bausystem.features.script.expression.VarNotFoundException;
import de.steamwar.bausystem.features.script.variables.Constants;
import de.steamwar.bausystem.features.script.variables.Context;
import de.steamwar.bausystem.features.script.variables.Value;
+import de.steamwar.bausystem.features.world.WorldEditListener;
import de.steamwar.bausystem.linkage.LinkageUtils;
+import de.steamwar.bausystem.utils.WorldEditUtils;
import lombok.Getter;
import lombok.Setter;
import org.bukkit.Bukkit;
@@ -23,6 +35,8 @@ public final class ScriptExecutor {
LinkageUtils.linkScriptCommands();
}
+ private static final boolean hasFAWE = Bukkit.getPluginManager().getPlugin("FastAsyncWorldEdit") != null;
+
private String specialCommand = null;
@Getter
@@ -123,7 +137,7 @@ public final class ScriptExecutor {
return;
}
- String[] strings = replaceVariables(command);
+ String[] strings = replaceExpressions(command);
if (strings.length == 0) {
return;
}
@@ -154,12 +168,22 @@ public final class ScriptExecutor {
command = String.join(" ", strings);
Bukkit.getLogger().log(Level.INFO, player.getName() + " dispatched command: " + command);
- Bukkit.getServer().dispatchCommand(player, command);
+ if (hasFAWE && WorldEditListener.isWorldEditCommand("/" + strings[0])) {
+ EditSession editSession = WorldEditUtils.getEditSession(player.getWorld());
+ WorldEditUtils.addToPlayer(player, editSession);
+ Actor actor = BukkitAdapter.adapt(player);
+ WorldEdit.getInstance().getPlatformManager().getPlatformCommandManager().handleCommandOnCurrentThread(new CommandEvent(actor, command, editSession));
+ editSession.close();
+ WorldEdit.getInstance().flushBlockBag(actor, editSession);
+ } else {
+ Bukkit.getServer().dispatchCommand(player, command);
+ }
}
}
- private String[] replaceVariables(String s) {
+ private String[] replaceExpressions(String s) {
s = s.replaceAll(" +", " ");
+ // TODO: Remove this code as the Expression System below will replace it!
Set variables = new HashSet<>(localVariables.allVariables());
variables.addAll(Constants.allVariables());
variables.addAll(globalVariables.allVariables());
@@ -182,28 +206,49 @@ public final class ScriptExecutor {
s = s.replace("", globalVariables.getValue(globalVariable).type());
}
}
- return s.split(" ");
- }
- public Value parse(String varValue) {
- try {
- return new Value.LongValue(Long.parseLong(varValue));
- } catch (NumberFormatException ne) {
- try {
- return new Value.DoubleValue(Double.parseDouble(varValue));
- } catch (NumberFormatException e) {
- if (varValue.equalsIgnoreCase("true") || varValue.equalsIgnoreCase("false")) {
- return new Value.BooleanValue(varValue.equalsIgnoreCase("true"));
- } else {
- return new Value.StringValue(varValue);
+ StringBuilder result = new StringBuilder();
+ int depth = 0;
+ StringBuilder st = new StringBuilder();
+ for (int i = 0; i < s.length(); i++) {
+ char c = s.charAt(i);
+ if (c == '{') {
+ st.append(c);
+ depth++;
+ } else if (c == '}') {
+ st.append(c);
+ depth--;
+ if (depth == 0) {
+ try {
+ Expression expression = new Expression(player, st.toString(), this);
+ result.append(expression.eval().asString());
+ st = new StringBuilder();
+ } catch (IllegalArgumentException e) {
+ BauSystem.MESSAGE.send(e.getMessage(), player);
+ return new String[0];
+ } catch (VarNotFoundException e) {
+ BauSystem.MESSAGE.send("SCRIPT_COMMAND_ERROR_UNKNOWN_VAR", player, e.getMessage());
+ return new String[0];
+ } catch (IndexOutOfBoundsException e) {
+ BauSystem.MESSAGE.send("SCRIPT_COMMAND_ERROR_EXPRESSION", player, st.toString());
+ return new String[0];
+ } catch (UnknownOperatorException e) {
+ BauSystem.MESSAGE.send("SCRIPT_COMMAND_ERROR_UNKNOWN_OPERATION", player, e.getMessage());
+ return new String[0];
+ }
}
+ } else if (st.length() > 0) {
+ st.append(c);
+ } else {
+ result.append(c);
}
}
+ return result.toString().split(" ");
}
public Value getOrItselfValue(String variable) {
if (!isVariable(variable)) {
- return parse(variable);
+ return Value.parse(variable);
}
if (Constants.isConstant(variable)) {
@@ -215,6 +260,19 @@ public final class ScriptExecutor {
return localVariables.getValue(variable);
}
+ public Value getValueOrNull(String variable) {
+ if (Constants.isConstant(variable)) {
+ return Constants.getConstant(variable, player);
+ }
+ if (globalVariables.hasValue(variable)) {
+ return globalVariables.getValue(variable);
+ }
+ if (localVariables.hasValue(variable)) {
+ return localVariables.getValue(variable);
+ }
+ return null;
+ }
+
public String getOrItself(String variable) {
if (isVariable(variable)) {
return getValue(variable);
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 b61189fe..04fcea0b 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
@@ -32,43 +32,24 @@ public class If implements SpecialCommand {
@Override
public boolean execute(String[] command, ScriptExecutor scriptExecutor) {
- if (command.length <= 1) {
+ if (command.length < 1) {
BauSystem.MESSAGE.send("SCRIPT_COMMAND_ERROR_FIRST_ARG_NOVAR_OR_VALUE", scriptExecutor.getPlayer());
return true;
}
- if (command.length <= 2) {
- BauSystem.MESSAGE.send("SCRIPT_COMMAND_ERROR_SECOND_ARG_NOVAR_OR_VALUE", scriptExecutor.getPlayer());
- return true;
- }
- if (command.length <= 3) {
- BauSystem.MESSAGE.send("SCRIPT_COMMAND_ERROR_THIRD_ARG_NOJUMPPOINT", scriptExecutor.getPlayer());
+ if (command.length < 2) {
+ BauSystem.MESSAGE.send("SCRIPT_COMMAND_ERROR_SECOND_ARG_NOJUMPPOINT", scriptExecutor.getPlayer());
return true;
}
- if (command[2].equals("exists")) {
- if (scriptExecutor.isVariable(command[1])) {
- jumpToIndex(scriptExecutor, command[3]);
- } else {
- if (command.length > 4) {
- jumpToIndex(scriptExecutor, command[4]);
- }
- }
- return true;
+ Value v = scriptExecutor.getOrItselfValue(command[1]);
+ if (!(v instanceof Value.BooleanValue)) {
+ BauSystem.MESSAGE.send("SCRIPT_COMMAND_ERROR_NO_BOOLEAN", scriptExecutor.getPlayer());
+ return false;
}
-
- Value v1 = scriptExecutor.getOrItselfValue(command[1]);
- Value v2 = scriptExecutor.getOrItselfValue(command[2]);
- if (v1.getClass() != v2.getClass()) {
- // This is intended
- if (command.length > 4) {
- jumpToIndex(scriptExecutor, command[4]);
- }
- return true;
- }
- if (v1.asString().equals(v2.asString())) {
+ if (v.asBoolean()) {
+ jumpToIndex(scriptExecutor, command[2]);
+ } else if (command.length > 3) {
jumpToIndex(scriptExecutor, command[3]);
- } else if (command.length > 4) {
- jumpToIndex(scriptExecutor, command[4]);
}
return true;
}
diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/arithmetic/Add.java b/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/arithmetic/Add.java
deleted file mode 100644
index 75006f6d..00000000
--- a/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/arithmetic/Add.java
+++ /dev/null
@@ -1,62 +0,0 @@
-package de.steamwar.bausystem.features.script.command.arithmetic;
-
-import de.steamwar.bausystem.BauSystem;
-import de.steamwar.bausystem.features.script.ScriptExecutor;
-import de.steamwar.bausystem.features.script.SpecialCommand;
-import de.steamwar.bausystem.features.script.variables.Value;
-import de.steamwar.linkage.Linked;
-import org.bukkit.Material;
-
-@Linked
-public class Add implements SpecialCommand {
-
- @Override
- public String[] description() {
- return new String[]{
- "SCRIPT_COMMAND_ARITHMETIC_ADD_HELP_1",
- "SCRIPT_COMMAND_ARITHMETIC_ADD_HELP_2",
- "",
- "SCRIPT_COMMAND_ARITHMETIC_ADD_HELP_3"
- };
- }
-
- @Override
- public Material material() {
- return Material.REDSTONE;
- }
-
- @Override
- public String command() {
- return "add";
- }
-
- @Override
- public boolean execute(String[] command, ScriptExecutor scriptExecutor) {
- if (command.length <= 1) {
- BauSystem.MESSAGE.send("SCRIPT_COMMAND_ERROR_FIRST_ARG_NOVAR", scriptExecutor.getPlayer());
- return true;
- }
- if (command.length <= 2) {
- BauSystem.MESSAGE.send("SCRIPT_COMMAND_ERROR_SECOND_ARG_NOVAR", scriptExecutor.getPlayer());
- return true;
- }
-
- Value v1 = scriptExecutor.getOrItselfValue(command[command.length - 2]);
- Value v2 = scriptExecutor.getOrItselfValue(command[command.length - 1]);
- if (!(v1 instanceof Value.LongValue) && !(v1 instanceof Value.DoubleValue)) {
- BauSystem.MESSAGE.send("SCRIPT_COMMAND_ARITHMETIC_ADD_ERROR", scriptExecutor.getPlayer());
- return true;
- }
- if (!(v2 instanceof Value.LongValue) && !(v2 instanceof Value.DoubleValue)) {
- BauSystem.MESSAGE.send("SCRIPT_COMMAND_ARITHMETIC_ADD_ERROR", scriptExecutor.getPlayer());
- return true;
- }
-
- if (v1 instanceof Value.DoubleValue || v2 instanceof Value.DoubleValue) {
- scriptExecutor.getLocalVariables().putValue(command[1], new Value.DoubleValue(v1.asDouble() + v2.asDouble()));
- } else {
- scriptExecutor.getLocalVariables().putValue(command[1], new Value.LongValue(v1.asLong() + v2.asLong()));
- }
- return true;
- }
-}
diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/arithmetic/Div.java b/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/arithmetic/Div.java
deleted file mode 100644
index f50b4e34..00000000
--- a/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/arithmetic/Div.java
+++ /dev/null
@@ -1,62 +0,0 @@
-package de.steamwar.bausystem.features.script.command.arithmetic;
-
-import de.steamwar.bausystem.BauSystem;
-import de.steamwar.bausystem.features.script.ScriptExecutor;
-import de.steamwar.bausystem.features.script.SpecialCommand;
-import de.steamwar.bausystem.features.script.variables.Value;
-import de.steamwar.linkage.Linked;
-import org.bukkit.Material;
-
-@Linked
-public class Div implements SpecialCommand {
-
- @Override
- public String[] description() {
- return new String[]{
- "SCRIPT_COMMAND_ARITHMETIC_DIV_HELP_1",
- "SCRIPT_COMMAND_ARITHMETIC_DIV_HELP_2",
- "",
- "SCRIPT_COMMAND_ARITHMETIC_DIV_HELP_3"
- };
- }
-
- @Override
- public Material material() {
- return Material.REDSTONE;
- }
-
- @Override
- public String command() {
- return "div";
- }
-
- @Override
- public boolean execute(String[] command, ScriptExecutor scriptExecutor) {
- if (command.length <= 1) {
- BauSystem.MESSAGE.send("SCRIPT_COMMAND_ERROR_FIRST_ARG_NOVAR", scriptExecutor.getPlayer());
- return true;
- }
- if (command.length <= 2) {
- BauSystem.MESSAGE.send("SCRIPT_COMMAND_ERROR_SECOND_ARG_NOVAR", scriptExecutor.getPlayer());
- return true;
- }
-
- Value v1 = scriptExecutor.getOrItselfValue(command[command.length - 2]);
- Value v2 = scriptExecutor.getOrItselfValue(command[command.length - 1]);
- if (!(v1 instanceof Value.LongValue) && !(v1 instanceof Value.DoubleValue)) {
- BauSystem.MESSAGE.send("SCRIPT_COMMAND_ARITHMETIC_DIV_ERROR", scriptExecutor.getPlayer());
- return true;
- }
- if (!(v2 instanceof Value.LongValue) && !(v2 instanceof Value.DoubleValue)) {
- BauSystem.MESSAGE.send("SCRIPT_COMMAND_ARITHMETIC_DIV_ERROR", scriptExecutor.getPlayer());
- return true;
- }
-
- if (v1 instanceof Value.DoubleValue || v2 instanceof Value.DoubleValue) {
- scriptExecutor.getLocalVariables().putValue(command[1], new Value.DoubleValue(v1.asDouble() / v2.asDouble()));
- } else {
- scriptExecutor.getLocalVariables().putValue(command[1], new Value.LongValue(v1.asLong() / v2.asLong()));
- }
- return true;
- }
-}
diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/arithmetic/Mul.java b/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/arithmetic/Mul.java
deleted file mode 100644
index cce89be9..00000000
--- a/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/arithmetic/Mul.java
+++ /dev/null
@@ -1,62 +0,0 @@
-package de.steamwar.bausystem.features.script.command.arithmetic;
-
-import de.steamwar.bausystem.BauSystem;
-import de.steamwar.bausystem.features.script.ScriptExecutor;
-import de.steamwar.bausystem.features.script.SpecialCommand;
-import de.steamwar.bausystem.features.script.variables.Value;
-import de.steamwar.linkage.Linked;
-import org.bukkit.Material;
-
-@Linked
-public class Mul implements SpecialCommand {
-
- @Override
- public String[] description() {
- return new String[]{
- "SCRIPT_COMMAND_ARITHMETIC_MUL_HELP_1",
- "SCRIPT_COMMAND_ARITHMETIC_MUL_HELP_2",
- "",
- "SCRIPT_COMMAND_ARITHMETIC_MUL_HELP_3"
- };
- }
-
- @Override
- public Material material() {
- return Material.REDSTONE;
- }
-
- @Override
- public String command() {
- return "mul";
- }
-
- @Override
- public boolean execute(String[] command, ScriptExecutor scriptExecutor) {
- if (command.length <= 1) {
- BauSystem.MESSAGE.send("SCRIPT_COMMAND_ERROR_FIRST_ARG_NOVAR", scriptExecutor.getPlayer());
- return true;
- }
- if (command.length <= 2) {
- BauSystem.MESSAGE.send("SCRIPT_COMMAND_ERROR_SECOND_ARG_NOVAR", scriptExecutor.getPlayer());
- return true;
- }
-
- Value v1 = scriptExecutor.getOrItselfValue(command[command.length - 2]);
- Value v2 = scriptExecutor.getOrItselfValue(command[command.length - 1]);
- if (!(v1 instanceof Value.LongValue) && !(v1 instanceof Value.DoubleValue)) {
- BauSystem.MESSAGE.send("SCRIPT_COMMAND_ARITHMETIC_MUL_ERROR", scriptExecutor.getPlayer());
- return true;
- }
- if (!(v2 instanceof Value.LongValue) && !(v2 instanceof Value.DoubleValue)) {
- BauSystem.MESSAGE.send("SCRIPT_COMMAND_ARITHMETIC_MUL_ERROR", scriptExecutor.getPlayer());
- return true;
- }
-
- if (v1 instanceof Value.DoubleValue || v2 instanceof Value.DoubleValue) {
- scriptExecutor.getLocalVariables().putValue(command[1], new Value.DoubleValue(v1.asDouble() * v2.asDouble()));
- } else {
- scriptExecutor.getLocalVariables().putValue(command[1], new Value.LongValue(v1.asLong() * v2.asLong()));
- }
- return true;
- }
-}
diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/arithmetic/Sub.java b/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/arithmetic/Sub.java
deleted file mode 100644
index 00d6e694..00000000
--- a/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/arithmetic/Sub.java
+++ /dev/null
@@ -1,62 +0,0 @@
-package de.steamwar.bausystem.features.script.command.arithmetic;
-
-import de.steamwar.bausystem.BauSystem;
-import de.steamwar.bausystem.features.script.ScriptExecutor;
-import de.steamwar.bausystem.features.script.SpecialCommand;
-import de.steamwar.bausystem.features.script.variables.Value;
-import de.steamwar.linkage.Linked;
-import org.bukkit.Material;
-
-@Linked
-public class Sub implements SpecialCommand {
-
- @Override
- public String[] description() {
- return new String[]{
- "SCRIPT_COMMAND_ARITHMETIC_SUB_HELP_1",
- "SCRIPT_COMMAND_ARITHMETIC_SUB_HELP_2",
- "",
- "SCRIPT_COMMAND_ARITHMETIC_SUB_HELP_3"
- };
- }
-
- @Override
- public Material material() {
- return Material.REDSTONE;
- }
-
- @Override
- public String command() {
- return "sub";
- }
-
- @Override
- public boolean execute(String[] command, ScriptExecutor scriptExecutor) {
- if (command.length <= 1) {
- BauSystem.MESSAGE.send("SCRIPT_COMMAND_ERROR_FIRST_ARG_NOVAR", scriptExecutor.getPlayer());
- return true;
- }
- if (command.length <= 2) {
- BauSystem.MESSAGE.send("SCRIPT_COMMAND_ERROR_SECOND_ARG_NOVAR", scriptExecutor.getPlayer());
- return true;
- }
-
- Value v1 = scriptExecutor.getOrItselfValue(command[command.length - 2]);
- Value v2 = scriptExecutor.getOrItselfValue(command[command.length - 1]);
- if (!(v1 instanceof Value.LongValue) && !(v1 instanceof Value.DoubleValue)) {
- BauSystem.MESSAGE.send("SCRIPT_COMMAND_ARITHMETIC_SUB_ERROR", scriptExecutor.getPlayer());
- return true;
- }
- if (!(v2 instanceof Value.LongValue) && !(v2 instanceof Value.DoubleValue)) {
- BauSystem.MESSAGE.send("SCRIPT_COMMAND_ARITHMETIC_SUB_ERROR", scriptExecutor.getPlayer());
- return true;
- }
-
- if (v1 instanceof Value.DoubleValue || v2 instanceof Value.DoubleValue) {
- scriptExecutor.getLocalVariables().putValue(command[1], new Value.DoubleValue(v1.asDouble() - v2.asDouble()));
- } else {
- scriptExecutor.getLocalVariables().putValue(command[1], new Value.LongValue(v1.asLong() - v2.asLong()));
- }
- return true;
- }
-}
diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/logic/And.java b/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/logic/And.java
deleted file mode 100644
index 7f0ea700..00000000
--- a/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/logic/And.java
+++ /dev/null
@@ -1,64 +0,0 @@
-package de.steamwar.bausystem.features.script.command.logic;
-
-import de.steamwar.bausystem.BauSystem;
-import de.steamwar.bausystem.features.script.ScriptExecutor;
-import de.steamwar.bausystem.features.script.SpecialCommand;
-import de.steamwar.bausystem.features.script.variables.Value;
-import de.steamwar.linkage.Linked;
-import org.bukkit.Material;
-
-@Linked
-public class And implements SpecialCommand {
-
- @Override
- public String[] description() {
- return new String[]{
- "SCRIPT_COMMAND_LOGIC_AND_HELP_1",
- "SCRIPT_COMMAND_LOGIC_AND_HELP_2",
- "",
- "SCRIPT_COMMAND_LOGIC_AND_HELP_3"
- };
- }
-
- @Override
- public Material material() {
- return Material.COMPARATOR;
- }
-
- @Override
- public String command() {
- return "and";
- }
-
- @Override
- public boolean execute(String[] command, ScriptExecutor scriptExecutor) {
- if (command.length <= 1) {
- BauSystem.MESSAGE.send("SCRIPT_COMMAND_ERROR_FIRST_ARG_NOVAR", scriptExecutor.getPlayer());
- return true;
- }
- if (command.length <= 2) {
- BauSystem.MESSAGE.send("SCRIPT_COMMAND_ERROR_SECOND_ARG_NOVAR", scriptExecutor.getPlayer());
- return true;
- }
-
- Value v1 = scriptExecutor.getOrItselfValue(command[command.length - 2]);
- Value v2 = scriptExecutor.getOrItselfValue(command[command.length - 1]);
- if (!(v1 instanceof Value.BooleanValue)) {
- BauSystem.MESSAGE.send("SCRIPT_COMMAND_ERROR_BOOLEAN_COMPARE", scriptExecutor.getPlayer());
- return true;
- }
- if (!(v2 instanceof Value.BooleanValue)) {
- BauSystem.MESSAGE.send("SCRIPT_COMMAND_ERROR_BOOLEAN_COMPARE", scriptExecutor.getPlayer());
- return true;
- }
- Value result;
- if (v1.asBoolean() && v2.asBoolean()) {
- result = new Value.BooleanValue(true);
- } else {
- result = new Value.BooleanValue(false);
- }
-
- scriptExecutor.getLocalVariables().putValue(command[1], result);
- return true;
- }
-}
diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/logic/Equal.java b/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/logic/Equal.java
deleted file mode 100644
index 9ac6d6b1..00000000
--- a/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/logic/Equal.java
+++ /dev/null
@@ -1,58 +0,0 @@
-package de.steamwar.bausystem.features.script.command.logic;
-
-import de.steamwar.bausystem.BauSystem;
-import de.steamwar.bausystem.features.script.ScriptExecutor;
-import de.steamwar.bausystem.features.script.SpecialCommand;
-import de.steamwar.bausystem.features.script.variables.Value;
-import de.steamwar.linkage.Linked;
-import org.bukkit.Material;
-
-@Linked
-public class Equal implements SpecialCommand {
-
- @Override
- public String[] description() {
- return new String[]{
- "SCRIPT_COMMAND_LOGIC_EQUAL_HELP_1",
- "SCRIPT_COMMAND_LOGIC_EQUAL_HELP_2",
- "",
- "SCRIPT_COMMAND_LOGIC_EQUAL_HELP_3"
- };
- }
-
- @Override
- public Material material() {
- return Material.COMPARATOR;
- }
-
- @Override
- public String command() {
- return "equal";
- }
-
- @Override
- public boolean execute(String[] command, ScriptExecutor scriptExecutor) {
- if (command.length <= 1) {
- BauSystem.MESSAGE.send("SCRIPT_COMMAND_ERROR_FIRST_ARG_NOVAR", scriptExecutor.getPlayer());
- return true;
- }
- if (command.length <= 2) {
- BauSystem.MESSAGE.send("SCRIPT_COMMAND_ERROR_SECOND_ARG_NOVAR", scriptExecutor.getPlayer());
- return true;
- }
-
- Value v1 = scriptExecutor.getOrItselfValue(command[command.length - 2]);
- Value v2 = scriptExecutor.getOrItselfValue(command[command.length - 1]);
- Value result;
- if (!v1.getClass().isInstance(v2.getClass()) && !v2.getClass().isInstance(v1.getClass())) {
- result = new Value.BooleanValue(false);
- } else if (v1.asString().equals(v2.asString())) {
- result = new Value.BooleanValue(true);
- } else {
- result = new Value.BooleanValue(false);
- }
-
- scriptExecutor.getLocalVariables().putValue(command[1], result);
- return true;
- }
-}
diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/logic/Greater.java b/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/logic/Greater.java
deleted file mode 100644
index be5e7e3f..00000000
--- a/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/logic/Greater.java
+++ /dev/null
@@ -1,64 +0,0 @@
-package de.steamwar.bausystem.features.script.command.logic;
-
-import de.steamwar.bausystem.BauSystem;
-import de.steamwar.bausystem.features.script.ScriptExecutor;
-import de.steamwar.bausystem.features.script.SpecialCommand;
-import de.steamwar.bausystem.features.script.variables.Value;
-import de.steamwar.linkage.Linked;
-import org.bukkit.Material;
-
-@Linked
-public class Greater implements SpecialCommand {
-
- @Override
- public String[] description() {
- return new String[]{
- "SCRIPT_COMMAND_LOGIC_GREATER_HELP_1",
- "SCRIPT_COMMAND_LOGIC_GREATER_HELP_2",
- "",
- "SCRIPT_COMMAND_LOGIC_GREATER_HELP_3"
- };
- }
-
- @Override
- public Material material() {
- return Material.COMPARATOR;
- }
-
- @Override
- public String command() {
- return "greater";
- }
-
- @Override
- public boolean execute(String[] command, ScriptExecutor scriptExecutor) {
- if (command.length <= 1) {
- BauSystem.MESSAGE.send("SCRIPT_COMMAND_ERROR_FIRST_ARG_NOVAR", scriptExecutor.getPlayer());
- return true;
- }
- if (command.length <= 2) {
- BauSystem.MESSAGE.send("SCRIPT_COMMAND_ERROR_SECOND_ARG_NOVAR", scriptExecutor.getPlayer());
- return true;
- }
-
- Value v1 = scriptExecutor.getOrItselfValue(command[command.length - 2]);
- Value v2 = scriptExecutor.getOrItselfValue(command[command.length - 1]);
- if (!(v1 instanceof Value.LongValue) && !(v1 instanceof Value.DoubleValue)) {
- BauSystem.MESSAGE.send("SCRIPT_COMMAND_ERROR_NUMBER_COMPARE", scriptExecutor.getPlayer());
- return true;
- }
- if (!(v2 instanceof Value.LongValue) && !(v2 instanceof Value.DoubleValue)) {
- BauSystem.MESSAGE.send("SCRIPT_COMMAND_ERROR_NUMBER_COMPARE", scriptExecutor.getPlayer());
- return true;
- }
- Value result;
- if (v1.asDouble() > v2.asDouble()) {
- result = new Value.BooleanValue(true);
- } else {
- result = new Value.BooleanValue(false);
- }
-
- scriptExecutor.getLocalVariables().putValue(command[1], result);
- return true;
- }
-}
diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/logic/Less.java b/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/logic/Less.java
deleted file mode 100644
index 3368e9dd..00000000
--- a/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/logic/Less.java
+++ /dev/null
@@ -1,64 +0,0 @@
-package de.steamwar.bausystem.features.script.command.logic;
-
-import de.steamwar.bausystem.BauSystem;
-import de.steamwar.bausystem.features.script.ScriptExecutor;
-import de.steamwar.bausystem.features.script.SpecialCommand;
-import de.steamwar.bausystem.features.script.variables.Value;
-import de.steamwar.linkage.Linked;
-import org.bukkit.Material;
-
-@Linked
-public class Less implements SpecialCommand {
-
- @Override
- public String[] description() {
- return new String[]{
- "SCRIPT_COMMAND_LOGIC_LESS_HELP_1",
- "SCRIPT_COMMAND_LOGIC_LESS_HELP_2",
- "",
- "SCRIPT_COMMAND_LOGIC_LESS_HELP_3"
- };
- }
-
- @Override
- public Material material() {
- return Material.COMPARATOR;
- }
-
- @Override
- public String command() {
- return "less";
- }
-
- @Override
- public boolean execute(String[] command, ScriptExecutor scriptExecutor) {
- if (command.length <= 1) {
- BauSystem.MESSAGE.send("SCRIPT_COMMAND_ERROR_FIRST_ARG_NOVAR", scriptExecutor.getPlayer());
- return true;
- }
- if (command.length <= 2) {
- BauSystem.MESSAGE.send("SCRIPT_COMMAND_ERROR_SECOND_ARG_NOVAR", scriptExecutor.getPlayer());
- return true;
- }
-
- Value v1 = scriptExecutor.getOrItselfValue(command[command.length - 2]);
- Value v2 = scriptExecutor.getOrItselfValue(command[command.length - 1]);
- if (!(v1 instanceof Value.LongValue) && !(v1 instanceof Value.DoubleValue)) {
- BauSystem.MESSAGE.send("SCRIPT_COMMAND_ERROR_NUMBER_COMPARE", scriptExecutor.getPlayer());
- return true;
- }
- if (!(v2 instanceof Value.LongValue) && !(v2 instanceof Value.DoubleValue)) {
- BauSystem.MESSAGE.send("SCRIPT_COMMAND_ERROR_NUMBER_COMPARE", scriptExecutor.getPlayer());
- return true;
- }
- Value result;
- if (v1.asDouble() < v2.asDouble()) {
- result = new Value.BooleanValue(true);
- } else {
- result = new Value.BooleanValue(false);
- }
-
- scriptExecutor.getLocalVariables().putValue(command[1], result);
- return true;
- }
-}
diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/logic/Not.java b/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/logic/Not.java
deleted file mode 100644
index bc1c0f2d..00000000
--- a/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/logic/Not.java
+++ /dev/null
@@ -1,48 +0,0 @@
-package de.steamwar.bausystem.features.script.command.logic;
-
-import de.steamwar.bausystem.BauSystem;
-import de.steamwar.bausystem.features.script.ScriptExecutor;
-import de.steamwar.bausystem.features.script.SpecialCommand;
-import de.steamwar.bausystem.features.script.variables.Value;
-import de.steamwar.linkage.Linked;
-import org.bukkit.Material;
-
-@Linked
-public class Not implements SpecialCommand {
-
- @Override
- public String[] description() {
- return new String[]{
- "SCRIPT_COMMAND_LOGIC_NOT_HELP_1",
- "SCRIPT_COMMAND_LOGIC_NOT_HELP_2",
- "",
- "SCRIPT_COMMAND_LOGIC_NOT_HELP_3"
- };
- }
-
- @Override
- public Material material() {
- return Material.COMPARATOR;
- }
-
- @Override
- public String command() {
- return "not";
- }
-
- @Override
- public boolean execute(String[] command, ScriptExecutor scriptExecutor) {
- if (command.length <= 1) {
- BauSystem.MESSAGE.send("SCRIPT_COMMAND_ERROR_FIRST_ARG_NOVAR", scriptExecutor.getPlayer());
- return true;
- }
-
- Value v1 = scriptExecutor.getOrItselfValue(command[command.length - 1]);
- if (!(v1 instanceof Value.BooleanValue)) {
- BauSystem.MESSAGE.send("SCRIPT_COMMAND_ERROR_BOOLEAN_COMPARE", scriptExecutor.getPlayer());
- return true;
- }
- scriptExecutor.getLocalVariables().putValue(command[1], new Value.BooleanValue(!v1.asBoolean()));
- return true;
- }
-}
diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/logic/Or.java b/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/logic/Or.java
deleted file mode 100644
index bec5950c..00000000
--- a/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/logic/Or.java
+++ /dev/null
@@ -1,64 +0,0 @@
-package de.steamwar.bausystem.features.script.command.logic;
-
-import de.steamwar.bausystem.BauSystem;
-import de.steamwar.bausystem.features.script.ScriptExecutor;
-import de.steamwar.bausystem.features.script.SpecialCommand;
-import de.steamwar.bausystem.features.script.variables.Value;
-import de.steamwar.linkage.Linked;
-import org.bukkit.Material;
-
-@Linked
-public class Or implements SpecialCommand {
-
- @Override
- public String[] description() {
- return new String[]{
- "SCRIPT_COMMAND_LOGIC_OR_HELP_1",
- "SCRIPT_COMMAND_LOGIC_OR_HELP_2",
- "",
- "SCRIPT_COMMAND_LOGIC_OR_HELP_3"
- };
- }
-
- @Override
- public Material material() {
- return Material.COMPARATOR;
- }
-
- @Override
- public String command() {
- return "or";
- }
-
- @Override
- public boolean execute(String[] command, ScriptExecutor scriptExecutor) {
- if (command.length <= 1) {
- BauSystem.MESSAGE.send("SCRIPT_COMMAND_ERROR_FIRST_ARG_NOVAR", scriptExecutor.getPlayer());
- return true;
- }
- if (command.length <= 2) {
- BauSystem.MESSAGE.send("SCRIPT_COMMAND_ERROR_SECOND_ARG_NOVAR", scriptExecutor.getPlayer());
- return true;
- }
-
- Value v1 = scriptExecutor.getOrItselfValue(command[command.length - 2]);
- Value v2 = scriptExecutor.getOrItselfValue(command[command.length - 1]);
- if (!(v1 instanceof Value.BooleanValue)) {
- BauSystem.MESSAGE.send("SCRIPT_COMMAND_ERROR_BOOLEAN_COMPARE", scriptExecutor.getPlayer());
- return true;
- }
- if (!(v2 instanceof Value.BooleanValue)) {
- BauSystem.MESSAGE.send("SCRIPT_COMMAND_ERROR_BOOLEAN_COMPARE", scriptExecutor.getPlayer());
- return true;
- }
- Value result;
- if (v1.asBoolean() || v2.asBoolean()) {
- result = new Value.BooleanValue(true);
- } else {
- result = new Value.BooleanValue(false);
- }
-
- scriptExecutor.getLocalVariables().putValue(command[1], result);
- return true;
- }
-}
diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/string/Length.java b/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/string/Length.java
deleted file mode 100644
index 05a26a53..00000000
--- a/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/string/Length.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * This file is a part of the SteamWar software.
- *
- * Copyright (C) 2021 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.command.string;
-
-import de.steamwar.bausystem.BauSystem;
-import de.steamwar.bausystem.features.script.ScriptExecutor;
-import de.steamwar.bausystem.features.script.SpecialCommand;
-import de.steamwar.bausystem.features.script.variables.Value;
-import de.steamwar.linkage.Linked;
-import org.bukkit.Material;
-
-@Linked
-public class Length implements SpecialCommand {
-
- @Override
- public String[] description() {
- return new String[]{
- "SCRIPT_COMMAND_STRING_LENGTH_HELP_1",
- "SCRIPT_COMMAND_STRING_LENGTH_HELP_2",
- "",
- "SCRIPT_COMMAND_STRING_LENGTH_HELP_3"
- };
- }
-
- @Override
- public Material material() {
- return Material.REPEATER;
- }
-
- @Override
- public String command() {
- return "length";
- }
-
- @Override
- public boolean execute(String[] command, ScriptExecutor scriptExecutor) {
- if (command.length <= 1) {
- BauSystem.MESSAGE.send("SCRIPT_COMMAND_ERROR_FIRST_ARG_NOVAR", scriptExecutor.getPlayer());
- return true;
- }
- if (command.length <= 2) {
- BauSystem.MESSAGE.send("SCRIPT_COMMAND_ERROR_SECOND_ARG_NOVAR", scriptExecutor.getPlayer());
- return true;
- }
-
- String resultName = command[1];
- Value v2 = scriptExecutor.getOrItselfValue(command[command.length - 1]);
-
- if (!(v2 instanceof Value.StringValue)) {
- BauSystem.MESSAGE.send("SCRIPT_COMMAND_ERROR_ONLY_STRINGS_ALLOWED", scriptExecutor.getPlayer());
- return true;
- }
-
- scriptExecutor.getLocalVariables().putValue(resultName, new Value.LongValue(v2.asString().length()));
- return true;
- }
-}
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 f69a6b34..838601da 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
@@ -23,6 +23,7 @@ import de.steamwar.bausystem.BauSystem;
import de.steamwar.bausystem.features.script.ScriptExecutor;
import de.steamwar.bausystem.features.script.SpecialCommand;
import de.steamwar.bausystem.features.script.variables.Constants;
+import de.steamwar.bausystem.features.script.variables.Value;
import de.steamwar.linkage.Linked;
import org.bukkit.Material;
@@ -66,7 +67,7 @@ public class Const implements SpecialCommand {
}
varValue.append(command[i]);
}
- Constants.getConstant(varName, scriptExecutor.getPlayer()).fromValue(scriptExecutor.parse(varValue.toString()));
+ Constants.getConstant(varName, scriptExecutor.getPlayer()).fromValue(Value.parse(varValue.toString()));
return true;
}
}
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 90413443..8abe3afc 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
@@ -22,6 +22,7 @@ package de.steamwar.bausystem.features.script.command.variable;
import de.steamwar.bausystem.BauSystem;
import de.steamwar.bausystem.features.script.ScriptExecutor;
import de.steamwar.bausystem.features.script.SpecialCommand;
+import de.steamwar.bausystem.features.script.variables.Value;
import de.steamwar.linkage.Linked;
import org.bukkit.Material;
@@ -58,7 +59,7 @@ public class Convert implements SpecialCommand {
return true;
}
- scriptExecutor.getLocalVariables().putValue(command[1], scriptExecutor.parse(command[2]));
+ scriptExecutor.getLocalVariables().putValue(command[1], Value.parse(command[2]));
return true;
}
}
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 ec9fdcbb..b8a8e662 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
@@ -3,6 +3,7 @@ package de.steamwar.bausystem.features.script.command.variable;
import de.steamwar.bausystem.BauSystem;
import de.steamwar.bausystem.features.script.ScriptExecutor;
import de.steamwar.bausystem.features.script.SpecialCommand;
+import de.steamwar.bausystem.features.script.variables.Value;
import de.steamwar.linkage.Linked;
import org.bukkit.Material;
@@ -46,7 +47,7 @@ public class Global implements SpecialCommand {
}
varValue.append(command[i]);
}
- scriptExecutor.getGlobalVariables().putValue(varName, scriptExecutor.parse(varValue.toString()));
+ scriptExecutor.getGlobalVariables().putValue(varName, Value.parse(varValue.toString()));
return true;
}
}
diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/variable/Isset.java b/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/variable/Isset.java
deleted file mode 100644
index b246eb83..00000000
--- a/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/variable/Isset.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * This file is a part of the SteamWar software.
- *
- * Copyright (C) 2021 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.command.variable;
-
-import de.steamwar.bausystem.BauSystem;
-import de.steamwar.bausystem.features.script.ScriptExecutor;
-import de.steamwar.bausystem.features.script.SpecialCommand;
-import de.steamwar.bausystem.features.script.variables.Value;
-import de.steamwar.linkage.Linked;
-import org.bukkit.Material;
-
-@Linked
-public class Isset implements SpecialCommand {
-
- @Override
- public String[] description() {
- return new String[]{
- "SCRIPT_COMMAND_VARIABLE_ISSET_HELP_1",
- "",
- "SCRIPT_COMMAND_VARIABLE_ISSET_HELP_2"
- };
- }
-
- @Override
- public Material material() {
- return Material.REDSTONE_TORCH;
- }
-
- @Override
- public String command() {
- return "isset";
- }
-
- @Override
- public boolean execute(String[] command, ScriptExecutor scriptExecutor) {
- if (command.length <= 1) {
- BauSystem.MESSAGE.send("SCRIPT_COMMAND_ERROR_FIRST_ARG_NOVAR", scriptExecutor.getPlayer());
- return true;
- }
- if (command.length <= 2) {
- BauSystem.MESSAGE.send("SCRIPT_COMMAND_ERROR_SECOND_ARG_NOVAR", scriptExecutor.getPlayer());
- return true;
- }
-
- scriptExecutor.getLocalVariables().putValue(command[1], scriptExecutor.isVariable(command[2]) ? new Value.BooleanValue(true) : new Value.BooleanValue(false));
- return true;
- }
-}
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 bedb88da..41b948fe 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
@@ -3,6 +3,7 @@ package de.steamwar.bausystem.features.script.command.variable;
import de.steamwar.bausystem.BauSystem;
import de.steamwar.bausystem.features.script.ScriptExecutor;
import de.steamwar.bausystem.features.script.SpecialCommand;
+import de.steamwar.bausystem.features.script.variables.Value;
import de.steamwar.linkage.Linked;
import org.bukkit.Material;
@@ -46,7 +47,7 @@ public class Var implements SpecialCommand {
}
varValue.append(command[i]);
}
- scriptExecutor.getLocalVariables().putValue(varName, scriptExecutor.parse(varValue.toString()));
+ scriptExecutor.getLocalVariables().putValue(varName, Value.parse(varValue.toString()));
return true;
}
}
diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/variable/Vartype.java b/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/variable/Vartype.java
deleted file mode 100644
index 46680548..00000000
--- a/BauSystem_Main/src/de/steamwar/bausystem/features/script/command/variable/Vartype.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * This file is a part of the SteamWar software.
- *
- * Copyright (C) 2021 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.command.variable;
-
-import de.steamwar.bausystem.BauSystem;
-import de.steamwar.bausystem.features.script.ScriptExecutor;
-import de.steamwar.bausystem.features.script.SpecialCommand;
-import de.steamwar.bausystem.features.script.variables.Value;
-import de.steamwar.linkage.Linked;
-import org.bukkit.Material;
-
-@Linked
-public class Vartype implements SpecialCommand {
-
- @Override
- public String[] description() {
- return new String[]{
- "SCRIPT_COMMAND_VARIABLE_VARTYPE_HELP_1",
- "",
- "SCRIPT_COMMAND_VARIABLE_VARTYPE_HELP_2"
- };
- }
-
- @Override
- public Material material() {
- return Material.CHEST;
- }
-
- @Override
- public String command() {
- return "vartype";
- }
-
- @Override
- public boolean execute(String[] command, ScriptExecutor scriptExecutor) {
- if (command.length <= 1) {
- BauSystem.MESSAGE.send("SCRIPT_COMMAND_ERROR_FIRST_ARG_NOVAR", scriptExecutor.getPlayer());
- return true;
- }
- if (command.length <= 2) {
- BauSystem.MESSAGE.send("SCRIPT_COMMAND_ERROR_SECOND_ARG_NOVAR", scriptExecutor.getPlayer());
- return true;
- }
-
- if (!scriptExecutor.isVariable(command[2])) {
- scriptExecutor.getLocalVariables().putValue(command[1], new Value.BooleanValue(false));
- }
- Value value = scriptExecutor.getOrItselfValue(command[2]);
- scriptExecutor.getLocalVariables().putValue(command[1], new Value.StringValue(value.type()));
- return true;
- }
-}
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
new file mode 100644
index 00000000..7cde325a
--- /dev/null
+++ b/BauSystem_Main/src/de/steamwar/bausystem/features/script/expression/Expression.java
@@ -0,0 +1,242 @@
+/*
+ * 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.expression;
+
+import de.steamwar.bausystem.features.script.ScriptExecutor;
+import de.steamwar.bausystem.features.script.variables.Constants;
+import de.steamwar.bausystem.features.script.variables.Value;
+import org.bukkit.entity.Player;
+
+import java.util.*;
+
+public class Expression {
+
+ private static int highestPrecedence = 1;
+
+ private static final Map OPERATORS = new HashMap<>();
+
+ public static void registerOperator(Operator operator) {
+ highestPrecedence = Math.max(highestPrecedence, operator.getPriority()) + 1;
+ OPERATORS.put(operator.getOperator(), operator);
+ }
+
+ private Player p;
+ private ScriptExecutor scriptExecutor;
+
+ private String s;
+
+ public Expression(Player p, String s, ScriptExecutor scriptExecutor) {
+ s = s.substring(1, s.length() - 1);
+ this.p = p;
+ this.s = s;
+ this.scriptExecutor = scriptExecutor;
+ }
+
+ public Value eval() {
+ List