diff --git a/.gitignore b/.gitignore index 377ce8c..36e1257 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,15 @@ +# Package Files +*.jar + +# Gradle +.gradle +**/build/ +!gradle/wrapper/gradle-wrapper.jar +steamwar.properties + +# IntelliJ IDEA .idea -target -lib -dependency-reduced-pom.xml -*.iml \ No newline at end of file +*.iml + +# Other +lib \ No newline at end of file diff --git a/SchematicSystem_15/build.gradle b/SchematicSystem_15/build.gradle new file mode 100644 index 0000000..cb6a6ae --- /dev/null +++ b/SchematicSystem_15/build.gradle @@ -0,0 +1,56 @@ +/* + * 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 . + */ + +plugins { + id 'base' + id 'java' +} + +group 'steamwar' +version '1.0' + +compileJava.options.encoding = 'UTF-8' + +sourceCompatibility = 1.8 +targetCompatibility = 1.8 + +sourceSets { + main { + java { + srcDirs = ['src/'] + } + resources { + srcDirs = ['src/'] + exclude '**/*.java', '**/*.kt' + } + } +} + +dependencies { + compileOnly 'org.projectlombok:lombok:1.18.22' + testCompileOnly 'org.projectlombok:lombok:1.18.22' + annotationProcessor 'org.projectlombok:lombok:1.18.22' + testAnnotationProcessor 'org.projectlombok:lombok:1.18.22' + + implementation project(":SchematicSystem_Core") + + compileOnly files("${projectDir}/../lib/Spigot-1.15.jar") + compileOnly files("${projectDir}/../lib/WorldEdit-1.15.jar") + compileOnly files("${projectDir}/../lib/SpigotCore.jar") +} diff --git a/SchematicSystem_15/pom.xml b/SchematicSystem_15/pom.xml deleted file mode 100644 index e23f79a..0000000 --- a/SchematicSystem_15/pom.xml +++ /dev/null @@ -1,54 +0,0 @@ - - - 4.0.0 - - SchematicSystem_15 - 1.0 - - - steamwar - SchematicSystem - 1.0 - - - - ${project.basedir}/.. - - - - src - - - src - - **/*.java - **/*.kt - - - - - - - - steamwar - SchematicSystem_Core - 1.0 - - - steamwar - Spigot - 1.15 - system - ${main.basedir}/lib/Spigot-1.15.jar - - - steamwar - WorldEdit - 1.15 - system - ${main.basedir}/lib/WorldEdit-1.15.jar - - - \ No newline at end of file diff --git a/SchematicSystem_15/settings.gradle b/SchematicSystem_15/settings.gradle new file mode 100644 index 0000000..99722b8 --- /dev/null +++ b/SchematicSystem_15/settings.gradle @@ -0,0 +1,20 @@ +/* + * This file is a part of the SteamWar software. + * + * Copyright (C) 2020 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 . + */ + +rootProject.name = 'SchematicSystem_15' \ No newline at end of file diff --git a/SchematicSystem_8/build.gradle b/SchematicSystem_8/build.gradle new file mode 100644 index 0000000..afd30df --- /dev/null +++ b/SchematicSystem_8/build.gradle @@ -0,0 +1,56 @@ +/* + * 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 . + */ + +plugins { + id 'base' + id 'java' +} + +group 'steamwar' +version '1.0' + +compileJava.options.encoding = 'UTF-8' + +sourceCompatibility = 1.8 +targetCompatibility = 1.8 + +sourceSets { + main { + java { + srcDirs = ['src/'] + } + resources { + srcDirs = ['src/'] + exclude '**/*.java', '**/*.kt' + } + } +} + +dependencies { + compileOnly 'org.projectlombok:lombok:1.18.22' + testCompileOnly 'org.projectlombok:lombok:1.18.22' + annotationProcessor 'org.projectlombok:lombok:1.18.22' + testAnnotationProcessor 'org.projectlombok:lombok:1.18.22' + + implementation project(":SchematicSystem_Core") + + compileOnly files("${projectDir}/../lib/Spigot-1.8.jar") + compileOnly files("${projectDir}/../lib/WorldEdit-1.12.jar") + compileOnly files("${projectDir}/../lib/SpigotCore.jar") +} diff --git a/SchematicSystem_8/pom.xml b/SchematicSystem_8/pom.xml deleted file mode 100644 index 109833f..0000000 --- a/SchematicSystem_8/pom.xml +++ /dev/null @@ -1,54 +0,0 @@ - - - 4.0.0 - - SchematicSystem_8 - 1.0 - - - steamwar - SchematicSystem - 1.0 - - - - ${project.basedir}/.. - - - - src - - - src - - **/*.java - **/*.kt - - - - - - - - steamwar - Spigot - 1.8 - system - ${main.basedir}/lib/Spigot-1.8.jar - - - steamwar - WorldEdit - 1.12 - system - ${main.basedir}/lib/WorldEdit-1.12.jar - - - steamwar - SchematicSystem_Core - 1.0 - - - \ No newline at end of file diff --git a/SchematicSystem_8/settings.gradle b/SchematicSystem_8/settings.gradle new file mode 100644 index 0000000..f86503d --- /dev/null +++ b/SchematicSystem_8/settings.gradle @@ -0,0 +1,20 @@ +/* + * This file is a part of the SteamWar software. + * + * Copyright (C) 2020 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 . + */ + +rootProject.name = 'SchematicSystem_8' \ No newline at end of file diff --git a/SchematicSystem_Core/build.gradle b/SchematicSystem_Core/build.gradle new file mode 100644 index 0000000..282fc61 --- /dev/null +++ b/SchematicSystem_Core/build.gradle @@ -0,0 +1,54 @@ +/* + * 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 . + */ + +plugins { + id 'base' + id 'java' +} + +group 'steamwar' +version '1.0' + +compileJava.options.encoding = 'UTF-8' + +sourceCompatibility = 1.8 +targetCompatibility = 1.8 + +sourceSets { + main { + java { + srcDirs = ['src/'] + } + resources { + srcDirs = ['src/'] + exclude '**/*.java', '**/*.kt' + } + } +} + +dependencies { + compileOnly 'org.projectlombok:lombok:1.18.22' + testCompileOnly 'org.projectlombok:lombok:1.18.22' + annotationProcessor 'org.projectlombok:lombok:1.18.22' + testAnnotationProcessor 'org.projectlombok:lombok:1.18.22' + + compileOnly files("${projectDir}/../lib/Spigot-1.15.jar") + compileOnly files("${projectDir}/../lib/WorldEdit-1.15.jar") + compileOnly files("${projectDir}/../lib/SpigotCore.jar") +} diff --git a/SchematicSystem_Core/pom.xml b/SchematicSystem_Core/pom.xml deleted file mode 100644 index 60d1745..0000000 --- a/SchematicSystem_Core/pom.xml +++ /dev/null @@ -1,50 +0,0 @@ - - - 4.0.0 - - - steamwar - SchematicSystem - 1.0 - - - - ${project.basedir}/.. - - - SchematicSystem_Core - 1.0 - jar - - - src - - - src - - **/*.java - **/*.kt - - - - - - - - steamwar - Spigot - 1.15 - system - ${main.basedir}/lib/Spigot-1.15.jar - - - steamwar - WorldEdit - 1.15 - system - ${main.basedir}/lib/WorldEdit-1.15.jar - - - \ No newline at end of file diff --git a/SchematicSystem_Core/settings.gradle b/SchematicSystem_Core/settings.gradle new file mode 100644 index 0000000..0463912 --- /dev/null +++ b/SchematicSystem_Core/settings.gradle @@ -0,0 +1,20 @@ +/* + * This file is a part of the SteamWar software. + * + * Copyright (C) 2020 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 . + */ + +rootProject.name = 'SchematicSystem_Core' \ No newline at end of file diff --git a/SchematicSystem_Core/src/SchematicSystem.properties b/SchematicSystem_Core/src/SchematicSystem.properties new file mode 100644 index 0000000..f3a2f19 --- /dev/null +++ b/SchematicSystem_Core/src/SchematicSystem.properties @@ -0,0 +1,215 @@ +PREFIX=§eSchematic§8» §7 +ON=§aon +OFF=§coff +CHANGE=§7change +CLICK=§7click +CURRENT=§7Current: {0} +CONFIRM=§aConfirm +CANCEL=§cCancel + +UTIL_NAME_REQUIRED=§cFolder name required +UTIL_NAME_TOO_LONG=§cSchematic name too long +UTIL_NAME_INVALID_CHAR=§cThe specified schema name contains forbidden characters +UTIL_NAME_FORBIDDEN=§cThe path must not contain \"§l{0}§c\" +UTIL_LIST_HEAD=§eSchematics §8(§e{0}§8) +UTIL_LIST_PATH=§7Current path: §e{0} +UTIL_LIST_BACK=§e../ +UTIL_LIST_BACK_HOVER=§eBack {0} +UTIL_LIST_DIR=§7§lDIR +UTIL_LIST_TYPE=§8§l{0} +UTIL_LIST_BASE=§e +UTIL_LIST_FROM=§8Owner §7{0} +UTIL_LIST_OPEN_DIR=§eShow directory +UTIL_LIST_OPEN_SCHEM=§eManage schematics +UTIL_LIST_REMOVE=[Remove] +UTIL_LIST_REMOVE_HOVER=§7Remove yourself from the directory +UTIL_LIST_BACK_ARROW=«« +UTIL_LIST_BACK_ARROW_HOVER=§ePrevious page +UTIL_LIST_NEXT=Page ({0}/{1}) »» +UTIL_LIST_NEXT_HOVER=§eNext page +UTIL_INFO_SCHEM=§7Schematic: §e{0} +UTIL_INFO_NAME=§7Name: §e{0} +UTIL_INFO_OWNER=§7Owner: §e{0} +UTIL_INFO_PARENT=§7Directory: §e{0} +UTIL_INFO_UPDATED=§7Last update: §e{0} +UTIL_INFO_TYPE=§7Type: §e{0} +UTIL_INFO_TYPE_DIR=§7DIR +UTIL_INFO_RANK=§7Rank: §e{0} +UTIL_INFO_COLOR=§Color translation: {0} +UTIL_INFO_REPLAY=§7Replay playback: {0} +UTIL_INFO_FORMAT=§7Format: §e{0} +UTIL_INFO_STATUS=§cState: §c{0}: {1} +UTIL_INFO_MEMBER=§7Members: §e{0} +UTIL_INFO_ACTION_LOAD=[Load] +UTIL_INFO_ACTION_LOAD_HOVER=§eLoad schematic +UTIL_INFO_ACTION_DOWNLOAD=[Download] +UTIL_INFO_ACTION_DOWNLOAD_HOVER=§eDownload schematic +UTIL_INFO_ACTION_TYPE=[Change type] +UTIL_INFO_ACTION_TYPE_HOVER=§eChange schematic type +UTIL_INFO_ACTION_ADD=[Add] +UTIL_INFO_ACTION_ADD_HOVER=§eAdd member +UTIL_INFO_ACTION_REMOVE=[Remove] +UTIL_INFO_ACTION_REMOVE_HOVER=§eRemove member +UTIL_INFO_ACTION_MOVE=[Move] +UTIL_INFO_ACTION_MOVE_HOVER=§eMove schematic +UTIL_INFO_ACTION_RENAME=[Rename] +UTIL_INFO_ACTION_RENAME_HOVER=§eRename schematic +UTIL_INFO_ACTION_DELETE=[Delete] +UTIL_INFO_ACTION_DELETE_HOVER=§eDelete schematic +UTIL_LOAD_NOT_HERE=§cYou cannot load schematics here +UTIL_LOAD_NOT_HERE_ALL=§cSchematics cannot be loaded on this build +UTIL_LOAD_DIR=§cYou cannot load folders +UTIL_LOAD_DONE=§7Schematic §e{0} loaded +UTIL_LOAD_NO_DATA=§cNo data could be found in the Schematic +UTIL_LOAD_ERROR=§cThe schematic could not be loaded +UTIL_DOWNLOAD_PUNISHED=§cYou are not allowed to download schematics: §f§l{0} +UTIL_DOWNLOAD_NOT_OWN=§cYou may download only your own schematics +UTIL_DOWNLOAD_LINK=Your download link: +UTIL_TYPE_PUNISHED=§cYou are not allowed to submit schematics: §f§l{0} +UTIL_TYPE_NOT_OWN=§cYou can only submit your own schematics +UTIL_TYPE_DIR=§cYou cannot submit folders +UTIL_TYPE_NOT_ASSIGNABLE=§cSchematics cannot be changed for this type +UTIL_TYPE_ALREADY=§cThe Schematic already has this type +UTIL_TYPE_DONE=§aChange schematic type +UTIL_TYPE_FIGHT_ALREADY=§cYou have already submitted this schematic +UTIL_TYPE_AFTER_DEADLINE=§cSchematics of this type can no longer be submitted. Deadline was: {0} +UTIL_TYPE_ERROR=§cThe Schematic is not compliant with the rules +UTIL_TYPE_EXTEND=§aThe preparation server is starting +UTIL_SUBMIT_TITLE=Extend Schematic +UTIL_SUBMIT_REPLAY_ON=§aReplay allowed +UTIL_SUBMIT_REPLAY_OFF=§cReplay locked +UTIL_SUBMIT_COLOR_ON=§aReplace pink to team color +UTIL_SUBMIT_COLOR_OFF=§cDo not replace pink +UTIL_SUBMIT_DIRECT=§eSubmit directly +UTIL_SUBMIT_DIRECT_DONE=§aThe Schematic will be reviewed in a timely manner +UTIL_SUBMIT_EXTEND=§eExtend Schematic +UTIL_SUBMIT_EXTEND_DONE=§aThe preparation server is starting + +COMMAND_NOT_FOLDER=This is a schematic and not a folder +COMMAND_ENTER_NAME=Insert name +COMMAND_PUNISHMENT_NO_SAVE_EXTERNAL=§cYou can not make schematics on other build server +COMMAND_PUNISHMENT_NO_SAVE=§cSchematics cannot be made on this build +COMMAND_SAVE_NO_NAME=§cYou must also specify a name for the schematic after the folder +COMMAND_SAVE_FOLDER=§cSchematic is a folder +COMMAND_SAVE_NO_OVERWRITE=§cYou must not overwrite this Schematic +COMMAND_SAVE_CLIPBOARD_EMPTY=§cYour clipboard is empty +COMMAND_SAVE_ERROR=§cError while saving the Schematic +COMMAND_SAVE_DONE=Schematic §e{0} §7stored +COMMAND_SAVE_OVERWRITE=Schematic §e{0} §7overwritten +COMMAND_ADD_PUNISH=§cYou may not add anyone to your schematics: §f§l{0} +COMMAND_ADD_NOT_OWNER=§cYou can only add someone to your own stuff +COMMAND_ADD_USER_PUNISHED=§c{0} must not be added to schematics +COMMAND_ADD_OWN=§cSo please: This is your own Schematic! +COMMAND_ADD_PUBLIC=§cFor public requests please contact the moderator +COMMAND_ADD_ALREADY=§c{0} is already added to this schematic +COMMAND_ADD_ADDED=You now have access to the Schematic §e{0} §7of §e{1} +COMMAND_ADD_NONE=§cNo player has been added +COMMAND_ADD_ONE=§7The player §e{0} was added to the schematic +COMMAND_ADD_MANY=§7The players §e{0} were added to the schematic +COMMAND_DELMEM_NOT_OWN=§cYou can only remove someone on your own stuff +COMMAND_DELMEM_DONE=The player §e{0} §7no longer has access to the Schematic §e{1} +COMMAND_DELMEM_DELETED=§cYou now no longer have access to the Schematic §e{0} §7of §e{1} +COMMAND_SEARCH_NOT_A_PLAYER=§cThe player §e{0} §cdoes not exists +COMMAND_LOCKREPLAY=Replays of fights with {0} can no longer be viewed from now on +COMMAND_REPLACE_COLOR_OFF=In fights {0} pink blocks are not replaced +COMMAND_REPLACE_COLOR_ON=In fights {0} pink blocks are replaced +COMMAND_DIR_DONE=§7Directory §e{0} §7created +COMMAND_CHANGE_TYPE_NOT_OWNER=§cYou can only submit your own schematics +COMMAND_CHANGE_TYPE_SELECT=§eSelect type +COMMAND_MOVE_NOT_OWN=§cYou can only move your own shematics +COMMAND_MOVE_RECURSIVE=§cThis only gives mistakes, trust me +COMMAND_MOVE_DONE=§7The schematic can now be found under §e{0} +COMMAND_RENAME_NOT_OWN=§cYou can only do that with your own schematics +COMMAND_RENAME_DONE=§7The schematic is now called §e{0} +COMMAND_ADD_TEAM_NOT_OWN=§cYou can only do that with your own schematics +COMMAND_ADD_TEAM_NOT_IN_TEAM=§cYou are not in any team +COMMAND_DEL_TEAM_NOT_OWN=§cYou can only do that with your own schematics +COMMAND_DEL_TEAM_NOT_IN_TEAM=§cYou are not in any team +COMMAND_DEL_TEAM_NONE=§7No player was removed +COMMAND_DEL_TEAM_DONE=§7The player §e{0} §7were removed from the Schematic +COMMAND_CLEAR_MEMBER_NOT_OWN=§cYou can only do that with your own schematics +COMMAND_CLEAR_MEMBER_DONE=§7All players were removed from the Schematic +COMMAND_DEL_ALL_MEMBER=§e{0} §7has been removed from §e{1} §7Schematics +COMMAND_PUBLIC_ON=§aYou are now the public user +COMMAND_PUBLIC_OFF=§cYou are no longer the public user +COMMAND_DELETE_NOT_OWN=§cThe schematic is not yours +COMMAND_DELETE_MEMBER=§aYou have removed yourself from the Schematic +COMMAND_DELETE_DIR=§aThe folder §e{0}§a is deleted... +COMMAND_DELETE_DIR_FULL=§cThe folder must be empty to delete it +COMMAND_DELETE_SCHEM=§aThe Schematic §e{0}§a is deleted... + +HELP_HEADER=§e§lSchematicSystem §8§lHelp +HELP_VIEW=Find & Load +HELP_VIEW_HOVER=Search or download schematics +HELP_VIEW_1=§8/§7schem §einfo §8[§7schematic§8] - §7Shows information about the schematic +HELP_VIEW_2=§8/§7schem §elist §8- §7Shows you your schematics +HELP_VIEW_3=§8/§7schem §elist public §8- §7Shows all public schematics +HELP_VIEW_4=§8/§7schem §esearch §8[§7keyword§8] - §7Searches for matching schematics +HELP_VIEW_5=§8/§7schem §eload §8[§7schematic§8] - §7Loads a schematic +HELP_VIEW_6=§8/§7schem §edownload §8[§7schematic§8] - §7Gives you a download link (valid for 1 min) +HELP_EDIT=Save & Edit +HELP_EDIT_HOVER=Modification of schematics and folders +HELP_EDIT_1=§8/§7schem §esave §8[§7schematic§8] - §7Saves your clipboard as a schematic +HELP_EDIT_2=§8/§7schem §eordner §8[§7directory§8] - §7Create an empty folder +HELP_EDIT_3=§8/§7schem §emove §8[§7schematic§8] [§7new path§8] - §7Move a schematic +HELP_EDIT_4=§8/§7schem §erename §8[§7schematic§8] [§7new path§8] - §7Give the schematic a new name +HELP_EDIT_5=§8/§7schem §echangetype §8[§7schematic§8] - §7Changes the type of your schematic +HELP_EDIT_6=§8/§7schem §elockreplay §8[§7schematic§8] - §7Locks replays of the schematic +HELP_EDIT_7=§8/§7schem §ereplacecolor §8[§7schematic§8] - §7Changes color substitution in the arena +HELP_EDIT_8=§8/§7schem §edelete §8[§7schematic§8] - §7Deletes a schematic +HELP_SHARE=Ownership +HELP_SHARE_HOVER=Share Schematics with others +HELP_SHARE_1=§8/§7schem §eaddmember §8[§7schematic§8] §8[§7Spieler§8] - §7Adds a player to a schematic +HELP_SHARE_2=§8/§7schem §edelmember §8[§7schematic§8] §8[§7Spieler§8] - §7Removes a player from a schematic +HELP_SHARE_3=§8/§7schem §eclearmember §8[§7schematic§8] - §7Removes all players from the schematic +HELP_SHARE_4=§8/§7schem §edelallmember §8[§7player§8] - §7Removes a player from all your schematics +HELP_SHARE_5=§8/§7schem §eaddteam §8[§7schematic§8] - §7Add everyone from your team to the schematic +HELP_SHARE_6=§8/§7schem §edelteam §8[§7schematic§8] - §7Remove everyone from your team from the Schematic + +GUI_TITLE=Schematics \{1\} +GUI_FOLDER_PROPERTIES=§7Directory properties +GUI_INFO_LOAD=§eLoading +GUI_INFO_BACK=§eBack +GUI_INFO_STATUS=§eState {0} +GUI_INFO_STATUS_LORE=§7{0} +GUI_INFO_MAT=§e{0} +GUI_INFO_TYPE=§e{0} +GUI_INFO_DOWNLOAD=§eDownload +GUI_INFO_COLOR=Color translation +GUI_INFO_REPLAY=Replay playback +GUI_INFO_REPLAY_OFF=§7§lTurn off +GUI_INFO_REPLAY_TITLE=Lock playback permanently +GUI_INFO_MEMBER=§eMembers +GUI_INFO_MOVE=§eMove +GUI_INFO_RENAME=§eRename +GUI_INFO_RENAME_TITLE={0} rename +GUI_INFO_DELETE=§cDelete +GUI_INFO_MEMBER_FROM=§7Owner §e{0} +GUI_INFO_MEMBER_REMOVE=§cRemove access +GUI_CHANGE_TYPE=Change type +GUI_DELETE_OWN_DELETED=Schematic §e{0} §7deleted +GUI_DELETE_OWN_TITLE=Delete {0} +GUI_DELETE_MEMBER_TITLE=Remove {0} +GUI_DELETE_MEMBER_DONE=Access to Schematic §e{0} §7removed +GUI_DELETE_MEMBERS_TITLE=Remove members +GUI_CHANGE_ITEM=Change item + +AUTO_CHECK_RESULT_NOT_LOAD=The schematic could not be loaded +AUTO_CHECK_RESULT_TOO_WIDE=The schematic is too wide ({0} > {1}) +AUTO_CHECK_RESULT_TOO_LONG=The schematic is too long ({0} > {1}) +AUTO_CHECK_RESULT_TOO_HIGH=The schematic is too high ({0} > {1}) +AUTO_CHECK_RESULT_TOO_MANY_BLOCK=The block {0} was used {1} times too often +AUTO_CHECK_RESULT_TOO_MANY_BLOCKS=The block combination {0} was used {1} times too often +AUTO_CHECK_RESULT_TOO_MANY_ALL_BLOCKS=Too many blocks ({0} > {1}) +AUTO_CHECK_RESULT_TOO_MANY_RECORDS=No records allowed ({0} found) +AUTO_CHECK_RESULT_FORBIDDEN_ITEM=In {0}s the forbidden item {1} {2} times was found +AUTO_CHECK_RESULT_FORBIDDEN_ITEM_NBT=In {0}s the forbidden item {1} {2} times was found with custom tag +AUTO_CHECK_RESULT_TOO_MANY_DISPENSER_ITEMS=One launcher contains more than {0} arrows and fireballs +AUTO_CHECK_RESULT_TOO_MANY_DISPENSERS_ITEMS={0} launchers contains more than {1} arrows and fireballs +AUTO_CHECK_RESULT_NBTS_WARNING={0} {1}s contain no or incorrect NBT data +AUTO_CHECK_RESULT_NBT_WARNING=One {0} contains no or incorrect NBT data. + +SAFE_NODE_NOT_A_DIR=§cThe selected Schematic is not a folder +SAFE_NODE_ALREADY_IN_DIRECTORY=§cThe schematic is already available in this folder +SAFE_NODE_INVALID_NAME=§cThis name is illegal +SAFE_NODE_NOT_OWNER=§cYou are not the owner of this schematic diff --git a/SchematicSystem_Core/src/SchematicSystem_de.properties b/SchematicSystem_Core/src/SchematicSystem_de.properties new file mode 100644 index 0000000..a9d085d --- /dev/null +++ b/SchematicSystem_Core/src/SchematicSystem_de.properties @@ -0,0 +1,199 @@ +ON=§aAn +OFF=§cAus +CHANGE=§7Zum Ändern +CLICK=§7anklicken +CURRENT=§7Aktuell: {0} +CONFIRM=§aBestätigen +CANCEL=§cAbbrechen + +UTIL_NAME_REQUIRED=§cDeine Ordner brauchen schon einen Namen +UTIL_NAME_TOO_LONG=§cDer Name der Schematic ist zu lang +UTIL_NAME_INVALID_CHAR=§cDer angegebene Schematicname enthält verbotene Zeichen +UTIL_NAME_FORBIDDEN=§cDer Pfad darf nicht \"§l{0}§c\" enthalten +UTIL_LIST_PATH=§7Aktueller Pfad: §e{0} +UTIL_LIST_BACK_HOVER=§eZurück gehen {0} +UTIL_LIST_FROM=§8von §7{0} +UTIL_LIST_OPEN_DIR=§eOrdner anzeigen +UTIL_LIST_OPEN_SCHEM=§eSchematic verwalten +UTIL_LIST_REMOVE=[Entfernen] +UTIL_LIST_REMOVE_HOVER=§7Entferne dich von dem Ordner +UTIL_LIST_BACK_ARROW_HOVER=§eVorherige Seite +UTIL_LIST_NEXT=Seite ({0}/{1}) »» +UTIL_LIST_NEXT_HOVER=§eNächste Seite +UTIL_INFO_OWNER=§7Besitzer: §e{0} +UTIL_INFO_PARENT=§7Ordner: §e{0} +UTIL_INFO_UPDATED=§7Letzes Update: §e{0} +UTIL_INFO_TYPE=§7Typ: §e{0} +UTIL_INFO_RANK=§7Rang: §e{0} +UTIL_INFO_COLOR=§7Farbersetzung: {0} +UTIL_INFO_REPLAY=§7Replaywiedergabe: {0} +UTIL_INFO_STATUS=§cStatus: §c{0}: {1} +UTIL_INFO_MEMBER=§7Mitglieder: §e{0} +UTIL_INFO_ACTION_LOAD=[Laden] +UTIL_INFO_ACTION_LOAD_HOVER=§eSchematic laden +UTIL_INFO_ACTION_DOWNLOAD_HOVER=§eSchematic downloaden +UTIL_INFO_ACTION_TYPE=[Typ ändern] +UTIL_INFO_ACTION_TYPE_HOVER=§eSchematic Typ ändern +UTIL_INFO_ACTION_ADD=[Hinzufügen] +UTIL_INFO_ACTION_ADD_HOVER=§eMember hinzufügen +UTIL_INFO_ACTION_REMOVE=[Entfernen] +UTIL_INFO_ACTION_REMOVE_HOVER=§eMember entfernen +UTIL_INFO_ACTION_MOVE=[Verschieben] +UTIL_INFO_ACTION_MOVE_HOVER=§eSchematic verschieben +UTIL_INFO_ACTION_RENAME=[Umbenennen] +UTIL_INFO_ACTION_RENAME_HOVER=§eSchematic umbenennen +UTIL_INFO_ACTION_DELETE=[Löschen] +UTIL_INFO_ACTION_DELETE_HOVER=§eSchematic löschen +UTIL_LOAD_NOT_HERE=§cDu kannst hier keine Schematics laden +UTIL_LOAD_NOT_HERE_ALL=§cAuf diesem Bau können keine Schematics geladen werden +UTIL_LOAD_DIR=§cDu kannst keine Ordner Laden +UTIL_LOAD_DONE=§7Schematic §e{0} geladen +UTIL_LOAD_NO_DATA=§cEs konnte keine Daten in der Schematic gefunden werden +UTIL_LOAD_ERROR=§cDie Schematic konnte nicht geladen werden +UTIL_DOWNLOAD_PUNISHED=§cDu darf keine Schematics Downloaden: §f§l{0} +UTIL_DOWNLOAD_NOT_OWN=§cDu darfst nur deine eigenen Schematics herunterladen +UTIL_DOWNLOAD_LINK=Dein Download Link: +UTIL_TYPE_PUNISHED=§cDu darf keine Schematics einsenden: §f§l{0} +UTIL_TYPE_NOT_OWN=§cDu kannst nur deine eigenen Schematics einsenden +UTIL_TYPE_DIR=§cDu kannst keine Ordner einsenden +UTIL_TYPE_NOT_ASSIGNABLE=§cZu diesem Typen können keine Schematics geändert werden +UTIL_TYPE_ALREADY=§cDie Schematic hat schon diesen Typen +UTIL_TYPE_DONE=§aSchematictyp geändert +UTIL_TYPE_FIGHT_ALREADY=§cDu hast diese Schematic bereits eingesendet +UTIL_TYPE_AFTER_DEADLINE=§cVon diesem Typen können keine Schematics mehr eingesendet werden. Einsendeschluss war: {0} +UTIL_TYPE_ERROR=§cDie Schematic ist nicht regelkonform +UTIL_TYPE_EXTEND=§aDer Vorbereitungsserver wird gestartet +UTIL_SUBMIT_TITLE=Schematic ausfahren +UTIL_SUBMIT_REPLAY_ON=§aReplay erlaubt +UTIL_SUBMIT_REPLAY_OFF=§cReplay gesperrt +UTIL_SUBMIT_COLOR_ON=§aPink zu Teamfarbe ersetzen +UTIL_SUBMIT_COLOR_OFF=§cPink nicht ersetzen +UTIL_SUBMIT_DIRECT=§eDirekt einsenden +UTIL_SUBMIT_DIRECT_DONE=§aDie Schematic wird zeitnah überprüft +UTIL_SUBMIT_EXTEND=§eSchematic ausfahren +UTIL_SUBMIT_EXTEND_DONE=§aDer Vorbereitungsserver wird gestartet + +COMMAND_NOT_FOLDER=Das ist eine Schematic und kein Ordner +COMMAND_ENTER_NAME=Namen eingeben +COMMAND_PUNISHMENT_NO_SAVE_EXTERNAL=§cDu kannst nicht auf anderen Baus Schematics machen +COMMAND_PUNISHMENT_NO_SAVE=§cAuf diesem Bau können keine Schematics gemacht werden +COMMAND_SAVE_NO_NAME=§cDu must auch einen Namen für die Schematic nach dem Ordner angeben +COMMAND_SAVE_FOLDER=§cDie Schematic ist ein Ordner +COMMAND_SAVE_NO_OVERWRITE=§cDu darfst diese Schematic nicht überschreiben +COMMAND_SAVE_CLIPBOARD_EMPTY=§cDein Clipboard ist leer +COMMAND_SAVE_ERROR=§cFehler beim Speichern der Schematic +COMMAND_SAVE_DONE=Schematic §e{0} §7gespeichert +COMMAND_SAVE_OVERWRITE=Schematic §e{0} §7überschrieben +COMMAND_ADD_PUNISH=§cDu darfst niemanden auf deine Schematics hinzufügen: §f§l{0} +COMMAND_ADD_NOT_OWNER=§cDu kannst nur auf deine eigenen Sachen jemanden hinzufügen +COMMAND_ADD_USER_PUNISHED=§c{0} darf nicht auf Schematics hinzugefügt werden +COMMAND_ADD_OWN=§cAlso bitte: Das ist deine eigene Schematic! +COMMAND_ADD_PUBLIC=§cFür Public-Anträge bitte bei der Moderation melden +COMMAND_ADD_ALREADY=§c{0} ist bereits auf diese Schematic geaddet +COMMAND_ADD_ADDED=Du hast nun Zugriff auf die Schematic §e{0} §7von §e{1} +COMMAND_ADD_NONE=§cEs wurde kein Spieler hinzugefügt +COMMAND_ADD_ONE=§7Der Spieler §e{0} wurde auf die Schematic hinzugefügt +COMMAND_ADD_MANY=§7Die Spieler §e{0} wurden auf die Schematic hinzugefügt +COMMAND_DELMEM_NOT_OWN=§cDu kannst nur auf deine eigenen Sachen jemanden entfernen +COMMAND_DELMEM_DONE=Der Spieler §e{0} §7hat nun keinen Zugriff mehr auf die Schematic §e{1} +COMMAND_DELMEM_DELETED=§cDu hast nun keinen Zugriff mehr auf die Schematic §e{0} §7von §e{1} +COMMAND_SEARCH_NOT_A_PLAYER=§cDer Spieler §e{0} §cexistiert nicht +COMMAND_LOCKREPLAY=Replays von Kämpfen mit {0} können ab sofort nicht mehr betrachtet werden +COMMAND_REPLACE_COLOR_OFF=In Kämpfen {0} werden pinke Blöcke nicht ersetzt +COMMAND_REPLACE_COLOR_ON=In Kämpfen {0} werden pinke Blöcke ersetzt +COMMAND_DIR_DONE=§7Ordner §e{0} §7erstellt +COMMAND_CHANGE_TYPE_NOT_OWNER=§cDu kannst nur deine eigenen Schematics einsenden +COMMAND_CHANGE_TYPE_SELECT=§eTyp auswählen +COMMAND_MOVE_NOT_OWN=§cDu kannst nur deine eigenen Schems verschieben +COMMAND_MOVE_RECURSIVE=§cDas gibt nur Fehler, vertrau mir +COMMAND_MOVE_DONE=§7Die Schematic ist nun unter §e{0} §7zu finden +COMMAND_RENAME_NOT_OWN=§cDas kannst du nur bei deinen eigenen Schems machen +COMMAND_RENAME_DONE=§7Die Schematic heist nun §e{0} +COMMAND_ADD_TEAM_NOT_OWN=§cDas kannst du nur bei deinen eigenen Schems machen +COMMAND_ADD_TEAM_NOT_IN_TEAM=§cDu bist in keinem Team +COMMAND_DEL_TEAM_NOT_OWN=§cDas kannst du nur bei deinen eigenen Schems machen +COMMAND_DEL_TEAM_NOT_IN_TEAM=§cDu bist in keinem Team +COMMAND_DEL_TEAM_NONE=§7Es wurde kein Spieler entfernt +COMMAND_DEL_TEAM_DONE=§7Der Spieler §e{0} §7wurden von der Schematic entfernt +COMMAND_CLEAR_MEMBER_NOT_OWN=§cDas kannst du nur bei deinen eigenen Schems machen +COMMAND_CLEAR_MEMBER_DONE=§7Alle Spieler wurden von der Schematic entfernt +COMMAND_DEL_ALL_MEMBER=§e{0} §7wurde von §e{1} §7Schematics entfernt +COMMAND_PUBLIC_ON=§aDu bist nun der Public User +COMMAND_PUBLIC_OFF=§cDu bist nun nicht mehr der Public User +COMMAND_DELETE_NOT_OWN=§cDie Schematic gehört dir nicht +COMMAND_DELETE_MEMBER=§aDu hast dich von der Schematic entfernt +COMMAND_DELETE_DIR=§aDer Ordner §e{0}§a wird gelöscht... +COMMAND_DELETE_DIR_FULL=§cDer Ordner muss leer sein, um ihn zu löschen +COMMAND_DELETE_SCHEM=§aDie Schematic §e{0}§a wird gelöscht... + +HELP_HEADER=§e§lSchematicSystem §8§lHilfe +HELP_VIEW=Finden & Laden +HELP_VIEW_HOVER=Suche oder lade Schematics +HELP_VIEW_1=§8/§7schem §einfo §8[§7Schematic§8] - §7Zeigt dir Informationen zur Schematic +HELP_VIEW_2=§8/§7schem §elist §8- §7Zeigt dir deine Schematics an +HELP_VIEW_3=§8/§7schem §elist public §8- §7Zeigt alle Public-Schematics +HELP_VIEW_4=§8/§7schem §esearch §8[§7Stichwort§8] - §7Sucht nach passenden Schematics +HELP_VIEW_5=§8/§7schem §eload §8[§7Schematic§8] - §7Lädt eine Schematic +HELP_VIEW_6=§8/§7schem §edownload §8[§7Schematic§8] - §7Gibt dir einen Downloadlink (1 min gültig) +HELP_EDIT=Speichern & Bearbeiten +HELP_EDIT_HOVER=Modifizierung von Schematics und Ordnern +HELP_EDIT_1=§8/§7schem §esave §8[§7Schematic§8] - §7Speichert dein Clipboard als Schematic +HELP_EDIT_2=§8/§7schem §eordner §8[§7Ordner§8] - §7Erstelle einen leeren Ordner +HELP_EDIT_3=§8/§7schem §emove §8[§7Schematic§8] [§7Neuer Pfad§8] - §7Verschiebe eine Schematic +HELP_EDIT_4=§8/§7schem §erename §8[§7Schematic§8] [§7Neuer Name§8] - §7Gib der Schematic einen neuen Namen +HELP_EDIT_5=§8/§7schem §echangetype §8[§7Schematic§8] - §7Ändert die Art deiner Schematic +HELP_EDIT_6=§8/§7schem §elockreplay §8[§7Schematic§8] - §7Sperrt Replays mit der Schematic +HELP_EDIT_7=§8/§7schem §ereplacecolor §8[§7Schematic§8] - §7Ändert Farbersetzung in der Arena +HELP_EDIT_8=§8/§7schem §edelete §8[§7Schematic§8] - §7Löscht eine Schematic +HELP_SHARE=Besitzrechte +HELP_SHARE_HOVER=Schematics mit anderen teilen +HELP_SHARE_1=§8/§7schem §eaddmember §8[§7Schematic§8] §8[§7Spieler§8] - §7Fügt einen Spieler zu einer Schematic hinzu +HELP_SHARE_2=§8/§7schem §edelmember §8[§7Schematic§8] §8[§7Spieler§8] - §7Entfernt einen Spieler von einer Schematic +HELP_SHARE_3=§8/§7schem §eclearmember §8[§7Schematic§8] - §7Entfernt alle Spieler von der Schematic +HELP_SHARE_4=§8/§7schem §edelallmember §8[§7Spieler§8] - §7Entfernt einen Spieler von allen deinen Schematics +HELP_SHARE_5=§8/§7schem §eaddteam §8[§7Schematic§8] - §7Füge jeden aus deinem Team auf die Schematic hinzu +HELP_SHARE_6=§8/§7schem §edelteam §8[§7Schematic§8] - §7Entferne jeden aus deinem Team von der Schematic + +GUI_TITLE=Schematics \{1\} +GUI_FOLDER_PROPERTIES=§7Ordnereigenschaften +GUI_INFO_LOAD=§eLaden +GUI_INFO_BACK=§eZurück +GUI_INFO_STATUS=§eStatus {0} +GUI_INFO_COLOR=Farbersetzung +GUI_INFO_REPLAY=Replay Wiedergabe +GUI_INFO_REPLAY_OFF=§7Zum §lAusschalten +GUI_INFO_REPLAY_TITLE=Wiedergabe dauerhaft sperren +GUI_INFO_MEMBER=§eMitglieder +GUI_INFO_MOVE=§eVerschieben +GUI_INFO_RENAME=§eUmbenennen +GUI_INFO_RENAME_TITLE={0} umbenennen +GUI_INFO_DELETE=§cLöschen +GUI_INFO_MEMBER_FROM=§7von §e{0} +GUI_INFO_MEMBER_REMOVE=§cZugriff entfernen +GUI_CHANGE_TYPE=Typ ändern +GUI_DELETE_OWN_DELETED=Schematic §e{0} §7gelöscht +GUI_DELETE_OWN_TITLE={0} löschen +GUI_DELETE_MEMBER_TITLE={0} entfernen +GUI_DELETE_MEMBER_DONE=Zugriff zu Schematic §e{0} §7entfernt +GUI_DELETE_MEMBERS_TITLE=Mitglieder entfernen +GUI_CHANGE_ITEM=Item ändern + +AUTO_CHECK_RESULT_NOT_LOAD=Die Schematic konnte nicht geladen werden +AUTO_CHECK_RESULT_TOO_WIDE=Die Schematic ist zu breit ({0} > {1}) +AUTO_CHECK_RESULT_TOO_LONG=Die Schematic ist zu lang ({0} > {1}) +AUTO_CHECK_RESULT_TOO_HIGH=Die Schematic ist zu hoch ({0} > {1}) +AUTO_CHECK_RESULT_TOO_MANY_BLOCK=Der Block {0} wurde {1} mal zu häufig verbaut +AUTO_CHECK_RESULT_TOO_MANY_BLOCKS=Die Blockkombination {0} wurde {1} mal zu häufig verbaut +AUTO_CHECK_RESULT_TOO_MANY_ALL_BLOCKS=Zu viele Blöcke ({0} > {1}) +AUTO_CHECK_RESULT_TOO_MANY_RECORDS=Keine Schallplatten erlaubt ({0} gefunden) +AUTO_CHECK_RESULT_FORBIDDEN_ITEM=In {0}s wurde das verbotene Item {1} {2} mal gefunden +AUTO_CHECK_RESULT_FORBIDDEN_ITEM_NBT=In {0}s wurde das verbotene Item {1} {2} mal mit Custom-Tag gefunden +AUTO_CHECK_RESULT_TOO_MANY_DISPENSER_ITEMS=Ein Werfer enthält mehr als {0} Pfeile und Feuerbälle +AUTO_CHECK_RESULT_TOO_MANY_DISPENSERS_ITEMS={0} Werfer enthält mehr als {1} Pfeile und Feuerbälle +AUTO_CHECK_RESULT_NBTS_WARNING={0} {1}s enthalten keine oder inkorrekte NBT-Daten +AUTO_CHECK_RESULT_NBT_WARNING=Ein(e) {0} enthält keine oder inkorrekte NBT-Daten + +SAFE_NODE_NOT_A_DIR=§cDie ausgewählte Schematic ist kein Ordner +SAFE_NODE_ALREADY_IN_DIRECTORY=§cDie Schematic gibt es bereits in diesem Ordner +SAFE_NODE_INVALID_NAME=§cDieser Name ist unzulässig +SAFE_NODE_NOT_OWNER=§cDu bist nicht der Besitzer dieser Schematic diff --git a/SchematicSystem_Core/src/de/steamwar/schematicsystem/AutoCheckResult.java b/SchematicSystem_Core/src/de/steamwar/schematicsystem/AutoCheckResult.java index d3760a9..994324e 100644 --- a/SchematicSystem_Core/src/de/steamwar/schematicsystem/AutoCheckResult.java +++ b/SchematicSystem_Core/src/de/steamwar/schematicsystem/AutoCheckResult.java @@ -47,53 +47,67 @@ public class AutoCheckResult { this.limitedMaterials = type.getLimits(); } - public Collection errors() { - List errors = new LinkedList<>(); + public Map errors() { + Map errors = new HashMap<>(); - if(errorLoadingSchematic) - errors.add("Die Schematic konnte nicht geladen werden"); + if(errorLoadingSchematic) { + errors.put("AUTO_CHECK_RESULT_NOT_LOAD", new Object[0]); + } assert type != null; + // SW Quality Code, Check the Comments! if(width > type.getDepth()) - errors.add("Die Schematic ist zu breit (" + width + " > " + type.getDepth() + ")"); + // Width + errors.put("AUTO_CHECK_RESULT_TOO_WIDE", new Object[]{width, type.getDepth()}); if(length > type.getWidth()) - errors.add("Die Schematic ist zu lang (" + length + " > " + type.getWidth() + ")"); + // Length + errors.put("AUTO_CHECK_RESULT_TOO_LONG", new Object[]{width, type.getWidth()}); if(height > type.getHeight()) - errors.add("Die Schematic ist zu hoch (" + height + " > " + type.getHeight() + ")"); + errors.put("AUTO_CHECK_RESULT_TOO_HIGH", new Object[]{height, type.getHeight()}); for(Map.Entry, Integer> entry : limitedMaterials.entrySet()) { - if(entry.getValue() < 0) - errors.add((entry.getKey().size() == 1 ? "Der Block " : "Die Blockkombination") + String.join(" ", entry.getKey()) + " wurde " + (-entry.getValue()) + " mal zu häufig verbaut"); + if(entry.getValue() < 0) { + errors.put((entry.getKey().size() == 1 ? "AUTO_CHECK_RESULT_TOO_MANY_BLOCK" : "AUTO_CHECK_RESULT_TOO_MANY_BLOCKS"), new Object[]{String.join(" ", entry.getKey()), -entry.getValue()}); + } } if(type.getMaxBlocks() != 0 && blocks > type.getMaxBlocks()) { - errors.add("Zu viele Blöcke (" + blocks + " > " + type.getMaxBlocks() + ")"); + errors.put("AUTO_CHECK_RESULT_TOO_MANY_ALL_BLOCKS", new Object[]{blocks, type.getMaxBlocks()}); } - if(records > 0) - errors.add("Keine Schallplatten erlaubt (" + records + " gefunden)"); - for(Map.Entry> block : forbiddenItems.entrySet()) - for(Map.Entry item : block.getValue().entrySet()) - errors.add("In " + block.getKey() + "s wurde das verbotene Item " + item.getKey() + " " + item.getValue() + " mal gefunden"); - for(Map.Entry> block : itemsWithTag.entrySet()) - for(Map.Entry item : block.getValue().entrySet()) - errors.add("In " + block.getKey() + "s wurde das Item " + item.getKey() + " " + item.getValue() + " mal mit Custom-Tag gefunden"); - if(tooManyDispenserItems == 1) - errors.add("Ein Werfer enthält mehr als " + type.getMaxDispenserItems() + " Pfeile und Feuerbälle"); - else if(tooManyDispenserItems > 1) - errors.add(tooManyDispenserItems + " Werfer enthalten mehr als " + type.getMaxDispenserItems() + " Pfeile und Feuerbälle"); + if(records > 0) { + errors.put("AUTO_CHECK_RESULT_TOO_MANY_RECORDS", new Object[]{records}); + } + + for(Map.Entry> block : forbiddenItems.entrySet()) { + for (Map.Entry item : block.getValue().entrySet()) { + errors.put("AUTO_CHECK_RESULT_FORBIDDEN_ITEM", new Object[]{block.getKey(), item.getKey(), item.getValue()}); + } + } + for(Map.Entry> block : itemsWithTag.entrySet()) { + for (Map.Entry item : block.getValue().entrySet()) { + errors.put("AUTO_CHECK_RESULT_FORBIDDEN_ITEM_NBT", new Object[]{block.getKey(), item.getKey(), item.getValue()}); + } + } + if(tooManyDispenserItems == 1) { + errors.put("AUTO_CHECK_RESULT_TOO_MANY_DISPENSER_ITEMS", new Object[]{type.getMaxDispenserItems()}); + } + else if(tooManyDispenserItems > 1) { + errors.put("AUTO_CHECK_RESULT_TOO_MANY_DISPENSERS_ITEMS", new Object[]{tooManyDispenserItems, type.getMaxDispenserItems()}); + } return errors; } - public Collection warnings(){ - List warnings = new LinkedList<>(); + public Map warnings(){ + Map warnings = new HashMap<>(); for(Map.Entry nbtBlock : defunctNbt.entrySet()){ - if(nbtBlock.getValue() > 1) - warnings.add(nbtBlock.getValue() + " " + nbtBlock.getKey() + "s enthalten keine oder inkorrekte NBT-Daten"); - else - warnings.add("Ein(e) " + nbtBlock.getKey() + " enthält keine oder inkorrekte NBT-Daten"); + if(nbtBlock.getValue() > 1) { + warnings.put("AUTO_CHECK_RESULT_NBTS_WARNING", new Object[]{nbtBlock.getValue(), nbtBlock.getKey()}); + } else { + warnings.put("AUTO_CHECK_RESULT_NBT_WARNING", new Object[]{nbtBlock.getKey()}); + } } return warnings; diff --git a/SchematicSystem_Core/src/de/steamwar/schematicsystem/CheckSchemType.java b/SchematicSystem_Core/src/de/steamwar/schematicsystem/CheckSchemType.java index 9af5cee..257c466 100644 --- a/SchematicSystem_Core/src/de/steamwar/schematicsystem/CheckSchemType.java +++ b/SchematicSystem_Core/src/de/steamwar/schematicsystem/CheckSchemType.java @@ -30,6 +30,10 @@ import org.bukkit.configuration.file.YamlConfiguration; import java.io.File; import java.io.IOException; +import java.text.DateFormat; +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.time.Instant; import java.util.*; import java.util.logging.Level; @@ -45,6 +49,8 @@ public class CheckSchemType { private final Map, Integer> limits; private final int maxBlocks; + private final Date deadline; + private CheckSchemType(ConfigurationSection section) { String name = section.getString("Schematic.Type"); width = section.getInt("Schematic.Size.x"); @@ -65,6 +71,18 @@ public class CheckSchemType { } } + String deadlineString = section.getString("deadline", null); + if (deadlineString != null) { + try { + SimpleDateFormat dateFormat = new SimpleDateFormat("dd.MM.yyyy HH:mm"); + deadline = dateFormat.parse(deadlineString); + } catch (ParseException e) { + throw new SecurityException(e.getMessage(), e); + } + } else { + deadline = null; + } + types.put(SchematicType.fromDB(name.toLowerCase()), this); types.put(SchematicType.fromDB("c" + name.toLowerCase()), this); } @@ -126,6 +144,14 @@ public class CheckSchemType { return new HashMap<>(limits); } + public boolean isAfterDeadline() { + return deadline != null && deadline.before(Date.from(Instant.now())); + } + + public String getDeadline() { + return DateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.SHORT, Locale.GERMAN).format(deadline); + } + public static final ICheckSchemType impl = VersionDependent.getVersionImpl(SchematicSystem.getInstance()); diff --git a/SchematicSystem_Core/src/de/steamwar/schematicsystem/SafeSchematicNode.java b/SchematicSystem_Core/src/de/steamwar/schematicsystem/SafeSchematicNode.java index db3b85b..a91ce52 100644 --- a/SchematicSystem_Core/src/de/steamwar/schematicsystem/SafeSchematicNode.java +++ b/SchematicSystem_Core/src/de/steamwar/schematicsystem/SafeSchematicNode.java @@ -72,16 +72,14 @@ public class SafeSchematicNode { @AllArgsConstructor public enum Result { - DONE("No"), - NOT_A_DIR(SchematicSystem.PREFIX + "§cDie ausgewählte Schematic ist kein Ordner"), - ALREADY_IN_DIRECTORY(SchematicSystem.PREFIX + "§cDie Schematic gibt es bereits in diesem Ordner"), - INVALID_NAME(SchematicSystem.PREFIX + "§cDieser Name ist unzulässig"), - NOT_OWNER(SchematicSystem.PREFIX + "§cDu bist nicht der Besitzer dieser Schematic"); - - private final String errorMessage; + DONE, + NOT_A_DIR, + ALREADY_IN_DIRECTORY, + INVALID_NAME, + NOT_OWNER; public void sendError(Player player) { - player.sendMessage(errorMessage); + SchematicSystem.MESSAGE.send("SAFE_SCHEMATIC_NODE_" + this.name(), player); } public boolean isSuccessful() { diff --git a/SchematicSystem_Core/src/de/steamwar/schematicsystem/SchematicSystem.java b/SchematicSystem_Core/src/de/steamwar/schematicsystem/SchematicSystem.java index de7ec61..8cec6d8 100644 --- a/SchematicSystem_Core/src/de/steamwar/schematicsystem/SchematicSystem.java +++ b/SchematicSystem_Core/src/de/steamwar/schematicsystem/SchematicSystem.java @@ -19,11 +19,13 @@ package de.steamwar.schematicsystem; +import de.steamwar.core.Core; +import de.steamwar.message.Message; import de.steamwar.schematicsystem.commands.SchematicCommand; import org.bukkit.plugin.java.JavaPlugin; public class SchematicSystem extends JavaPlugin { - public static final String PREFIX = "§eSchematic§8» §7"; + public static final Message MESSAGE = new Message("SchematicSystem", SchematicSystem.class.getClassLoader()); private static SchematicSystem instance; diff --git a/SchematicSystem_Core/src/de/steamwar/schematicsystem/commands/GUI.java b/SchematicSystem_Core/src/de/steamwar/schematicsystem/commands/GUI.java index 8fb1f87..a2de41e 100644 --- a/SchematicSystem_Core/src/de/steamwar/schematicsystem/commands/GUI.java +++ b/SchematicSystem_Core/src/de/steamwar/schematicsystem/commands/GUI.java @@ -19,10 +19,12 @@ package de.steamwar.schematicsystem.commands; +import de.steamwar.core.Core; import de.steamwar.inventory.*; import de.steamwar.schematicsystem.SafeSchematicNode; import de.steamwar.schematicsystem.SchematicSystem; import de.steamwar.sql.*; +import org.bukkit.ChatColor; import org.bukkit.Material; import org.bukkit.entity.Player; import org.bukkit.event.inventory.ClickType; @@ -38,7 +40,7 @@ public class GUI { SchematicSelector selector = new SchematicSelector(player, SchematicSelector.selectSchematic(), new SchematicSelectorInjectable() { @Override public String createTitle(Player player) { - return "Schematics {1}"; + return SchematicSystem.MESSAGE.parse("GUI_TITLE", player); } @Override @@ -46,7 +48,7 @@ public class GUI { if(parent == null) { inv.setItem(49, Material.AIR, "", clickType -> {}); } else { - inv.setItem(49, Material.ANVIL, "§7Ordnereigenschaften", clickType -> { + inv.setItem(49, Material.ANVIL, SchematicSystem.MESSAGE.parse("GUI_FOLDER_PROPERTIES", player), clickType -> { info(selector.getPlayer(), parent, selector); }); } @@ -61,54 +63,47 @@ public class GUI { SteamwarUser user = getUser(player); SWInventory inv = new SWInventory(player, 9 * 2, node.generateBreadcrumbs(user)); if(!node.isDir()) { - inv.setItem(0, SWItem.getMaterial("WOOD_AXE"), "§eLaden", click -> { + inv.setItem(0, SWItem.getMaterial("WOOD_AXE"), SchematicSystem.MESSAGE.parse("GUI_INFO_LOAD", player), click -> { player.closeInventory(); SchematicCommandUtils.loadSchem(player, node); }); } - inv.setItem(9, SWItem.getMaterial("LEASH"), "§eZurück", clickType -> { + inv.setItem(9, SWItem.getMaterial("LEASH"), SchematicSystem.MESSAGE.parse("GUI_INFO_BACK", player), clickType -> { back.reOpen(); }); if(node.getOwner() == user.getId()){ if(!node.isDir() && node.getSchemtype().writeable()){ - List checkedSchematics = CheckedSchematic.getLastDeclined(player.getUniqueId()); - ListIterator i = checkedSchematics.listIterator(checkedSchematics.size()); - while(i.hasPrevious()) { - CheckedSchematic checkedSchematic = i.previous(); - if(checkedSchematic.getNode() == node.getId()) { - inv.setItem(1, SWItem.getDye(10), (byte) 10, "§eStatus " + node.getSchemtype().name(), Collections.singletonList("§7" + checkedSchematic.getDeclineReason()), false, click -> {}); - break; - } - } + CheckedSchematic.getLastDeclinedOfNode(node).stream().findFirst().ifPresent(checkedSchematic -> + inv.setItem(1, SWItem.getDye(10), (byte) 10, SchematicSystem.MESSAGE.parse("GUI_INFO_STATUS", player, node.getSchemtype().name()), Collections.singletonList(SchematicSystem.MESSAGE.parse("GUI_INFO_STATUS_LORE", player, checkedSchematic.getDeclineReason().replaceAll("&", "§"))), false, click -> {})); } Material mat = SWItem.getMaterial(node.getItem()); - inv.setItem(node.isDir()?7:5, mat, "§e" + mat.name(), Arrays.asList("§7Zum Ändern", "§7anklicken"), false, click -> { + inv.setItem(node.isDir()?7:5, mat, SchematicSystem.MESSAGE.parse("GUI_INFO_MAT", player, mat.name()), Arrays.asList(SchematicSystem.MESSAGE.parse("CHANGE", player), SchematicSystem.MESSAGE.parse("CLICK", player)), false, click -> { changeItem(player, node, back); }); if(!node.isDir()) { - inv.setItem(6, SWItem.getMaterial("CAULDRON_ITEM"), "§e" + node.getSchemtype().name(), Arrays.asList("§7Zum Ändern", "§7anklicken"), node.getSchemtype().fightType(), click -> { + inv.setItem(6, SWItem.getMaterial("CAULDRON_ITEM"), SchematicSystem.MESSAGE.parse("GUI_INFO_TYPE", player, mat.name()), Arrays.asList(SchematicSystem.MESSAGE.parse("CHANGE", player), SchematicSystem.MESSAGE.parse("CLICK", player)), node.getSchemtype().fightType(), click -> { changeType(player, node); }); - inv.setItem(7, SWItem.getMaterial("MAGENTA_GLAZED_TERRACOTTA"), "§eDownload", click -> { + inv.setItem(7, SWItem.getMaterial("MAGENTA_GLAZED_TERRACOTTA"), SchematicSystem.MESSAGE.parse("GUI_INFO_DOWNLOAD", player), click -> { player.closeInventory(); SchematicCommandUtils.download(player, node); }); if(node.getSchemtype().fightType()) { - inv.setItem(14, SWItem.getMaterial(node.replaceColor() ? "PINK_WOOL" : "LIGHT_GRAY_WOOL"), "Farbersetzung", Arrays.asList("§7Aktuell: " + (node.replaceColor()?"§aAn":"§cAus"), "§7Zum Ändern", "§7anklicken"), false, clickType -> { + inv.setItem(14, SWItem.getMaterial(node.replaceColor() ? "PINK_WOOL" : "LIGHT_GRAY_WOOL"), SchematicSystem.MESSAGE.parse("GUI_INFO_COLOR", player), Arrays.asList(SchematicSystem.MESSAGE.parse("CURRENT", player, SchematicSystem.MESSAGE.parse(node.replaceColor()?"ON":"OFF", player)), SchematicSystem.MESSAGE.parse("CHANGE", player), SchematicSystem.MESSAGE.parse("CLICK", player)), false, clickType -> { node.setReplaceColor(!node.replaceColor()); info(player, node, back); }); - inv.setItem(13, SWItem.getMaterial(node.allowReplay() ? "EYE_OF_ENDER" : "ENDER_PEARL"), "Replay Wiedergabe", Arrays.asList("§7Aktuell: " + (node.allowReplay()?"§aAn":"§4Aus"), "§7Zum §lAusschalten", "§7anklicken"), false, clickType -> { + inv.setItem(13, SWItem.getMaterial(node.allowReplay() ? "EYE_OF_ENDER" : "ENDER_PEARL"), SchematicSystem.MESSAGE.parse("GUI_INFO_REPLAY", player), Arrays.asList(SchematicSystem.MESSAGE.parse("CURRENT", player, SchematicSystem.MESSAGE.parse(node.allowReplay()?"ON":"OFF", player)), SchematicSystem.MESSAGE.parse("GUI_INFO_REPLAY_OFF", player), SchematicSystem.MESSAGE.parse("CLICK", player)), false, clickType -> { if(node.allowReplay()) { - SWInventory confInv = new SWInventory(player, 9, "Wiedergabe dauerhaft sperren"); - confInv.setItem(0, SWItem.getDye(10), (byte) 10, "§aBestätigen", type -> { + SWInventory confInv = new SWInventory(player, 9, SchematicSystem.MESSAGE.parse("GUI_INFO_REPLAY_TITLE", player)); + confInv.setItem(0, SWItem.getDye(10), (byte) 10, SchematicSystem.MESSAGE.parse("CONFIRM", player), type -> { node.setAllowReplay(false); info(player, node, back); }); - confInv.setItem(8, SWItem.getDye(1), (byte) 1, "§cAbbrechen", type -> { + confInv.setItem(8, SWItem.getDye(1), (byte) 1, SchematicSystem.MESSAGE.parse("CANCEL", player), type -> { info(player, node, back); }); confInv.open(); @@ -121,9 +116,9 @@ public class GUI { player.closeInventory(); delmembers(player, node); }); - skull.setName("§eMitglieder"); + skull.setName(SchematicSystem.MESSAGE.parse("GUI_INFO_MEMBER", player)); inv.setItem(8, skull); - inv.setItem(15, Material.ARROW, "§eVerschieben", clickType -> { + inv.setItem(15, Material.ARROW, SchematicSystem.MESSAGE.parse("GUI_INFO_MOVE", player), clickType -> { SchematicSelector selector = new SchematicSelector(player, SchematicSelector.selectDirectory(), npar -> { SafeSchematicNode.Result result = SafeSchematicNode.setParent(user, node, npar); if(result.isSuccessful()) { @@ -134,8 +129,8 @@ public class GUI { }); selector.open(); }); - inv.setItem(16, Material.NAME_TAG, "§eUmbenennen", clickType -> { - SWAnvilInv anvilInv = new SWAnvilInv(player, node.getName() + " umbenennen", node.getName()); + inv.setItem(16, Material.NAME_TAG, SchematicSystem.MESSAGE.parse("GUI_INFO_RENAME", player), clickType -> { + SWAnvilInv anvilInv = new SWAnvilInv(player, SchematicSystem.MESSAGE.parse("GUI_INFO_RENAME_TITLE", player, node.getName()), node.getName()); anvilInv.setItem(mat); anvilInv.setCallback(s -> { SafeSchematicNode.Result result = SafeSchematicNode.setName(user, node, s); @@ -147,21 +142,21 @@ public class GUI { }); anvilInv.open(); }); - inv.setItem(17, SWItem.getDye(1), (byte) 1, "§cLöschen", click -> { + inv.setItem(17, SWItem.getDye(1), (byte) 1, SchematicSystem.MESSAGE.parse("GUI_INFO_DELETE", player), click -> { delete(player, node, back); }); }else{ if(!node.isDir()) { - inv.setItem(4, SWItem.getMaterial("CAULDRON_ITEM"), "§e" + node.getSchemtype().name(), Collections.emptyList(), node.getSchemtype().fightType(), click -> {}); + inv.setItem(4, SWItem.getMaterial("CAULDRON_ITEM"), SchematicSystem.MESSAGE.parse("GUI_INFO_TYPE", player, node.getSchemtype().name()), Collections.emptyList(), node.getSchemtype().fightType(), click -> {}); } SteamwarUser owneruser = SteamwarUser.get(node.getOwner()); SWItem skull = SWItem.getPlayerSkull(owneruser.getUserName()); - skull.setName("§7von §e" + owneruser.getUserName()); + skull.setName(SchematicSystem.MESSAGE.parse("GUI_INFO_MEMBER_FROM", player, owneruser.getUserName())); inv.setItem(8, skull.getItemStack(), clickType -> {}); if(NodeMember.getNodeMember(node.getId(), user.getId()) != null) { - inv.setItem(17, SWItem.getDye(1), (byte) 1, "§cZugriff entfernen", click -> { + inv.setItem(17, SWItem.getDye(1), (byte) 1, SchematicSystem.MESSAGE.parse("GUI_INFO_MEMBER_REMOVE", player), click -> { delete(player, node, back); }); } @@ -184,7 +179,7 @@ public class GUI { types.add(new SWListInv.SWListEntry<>(item, type)); } - SWListInv inv = new SWListInv<>(p, "Typ ändern", types, (clickType, schematicType) -> { + SWListInv inv = new SWListInv<>(p, SchematicSystem.MESSAGE.parse("GUI_CHANGE_TYPE", p), types, (clickType, schematicType) -> { p.closeInventory(); SchematicCommandUtils.changeType(p, schem, schematicType, null); }); @@ -194,11 +189,11 @@ public class GUI { private static void deleteOwn(Player p, SchematicNode schem, SchematicSelector back){ SteamwarUser user = getUser(p); - SWInventory inv = new SWInventory(p, 9, schem.generateBreadcrumbs(user) + " löschen"); - inv.setItem(0, SWItem.getDye(1), (byte) 1, "§eLöschen", click -> { + SWInventory inv = new SWInventory(p, 9, SchematicSystem.MESSAGE.parse("GUI_DELETE_OWN_TITLE", p, schem.generateBreadcrumbs(user))); + inv.setItem(0, SWItem.getDye(1), (byte) 1, SchematicSystem.MESSAGE.parse("CONFIRM", p), click -> { schem.delete(); - p.sendMessage(SchematicSystem.PREFIX + "Schematic §e" + schem.generateBreadcrumbs(user) + " §7gelöscht"); + SchematicSystem.MESSAGE.send("GUI_DELETE_OWN_DELETED", p, schem.generateBreadcrumbs(user)); if(back != null) { if(schem.isDir()) { back.reOpenDirUp(); @@ -207,19 +202,19 @@ public class GUI { } } }); - inv.setItem(8, SWItem.getDye(14), (byte) 14, "§cAbbruch", click -> p.closeInventory()); + inv.setItem(8, SWItem.getDye(14), (byte) 14, SchematicSystem.MESSAGE.parse("CANCEL", p), click -> p.closeInventory()); inv.setCallback(-999, click -> p.closeInventory()); inv.open(); } private static void deleteMembership(Player p, SchematicNode schem, SchematicSelector back){ SteamwarUser user = getUser(p); - SWInventory inv = new SWInventory(p, 9, schem.generateBreadcrumbs(user) + " entfernen"); - inv.setItem(0, SWItem.getDye(1), (byte) 1, "§eZugriff entfernen", click -> { + SWInventory inv = new SWInventory(p, 9, SchematicSystem.MESSAGE.parse("GUI_DELETE_MEMBER_TITLE", p, schem.generateBreadcrumbs(user))); + inv.setItem(0, SWItem.getDye(1), (byte) 1, SchematicSystem.MESSAGE.parse("CONFIRM", p), click -> { NodeMember member = NodeMember.getNodeMember(schem.getId(), user.getId()); if(member != null) member.delete(); - p.sendMessage(SchematicSystem.PREFIX + "Zugriff zu Schematic §e" + schem.generateBreadcrumbs(user) + " §7entfernt"); + SchematicSystem.MESSAGE.send("GUI_DELETE_MEMBER_DONE", p, schem.generateBreadcrumbs(user)); if(back != null) { if(schem.isDir()) { back.reOpenDirUp(); @@ -228,7 +223,7 @@ public class GUI { } } }); - inv.setItem(8, SWItem.getDye(14), (byte) 14, "§cAbbruch", click -> p.closeInventory()); + inv.setItem(8, SWItem.getDye(14), (byte) 14, SchematicSystem.MESSAGE.parse("CANCEL", p), click -> p.closeInventory()); inv.setCallback(-999, click -> p.closeInventory()); inv.open(); } @@ -247,7 +242,7 @@ public class GUI { members.add(new SWListInv.SWListEntry<>(SWItem.getPlayerSkull(user.getUserName()), member)); } - SWListInv inv = new SWListInv<>(p, "Mitglieder entfernen", members, (clickType, member) -> { + SWListInv inv = new SWListInv<>(p, SchematicSystem.MESSAGE.parse("GUI_DELETE_MEMBERS_TITLE", p), members, (clickType, member) -> { member.delete(); p.closeInventory(); delmembers(p, schem); @@ -257,7 +252,7 @@ public class GUI { } private static void changeItem(Player p, SchematicNode schem, SchematicSelector back){ - UtilGui.openMaterialSelector(p, "Item ändern", material -> { + UtilGui.openMaterialSelector(p, SchematicSystem.MESSAGE.parse("GUI_CHANGE_ITEM", p), material -> { schem.setItem(material.name()); p.closeInventory(); info(p, schem, back); diff --git a/SchematicSystem_Core/src/de/steamwar/schematicsystem/commands/SchematicCommand.java b/SchematicSystem_Core/src/de/steamwar/schematicsystem/commands/SchematicCommand.java index c3acd21..608ad43 100644 --- a/SchematicSystem_Core/src/de/steamwar/schematicsystem/commands/SchematicCommand.java +++ b/SchematicSystem_Core/src/de/steamwar/schematicsystem/commands/SchematicCommand.java @@ -19,6 +19,7 @@ package de.steamwar.schematicsystem.commands; +import de.steamwar.command.AbstractTypeMapper; import de.steamwar.command.SWCommand; import de.steamwar.command.SWCommandUtils; import de.steamwar.command.TypeMapper; @@ -49,7 +50,7 @@ import static de.steamwar.schematicsystem.commands.SchematicCommandUtils.*; public class SchematicCommand extends SWCommand { - private static final Map> searchMapper = new HashMap<>(); + private static final Map> searchMapper = new HashMap<>(); static { searchMapper.put("-type", SWCommandUtils.createMapper(SchematicType.values().stream().map(SchematicType::name).toArray(String[]::new))); @@ -108,7 +109,7 @@ public class SchematicCommand extends SWCommand { public void schemList(Player player, @Mapper("dirMapper") SchematicNode node, @OptionalValue("0") int page) { SteamwarUser user = getUser(player); if (!node.isDir()) { - player.sendMessage(SchematicSystem.PREFIX + "Das ist eine Schematic und kein Ordner"); + SchematicSystem.MESSAGE.send("COMMAND_NOT_FOLDER", player); } else { renderSchemlist(player, SchematicNode.getSchematicNodeInNode(node), page, node, SchematicListBehavior.builder().setPublics(node.getOwner() == 0).setPageCommandGen(value -> "/schem list " + (node.getOwner()==0?"public ":"") + node.generateBreadcrumbs(user) + " " + value).build()); } @@ -137,7 +138,7 @@ public class SchematicCommand extends SWCommand { SchematicSelector selector = new SchematicSelector(player, SchematicSelector.selectSchematicNode(), schematicNode -> { SteamwarUser user = SteamwarUser.get(player.getUniqueId()); if(schematicNode == null || schematicNode.isDir()) { - SWAnvilInv anvilInv = new SWAnvilInv(player, "Namen eingeben"); + SWAnvilInv anvilInv = new SWAnvilInv(player, SchematicSystem.MESSAGE.parse("COMMAND_ENTER_NAME", player)); anvilInv.setCallback(s -> saveSchem(player, schematicNode==null?s:(schematicNode.generateBreadcrumbs(user) + s))); anvilInv.setItem(Material.CAULDRON); anvilInv.open(); @@ -155,13 +156,13 @@ public class SchematicCommand extends SWCommand { SteamwarUser user = getUser(player); if(BauServerInfo.isBauServer() && BauServerInfo.getOwnerId() != user.getId() && (Punishment.isPunished(user, Punishment.PunishmentType.NoSchemReceiving, punishment -> - player.sendMessage(SchematicSystem.PREFIX + "§cDu kannst nicht auf anderen Baus Schematics machen")) || + SchematicSystem.MESSAGE.send("COMMAND_PUNISHMENT_NO_SAVE_EXTERNAL", player)) || Punishment.isPunished(SteamwarUser.get(BauServerInfo.getOwnerId()), Punishment.PunishmentType.NoSchemSharing, punishment -> - player.sendMessage(SchematicSystem.PREFIX + "§cAuf diesem Bau können keine Schematics gemacht werden")))) { + SchematicSystem.MESSAGE.send("COMMAND_PUNISHMENT_NO_SAVE", player)))) { return; } if (name.endsWith("/")) { - player.sendMessage(SchematicSystem.PREFIX + "§cDu must auch einen Namen für die Schematic nach dem Ordner angeben"); + SchematicSystem.MESSAGE.send("COMMAND_SAVE_NO_NAME", player); return; } if (name.startsWith("/")) name = name.substring(1); @@ -172,10 +173,10 @@ public class SchematicCommand extends SWCommand { SchematicNode node = SchematicNode.getNodeFromPath(user, String.join("/", layers)); if (node != null) { if(node.isDir()) { - player.sendMessage(SchematicSystem.PREFIX + "§cDie Schematic ist ein Ordner"); + SchematicSystem.MESSAGE.send("COMMAND_SAVE_FOLDER", player); return; } else if (!node.getSchemtype().writeable() || node.getOwner() != user.getId()) { - player.sendMessage(SchematicSystem.PREFIX + "§cDu darfst diese Schematic nicht überschreiben"); + SchematicSystem.MESSAGE.send("COMMAND_SAVE_NO_OVERWRITE", player); return; } } @@ -189,55 +190,51 @@ public class SchematicCommand extends SWCommand { try { node.saveFromPlayer(player); } catch (NoClipboardException e) { - player.sendMessage(SchematicSystem.PREFIX + "§cDein Clipboard ist leer"); + SchematicSystem.MESSAGE.send("COMMAND_SAVE_CLIPBOARD_EMPTY", player); if (newSchem) node.delete(); return; } catch (Exception ex) { Bukkit.getLogger().log(Level.SEVERE, "Could not save schematic", ex); - player.sendMessage(SchematicSystem.PREFIX + "§cFehler beim Speichern der Schematic."); + SchematicSystem.MESSAGE.send("COMMAND_SAVE_ERROR", player); if (newSchem) node.delete(); return; } - if (newSchem) { - player.sendMessage(SchematicSystem.PREFIX + "Schematic §e" + node.getName() + " §7gespeichert"); - } else { - player.sendMessage(SchematicSystem.PREFIX + "Schematic §e" + node.getName() + " §7überschrieben"); - } + SchematicSystem.MESSAGE.send(newSchem?"COMMAND_SAVE_DONE":"COMMAND_SAVE_OVERWRITE", player, node.generateBreadcrumbs(user)); } @Register("addmember") public void addMember(Player player, SchematicNode node, SteamwarUser... targets) { SteamwarUser user = getUser(player); - if(Punishment.isPunished(user, Punishment.PunishmentType.NoSchemSharing, punishment -> player.sendMessage(SchematicSystem.PREFIX + "§cDu darfst niemanden auf deine Schematics hinzufügen: §f§l" + punishment.getReason()))) { + if(Punishment.isPunished(user, Punishment.PunishmentType.NoSchemSharing, punishment -> SchematicSystem.MESSAGE.send("COMMAND_ADD_PUNISH", player, punishment.getReason()))) { return; } if (node.getOwner() != user.getId()) { - player.sendMessage(SchematicSystem.PREFIX + "§cDu kannst nur auf deine eigenen Sachen jemanden hinzufügen."); + SchematicSystem.MESSAGE.send("COMMAND_ADD_NOT_OWNER", player); return; } List added = new ArrayList<>(); for (SteamwarUser target: targets) { if(Punishment.isPunished(target, Punishment.PunishmentType.NoSchemReceiving, - punishment -> player.sendMessage(SchematicSystem.PREFIX + "§c" + target.getUserName() + " darf nicht auf Schematics hinzugefügt werden."))) { + punishment -> SchematicSystem.MESSAGE.send("COMMAND_ADD_USER_PUNISHED", player, target.getUserName()))) { continue; } if (user.getId() == target.getId()) { - player.sendMessage(SchematicSystem.PREFIX + "§cAlso bitte: Das ist deine eigene Schematic!"); + SchematicSystem.MESSAGE.send("COMMAND_ADD_OWN", player); continue; } if (target.getId() == 0) { - player.sendMessage(SchematicSystem.PREFIX + "§cFür Public-Anträge bitte bei der Moderation melden"); + SchematicSystem.MESSAGE.send("COMMAND_ADD_PUBLIC", player); continue; } if (NodeMember.getNodeMember(node.getId(), target.getId()) != null) { - player.sendMessage(SchematicSystem.PREFIX + "§c" + target.getUserName() + " ist bereits auf diese Schematic geaddet"); + SchematicSystem.MESSAGE.send("COMMAND_ADD_ALREADY", player, target.getUserName()); continue; } @@ -246,15 +243,15 @@ public class SchematicCommand extends SWCommand { Player t = Bukkit.getPlayer(target.getUUID()); if (t != null) { - t.sendMessage(SchematicSystem.PREFIX + "Du hast nun Zugriff auf die Schematic §e" + node.getName() + " §7von §e" + player.getName()); + SchematicSystem.MESSAGE.send("COMMAND_ADD_ADDED", t, node.generateBreadcrumbs(target), player.getName()); } } Optional reduced = added.stream().map(SteamwarUser::getUserName).reduce((s, s2) -> s + ", " + s2); if (reduced.isPresent()) { - player.sendMessage(SchematicSystem.PREFIX + "§7" + (added.size()>1?"Die":"Der") + " Spieler §e" + reduced.get() + " §7" + (added.size()>1?"wurden":"wurde") + " auf die Schematic hinzugefügt"); + SchematicSystem.MESSAGE.send(added.size()>1?"COMMAND_ADD_MANY":"COMMAND_ADD_ONE", player, reduced.get()); } else { - player.sendMessage(SchematicSystem.PREFIX + "§cEs wurde kein Spieler hinzugefügt"); + SchematicSystem.MESSAGE.send("COMMAND_ADD_NONE", player); } } @@ -263,7 +260,7 @@ public class SchematicCommand extends SWCommand { SteamwarUser user = getUser(player); if (node.getOwner() != user.getId()) { - player.sendMessage(SchematicSystem.PREFIX + "§cDu kannst nur auf deine eigenen Sachen jemanden entfernen."); + SchematicSystem.MESSAGE.send("COMMAND_DELMEM_NOT_OWN", player); return; } @@ -281,11 +278,11 @@ public class SchematicCommand extends SWCommand { } member.delete(); - player.sendMessage(SchematicSystem.PREFIX + "Der Spieler §e" + target.getUserName() + " §7hat nun keinen Zugriff mehr auf die Schematic §e" + node.generateBreadcrumbs(user)); + SchematicSystem.MESSAGE.send("COMMAND_DELMEM_DONE", player, target.getUserName(), node.generateBreadcrumbs(user)); Player t = Bukkit.getPlayer(target.getUUID()); if (t != null) { - t.sendMessage(SchematicSystem.PREFIX + "Du hast nun keinen Zugriff mehr auf die Schematic §e" + node.getName() + " §7von §e" + player.getName()); + SchematicSystem.MESSAGE.send("COMMAND_DELMEM_DELETED", t, node.getName(), player.getName()); } } @@ -315,7 +312,7 @@ public class SchematicCommand extends SWCommand { case "-owner": SteamwarUser steamwarUser = SteamwarUser.get(query[finalI + 1]); if (steamwarUser == null) { - player.sendMessage(SchematicSystem.PREFIX + "§cDer Spieler §e" + query[finalI + 1] + " §cexistiert nicht"); + SchematicSystem.MESSAGE.send("COMMAND_SEARCH_NOT_A_PLAYER", player, query[finalI + 1]); return; } predicates.add(node -> node.getOwner() == steamwarUser.getId()); @@ -329,7 +326,7 @@ public class SchematicCommand extends SWCommand { case "-excludeOwner": SteamwarUser steamwarUser1 = SteamwarUser.get(query[finalI + 1]); if (steamwarUser1 == null) { - player.sendMessage(SchematicSystem.PREFIX + "§cDer Spieler §e" + query[finalI + 1] + " §cexistiert nicht"); + SchematicSystem.MESSAGE.send("COMMAND_SEARCH_NOT_A_PLAYER", player, query[finalI + 1]); return; } predicates.add(node -> node.getOwner() != steamwarUser1.getId()); @@ -368,14 +365,14 @@ public class SchematicCommand extends SWCommand { @Register("lockreplay") public void lockreplay(Player player, SchematicNode node) { node.setAllowReplay(false); - player.sendMessage(SchematicSystem.PREFIX + "Replays von Kämpfen mit " + node.getName() + " können ab sofort nicht mehr betrachtet werden"); + SchematicSystem.MESSAGE.send("COMMAND_LOCKREPLAY", player, node.getName()); } @Register("replacecolor") public void replacecolor(Player player, SchematicNode node) { boolean state = !node.replaceColor(); node.setReplaceColor(state); - player.sendMessage(SchematicSystem.PREFIX + "In Kämpfen " + node.getName() + " werden pinke Blöcke " + (state ? "" : "nicht ") + "ersetzt"); + SchematicSystem.MESSAGE.send(state?"COMMAND_REPLACE_COLOR_ON":"COMMAND_REPLACE_COLOR_OFF", player, node.getName()); } @Register("dir") @@ -388,14 +385,14 @@ public class SchematicCommand extends SWCommand { String[] layers = name.split("/"); if (invalidSchemName(player, layers)) return; SchematicNode node = mkdirs(layers, user, 0); - player.sendMessage(SchematicSystem.PREFIX + "§7Ordner §e" + node.generateBreadcrumbs(user) + " §7erstellt"); + SchematicSystem.MESSAGE.send("COMMAND_DIR_DONE", player, node.generateBreadcrumbs(user)); } @Register("changetype") public void changeType(Player player, SchematicNode node) { SteamwarUser user = getUser(player); if (node.getOwner() != user.getId()) { - player.sendMessage(SchematicSystem.PREFIX + "§cDu kannst nur deine eigenen Schematics einsenden."); + SchematicSystem.MESSAGE.send("COMMAND_CHANGE_TYPE_NOT_OWNER", player); return; } TextComponent base = new TextComponent(); @@ -406,7 +403,7 @@ public class SchematicCommand extends SWCommand { TextComponent component = new TextComponent(type.name() + " "); component.setColor(ChatColor.GRAY); component.setBold(true); - component.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, TextComponent.fromLegacyText("§eTyp auswählen"))); + component.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, TextComponent.fromLegacyText(SchematicSystem.MESSAGE.parse("COMMAND_CHANGE_TYPE_SELECT", player)))); component.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/schem changetype " + node.generateBreadcrumbs(user) + " " + type.name())); base.addExtra(component); }); @@ -433,7 +430,7 @@ public class SchematicCommand extends SWCommand { public void move(Player player, SchematicNode node, @Mapper("dirStringMapper") String name) { SteamwarUser user = getUser(player); if (node.getOwner() != user.getId()) { - player.sendMessage(SchematicSystem.PREFIX + "§cDu kannst nur deine eigenen Schems verschieben."); + SchematicSystem.MESSAGE.send("COMMAND_MOVE_NOT_OWN", player); return; } @@ -446,7 +443,7 @@ public class SchematicCommand extends SWCommand { if (invalidSchemName(player, layers)) return; SchematicNode newNode = mkdirs(layers, user, 0); if(SchematicNode.getAllParentsOfNode(newNode).contains(node)) { - player.sendMessage(SchematicSystem.PREFIX + "§cDas gibt nur Fehler, vertrau mir."); + SchematicSystem.MESSAGE.send("COMMAND_MOVE_RECURSIVE", player); return; } SafeSchematicNode.Result result = SafeSchematicNode.setParent(user, node, newNode); @@ -455,14 +452,14 @@ public class SchematicCommand extends SWCommand { return; } } - player.sendMessage(SchematicSystem.PREFIX + "§7Die Schematic ist nun unter §e" + node.generateBreadcrumbs(user) + " §7zu finden"); + SchematicSystem.MESSAGE.send("COMMAND_MOVE_DONE", player, node.generateBreadcrumbs(user)); } @Register("rename") public void rename(Player player, SchematicNode node, String name) { SteamwarUser user = getUser(player); if (node.getOwner() != user.getId()) { - player.sendMessage(SchematicSystem.PREFIX + "§cDas kannst du nur bei deinen eigenen Schems machen"); + SchematicSystem.MESSAGE.send("COMMAND_RENAME_NOT_OWN", player); return; } if (invalidSchemName(player, new String[]{name})) { @@ -473,19 +470,19 @@ public class SchematicCommand extends SWCommand { result.sendError(player); return; } - player.sendMessage(SchematicSystem.PREFIX + "§7Die Schematic heist nun §e" + node.generateBreadcrumbs(user)); + SchematicSystem.MESSAGE.send("COMMAND_RENAME_DONE", player, node.generateBreadcrumbs(user)); } @Register("addteam") public void addTeam(Player player, SchematicNode node) { SteamwarUser user = getUser(player); if (node.getOwner() != user.getId()) { - player.sendMessage(SchematicSystem.PREFIX + "§cDas kannst du nur bei deinen eigenen Schems machen"); + SchematicSystem.MESSAGE.send("COMMAND_ADD_TEAM_NOT_OWN", player); return; } Team team = Team.get(user.getTeam()); if (team == null) { - player.sendMessage(SchematicSystem.PREFIX + "§cDu bist in keinem Team"); + SchematicSystem.MESSAGE.send("COMMAND_ADD_TEAM_NOT_IN_TEAM", player); return; } @@ -496,12 +493,12 @@ public class SchematicCommand extends SWCommand { public void remTeam(Player player, SchematicNode node) { SteamwarUser user = getUser(player); if (node.getOwner() != user.getId()) { - player.sendMessage(SchematicSystem.PREFIX + "§cDas kannst du nur bei deinen eigenen Schems machen"); + SchematicSystem.MESSAGE.send("COMMAND_DEL_TEAM_NOT_OWN", player); return; } Team team = Team.get(user.getTeam()); if (team == null) { - player.sendMessage(SchematicSystem.PREFIX + "§cDu bist in keinem Team"); + SchematicSystem.MESSAGE.send("COMMAND_DEL_TEAM_NOT_IN_TEAM", player); return; } @@ -517,9 +514,9 @@ public class SchematicCommand extends SWCommand { Optional reduced = removed.stream().reduce((s, s2) -> s + ", " + s2); if (reduced.isPresent()) { - player.sendMessage(SchematicSystem.PREFIX + "§7Die Spieler §e" + reduced.get() + " §7wurden von der Schematic entfernt"); + SchematicSystem.MESSAGE.send("COMMAND_DEL_TEAM_DONE", player, reduced.get()); } else { - player.sendMessage(SchematicSystem.PREFIX + "§7Es wurde kein Spieler entfernt"); + SchematicSystem.MESSAGE.send("COMMAND_DEL_TEAM_NONE", player); } } @@ -527,12 +524,12 @@ public class SchematicCommand extends SWCommand { public void clearMember(Player player, SchematicNode node) { SteamwarUser user = getUser(player); if (node.getOwner() != user.getId()) { - player.sendMessage(SchematicSystem.PREFIX + "§cDas kannst du nur bei deinen eigenen Schems machen"); + SchematicSystem.MESSAGE.send("COMMAND_CLEAR_MEMBER_NOT_OWN", player); return; } node.getMembers().forEach(NodeMember::delete); - player.sendMessage(SchematicSystem.PREFIX + "§7Alle Spieler wurden von der Schematic entfernt"); + SchematicSystem.MESSAGE.send("COMMAND_CLEAR_MEMBER_DONE", player); } @Register("delallmember") @@ -546,7 +543,7 @@ public class SchematicCommand extends SWCommand { i++; } } - player.sendMessage(SchematicSystem.PREFIX + "§e" + target.getUserName() + " §7wurde von §e" + i + " §7Schematics entfernt"); + SchematicSystem.MESSAGE.send("COMMAND_DEL_ALL_MEMBER", player, target.getUserName(), i); } @Register(value = "togglepublic", noTabComplete = true) @@ -558,9 +555,9 @@ public class SchematicCommand extends SWCommand { } if (togglePublic(player)) { - player.sendMessage(SchematicSystem.PREFIX + "§aDu bist nun der Public User"); + SchematicSystem.MESSAGE.send("COMMAND_PUBLIC_ON", player); } else { - player.sendMessage(SchematicSystem.PREFIX + "§cDu bist nun nicht mehr der Public User"); + SchematicSystem.MESSAGE.send("COMMAND_PUBLIC_OFF", player); } } @@ -570,23 +567,23 @@ public class SchematicCommand extends SWCommand { if (node.getOwner() != user.getId()) { NodeMember member = NodeMember.getNodeMember(node.getId(), user.getId()); if (member == null) { - player.sendMessage(SchematicSystem.PREFIX + "§cDie Schematic gehört dir nicht"); + SchematicSystem.MESSAGE.send("COMMAND_DELETE_NOT_OWN", player); return; } member.delete(); - player.sendMessage(SchematicSystem.PREFIX + "§aDu hast dich von der Schematic entfernt"); + SchematicSystem.MESSAGE.send("COMMAND_DELETE_MEMBER", player); return; } if (node.isDir()) { if (SchematicNode.getSchematicNodeInNode(node).isEmpty()) { - player.sendMessage(SchematicSystem.PREFIX + "§aDer Ordner §e" + node.generateBreadcrumbs(user) + "§a wird gelöcht..."); + SchematicSystem.MESSAGE.send("COMMAND_DELETE_DIR", player, node.generateBreadcrumbs(user)); node.delete(); } else { - player.sendMessage(SchematicSystem.PREFIX + "§cDer Ordner muss leer sein, um ihn zu löchen!"); + SchematicSystem.MESSAGE.send("COMMAND_DELETE_DIR_FULL", player); } } else { - player.sendMessage(SchematicSystem.PREFIX + "§aDie Schematic §e" + node.generateBreadcrumbs(user) + "§a wird gelöscht..."); + SchematicSystem.MESSAGE.send("COMMAND_DELETE_SCHEM", player, node.generateBreadcrumbs(user)); node.delete(); } } @@ -657,8 +654,8 @@ public class SchematicCommand extends SWCommand { public TypeMapper publicDirNodeTypeMapper() { return new TypeMapper() { @Override - public List tabCompletes(CommandSender commandSender, String[] strings, String s) { - List list = publicCommandTypeMapper.tabCompletes(commandSender, strings, s); + public Collection tabCompletes(CommandSender commandSender, String[] strings, String s) { + Collection list = publicCommandTypeMapper.tabCompletes(commandSender, strings, s); list.removeIf(s1 -> !s1.endsWith("/")); return list; } @@ -731,7 +728,7 @@ public class SchematicCommand extends SWCommand { } @Override - public List tabCompletes(CommandSender commandSender, String[] strings, String s) { + public Collection tabCompletes(CommandSender commandSender, String[] strings, String s) { if (strings.length == 0) { List list = new ArrayList<>(); list.add(s); @@ -740,7 +737,7 @@ public class SchematicCommand extends SWCommand { } String last = strings[strings.length - 1]; if (searchMapper.containsKey(last)) { - TypeMapper mapper = searchMapper.get(last); + AbstractTypeMapper mapper = searchMapper.get(last); if (mapper == null) { List list = new ArrayList<>(searchMapper.keySet()); list.add(s); diff --git a/SchematicSystem_Core/src/de/steamwar/schematicsystem/commands/SchematicCommandHelp.java b/SchematicSystem_Core/src/de/steamwar/schematicsystem/commands/SchematicCommandHelp.java index b5d00da..fc2dc0d 100644 --- a/SchematicSystem_Core/src/de/steamwar/schematicsystem/commands/SchematicCommandHelp.java +++ b/SchematicSystem_Core/src/de/steamwar/schematicsystem/commands/SchematicCommandHelp.java @@ -19,6 +19,7 @@ package de.steamwar.schematicsystem.commands; +import de.steamwar.schematicsystem.SchematicSystem; import net.md_5.bungee.api.ChatColor; import net.md_5.bungee.api.chat.ClickEvent; import net.md_5.bungee.api.chat.HoverEvent; @@ -30,49 +31,49 @@ public class SchematicCommandHelp { } public static void printHelpMainPage(Player player) { - player.sendMessage("§e§lSchematicSystem §8§lHilfe"); + SchematicSystem.MESSAGE.sendPrefixless("HELP_HEADER", player); for (HelpPage page : HelpPage.values()) { - TextComponent pageComp = new TextComponent(page.mainText); + TextComponent pageComp = new TextComponent(SchematicSystem.MESSAGE.parse(page.mainText, player)); pageComp.setColor(ChatColor.GRAY); - pageComp.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, TextComponent.fromLegacyText("§e" + page.hover))); + pageComp.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, TextComponent.fromLegacyText("§e" + SchematicSystem.MESSAGE.parse(page.hover, player)))); pageComp.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/schem help " + page.name())); player.spigot().sendMessage(pageComp); } } public static void printHelpPage(Player player, HelpPage page) { - player.sendMessage("§e§lSchematicSystem §8§lHilfe"); + SchematicSystem.MESSAGE.sendPrefixless("HELP_HEADER", player); for (String s : page.content) { - player.sendMessage(s); + SchematicSystem.MESSAGE.sendPrefixless(s, player); } } public enum HelpPage { - ANSICHT("Finden & Laden", "Suche oder lade Schematics", new String[]{ - "§8/§7schem §einfo §8[§7Schematic§8] - §7Zeigt dir Informationen zur Schematic", - "§8/§7schem §elist §8- §7Zeigt dir deine Schematics an", - "§8/§7schem §elist public §8- §7Zeigt alle Public-Schematics", - "§8/§7schem §esearch §8[§7Stichwort§8] - §7Sucht nach passenden Schematics", - "§8/§7schem §eload §8[§7Schematic§8] - §7Lädt eine Schematic", - "§8/§7schem §edownload §8[§7Schematic§8] - §7Gibt dir einen Downloadlink (1 min gültig)" + ANSICHT("HELP_VIEW", "HELP_VIEW_HOVER", new String[]{ + "HELP_VIEW_1", + "HELP_VIEW_2", + "HELP_VIEW_3", + "HELP_VIEW_4", + "HELP_VIEW_5", + "HELP_VIEW_6" }), - BEARBEITUNG("Speichern & Bearbeiten", "Modifizierung von Schematics und Ordnern", new String[]{ - "§8/§7schem §esave §8[§7Schematic§8] - §7Speichert dein Clipboard als Schematic", - "§8/§7schem §eordner §8[§7Ordner§8] - §7Erstelle einen leeren Ordner", - "§8/§7schem §emove §8[§7Schematic§8] [§7Neuer Pfad§8] - §7Verschiebe eine Schematic", - "§8/§7schem §erename §8[§7Schematic§8] [§7Neuer Name§8] - §7Gib der Schematic einen neuen Namen", - "§8/§7schem §echangetype §8[§7Schematic§8] - §7Ändert die Art deiner Schematic", - "§8/§7schem §elockreplay §8[§7Schematic§8] - §7Sperrt Replays mit der Schematic", - "§8/§7schem §ereplacecolor §8[§7Schematic§8] - §7Ändert Farbersetzung in der Arena", - "§8/§7schem §edelete §8[§7Schematic§8] - §7Löscht eine Schematic" + BEARBEITUNG("HELP_EDIT", "HELP_EDIT_HOVER", new String[]{ + "HELP_EDIT_1", + "HELP_EDIT_2", + "HELP_EDIT_3", + "HELP_EDIT_4", + "HELP_EDIT_5", + "HELP_EDIT_6", + "HELP_EDIT_7", + "HELP_EDIT_8" }), - MEMBER("Besitzrechte", "Schematics mit anderen teilen", new String[]{ - "§8/§7schem §eaddmember §8[§7Schematic§8] §8[§7Spieler§8] - §7Fügt einen Spieler zu einer Schematic hinzu", - "§8/§7schem §edelmember §8[§7Schematic§8] §8[§7Spieler§8] - §7Entfernt einen Spieler von einer Schematic", - "§8/§7schem §eclearmember §8[§7Schematic§8] - §7Entfernt alle Spieler von der Schematic", - "§8/§7schem §edelallmember §8[§7Spieler§8] - §7Entfernt einen Spieler von allen deinen Schematics", - "§8/§7schem §eaddteam §8[§7Schematic§8] - §7Füge jeden aus deinem Team auf die Schematic hinzu", - "§8/§7schem §edelteam §8[§7Schematic§8] - §7Entferne jeden aus deinem Team von der Schematic" + MEMBER("HELP_SHARE", "HELP_SHARE_HOVER", new String[]{ + "HELP_SHARE_1", + "HELP_SHARE_2", + "HELP_SHARE_3", + "HELP_SHARE_4", + "HELP_SHARE_5", + "HELP_SHARE_6" }); private final String mainText; diff --git a/SchematicSystem_Core/src/de/steamwar/schematicsystem/commands/SchematicCommandUtils.java b/SchematicSystem_Core/src/de/steamwar/schematicsystem/commands/SchematicCommandUtils.java index d55405b..88c586c 100644 --- a/SchematicSystem_Core/src/de/steamwar/schematicsystem/commands/SchematicCommandUtils.java +++ b/SchematicSystem_Core/src/de/steamwar/schematicsystem/commands/SchematicCommandUtils.java @@ -19,9 +19,10 @@ package de.steamwar.schematicsystem.commands; -import de.steamwar.comms.packets.PrepareSchemPacket; import de.steamwar.inventory.SWInventory; import de.steamwar.inventory.SWItem; +import de.steamwar.network.NetworkSender; +import de.steamwar.network.packets.client.PrepareSchemPacket; import de.steamwar.providers.BauServerInfo; import de.steamwar.schematicsystem.AutoCheckResult; import de.steamwar.schematicsystem.CheckSchemType; @@ -37,7 +38,6 @@ import net.md_5.bungee.api.chat.TextComponent; import org.bukkit.Bukkit; import org.bukkit.entity.Player; -import java.time.format.DateTimeFormatter; import java.util.*; import java.util.function.IntFunction; import java.util.function.UnaryOperator; @@ -56,11 +56,11 @@ public class SchematicCommandUtils { public static boolean invalidSchemName(Player player, String[] layers) { for (String layer : layers) { if (layer.isEmpty()) { - player.sendMessage(SchematicSystem.PREFIX + "§cDeine Ordner brauchen schon einen Namen!"); + SchematicSystem.MESSAGE.send("UTIL_NAME_REQUIRED", player); return true; } if(layer.length() > 64) { - player.sendMessage(SchematicSystem.PREFIX + "§cDer Name der Schematic ist zu lang"); + SchematicSystem.MESSAGE.send("UTIL_NAME_TOO_LONG", player); return true; } if (layer.contains("/") || @@ -72,11 +72,11 @@ public class SchematicCommandUtils { layer.contains("'") || layer.contains("\"") || layer.contains(" ")) { - player.sendMessage(SchematicSystem.PREFIX + "§cDer angegebene Schematicname enthält verbotene Zeichen"); + SchematicSystem.MESSAGE.send("UTIL_NAME_INVALID_CHAR", player); return true; } if (FORBIDDEN_NAMES.contains(layer.toLowerCase())) { - player.sendMessage(SchematicSystem.PREFIX + "§cDer Pfad darf nicht \"§l" + layer + "§c\" enthalten"); + SchematicSystem.MESSAGE.send("UTIL_NAME_FORBIDDEN", player, layer); return true; } } @@ -91,16 +91,12 @@ public class SchematicCommandUtils { SteamwarUser user = getUser(player); int pageCount = (int) Math.ceil(nodes.size() / (double) CHUNK_SIZE); - player.sendMessage("§eSchematics §8(§e" + nodes.size() + "§8)"); + SchematicSystem.MESSAGE.sendPrefixless("UTIL_LIST_HEAD", player, nodes.size()); String breadcrumbs = parent == null ? "" : parent.generateBreadcrumbs(user); - player.sendMessage("§7Aktueller Pfad: §e" + (breadcrumbs.isEmpty() ? "/" : breadcrumbs)); + SchematicSystem.MESSAGE.sendPrefixless("UTIL_LIST_PATH", player, (breadcrumbs.isEmpty() ? "/" : breadcrumbs)); if (!breadcrumbs.isEmpty()) { - TextComponent back = new TextComponent("§e../"); String str = breadcrumbs.substring(0, Math.max(0, breadcrumbs.substring(0, breadcrumbs.length() - 1).lastIndexOf("/"))); - back.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder("§eZurück gehen" + str).create())); - back.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/schem list " + (behavior.isPublics() ? "public" : "") + " " + str)); - - player.spigot().sendMessage(back); + SchematicSystem.MESSAGE.sendPrefixless("UTIL_LIST_BACK", player, SchematicSystem.MESSAGE.parse("UTIL_LIST_BACK_HOVER", player, str), new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/schem list " + (behavior.isPublics() ? "public" : "") + " " + str)); } for (int i = chunk * CHUNK_SIZE; i < nodes.size() && i < (chunk + 1) * CHUNK_SIZE; i++) { SchematicNode node = nodes.get(i); @@ -108,16 +104,14 @@ public class SchematicCommandUtils { StringBuilder nodeString = new StringBuilder(); if (node.isDir()) { - nodeString.append("§7§lDIR §e"); + nodeString.append(SchematicSystem.MESSAGE.parse("UTIL_LIST_DIR", player)).append(" "); } else { SchematicType type = node.getSchemtype(); if (type != SchematicType.Normal) { - nodeString.append("§8§l") - .append(type.getKuerzel().toUpperCase()) - .append(" "); + nodeString.append(SchematicSystem.MESSAGE.parse("UTIL_LIST_TYPE", player, type.name())).append(" "); } - nodeString.append("§e"); } + nodeString.append(SchematicSystem.MESSAGE.parse("UTIL_LIST_BASE", player)); nodeString.append(behavior.getRenderHook().apply(node.getName())); @@ -126,16 +120,15 @@ public class SchematicCommandUtils { } if (node.getOwner() != user.getId()) { - nodeString.append(" §8von §7") - .append(SteamwarUser.get(node.getOwner()).getUserName()); + nodeString.append(" ").append(SchematicSystem.MESSAGE.parse("UTIL_LIST_FROM", player, SteamwarUser.get(node.getOwner()).getUserName())); } TextComponent schematics = new TextComponent(nodeString.toString()); if (node.isDir()) { - schematics.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder("§eOrdner anzeigen").create())); + schematics.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder(SchematicSystem.MESSAGE.parse("UTIL_LIST_OPEN_DIR", player)).create())); schematics.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/schem list " + (behavior.isPublics() ? "public" : "") + " " + breadcrumbs + node.getName() + "/")); } else { - schematics.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder("§eSchematic verwalten").create())); + schematics.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder(SchematicSystem.MESSAGE.parse("UTIL_LIST_OPEN_SCHEM", player)).create())); schematics.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/schem info " + (behavior.isPublics() ? "public" : "") + " " + breadcrumbs + node.getName())); } @@ -143,26 +136,27 @@ public class SchematicCommandUtils { } if (parent != null && parent.getOwner() != user.getId() && NodeMember.getNodeMember(parent.getId(), user.getId()) != null) { - TextComponent deadd = new TextComponent("[Entfernen]"); + TextComponent deadd = SchematicSystem.MESSAGE.parseToComponent("UTIL_LIST_REMOVE", false, player); deadd.setColor(ChatColor.RED); - deadd.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, TextComponent.fromLegacyText("§7Entferne dich von dem Ordner"))); + deadd.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new TextComponent[] {SchematicSystem.MESSAGE.parseToComponent("UTIL_LIST_REMOVE_HOVER", false, player)})); deadd.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/schem delete " + parent.generateBreadcrumbs(user))); player.spigot().sendMessage(deadd); } - TextComponent beforePage = new TextComponent("««"); + TextComponent beforePage = SchematicSystem.MESSAGE.parseToComponent("UTIL_LIST_BACK_ARROW", false, player); + beforePage.addExtra(" "); if (chunk > 0) { beforePage.setColor(ChatColor.YELLOW); - beforePage.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder("§eVorherige Seite").create())); + beforePage.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new TextComponent[] {SchematicSystem.MESSAGE.parseToComponent("UTIL_LIST_BACK_ARROW_HOVER", false, player)})); beforePage.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, behavior.getPageCommandGen().apply(chunk - 1))); } else { beforePage.setColor(ChatColor.RED); } - TextComponent nextPage = new TextComponent(" Seite (" + (chunk + 1) + "/" + Math.max(pageCount, 1) + ") »»"); + TextComponent nextPage = SchematicSystem.MESSAGE.parseToComponent("UTIL_LIST_NEXT", false, player, chunk + 1, Math.max(pageCount, 1)); if (chunk < pageCount - 1) { nextPage.setColor(ChatColor.YELLOW); - nextPage.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder("§eNächste Seite").create())); + nextPage.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new TextComponent[] {SchematicSystem.MESSAGE.parseToComponent("UTIL_LIST_NEXT_HOVER", false, player)})); nextPage.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, behavior.getPageCommandGen().apply(chunk + 1))); } else { nextPage.setColor(ChatColor.RED); @@ -223,12 +217,12 @@ public class SchematicCommandUtils { player.sendMessage("§7Typ: §e" + node.getSchemtype().name()); } if (node.getRank() > 0) { - player.sendMessage("§7Rang: §e" + node.getRank()); + SchematicSystem.MESSAGE.sendPrefixless("UTIL_INFO_RANK", player, node.getRank()); } if (node.getSchemtype().fightType()) { - player.sendMessage("§7Farbersetzung: §e" + (node.replaceColor() ? "ja" : "nein")); - player.sendMessage("§7Replaywiedergabe: §e" + (node.allowReplay() ? "gestattet" : "untersagt")); + SchematicSystem.MESSAGE.sendPrefixless("UTIL_INFO_COLOR", player, SchematicSystem.MESSAGE.parse(node.replaceColor() ? "ON" : "OFF", player)); + SchematicSystem.MESSAGE.sendPrefixless("UTIL_INFO_REPLAY", player, SchematicSystem.MESSAGE.parse(node.allowReplay() ? "ON" : "OFF", player)); } player.sendMessage("§7Format: §e" + (node.getSchemFormat() ? ".schem" : ".schematic")); @@ -262,24 +256,24 @@ public class SchematicCommandUtils { TextComponent base = new TextComponent(); if (!node.isDir()) { - TextComponent load = new TextComponent("[Laden] "); + TextComponent load = SchematicSystem.MESSAGE.parseToComponent("UTIL_INFO_ACTION_LOAD", false, player); load.setColor(ChatColor.GREEN); - load.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, TextComponent.fromLegacyText("§eSchematic laden"))); + load.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new TextComponent[]{SchematicSystem.MESSAGE.parseToComponent("UTIL_INFO_ACTION_LOAD_HOVER", false, player)})); load.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/schem load " + (node.getOwner() == 0 ? "public " : "") + node.generateBreadcrumbs(user))); base.addExtra(load); if (node.getOwner() == user.getId()) { - TextComponent download = new TextComponent("[Download] "); + TextComponent download = SchematicSystem.MESSAGE.parseToComponent("UTIL_INFO_ACTION_DOWNLOAD", false, player); download.setColor(ChatColor.GOLD); - download.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, TextComponent.fromLegacyText("§eSchematic downloaden"))); + download.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new TextComponent[]{SchematicSystem.MESSAGE.parseToComponent("UTIL_INFO_ACTION_DOWNLOAD_HOVER", false, player)})); download.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/schem download " + node.generateBreadcrumbs(user))); base.addExtra(download); } } - TextComponent delete = new TextComponent("[" + (node.getOwner() == user.getId() ? "Löschen" : "Entfernen") + "] "); + TextComponent delete = SchematicSystem.MESSAGE.parseToComponent("UTIL_INFO_ACTION_DELETE", false, player); delete.setColor(ChatColor.DARK_RED); - delete.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, TextComponent.fromLegacyText("§e" + (node.isDir() ? "Ordner" : "Schematic") + " Löschen"))); + delete.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new TextComponent[]{SchematicSystem.MESSAGE.parseToComponent("UTIL_INFO_ACTION_DELETE_HOVER", false, player)})); delete.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/schem delete " + node.generateBreadcrumbs(user))); base.addExtra(delete); @@ -336,24 +330,24 @@ public class SchematicCommandUtils { SteamwarUser user = getUser(player); if(BauServerInfo.isBauServer() && BauServerInfo.getOwnerId() != user.getId() && (Punishment.isPunished(user, Punishment.PunishmentType.NoSchemSharing, punishment -> - player.sendMessage(SchematicSystem.PREFIX + "§cDu kannst hier keine Schematics laden")) || + SchematicSystem.MESSAGE.send("UTIL_LOAD_NOT_HERE", player)) || Punishment.isPunished(SteamwarUser.get(BauServerInfo.getOwnerId()), Punishment.PunishmentType.NoSchemReceiving, punishment -> - player.sendMessage(SchematicSystem.PREFIX + "§cAuf diesem Bau können keine Schematics geladen werden")))) { + SchematicSystem.MESSAGE.send("UTIL_LOAD_NOT_HERE_ALL", player)))) { return; } if (node.isDir()) { - player.sendMessage(SchematicSystem.PREFIX + "§cDu kannst keine Ordner Laden"); + SchematicSystem.MESSAGE.send("UTIL_LOAD_DIR", player); return; } try { node.loadToPlayer(player); - player.sendMessage(SchematicSystem.PREFIX + "§7Schematic §e" + node.getName() + " §7geladen!"); + SchematicSystem.MESSAGE.send("UTIL_LOAD_DONE", player, node.getName()); Bukkit.getLogger().log(Level.INFO, "{0} has loaded Schematic {1} {2}", new Object[]{player.getName(), node.getId(), node.getName()}); } catch (NoClipboardException e) { - player.sendMessage(SchematicSystem.PREFIX + "§cEs konnte keine Daten in der Schematic gefunden werden."); + SchematicSystem.MESSAGE.send("UTIL_LOAD_NO_DATA", player); } catch (Exception e) { - player.sendMessage(SchematicSystem.PREFIX + "§cDie Schematic konnte nicht geladen werden."); + SchematicSystem.MESSAGE.send("UTIL_LOAD_ERROR", player); Bukkit.getLogger().log(Level.INFO, e.getMessage(), e); } } @@ -361,16 +355,16 @@ public class SchematicCommandUtils { public static void download(Player player, SchematicNode node) { SteamwarUser user = getUser(player); if (Punishment.isPunished(user, Punishment.PunishmentType.NoSchemSharing, punishment -> { - player.sendMessage(SchematicSystem.PREFIX + "§cDu darf keine Schematics Downloaden: §f§l" + punishment.getReason()); + SchematicSystem.MESSAGE.send("UTIL_DOWNLOAD_PUNISHED", player, punishment.getReason()); })) { return; } if (node.getOwner() != user.getId()) { - player.sendMessage("§cDu darfst nur deine eigenen Schematics herunterladen!"); + SchematicSystem.MESSAGE.send("UTIL_DOWNLOAD_NOT_OWN", player); return; } - player.sendMessage(SchematicSystem.PREFIX + "Dein Download Link:"); + SchematicSystem.MESSAGE.send("UTIL_DOWNLOAD_LINK", player); player.sendMessage(NodeDownload.getLink(node)); } @@ -378,77 +372,84 @@ public class SchematicCommandUtils { SteamwarUser user = getUser(player); if (Punishment.isPunished(user, Punishment.PunishmentType.NoSchemSubmitting, - punishment -> player.sendMessage(SchematicSystem.PREFIX + "§cDu darf keine Schematics einsenden: §f§l: " + punishment.getReason()))) { + punishment -> SchematicSystem.MESSAGE.send("UTIL_TYPE_PUNISHED", player, punishment.getReason()))) { return; } if (node.getOwner() != user.getId()) { - player.sendMessage(SchematicSystem.PREFIX + "§cDu kannst nur deine eigenen Schematics einsenden."); + SchematicSystem.MESSAGE.send("UTIL_TYPE_NOT_OWN", player); return; } if (node.isDir()) { - player.sendMessage(SchematicSystem.PREFIX + "§cOrdner haben keinen Typen."); + SchematicSystem.MESSAGE.send("UTIL_TYPE_DIR", player); return; } if (!type.isAssignable()) { - player.sendMessage(SchematicSystem.PREFIX + "§cZu diesem Typen können keine Schematics geändert werden."); + SchematicSystem.MESSAGE.send("UTIL_TYPE_NOT_ASSIGNABLE", player); + return; } if (node.getSchemtype().equals(type)) { - player.sendMessage(SchematicSystem.PREFIX + "§cDie Schematic hat schon diesen Typen"); + SchematicSystem.MESSAGE.send("UTIL_TYPE_ALREADY", player); return; } if (type.writeable()) { node.setSchemtype(type); - player.sendMessage(SchematicSystem.PREFIX + "§aSchematictyp geändert"); + SchematicSystem.MESSAGE.send("UTIL_TYPE_DONE", player); } else if (type.fightType()) { if (node.getSchemtype().check()) { - player.sendMessage(SchematicSystem.PREFIX + "§cDu hast diese Schematic bereits eingesendet"); + SchematicSystem.MESSAGE.send("UTIL_TYPE_FIGHT_ALREADY", player); return; } - AutoCheckResult result = CheckSchemType.get(type).autoCheck(node); - Collection errors = result.errors(); - for (String warning : result.warnings()) { - player.sendMessage(" §e" + warning); + CheckSchemType checkSchemType = CheckSchemType.get(type); + if (checkSchemType.isAfterDeadline()) { + SchematicSystem.MESSAGE.send("UTIL_TYPE_AFTER_DEADLINE", player, checkSchemType.getDeadline()); + return; } - for (String error : errors) { - player.sendMessage(" §c" + error); + + AutoCheckResult result = checkSchemType.autoCheck(node); + Map errors = result.errors(); + for (Map.Entry warning : result.warnings().entrySet()) { + SchematicSystem.MESSAGE.sendPrefixless(warning.getKey(), player, warning.getValue()); + } + for (Map.Entry error : errors.entrySet()) { + SchematicSystem.MESSAGE.sendPrefixless(error.getKey(), player, error.getValue()); } if (!errors.isEmpty()) { - player.sendMessage(SchematicSystem.PREFIX + "§cDie Schematic ist nicht regelkonform"); + SchematicSystem.MESSAGE.send("UTIL_TYPE_ERROR", player); return; } if (extend == null) { submitSchemGUI(player, node, type); } else if (extend == SchematicCommand.Extend.AUSFAHREN) { - new PrepareSchemPacket(SteamwarUser.get(player.getUniqueId()), node, type).send(player); - player.sendMessage(SchematicSystem.PREFIX + "§aDer Vorbereitungsserver wird gestartet"); + NetworkSender.send(new PrepareSchemPacket(SteamwarUser.get(player.getUniqueId()).getId(), node.getId(), type.toDB())); + SchematicSystem.MESSAGE.send("UTIL_TYPE_EXTEND", player); } } } private static void submitSchemGUI(Player player, SchematicNode node, SchematicType type) { - SWInventory inv = new SWInventory(player, 9, "Schematic ausfahren"); - inv.setItem(0, SWItem.getMaterial("SIGN"), node.allowReplay() ? "§aReplay erlaubt" : "§cReplay gesperrt", click -> { + SWInventory inv = new SWInventory(player, 9, SchematicSystem.MESSAGE.parse("UTIL_SUBMIT_TITLE", player)); + inv.setItem(0, SWItem.getMaterial("SIGN"), SchematicSystem.MESSAGE.parse(node.allowReplay()?"UTIL_SUBMIT_REPLAY_ON":"UTIL_SUBMIT_REPLAY_OFF", player), click -> { node.setAllowReplay(!node.allowReplay()); submitSchemGUI(player, node, type); }); - inv.setItem(1, SWItem.getMaterial(node.replaceColor() ? "PINK_WOOL" : "LIGHT_GRAY_WOOL"), node.replaceColor() ? "§aPink zu Teamfarbe ersetzen" : "§cPink nicht ersetzen", click -> { + inv.setItem(1, SWItem.getMaterial(node.replaceColor() ? "PINK_WOOL" : "LIGHT_GRAY_WOOL"), SchematicSystem.MESSAGE.parse(node.allowReplay()?"UTIL_SUBMIT_COLOR_ON":"UTIL_SUBMIT_COLOR_OFF", player), click -> { node.setReplaceColor(!node.replaceColor()); submitSchemGUI(player, node, type); }); - inv.setItem(7, SWItem.getDye(7), (byte) 7, "§eDirekt einsenden", click -> { + inv.setItem(7, SWItem.getDye(7), (byte) 7, SchematicSystem.MESSAGE.parse("UTIL_SUBMIT_DIRECT", player), click -> { node.setSchemtype(type.checkType()); - player.sendMessage(SchematicSystem.PREFIX + "§aDie Schematic wird zeitnah überprüft"); + SchematicSystem.MESSAGE.send("UTIL_SUBMIT_DIRECT_DONE", player); player.closeInventory(); }); - inv.setItem(8, SWItem.getDye(10), (byte) 10, "§eSchematic ausfahren", click -> { - new PrepareSchemPacket(SteamwarUser.get(player.getUniqueId()), node, type).send(player); - player.sendMessage(SchematicSystem.PREFIX + "§aDer Vorbereitungsserver wird gestartet"); + inv.setItem(8, SWItem.getDye(10), (byte) 10, SchematicSystem.MESSAGE.parse("UTIL_SUBMIT_EXTEND", player), click -> { + NetworkSender.send(new PrepareSchemPacket(SteamwarUser.get(player.getUniqueId()).getId(), node.getId(), type.toDB())); + SchematicSystem.MESSAGE.send("UTIL_SUBMIT_EXTEND_DONE", player); player.closeInventory(); }); inv.setCallback(-999, click -> player.closeInventory()); diff --git a/SchematicSystem_Core/src/plugin.yml b/SchematicSystem_Core/src/plugin.yml index b756bec..40e41e6 100644 --- a/SchematicSystem_Core/src/plugin.yml +++ b/SchematicSystem_Core/src/plugin.yml @@ -1,10 +1,8 @@ name: SchematicSystem -version: "2.0" +version: "2.1.0" authors: [Yaruma3341, Lixfel, Chaoscaot] depend: [SpigotCore, WorldEdit] main: de.steamwar.schematicsystem.SchematicSystem website: steamwar.de api-version: "1.13" description: Schematic-Frontend - -commands: diff --git a/SchematicSystem_Main/pom.xml b/SchematicSystem_Main/pom.xml deleted file mode 100644 index 154470e..0000000 --- a/SchematicSystem_Main/pom.xml +++ /dev/null @@ -1,59 +0,0 @@ - - - 4.0.0 - - - steamwar - SchematicSystem - 1.0 - - - - ${project.basedir}/.. - - - SchematicSystem_Main - 1.0 - - - - - org.apache.maven.plugins - maven-shade-plugin - 3.2.1 - - - package - - shade - - - - - - schematicsystem - - - - - steamwar - SchematicSystem_15 - 1.0 - compile - - - steamwar - SchematicSystem_8 - 1.0 - compile - - - steamwar - SchematicSystem_Core - 1.0 - compile - - - \ No newline at end of file diff --git a/build.gradle b/build.gradle new file mode 100644 index 0000000..34ae5ad --- /dev/null +++ b/build.gradle @@ -0,0 +1,247 @@ +/* + * This file is a part of the SteamWar software. + * + * Copyright (C) 2020 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 . + */ + + +import org.apache.tools.ant.taskdefs.condition.Os + +import java.util.function.BiConsumer + +plugins { + // Adding the base plugin fixes the following gradle warnings in IntelliJ: + // + // Warning: root project 'module-work-multi': Unable to resolve all content root directories + // Details: java.lang.IllegalStateException: No value has been specified for this provider. + // + // Warning: root project 'module-work-multi': Unable to resolve additional project configuration. + // Details: java.lang.IllegalStateException: No value has been specified for this provider. + id 'base' + id 'application' + + id 'com.github.johnrengelman.shadow' version '5.0.0' +} + +group 'de.steamwar' +version '' + +Properties steamwarProperties = new Properties() +if (file("steamwar.properties").exists()) { + steamwarProperties.load(file("steamwar.properties").newDataInputStream()) +} + +ext { + buildName = 'SchematicSystem' + artifactName = 'schematicsystem' + + uberJarName = "${buildName}-all.jar" + jarName = "${artifactName}.jar" + libs = "${buildDir}/libs" + + if (Os.isFamily(Os.FAMILY_WINDOWS)) { + operatingSystem = "windows" + } else { + operatingSystem = "unix" + } +} + +compileJava.options.encoding = 'UTF-8' +compileJava.options.compilerArgs << '-parameter' + +sourceCompatibility = 11 +targetCompatibility = 11 + +mainClassName = '' + +allprojects { + repositories { + mavenCentral() + jcenter() + + maven { + url = uri("https://repo.codemc.io/repository/maven-snapshots/") + } + + maven { + url = uri('https://hub.spigotmc.org/nexus/content/repositories/snapshots/') + } + + maven { + url = uri('https://libraries.minecraft.net') + } + } +} + +dependencies { + implementation project(":SchematicSystem_Core") + implementation project(":SchematicSystem_15") + implementation project(":SchematicSystem_8") +} + +task buildResources(type: Copy) { + from("BauSystem_Main/build/classes/java/main/META-INF/annotations/") + into("build/resources/main/de.steamwar.bausystem") +} +classes.finalizedBy(buildResources) + +task buildProject { + description 'Build this project' + group "Steamwar" + + dependsOn build +} + +task finalizeProject { + description 'Finalize this project' + group "Steamwar" + + doLast { + if ("${buildDir}" == null) { + return + } + delete fileTree("${libs}").matching { + exclude("${uberJarName}") + } + file(libs + "/" + uberJarName).renameTo(file(libs + "/" + jarName)) + } +} +build.finalizedBy(finalizeProject) + +if (steamwarProperties.containsKey("hostname")) { + String hostname = steamwarProperties.get("hostname") + String uploadPath = steamwarProperties.getOrDefault("uploadPath", "~") + + String server = steamwarProperties.getOrDefault("server", "Dev1.15") + String serverStartFlags = steamwarProperties.getOrDefault("serverStartFlags", "") + + task uploadProject { + description 'Upload this project' + group "Steamwar" + + doLast { + await(shell("scp ${libs}/${jarName} ${hostname}:${uploadPath}/${server}/plugins")) + if (steamwarProperties.getOrDefault("directStart", "false") == "false" && !answer("Start ${server} server?")) { + return + } + serverStart(server, serverStartFlags, hostname) + } + } + uploadProject.dependsOn(buildProject) + + task startDevServer { + description 'Start the DevServer' + group "Steamwar" + + doLast { + serverStart(server, serverStartFlags, hostname) + } + } +} + +private def await(Process proc) { + def out = new StringBuilder() + def err = new StringBuilder() + proc.waitForProcessOutput(out, err) + return [out, err, proc.exitValue()] +} + +private def shell(String command) { + if (operatingSystem == "unix") { + return ['bash', '-c', command].execute() + } else { + return ["cmd", "/c", command].execute() + } +} + +private def serverStart(String serverName, String serverFlags, String hostname) { + def proc = shell("ssh -t ${hostname} \"./mc ${serverFlags} ${serverName}\"") + + Set strings = new HashSet<>() + File file = new File("${projectDir}/ignoredlog"); + if (file.exists()) { + new BufferedReader(new InputStreamReader(new FileInputStream(file))).readLines().forEach({ s -> + strings.add(s) + }) + } + + Thread outputThread = new Thread({ + Reader reader = proc.getInputStream().newReader(); + Writer writer = System.out.newWriter(); + try { + while (proc.alive) { + String s = reader.readLine() + if (s == null) { + return + } + if (strings.stream().anyMatch({check -> s.contains(check)})) { + continue + } + writer.write(s + "\n") + writer.flush() + } + } catch (IOException e) { + // Ignored + } + }) + outputThread.setName("${serverName} - OutputThread") + outputThread.start() + + Writer writer + Thread inputThread = new Thread({ + Reader reader = System.in.newReader() + writer = proc.getOutputStream().newWriter() + try { + while (proc.alive) { + String s = reader.readLine() + writer.write(s + "\n") + writer.flush() + } + } catch (IOException e) { + // Ignored + } + }) + inputThread.setName("${serverName} - InputThread") + inputThread.start() + + gradle.buildFinished { buildResult -> + if (!proc.alive) { + return + } + writer = proc.getOutputStream().newWriter() + writer.write("stop\n") + writer.flush() + awaitClose(proc, outputThread, inputThread) + } + awaitClose(proc, outputThread, inputThread) +}; + +private static def awaitClose(Process proc, Thread outputThread, Thread inputThread) { + while (proc.alive) { + Thread.sleep(10) + } + proc.closeStreams() + outputThread.interrupt() + inputThread.interrupt() +} + +private def answer(String question) { + while (System.in.available() > 0) System.in.read() + println(question) + boolean valid = "Yy".contains(((char) System.in.read()).toString()) + while (System.in.available() > 0) System.in.read() + return valid +} \ No newline at end of file diff --git a/gradle.properties b/gradle.properties new file mode 100644 index 0000000..dc56501 --- /dev/null +++ b/gradle.properties @@ -0,0 +1,22 @@ +# +# This file is a part of the SteamWar software. +# +# Copyright (C) 2020 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 . +# + +org.gradle.daemon = true +org.gradle.parallel = true +org.gradle.workers.max = 4 \ No newline at end of file diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000..f3d88b1 Binary files /dev/null and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000..0f5795e --- /dev/null +++ b/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,6 @@ +#Sat Apr 10 23:34:12 CEST 2021 +distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.1-all.zip +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +zipStorePath=wrapper/dists +zipStoreBase=GRADLE_USER_HOME diff --git a/gradlew b/gradlew new file mode 100755 index 0000000..2fe81a7 --- /dev/null +++ b/gradlew @@ -0,0 +1,183 @@ +#!/usr/bin/env sh + +# +# Copyright 2015 the original author or authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +############################################################################## +## +## Gradle start up script for UN*X +## +############################################################################## + +# Attempt to set APP_HOME +# Resolve links: $0 may be a link +PRG="$0" +# Need this for relative symlinks. +while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`"/$link" + fi +done +SAVED="`pwd`" +cd "`dirname \"$PRG\"`/" >/dev/null +APP_HOME="`pwd -P`" +cd "$SAVED" >/dev/null + +APP_NAME="Gradle" +APP_BASE_NAME=`basename "$0"` + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD="maximum" + +warn () { + echo "$*" +} + +die () { + echo + echo "$*" + echo + exit 1 +} + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "`uname`" in + CYGWIN* ) + cygwin=true + ;; + Darwin* ) + darwin=true + ;; + MINGW* ) + msys=true + ;; + NONSTOP* ) + nonstop=true + ;; +esac + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD="java" + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then + MAX_FD_LIMIT=`ulimit -H -n` + if [ $? -eq 0 ] ; then + if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then + MAX_FD="$MAX_FD_LIMIT" + fi + ulimit -n $MAX_FD + if [ $? -ne 0 ] ; then + warn "Could not set maximum file descriptor limit: $MAX_FD" + fi + else + warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" + fi +fi + +# For Darwin, add options to specify how the application appears in the dock +if $darwin; then + GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" +fi + +# For Cygwin or MSYS, switch paths to Windows format before running java +if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then + APP_HOME=`cygpath --path --mixed "$APP_HOME"` + CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + JAVACMD=`cygpath --unix "$JAVACMD"` + + # We build the pattern for arguments to be converted via cygpath + ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` + SEP="" + for dir in $ROOTDIRSRAW ; do + ROOTDIRS="$ROOTDIRS$SEP$dir" + SEP="|" + done + OURCYGPATTERN="(^($ROOTDIRS))" + # Add a user-defined pattern to the cygpath arguments + if [ "$GRADLE_CYGPATTERN" != "" ] ; then + OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" + fi + # Now convert the arguments - kludge to limit ourselves to /bin/sh + i=0 + for arg in "$@" ; do + CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` + CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option + + if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition + eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` + else + eval `echo args$i`="\"$arg\"" + fi + i=`expr $i + 1` + done + case $i in + 0) set -- ;; + 1) set -- "$args0" ;; + 2) set -- "$args0" "$args1" ;; + 3) set -- "$args0" "$args1" "$args2" ;; + 4) set -- "$args0" "$args1" "$args2" "$args3" ;; + 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; + 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; + 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; + 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; + 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; + esac +fi + +# Escape application args +save () { + for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done + echo " " +} +APP_ARGS=`save "$@"` + +# Collect all arguments for the java command, following the shell quoting and substitution rules +eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" + +exec "$JAVACMD" "$@" diff --git a/gradlew.bat b/gradlew.bat new file mode 100644 index 0000000..9618d8d --- /dev/null +++ b/gradlew.bat @@ -0,0 +1,100 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto init + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto init + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:init +@rem Get command-line arguments, handling Windows variants + +if not "%OS%" == "Windows_NT" goto win9xME_args + +:win9xME_args +@rem Slurp the command line arguments. +set CMD_LINE_ARGS= +set _SKIP=2 + +:win9xME_args_slurp +if "x%~1" == "x" goto execute + +set CMD_LINE_ARGS=%* + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/pom.xml b/pom.xml deleted file mode 100644 index 411fb62..0000000 --- a/pom.xml +++ /dev/null @@ -1,56 +0,0 @@ - - - 4.0.0 - - steamwar - SchematicSystem - 1.0 - https://maven.apache.org - pom - - - UTF-8 - ${project.basedir} - - - - clean package - - - org.apache.maven.plugins - maven-compiler-plugin - 3.6.1 - - 1.8 - 1.8 - -Xlint - - - - - - - SchematicSystem_8 - SchematicSystem_15 - SchematicSystem_Main - SchematicSystem_Core - - - - - steamwar - SpigotCore - 1.0 - system - ${main.basedir}/lib/SpigotCore.jar - - - org.projectlombok - lombok - 1.18.22 - provided - - - \ No newline at end of file diff --git a/settings.gradle b/settings.gradle new file mode 100644 index 0000000..29bc7e4 --- /dev/null +++ b/settings.gradle @@ -0,0 +1,24 @@ +/* + * This file is a part of the SteamWar software. + * + * Copyright (C) 2020 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 . + */ + +rootProject.name = 'SchematicSystem' + +include 'SchematicSystem_8' +include 'SchematicSystem_15' +include 'SchematicSystem_Core' diff --git a/steamwarci.yml b/steamwarci.yml index 7b6472d..d958c67 100644 --- a/steamwarci.yml +++ b/steamwarci.yml @@ -1,6 +1,7 @@ build: - "ln -s /home/gitea/lib" - - "mvn package -B" + - "cp ~/gradle.properties ." + - "./gradlew buildProject" artifacts: - "/binarys/schematicsystem.jar": "SchematicSystem_Main/target/schematicsystem.jar" + "/binarys/schematicsystem.jar": "build/libs/schematicsystem.jar"