diff --git a/BauSystem_Linkage/src/de/steamwar/linkage/types/LuaLib_GENERIC.java b/BauSystem_Linkage/src/de/steamwar/linkage/types/LuaLib_GENERIC.java new file mode 100644 index 00000000..570f6a33 --- /dev/null +++ b/BauSystem_Linkage/src/de/steamwar/linkage/types/LuaLib_GENERIC.java @@ -0,0 +1,40 @@ +/* + * This file is a part of the SteamWar software. + * + * Copyright (C) 2023 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 LuaLib_GENERIC implements LinkageType { + + @Override + public String method() { + return "link"; + } + + @Override + public void generateCode(BuildPlan buildPlan, MethodBuilder methodBuilder, String s, TypeElement typeElement) { + buildPlan.addImport("de.steamwar.bausystem.features.script.lua.SteamWarLuaPlugin"); + methodBuilder.addLine("SteamWarLuaPlugin.add(" + s + ");"); + } +} diff --git a/BauSystem_Linkage/src/de/steamwar/linkage/types/Operator_GENERIC.java b/BauSystem_Linkage/src/de/steamwar/linkage/types/Operator_GENERIC.java deleted file mode 100644 index 8a1916a8..00000000 --- a/BauSystem_Linkage/src/de/steamwar/linkage/types/Operator_GENERIC.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * 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_Linkage/src/de/steamwar/linkage/types/SpecialCommand_GENERIC.java b/BauSystem_Linkage/src/de/steamwar/linkage/types/SpecialCommand_GENERIC.java deleted file mode 100644 index 97c63276..00000000 --- a/BauSystem_Linkage/src/de/steamwar/linkage/types/SpecialCommand_GENERIC.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * 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 SpecialCommand_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.ScriptExecutor"); - methodBuilder.addLine("ScriptExecutor.SPECIAL_COMMANDS.add(" + s + ");"); - } -} diff --git a/BauSystem_Main/build.gradle b/BauSystem_Main/build.gradle index 1052e30a..2e9a8d6c 100644 --- a/BauSystem_Main/build.gradle +++ b/BauSystem_Main/build.gradle @@ -64,4 +64,6 @@ dependencies { annotationProcessor swdep('SpigotCore') compileOnly swdep('FastAsyncWorldEdit-1.18') + + implementation 'org.luaj:luaj-jse:3.0.1' } \ No newline at end of file diff --git a/BauSystem_Main/src/BauSystem.properties b/BauSystem_Main/src/BauSystem.properties index 0900dca1..af6e40c9 100644 --- a/BauSystem_Main/src/BauSystem.properties +++ b/BauSystem_Main/src/BauSystem.properties @@ -230,300 +230,40 @@ 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_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_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_ERROR = §cOnly numbers or strings can be added -SCRIPT_COMMAND_ARITHMETIC_DIV_ERROR = §cOnly numbers can be divided -SCRIPT_COMMAND_ARITHMETIC_MUL_ERROR = §cOnly numbers can be multiplied -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> -SCRIPT_COMMAND_ARITHMETIC_OTHER_CEIL_HELP_3 = Ceils the second number and writes it in the first or ceils the second number with the precision from the third number and writes it in the first -SCRIPT_COMMAND_ARITHMETIC_OTHER_CEIL_ERROR_1 = §cOnly floating point numbers can be ceiled -SCRIPT_COMMAND_ARITHMETIC_OTHER_CEIL_ERROR_2 = §cThe precision needs to be a whole number - -SCRIPT_COMMAND_ARITHMETIC_OTHER_FLOOR_HELP_1 = §efloor §8<§7variable§8> §8<§7variable§8|§7value§8> -SCRIPT_COMMAND_ARITHMETIC_OTHER_FLOOR_HELP_2 = §efloor §8<§7variable§8> §8<§7variable§8|§7value§8> §8<§7variable§8|§7value§8> -SCRIPT_COMMAND_ARITHMETIC_OTHER_FLOOR_HELP_3 = Floors the second number and writes it in the first or floors the second number with the precision from the third number and writes it in the first -SCRIPT_COMMAND_ARITHMETIC_OTHER_FLOOR_ERROR_1 = §cOnly floating point numbers can be floored -SCRIPT_COMMAND_ARITHMETIC_OTHER_FLOOR_ERROR_2 = §cThe precision needs to be a whole number - -SCRIPT_COMMAND_ARITHMETIC_OTHER_ROUND_HELP_1 = §eround §8<§7variable§8> §8<§7variable§8|§7value§8> -SCRIPT_COMMAND_ARITHMETIC_OTHER_ROUND_HELP_2 = §eround §8<§7variable§8> §8<§7variable§8|§7value§8> §8<§7variable§8|§7value§8> -SCRIPT_COMMAND_ARITHMETIC_OTHER_ROUND_HELP_3 = Round the second number and writes it in the first or rounds the second number with the precision from the third number and writes it in the first -SCRIPT_COMMAND_ARITHMETIC_OTHER_ROUND_ERROR_1 = §cOnly floating point numbers can be rounded -SCRIPT_COMMAND_ARITHMETIC_OTHER_ROUND_ERROR_2 = §cThe precision needs to be a whole number - -SCRIPT_COMMAND_IO_ECHO_HELP_1 = §eecho §8<§7value§8> -SCRIPT_COMMAND_IO_ECHO_HELP_2 = §7Send a message to the player. If the value is empty, the message will be empty as well -SCRIPT_COMMAND_IO_ECHO_MESSAGE = §f{0} - -SCRIPT_COMMAND_IO_ECHOACTIONBAR_HELP_1 = §eechoactionbar §8<§7value§8> -SCRIPT_COMMAND_IO_ECHOACTIONBAR_HELP_2 = §7Send a message to the player to the action bar. If the value is empty, the message will be empty as well - -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_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_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. - -SCRIPT_COMMAND_STRING_REPLACE_HELP_1 = §ereplace §8<§7variable§8> §8<§7from variable§8> §8<§7to variable§8> -SCRIPT_COMMAND_STRING_REPLACE_HELP_2 = §ereplace §8<§7variable§8> §8<§7variable§8> §8<§7from variable§8> §8<§7to variable§8> -SCRIPT_COMMAND_STRING_REPLACE_HELP_3 = Replaces all occurrences of a string from another string with a given string - -SCRIPT_COMMAND_STRING_SUBSTRING_HELP_1 = §esubstring §8<§7variable§8> §8<§7number§8> -SCRIPT_COMMAND_STRING_SUBSTRING_HELP_2 = §esubstring §8<§7variable§8> §8<§7variable§8> §8<§7number§8> -SCRIPT_COMMAND_STRING_SUBSTRING_HELP_3 = Shortens a string either from the start or the end, depending on whether the given index is positive (start) or negative (end) - -SCRIPT_COMMAND_VARIABLE_CONST_HELP_1 = §econst §8<§7variable§8> §8[§7value§8(§7s§8)§8] -SCRIPT_COMMAND_VARIABLE_CONST_HELP_2 = Writes a value in a constant, which can be a number, a boolean or a string - -SCRIPT_COMMAND_VARIABLE_CONVERT_HELP_1 = §econvert §8<§7variable§8> §8<§7value§8> -SCRIPT_COMMAND_VARIABLE_CONVERT_HELP_2 = Converts a value to 'number' if it's a number, or to 'boolean' if it's either 'true' or 'false'. Otherwise it remains of type 'text'. - -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_UNGLOBAL_HELP_1 = §eunglobal §8<§7variable§8> -SCRIPT_COMMAND_VARIABLE_UNGLOBAL_HELP_2 = Deletes a global variable. - -SCRIPT_COMMAND_VARIABLE_UNVAR_HELP_1 = §eunvar §8<§7variable§8> -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_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 - -SCRIPT_COMMAND_WORLD_SETMATERIAL_HELP_1 = §esetmaterial §8<§7variable§8> §8<§7number§8> §8<§7number§8> §8<§7number§8> -SCRIPT_COMMAND_WORLD_SETMATERIAL_HELP_2 = Sets a block in the world with the given material, given in the variable - -SCRIPT_COMMAND_EXIT_HELP_1 = §eexit -SCRIPT_COMMAND_EXIT_HELP_2 = Exits the script - -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 the first jump-point if the given value is true or the second jump-point otherwise. - -SCRIPT_COMMAND_JUMP_HELP_1 = §ejump §8<§7jump-point§8> -SCRIPT_COMMAND_JUMP_HELP_2 = §7Jump to a jump-point. A jump-point is a line with §8'§7.§8'§7 before. -SCRIPT_COMMAND_JUMP_ERROR = §cUnknown jump-point: {0} - -SCRIPT_COMMAND_CALL_HELP_1 = §ecall §8<§7jump-point§8> -SCRIPT_COMMAND_CALL_HELP_2 = §7Jump to a jump-point. A jump-point is a line with §8'§7.§8'§7 before. Building a return stack alongside. Use 'return' to jump back. -SCRIPT_COMMAND_CALL_ERROR = §cUnknown jump-point: {0} - -SCRIPT_COMMAND_RETURN_HELP_1 = §ereturn -SCRIPT_COMMAND_RETURN_HELP_2 = §7Jump back to the last 'call' command -SCRIPT_COMMAND_RETURN_ERROR = §cNo 'call' command executed before - -SCRIPT_COMMAND_SLEEP_HELP_1 = §esleep §8<§7time§8> -SCRIPT_COMMAND_SLEEP_HELP_2 = Pauses the execution by the given number of game ticks. -SCRIPT_COMMAND_SLEEP_ERROR = §cThe given number needs to be greater than zero. - -## GUI -SCRIPT_GUI_ITEM_NAME = §eScript Help +SCRIPT_ERROR_GUI=§cError in parsing script: Line {0} +SCRIPT_ERROR_GLOBAL=§cError in global script: Line {0} +SCRIPT_ERROR_CLICK=§cError in script: Line {0} +SCRIPT_ERROR_ONLY_IN_GLOBAL=§cThis function is only available in global scripts ## CustomScript -SCRIPT_HOTKEY_ITEM_NAME = §7Hotkey§8: §e{0} §8-§7 {1} -SCRIPT_EVENT_ITEM_NAME = §7Event§8: §e{0} §8-§7 {1} -SCRIPT_COMMAND_ITEM_NAME = §7Command§8: §e{0} +SCRIPT_HOTKEY_ITEM_NAME = §7Hotkey§8: §e{0} +SCRIPT_EVENT_ITEM_NAME = §7Event§8: §e{0} +SCRIPT_COMMAND_ITEM_NAME = §7Command§8: §e/{0} ## Script Menu GUI SCRIPT_MENU_GUI_ITEM_LORE_1 = §7Click to retrieve SCRIPT_MENU_GUI_ITEM_LORE_2 = §7Shift-Click to copy -SCRIPT_MENU_GUI_NAME = §eScript Commands {0}{1}§7% +SCRIPT_MENU_GUI_ITEM_LORE_3 = §7Right-Click to edit +SCRIPT_MENU_GUI_ITEM_LORE_4 = §7Middle-Click to preview +SCRIPT_MENU_GUI_NAME = §eScript-Menu SCRIPT_MENU_GUI_ITEM_ADD_NAME = §eInsert SCRIPT_MENU_GUI_ITEM_ADD_LORE = §7Click with a book to insert -SCRIPT_MENU_GUI_DUPLICATE_COMMAND = §cCommand '{0}' already defined -SCRIPT_MENU_GUI_UNKNOWN_EVENT = §cEvent '{0}' cannot be defined -SCRIPT_MENU_GUI_LIMIT = §cScript-Book limit reached - -## ScriptCommand -SCRIPT_COMMAND_HELP = §8/§escript §8- §7Opens the ScriptGUI -SCRIPT_COMMAND_HELP_MENU = §8/§escript menu §8- §7Opens the ScriptGUI for custom commands shares across baus - -## Script GUI -SCRIPT_GUI_NAME = Script Elements -SCRIPT_GUI_COMMAND_CHAT = §eScript Command§8: §e{0} - -SCRIPT_GUI_CUSTOM_HOTKEYS = §eCustom Hotkeys -SCRIPT_GUI_CUSTOM_HOTKEYS_COMMANDS_LORE_1 = §7Write§8: §e#!HOTKEY 'Char' -SCRIPT_GUI_CUSTOM_HOTKEYS_COMMANDS_LORE_2 = §7at the beginning of a Script Book to use a custom hotkey. The 'Char' can be any char between '§eA§7' and '§eZ§7' as well as '§e0§7' and '§e9§7'. While executing two variables are available: §epressed§7, §ereleased§7. -SCRIPT_GUI_CUSTOM_HOTKEYS_COMMANDS_LORE_3 = §7You can add modifiers like "SHIFT", "CTRL", "ALT" or "META" to the hotkey. §7Example: §e#!HOTKEY SHIFT+A -SCRIPT_GUI_CUSTOM_HOTKEYS_COMMANDS_LORE_4 = §7 -SCRIPT_GUI_CUSTOM_HOTKEYS_COMMANDS_LORE_5 = §cThis can only be used in conjunction with the Fabric-Mod: §eAdvancedScripts §7found on §ehttps://steamwar.de/downloads - -SCRIPT_GUI_CUSTOM_COMMANDS = §eCustom Commands -SCRIPT_GUI_CUSTOM_COMMANDS_LORE_1 = §7Write§8: §e#!CMD 'COMMAND' -SCRIPT_GUI_CUSTOM_COMMANDS_LORE_2 = §7at the beginning of a Script Book to use a custom command. The command always starts with §e/§7 and can be structured as you wish. Everything in pointy Brackets '§e<>§7' will be counted as a Parameter and therefore as a variable. Parameters in round brackets '§e()§7' are optional. Simple texts as parameters get a variable with the same name with the values true/false, depending on whether the value was given or not - -SCRIPT_GUI_CUSTOM_EVENTS = §eCustom Events -SCRIPT_GUI_CUSTOM_EVENTS_LORE_1 = §7Write§8: §e#!EVENT 'EventName' -SCRIPT_GUI_CUSTOM_EVENTS_LORE_2 = §7at the beginning of a Script Book to use a custom event. Every event can ve canceled by using 'var cancel true'. After the event name are the variables which are usable in a Script Book. -SCRIPT_GUI_CUSTOM_EVENTS_LORE_3 = §7Usable Events are: -SCRIPT_GUI_CUSTOM_EVENTS_LORE_4 = §eFF -SCRIPT_GUI_CUSTOM_EVENTS_LORE_5 = §ePlaceBlock §8-§7 blockX, blockY, blockZ, blockType -SCRIPT_GUI_CUSTOM_EVENTS_LORE_6 = §eBreakBlock §8-§7 blockX, blockY, blockZ, blockType -SCRIPT_GUI_CUSTOM_EVENTS_LORE_7 = §eRightClick §8-§7 blockInHand, action, handType, -SCRIPT_GUI_CUSTOM_EVENTS_LORE_8 = §7 hasBlock §8[§7blockX, blockY, blockZ, blockFace§8]§e* -SCRIPT_GUI_CUSTOM_EVENTS_LORE_9 = §eLeftClick §8-§7 blockInHand, action, handType, -SCRIPT_GUI_CUSTOM_EVENTS_LORE_10 = §7 hasBlock §8[§7blockX, blockY, blockZ, blockFace§8]§e* -SCRIPT_GUI_CUSTOM_EVENTS_LORE_11 = §eTNTSpawn -SCRIPT_GUI_CUSTOM_EVENTS_LORE_12 = §eTNTExplode §8-§7 x, y, z -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_18 = §eScoreboard -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_2 = §7Jump_Points start with §e.§7. -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} - -SCRIPT_GUI_CUSTOM_VARIABLES = §eCustom Variables - -SCRIPT_GUI_CONSTANT_TIME_NAME = §7Constant §etime -SCRIPT_GUI_CONSTANT_TIME_LORE = §7Formatted time variable. - -SCRIPT_GUI_CONSTANT_TICKS_NAME = §7Constant §eticks -SCRIPT_GUI_CONSTANT_TICKS_LORE = §7Ticks since server start. - -SCRIPT_GUI_CONSTANT_TRACE_NAME = §7Constant §etrace -SCRIPT_GUI_CONSTANT_TRACE_LORE = §etrue§7 if the trace is activated. - -SCRIPT_GUI_CONSTANT_AUTO_TRACE_NAME = §7Constant §eautotrace -SCRIPT_GUI_CONSTANT_AUTO_TRACE_LORE = §etrue§7 if the auto trace is activated. - -SCRIPT_GUI_CONSTANT_TRACE_STATUS_NAME = §7Constant §etrace_status -SCRIPT_GUI_CONSTANT_TRACE_STATUS_LORE = §7One of: §eOFF§8, §eIDLE§8, §eIDLE_AUTO_EXPLODE§8, §eIDLE_AUTO_IGNITE§8, §eIDLE_SINGLE - -SCRIPT_GUI_CONSTANT_TRACE_TIME_NAME = §7Constant §etrace_time -SCRIPT_GUI_CONSTANT_TRACE_TIME_LORE = §e0§7 if the trace is not active, otherwise the time in ticks since the trace was started. - -SCRIPT_GUI_CONSTANT_LOADER_STATUS_NAME = §7Constant §eloader_status -SCRIPT_GUI_CONSTANT_LOADER_STATUS_LORE = §7One of: §eOFF§8, §eSETUP§8, §eRUNNING§8, §eSINGLE§8, §ePAUSE§8, §eEND - -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_LORE = §etrue§7 if tnt no build is activated. - -SCRIPT_GUI_CONSTANT_FREEZE_NAME = §7Constant §efreeze -SCRIPT_GUI_CONSTANT_FREEZE_LORE = §etrue§7 if freeze is not deactivated. - -SCRIPT_GUI_CONSTANT_FIRE_NAME = §7Constant §efire -SCRIPT_GUI_CONSTANT_FIRE_LORE = §etrue§7 if fire is not deactivated. - -SCRIPT_GUI_CONSTANT_PROTECT_NAME = §7Constant §eprotect -SCRIPT_GUI_CONSTANT_PROTECT_LORE = §etrue§7 if protect is activated. - -SCRIPT_GUI_CONSTANT_X_NAME = §7Constant §ex -SCRIPT_GUI_CONSTANT_X_LORE = §ex§7 position of the player. - -SCRIPT_GUI_CONSTANT_Y_NAME = §7Constant §ey -SCRIPT_GUI_CONSTANT_Y_LORE = §ey§7 position of the player. - -SCRIPT_GUI_CONSTANT_Z_NAME = §7Constant §ez -SCRIPT_GUI_CONSTANT_Z_LORE = §ez§7 position of the player. - -SCRIPT_GUI_CONSTANT_NAME_NAME = §7Constant §ename -SCRIPT_GUI_CONSTANT_NAME_LORE = §eDisplay§7 name of the player. - -SCRIPT_GUI_CONSTANT_SNEAK_NAME = §7Constant §esneaking -SCRIPT_GUI_CONSTANT_SNEAK_LORE = §etrue§7 if the player is sneaking. - -SCRIPT_GUI_CONSTANT_SPRINTING_NAME = §7Constant §esprinting -SCRIPT_GUI_CONSTANT_SPRINTING_LORE = §etrue§7 is the player is sprinting. - -SCRIPT_GUI_CONSTANT_SLOT_NAME = §7Constant §eslot -SCRIPT_GUI_CONSTANT_SLOT_LORE = §e0-8§7 for the selected slot. - -SCRIPT_GUI_CONSTANT_SLOT_MATERIAL_NAME = §7Constant §eslotmaterial -SCRIPT_GUI_CONSTANT_SLOT_MATERIAL_LORE = §eMaterial§7 of the item in the current slot - -SCRIPT_GUI_CONSTANT_OFF_HAND_MATERIAL_NAME = §7Constant §eoffhandmaterial -SCRIPT_GUI_CONSTANT_OFF_HAND_MATERIAL_LORE = §eMaterial§7 of the item in the off hand - -SCRIPT_GUI_CONSTANT_SLOT_MATERIAL_DISPLAY_NAME = §7Constant §ematerialname -SCRIPT_GUI_CONSTANT_SLOT_MATERIAL_DISPLAY_LORE = §eName§7 of the item in the current slot - -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_LORE = §eregion type§7 of the current region - -SCRIPT_GUI_CONSTANT_REGION_NAME_NAME = §7Constant §eregion_name -SCRIPT_GUI_CONSTANT_REGION_NAME_LORE = §eregion name§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 +SCRIPT_MENU_GUI_ENTER_NAME = §eEnter a name # Shield Printing +SHIELD_PRINTING_HELP_START = §8/§eshieldprinting start §8- §7Starts the shield printing +SHIELD_PRINTING_HELP_COPY = §8/§eshieldprinting copy §8- §7Copies the shield configuration +SHIELD_PRINTING_HELP_APPLY = §8/§eshieldprinting apply §8- §7Applies the shield configuration +SHIELD_PRINTING_HELP_STOP = §8/§eshieldprinting stop §8- §7Stops the shield printing +SHIELD_PRINTING_HELP_STEP_1 = §81. §7Paste the schematic you want to use +SHIELD_PRINTING_HELP_STEP_2 = §82. §7Start the shield printing with §8/§eshieldprinting start +SHIELD_PRINTING_HELP_STEP_3 = §83. §7Wait until the shield printing is finished +SHIELD_PRINTING_HELP_STEP_4 = §84. §7Edit the shields if necessary +SHIELD_PRINTING_HELP_STEP_5 = §85. §7Copy the shields printing with §8/§eshieldprinting copy +SHIELD_PRINTING_HELP_STEP_6 = §86. §7Paste the original schematic +SHIELD_PRINTING_HELP_STEP_7 = §87. §7Apply the shield printing with §8/§eshieldprinting apply + SHIELD_PRINTING_NO_REGION = §cYou are not in a region. SHIELD_PRINTING_NOT_RUNNING = §cThe shield printing is not running. SHIELD_PRINTING_DISALLOWED = §cYou are not allowed to use shield printing here. @@ -689,26 +429,16 @@ KILLCHECKER_BOSSBAR = §e§l{0} §7(§e{1}%§7) §e§l{2}§7 cannons BLOCK_COUNTER_HELP_TOGGLE = §8/§eblockcounter §8- §7Toggle on/off BLOCK_COUNTER_HELP_ENABLE = §8/§eblockcounter enable §8- §7Toggles BlockCounter on BLOCK_COUNTER_HELP_DISABLE = §8/§eblockcounter disable §8- §7Toggles BlockCounter off -BLOCK_COUNTER_MESSAGE = §7Counter §8> §e{0} §7Blocks §e{1} §7TNT §e{2} §7Blocks/TNT §e{3} §7Blocks/tick -BLOCK_COUNTER_MESSAGE_SECOND = §7Counter §8> §e{0} §7Blocks §e{1} §7TNT §e{2} §7Blocks/TNT §e{3} §7Blocks/s +BLOCK_COUNTER_MESSAGE = §7Damage §8> §e{0} §7Blocks §e{1} §7TNT §e{2} §7Blocks/TNT §e{3} §7Blocks/tick +BLOCK_COUNTER_MESSAGE_SECOND = §7Damage §8> §e{0} §7Blocks §e{1} §7TNT §e{2} §7Blocks/TNT §e{3} §7Blocks/s BLOCK_COUNTER_ENABLE = §7BlockCounter activated BLOCK_COUNTER_DISABLE = §7BlockCounter deactivated # DepthCounter -DEPTH_COUNTER_COMMAND_ENABLE_HELP = §8/§edepthcounter enable §8- §7Activate the depth-counter -DEPTH_COUNTER_COMMAND_DISABLE_HELP = §8/§edepthcounter disable §8- §7Deactivate the depth-counter -DEPTH_COUNTER_COMMAND_INFO_HELP = §8/§edepthcounter info §8- §7Lists active counting modes -DEPTH_COUNTER_COMMAND_TOGGLE_HELP = §8/§edepthcounter toggle §8<§7CountMode§8> §8- §7Toggle counting modes -DEPTH_COUNTER_ENABLE_MESSAGE = §7You activated the depth-counter -DEPTH_COUNTER_DISABLE_MESSAGE = §7You deactivated the depth-counter -DEPTH_COUNTER_ACTIVE_MESSAGE = §7Active couting modes: §e{0}§8. -DEPTH_COUNTER_MESSAGE = §7Damage §8> §7{0} -DEPTH_COUNTER_HIGHLIGHT = §e -DEPTH_COUNTER_SEPARATOR = §7 §7 -DEPTH_COUNTER_X = X: {0} -DEPTH_COUNTER_Y = Y: {0} -DEPTH_COUNTER_Z = Z: {0} -DEPTH_COUNTER_TNT = §7TNT§8: §e{0} +DEPTH_COUNTER_MESSAGE = §7Depth §8> §7 +DEPTH_COUNTER_COUNT = {0}{1}§8×{2}{3}§8×{4}{5} +DEPTH_COUNTER_HOVER = §7X§8ק7Y§8ק7Z +DEPTH_COUNTER_TNT = §7 TNT§8: §e{0} # TPSLimit TICK_STEP_HELP = §8/§etick step §8<§7Ticks§8> §8- §7Step n ticks @@ -751,7 +481,6 @@ TRACE_MESSAGE_ISOLATE = §aTNT-positions isolated TRACE_MESSAGE_UNISOLATE = §cTNT-positions hidden TRACE_MESSAGE_CLICK_ISOLATE = §eClick to §aisolate§8/§cunisolate TRACE_MESSAGE_DISALLOWED = §cYou are not allowed to use the TNT-Tracer here -TRACE_MESSAGE_NO_REGION = §cYou are not in a region TRACE_COMMAND_HELP_START = §8/§etrace start §8- §7Starts recording of all TNT-positions TRACE_COMMAND_HELP_SINGLE = §8/§etrace single §8- §7Starts a single recording of all TNT-positions diff --git a/BauSystem_Main/src/BauSystem_de.properties b/BauSystem_Main/src/BauSystem_de.properties index 83eb053e..7cdaa440 100644 --- a/BauSystem_Main/src/BauSystem_de.properties +++ b/BauSystem_Main/src/BauSystem_de.properties @@ -226,296 +226,34 @@ GUI_EDITOR_ITEM_CLOSE=§eSchließen 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_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_FOURTH_ARG_NOVALUE = §cDas vierte Argument fehlt und sollte ein Wert sein - -SCRIPT_COMMAND_ERROR_BOOLEAN_COMPARE = §cNur Booleans können verglichen werden -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_ERROR = §cNur Zahlen können addiert werden -SCRIPT_COMMAND_ARITHMETIC_DIV_ERROR = §cNur Zahlen können dividiert werden -SCRIPT_COMMAND_ARITHMETIC_MUL_ERROR = §cNur Zahlen können multipliziert werden -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> -SCRIPT_COMMAND_ARITHMETIC_OTHER_CEIL_HELP_3 = Aufrunden der zweiten Zahl und schreibt es in die erste oder aufrunden der zweiten Zahl auf die Nachkommastellenanzahl aus der dritten Zahl und schreibt es in die erste. -SCRIPT_COMMAND_ARITHMETIC_OTHER_CEIL_ERROR_1 = §cNur Fließ-Komma-Zahlen können aufgerundet werden -SCRIPT_COMMAND_ARITHMETIC_OTHER_CEIL_ERROR_2 = §cEs kann nur auf ganze Nachkommastellen gerundet werden - -SCRIPT_COMMAND_ARITHMETIC_OTHER_FLOOR_HELP_1 = §efloor §8<§7Variable§8> §8<§7Variable§8|§7Wert§8> -SCRIPT_COMMAND_ARITHMETIC_OTHER_FLOOR_HELP_2 = §efloor §8<§7Variable§8> §8<§7Variable§8|§7Wert§8> §8<§7Variable§8|§7Wert§8> -SCRIPT_COMMAND_ARITHMETIC_OTHER_FLOOR_HELP_3 = Abrunden der zweiten Zahl und schreibt es in die erste oder abrunden der zweiten Zahl auf die Nachkommastellenanzahl aus der dritten Zahl und schreibt es in die erste. -SCRIPT_COMMAND_ARITHMETIC_OTHER_FLOOR_ERROR_1 = §cNur Fließ-Komma-Zahlen können abgerundet werden -SCRIPT_COMMAND_ARITHMETIC_OTHER_FLOOR_ERROR_2 = §cEs kann nur auf ganze Nachkommastellen gerundet werden - -SCRIPT_COMMAND_ARITHMETIC_OTHER_ROUND_HELP_1 = §eround §8<§7Variable§8> §8<§7Variable§8|§7Wert§8> -SCRIPT_COMMAND_ARITHMETIC_OTHER_ROUND_HELP_2 = §eround §8<§7Variable§8> §8<§7Variable§8|§7Wert§8> §8<§7Variable§8|§7Wert§8> -SCRIPT_COMMAND_ARITHMETIC_OTHER_ROUND_HELP_3 = Runden der zweiten Zahl und schreibt es in die erste oder runden der zweiten Zahl auf die Nachkommastellenanzahl aus der dritten Zahl und schreibt es in die erste. -SCRIPT_COMMAND_ARITHMETIC_OTHER_ROUND_ERROR_1 = §cNur Fließ-Komma-Zahlen können gerundet werden -SCRIPT_COMMAND_ARITHMETIC_OTHER_ROUND_ERROR_2 = §cEs kann nur auf ganze Nachkommastellen gerundet werden - -SCRIPT_COMMAND_IO_ECHO_HELP_1 = §eecho §8<§7Wert§8> -SCRIPT_COMMAND_IO_ECHO_HELP_2 = §7Schreibe etwas dem Spieler. Wenn kein Wert angegeben wurde ist die Nachricht leer. -SCRIPT_COMMAND_IO_ECHO_MESSAGE = §f{0} - -SCRIPT_COMMAND_IO_ECHOACTIONBAR_HELP_1 = §eechoactionbar §8<§7Wert§8> -SCRIPT_COMMAND_IO_ECHOACTIONBAR_HELP_2 = §7Schreibe etwas dem Spieler in der ActionBar. Wenn kein Wert angegeben wurde ist die Nachricht leer. - -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_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_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. - -SCRIPT_COMMAND_STRING_REPLACE_HELP_1 = §ereplace §8<§7Variable§8> §8<§7Von Variable§8> §8<§7Zu Variable§8> -SCRIPT_COMMAND_STRING_REPLACE_HELP_2 = §ereplace §8<§7Variable§8> §8<§7Variable§8> §8<§7Von Variable§8> §8<§7Zu Variable§8> -SCRIPT_COMMAND_STRING_REPLACE_HELP_3 = Ersetzte eine Zeichenkette aus dem Ursprung mit einer neuen Zeichenkette. Dies ersetzt nicht nur die erste Stelle sondern alle. - -SCRIPT_COMMAND_STRING_SUBSTRING_HELP_1 = §esubstring §8<§7Variable§8> §8<§7Zahl§8> -SCRIPT_COMMAND_STRING_SUBSTRING_HELP_2 = §esubstring §8<§7Variable§8> §8<§7Variable§8> §8<§7Zahl§8> -SCRIPT_COMMAND_STRING_SUBSTRING_HELP_3 = Kürze einen String entweder vorne oder hinter, je nachdem ob die Zahl positiv (vorne) oder negativ (hinten) ist. - -SCRIPT_COMMAND_VARIABLE_CONST_HELP_1 = §econst §8<§7Variable§8> §8[§7Value§8(§7s§8)§8] -SCRIPT_COMMAND_VARIABLE_CONST_HELP_2 = Schreibt in eine Konstante einen Wert rein, welcher eine Zahl sein kann, ein Boolscher Wert oder ein Text. - -SCRIPT_COMMAND_VARIABLE_CONVERT_HELP_1 = §econvert §8<§7Variable§8> §8<§7Value§8> -SCRIPT_COMMAND_VARIABLE_CONVERT_HELP_2 = Konvertiere den Value zu 'number' wenn es eine Zahl ist, oder zu 'boolean' bei 'true' oder 'false' und behalte 'text' bei wenn nichts zutrifft. - -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_UNGLOBAL_HELP_1 = §eunglobal §8<§7Variable§8> -SCRIPT_COMMAND_VARIABLE_UNGLOBAL_HELP_2 = Lösche eine Globale variable. - -SCRIPT_COMMAND_VARIABLE_UNVAR_HELP_1 = §eunvar §8<§7Variable§8> -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_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. - -SCRIPT_COMMAND_WORLD_SETMATERIAL_HELP_1 = §esetmaterial §8<§7Variable§8> §8<§7Zahl§8> §8<§7Zahl§8> §8<§7Zahl§8> -SCRIPT_COMMAND_WORLD_SETMATERIAL_HELP_2 = Setzt an einem Block in der Welt das Material der ersten Variable. - -SCRIPT_COMMAND_EXIT_HELP_1 = §eexit -SCRIPT_COMMAND_EXIT_HELP_2 = Beendet das ausführen des Scripts. - -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 = §7Springe zu ersten Stelle, wenn der Wert true ist. Oder zu dem zweiten, wenn dies nicht der fall ist. - -SCRIPT_COMMAND_JUMP_HELP_1 = §ejump §8<§7Jump-Point§8> -SCRIPT_COMMAND_JUMP_HELP_2 = §7Springe zu einer anderen Zeile. Hierbei ist ein Jump-Point eine Zeile mit §8'§7.§8'§7 vor. -SCRIPT_COMMAND_JUMP_ERROR = §cDer Jump-Point ({0}) ist nicht definiert. - -SCRIPT_COMMAND_CALL_HELP_1 = §ecall §8<§7Jump-Point§8> -SCRIPT_COMMAND_CALL_HELP_2 = §7Springe zu einer anderen Zeile. Hierbei ist ein Jump-Point eine Zeile mit §8'§7.§8'§7 vor. Hierbei wird auf den ReturnStack die jetzige Zeile geschrieben, dahin kann man wieder mit 'return' zurück springen. -SCRIPT_COMMAND_CALL_ERROR = §cDer Jump-Point ({0}) ist nicht definiert. - -SCRIPT_COMMAND_RETURN_HELP_1 = §ereturn -SCRIPT_COMMAND_RETURN_HELP_2 = §7Springe zum letzten 'call' Befehl. -SCRIPT_COMMAND_RETURN_ERROR = §cEs wurde kein 'call' Befehl ausgeführt - -SCRIPT_COMMAND_SLEEP_HELP_1 = §esleep §8<§7Time§8> -SCRIPT_COMMAND_SLEEP_HELP_2 = Pausiert das Ausführen des Scripts. Das erste Argument ist in GameTicks. -SCRIPT_COMMAND_SLEEP_ERROR = §cDie Zeit muss eine Zahl großer 0 sein. - -## GUI -SCRIPT_GUI_ITEM_NAME = §eScript Hilfe - ## CustomScript -SCRIPT_HOTKEY_ITEM_NAME = §7Hotkey§8: §e{0} §8-§7 {1} -SCRIPT_EVENT_ITEM_NAME = §7Event§8: §e{0} §8-§7 {1} -SCRIPT_COMMAND_ITEM_NAME = §7Command§8: §e{0} +SCRIPT_HOTKEY_ITEM_NAME = §7Hotkey§8: §e{0} +SCRIPT_EVENT_ITEM_NAME = §7Event§8: §e{0} +SCRIPT_COMMAND_ITEM_NAME = §7Befehl§8: §e/{0} +SCRIPT_ERROR_ONLY_IN_GLOBAL=§cDieses Skript kann nur als globales Skript ausgeführt werden ## Script Menu GUI SCRIPT_MENU_GUI_ITEM_LORE_1 = §7Klicke zum rausnehmen -SCRIPT_MENU_GUI_ITEM_LORE_2 = §7Shift Klicke zum kopieren -SCRIPT_MENU_GUI_NAME = §eScript Commands {0}{1}§7% +SCRIPT_MENU_GUI_ITEM_LORE_2 = §7Shiftklick zum kopieren +SCRIPT_MENU_GUI_ITEM_LORE_3 = §7Rechtsklick zum editieren +SCRIPT_MENU_GUI_ITEM_LORE_4 = §7Mittelklick zum anschauen +SCRIPT_MENU_GUI_NAME = §eSkript-Menü SCRIPT_MENU_GUI_ITEM_ADD_NAME = §eHinzufügen SCRIPT_MENU_GUI_ITEM_ADD_LORE = §7Klicke mit einem Buch zum hinzufügen -SCRIPT_MENU_GUI_DUPLICATE_COMMAND = §cCommand '{0}' bereits definiert -SCRIPT_MENU_GUI_UNKNOWN_EVENT = §cEvent '{0}' ist nicht definierbar -SCRIPT_MENU_GUI_LIMIT = §cScript-Buch Limit erreicht - -## ScriptCommand -SCRIPT_COMMAND_HELP = §8/§escript §8- §7Öffnet die ScriptGUI -SCRIPT_COMMAND_HELP_MENU = §8/§escript menu §8- §7Öffnet die ScriptMenuGUI für Custom Command bauübergreifend - -## Script GUI -SCRIPT_GUI_NAME = Script Elements -SCRIPT_GUI_COMMAND_CHAT = §eScript Command§8: §e{0} - -SCRIPT_GUI_CUSTOM_HOTKEYS = §eCustom Hotkeys -SCRIPT_GUI_CUSTOM_HOTKEYS_COMMANDS_LORE_1 = §7Schreibe§8: §e#!HOTKEY 'Char' -SCRIPT_GUI_CUSTOM_HOTKEYS_COMMANDS_LORE_2 = §7am Anfang eines Skript Buches, um einen benutzerdefinierten Hotkey zu verwenden. Das 'Char' kann ein beliebiges Zeichen zwischen '§eA§7' und '§eZ§7' sowie '§e0§7' und '§e9§7' sein. Während der Ausführung sind zwei Variablen verfügbar: §epressed§7, §ereleased§7 -SCRIPT_GUI_CUSTOM_HOTKEYS_COMMANDS_LORE_3 = §7Sie können dem Hotkey Modifikatoren wie "SHIFT", "CTRL", "ALT" oder "META" hinzufügen. §7Beispiel: §e#!HOTKEY SHIFT+A -SCRIPT_GUI_CUSTOM_HOTKEYS_COMMANDS_LORE_4 = §7 -SCRIPT_GUI_CUSTOM_HOTKEYS_COMMANDS_LORE_5 = §cDies kann nur in Verbindung mit den Fabric-Mod: §eAdvancedScripts §7runterladbar unter §ehttps://steamwar.de/downloads §cverwendet werden. - -SCRIPT_GUI_CUSTOM_COMMANDS = §eCustom Commands -SCRIPT_GUI_CUSTOM_COMMANDS_LORE_1 = §7Schreibe§8: §e#!CMD 'COMMAND' -SCRIPT_GUI_CUSTOM_COMMANDS_LORE_2 = §7an den Anfang eines Script Buches um ein Custom Command zu nutzen. Der Befehl startet immer mit §e/§7 und kann dann so aufgebaut sein wie du willst. Alles was in Spitzen Klammern steht '§e<>§7' wird als Parameter und somit als Variable gewertet. Parameter, welche in runden Klammern stehen sind Optional. Einfache Texte als Parameter bekommen eine gleichnamige Variable mit true/false als Wert je nachdem ob dieser angegeben wurde oder nicht - -SCRIPT_GUI_CUSTOM_EVENTS = §eCustom Events -SCRIPT_GUI_CUSTOM_EVENTS_LORE_1 = §7Schreibe§8: §e#!EVENT 'EventName' -SCRIPT_GUI_CUSTOM_EVENTS_LORE_2 = §7an den Anfang eines Script Buches um ein Custom Event zu nutzen. Jedes Event kann durch 'var cancel true' gecancelt werden. Hinter dem Event Namen stehen die Variablen, welche im Script durch das Event nutztbar sind. -SCRIPT_GUI_CUSTOM_EVENTS_LORE_3 = §7Nutzbare Events sind: -SCRIPT_GUI_CUSTOM_EVENTS_LORE_4 = §eFF -SCRIPT_GUI_CUSTOM_EVENTS_LORE_5 = §ePlaceBlock §8-§7 blockX, blockY, blockZ, blockType -SCRIPT_GUI_CUSTOM_EVENTS_LORE_6 = §eBreakBlock §8-§7 blockX, blockY, blockZ, blockType -SCRIPT_GUI_CUSTOM_EVENTS_LORE_7 = §eRightClick §8-§7 blockInHand, action, handType, -SCRIPT_GUI_CUSTOM_EVENTS_LORE_8 = §7 hasBlock §8[§7blockX, blockY, blockZ, blockFace§8]§e* -SCRIPT_GUI_CUSTOM_EVENTS_LORE_9 = §eLeftClick §8-§7 blockInHand, action, handType, -SCRIPT_GUI_CUSTOM_EVENTS_LORE_10 = §7 hasBlock §8[§7blockX, blockY, blockZ, blockFace§8]§e* -SCRIPT_GUI_CUSTOM_EVENTS_LORE_11 = §eTNTSpawn -SCRIPT_GUI_CUSTOM_EVENTS_LORE_12 = §eTNTExplode §8-§7 x, y, z -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 = §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} - -SCRIPT_GUI_CUSTOM_VARIABLES = §eCustom Variables - -SCRIPT_GUI_CONSTANT_TIME_NAME = §7Constant §etime -SCRIPT_GUI_CONSTANT_TIME_LORE = §7Formattierte Uhrzeit - -SCRIPT_GUI_CONSTANT_TICKS_NAME = §7Constant §eticks -SCRIPT_GUI_CONSTANT_TICKS_LORE = §7Ticks seit dem Serverstart - -SCRIPT_GUI_CONSTANT_TRACE_NAME = §7Constant §etrace -SCRIPT_GUI_CONSTANT_TRACE_LORE = §etrue§7 wenn gerade der Tracer an ist. - -SCRIPT_GUI_CONSTANT_AUTO_TRACE_NAME = §7Constant §eautotrace -SCRIPT_GUI_CONSTANT_AUTO_TRACE_LORE = §etrue§7 wenn gerade der AutoTracer an ist. - -SCRIPT_GUI_CONSTANT_TRACE_STATUS_NAME = §7Constant §etrace_status -SCRIPT_GUI_CONSTANT_TRACE_STATUS_LORE = §7Ein Wert von: §eOFF§8, §eIDLE§8, §eIDLE_AUTO_EXPLODE§8, §eIDLE_AUTO_IGNITE§8, §eIDLE_SINGLE - -SCRIPT_GUI_CONSTANT_TRACE_TIME_NAME = §7Constant §etrace_time -SCRIPT_GUI_CONSTANT_TRACE_TIME_LORE = §e0§7 wenn gerade kein TNT getraced wird, ansonsten die Zeit in Ticks seit dem Start des Tracers. - -SCRIPT_GUI_CONSTANT_LOADER_STATUS_NAME = §7Constant §eloader_status -SCRIPT_GUI_CONSTANT_LOADER_STATUS_LORE = §7Ein Wert von: §eOFF§8, §eSETUP§8, §eRUNNING§8, §eSINGLE§8, §ePAUSE§8, §eEND - -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_LORE = §etrue§7 wenn TNT Nur Testblock an ist. - -SCRIPT_GUI_CONSTANT_FREEZE_NAME = §7Constant §efreeze -SCRIPT_GUI_CONSTANT_FREEZE_LORE = §etrue§7 wenn Freeze nicht ausgeschaltet ist. - -SCRIPT_GUI_CONSTANT_FIRE_NAME = §7Constant §efire -SCRIPT_GUI_CONSTANT_FIRE_LORE = §etrue§7 wenn Fire nicht ausgeschaltet ist. - -SCRIPT_GUI_CONSTANT_PROTECT_NAME = §7Constant §eprotect -SCRIPT_GUI_CONSTANT_PROTECT_LORE = §etrue§7 wenn Protect angeschaltet ist. - -SCRIPT_GUI_CONSTANT_X_NAME = §7Constant §ex -SCRIPT_GUI_CONSTANT_X_LORE = §ex§7 Position des Spielers. - -SCRIPT_GUI_CONSTANT_Y_NAME = §7Constant §ey -SCRIPT_GUI_CONSTANT_Y_LORE = §ey§7 Position des Spielers. - -SCRIPT_GUI_CONSTANT_Z_NAME = §7Constant §ez -SCRIPT_GUI_CONSTANT_Z_LORE = §ez§7 Position des Spielers. - -SCRIPT_GUI_CONSTANT_NAME_NAME = §7Constant §ename -SCRIPT_GUI_CONSTANT_NAME_LORE = §eDisplay§7 Name des Spielers. - -SCRIPT_GUI_CONSTANT_SNEAK_NAME = §7Constant §esneaking -SCRIPT_GUI_CONSTANT_SNEAK_LORE = §etrue§7 wenn der Spieler gerade sneakt. - -SCRIPT_GUI_CONSTANT_SPRINTING_NAME = §7Constant §esprinting -SCRIPT_GUI_CONSTANT_SPRINTING_LORE = §etrue§7 wenn der Spieler gerade rennt. - -SCRIPT_GUI_CONSTANT_SLOT_NAME = §7Constant §eslot -SCRIPT_GUI_CONSTANT_SLOT_LORE = §e0-8§7 für den ausgewählten slot. - -SCRIPT_GUI_CONSTANT_SLOT_MATERIAL_NAME = §7Constant §eslotmaterial -SCRIPT_GUI_CONSTANT_SLOT_MATERIAL_LORE = §eMaterial§7 des Items im Slot - -SCRIPT_GUI_CONSTANT_OFF_HAND_MATERIAL_NAME = §7Constant §eoffhandmaterial -SCRIPT_GUI_CONSTANT_OFF_HAND_MATERIAL_LORE = §eMaterial§7 des Items in der Off Hand - -SCRIPT_GUI_CONSTANT_SLOT_MATERIAL_DISPLAY_NAME = §7Constant §ematerialname -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_LORE = §eRegionstype§7 der jetztigen Region - -SCRIPT_GUI_CONSTANT_REGION_NAME_NAME = §7Constant §eregion_name -SCRIPT_GUI_CONSTANT_REGION_NAME_LORE = §eRegionsname§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 - # Shield Printing +SHIELD_PRINTING_HELP_START = §8/§eshieldprinting start §8- §7Starte das Schild drucken +SHIELD_PRINTING_HELP_COPY = §8/§eshieldprinting copy §8- §7Kopiert die Schilder +SHIELD_PRINTING_HELP_APPLY = §8/§eshieldprinting apply §8- §7Wendet die Schilder an +SHIELD_PRINTING_HELP_STOP = §8/§eshieldprinting stop §8- §7Stoppt das Schild drucken +SHIELD_PRINTING_HELP_STEP_1 = §81. §7Füge die Schematic in die Welt ein +SHIELD_PRINTING_HELP_STEP_2 = §82. §7Starte das Schild drucken mit §8/§eshieldprinting start +SHIELD_PRINTING_HELP_STEP_3 = §83. §7Warte bis alle Schilde ausgefahren sind +SHIELD_PRINTING_HELP_STEP_4 = §84. §7Editiere die Schilde wenn nötig +SHIELD_PRINTING_HELP_STEP_5 = §85. §7Kopiere das gedruckte mit §8/§eshieldprinting copy +SHIELD_PRINTING_HELP_STEP_6 = §86. §7Füge die originale Schematic wieder ein +SHIELD_PRINTING_HELP_STEP_7 = §87. §7Wende das gedruckte mit §8/§eshieldprinting apply§7 an + SHIELD_PRINTING_NO_REGION = §cDu bist in keiner Region. SHIELD_PRINTING_NOT_RUNNING = §cShield printing ist nicht aktiv. SHIELD_PRINTING_DISALLOWED = §cDu darfst Shield printing nicht benutzen. @@ -523,7 +261,7 @@ SHIELD_PRINTING_BOSSBAR = §fBewegungen: {0} SHIELD_PRINTING_BOSSBAR_COPIED = §fBewegungen: {0} Kopiert: {1} SHIELD_PRINTING_START = §aShield printing wurde gestartet. -SHIELD_PRINTING_COPY = §aSchilde wurden kopiert. +SHIELD_PRINTING_COPY = §aSchilde wurden kopiert. SHIELD_PRINTING_APPLY = §aSchilde wurden angewendet. SHIELD_PRINTING_STOP = §aShield printing wurde gestoppt. @@ -661,26 +399,13 @@ KILLCHECKER_BOSSBAR = §e§l{0} §7(§e{1}%§7) §e§l{2}§7 Kanonnen BLOCK_COUNTER_HELP_TOGGLE = §8/§eblockcounter §8- §7Wechsel zwischen an und aus BLOCK_COUNTER_HELP_ENABLE = §8/§eblockcounter enable §8- §7Schalte den BlockCounter an BLOCK_COUNTER_HELP_DISABLE = §8/§eblockcounter disable §8- §7Schalte den BlockCounter aus -BLOCK_COUNTER_MESSAGE = §7Counter §8> §e{0} §7Blöcke §e{1} §7TNT §e{2} §7Blöcke/TNT §e{3} §7Blöcke/tick -BLOCK_COUNTER_MESSAGE_SECOND = §7Counter §8> §e{0} §7Blöcke §e{1} §7TNT §e{2} §7Blöcke/TNT §e{3} §7Blöcke/s +BLOCK_COUNTER_MESSAGE = §7Schaden §8> §e{0} §7Blöcke §e{1} §7TNT §e{2} §7Blöcke/TNT §e{3} §7Blöcke/tick +BLOCK_COUNTER_MESSAGE_SECOND = §7Schaden §8> §e{0} §7Blöcke §e{1} §7TNT §e{2} §7Blöcke/TNT §e{3} §7Blöcke/s BLOCK_COUNTER_ENABLE = §7BlockCounter angemacht BLOCK_COUNTER_DISABLE = §7BlockCounter ausgemacht # DepthCounter -DEPTH_COUNTER_COMMAND_ENABLE_HELP = §8/§edepthcounter enable §8- §7Aktiviere den Tiefenzähler -DEPTH_COUNTER_COMMAND_DISABLE_HELP = §8/§edepthcounter disable §8- §7Deaktiviere den Tiefenzähler -DEPTH_COUNTER_COMMAND_INFO_HELP = §8/§edepthcounter info §8- §7Zähle aktive Zählmodi auf -DEPTH_COUNTER_COMMAND_TOGGLE_HELP = §8/§edepthcounter toggle §8<§7CountMode§8> §8- §7Stelle einzelne Zählmodi ein -DEPTH_COUNTER_ENABLE_MESSAGE = §7Du hast den Tiefenzähler aktiviert. -DEPTH_COUNTER_DISABLE_MESSAGE = §7Du hast den Tiefenzähler deaktiviert. -DEPTH_COUNTER_ACTIVE_MESSAGE = §7Aktive Zählmodi: §e{0}§8. -DEPTH_COUNTER_MESSAGE = §7Schaden §8> §7{0} -DEPTH_COUNTER_HIGHLIGHT = §e -DEPTH_COUNTER_SEPARATOR = §7 §7 -DEPTH_COUNTER_X = X: {0} -DEPTH_COUNTER_Y = Y: {0} -DEPTH_COUNTER_Z = Z: {0} -DEPTH_COUNTER_TNT = §7TNT§8: §e{0} +DEPTH_COUNTER_MESSAGE = §7Tiefe §8> §7 # TPSLimit TICK_STEP_HELP = §8/§etick step §8<§7Ticks§8> §8- §7Spule n Ticks vor @@ -723,7 +448,6 @@ TRACE_MESSAGE_ISOLATE = §aTNT-Positionen isoliert TRACE_MESSAGE_UNISOLATE = §cTNT-Positionen ausgeblendet TRACE_MESSAGE_CLICK_ISOLATE = §eKlicken zum §aisolieren§8/§causblenden TRACE_MESSAGE_DISALLOWED = §cDu darfst hier nicht den TNT-Tracer nutzen -TRACE_MESSAGE_NO_REGION = §cDu bist in keiner Region TRACE_COMMAND_HELP_START = §8/§etrace start §8- §7Startet die Aufnahme aller TNT-Positionen TRACE_COMMAND_HELP_SINGLE = §8/§etrace single §8- §7Startet eine einzelne Aufnahme aller TNT-Positionen @@ -1293,7 +1017,7 @@ WARP_EXISTS=§7Ein Warp mit dem namen §e{0} §7existiert bereits WARP_NAME_RESERVED=§7Du kannst nicht §c{0} §7als name für einen Warp nutzen WARP_CREATED=§7Der Warp §e{0} §7wurde erstellt WARP_DELETE_HOVER=§e{0} §7löschen -WARP_DELETED=§e{0} §7wurde gelöcht +WARP_DELETED=§e{0} §7wurde gelöscht WARP_TELEPORT_HOVER=§7Zu §e{0} §7teleportieren WARP_MATERIAL_CHOOSE=Material auswählen WARP_GUI_NAME=Warps diff --git a/BauSystem_Main/src/de/steamwar/bausystem/BauSystem.java b/BauSystem_Main/src/de/steamwar/bausystem/BauSystem.java index 1d1e6362..0d38af4e 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/BauSystem.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/BauSystem.java @@ -21,6 +21,11 @@ package de.steamwar.bausystem; import com.comphenix.tinyprotocol.TinyProtocol; import de.steamwar.bausystem.configplayer.Config; +import de.steamwar.bausystem.features.tpslimit.FreezeUtils; +import de.steamwar.bausystem.features.tpslimit.TPSLimitUtils; +import de.steamwar.bausystem.features.tpslimit.TPSUtils; +import de.steamwar.bausystem.features.tpslimit.TPSWarpUtils; +import de.steamwar.bausystem.features.world.RamUsage; import de.steamwar.bausystem.region.loader.PrototypeLoader; import de.steamwar.bausystem.region.loader.RegionLoader; import de.steamwar.bausystem.region.loader.Updater; @@ -31,11 +36,16 @@ import lombok.Getter; import org.bukkit.Bukkit; import org.bukkit.World; import org.bukkit.event.Listener; +import org.bukkit.plugin.Plugin; import org.bukkit.plugin.java.JavaPlugin; +import org.bukkit.scheduler.BukkitRunnable; +import org.bukkit.scheduler.BukkitTask; import java.io.IOException; import java.io.OutputStream; import java.io.PrintStream; +import java.util.concurrent.atomic.AtomicReference; +import java.util.function.Consumer; import java.util.logging.Level; public class BauSystem extends JavaPlugin implements Listener { @@ -73,6 +83,7 @@ public class BauSystem extends JavaPlugin implements Listener { new Updater(RegionLoader.file, RegionLoader::load); LinkageUtils.link(); + RamUsage.init(); // This could disable any watchdog stuff. We need to investigate if this is a problem. /* @@ -121,4 +132,45 @@ public class BauSystem extends JavaPlugin implements Listener { } })); } + + public static BukkitTask runTaskLater(Plugin plugin, Runnable runnable, long delay) { + return new BukkitRunnable() { + private int counter = 1; + + @Override + public void run() { + if (FreezeUtils.isFrozen()) return; + if (counter >= delay) { + runnable.run(); + cancel(); + return; + } + counter++; + } + }.runTaskTimer(plugin, 0, 1); + } + + public static BukkitTask runTaskTimer(Plugin plugin, Runnable runnable, long delay, long period) { + return new BukkitRunnable() { + private int counter = 1; + private boolean first = true; + + @Override + public void run() { + if (FreezeUtils.isFrozen()) return; + if (counter >= (first ? delay : period)) { + first = false; + runnable.run(); + counter = 1; + return; + } + counter++; + } + }.runTaskTimer(plugin, 0, 1); + } + + public static void runTaskTimer(Plugin plugin, Consumer consumer, long delay, long period) { + AtomicReference task = new AtomicReference<>(); + task.set(runTaskTimer(plugin, () -> consumer.accept(task.get()), delay, period)); + } } \ No newline at end of file diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/autostart/AutostartListener.java b/BauSystem_Main/src/de/steamwar/bausystem/features/autostart/AutostartListener.java index 8d254a3a..66f53359 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/autostart/AutostartListener.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/autostart/AutostartListener.java @@ -88,7 +88,7 @@ public class AutostartListener implements Listener { } else { BauSystem.MESSAGE.send("AUTOSTART_MESSAGE_START", player); } - regionStartTime.put(region, TPSUtils.currentTick.get()); + regionStartTime.put(region, TPSUtils.currentRealTick.get()); } @EventHandler @@ -101,7 +101,7 @@ public class AutostartListener implements Listener { if (!regionStartTime.containsKey(region)) return; if (!region.hasType(RegionType.TESTBLOCK)) return; if (!region.inRegion(block.getLocation(), RegionType.TESTBLOCK, RegionExtensionType.EXTENSION)) return; - long tickDiff = TPSUtils.currentTick.get() - regionStartTime.remove(region); + long tickDiff = TPSUtils.currentRealTick.get() - regionStartTime.remove(region); RegionUtils.message(region, player -> { return BauSystem.MESSAGE.parse("AUTOSTART_MESSAGE_RESULT1", player, new SimpleDateFormat(BauSystem.MESSAGE.parse("AUTOSTART_MESSAGE_DATE_PATTERN", player)).format(new Date(tickDiff * 50))); }); diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/cannon/CannonDetector.java b/BauSystem_Main/src/de/steamwar/bausystem/features/cannon/CannonDetector.java new file mode 100644 index 00000000..09893fd5 --- /dev/null +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/cannon/CannonDetector.java @@ -0,0 +1,99 @@ +/* + * This file is a part of the SteamWar software. + * + * Copyright (C) 2023 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.cannon; + +import de.steamwar.bausystem.BauSystem; +import de.steamwar.bausystem.features.cannon.depth.Depth; +import de.steamwar.bausystem.features.cannon.depth.DepthManager; +import de.steamwar.bausystem.region.Region; +import de.steamwar.bausystem.region.utils.RegionType; +import de.steamwar.linkage.Linked; +import org.bukkit.Bukkit; +import org.bukkit.entity.TNTPrimed; +import org.bukkit.event.EventHandler; +import org.bukkit.event.Listener; +import org.bukkit.event.entity.EntityExplodeEvent; +import org.bukkit.util.Vector; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +@Linked +public class CannonDetector implements Listener { + + private Map velocities = new HashMap<>(); + + @EventHandler + public void onEntityExplode(EntityExplodeEvent event) { + if (!(event.getEntity() instanceof TNTPrimed)) { + return; + } + + TNTPrimed tnt = (TNTPrimed) event.getEntity(); + DepthManager.update(tnt, event.blockList()); + + List tnts = Bukkit.getWorlds().get(0).getEntitiesByClass(TNTPrimed.class) + .stream() + .filter(entity -> entity != tnt) + .filter(entity -> entity.getFuseTicks() > 1) + .filter(entity -> entity.getLocation().distance(event.getLocation()) <= 8) + .collect(Collectors.toList()); + + if (tnts.isEmpty()) { + return; + } + + boolean isEmpty = velocities.isEmpty(); + tnts.forEach(tntPrimed -> { + velocities.put(tntPrimed, tntPrimed.getVelocity().clone()); + }); + + if (!isEmpty) { + return; + } + + BauSystem.runTaskLater(BauSystem.getInstance(), () -> { + Map> grouped = new HashMap<>(); + velocities.forEach((tntPrimed, vector) -> { + grouped.computeIfAbsent(new CannonKey(round(tntPrimed.getLocation().toVector()), round(vector)), ignored -> new ArrayList<>()).add(tntPrimed); + }); + grouped.forEach((cannonKey, tntPrimeds) -> { + if (tntPrimeds.size() <= 5) return; + Region region = Region.getRegion(tntPrimeds.get(0).getLocation()); + if (region.isGlobal()) return; + if (!region.hasType(RegionType.TESTBLOCK)) return; + Depth depth = new Depth(region); + DepthManager.init(tntPrimeds, depth); + }); + velocities.clear(); + }, 1); + } + + private Vector round(Vector vector) { + vector.multiply(10000); + vector.setX(Math.round(vector.getX())); + vector.setY(Math.round(vector.getY())); + vector.setZ(Math.round(vector.getZ())); + return vector; + } +} diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/cannon/CannonKey.java b/BauSystem_Main/src/de/steamwar/bausystem/features/cannon/CannonKey.java new file mode 100644 index 00000000..73270eab --- /dev/null +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/cannon/CannonKey.java @@ -0,0 +1,33 @@ +/* + * This file is a part of the SteamWar software. + * + * Copyright (C) 2023 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.cannon; + +import lombok.AllArgsConstructor; +import lombok.EqualsAndHashCode; +import lombok.Getter; +import org.bukkit.util.Vector; + +@AllArgsConstructor +@EqualsAndHashCode +@Getter +public final class CannonKey { + private Vector locationVector; + private Vector velocityVector; +} diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/cannon/depth/Depth.java b/BauSystem_Main/src/de/steamwar/bausystem/features/cannon/depth/Depth.java new file mode 100644 index 00000000..506b6e93 --- /dev/null +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/cannon/depth/Depth.java @@ -0,0 +1,110 @@ +/* + * This file is a part of the SteamWar software. + * + * Copyright (C) 2023 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.cannon.depth; + +import de.steamwar.bausystem.BauSystem; +import de.steamwar.bausystem.region.Region; +import de.steamwar.bausystem.region.RegionUtils; +import de.steamwar.bausystem.region.utils.RegionExtensionType; +import de.steamwar.bausystem.region.utils.RegionType; +import net.md_5.bungee.api.chat.BaseComponent; +import net.md_5.bungee.api.chat.HoverEvent; +import net.md_5.bungee.api.chat.TextComponent; +import org.bukkit.block.Block; +import org.bukkit.entity.Player; +import org.bukkit.util.Vector; + +import java.util.HashSet; +import java.util.List; +import java.util.Set; +import java.util.stream.Collectors; + +public class Depth { + + private Region region; + private Vector minVector = null; + private Vector maxVector = null; + private int tntCount = 0; + + public Depth(Region region) { + this.region = region; + } + + public void update(List blocks) { + List blocksList = blocks.stream() + .filter(block -> region.inRegion(block.getLocation(), RegionType.TESTBLOCK, RegionExtensionType.EXTENSION)) + .collect(Collectors.toList()); + if (blocksList.isEmpty()) return; + tntCount++; + for (Block block : blocksList) { + internalUpdate(block); + } + } + + public void finish() { + if (maxVector == null || minVector == null) return; + Vector dimensions = maxVector.subtract(minVector); + dimensions.setX(Math.abs(dimensions.getX())); + dimensions.setY(Math.abs(dimensions.getY())); + dimensions.setZ(Math.abs(dimensions.getZ())); + + RegionUtils.message(region, player -> { + player.spigot().sendMessage(getMessage(player, dimensions.getBlockX() + 1, dimensions.getBlockY() + 1, dimensions.getBlockZ() + 1, tntCount)); + }); + } + + private void internalUpdate(Block block) { + if (minVector == null) { + minVector = block.getLocation().toVector(); + } + minVector.setX(Math.min(minVector.getX(), block.getX())); + minVector.setY(Math.min(minVector.getY(), block.getY())); + minVector.setZ(Math.min(minVector.getZ(), block.getZ())); + + if (maxVector == null) { + maxVector = block.getLocation().toVector(); + } + maxVector.setX(Math.max(maxVector.getX(), block.getX())); + maxVector.setY(Math.max(maxVector.getY(), block.getY())); + maxVector.setZ(Math.max(maxVector.getZ(), block.getZ())); + } + + private static BaseComponent[] getMessage(Player player, int x, int y, int z, int tntCount) { + final Set dimensions = new HashSet<>(); + dimensions.add(x); + dimensions.add(y); + dimensions.add(z); + + int max = getMax(dimensions); + + TextComponent headerComponent = new TextComponent(BauSystem.MESSAGE.parse("DEPTH_COUNTER_MESSAGE", player)); + + TextComponent depthComponent = new TextComponent(BauSystem.MESSAGE.parse("DEPTH_COUNTER_COUNT", player, x == max ? "§e" : "§7", x, y == max ? "§e" : "§7", y, z == max ? "§e" : "§7", z)); + depthComponent.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new TextComponent[]{new TextComponent(BauSystem.MESSAGE.parse("DEPTH_COUNTER_HOVER", player))})); + + TextComponent tntComponent = new TextComponent(BauSystem.MESSAGE.parse("DEPTH_COUNTER_TNT", player, tntCount)); + + return new BaseComponent[]{headerComponent, depthComponent, tntComponent}; + } + + private static int getMax(Set values) { + return values.stream().max(Integer::compare).orElse(0); + } +} diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/cannon/depth/DepthManager.java b/BauSystem_Main/src/de/steamwar/bausystem/features/cannon/depth/DepthManager.java new file mode 100644 index 00000000..21789d7b --- /dev/null +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/cannon/depth/DepthManager.java @@ -0,0 +1,48 @@ +/* + * This file is a part of the SteamWar software. + * + * Copyright (C) 2023 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.cannon.depth; + +import lombok.experimental.UtilityClass; +import org.bukkit.block.Block; +import org.bukkit.entity.TNTPrimed; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +@UtilityClass +public class DepthManager { + + private Map depths = new HashMap<>(); + + public void init(List list, Depth depth) { + for (TNTPrimed tnt : list) { + depths.putIfAbsent(tnt, depth); + } + } + + public void update(TNTPrimed tnt, List blocks) { + Depth depth = depths.remove(tnt); + if (depth == null) return; + depth.update(blocks); + if (depths.containsValue(depth)) return; + depth.finish(); + } +} diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/killchecker/KillcheckerVisualizer.java b/BauSystem_Main/src/de/steamwar/bausystem/features/killchecker/KillcheckerVisualizer.java index ff21d13b..6d4b8af2 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/killchecker/KillcheckerVisualizer.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/killchecker/KillcheckerVisualizer.java @@ -293,7 +293,7 @@ public class KillcheckerVisualizer { private void updateBossBar(Player player) { BauSystemBossbar bossbar = bossBarService.get(player, region, "killchecker"); bossbar.setTitle(BauSystem.MESSAGE.parse("KILLCHECKER_BOSSBAR", player, kills, ((int) (percent * 1000) / 10.0), cannonCount)); - bossbar.setProgress(percent); + bossbar.setProgress(Math.min(Math.max(percent, 0), 1)); if (percent >= 0.35) { bossbar.setColor(BarColor.RED); diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/loader/Loader.java b/BauSystem_Main/src/de/steamwar/bausystem/features/loader/Loader.java index 6b61f14f..c0d8ebc3 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/loader/Loader.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/loader/Loader.java @@ -21,6 +21,7 @@ package de.steamwar.bausystem.features.loader; import de.steamwar.bausystem.BauSystem; import de.steamwar.bausystem.features.loader.elements.LoaderElement; +import de.steamwar.bausystem.features.loader.elements.LoaderInteractionElement; import de.steamwar.bausystem.features.loader.elements.impl.LoaderTNT; import de.steamwar.bausystem.features.loader.elements.impl.LoaderWait; import de.steamwar.bausystem.shared.EnumDisplay; @@ -58,31 +59,32 @@ public class Loader implements Listener { private List elements = new ArrayList<>(); private int currentElement = 0; - private long totalDelay = 0; + private long waitTime = 0; public Loader(Player p) { this.p = p; this.recorder = new LoaderRecorder(p, elements); Bukkit.getPluginManager().registerEvents(this, BauSystem.getInstance()); - } - private void next() { - currentElement++; - if (currentElement >= elements.size()) { - currentElement = 0; - if (totalDelay == 0) { - Bukkit.getScheduler().runTaskLater(BauSystem.getInstance(), this::next, 1); + BauSystem.runTaskTimer(BauSystem.getInstance(), () -> { + if (stage != Stage.RUNNING) return; + if (waitTime > 0) { + waitTime--; return; } - totalDelay = 0; - } - if (stage == Stage.RUNNING) { - LoaderElement element = elements.get(currentElement); - if (element instanceof LoaderWait) { - totalDelay += ((LoaderWait) element).getDelay(); + + while (currentElement < elements.size()) { + LoaderElement element = elements.get(currentElement); + currentElement++; + element.execute(delay -> waitTime = delay); + if (waitTime > 0) { + break; + } } - element.execute(this::next); - } + if (currentElement >= elements.size()) { + currentElement = 0; + } + }, 0, 1); } public void start() { @@ -96,9 +98,7 @@ public class Loader implements Listener { if (elements.isEmpty()) { BauSystem.MESSAGE.send("LOADER_NOTHING_RECORDED", p); stop(); - return; } - elements.get(currentElement).execute(this::next); } public void pause() { @@ -133,7 +133,12 @@ public class Loader implements Listener { } } SWItem item = element.menu(p); - item.setLore(Arrays.asList(BauSystem.MESSAGE.parse("LOADER_SETTING_MODES", p, elements.size()), "§8", BauSystem.MESSAGE.parse("LOADER_GUI_CLICK_TO_EDIT", p))); + if (element instanceof LoaderInteractionElement) { + LoaderInteractionElement interactionElement = (LoaderInteractionElement) element; + item.setLore(Arrays.asList(BauSystem.MESSAGE.parse("LOADER_SETTING_MODES", p, interactionElement.size()), "§8", BauSystem.MESSAGE.parse("LOADER_GUI_CLICK_TO_EDIT", p))); + } else { + item.setLore(Arrays.asList(BauSystem.MESSAGE.parse("LOADER_GUI_CLICK_TO_EDIT", p))); + } list.add(new SWListInv.SWListEntry<>(item, element)); } SWListInv swListInv = new SWListInv<>(p, BauSystem.MESSAGE.parse("LOADER_GUI_TITLE", p), false, list, (clickType, loaderElement) -> {}); diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/loader/LoaderRecorder.java b/BauSystem_Main/src/de/steamwar/bausystem/features/loader/LoaderRecorder.java index f42ad0db..a0734231 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/loader/LoaderRecorder.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/loader/LoaderRecorder.java @@ -46,7 +46,7 @@ public class LoaderRecorder implements Listener { private Player player; private List loaderElementList; - private long lastInteraction = TPSUtils.currentTick.get(); + private long lastInteraction = TPSUtils.currentRealTick.get(); public LoaderRecorder(Player player, List loaderElementList) { this.player = player; @@ -63,15 +63,15 @@ public class LoaderRecorder implements Listener { private void addWaitTime(boolean last) { if (loaderElementList.isEmpty()) { - lastInteraction = TPSUtils.currentTick.get(); + lastInteraction = TPSUtils.currentRealTick.get(); return; } if (loaderElementList.get(loaderElementList.size() - 1) instanceof LoaderWait) { return; } - long diff = TPSUtils.currentTick.get() - lastInteraction; + long diff = TPSUtils.currentRealTick.get() - lastInteraction; if (last && diff > 160) diff = 160; - lastInteraction = TPSUtils.currentTick.get(); + lastInteraction = TPSUtils.currentRealTick.get(); loaderElementList.add(new LoaderWait(diff)); } @@ -165,10 +165,10 @@ public class LoaderRecorder implements Listener { Long startTime = blockSet.remove(fromBlock.getLocation()); LoaderMovement loaderMovement = movementSet.remove(fromBlock.getLocation()); if (loaderMovement != null && startTime != null) { - loaderMovement.setInitialTicks(TPSUtils.currentTick.get() - startTime); + loaderMovement.setInitialTicks(TPSUtils.currentRealTick.get() - startTime); } - blockSet.put(toBlock.getLocation(), TPSUtils.currentTick.get()); + blockSet.put(toBlock.getLocation(), TPSUtils.currentRealTick.get()); addWaitTime(false); loaderMovement = null; diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/loader/elements/ElementSettings.java b/BauSystem_Main/src/de/steamwar/bausystem/features/loader/elements/ElementSettings.java index 7650878c..55bce084 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/loader/elements/ElementSettings.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/loader/elements/ElementSettings.java @@ -23,9 +23,11 @@ import de.steamwar.bausystem.BauSystem; import de.steamwar.inventory.SWItem; import org.bukkit.entity.Player; +import java.util.function.Consumer; + public interface ElementSettings { SWItem menu(Player player); - void execute(Runnable nextAction); + void execute(Consumer delay); void click(Player player, Runnable backAction, Runnable deleteAction); default void playerInteract() {} diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/loader/elements/LoaderElement.java b/BauSystem_Main/src/de/steamwar/bausystem/features/loader/elements/LoaderElement.java index eb173dc5..658a9f8d 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/loader/elements/LoaderElement.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/loader/elements/LoaderElement.java @@ -22,8 +22,10 @@ package de.steamwar.bausystem.features.loader.elements; import de.steamwar.inventory.SWItem; import org.bukkit.entity.Player; +import java.util.function.Consumer; + public interface LoaderElement { SWItem menu(Player player); - void execute(Runnable nextAction); + void execute(Consumer delay); void click(Player player, Runnable backAction); } diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/loader/elements/LoaderInteractionElement.java b/BauSystem_Main/src/de/steamwar/bausystem/features/loader/elements/LoaderInteractionElement.java index dad60ebf..e90491d8 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/loader/elements/LoaderInteractionElement.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/loader/elements/LoaderInteractionElement.java @@ -33,6 +33,7 @@ import org.bukkit.entity.Player; import java.util.ArrayList; import java.util.List; +import java.util.function.Consumer; public abstract class LoaderInteractionElement implements LoaderElement { @@ -49,9 +50,9 @@ public abstract class LoaderInteractionElement implem } @Override - public void execute(Runnable nextAction) { + public void execute(Consumer delay) { if (currentShot >= elements.size()) currentShot = 0; - elements.get(currentShot).execute(nextAction); + elements.get(currentShot).execute(delay); currentShot++; if (currentShot >= elements.size()) currentShot = 0; } @@ -122,4 +123,8 @@ public abstract class LoaderInteractionElement implem protected final String translateItemName(String name, Player player) { return BauSystem.MESSAGE.parse("LOADER_SETTING_NAME", player, BauSystem.MESSAGE.parse(name, player)); } + + public int size() { + return elements.size(); + } } diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/loader/elements/impl/LoaderComparator.java b/BauSystem_Main/src/de/steamwar/bausystem/features/loader/elements/impl/LoaderComparator.java index fef006f7..4ddb1f02 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/loader/elements/impl/LoaderComparator.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/loader/elements/impl/LoaderComparator.java @@ -31,6 +31,7 @@ import org.bukkit.entity.Player; import java.util.Arrays; import java.util.Collections; +import java.util.function.Consumer; public class LoaderComparator extends LoaderInteractionElement { @@ -62,8 +63,7 @@ public class LoaderComparator extends LoaderInteractionElement delay) { if (location.getBlock().getType() != Material.COMPARATOR) return; Comparator comparator = (Comparator) location.getBlock().getBlockData(); if (interact) { diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/loader/elements/impl/LoaderDaylightDetector.java b/BauSystem_Main/src/de/steamwar/bausystem/features/loader/elements/impl/LoaderDaylightDetector.java index 10c2b74c..ed192ba4 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/loader/elements/impl/LoaderDaylightDetector.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/loader/elements/impl/LoaderDaylightDetector.java @@ -31,6 +31,7 @@ import org.bukkit.entity.Player; import java.util.Arrays; import java.util.Collections; +import java.util.function.Consumer; public class LoaderDaylightDetector extends LoaderInteractionElement { @@ -64,8 +65,7 @@ public class LoaderDaylightDetector extends LoaderInteractionElement delay) { if (location.getBlock().getType() != Material.DAYLIGHT_DETECTOR) return; DaylightDetector daylightDetector = (DaylightDetector) location.getBlock().getBlockData(); if (noop) { diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/loader/elements/impl/LoaderLectern.java b/BauSystem_Main/src/de/steamwar/bausystem/features/loader/elements/impl/LoaderLectern.java index b2cf3ff4..ca16eff5 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/loader/elements/impl/LoaderLectern.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/loader/elements/impl/LoaderLectern.java @@ -32,6 +32,7 @@ import org.bukkit.inventory.meta.BookMeta; import java.util.Arrays; import java.util.Collections; +import java.util.function.Consumer; public class LoaderLectern extends LoaderInteractionElement { @@ -68,8 +69,7 @@ public class LoaderLectern extends LoaderInteractionElement delay) { if (location.getBlock().getType() != Material.LECTERN) return; Lectern lectern = (Lectern) location.getBlock().getState(); if (!((org.bukkit.block.data.type.Lectern) lectern.getBlockData()).hasBook()) return; diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/loader/elements/impl/LoaderLever.java b/BauSystem_Main/src/de/steamwar/bausystem/features/loader/elements/impl/LoaderLever.java index 911daf57..733a329d 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/loader/elements/impl/LoaderLever.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/loader/elements/impl/LoaderLever.java @@ -31,6 +31,7 @@ import org.bukkit.entity.Player; import java.util.Arrays; import java.util.Collections; +import java.util.function.Consumer; public class LoaderLever extends LoaderInteractionElement { @@ -52,19 +53,18 @@ public class LoaderLever extends LoaderInteractionElement delay) { if (location.getBlock().getType() != Material.LEVER) return; if (noop) return; diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/loader/elements/impl/LoaderMovement.java b/BauSystem_Main/src/de/steamwar/bausystem/features/loader/elements/impl/LoaderMovement.java index 55c41fd7..9e88b13c 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/loader/elements/impl/LoaderMovement.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/loader/elements/impl/LoaderMovement.java @@ -35,6 +35,7 @@ import org.bukkit.entity.Player; import java.util.Arrays; import java.util.Collections; +import java.util.function.Consumer; public class LoaderMovement extends LoaderInteractionElement { @@ -83,15 +84,9 @@ public class LoaderMovement extends LoaderInteractionElement delay) { + if (!(material == Material.STRING && location.getBlock().getType() == Material.TRIPWIRE) && location.getBlock().getType() != material) return; + if (noop) return; BlockData blockData = location.getBlock().getBlockData(); if (blockData instanceof AnaloguePowerable) { @@ -111,8 +106,10 @@ public class LoaderMovement extends LoaderInteractionElement= 0) { - boolean finalWaitFor = waitFor; - Bukkit.getScheduler().runTaskLater(BauSystem.getInstance(), () -> { + if (waitFor) { + delay.accept(ticks); + } + BauSystem.runTaskLater(BauSystem.getInstance(), () -> { if (blockData instanceof AnaloguePowerable) { AnaloguePowerable analoguePowerable = (AnaloguePowerable) blockData; analoguePowerable.setPower(0); @@ -124,13 +121,7 @@ public class LoaderMovement extends LoaderInteractionElement { @@ -60,8 +61,7 @@ public class LoaderNoteBlock extends LoaderInteractionElement delay) { if (location.getBlock().getType() != Material.NOTE_BLOCK) return; NoteBlock noteBlock = (NoteBlock) location.getBlock().getBlockData(); if (interact) { diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/loader/elements/impl/LoaderOpenable.java b/BauSystem_Main/src/de/steamwar/bausystem/features/loader/elements/impl/LoaderOpenable.java index de4abe42..f35aed98 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/loader/elements/impl/LoaderOpenable.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/loader/elements/impl/LoaderOpenable.java @@ -31,6 +31,7 @@ import org.bukkit.entity.Player; import java.util.Arrays; import java.util.Collections; +import java.util.function.Consumer; public class LoaderOpenable extends LoaderInteractionElement { @@ -68,8 +69,7 @@ public class LoaderOpenable extends LoaderInteractionElement delay) { if (location.getBlock().getType() != material) return; Openable openable = (Openable) location.getBlock().getBlockData(); if (noop) { diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/loader/elements/impl/LoaderRepeater.java b/BauSystem_Main/src/de/steamwar/bausystem/features/loader/elements/impl/LoaderRepeater.java index 26234c54..153721a0 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/loader/elements/impl/LoaderRepeater.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/loader/elements/impl/LoaderRepeater.java @@ -31,6 +31,7 @@ import org.bukkit.entity.Player; import java.util.Arrays; import java.util.Collections; +import java.util.function.Consumer; public class LoaderRepeater extends LoaderInteractionElement { @@ -63,8 +64,7 @@ public class LoaderRepeater extends LoaderInteractionElement __) { if (location.getBlock().getType() != Material.REPEATER) return; Repeater repeater = (Repeater) location.getBlock().getBlockData(); if (interact) { diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/loader/elements/impl/LoaderTNT.java b/BauSystem_Main/src/de/steamwar/bausystem/features/loader/elements/impl/LoaderTNT.java index 6c95bf71..964c5df2 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/loader/elements/impl/LoaderTNT.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/loader/elements/impl/LoaderTNT.java @@ -29,6 +29,7 @@ import org.bukkit.block.Block; import org.bukkit.entity.Player; import java.util.Arrays; +import java.util.function.Consumer; public class LoaderTNT implements LoaderElement { @@ -46,15 +47,14 @@ public class LoaderTNT implements LoaderElement { } @Override - public void execute(Runnable nextAction) { + public void execute(Consumer delay) { Block block = location.getBlock(); if (block.getType() != Material.AIR && block.getType() != Material.WATER) { - Bukkit.getScheduler().runTaskLater(BauSystem.getInstance(), () -> execute(nextAction), 1); + delay.accept(1L); return; } block.setType(Material.TNT, true); - nextAction.run(); } @Override diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/loader/elements/impl/LoaderTicks.java b/BauSystem_Main/src/de/steamwar/bausystem/features/loader/elements/impl/LoaderTicks.java index 098d29ea..b83d5c0b 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/loader/elements/impl/LoaderTicks.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/loader/elements/impl/LoaderTicks.java @@ -32,6 +32,7 @@ import org.bukkit.entity.Player; import java.util.Arrays; import java.util.Collections; +import java.util.function.Consumer; public class LoaderTicks extends LoaderInteractionElement { @@ -71,13 +72,11 @@ public class LoaderTicks extends LoaderInteractionElement delay) { if (location.getBlock().getType() != material) { - nextAction.run(); return; } if (noop) { - nextAction.run(); return; } @@ -86,18 +85,14 @@ public class LoaderTicks extends LoaderInteractionElement { + if (waitFor) { + delay.accept((long) ticks); + } + BauSystem.runTaskLater(BauSystem.getInstance(), () -> { powerable.setPowered(false); location.getBlock().setBlockData(powerable, true); update(powerable); - if (finalWaitFor) { - nextAction.run(); - } }, ticks); - if (!finalWaitFor) { - nextAction.run(); - } } @Override diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/loader/elements/impl/LoaderWait.java b/BauSystem_Main/src/de/steamwar/bausystem/features/loader/elements/impl/LoaderWait.java index 0c694a87..b4df1432 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/loader/elements/impl/LoaderWait.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/loader/elements/impl/LoaderWait.java @@ -32,6 +32,7 @@ import org.bukkit.entity.Player; import org.bukkit.event.Listener; import java.util.Arrays; +import java.util.function.Consumer; public class LoaderWait implements LoaderElement, Listener { @@ -53,12 +54,8 @@ public class LoaderWait implements LoaderElement, Listener { } @Override - public void execute(Runnable nextAction) { - if (delay == 0) { - nextAction.run(); - return; - } - Bukkit.getScheduler().runTaskLater(BauSystem.getInstance(), nextAction, delay); + public void execute(Consumer __) { + __.accept(delay); } @Override diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/loadtimer/Loadtimer.java b/BauSystem_Main/src/de/steamwar/bausystem/features/loadtimer/Loadtimer.java index c321faba..116edba5 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/loadtimer/Loadtimer.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/loadtimer/Loadtimer.java @@ -65,9 +65,9 @@ public class Loadtimer implements Listener { this.region = region; this.stage = Stage.WAITING; Bukkit.getPluginManager().registerEvents(this, BauSystem.getInstance()); - task = Bukkit.getScheduler().runTaskTimer(BauSystem.getInstance(), () -> { + task = BauSystem.runTaskTimer(BauSystem.getInstance(), () -> { if (stage == Stage.COUNTING) { - long timeSinceStart = TPSUtils.currentTick.get() - start; + long timeSinceStart = TPSUtils.currentRealTick.get() - start; long timeSinceHalf = timeSinceStart / 2; double timeSec = (timeSinceStart / 20d); String sec = new DecimalFormat("#.#").format(timeSec); @@ -119,7 +119,7 @@ public class Loadtimer implements Listener { public void onTntPlace(BlockPlaceEvent event) { if (stage == Stage.WAITING) { this.stage = Stage.COUNTING; - this.start = TPSUtils.currentTick.get(); + this.start = TPSUtils.currentRealTick.get(); } if (stage == Stage.COUNTING) { @@ -146,9 +146,9 @@ public class Loadtimer implements Listener { public void onTntSpawn() { if ((stage == Stage.COUNTING || stage == Stage.ACTIVATED)) { stage = Stage.IGNITION; - ignite = TPSUtils.currentTick.get(); + ignite = TPSUtils.currentRealTick.get(); if (activate == -1) - activate = TPSUtils.currentTick.get(); + activate = TPSUtils.currentRealTick.get(); if (finishOnActive) { stage = Stage.END; print(); @@ -160,14 +160,14 @@ public class Loadtimer implements Listener { public void onTntExplode(EntityExplodeEvent event) { if (region.inRegion(event.getLocation(), RegionType.BUILD, RegionExtensionType.EXTENSION) && stage == Stage.IGNITION) { stage = Stage.END; - explode = TPSUtils.currentTick.get(); + explode = TPSUtils.currentRealTick.get(); print(); delete(); } } private void setActivate() { - activate = TPSUtils.currentTick.get(); + activate = TPSUtils.currentRealTick.get(); stage = Stage.ACTIVATED; if (finishOnActive) { print(); diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/redstonetester/RedstonetesterUtils.java b/BauSystem_Main/src/de/steamwar/bausystem/features/redstonetester/RedstonetesterUtils.java index 128c79ae..a70b143b 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/redstonetester/RedstonetesterUtils.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/redstonetester/RedstonetesterUtils.java @@ -89,18 +89,18 @@ public class RedstonetesterUtils { tick = null; return; } - if (TPSUtils.currentTick.get() - lastTick > 100) { + if (TPSUtils.currentRealTick.get() - lastTick > 100) { tick = null; } if (loc1.equals(location)) { - lastTick = TPSUtils.currentTick.get(); + lastTick = TPSUtils.currentRealTick.get(); if (tick == null) { - tick = TPSUtils.currentTick.get(); + tick = TPSUtils.currentRealTick.get(); } return; } if (tick != null && loc2.equals(location)) { - BauSystem.MESSAGE.send("RT_RESULT", player, (TPSUtils.currentTick.get() - tick), ((TPSUtils.currentTick.get() - tick) / 2.0)); + BauSystem.MESSAGE.send("RT_RESULT", player, (TPSUtils.currentRealTick.get() - tick), ((TPSUtils.currentRealTick.get() - tick) / 2.0)); } } diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/region/FireListener.java b/BauSystem_Main/src/de/steamwar/bausystem/features/region/FireListener.java index afe30aa1..3cf4d1dc 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/region/FireListener.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/region/FireListener.java @@ -37,6 +37,7 @@ public class FireListener implements Listener, ScoreboardElement { @Override public String get(Region region, Player p) { + if (region.get(Flag.FIRE) == Flag.FIRE.getDefaultValue()) return null; return "§e" + BauSystem.MESSAGE.parse(Flag.FIRE.getChatValue(), p) + "§8: " + BauSystem.MESSAGE.parse(region.get(Flag.FIRE).getChatValue(), p); } } diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/region/FreezeListener.java b/BauSystem_Main/src/de/steamwar/bausystem/features/region/FreezeListener.java index d810ce61..df73575c 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/region/FreezeListener.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/region/FreezeListener.java @@ -100,7 +100,9 @@ public class FreezeListener implements Listener, ScoreboardElement { @EventHandler public void onInventoryMoveEvent(InventoryMoveItemEvent e) { - if (Region.getRegion(e.getDestination().getLocation()).get(Flag.FREEZE) == FreezeMode.ACTIVE) { + if (e.getDestination().getLocation() != null && Region.getRegion(e.getDestination().getLocation()).get(Flag.FREEZE) == FreezeMode.ACTIVE) { + e.setCancelled(true); + } else if (e.getSource().getLocation() != null && Region.getRegion(e.getSource().getLocation()).get(Flag.FREEZE) == FreezeMode.ACTIVE) { e.setCancelled(true); } } @@ -197,6 +199,7 @@ public class FreezeListener implements Listener, ScoreboardElement { @Override public String get(Region region, Player p) { + if (region.get(Flag.FREEZE) == Flag.FREEZE.getDefaultValue()) return null; return "§e" + BauSystem.MESSAGE.parse(Flag.FREEZE.getChatValue(), p) + "§8: " + BauSystem.MESSAGE.parse(region.get(Flag.FREEZE).getChatValue(), p); } } diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/region/ItemsCommand.java b/BauSystem_Main/src/de/steamwar/bausystem/features/region/ItemsCommand.java index cbde76cf..3b99382d 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/region/ItemsCommand.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/region/ItemsCommand.java @@ -54,16 +54,6 @@ public class ItemsCommand extends SWCommand { } } - @Register(value = "global") - public void globalToggleCommand(@Validator Player p) { - Region region = GlobalRegion.getInstance(); - if (toggle(region)) { - RegionUtils.actionBar(region, getEnableMessage()); - } else { - RegionUtils.actionBar(region, getDisableMessage()); - } - } - private String getNoPermMessage() { return "REGION_ITEMS_NO_PERMS"; } diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/region/ItemsListener.java b/BauSystem_Main/src/de/steamwar/bausystem/features/region/ItemsListener.java index 1becf08b..66e1fdb7 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/region/ItemsListener.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/region/ItemsListener.java @@ -20,7 +20,6 @@ package de.steamwar.bausystem.features.region; import de.steamwar.bausystem.BauSystem; -import de.steamwar.bausystem.region.GlobalRegion; import de.steamwar.bausystem.region.Region; import de.steamwar.bausystem.region.flags.Flag; import de.steamwar.bausystem.region.flags.flagvalues.ItemMode; @@ -37,8 +36,6 @@ import org.bukkit.event.entity.ItemSpawnEvent; public class ItemsListener implements Listener, ScoreboardElement { private static ItemMode getMode(Region region) { - ItemMode itemMode = GlobalRegion.getInstance().getPlain(Flag.ITEMS, ItemMode.class); - if (itemMode == ItemMode.INACTIVE) return ItemMode.INACTIVE; return region.getPlain(Flag.ITEMS, ItemMode.class); } @@ -61,8 +58,7 @@ public class ItemsListener implements Listener, ScoreboardElement { @Override public String get(Region region, Player p) { - ItemMode itemMode = getMode(region); - if (itemMode == ItemMode.ACTIVE) return null; - return "§e" + BauSystem.MESSAGE.parse(Flag.ITEMS.getChatValue(), p) + "§8: " + BauSystem.MESSAGE.parse(itemMode.getChatValue(), p); + if (region.get(Flag.ITEMS) == Flag.ITEMS.getDefaultValue()) return null; + return "§e" + BauSystem.MESSAGE.parse(Flag.ITEMS.getChatValue(), p) + "§8: " + BauSystem.MESSAGE.parse(region.get(Flag.ITEMS).getChatValue(), p); } } diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/region/ProtectListener.java b/BauSystem_Main/src/de/steamwar/bausystem/features/region/ProtectListener.java index 9b173359..65ec30de 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/region/ProtectListener.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/region/ProtectListener.java @@ -53,6 +53,7 @@ public class ProtectListener implements Listener, ScoreboardElement { @Override public String get(Region region, Player p) { if (region.getFloorLevel() == 0) return null; + if (region.get(Flag.PROTECT) != Flag.PROTECT.getDefaultValue()) return null; return "§e" + BauSystem.MESSAGE.parse(Flag.PROTECT.getChatValue(), p) + "§8: " + BauSystem.MESSAGE.parse(region.get(Flag.PROTECT).getChatValue(), p); } } diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/region/TNTListener.java b/BauSystem_Main/src/de/steamwar/bausystem/features/region/TNTListener.java index 08309eb6..d65a8750 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/region/TNTListener.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/region/TNTListener.java @@ -20,8 +20,6 @@ package de.steamwar.bausystem.features.region; import de.steamwar.bausystem.BauSystem; -import de.steamwar.bausystem.features.script.CustomScriptManager; -import de.steamwar.bausystem.features.script.custom.event.EventType; import de.steamwar.bausystem.region.Region; import de.steamwar.bausystem.region.RegionUtils; import de.steamwar.bausystem.region.flags.Flag; @@ -48,10 +46,7 @@ import java.util.concurrent.atomic.AtomicBoolean; @Linked public class TNTListener implements Listener, ScoreboardElement { - @LinkedInstance - public CustomScriptManager customScriptManager; - - private void explode(List blockList, Location location, EventType eventType, Event event) { + private void explode(List blockList) { AtomicBoolean inBuild = new AtomicBoolean(); blockList.removeIf(block -> { Region region = Region.getRegion(block.getLocation()); @@ -71,24 +66,16 @@ public class TNTListener implements Listener, ScoreboardElement { } return value == TNTMode.DENY; }); - if (inBuild.get()) { - Region region = Region.getRegion(location); - for (Player player : Bukkit.getOnlinePlayers()) { - if (region.inRegion(player.getLocation(), RegionType.NORMAL, RegionExtensionType.NORMAL)) { - customScriptManager.callEvent(eventType, player, event); - } - } - } } @EventHandler public void onBlockExplode(BlockExplodeEvent event) { - explode(event.blockList(), event.getBlock().getLocation(), null, null); + explode(event.blockList()); } @EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true) public void onExplode(EntityExplodeEvent event) { - explode(event.blockList(), event.getLocation(), EventType.TNTExplodeInBuild, event); + explode(event.blockList()); } @Override diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/script/CustomScriptManager.java b/BauSystem_Main/src/de/steamwar/bausystem/features/script/CustomScriptManager.java deleted file mode 100644 index 0c4e50af..00000000 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/script/CustomScriptManager.java +++ /dev/null @@ -1,342 +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; - -import de.steamwar.bausystem.BauSystem; -import de.steamwar.bausystem.SWUtils; -import de.steamwar.bausystem.features.script.custom.MenuScript; -import de.steamwar.bausystem.features.script.custom.Script; -import de.steamwar.bausystem.features.script.custom.command.CustomCommand; -import de.steamwar.bausystem.features.script.custom.command.InventoryCommand; -import de.steamwar.bausystem.features.script.custom.command.MenuCommand; -import de.steamwar.bausystem.features.script.custom.event.CustomEvent; -import de.steamwar.bausystem.features.script.custom.event.EventType; -import de.steamwar.bausystem.features.script.custom.event.InventoryEvent; -import de.steamwar.bausystem.features.script.custom.event.MenuEvent; -import de.steamwar.bausystem.features.script.custom.hotkey.Hotkey; -import de.steamwar.bausystem.features.script.custom.hotkey.Hotkeys; -import de.steamwar.bausystem.features.script.custom.hotkey.InventoryHotkey; -import de.steamwar.bausystem.features.script.custom.hotkey.MenuHotkey; -import de.steamwar.bausystem.features.script.variables.Value; -import de.steamwar.bausystem.utils.FlatteningWrapper; -import de.steamwar.inventory.SWItem; -import de.steamwar.inventory.SWListInv; -import de.steamwar.linkage.Linked; -import de.steamwar.sql.UserConfig; -import org.bukkit.Material; -import org.bukkit.entity.Player; -import org.bukkit.event.Cancellable; -import org.bukkit.event.Event; -import org.bukkit.event.EventHandler; -import org.bukkit.event.Listener; -import org.bukkit.event.inventory.InventoryCloseEvent; -import org.bukkit.event.player.PlayerCommandPreprocessEvent; -import org.bukkit.event.player.PlayerJoinEvent; -import org.bukkit.event.player.PlayerQuitEvent; -import org.bukkit.inventory.ItemStack; -import org.bukkit.inventory.meta.BookMeta; -import yapion.hierarchy.output.LengthOutput; -import yapion.hierarchy.output.StringOutput; -import yapion.hierarchy.types.YAPIONArray; -import yapion.hierarchy.types.YAPIONMap; -import yapion.hierarchy.types.YAPIONObject; -import yapion.hierarchy.types.YAPIONValue; -import yapion.parser.YAPIONParser; - -import java.util.*; -import java.util.function.Consumer; -import java.util.stream.Collectors; - -@Linked -public class CustomScriptManager implements Listener { - - public final Map> playerMap = Collections.synchronizedMap(new HashMap<>()); // new ConcurrentHashMap<>(); - - private void updateInventory(Player p) { - playerMap.computeIfPresent(p, (player, customCommands) -> { - customCommands.removeIf(script -> !(script instanceof MenuScript)); - return customCommands; - }); - for (ItemStack item : p.getInventory().getContents()) { - if (item == null || FlatteningWrapper.impl.isNoBook(item) || item.getItemMeta() == null) { - continue; - } - - BookMeta bookMeta = ((BookMeta) item.getItemMeta()); - if (bookMeta.getPageCount() == 0) { - continue; - } - if (bookMeta.getPage(1).isEmpty()) { - continue; - } - String s = bookMeta.getPage(1).split("\n")[0]; - if (s.startsWith("#!CMD /")) { - playerMap.computeIfAbsent(p, player -> new ArrayList<>()).add(new InventoryCommand(bookMeta, s.substring(6).split(" "))); - } else if (s.startsWith("#!EVENT ")) { - playerMap.computeIfAbsent(p, player -> new ArrayList<>()).add(new InventoryEvent(bookMeta, s.substring(8).split(" "))); - } else if (s.startsWith("#!HOTKEY ")) { - playerMap.computeIfAbsent(p, player -> new ArrayList<>()).add(new InventoryHotkey(bookMeta, s.substring(9).split(" "))); - } - } - } - - @EventHandler - public void onPlayerJoin(PlayerJoinEvent e) { - load(e.getPlayer()); - } - - private synchronized void load(Player p) { - updateInventory(p); - - String s = UserConfig.getConfig(p.getUniqueId(), "bausystem-scripts"); - if (s == null) { - s = UserConfig.getConfig(p.getUniqueId(), "bausystem-commands"); - UserConfig.removePlayerConfig(p.getUniqueId(), "bausystem-commands"); - } - YAPIONObject yapionObject; - if (s == null) { - yapionObject = new YAPIONObject(); - yapionObject.getYAPIONMapOrSetDefault("events", new YAPIONMap()).add("FF", new YAPIONArray().add("#!EVENT FF /gui Script\ngui")); - } else { - yapionObject = YAPIONParser.parse(s); - if (yapionObject.containsKey("")) { - yapionObject.add("commands", yapionObject.getMap("")); - yapionObject.remove(""); - yapionObject.getYAPIONMapOrSetDefault("events", new YAPIONMap()).add("FF", new YAPIONArray().add("#!EVENT FF /gui Script\ngui")); - } - } - - yapionObject.getYAPIONMapOrSetDefault("commands", new YAPIONMap()).forEach((key, value) -> { - String[] command = ((YAPIONValue) key).get().split(" "); - List pages = ((YAPIONArray) value).stream().map(YAPIONValue.class::cast).map(YAPIONValue::get).map(String.class::cast).collect(Collectors.toList()); - playerMap.computeIfAbsent(p, player -> new ArrayList<>()).add(new MenuCommand(pages, command)); - }); - - yapionObject.getYAPIONMapOrSetDefault("events", new YAPIONMap()).forEach((key, value) -> { - String[] event = ((YAPIONValue) key).get().split(" "); - List pages = ((YAPIONArray) value).stream().map(YAPIONValue.class::cast).map(YAPIONValue::get).map(String.class::cast).collect(Collectors.toList()); - playerMap.computeIfAbsent(p, player -> new ArrayList<>()).add(new MenuEvent(pages, event)); - }); - - yapionObject.getYAPIONMapOrSetDefault("hotkeys", new YAPIONMap()).forEach((key, value) -> { - String[] hotkey = ((YAPIONValue) key).get().split(" "); - List pages = ((YAPIONArray) value).stream().map(YAPIONValue.class::cast).map(YAPIONValue::get).map(String.class::cast).collect(Collectors.toList()); - playerMap.computeIfAbsent(p, player -> new ArrayList<>()).add(new MenuHotkey(pages, hotkey)); - }); - } - - @EventHandler - public void onPlayerQuit(PlayerQuitEvent e) { - save(e.getPlayer()); - playerMap.remove(e.getPlayer()); - } - - private YAPIONObject output(Player p) { - if (!playerMap.containsKey(p)) return new YAPIONObject(); - YAPIONObject yapionObject = new YAPIONObject(); - - YAPIONMap commandsMap = new YAPIONMap(); - yapionObject.add("commands", commandsMap); - playerMap.get(p).stream().filter(MenuCommand.class::isInstance).map(MenuCommand.class::cast).forEach(menuCommand -> { - menuCommand.save(commandsMap); - }); - - YAPIONMap eventsMap = new YAPIONMap(); - yapionObject.add("events", eventsMap); - playerMap.get(p).stream().filter(MenuEvent.class::isInstance).map(MenuEvent.class::cast).forEach(menuCommand -> { - menuCommand.save(eventsMap); - }); - - YAPIONMap hotkeysMap = new YAPIONMap(); - yapionObject.add("hotkeys", hotkeysMap); - playerMap.get(p).stream().filter(MenuHotkey.class::isInstance).map(MenuHotkey.class::cast).forEach(menuCommand -> { - menuCommand.save(hotkeysMap); - }); - return yapionObject; - } - - private boolean save(Player p) { - if (!playerMap.containsKey(p)) { - UserConfig.removePlayerConfig(p.getUniqueId(), "bausystem-scripts"); - return true; - } - YAPIONObject yapionObject = output(p); - if (yapionObject.toYAPION(new LengthOutput()).getLength() > 64 * 1024) { - return false; - } - UserConfig.updatePlayerConfig(p.getUniqueId(), "bausystem-scripts", yapionObject.toYAPION(new StringOutput()).getResult()); - return true; - } - - @EventHandler - public void onInventoryClose(InventoryCloseEvent e) { - if (e.getPlayer() instanceof Player) { - updateInventory((Player) e.getPlayer()); - } - } - - public void openCommandsMenu(Player p) { - List> menuCommands = new ArrayList<>(); - playerMap.getOrDefault(p, new ArrayList<>()).stream().filter(MenuScript.class::isInstance).map(MenuScript.class::cast).forEach(menuItem -> { - SWItem swItem = menuItem.toItem(p); - ItemStack itemStack = swItem.getItemStack(); - if (menuItem instanceof MenuHotkey) { - itemStack.setType(Material.CHAIN_COMMAND_BLOCK); - } else if (menuItem instanceof MenuEvent) { - itemStack.setType(Material.REPEATING_COMMAND_BLOCK); - } else { - itemStack.setType(Material.COMMAND_BLOCK); - } - swItem.setItemStack(itemStack); - swItem.setLore(Arrays.asList(BauSystem.MESSAGE.parse("SCRIPT_MENU_GUI_ITEM_LORE_1", p), BauSystem.MESSAGE.parse("SCRIPT_MENU_GUI_ITEM_LORE_2", p))); - - menuCommands.add(new SWListInv.SWListEntry<>(swItem, menuItem)); - }); - - int length = (int) output(p).toYAPION(new LengthOutput()).getLength(); - double percentage = ((int) ((length / 655336.0) * 1000)) / 10.0; - String menuName = BauSystem.MESSAGE.parse("SCRIPT_MENU_GUI_NAME", p, percentage > 99 ? "§c" : (percentage >= 75 ? "§6" : "§a"), percentage); - - SWListInv menuCommandSWListInv = new SWListInv<>(p, menuName, false, menuCommands, (clickType, menuCommand) -> { - if (!clickType.isShiftClick()) { - playerMap.get(p).removeIf(customCommand -> customCommand == menuCommand); - } - SWUtils.giveItemToPlayer(p, menuCommand.toItem(p).getItemStack()); - p.closeInventory(); - save(p); - }); - menuCommandSWListInv.setItem(49, new SWItem(Material.HOPPER, BauSystem.MESSAGE.parse("SCRIPT_MENU_GUI_ITEM_ADD_NAME", p), Arrays.asList(BauSystem.MESSAGE.parse("SCRIPT_MENU_GUI_ITEM_ADD_LORE", p)), false, clickType -> { - ItemStack item = p.getItemOnCursor(); - if (item.getType().isAir()) { - return; - } - if (FlatteningWrapper.impl.isNoBook(item) || item.getItemMeta() == null) { - return; - } - - BookMeta bookMeta = ((BookMeta) item.getItemMeta()); - if (bookMeta.getPageCount() == 0) { - return; - } - if (bookMeta.getPage(1).isEmpty()) { - return; - } - String s = bookMeta.getPage(1).split("\n")[0]; - if (s.startsWith("#!CMD /")) { - MenuCommand menuCommand = new MenuCommand(bookMeta.getPages(), s.substring(6).split(" ")); - for (Script script : playerMap.computeIfAbsent(p, player -> new ArrayList<>())) { - if (!(script instanceof MenuCommand)) { - continue; - } - if (((MenuCommand) script).equals(menuCommand)) { - BauSystem.MESSAGE.sendPrefixless("SCRIPT_MENU_GUI_DUPLICATE_COMMAND", p, String.join(" ", menuCommand.command())); - return; - } - } - scriptBookLimit(p, menuCommand); - } else if (s.startsWith("#!EVENT ")) { - MenuEvent menuEvent = new MenuEvent(bookMeta.getPages(), s.substring(8).split(" ")); - try { - EventType.valueOf(menuEvent.eventName()); - } catch (Exception e) { - BauSystem.MESSAGE.sendPrefixless("SCRIPT_MENU_GUI_UNKNOWN_EVENT", p, menuEvent.eventName()); - return; - } - scriptBookLimit(p, menuEvent); - } else if (s.startsWith("#!HOTKEY ")) { - scriptBookLimit(p, new MenuHotkey(bookMeta.getPages(), s.substring(9).split(" "))); - } - })); - menuCommandSWListInv.open(); - } - - private void scriptBookLimit(Player p, Script menuScript) { - playerMap.computeIfAbsent(p, player -> new ArrayList<>()).add(menuScript); - if (!save(p)) { - playerMap.get(p).removeIf(script -> script == menuScript); - p.closeInventory(); - SWUtils.giveItemToPlayer(p, p.getItemOnCursor()); - save(p); - BauSystem.MESSAGE.sendPrefixless("SCRIPT_MENU_GUI_LIMIT", p); - return; - } - p.setItemOnCursor(null); - openCommandsMenu(p); - } - - public boolean callCommand(Player p, PlayerCommandPreprocessEvent e, String message) { - List customCommands = playerMap.getOrDefault(p, new ArrayList<>()).stream().filter(CustomCommand.class::isInstance).map(CustomCommand.class::cast).collect(Collectors.toList()); - String[] command = message.split(" "); - for (CustomCommand customCommand : customCommands) { - if (customCommand.execute(command, e)) { - return true; - } - } - return false; - } - - public boolean callScoreboard(Player p, Map variables, Consumer echoConsumer) { - Map valueMap = new HashMap<>(); - for (Map.Entry entry : variables.entrySet()) { - valueMap.put(entry.getKey(), new Value.StringValue(entry.getValue())); - } - List customEvents = playerMap.getOrDefault(p, new ArrayList<>()).stream().filter(CustomEvent.class::isInstance).map(CustomEvent.class::cast).collect(Collectors.toList()); - boolean hasScript = false; - for (CustomEvent customEvent : customEvents) { - if (customEvent.eventName().equals(EventType.Scoreboard.name())) { - customEvent.execute(p, valueMap, echoConsumer); - hasScript = true; - } - } - return hasScript; - } - - public void callEvent(EventType eventType, Player p, Event e) { - if (eventType == null) return; - if (!eventType.getEventType().equals(e.getClass())) return; - - List customEvents = playerMap.getOrDefault(p, new ArrayList<>()).stream().filter(CustomEvent.class::isInstance).map(CustomEvent.class::cast).collect(Collectors.toList()); - for (CustomEvent customEvent : customEvents) { - if (customEvent.eventName().equals(eventType.name())) { - Map variables = eventType.getEventValues().apply(e); - if (variables == null) { - variables = new HashMap<>(); - } - if (e instanceof Cancellable) { - variables.put("cancel", new Value.BooleanValue(((Cancellable) e).isCancelled())); - } - customEvent.execute(p, variables, null); - if (variables.containsKey("cancel")) { - Value value = variables.get("cancel"); - ((Cancellable) e).setCancelled(value.asBoolean()); - } - } - } - } - - public void callHotkey(int modifiers, char pressedHotkey, Player p, boolean pressed) { - List hotkeys = playerMap.getOrDefault(p, new ArrayList<>()).stream().filter(Hotkey.class::isInstance).map(Hotkey.class::cast).collect(Collectors.toList()); - for (Hotkey hotkey : hotkeys) { - if (Hotkeys.isSame(modifiers, pressedHotkey, hotkey.hotkey())) { - hotkey.execute(p, pressed); - } - } - } -} diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/script/Hotkey.java b/BauSystem_Main/src/de/steamwar/bausystem/features/script/Hotkey.java new file mode 100644 index 00000000..d149eedd --- /dev/null +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/script/Hotkey.java @@ -0,0 +1,77 @@ +/* + * This file is a part of the SteamWar software. + * + * Copyright (C) 2023 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 lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.EqualsAndHashCode; + +@AllArgsConstructor +@Builder +@EqualsAndHashCode +public class Hotkey { + + private final int charcode; + + private final boolean ctrl; + private final boolean shift; + private final boolean alt; + private final boolean meta; + + public static Hotkey fromString(String string) { + String[] parts = string.split("\\+"); + HotkeyBuilder builder = Hotkey.builder(); + + for (String part : parts) { + switch (part.toLowerCase()) { + case "ctrl": + builder.ctrl(true); + break; + case "shift": + builder.shift(true); + break; + case "alt": + builder.alt(true); + break; + case "meta": + builder.meta(true); + break; + default: + if (part.length() == 1) { + builder.charcode(Character.toLowerCase(part.charAt(0))); + } else { + throw new IllegalArgumentException("Invalid hotkey: " + string); + } + } + } + + return builder.build(); + } + + public static Hotkey fromChar(int c, int mods) { + return Hotkey.builder() + .charcode(Character.toLowerCase(c)) + .shift((mods & 1) != 0) + .ctrl((mods & 2) != 0) + .alt((mods & 4) != 0) + .meta((mods & 8) != 0) + .build(); + } +} 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 d9bed371..9d640d52 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/script/ScriptCommand.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/script/ScriptCommand.java @@ -1,20 +1,28 @@ +/* + * This file is a part of the SteamWar software. + * + * Copyright (C) 2023 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.command.SWCommand; -import de.steamwar.inventory.SWItem; -import de.steamwar.inventory.SWListInv; import de.steamwar.linkage.Linked; -import de.steamwar.linkage.LinkedInstance; -import org.bukkit.Material; import org.bukkit.entity.Player; -import java.util.ArrayList; -import java.util.Comparator; -import java.util.List; - -import static de.steamwar.bausystem.features.script.ScriptExecutor.SPECIAL_COMMANDS; - @Linked public class ScriptCommand extends SWCommand { @@ -22,142 +30,8 @@ public class ScriptCommand extends SWCommand { super("script"); } - @LinkedInstance - public CustomScriptManager customScriptManager = null; - - private List loreBuilder(Player p, String... strings) { - List result = new ArrayList<>(); - for (String s : strings) { - result.addAll(split(BauSystem.MESSAGE.parse(s, p))); - } - return result; - } - - @Register(description = "SCRIPT_COMMAND_HELP") - public void menuCommand(Player p) { - List> swItems = new ArrayList<>(); - addEmptyItems(swItems, 2); - swItems.add(new SWListInv.SWListEntry<>(createItem(p, Material.BOOK, "SCRIPT_GUI_CUSTOM_HOTKEYS", loreBuilder(p, "SCRIPT_GUI_CUSTOM_HOTKEYS_COMMANDS_LORE_1", "SCRIPT_GUI_CUSTOM_HOTKEYS_COMMANDS_LORE_2", "SCRIPT_GUI_CUSTOM_HOTKEYS_COMMANDS_LORE_3", "SCRIPT_GUI_CUSTOM_HOTKEYS_COMMANDS_LORE_4", "SCRIPT_GUI_CUSTOM_HOTKEYS_COMMANDS_LORE_5")), null)); - 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_17", "SCRIPT_GUI_CUSTOM_EVENTS_LORE_18", "SCRIPT_GUI_CUSTOM_EVENTS_LORE_STAR_1")), null)); - addEmptyItems(swItems, 1); - 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, 2); - addCustomScriptsItems(swItems, p); - addEmptyItems(swItems, 45 - swItems.size() % 45); - addEmptyItems(swItems, 4); - swItems.add(new SWListInv.SWListEntry<>(createItem(p, Material.BOOK, "SCRIPT_GUI_CUSTOM_VARIABLES", new ArrayList<>()), null)); - addEmptyItems(swItems, 4); - addConstantItem(swItems, p, Material.CLOCK, "SCRIPT_GUI_CONSTANT_TIME_NAME", "SCRIPT_GUI_CONSTANT_TIME_LORE"); - addConstantItem(swItems, p, Material.CLOCK, "SCRIPT_GUI_CONSTANT_TICKS_NAME", "SCRIPT_GUI_CONSTANT_TICKS_LORE"); - addConstantItem(swItems, p, Material.TNT_MINECART, "SCRIPT_GUI_CONSTANT_TRACE_NAME", "SCRIPT_GUI_CONSTANT_TRACE_LORE"); - addConstantItem(swItems, p, Material.TNT_MINECART, "SCRIPT_GUI_CONSTANT_AUTO_TRACE_NAME", "SCRIPT_GUI_CONSTANT_AUTO_TRACE_LORE"); - addConstantItem(swItems, p, Material.TNT_MINECART, "SCRIPT_GUI_CONSTANT_TRACE_STATUS_NAME", "SCRIPT_GUI_CONSTANT_TRACE_STATUS_LORE"); - addConstantItem(swItems, p, Material.TNT_MINECART, "SCRIPT_GUI_CONSTANT_TRACE_TIME_NAME", "SCRIPT_GUI_CONSTANT_TRACE_TIME_LORE"); - addConstantItem(swItems, p, Material.HOPPER, "SCRIPT_GUI_CONSTANT_LOADER_STATUS_NAME", "SCRIPT_GUI_CONSTANT_LOADER_STATUS_LORE"); - addConstantItem(swItems, p, Material.TNT, "SCRIPT_GUI_CONSTANT_TNT_NAME", "SCRIPT_GUI_CONSTANT_TNT_LORE"); - addConstantItem(swItems, p, Material.TNT, "SCRIPT_GUI_CONSTANT_ONLY_TB_NAME", "SCRIPT_GUI_CONSTANT_ONLY_TB_LORE"); - addConstantItem(swItems, p, Material.GUNPOWDER, "SCRIPT_GUI_CONSTANT_FREEZE_NAME", "SCRIPT_GUI_CONSTANT_FREEZE_LORE"); - addConstantItem(swItems, p, Material.FIRE_CHARGE, "SCRIPT_GUI_CONSTANT_FIRE_NAME", "SCRIPT_GUI_CONSTANT_FIRE_LORE"); - addConstantItem(swItems, p, Material.OBSIDIAN, "SCRIPT_GUI_CONSTANT_PROTECT_NAME", "SCRIPT_GUI_CONSTANT_PROTECT_LORE"); - addConstantItem(swItems, p, Material.PLAYER_HEAD, "SCRIPT_GUI_CONSTANT_X_NAME", "SCRIPT_GUI_CONSTANT_X_LORE"); - addConstantItem(swItems, p, Material.PLAYER_HEAD, "SCRIPT_GUI_CONSTANT_Y_NAME", "SCRIPT_GUI_CONSTANT_Y_LORE"); - addConstantItem(swItems, p, Material.PLAYER_HEAD, "SCRIPT_GUI_CONSTANT_Z_NAME", "SCRIPT_GUI_CONSTANT_Z_LORE"); - addConstantItem(swItems, p, Material.NAME_TAG, "SCRIPT_GUI_CONSTANT_NAME_NAME", "SCRIPT_GUI_CONSTANT_NAME_LORE"); - addConstantItem(swItems, p, Material.IRON_BOOTS, "SCRIPT_GUI_CONSTANT_SNEAK_NAME", "SCRIPT_GUI_CONSTANT_SNEAK_LORE"); - addConstantItem(swItems, p, Material.DIAMOND_BOOTS, "SCRIPT_GUI_CONSTANT_SPRINTING_NAME", "SCRIPT_GUI_CONSTANT_SPRINTING_LORE"); - addConstantItem(swItems, p, Material.ARROW, "SCRIPT_GUI_CONSTANT_SLOT_NAME", "SCRIPT_GUI_CONSTANT_SLOT_LORE"); - addConstantItem(swItems, p, Material.GRASS_BLOCK, "SCRIPT_GUI_CONSTANT_SLOT_MATERIAL_NAME", "SCRIPT_GUI_CONSTANT_SLOT_MATERIAL_LORE"); - addConstantItem(swItems, p, Material.IRON_BLOCK, "SCRIPT_GUI_CONSTANT_OFF_HAND_MATERIAL_NAME", "SCRIPT_GUI_CONSTANT_OFF_HAND_MATERIAL_LORE"); - addConstantItem(swItems, p, Material.BIRCH_SIGN, "SCRIPT_GUI_CONSTANT_SLOT_MATERIAL_DISPLAY_NAME", "SCRIPT_GUI_CONSTANT_SLOT_MATERIAL_DISPLAY_LORE"); - addConstantItem(swItems, p, Material.ACACIA_SIGN, "SCRIPT_GUI_CONSTANT_OFF_HAND_MATERIAL_DISPLAY_NAME", "SCRIPT_GUI_CONSTANT_OFF_HAND_MATERIAL_DISPLAY_LORE"); - addConstantItem(swItems, p, Material.MAP, "SCRIPT_GUI_CONSTANT_REGION_TYPE_NAME", "SCRIPT_GUI_CONSTANT_REGION_TYPE_LORE"); - addConstantItem(swItems, p, Material.MAP, "SCRIPT_GUI_CONSTANT_REGION_NAME_NAME", "SCRIPT_GUI_CONSTANT_REGION_NAME_LORE"); - addConstantItem(swItems, p, Material.COMPASS, "SCRIPT_GUI_CONSTANT_TPS_NAME", "SCRIPT_GUI_CONSTANT_TPS_LORE"); - addConstantItem(swItems, p, Material.COMPASS, "SCRIPT_GUI_CONSTANT_TPS_LIMIT_NAME", "SCRIPT_GUI_CONSTANT_TPS_LIMIT_LORE"); - addEmptyItems(swItems, 45 - swItems.size() % 45); - - SWListInv swListInv = new SWListInv<>(p, BauSystem.MESSAGE.parse("SCRIPT_GUI_NAME", p), swItems, (clickType, o) -> { - if (o != null) { - BauSystem.MESSAGE.send("SCRIPT_GUI_COMMAND_CHAT", p, o.command()); - for (String s : o.description()) { - if (s.isEmpty()) { - BauSystem.MESSAGE.sendPrefixless("PREFIX", p); - } else { - BauSystem.MESSAGE.send(s, p); - } - } - p.closeInventory(); - } - }); - swListInv.open(); - } - - private void addEmptyItems(List> swItems, int count) { - for (int i = 0; i < count; i++) { - swItems.add(new SWListInv.SWListEntry<>(new SWItem(Material.GRAY_STAINED_GLASS_PANE, "§7", new ArrayList<>(), false, clickType -> { - }), null)); - } - } - - private SWItem createItem(Player p, Material material, String name, List lore) { - return new SWItem(material, BauSystem.MESSAGE.parse(name, p), lore, false, clickType -> { - }); - } - - private void addConstantItem(List> swItems, Player p, Material material, String name, String lore) { - List itemLore = new ArrayList<>(); - itemLore.add(BauSystem.MESSAGE.parse(lore, p)); - swItems.add(new SWListInv.SWListEntry<>(createItem(p, material, name, itemLore), null)); - } - - private void addCustomScriptsItems(List> swItems, Player p) { - List specialCommands = new ArrayList<>(SPECIAL_COMMANDS); - specialCommands.sort(Comparator.comparing(specialCommand -> specialCommand.getClass().getTypeName())); - specialCommands.forEach(specialCommand -> { - List strings = new ArrayList<>(); - boolean b = false; - for (String s : specialCommand.description()) { - if (s.isEmpty()) { - b = true; - strings.add(""); - continue; - } - s = BauSystem.MESSAGE.parse(s, p); - if (b) { - strings.addAll(split(s)); - } else { - strings.add(s); - } - } - - SWItem swItem = new SWItem(specialCommand.material(), BauSystem.MESSAGE.parse("SCRIPT_GUI_COMMAND_NAME", p, specialCommand.command()), strings, false, clickType -> { - }); - swItems.add(new SWListInv.SWListEntry<>(swItem, specialCommand)); - }); - } - - private List split(String s) { - List strings = new ArrayList<>(); - while (s.length() > 60) { - int index = s.indexOf(' ', 60); - if (index == -1) { - strings.add("§7" + s); - s = null; - break; - } else { - strings.add("§7" + s.substring(0, index)); - s = s.substring(index + 1); - } - } - if (s != null) { - strings.add("§7" + s); - } - return strings; - } - - @Register(value = "menu", description = "SCRIPT_COMMAND_HELP_MENU") - public void menuGUICommand(Player p) { - customScriptManager.openCommandsMenu(p); + @Register + public void genericCommand(Player player) { + ScriptGUI.open(player); } } diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/script/ScriptExecutor.java b/BauSystem_Main/src/de/steamwar/bausystem/features/script/ScriptExecutor.java deleted file mode 100644 index 25b29147..00000000 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/script/ScriptExecutor.java +++ /dev/null @@ -1,304 +0,0 @@ -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 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 net.md_5.bungee.api.ChatColor; -import org.bukkit.Bukkit; -import org.bukkit.entity.Player; -import org.bukkit.event.player.PlayerCommandPreprocessEvent; -import org.bukkit.inventory.meta.BookMeta; - -import java.util.*; -import java.util.function.Consumer; -import java.util.logging.Level; - -public final class ScriptExecutor { - - public static final Set SPECIAL_COMMANDS = new HashSet<>(); - - static { - LinkageUtils.linkScriptCommands(); - } - - private static final boolean hasFAWE = Bukkit.getPluginManager().getPlugin("FastAsyncWorldEdit") != null; - - private String specialCommand = null; - - @Getter - private final Player player; - - @Getter - private final Context localVariables = new Context(); - - @Getter - private final Context globalVariables; - - private final List commands = new ArrayList<>(); - - @Getter - public final Map jumpPoints = new HashMap<>(); - - @Getter - private final LinkedList returnStack = new LinkedList<>(); - - @Getter - @Setter - private int index = 0; - - @Getter - private final Consumer echoConsumer; - - public ScriptExecutor(BookMeta bookMeta, Player player, Consumer echoConsumer) { - this(bookMeta, player, new HashMap<>(), echoConsumer); - } - - public ScriptExecutor(List pages, Player player, Consumer echoConsumer) { - this(pages, player, new HashMap<>(), echoConsumer); - } - - public ScriptExecutor(BookMeta bookMeta, Player player, Map localVariables, Consumer echoConsumer) { - this.player = player; - globalVariables = ScriptListener.getGlobalContext(player); - - parseMeta(bookMeta); - this.echoConsumer = echoConsumer != null ? echoConsumer : s -> { - BauSystem.MESSAGE.send("SCRIPT_COMMAND_IO_ECHO_MESSAGE", player, s); - }; - if (commands.isEmpty()) return; - localVariables.forEach(this.localVariables::putValue); - resume(); - } - - public ScriptExecutor(List pages, Player player, Map localVariables, Consumer echoConsumer) { - this.player = player; - globalVariables = ScriptListener.getGlobalContext(player); - - parseList(pages); - this.echoConsumer = echoConsumer != null ? echoConsumer : s -> { - BauSystem.MESSAGE.send("SCRIPT_COMMAND_IO_ECHO_MESSAGE", player, s); - }; - if (commands.isEmpty()) return; - localVariables.forEach(this.localVariables::putValue); - resume(); - } - - private void parseMeta(BookMeta bookMeta) { - boolean initial = true; - for (String page : bookMeta.getPages()) { - initial = parsePage(page, initial); - } - } - - private void parseList(List pages) { - boolean initial = true; - for (String page : pages) { - initial = parsePage(page, initial); - } - } - - private boolean parsePage(String page, boolean initial) { - for (String command : page.split("\n")) { - command = command.replaceAll(" +", " "); - if (command.startsWith("#") || command.trim().isEmpty()) { - if (initial && command.startsWith("#!CMD /")) { - specialCommand = command.substring(7).split(" ")[0]; - } - initial = false; - continue; - } - initial = false; - if (command.startsWith(".")) { - jumpPoints.put(command.substring(1), commands.size()); - continue; - } - commands.add(command); - } - return initial; - } - - public void resume() { - if (!player.isOnline()) { - return; - } - - int executionPoints = 0; - - while (index < commands.size()) { - String command = commands.get(index).trim(); - index++; - if (executionPoints++ > 200) { - BauSystem.MESSAGE.send("SCRIPT_SLEEP_ERROR", player); - return; - } - - String[] strings = replaceExpressions(command); - if (strings.length == 0) { - return; - } - boolean found = false; - for (SpecialCommand specialCommand : SPECIAL_COMMANDS) { - if (specialCommand.command().equalsIgnoreCase(strings[0])) { - found = true; - if (!specialCommand.execute(strings, this)) { - return; - } - } - } - if (found) { - continue; - } - - if (strings[0].contains(":")) { - continue; - } - - // Variable Replaces in commands. - command = String.join(" ", strings); - - PlayerCommandPreprocessEvent preprocessEvent = new PlayerCommandPreprocessEvent(player, "/" + (specialCommand != null && command.startsWith(specialCommand) ? "script:" : "") + command); - Bukkit.getServer().getPluginManager().callEvent(preprocessEvent); - if (preprocessEvent.isCancelled()) { - continue; - } - - Bukkit.getLogger().log(Level.INFO, player.getName() + " dispatched command: " + command); - if (!strings[0].equals("select") && hasFAWE && WorldEditListener.isWorldEditCommand("/" + strings[0])) { - EditSession editSession = WorldEditUtils.getEditSession(player); - Actor actor = BukkitAdapter.adapt(player); - WorldEdit.getInstance().getPlatformManager().getPlatformCommandManager().handleCommandOnCurrentThread(new CommandEvent(actor, command, editSession)); - editSession.flushSession(); - WorldEditUtils.addToPlayer(player, editSession); - } else { - Bukkit.getServer().dispatchCommand(player, command); - } - } - } - - private String[] replaceExpressions(String s) { - s = s.replaceAll(" +", " "); - 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 Value.parse(variable); - } - - if (localVariables.hasValue(variable)) { - return localVariables.getValue(variable); - } - if (globalVariables.hasValue(variable)) { - return globalVariables.getValue(variable); - } - return Constants.getConstant(variable, player); - } - - public Value getValueOrNull(String variable) { - if (localVariables.hasValue(variable)) { - return localVariables.getValue(variable); - } - if (globalVariables.hasValue(variable)) { - return globalVariables.getValue(variable); - } - if (Constants.isConstant(variable)) { - return Constants.getConstant(variable, player); - } - return null; - } - - public String getOrItself(String variable) { - if (isVariable(variable)) { - return getValue(variable); - } - return variable; - } - - public boolean isVariable(String variable) { - return Constants.isConstant(variable) || globalVariables.hasValue(variable) || localVariables.hasValue(variable); - } - - public String getValue(String variable) { - if (localVariables.hasValue(variable)) { - return localVariables.getValue(variable).asString(); - } - if (globalVariables.hasValue(variable)) { - return globalVariables.getValue(variable).asString(); - } - if (Constants.isConstant(variable)) { - return Constants.getConstant(variable, player).asString(); - } - return ""; - } - - public String getConstant(String variable) { - if (Constants.isConstant(variable)) { - return Constants.getConstant(variable, player).asString(); - } - return "0"; - } - - public String getGlobal(String variable) { - if (globalVariables.hasValue(variable)) { - return globalVariables.getValue(variable).asString(); - } - return "0"; - } - - public String getLocal(String variable) { - if (localVariables.hasValue(variable)) { - return localVariables.getValue(variable).asString(); - } - return "0"; - } -} diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/script/ScriptGUI.java b/BauSystem_Main/src/de/steamwar/bausystem/features/script/ScriptGUI.java new file mode 100644 index 00000000..c8098fed --- /dev/null +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/script/ScriptGUI.java @@ -0,0 +1,126 @@ +/* + * This file is a part of the SteamWar software. + * + * Copyright (C) 2023 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.lua.SteamWarPlatform; +import de.steamwar.inventory.SWAnvilInv; +import de.steamwar.inventory.SWItem; +import de.steamwar.inventory.SWListInv; +import de.steamwar.linkage.Linked; +import de.steamwar.sql.Script; +import de.steamwar.sql.SteamwarUser; +import org.bukkit.Material; +import org.bukkit.entity.Player; +import org.bukkit.event.Listener; +import org.bukkit.event.inventory.ClickType; +import org.bukkit.inventory.ItemStack; +import org.bukkit.inventory.meta.BookMeta; +import org.luaj.vm2.Globals; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.List; + +@Linked +public class ScriptGUI implements Listener { + public static void open(Player player) { + open(player, null); + } + + private static void open(Player player, ItemStack setCursor) { + SteamwarUser user = SteamwarUser.get(player.getUniqueId()); + List> entries = new ArrayList<>(); + List lore = new ArrayList<>(); + Globals globals = SteamWarPlatform.createGlobalParser( + (eventType, luaFunction) -> lore.add(BauSystem.MESSAGE.parse("SCRIPT_EVENT_ITEM_NAME", player, eventType.name())), + (s, luaFunction) -> lore.add(BauSystem.MESSAGE.parse("SCRIPT_HOTKEY_ITEM_NAME", player, s)), + commandRegister -> lore.add(BauSystem.MESSAGE.parse("SCRIPT_COMMAND_ITEM_NAME", player, commandRegister.getName())) + ); + + Script.list(user).forEach(script -> { + try { + globals.load(script.getCode()).call(); + } catch (Exception e) { + String[] sp = e.getMessage().split(":"); + lore.add(BauSystem.MESSAGE.parse("SCRIPT_ERROR_GUI", player, String.join(":", Arrays.copyOfRange(sp, 1, sp.length)))); + } + + if(!lore.isEmpty()) { + lore.add(""); + } + lore.add(BauSystem.MESSAGE.parse("SCRIPT_MENU_GUI_ITEM_LORE_1", player)); + lore.add(BauSystem.MESSAGE.parse("SCRIPT_MENU_GUI_ITEM_LORE_2", player)); + lore.add(BauSystem.MESSAGE.parse("SCRIPT_MENU_GUI_ITEM_LORE_3", player)); + lore.add(BauSystem.MESSAGE.parse("SCRIPT_MENU_GUI_ITEM_LORE_4", player)); + + entries.add(new SWListInv.SWListEntry<>(new SWItem(Material.ENCHANTED_BOOK, script.getName(), new ArrayList<>(lore), false, clickType -> {}), script)); + lore.clear(); + }); + + SWListInv