From 6d2c974d65ad18cdb57691126cfcd692c8f674ed Mon Sep 17 00:00:00 2001 From: yoyosource Date: Wed, 5 May 2021 10:51:54 +0200 Subject: [PATCH 01/24] Add gradle support --- .gitignore | 18 +- SpigotCore_10/build.gradle | 56 ++++++ SpigotCore_10/pom.xml | 59 ------ SpigotCore_10/settings.gradle | 20 ++ SpigotCore_12/build.gradle | 56 ++++++ SpigotCore_12/pom.xml | 59 ------ SpigotCore_12/settings.gradle | 20 ++ SpigotCore_14/build.gradle | 55 ++++++ SpigotCore_14/pom.xml | 55 ------ SpigotCore_14/settings.gradle | 20 ++ SpigotCore_15/build.gradle | 56 ++++++ SpigotCore_15/pom.xml | 59 ------ SpigotCore_15/settings.gradle | 20 ++ SpigotCore_8/build.gradle | 55 ++++++ SpigotCore_8/pom.xml | 54 ------ SpigotCore_8/settings.gradle | 20 ++ SpigotCore_9/build.gradle | 56 ++++++ SpigotCore_9/pom.xml | 59 ------ SpigotCore_9/settings.gradle | 20 ++ SpigotCore_API/build.gradle | 52 +++++ SpigotCore_API/pom.xml | 32 ---- SpigotCore_API/settings.gradle | 20 ++ SpigotCore_Main/build.gradle | 69 +++++++ SpigotCore_Main/pom.xml | 128 ------------- SpigotCore_Main/settings.gradle | 20 ++ build.gradle | 230 +++++++++++++++++++++++ gradle.properties | 22 +++ gradle/wrapper/gradle-wrapper.jar | Bin 0 -> 58695 bytes gradle/wrapper/gradle-wrapper.properties | 6 + gradlew | 183 ++++++++++++++++++ gradlew.bat | 100 ++++++++++ ignoredlog | 2 + pom.xml | 43 ----- settings.gradle | 29 +++ 34 files changed, 1201 insertions(+), 552 deletions(-) create mode 100644 SpigotCore_10/build.gradle delete mode 100644 SpigotCore_10/pom.xml create mode 100644 SpigotCore_10/settings.gradle create mode 100644 SpigotCore_12/build.gradle delete mode 100644 SpigotCore_12/pom.xml create mode 100644 SpigotCore_12/settings.gradle create mode 100644 SpigotCore_14/build.gradle delete mode 100644 SpigotCore_14/pom.xml create mode 100644 SpigotCore_14/settings.gradle create mode 100644 SpigotCore_15/build.gradle delete mode 100644 SpigotCore_15/pom.xml create mode 100644 SpigotCore_15/settings.gradle create mode 100644 SpigotCore_8/build.gradle delete mode 100644 SpigotCore_8/pom.xml create mode 100644 SpigotCore_8/settings.gradle create mode 100644 SpigotCore_9/build.gradle delete mode 100644 SpigotCore_9/pom.xml create mode 100644 SpigotCore_9/settings.gradle create mode 100644 SpigotCore_API/build.gradle delete mode 100644 SpigotCore_API/pom.xml create mode 100644 SpigotCore_API/settings.gradle create mode 100644 SpigotCore_Main/build.gradle delete mode 100644 SpigotCore_Main/pom.xml create mode 100644 SpigotCore_Main/settings.gradle create mode 100644 build.gradle create mode 100644 gradle.properties create mode 100644 gradle/wrapper/gradle-wrapper.jar create mode 100644 gradle/wrapper/gradle-wrapper.properties create mode 100755 gradlew create mode 100644 gradlew.bat create mode 100644 ignoredlog delete mode 100644 pom.xml create mode 100644 settings.gradle 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/SpigotCore_10/build.gradle b/SpigotCore_10/build.gradle new file mode 100644 index 0000000..45f86b8 --- /dev/null +++ b/SpigotCore_10/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 { + implementation project(":SpigotCore_9") + implementation project(":SpigotCore_API") + + compileOnly 'org.projectlombok:lombok:1.18.6' + testCompileOnly 'org.projectlombok:lombok:1.18.6' + annotationProcessor 'org.projectlombok:lombok:1.18.6' + testAnnotationProcessor 'org.projectlombok:lombok:1.18.6' + + compileOnly files("${projectDir}/../lib/Spigot-1.10.jar") + compileOnly files("${projectDir}/../lib/WorldEdit-1.12.jar") +} diff --git a/SpigotCore_10/pom.xml b/SpigotCore_10/pom.xml deleted file mode 100644 index a04f9d3..0000000 --- a/SpigotCore_10/pom.xml +++ /dev/null @@ -1,59 +0,0 @@ - - - 4.0.0 - - - steamwar - SpigotCore - 2.0 - - - - ${project.basedir}/.. - - - SpigotCore_10 - 2.0 - - - src - - - src - - **/*.java - **/*.kt - - - - - - - - steamwar - Spigot - 1.10 - system - ${main.basedir}/lib/Spigot-1.10.jar - - - steamwar - WorldEdit - 1.12 - system - ${main.basedir}/lib/WorldEdit-1.12.jar - - - steamwar - SpigotCore_API - 2.0 - - - steamwar - SpigotCore_9 - 2.0 - - - diff --git a/SpigotCore_10/settings.gradle b/SpigotCore_10/settings.gradle new file mode 100644 index 0000000..13f4f4a --- /dev/null +++ b/SpigotCore_10/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 = 'SpigotCore_10' \ No newline at end of file diff --git a/SpigotCore_12/build.gradle b/SpigotCore_12/build.gradle new file mode 100644 index 0000000..47b4c75 --- /dev/null +++ b/SpigotCore_12/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 { + implementation project(":SpigotCore_8") + implementation project(":SpigotCore_API") + + compileOnly 'org.projectlombok:lombok:1.18.6' + testCompileOnly 'org.projectlombok:lombok:1.18.6' + annotationProcessor 'org.projectlombok:lombok:1.18.6' + testAnnotationProcessor 'org.projectlombok:lombok:1.18.6' + + compileOnly files("${projectDir}/../lib/Spigot-1.12.jar") + compileOnly files("${projectDir}/../lib/WorldEdit-1.12.jar") +} diff --git a/SpigotCore_12/pom.xml b/SpigotCore_12/pom.xml deleted file mode 100644 index c91c885..0000000 --- a/SpigotCore_12/pom.xml +++ /dev/null @@ -1,59 +0,0 @@ - - - 4.0.0 - - - steamwar - SpigotCore - 2.0 - - - - ${project.basedir}/.. - - - SpigotCore_12 - 2.0 - - - src - - - src - - **/*.java - **/*.kt - - - - - - - - steamwar - Spigot - 1.12 - system - ${main.basedir}/lib/Spigot-1.12.jar - - - steamwar - WorldEdit - 1.12 - system - ${main.basedir}/lib/WorldEdit-1.12.jar - - - steamwar - SpigotCore_API - 2.0 - - - steamwar - SpigotCore_8 - 2.0 - - - \ No newline at end of file diff --git a/SpigotCore_12/settings.gradle b/SpigotCore_12/settings.gradle new file mode 100644 index 0000000..079bf5a --- /dev/null +++ b/SpigotCore_12/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 = 'SpigotCore_12' \ No newline at end of file diff --git a/SpigotCore_14/build.gradle b/SpigotCore_14/build.gradle new file mode 100644 index 0000000..3576bd0 --- /dev/null +++ b/SpigotCore_14/build.gradle @@ -0,0 +1,55 @@ +/* + * 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 { + implementation project(":SpigotCore_API") + + compileOnly 'org.projectlombok:lombok:1.18.6' + testCompileOnly 'org.projectlombok:lombok:1.18.6' + annotationProcessor 'org.projectlombok:lombok:1.18.6' + testAnnotationProcessor 'org.projectlombok:lombok:1.18.6' + + compileOnly files("${projectDir}/../lib/Spigot-1.14.jar") + compileOnly files("${projectDir}/../lib/WorldEdit-1.15.jar") +} diff --git a/SpigotCore_14/pom.xml b/SpigotCore_14/pom.xml deleted file mode 100644 index 724d006..0000000 --- a/SpigotCore_14/pom.xml +++ /dev/null @@ -1,55 +0,0 @@ - - - 4.0.0 - - - steamwar - SpigotCore - 2.0 - - - - ${project.basedir}/.. - - - SpigotCore_14 - 2.0 - - - src - - - src - - **/*.java - **/*.kt - - - - - - - - steamwar - Spigot - 1.14 - system - ${main.basedir}/lib/Spigot-1.14.jar - - - steamwar - WorldEdit - 1.15 - system - ${main.basedir}/lib/WorldEdit-1.15.jar - - - steamwar - SpigotCore_API - 2.0 - compile - - - \ No newline at end of file diff --git a/SpigotCore_14/settings.gradle b/SpigotCore_14/settings.gradle new file mode 100644 index 0000000..4a8abac --- /dev/null +++ b/SpigotCore_14/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 = 'SpigotCore_14' \ No newline at end of file diff --git a/SpigotCore_15/build.gradle b/SpigotCore_15/build.gradle new file mode 100644 index 0000000..6c9dfd8 --- /dev/null +++ b/SpigotCore_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 { + implementation project(":SpigotCore_14") + implementation project(":SpigotCore_API") + + compileOnly 'org.projectlombok:lombok:1.18.6' + testCompileOnly 'org.projectlombok:lombok:1.18.6' + annotationProcessor 'org.projectlombok:lombok:1.18.6' + testAnnotationProcessor 'org.projectlombok:lombok:1.18.6' + + compileOnly files("${projectDir}/../lib/Spigot-1.15.jar") + compileOnly files("${projectDir}/../lib/WorldEdit-1.15.jar") +} diff --git a/SpigotCore_15/pom.xml b/SpigotCore_15/pom.xml deleted file mode 100644 index a7ecfbd..0000000 --- a/SpigotCore_15/pom.xml +++ /dev/null @@ -1,59 +0,0 @@ - - - 4.0.0 - - - steamwar - SpigotCore - 2.0 - - - - ${project.basedir}/.. - - - SpigotCore_15 - 2.0 - - - 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 - - - steamwar - SpigotCore_API - 2.0 - - - steamwar - SpigotCore_14 - 2.0 - - - \ No newline at end of file diff --git a/SpigotCore_15/settings.gradle b/SpigotCore_15/settings.gradle new file mode 100644 index 0000000..a861db0 --- /dev/null +++ b/SpigotCore_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 = 'SpigotCore_15' \ No newline at end of file diff --git a/SpigotCore_8/build.gradle b/SpigotCore_8/build.gradle new file mode 100644 index 0000000..f882aca --- /dev/null +++ b/SpigotCore_8/build.gradle @@ -0,0 +1,55 @@ +/* + * 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 { + implementation project(":SpigotCore_API") + + compileOnly 'org.projectlombok:lombok:1.18.6' + testCompileOnly 'org.projectlombok:lombok:1.18.6' + annotationProcessor 'org.projectlombok:lombok:1.18.6' + testAnnotationProcessor 'org.projectlombok:lombok:1.18.6' + + compileOnly files("${projectDir}/../lib/Spigot-1.8.jar") + compileOnly files("${projectDir}/../lib/WorldEdit-1.12.jar") +} diff --git a/SpigotCore_8/pom.xml b/SpigotCore_8/pom.xml deleted file mode 100644 index 0e05af5..0000000 --- a/SpigotCore_8/pom.xml +++ /dev/null @@ -1,54 +0,0 @@ - - - 4.0.0 - - - steamwar - SpigotCore - 2.0 - - - - ${project.basedir}/.. - - - SpigotCore_8 - 2.0 - - - 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 - SpigotCore_API - 2.0 - - - \ No newline at end of file diff --git a/SpigotCore_8/settings.gradle b/SpigotCore_8/settings.gradle new file mode 100644 index 0000000..e4a8e0a --- /dev/null +++ b/SpigotCore_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 = 'SpigotCore_8' \ No newline at end of file diff --git a/SpigotCore_9/build.gradle b/SpigotCore_9/build.gradle new file mode 100644 index 0000000..e1203cd --- /dev/null +++ b/SpigotCore_9/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 { + implementation project(":SpigotCore_8") + implementation project(":SpigotCore_API") + + compileOnly 'org.projectlombok:lombok:1.18.6' + testCompileOnly 'org.projectlombok:lombok:1.18.6' + annotationProcessor 'org.projectlombok:lombok:1.18.6' + testAnnotationProcessor 'org.projectlombok:lombok:1.18.6' + + compileOnly files("${projectDir}/../lib/Spigot-1.9.jar") + compileOnly files("${projectDir}/../lib/WorldEdit-1.12.jar") +} diff --git a/SpigotCore_9/pom.xml b/SpigotCore_9/pom.xml deleted file mode 100644 index 2b9cb04..0000000 --- a/SpigotCore_9/pom.xml +++ /dev/null @@ -1,59 +0,0 @@ - - - 4.0.0 - - - steamwar - SpigotCore - 2.0 - - - - ${project.basedir}/.. - - - SpigotCore_9 - 2.0 - - - src - - - src - - **/*.java - **/*.kt - - - - - - - - steamwar - Spigot - 1.9 - system - ${main.basedir}/lib/Spigot-1.9.jar - - - steamwar - WorldEdit - 1.12 - system - ${main.basedir}/lib/WorldEdit-1.12.jar - - - steamwar - SpigotCore_API - 2.0 - - - steamwar - SpigotCore_8 - 2.0 - - - \ No newline at end of file diff --git a/SpigotCore_9/settings.gradle b/SpigotCore_9/settings.gradle new file mode 100644 index 0000000..c55656e --- /dev/null +++ b/SpigotCore_9/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 = 'SpigotCore_9' \ No newline at end of file diff --git a/SpigotCore_API/build.gradle b/SpigotCore_API/build.gradle new file mode 100644 index 0000000..c8ee702 --- /dev/null +++ b/SpigotCore_API/build.gradle @@ -0,0 +1,52 @@ +/* + * 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 . + */ + +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.6' + testCompileOnly 'org.projectlombok:lombok:1.18.6' + annotationProcessor 'org.projectlombok:lombok:1.18.6' + testAnnotationProcessor 'org.projectlombok:lombok:1.18.6' + + compileOnly files("${projectDir}/../lib/Spigot-1.15.jar") +} \ No newline at end of file diff --git a/SpigotCore_API/pom.xml b/SpigotCore_API/pom.xml deleted file mode 100644 index 3d316be..0000000 --- a/SpigotCore_API/pom.xml +++ /dev/null @@ -1,32 +0,0 @@ - - - 4.0.0 - - - steamwar - SpigotCore - 2.0 - - - - ${project.basedir}/.. - - - SpigotCore_API - 2.0 - - - src - - - src - - **/*.java - **/*.kt - - - - - \ No newline at end of file diff --git a/SpigotCore_API/settings.gradle b/SpigotCore_API/settings.gradle new file mode 100644 index 0000000..ada3e44 --- /dev/null +++ b/SpigotCore_API/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 = 'SpigotCore_API' \ No newline at end of file diff --git a/SpigotCore_Main/build.gradle b/SpigotCore_Main/build.gradle new file mode 100644 index 0000000..7114e44 --- /dev/null +++ b/SpigotCore_Main/build.gradle @@ -0,0 +1,69 @@ +/* + * 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 { + implementation project(":SpigotCore_8") + implementation project(":SpigotCore_9") + implementation project(":SpigotCore_10") + implementation project(":SpigotCore_12") + implementation project(":SpigotCore_14") + implementation project(":SpigotCore_15") + implementation project(":SpigotCore_API") + + compileOnly 'org.projectlombok:lombok:1.18.6' + testCompileOnly 'org.projectlombok:lombok:1.18.6' + annotationProcessor 'org.projectlombok:lombok:1.18.6' + testAnnotationProcessor 'org.projectlombok:lombok:1.18.6' + + compileOnly files("${projectDir}/../lib/Spigot-1.15.jar") + compileOnly files("${projectDir}/../lib/WorldEdit-1.12.jar") + compileOnly files("${projectDir}/../lib/ProtocolLib.jar") + compileOnly 'net.wesjd:anvilgui:1.4.0-SNAPSHOT' +} + +processResources { + from("build/classes/java/main/META-INF/annotations/") { + into("de.steamwar.bausystem") + } +} diff --git a/SpigotCore_Main/pom.xml b/SpigotCore_Main/pom.xml deleted file mode 100644 index 0d23f6f..0000000 --- a/SpigotCore_Main/pom.xml +++ /dev/null @@ -1,128 +0,0 @@ - - - 4.0.0 - - - steamwar - SpigotCore - 2.0 - - - - ${project.basedir}/.. - - - - - codemc-snapshots - https://repo.codemc.io/repository/maven-snapshots/ - - - - SpigotCore_Main - 2.0 - jar - - - src - - - src - - **/*.java - **/*.kt - - - - - - org.apache.maven.plugins - maven-shade-plugin - 3.2.1 - - - package - - shade - - - - - - spigotcore - - - - - steamwar - Spigot - 1.15 - system - ${main.basedir}/lib/Spigot-1.15.jar - - - steamwar - WorldEdit - 1.12 - system - ${main.basedir}/lib/WorldEdit-1.12.jar - - - steamwar - ProtocolLib - 1.0 - system - ${main.basedir}/lib/ProtocolLib.jar - - - net.wesjd - anvilgui - 1.4.0-SNAPSHOT - compile - - - steamwar - SpigotCore_API - 2.0 - compile - - - steamwar - SpigotCore_8 - 2.0 - compile - - - steamwar - SpigotCore_9 - 2.0 - compile - - - steamwar - SpigotCore_10 - 2.0 - compile - - - steamwar - SpigotCore_12 - 2.0 - compile - - - steamwar - SpigotCore_14 - 2.0 - compile - - - steamwar - SpigotCore_15 - 2.0 - compile - - - \ No newline at end of file diff --git a/SpigotCore_Main/settings.gradle b/SpigotCore_Main/settings.gradle new file mode 100644 index 0000000..2d1bf48 --- /dev/null +++ b/SpigotCore_Main/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 = 'SpigotCore_Main' \ No newline at end of file diff --git a/build.gradle b/build.gradle new file mode 100644 index 0000000..4de1369 --- /dev/null +++ b/build.gradle @@ -0,0 +1,230 @@ +/* + * 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 = 'SpigotCore' + artifactName = 'bausystem' + + 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' + +sourceCompatibility = 1.8 +targetCompatibility = 1.8 + +mainClassName = '' + +allprojects { + repositories { + mavenCentral() + jcenter() + + maven { + url = uri("https://repo.codemc.io/repository/maven-snapshots/") + } + } +} + +dependencies { + implementation project(":SpigotCore_Main") +} + +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 (!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 0000000000000000000000000000000000000000..f3d88b1c2faf2fc91d853cd5d4242b5547257070 GIT binary patch literal 58695 zcma&OV~}Oh(k5J8>Mq;vvTfV8ZQE5{wr$(iDciPf+tV}m-if*I+;_h3N1nY;M6TF7 zBc7A_WUgl&IY|&uNFbnJzkq;%`2QLZ5b*!{1OkHidzBVe;-?mu5upVElKVGD>pC88 zzP}E3wRHBgaO?2nzdZ5pL;m-xf&RU>buj(E-s=DK zf%>P9se`_emGS@673tqyT^;o8?2H}$uO&&u^TlmHfPgSSfPiTK^AZ7DTPH`Szw4#- z&21E&^c|dx9f;^@46XDX9itS+ZRYuqx#wG*>5Bs&gxwSQbj8grds#xkl;ikls1%(2 zR-`Tn(#9}E_aQ!zu~_iyc0gXp2I`O?erY?=JK{M`Ew(*RP3vy^0=b2E0^PSZgm(P6 z+U<&w#)I=>0z=IC4 zh4Q;eq94OGttUh7AGWu7m){;^Qk*5F6eTn+Ky$x>9Ntl~n0KDzFmB0lBI6?o!({iX zQt=|-9TPjAmCP!eA{r|^71cIvI(1#UCSzPw(L2>8OG0O_RQeJ{{MG)tLQ*aSX{AMS zP-;|nj+9{J&c9UV5Ww|#OE*Ah6?9WaR?B04N|#`m0G-IqwdN~Z{8)!$@UsK>l9H81 z?z`Z@`dWZEvuABvItgYLk-FA(u-$4mfW@2(Eh(9fe`5?WUda#wQa54 z3dXE&-*@lsrR~U#4NqkGM7Yu4#pfGqAmxmGr&Ep?&MwQ9?Z*twtODbi;vK|nQ~d_N z;T5Gtj_HZKu&oTfqQ~i`K!L||U1U=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apper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000..099d7b2 --- /dev/null +++ b/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,6 @@ +#Wed May 05 10:45:33 CEST 2021 +distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.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/ignoredlog b/ignoredlog new file mode 100644 index 0000000..b28379b --- /dev/null +++ b/ignoredlog @@ -0,0 +1,2 @@ +SteamWar? Unbekannter Befehl. +moved too quickly! \ No newline at end of file diff --git a/pom.xml b/pom.xml deleted file mode 100644 index 43dabfc..0000000 --- a/pom.xml +++ /dev/null @@ -1,43 +0,0 @@ - - - 4.0.0 - - steamwar - SpigotCore - 2.0 - pom - https://maven.apache.org - - - UTF-8 - ${project.basedir} - - - - - - org.apache.maven.plugins - maven-compiler-plugin - 3.6.1 - - 1.8 - 1.8 - - - - ${project.name} - - - - SpigotCore_API - SpigotCore_8 - SpigotCore_9 - SpigotCore_10 - SpigotCore_12 - SpigotCore_14 - SpigotCore_15 - SpigotCore_Main - - \ No newline at end of file diff --git a/settings.gradle b/settings.gradle new file mode 100644 index 0000000..bba0961 --- /dev/null +++ b/settings.gradle @@ -0,0 +1,29 @@ +/* + * 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 = 'SpigotCore' + +include 'SpigotCore_Main' +include 'SpigotCore_API' +include 'SpigotCore_15' +include 'SpigotCore_14' +include 'SpigotCore_12' +include 'SpigotCore_10' +include 'SpigotCore_9' +include 'SpigotCore_8' From 805acfbc1c3269aa43aca38e9e9345789a71e374 Mon Sep 17 00:00:00 2001 From: yoyosource Date: Fri, 7 May 2021 09:18:40 +0200 Subject: [PATCH 02/24] Fix build.gradle --- SpigotCore_10/build.gradle | 4 ++-- SpigotCore_12/build.gradle | 4 ++-- SpigotCore_14/build.gradle | 4 ++-- SpigotCore_15/build.gradle | 4 ++-- SpigotCore_8/build.gradle | 4 ++-- SpigotCore_9/build.gradle | 4 ++-- SpigotCore_API/build.gradle | 2 +- SpigotCore_Main/build.gradle | 6 +++--- 8 files changed, 16 insertions(+), 16 deletions(-) diff --git a/SpigotCore_10/build.gradle b/SpigotCore_10/build.gradle index 45f86b8..5ce5602 100644 --- a/SpigotCore_10/build.gradle +++ b/SpigotCore_10/build.gradle @@ -51,6 +51,6 @@ dependencies { annotationProcessor 'org.projectlombok:lombok:1.18.6' testAnnotationProcessor 'org.projectlombok:lombok:1.18.6' - compileOnly files("${projectDir}/../lib/Spigot-1.10.jar") - compileOnly files("${projectDir}/../lib/WorldEdit-1.12.jar") + compileOnly files("${project.rootDir}/lib/Spigot-1.10.jar") + compileOnly files("${project.rootDir}/lib/WorldEdit-1.12.jar") } diff --git a/SpigotCore_12/build.gradle b/SpigotCore_12/build.gradle index 47b4c75..a455a07 100644 --- a/SpigotCore_12/build.gradle +++ b/SpigotCore_12/build.gradle @@ -51,6 +51,6 @@ dependencies { annotationProcessor 'org.projectlombok:lombok:1.18.6' testAnnotationProcessor 'org.projectlombok:lombok:1.18.6' - compileOnly files("${projectDir}/../lib/Spigot-1.12.jar") - compileOnly files("${projectDir}/../lib/WorldEdit-1.12.jar") + compileOnly files("${project.rootDir}/lib/Spigot-1.12.jar") + compileOnly files("${project.rootDir}/lib/WorldEdit-1.12.jar") } diff --git a/SpigotCore_14/build.gradle b/SpigotCore_14/build.gradle index 3576bd0..522e351 100644 --- a/SpigotCore_14/build.gradle +++ b/SpigotCore_14/build.gradle @@ -50,6 +50,6 @@ dependencies { annotationProcessor 'org.projectlombok:lombok:1.18.6' testAnnotationProcessor 'org.projectlombok:lombok:1.18.6' - compileOnly files("${projectDir}/../lib/Spigot-1.14.jar") - compileOnly files("${projectDir}/../lib/WorldEdit-1.15.jar") + compileOnly files("${project.rootDir}/lib/Spigot-1.14.jar") + compileOnly files("${project.rootDir}/lib/WorldEdit-1.15.jar") } diff --git a/SpigotCore_15/build.gradle b/SpigotCore_15/build.gradle index 6c9dfd8..7cf4806 100644 --- a/SpigotCore_15/build.gradle +++ b/SpigotCore_15/build.gradle @@ -51,6 +51,6 @@ dependencies { annotationProcessor 'org.projectlombok:lombok:1.18.6' testAnnotationProcessor 'org.projectlombok:lombok:1.18.6' - compileOnly files("${projectDir}/../lib/Spigot-1.15.jar") - compileOnly files("${projectDir}/../lib/WorldEdit-1.15.jar") + compileOnly files("${project.rootDir}/lib/Spigot-1.15.jar") + compileOnly files("${project.rootDir}/lib/WorldEdit-1.15.jar") } diff --git a/SpigotCore_8/build.gradle b/SpigotCore_8/build.gradle index f882aca..cb5ff47 100644 --- a/SpigotCore_8/build.gradle +++ b/SpigotCore_8/build.gradle @@ -50,6 +50,6 @@ dependencies { annotationProcessor 'org.projectlombok:lombok:1.18.6' testAnnotationProcessor 'org.projectlombok:lombok:1.18.6' - compileOnly files("${projectDir}/../lib/Spigot-1.8.jar") - compileOnly files("${projectDir}/../lib/WorldEdit-1.12.jar") + compileOnly files("${project.rootDir}/lib/Spigot-1.8.jar") + compileOnly files("${project.rootDir}/lib/WorldEdit-1.12.jar") } diff --git a/SpigotCore_9/build.gradle b/SpigotCore_9/build.gradle index e1203cd..a6ea4c5 100644 --- a/SpigotCore_9/build.gradle +++ b/SpigotCore_9/build.gradle @@ -51,6 +51,6 @@ dependencies { annotationProcessor 'org.projectlombok:lombok:1.18.6' testAnnotationProcessor 'org.projectlombok:lombok:1.18.6' - compileOnly files("${projectDir}/../lib/Spigot-1.9.jar") - compileOnly files("${projectDir}/../lib/WorldEdit-1.12.jar") + compileOnly files("${project.rootDir}/lib/Spigot-1.9.jar") + compileOnly files("${project.rootDir}/lib/WorldEdit-1.12.jar") } diff --git a/SpigotCore_API/build.gradle b/SpigotCore_API/build.gradle index c8ee702..f2bf8a1 100644 --- a/SpigotCore_API/build.gradle +++ b/SpigotCore_API/build.gradle @@ -48,5 +48,5 @@ dependencies { annotationProcessor 'org.projectlombok:lombok:1.18.6' testAnnotationProcessor 'org.projectlombok:lombok:1.18.6' - compileOnly files("${projectDir}/../lib/Spigot-1.15.jar") + compileOnly files("${project.rootDir}/lib/Spigot-1.15.jar") } \ No newline at end of file diff --git a/SpigotCore_Main/build.gradle b/SpigotCore_Main/build.gradle index 7114e44..78a10e1 100644 --- a/SpigotCore_Main/build.gradle +++ b/SpigotCore_Main/build.gradle @@ -56,9 +56,9 @@ dependencies { annotationProcessor 'org.projectlombok:lombok:1.18.6' testAnnotationProcessor 'org.projectlombok:lombok:1.18.6' - compileOnly files("${projectDir}/../lib/Spigot-1.15.jar") - compileOnly files("${projectDir}/../lib/WorldEdit-1.12.jar") - compileOnly files("${projectDir}/../lib/ProtocolLib.jar") + compileOnly files("${project.rootDir}/lib/Spigot-1.15.jar") + compileOnly files("${project.rootDir}/lib/WorldEdit-1.12.jar") + compileOnly files("${project.rootDir}/lib/ProtocolLib.jar") compileOnly 'net.wesjd:anvilgui:1.4.0-SNAPSHOT' } From 760ae5c948951915fefbb025aa2b892458d31db1 Mon Sep 17 00:00:00 2001 From: yoyosource Date: Tue, 24 Aug 2021 09:25:52 +0200 Subject: [PATCH 03/24] Fix build.gradle --- build.gradle | 2 +- gradle.properties | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/build.gradle b/build.gradle index 4de1369..a310072 100644 --- a/build.gradle +++ b/build.gradle @@ -46,7 +46,7 @@ if (file("steamwar.properties").exists()) { ext { buildName = 'SpigotCore' - artifactName = 'bausystem' + artifactName = 'spigotcore' uberJarName = "${buildName}-all.jar" jarName = "${artifactName}.jar" diff --git a/gradle.properties b/gradle.properties index dc56501..1a2c8f1 100644 --- a/gradle.properties +++ b/gradle.properties @@ -19,4 +19,4 @@ org.gradle.daemon = true org.gradle.parallel = true -org.gradle.workers.max = 4 \ No newline at end of file +org.gradle.workers.max = 1 \ No newline at end of file From a9ed7441f15036e1d385e7dd71fa35ffd7b11967 Mon Sep 17 00:00:00 2001 From: Lixfel Date: Sat, 11 Sep 2021 01:24:55 +0200 Subject: [PATCH 04/24] ProtocolLib -> TinyProtocol, New Version Dependent --- SpigotCore_10/build.gradle | 4 +- .../CraftbukkitWrapper10.java} | 19 +- .../src/de/steamwar/core/SpigotTPS_10.java | 32 -- SpigotCore_12/build.gradle | 4 +- .../CraftbukkitWrapper12.java} | 19 +- .../src/de/steamwar/core/SpigotTPS_12.java | 32 -- .../WorldOfColorWrapper12.java} | 8 +- SpigotCore_14/build.gradle | 2 +- .../CraftbukkitWrapper14.java} | 19 +- .../FlatteningWrapper14.java} | 285 +++++++++- .../src/de/steamwar/core/SpigotTPS_14.java | 32 -- .../src/de/steamwar/inventory/SWItem_14.java | 278 ---------- SpigotCore_15/build.gradle | 4 +- .../CraftbukkitWrapper15.java} | 19 +- .../src/de/steamwar/core/SpigotTPS_15.java | 32 -- SpigotCore_8/build.gradle | 2 +- .../BountifulWrapper8.java} | 7 +- .../CraftbukkitWrapper8.java} | 18 +- .../FlatteningWrapper8.java} | 61 ++- .../IDConverter8.java} | 8 +- .../src/de/steamwar/core/SpigotTPS_8.java | 32 -- .../WorldOfColorWrapper8.java} | 8 +- SpigotCore_9/build.gradle | 4 +- .../BountifulWrapper9.java} | 7 +- .../CraftbukkitWrapper9.java} | 19 +- .../src/de/steamwar/core/SpigotTPS_9.java | 32 -- SpigotCore_API/build.gradle | 52 -- SpigotCore_API/settings.gradle | 20 - SpigotCore_Main/build.gradle | 9 - .../comphenix/tinyprotocol/Reflection.java | 411 ++++++++++++++ .../comphenix/tinyprotocol/TinyProtocol.java | 509 ++++++++++++++++++ .../steamwar/authlib/AuthlibInjector_15.java | 0 .../src/de/steamwar/comms/BungeeReceiver.java | 8 +- .../de/steamwar/core/BountifulWrapper.java | 32 ++ .../de/steamwar/core/CraftbukkitWrapper.java | 33 ++ .../de/steamwar/core/FlatteningWrapper.java | 44 +- .../src/de/steamwar/core/TPSWatcher.java | 7 +- .../de/steamwar/core/VersionDependent.java | 46 ++ .../de/steamwar/core/VersionedCallable.java | 1 + .../de/steamwar/core/VersionedRunnable.java | 1 + .../de/steamwar/core/WorldOfColorWrapper.java | 34 ++ .../steamwar/core/events/ChunkListener.java | 79 ++- .../src/de/steamwar/inventory/SWItem.java | 11 +- .../src/de/steamwar/message/Message.java | 5 +- .../de/steamwar/scoreboard/SWScoreboard.java | 118 ++-- .../scoreboard/ScoreboardCallback.java | 0 .../de/steamwar/sql/NoClipboardException.java | 0 .../src/de/steamwar/sql/Schematic.java | 33 +- SpigotCore_Main/src/plugin.yml | 2 - build.gradle | 6 + 50 files changed, 1630 insertions(+), 818 deletions(-) rename SpigotCore_10/src/de/steamwar/{chunk/Chunk_10.java => core/CraftbukkitWrapper10.java} (74%) delete mode 100644 SpigotCore_10/src/de/steamwar/core/SpigotTPS_10.java rename SpigotCore_12/src/de/steamwar/{chunk/Chunk_12.java => core/CraftbukkitWrapper12.java} (74%) delete mode 100644 SpigotCore_12/src/de/steamwar/core/SpigotTPS_12.java rename SpigotCore_12/src/de/steamwar/{message/Message_12.java => core/WorldOfColorWrapper12.java} (84%) rename SpigotCore_14/src/de/steamwar/{chunk/Chunk_14.java => core/CraftbukkitWrapper14.java} (74%) rename SpigotCore_14/src/de/steamwar/{sql/Schematic_14.java => core/FlatteningWrapper14.java} (63%) delete mode 100644 SpigotCore_14/src/de/steamwar/core/SpigotTPS_14.java delete mode 100644 SpigotCore_14/src/de/steamwar/inventory/SWItem_14.java rename SpigotCore_15/src/de/steamwar/{chunk/Chunk_15.java => core/CraftbukkitWrapper15.java} (74%) delete mode 100644 SpigotCore_15/src/de/steamwar/core/SpigotTPS_15.java rename SpigotCore_8/src/de/steamwar/{comms/BungeeReceiver_8.java => core/BountifulWrapper8.java} (85%) rename SpigotCore_8/src/de/steamwar/{chunk/Chunk_8.java => core/CraftbukkitWrapper8.java} (76%) rename SpigotCore_8/src/de/steamwar/{sql/Schematic_8.java => core/FlatteningWrapper8.java} (87%) rename SpigotCore_8/src/de/steamwar/{sql/IDConverter.java => core/IDConverter8.java} (90%) delete mode 100644 SpigotCore_8/src/de/steamwar/core/SpigotTPS_8.java rename SpigotCore_8/src/de/steamwar/{message/Message_8.java => core/WorldOfColorWrapper8.java} (84%) rename SpigotCore_9/src/de/steamwar/{comms/BungeeReceiver_9.java => core/BountifulWrapper9.java} (85%) rename SpigotCore_9/src/de/steamwar/{chunk/Chunk_9.java => core/CraftbukkitWrapper9.java} (74%) delete mode 100644 SpigotCore_9/src/de/steamwar/core/SpigotTPS_9.java delete mode 100644 SpigotCore_API/build.gradle delete mode 100644 SpigotCore_API/settings.gradle create mode 100644 SpigotCore_Main/src/com/comphenix/tinyprotocol/Reflection.java create mode 100644 SpigotCore_Main/src/com/comphenix/tinyprotocol/TinyProtocol.java rename {SpigotCore_15 => SpigotCore_Main}/src/de/steamwar/authlib/AuthlibInjector_15.java (100%) create mode 100644 SpigotCore_Main/src/de/steamwar/core/BountifulWrapper.java create mode 100644 SpigotCore_Main/src/de/steamwar/core/CraftbukkitWrapper.java rename SpigotCore_8/src/de/steamwar/inventory/SWItem_8.java => SpigotCore_Main/src/de/steamwar/core/FlatteningWrapper.java (50%) create mode 100644 SpigotCore_Main/src/de/steamwar/core/VersionDependent.java create mode 100644 SpigotCore_Main/src/de/steamwar/core/WorldOfColorWrapper.java rename {SpigotCore_API => SpigotCore_Main}/src/de/steamwar/scoreboard/ScoreboardCallback.java (100%) rename {SpigotCore_API => SpigotCore_Main}/src/de/steamwar/sql/NoClipboardException.java (100%) diff --git a/SpigotCore_10/build.gradle b/SpigotCore_10/build.gradle index 5ce5602..bd21efa 100644 --- a/SpigotCore_10/build.gradle +++ b/SpigotCore_10/build.gradle @@ -43,8 +43,7 @@ sourceSets { } dependencies { - implementation project(":SpigotCore_9") - implementation project(":SpigotCore_API") + implementation project(":SpigotCore_Main") compileOnly 'org.projectlombok:lombok:1.18.6' testCompileOnly 'org.projectlombok:lombok:1.18.6' @@ -52,5 +51,4 @@ dependencies { testAnnotationProcessor 'org.projectlombok:lombok:1.18.6' compileOnly files("${project.rootDir}/lib/Spigot-1.10.jar") - compileOnly files("${project.rootDir}/lib/WorldEdit-1.12.jar") } diff --git a/SpigotCore_10/src/de/steamwar/chunk/Chunk_10.java b/SpigotCore_10/src/de/steamwar/core/CraftbukkitWrapper10.java similarity index 74% rename from SpigotCore_10/src/de/steamwar/chunk/Chunk_10.java rename to SpigotCore_10/src/de/steamwar/core/CraftbukkitWrapper10.java index 4f59621..8916735 100644 --- a/SpigotCore_10/src/de/steamwar/chunk/Chunk_10.java +++ b/SpigotCore_10/src/de/steamwar/core/CraftbukkitWrapper10.java @@ -1,6 +1,6 @@ -/* +/* 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 @@ -17,17 +17,24 @@ along with this program. If not, see . */ -package de.steamwar.chunk; +package de.steamwar.core; +import net.minecraft.server.v1_10_R1.MinecraftServer; import net.minecraft.server.v1_10_R1.PacketPlayOutMapChunk; import org.bukkit.craftbukkit.v1_10_R1.CraftChunk; import org.bukkit.craftbukkit.v1_10_R1.entity.CraftPlayer; import org.bukkit.entity.Player; -public class Chunk_10 { - private Chunk_10(){} +public class CraftbukkitWrapper10 implements CraftbukkitWrapper.ICraftbukkitWrapper { - public static void sendChunk(Player p, int chunkX, int chunkZ){ + @Override + public void sendChunk(Player p, int chunkX, int chunkZ) { ((CraftPlayer)p).getHandle().playerConnection.sendPacket(new PacketPlayOutMapChunk(((CraftChunk)p.getWorld().getChunkAt(chunkX, chunkZ)).getHandle(), 65535)); } + + @SuppressWarnings("deprecation") + @Override + public double[] getSpigotTPS() { + return MinecraftServer.getServer().recentTps; + } } diff --git a/SpigotCore_10/src/de/steamwar/core/SpigotTPS_10.java b/SpigotCore_10/src/de/steamwar/core/SpigotTPS_10.java deleted file mode 100644 index 2cc2d26..0000000 --- a/SpigotCore_10/src/de/steamwar/core/SpigotTPS_10.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - 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 . -*/ - -package de.steamwar.core; - -import net.minecraft.server.v1_10_R1.MinecraftServer; - -public class SpigotTPS_10 { - - private SpigotTPS_10(){} - - static double[] getTps(){ - return MinecraftServer.getServer().recentTps; - } - -} diff --git a/SpigotCore_12/build.gradle b/SpigotCore_12/build.gradle index a455a07..48c917b 100644 --- a/SpigotCore_12/build.gradle +++ b/SpigotCore_12/build.gradle @@ -43,8 +43,7 @@ sourceSets { } dependencies { - implementation project(":SpigotCore_8") - implementation project(":SpigotCore_API") + implementation project(":SpigotCore_Main") compileOnly 'org.projectlombok:lombok:1.18.6' testCompileOnly 'org.projectlombok:lombok:1.18.6' @@ -52,5 +51,4 @@ dependencies { testAnnotationProcessor 'org.projectlombok:lombok:1.18.6' compileOnly files("${project.rootDir}/lib/Spigot-1.12.jar") - compileOnly files("${project.rootDir}/lib/WorldEdit-1.12.jar") } diff --git a/SpigotCore_12/src/de/steamwar/chunk/Chunk_12.java b/SpigotCore_12/src/de/steamwar/core/CraftbukkitWrapper12.java similarity index 74% rename from SpigotCore_12/src/de/steamwar/chunk/Chunk_12.java rename to SpigotCore_12/src/de/steamwar/core/CraftbukkitWrapper12.java index 8944a1f..3d084b3 100644 --- a/SpigotCore_12/src/de/steamwar/chunk/Chunk_12.java +++ b/SpigotCore_12/src/de/steamwar/core/CraftbukkitWrapper12.java @@ -1,6 +1,6 @@ -/* +/* 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 @@ -17,17 +17,24 @@ along with this program. If not, see . */ -package de.steamwar.chunk; +package de.steamwar.core; +import net.minecraft.server.v1_12_R1.MinecraftServer; import net.minecraft.server.v1_12_R1.PacketPlayOutMapChunk; import org.bukkit.craftbukkit.v1_12_R1.CraftChunk; import org.bukkit.craftbukkit.v1_12_R1.entity.CraftPlayer; import org.bukkit.entity.Player; -public class Chunk_12 { - private Chunk_12(){} +public class CraftbukkitWrapper12 implements CraftbukkitWrapper.ICraftbukkitWrapper { - public static void sendChunk(Player p, int chunkX, int chunkZ){ + @Override + public void sendChunk(Player p, int chunkX, int chunkZ) { ((CraftPlayer)p).getHandle().playerConnection.sendPacket(new PacketPlayOutMapChunk(((CraftChunk)p.getWorld().getChunkAt(chunkX, chunkZ)).getHandle(), 65535)); } + + @SuppressWarnings("deprecation") + @Override + public double[] getSpigotTPS() { + return MinecraftServer.getServer().recentTps; + } } diff --git a/SpigotCore_12/src/de/steamwar/core/SpigotTPS_12.java b/SpigotCore_12/src/de/steamwar/core/SpigotTPS_12.java deleted file mode 100644 index 17541c7..0000000 --- a/SpigotCore_12/src/de/steamwar/core/SpigotTPS_12.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - 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 . -*/ - -package de.steamwar.core; - -import net.minecraft.server.v1_12_R1.MinecraftServer; - -public class SpigotTPS_12 { - - private SpigotTPS_12(){} - - static double[] getTps(){ - return MinecraftServer.getServer().recentTps; - } - -} diff --git a/SpigotCore_12/src/de/steamwar/message/Message_12.java b/SpigotCore_12/src/de/steamwar/core/WorldOfColorWrapper12.java similarity index 84% rename from SpigotCore_12/src/de/steamwar/message/Message_12.java rename to SpigotCore_12/src/de/steamwar/core/WorldOfColorWrapper12.java index a228394..f6c5050 100644 --- a/SpigotCore_12/src/de/steamwar/message/Message_12.java +++ b/SpigotCore_12/src/de/steamwar/core/WorldOfColorWrapper12.java @@ -17,16 +17,16 @@ along with this program. If not, see . */ -package de.steamwar.message; +package de.steamwar.core; import org.bukkit.entity.Player; import java.util.Locale; -class Message_12 { - private Message_12(){} +public class WorldOfColorWrapper12 implements WorldOfColorWrapper.IWorldOfColorWrapper { - static Locale getLocale(Player player){ + @Override + public Locale getLocale(Player player){ return Locale.forLanguageTag(player.getLocale()); } } diff --git a/SpigotCore_14/build.gradle b/SpigotCore_14/build.gradle index 522e351..5ed491e 100644 --- a/SpigotCore_14/build.gradle +++ b/SpigotCore_14/build.gradle @@ -43,7 +43,7 @@ sourceSets { } dependencies { - implementation project(":SpigotCore_API") + implementation project(":SpigotCore_Main") compileOnly 'org.projectlombok:lombok:1.18.6' testCompileOnly 'org.projectlombok:lombok:1.18.6' diff --git a/SpigotCore_14/src/de/steamwar/chunk/Chunk_14.java b/SpigotCore_14/src/de/steamwar/core/CraftbukkitWrapper14.java similarity index 74% rename from SpigotCore_14/src/de/steamwar/chunk/Chunk_14.java rename to SpigotCore_14/src/de/steamwar/core/CraftbukkitWrapper14.java index fa5a2ca..bc27af3 100644 --- a/SpigotCore_14/src/de/steamwar/chunk/Chunk_14.java +++ b/SpigotCore_14/src/de/steamwar/core/CraftbukkitWrapper14.java @@ -1,6 +1,6 @@ -/* +/* 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 @@ -17,17 +17,24 @@ along with this program. If not, see . */ -package de.steamwar.chunk; +package de.steamwar.core; +import net.minecraft.server.v1_14_R1.MinecraftServer; import net.minecraft.server.v1_14_R1.PacketPlayOutMapChunk; import org.bukkit.craftbukkit.v1_14_R1.CraftChunk; import org.bukkit.craftbukkit.v1_14_R1.entity.CraftPlayer; import org.bukkit.entity.Player; -public class Chunk_14 { - private Chunk_14(){} +public class CraftbukkitWrapper14 implements CraftbukkitWrapper.ICraftbukkitWrapper { - public static void sendChunk(Player p, int chunkX, int chunkZ){ + @Override + public void sendChunk(Player p, int chunkX, int chunkZ) { ((CraftPlayer)p).getHandle().playerConnection.sendPacket(new PacketPlayOutMapChunk(((CraftChunk)p.getWorld().getChunkAt(chunkX, chunkZ)).getHandle(), 65535)); } + + @SuppressWarnings("deprecation") + @Override + public double[] getSpigotTPS() { + return MinecraftServer.getServer().recentTps; + } } diff --git a/SpigotCore_14/src/de/steamwar/sql/Schematic_14.java b/SpigotCore_14/src/de/steamwar/core/FlatteningWrapper14.java similarity index 63% rename from SpigotCore_14/src/de/steamwar/sql/Schematic_14.java rename to SpigotCore_14/src/de/steamwar/core/FlatteningWrapper14.java index 255530f..b5da68a 100644 --- a/SpigotCore_14/src/de/steamwar/sql/Schematic_14.java +++ b/SpigotCore_14/src/de/steamwar/core/FlatteningWrapper14.java @@ -1,6 +1,6 @@ -/* +/* 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 @@ -17,8 +17,9 @@ along with this program. If not, see . */ -package de.steamwar.sql; +package de.steamwar.core; +import com.comphenix.tinyprotocol.Reflection; import com.google.common.collect.ImmutableList; import com.google.common.collect.Maps; import com.sk89q.jnbt.*; @@ -46,8 +47,13 @@ import com.sk89q.worldedit.world.DataFixer; import com.sk89q.worldedit.world.block.BlockState; import com.sk89q.worldedit.world.block.BlockTypes; import com.sk89q.worldedit.world.registry.LegacyMapper; +import de.steamwar.scoreboard.SWScoreboard; +import de.steamwar.sql.NoClipboardException; import org.bukkit.Bukkit; +import org.bukkit.Material; import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; +import org.bukkit.inventory.meta.SkullMeta; import java.io.ByteArrayOutputStream; import java.io.IOException; @@ -57,13 +63,272 @@ import java.util.stream.Collectors; import static com.google.common.base.Preconditions.checkNotNull; -class Schematic_14 { - private Schematic_14(){} +public class FlatteningWrapper14 implements FlatteningWrapper.IFlatteningWrapper { + + private static final Map renamedLegacy = new HashMap<>(); + + static{ + renamedLegacy.put("WOOD", Material.OAK_WOOD); + renamedLegacy.put("SAPLING", Material.OAK_SAPLING); + renamedLegacy.put("STATIONARY_WATER", Material.WATER); + renamedLegacy.put("STATIONARY_LAVA", Material.LAVA); + renamedLegacy.put("LOG", Material.OAK_LOG); + renamedLegacy.put("LEAVES", Material.OAK_LEAVES); + renamedLegacy.put("BED_BLOCK", Material.RED_BED); + renamedLegacy.put("BED", Material.RED_BED); + renamedLegacy.put("PISTON_STICKY_BASE", Material.STICKY_PISTON); + renamedLegacy.put("WEB", Material.COBWEB); + renamedLegacy.put("LONG_GRASS", Material.TALL_GRASS); + renamedLegacy.put("PISTON_BASE", Material.PISTON); + renamedLegacy.put("PISTON_EXTENSION", Material.PISTON_HEAD); + renamedLegacy.put("WOOL", Material.WHITE_WOOL); + renamedLegacy.put("PISTON_MOVING_PIECE", Material.MOVING_PISTON); + renamedLegacy.put("YELLOW_FLOWER", Material.DANDELION); + renamedLegacy.put("RED_ROSE", Material.POPPY); + renamedLegacy.put("DOUBLE_STEP", Material.SMOOTH_STONE); + renamedLegacy.put("STEP", Material.SMOOTH_STONE_SLAB); + renamedLegacy.put("MOB_SPAWNER", Material.SPAWNER); + renamedLegacy.put("WOOD_STAIRS", Material.OAK_STAIRS); + renamedLegacy.put("WORKBENCH", Material.CRAFTING_TABLE); + renamedLegacy.put("CROPS", Material.WHEAT_SEEDS); + renamedLegacy.put("SEEDS", Material.WHEAT_SEEDS); + renamedLegacy.put("SOIL", Material.FARMLAND); + renamedLegacy.put("BURNING_FURNACE", Material.FURNACE); + renamedLegacy.put("SIGN_POST", Material.OAK_SIGN); + renamedLegacy.put("SIGN", Material.OAK_SIGN); + renamedLegacy.put("WOODEN_DOOR", Material.OAK_DOOR); + renamedLegacy.put("WOOD_DOOR", Material.OAK_DOOR); + renamedLegacy.put("RAILS", Material.RAIL); + renamedLegacy.put("WALL_SIGN", Material.OAK_WALL_SIGN); + renamedLegacy.put("STONE_PLATE", Material.STONE_PRESSURE_PLATE); + renamedLegacy.put("WOOD_PLATE", Material.OAK_PRESSURE_PLATE); + renamedLegacy.put("GLOWING_REDSTONE_ORE", Material.REDSTONE_ORE); + renamedLegacy.put("REDSTONE_TORCH_OFF", Material.REDSTONE_TORCH); + renamedLegacy.put("REDSTONE_TORCH_ON", Material.REDSTONE_TORCH); + renamedLegacy.put("IRON_DOOR_BLOCK", Material.IRON_DOOR); + renamedLegacy.put("SUGAR_CANE_BLOCK", Material.SUGAR_CANE); + renamedLegacy.put("CAKE_BLOCK", Material.CAKE); + renamedLegacy.put("MELON_BLOCK", Material.MELON); + renamedLegacy.put("BEETROOT_BLOCK", Material.BEETROOT); + renamedLegacy.put("FENCE", Material.OAK_FENCE); + renamedLegacy.put("PORTAL", Material.NETHER_PORTAL); + renamedLegacy.put("DIODE_BLOCK_OFF", Material.REPEATER); + renamedLegacy.put("DIODE_BLOCK_ON", Material.REPEATER); + renamedLegacy.put("DIODE", Material.REPEATER); + renamedLegacy.put("STAINED_GLASS", Material.WHITE_STAINED_GLASS); + renamedLegacy.put("TRAP_DOOR", Material.OAK_TRAPDOOR); + renamedLegacy.put("MONSTER_EGGS", Material.SKELETON_SPAWN_EGG); + renamedLegacy.put("MONSTER_EGG", Material.SKELETON_SPAWN_EGG); + renamedLegacy.put("SMOOTH_BRICK", Material.STONE_BRICKS); + renamedLegacy.put("HUGE_MUSHROOM_1", Material.MUSHROOM_STEM); + renamedLegacy.put("HUGE_MUSHROOM_2", Material.RED_MUSHROOM); + renamedLegacy.put("IRON_FENCE", Material.IRON_BARS); + renamedLegacy.put("THIN_GLASS", Material.GLASS_PANE); + renamedLegacy.put("FENCE_GATE", Material.OAK_FENCE_GATE); + renamedLegacy.put("SMOOTH_STAIRS", Material.STONE_BRICK_STAIRS); + renamedLegacy.put("MYCEL", Material.MYCELIUM); + renamedLegacy.put("WATER_LILY", Material.LILY_PAD); + renamedLegacy.put("NETHER_FENCE", Material.NETHER_BRICK_FENCE); + renamedLegacy.put("NETHER_WARTS", Material.NETHER_WART); + renamedLegacy.put("NETHER_STALK", Material.NETHER_WART); + renamedLegacy.put("ENCHANTMENT_TABLE", Material.ENCHANTING_TABLE); + renamedLegacy.put("ENDER_PORTAL", Material.END_PORTAL); + renamedLegacy.put("ENDER_PORTAL_FRAME", Material.END_PORTAL_FRAME); + renamedLegacy.put("ENDER_STONE", Material.END_STONE); + renamedLegacy.put("REDSTONE_LAMP_OFF", Material.REDSTONE_LAMP); + renamedLegacy.put("REDSTONE_LAMP_ON", Material.REDSTONE_LAMP); + renamedLegacy.put("WOOD_DOUBLE_STEP", Material.OAK_SLAB); + renamedLegacy.put("WOOD_STEP", Material.OAK_SLAB); + renamedLegacy.put("SPRUCE_WOOD_STAIRS", Material.SPRUCE_STAIRS); + renamedLegacy.put("BIRCH_WOOD_STAIRS", Material.BIRCH_STAIRS); + renamedLegacy.put("JUNGLE_WOOD_STAIRS", Material.JUNGLE_STAIRS); + renamedLegacy.put("COMMAND", Material.COMMAND_BLOCK); + renamedLegacy.put("COBBLE_WALL", Material.COBBLESTONE_WALL); + renamedLegacy.put("WOOD_BUTTON", Material.OAK_BUTTON); + renamedLegacy.put("SKULL", Material.SKELETON_SKULL); + renamedLegacy.put("SKULL_ITEM", Material.SKELETON_SKULL); + renamedLegacy.put("GOLD_PLATE", Material.LIGHT_WEIGHTED_PRESSURE_PLATE); + renamedLegacy.put("IRON_PLATE", Material.HEAVY_WEIGHTED_PRESSURE_PLATE); + renamedLegacy.put("REDSTONE_COMPARATOR_OFF", Material.COMPARATOR); + renamedLegacy.put("REDSTONE_COMPARATOR_ON", Material.COMPARATOR); + renamedLegacy.put("REDSTONE_COMPARATOR", Material.COMPARATOR); + renamedLegacy.put("QUARTZ_ORE", Material.QUARTZ); + renamedLegacy.put("STAINED_CLAY", Material.WHITE_TERRACOTTA); + renamedLegacy.put("STAINED_GLASS_PANE", Material.WHITE_STAINED_GLASS_PANE); + renamedLegacy.put("LEAVES_2", Material.ACACIA_LEAVES); + renamedLegacy.put("LOG_2", Material.ACACIA_LOG); + renamedLegacy.put("CARPET", Material.WHITE_CARPET); + renamedLegacy.put("HARD_CLAY", Material.TERRACOTTA); + renamedLegacy.put("DOUBLE_PLANT", Material.SUNFLOWER); + renamedLegacy.put("STANDING_BANNER", Material.WHITE_BANNER); + renamedLegacy.put("BANNER", Material.WHITE_BANNER); + renamedLegacy.put("WALL_BANNER", Material.WHITE_WALL_BANNER); + renamedLegacy.put("DAYLIGHT_DETECTOR_INVERTED", Material.DAYLIGHT_DETECTOR); + renamedLegacy.put("DOUBLE_STONE_SLAB2", Material.RED_SANDSTONE_SLAB); + renamedLegacy.put("STONE_SLAB2", Material.RED_SANDSTONE_SLAB); + renamedLegacy.put("PURPUR_DOUBLE_SLAB", Material.PURPUR_SLAB); + renamedLegacy.put("END_BRICKS", Material.END_STONE_BRICKS); + renamedLegacy.put("COMMAND_REPEATING", Material.REPEATING_COMMAND_BLOCK); + renamedLegacy.put("COMMAND_CHAIN", Material.CHAIN_COMMAND_BLOCK); + renamedLegacy.put("MAGMA", Material.MAGMA_BLOCK); + renamedLegacy.put("RED_NETHER_BRICK", Material.RED_NETHER_BRICKS); + renamedLegacy.put("SILVER_SHULKER_BOX", Material.LIGHT_GRAY_SHULKER_BOX); + renamedLegacy.put("SILVER_GLAZED_TERRACOTTA", Material.LIGHT_GRAY_TERRACOTTA); + renamedLegacy.put("CONCRETE", Material.WHITE_CONCRETE); + renamedLegacy.put("CONCRETE_POWDER", Material.WHITE_CONCRETE_POWDER); + renamedLegacy.put("IRON_SPADE", Material.IRON_SHOVEL); + renamedLegacy.put("WOOD_SWORD", Material.WOODEN_SWORD); + renamedLegacy.put("WOOD_SPADE", Material.WOODEN_SHOVEL); + renamedLegacy.put("WOOD_PICKAXE", Material.WOODEN_PICKAXE); + renamedLegacy.put("WOOD_AXE", Material.WOODEN_AXE); + renamedLegacy.put("STONE_SPADE", Material.STONE_SHOVEL); + renamedLegacy.put("DIAMOND_SPADE", Material.DIAMOND_SHOVEL); + renamedLegacy.put("MUSHROOM_SOUP", Material.MUSHROOM_STEW); + renamedLegacy.put("GOLD_SWORD", Material.GOLDEN_SWORD); + renamedLegacy.put("GOLD_SPADE", Material.GOLDEN_SHOVEL); + renamedLegacy.put("GOLD_PICKAXE", Material.GOLDEN_PICKAXE); + renamedLegacy.put("GOLD_AXE", Material.GOLDEN_AXE); + renamedLegacy.put("SULPHUR", Material.GUNPOWDER); + renamedLegacy.put("WOOD_HOE", Material.WOODEN_HOE); + renamedLegacy.put("GOLD_HOE", Material.GOLDEN_HOE); + renamedLegacy.put("GOLD_HELMET", Material.GOLDEN_HELMET); + renamedLegacy.put("GOLD_CHESTPLATE", Material.GOLDEN_CHESTPLATE); + renamedLegacy.put("GOLD_LEGGINGS", Material.GOLDEN_LEGGINGS); + renamedLegacy.put("GOLD_BOOTS", Material.GOLDEN_BOOTS); + renamedLegacy.put("PORK", Material.PORKCHOP); + renamedLegacy.put("GRILLED_PORK", Material.COOKED_PORKCHOP); + renamedLegacy.put("SNOW_BALL", Material.SNOWBALL); + renamedLegacy.put("BOAT", Material.OAK_BOAT); + renamedLegacy.put("CLAY_BRICK", Material.BRICKS); + renamedLegacy.put("STORAGE_MINECART", Material.CHEST_MINECART); + renamedLegacy.put("POWERED_MINECART", Material.FURNACE_MINECART); + renamedLegacy.put("WATCH", Material.CLOCK); + renamedLegacy.put("RAW_FISH", Material.SALMON); + renamedLegacy.put("COOKED_FISH", Material.COOKED_SALMON); + renamedLegacy.put("INK_SACK", Material.INK_SAC); + renamedLegacy.put("RAW_BEEF", Material.BEEF); + renamedLegacy.put("RAW_CHICKEN", Material.CHICKEN); + renamedLegacy.put("EYE_OF_ENDER", Material.ENDER_EYE); + renamedLegacy.put("SPECKLED_MELON", Material.GLISTERING_MELON_SLICE); + renamedLegacy.put("EXP_BOTTLE", Material.EXPERIENCE_BOTTLE); + renamedLegacy.put("FIREBALL", Material.FIRE_CHARGE); + renamedLegacy.put("BOOK_AND_QUILL", Material.WRITABLE_BOOK); + renamedLegacy.put("FLOWER_POT_ITEM", Material.FLOWER_POT); + renamedLegacy.put("EMPTY_MAP", Material.MAP); + renamedLegacy.put("BREWING_STAND_ITEM", Material.BREWING_STAND); + renamedLegacy.put("CAULDRON_ITEM", Material.CAULDRON); + renamedLegacy.put("CARROT_ITEM", Material.CARROT); + renamedLegacy.put("POTATO_ITEM", Material.POTATO); + renamedLegacy.put("SPRUCE_DOOR_ITEM", Material.SPRUCE_DOOR); + renamedLegacy.put("BIRCH_DOOR_ITEM", Material.BIRCH_DOOR); + renamedLegacy.put("JUNGLE_DOOR_ITEM", Material.JUNGLE_DOOR); + renamedLegacy.put("ACACIA_DOOR_ITEM", Material.ACACIA_DOOR); + renamedLegacy.put("DARK_OAK_DOOR_ITEM", Material.DARK_OAK_DOOR); + renamedLegacy.put("CARROT_STICK", Material.CARROT_ON_A_STICK); + renamedLegacy.put("FIREWORK", Material.FIREWORK_ROCKET); + renamedLegacy.put("FIREWORK_CHARGE", Material.FIREWORK_STAR); + renamedLegacy.put("NETHER_BRICK_ITEM", Material.NETHER_BRICKS); + renamedLegacy.put("EXPLOSIVE_MINECART", Material.TNT_MINECART); + renamedLegacy.put("IRON_BARDING", Material.IRON_HORSE_ARMOR); + renamedLegacy.put("GOLD_BARDING", Material.GOLDEN_HORSE_ARMOR); + renamedLegacy.put("DIAMOND_BARDING", Material.DIAMOND_HORSE_ARMOR); + renamedLegacy.put("LEASH", Material.LEAD); + renamedLegacy.put("COMMAND_MINECART", Material.COMMAND_BLOCK_MINECART); + renamedLegacy.put("CHORUS_FRUIT_POPPED", Material.POPPED_CHORUS_FRUIT); + renamedLegacy.put("DRAGONS_BREATH", Material.DRAGON_BREATH); + renamedLegacy.put("BOAT_SPRUCE", Material.SPRUCE_BOAT); + renamedLegacy.put("BOAT_BIRCH", Material.BIRCH_BOAT); + renamedLegacy.put("BOAT_JUNGLE", Material.JUNGLE_BOAT); + renamedLegacy.put("BOAT_ACACIA", Material.ACACIA_BOAT); + renamedLegacy.put("BOAT_DARK_OAK", Material.DARK_OAK_BOAT); + renamedLegacy.put("TOTEM", Material.TOTEM_OF_UNDYING); + renamedLegacy.put("GOLD_RECORD", Material.MUSIC_DISC_13); + renamedLegacy.put("GREEN_RECORD", Material.MUSIC_DISC_CAT); + renamedLegacy.put("RECORD_3", Material.MUSIC_DISC_BLOCKS); + renamedLegacy.put("RECORD_4", Material.MUSIC_DISC_CHIRP); + renamedLegacy.put("RECORD_5", Material.MUSIC_DISC_FAR); + renamedLegacy.put("RECORD_6", Material.MUSIC_DISC_MALL); + renamedLegacy.put("RECORD_7", Material.MUSIC_DISC_MELLOHI); + renamedLegacy.put("RECORD_8", Material.MUSIC_DISC_STAL); + renamedLegacy.put("RECORD_9", Material.MUSIC_DISC_STRAD); + renamedLegacy.put("RECORD_10", Material.MUSIC_DISC_WARD); + renamedLegacy.put("RECORD_11", Material.MUSIC_DISC_11); + renamedLegacy.put("RECORD_12", Material.MUSIC_DISC_WAIT); + } + + private static final Class chatComponent = Reflection.getClass("{nms}.ChatComponentText"); + private static final Reflection.FieldAccessor scoreboardName = Reflection.getField(SWScoreboard.scoreboardObjective, chatComponent, 0); + private static final Reflection.ConstructorInvoker chatComponentConstructor = Reflection.getConstructor(chatComponent, String.class); + + @Override + public void setScoreboardTitle(Object packet, String title) { + scoreboardName.set(packet, chatComponentConstructor.invoke(title)); + } + + @Override + public Material getMaterial(String material) { + try{ + return Material.valueOf(material); + }catch(IllegalArgumentException e){ + return renamedLegacy.get(material); + } + } + + @Override + public Material getDye(int colorCode) { + switch(colorCode){ + case 1: + return Material.RED_DYE; + case 2: + return Material.GREEN_DYE; + case 3: + return Material.BROWN_DYE; + case 4: + return Material.LAPIS_LAZULI; + case 5: + return Material.PURPLE_DYE; + case 6: + return Material.CYAN_DYE; + case 7: + return Material.LIGHT_GRAY_DYE; + case 8: + return Material.GRAY_DYE; + case 9: + return Material.PINK_DYE; + case 10: + return Material.LIME_DYE; + case 11: + return Material.YELLOW_DYE; + case 12: + return Material.LIGHT_BLUE_DYE; + case 13: + return Material.MAGENTA_DYE; + case 14: + return Material.ORANGE_DYE; + case 15: + return Material.WHITE_DYE; + default: + return Material.BLACK_DYE; + } + } + + @SuppressWarnings("deprecation") + @Override + public ItemStack setSkullOwner(String player) { + ItemStack head = new ItemStack(Material.PLAYER_HEAD, 1); + SkullMeta headmeta = (SkullMeta) head.getItemMeta(); + assert headmeta != null; + headmeta.setOwningPlayer(Bukkit.getOfflinePlayer(player)); + headmeta.setDisplayName(player); + head.setItemMeta(headmeta); + return head; + } private static final ClipboardFormat SCHEMATIC = BuiltInClipboardFormat.MCEDIT_SCHEMATIC; private static final ClipboardFormat SCHEM = BuiltInClipboardFormat.SPONGE_SCHEMATIC; - static byte[] getPlayerClipboard(Player player, boolean schemFormat) { + @Override + public byte[] getPlayerClipboard(Player player, boolean schemFormat) { ClipboardHolder clipboardHolder; try { clipboardHolder = getWorldEditPlugin().getSession(player).getClipboard(); @@ -92,7 +357,8 @@ class Schematic_14 { return outputStream.toByteArray(); } - static void setPlayerClipboard(Player player, InputStream is, boolean schemFormat) { + @Override + public void setPlayerClipboard(Player player, InputStream is, boolean schemFormat) { Clipboard clipboard = null; try { clipboard = getClipboard(is, schemFormat); @@ -107,7 +373,8 @@ class Schematic_14 { getWorldEditPlugin().getWorldEdit().getSessionManager().get(actor).setClipboard(new ClipboardHolder(clipboard)); } - static Clipboard getClipboard(InputStream is, boolean schemFormat) throws IOException { + @Override + public Clipboard getClipboard(InputStream is, boolean schemFormat) throws IOException { try { if(schemFormat){ return new SpongeSchematicReader(new NBTInputStream(is)).read(); @@ -419,7 +686,7 @@ class Schematic_14 { return readVersion1(schematicTag); } else if (schematicVersion == 2) { dataVersion = requireTag(schematic, "DataVersion", IntTag.class).getValue(); - if (dataVersion < liveDataVersion) { + if (dataVersion < liveDataVersion) { fixer = platform.getDataFixer(); } diff --git a/SpigotCore_14/src/de/steamwar/core/SpigotTPS_14.java b/SpigotCore_14/src/de/steamwar/core/SpigotTPS_14.java deleted file mode 100644 index d00aba8..0000000 --- a/SpigotCore_14/src/de/steamwar/core/SpigotTPS_14.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - 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 . -*/ - -package de.steamwar.core; - -import net.minecraft.server.v1_14_R1.MinecraftServer; - -public class SpigotTPS_14 { - - private SpigotTPS_14(){} - - static double[] getTps(){ - return MinecraftServer.getServer().recentTps; - } - -} diff --git a/SpigotCore_14/src/de/steamwar/inventory/SWItem_14.java b/SpigotCore_14/src/de/steamwar/inventory/SWItem_14.java deleted file mode 100644 index 623dd20..0000000 --- a/SpigotCore_14/src/de/steamwar/inventory/SWItem_14.java +++ /dev/null @@ -1,278 +0,0 @@ -/* - 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 . -*/ - -package de.steamwar.inventory; - -import org.bukkit.Bukkit; -import org.bukkit.Material; -import org.bukkit.inventory.ItemStack; -import org.bukkit.inventory.meta.SkullMeta; - -import java.util.HashMap; -import java.util.Map; - -class SWItem_14 { - private SWItem_14(){} - - private static final Map renamedLegacy = new HashMap<>(); - - static{ - renamedLegacy.put("WOOD", Material.OAK_WOOD); - renamedLegacy.put("SAPLING", Material.OAK_SAPLING); - renamedLegacy.put("STATIONARY_WATER", Material.WATER); - renamedLegacy.put("STATIONARY_LAVA", Material.LAVA); - renamedLegacy.put("LOG", Material.OAK_LOG); - renamedLegacy.put("LEAVES", Material.OAK_LEAVES); - renamedLegacy.put("BED_BLOCK", Material.RED_BED); - renamedLegacy.put("BED", Material.RED_BED); - renamedLegacy.put("PISTON_STICKY_BASE", Material.STICKY_PISTON); - renamedLegacy.put("WEB", Material.COBWEB); - renamedLegacy.put("LONG_GRASS", Material.TALL_GRASS); - renamedLegacy.put("PISTON_BASE", Material.PISTON); - renamedLegacy.put("PISTON_EXTENSION", Material.PISTON_HEAD); - renamedLegacy.put("WOOL", Material.WHITE_WOOL); - renamedLegacy.put("PISTON_MOVING_PIECE", Material.MOVING_PISTON); - renamedLegacy.put("YELLOW_FLOWER", Material.DANDELION); - renamedLegacy.put("RED_ROSE", Material.POPPY); - renamedLegacy.put("DOUBLE_STEP", Material.SMOOTH_STONE); - renamedLegacy.put("STEP", Material.SMOOTH_STONE_SLAB); - renamedLegacy.put("MOB_SPAWNER", Material.SPAWNER); - renamedLegacy.put("WOOD_STAIRS", Material.OAK_STAIRS); - renamedLegacy.put("WORKBENCH", Material.CRAFTING_TABLE); - renamedLegacy.put("CROPS", Material.WHEAT_SEEDS); - renamedLegacy.put("SEEDS", Material.WHEAT_SEEDS); - renamedLegacy.put("SOIL", Material.FARMLAND); - renamedLegacy.put("BURNING_FURNACE", Material.FURNACE); - renamedLegacy.put("SIGN_POST", Material.OAK_SIGN); - renamedLegacy.put("SIGN", Material.OAK_SIGN); - renamedLegacy.put("WOODEN_DOOR", Material.OAK_DOOR); - renamedLegacy.put("WOOD_DOOR", Material.OAK_DOOR); - renamedLegacy.put("RAILS", Material.RAIL); - renamedLegacy.put("WALL_SIGN", Material.OAK_WALL_SIGN); - renamedLegacy.put("STONE_PLATE", Material.STONE_PRESSURE_PLATE); - renamedLegacy.put("WOOD_PLATE", Material.OAK_PRESSURE_PLATE); - renamedLegacy.put("GLOWING_REDSTONE_ORE", Material.REDSTONE_ORE); - renamedLegacy.put("REDSTONE_TORCH_OFF", Material.REDSTONE_TORCH); - renamedLegacy.put("REDSTONE_TORCH_ON", Material.REDSTONE_TORCH); - renamedLegacy.put("IRON_DOOR_BLOCK", Material.IRON_DOOR); - renamedLegacy.put("SUGAR_CANE_BLOCK", Material.SUGAR_CANE); - renamedLegacy.put("CAKE_BLOCK", Material.CAKE); - renamedLegacy.put("MELON_BLOCK", Material.MELON); - renamedLegacy.put("BEETROOT_BLOCK", Material.BEETROOT); - renamedLegacy.put("FENCE", Material.OAK_FENCE); - renamedLegacy.put("PORTAL", Material.NETHER_PORTAL); - renamedLegacy.put("DIODE_BLOCK_OFF", Material.REPEATER); - renamedLegacy.put("DIODE_BLOCK_ON", Material.REPEATER); - renamedLegacy.put("DIODE", Material.REPEATER); - renamedLegacy.put("STAINED_GLASS", Material.WHITE_STAINED_GLASS); - renamedLegacy.put("TRAP_DOOR", Material.OAK_TRAPDOOR); - renamedLegacy.put("MONSTER_EGGS", Material.SKELETON_SPAWN_EGG); - renamedLegacy.put("MONSTER_EGG", Material.SKELETON_SPAWN_EGG); - renamedLegacy.put("SMOOTH_BRICK", Material.STONE_BRICKS); - renamedLegacy.put("HUGE_MUSHROOM_1", Material.MUSHROOM_STEM); - renamedLegacy.put("HUGE_MUSHROOM_2", Material.RED_MUSHROOM); - renamedLegacy.put("IRON_FENCE", Material.IRON_BARS); - renamedLegacy.put("THIN_GLASS", Material.GLASS_PANE); - renamedLegacy.put("FENCE_GATE", Material.OAK_FENCE_GATE); - renamedLegacy.put("SMOOTH_STAIRS", Material.STONE_BRICK_STAIRS); - renamedLegacy.put("MYCEL", Material.MYCELIUM); - renamedLegacy.put("WATER_LILY", Material.LILY_PAD); - renamedLegacy.put("NETHER_FENCE", Material.NETHER_BRICK_FENCE); - renamedLegacy.put("NETHER_WARTS", Material.NETHER_WART); - renamedLegacy.put("NETHER_STALK", Material.NETHER_WART); - renamedLegacy.put("ENCHANTMENT_TABLE", Material.ENCHANTING_TABLE); - renamedLegacy.put("ENDER_PORTAL", Material.END_PORTAL); - renamedLegacy.put("ENDER_PORTAL_FRAME", Material.END_PORTAL_FRAME); - renamedLegacy.put("ENDER_STONE", Material.END_STONE); - renamedLegacy.put("REDSTONE_LAMP_OFF", Material.REDSTONE_LAMP); - renamedLegacy.put("REDSTONE_LAMP_ON", Material.REDSTONE_LAMP); - renamedLegacy.put("WOOD_DOUBLE_STEP", Material.OAK_SLAB); - renamedLegacy.put("WOOD_STEP", Material.OAK_SLAB); - renamedLegacy.put("SPRUCE_WOOD_STAIRS", Material.SPRUCE_STAIRS); - renamedLegacy.put("BIRCH_WOOD_STAIRS", Material.BIRCH_STAIRS); - renamedLegacy.put("JUNGLE_WOOD_STAIRS", Material.JUNGLE_STAIRS); - renamedLegacy.put("COMMAND", Material.COMMAND_BLOCK); - renamedLegacy.put("COBBLE_WALL", Material.COBBLESTONE_WALL); - renamedLegacy.put("WOOD_BUTTON", Material.OAK_BUTTON); - renamedLegacy.put("SKULL", Material.SKELETON_SKULL); - renamedLegacy.put("SKULL_ITEM", Material.SKELETON_SKULL); - renamedLegacy.put("GOLD_PLATE", Material.LIGHT_WEIGHTED_PRESSURE_PLATE); - renamedLegacy.put("IRON_PLATE", Material.HEAVY_WEIGHTED_PRESSURE_PLATE); - renamedLegacy.put("REDSTONE_COMPARATOR_OFF", Material.COMPARATOR); - renamedLegacy.put("REDSTONE_COMPARATOR_ON", Material.COMPARATOR); - renamedLegacy.put("REDSTONE_COMPARATOR", Material.COMPARATOR); - renamedLegacy.put("QUARTZ_ORE", Material.QUARTZ); - renamedLegacy.put("STAINED_CLAY", Material.WHITE_TERRACOTTA); - renamedLegacy.put("STAINED_GLASS_PANE", Material.WHITE_STAINED_GLASS_PANE); - renamedLegacy.put("LEAVES_2", Material.ACACIA_LEAVES); - renamedLegacy.put("LOG_2", Material.ACACIA_LOG); - renamedLegacy.put("CARPET", Material.WHITE_CARPET); - renamedLegacy.put("HARD_CLAY", Material.TERRACOTTA); - renamedLegacy.put("DOUBLE_PLANT", Material.SUNFLOWER); - renamedLegacy.put("STANDING_BANNER", Material.WHITE_BANNER); - renamedLegacy.put("BANNER", Material.WHITE_BANNER); - renamedLegacy.put("WALL_BANNER", Material.WHITE_WALL_BANNER); - renamedLegacy.put("DAYLIGHT_DETECTOR_INVERTED", Material.DAYLIGHT_DETECTOR); - renamedLegacy.put("DOUBLE_STONE_SLAB2", Material.RED_SANDSTONE_SLAB); - renamedLegacy.put("STONE_SLAB2", Material.RED_SANDSTONE_SLAB); - renamedLegacy.put("PURPUR_DOUBLE_SLAB", Material.PURPUR_SLAB); - renamedLegacy.put("END_BRICKS", Material.END_STONE_BRICKS); - renamedLegacy.put("COMMAND_REPEATING", Material.REPEATING_COMMAND_BLOCK); - renamedLegacy.put("COMMAND_CHAIN", Material.CHAIN_COMMAND_BLOCK); - renamedLegacy.put("MAGMA", Material.MAGMA_BLOCK); - renamedLegacy.put("RED_NETHER_BRICK", Material.RED_NETHER_BRICKS); - renamedLegacy.put("SILVER_SHULKER_BOX", Material.LIGHT_GRAY_SHULKER_BOX); - renamedLegacy.put("SILVER_GLAZED_TERRACOTTA", Material.LIGHT_GRAY_TERRACOTTA); - renamedLegacy.put("CONCRETE", Material.WHITE_CONCRETE); - renamedLegacy.put("CONCRETE_POWDER", Material.WHITE_CONCRETE_POWDER); - renamedLegacy.put("IRON_SPADE", Material.IRON_SHOVEL); - renamedLegacy.put("WOOD_SWORD", Material.WOODEN_SWORD); - renamedLegacy.put("WOOD_SPADE", Material.WOODEN_SHOVEL); - renamedLegacy.put("WOOD_PICKAXE", Material.WOODEN_PICKAXE); - renamedLegacy.put("WOOD_AXE", Material.WOODEN_AXE); - renamedLegacy.put("STONE_SPADE", Material.STONE_SHOVEL); - renamedLegacy.put("DIAMOND_SPADE", Material.DIAMOND_SHOVEL); - renamedLegacy.put("MUSHROOM_SOUP", Material.MUSHROOM_STEW); - renamedLegacy.put("GOLD_SWORD", Material.GOLDEN_SWORD); - renamedLegacy.put("GOLD_SPADE", Material.GOLDEN_SHOVEL); - renamedLegacy.put("GOLD_PICKAXE", Material.GOLDEN_PICKAXE); - renamedLegacy.put("GOLD_AXE", Material.GOLDEN_AXE); - renamedLegacy.put("SULPHUR", Material.GUNPOWDER); - renamedLegacy.put("WOOD_HOE", Material.WOODEN_HOE); - renamedLegacy.put("GOLD_HOE", Material.GOLDEN_HOE); - renamedLegacy.put("GOLD_HELMET", Material.GOLDEN_HELMET); - renamedLegacy.put("GOLD_CHESTPLATE", Material.GOLDEN_CHESTPLATE); - renamedLegacy.put("GOLD_LEGGINGS", Material.GOLDEN_LEGGINGS); - renamedLegacy.put("GOLD_BOOTS", Material.GOLDEN_BOOTS); - renamedLegacy.put("PORK", Material.PORKCHOP); - renamedLegacy.put("GRILLED_PORK", Material.COOKED_PORKCHOP); - renamedLegacy.put("SNOW_BALL", Material.SNOWBALL); - renamedLegacy.put("BOAT", Material.OAK_BOAT); - renamedLegacy.put("CLAY_BRICK", Material.BRICKS); - renamedLegacy.put("STORAGE_MINECART", Material.CHEST_MINECART); - renamedLegacy.put("POWERED_MINECART", Material.FURNACE_MINECART); - renamedLegacy.put("WATCH", Material.CLOCK); - renamedLegacy.put("RAW_FISH", Material.SALMON); - renamedLegacy.put("COOKED_FISH", Material.COOKED_SALMON); - renamedLegacy.put("INK_SACK", Material.INK_SAC); - renamedLegacy.put("RAW_BEEF", Material.BEEF); - renamedLegacy.put("RAW_CHICKEN", Material.CHICKEN); - renamedLegacy.put("EYE_OF_ENDER", Material.ENDER_EYE); - renamedLegacy.put("SPECKLED_MELON", Material.GLISTERING_MELON_SLICE); - renamedLegacy.put("EXP_BOTTLE", Material.EXPERIENCE_BOTTLE); - renamedLegacy.put("FIREBALL", Material.FIRE_CHARGE); - renamedLegacy.put("BOOK_AND_QUILL", Material.WRITABLE_BOOK); - renamedLegacy.put("FLOWER_POT_ITEM", Material.FLOWER_POT); - renamedLegacy.put("EMPTY_MAP", Material.MAP); - renamedLegacy.put("BREWING_STAND_ITEM", Material.BREWING_STAND); - renamedLegacy.put("CAULDRON_ITEM", Material.CAULDRON); - renamedLegacy.put("CARROT_ITEM", Material.CARROT); - renamedLegacy.put("POTATO_ITEM", Material.POTATO); - renamedLegacy.put("SPRUCE_DOOR_ITEM", Material.SPRUCE_DOOR); - renamedLegacy.put("BIRCH_DOOR_ITEM", Material.BIRCH_DOOR); - renamedLegacy.put("JUNGLE_DOOR_ITEM", Material.JUNGLE_DOOR); - renamedLegacy.put("ACACIA_DOOR_ITEM", Material.ACACIA_DOOR); - renamedLegacy.put("DARK_OAK_DOOR_ITEM", Material.DARK_OAK_DOOR); - renamedLegacy.put("CARROT_STICK", Material.CARROT_ON_A_STICK); - renamedLegacy.put("FIREWORK", Material.FIREWORK_ROCKET); - renamedLegacy.put("FIREWORK_CHARGE", Material.FIREWORK_STAR); - renamedLegacy.put("NETHER_BRICK_ITEM", Material.NETHER_BRICKS); - renamedLegacy.put("EXPLOSIVE_MINECART", Material.TNT_MINECART); - renamedLegacy.put("IRON_BARDING", Material.IRON_HORSE_ARMOR); - renamedLegacy.put("GOLD_BARDING", Material.GOLDEN_HORSE_ARMOR); - renamedLegacy.put("DIAMOND_BARDING", Material.DIAMOND_HORSE_ARMOR); - renamedLegacy.put("LEASH", Material.LEAD); - renamedLegacy.put("COMMAND_MINECART", Material.COMMAND_BLOCK_MINECART); - renamedLegacy.put("CHORUS_FRUIT_POPPED", Material.POPPED_CHORUS_FRUIT); - renamedLegacy.put("DRAGONS_BREATH", Material.DRAGON_BREATH); - renamedLegacy.put("BOAT_SPRUCE", Material.SPRUCE_BOAT); - renamedLegacy.put("BOAT_BIRCH", Material.BIRCH_BOAT); - renamedLegacy.put("BOAT_JUNGLE", Material.JUNGLE_BOAT); - renamedLegacy.put("BOAT_ACACIA", Material.ACACIA_BOAT); - renamedLegacy.put("BOAT_DARK_OAK", Material.DARK_OAK_BOAT); - renamedLegacy.put("TOTEM", Material.TOTEM_OF_UNDYING); - renamedLegacy.put("GOLD_RECORD", Material.MUSIC_DISC_13); - renamedLegacy.put("GREEN_RECORD", Material.MUSIC_DISC_CAT); - renamedLegacy.put("RECORD_3", Material.MUSIC_DISC_BLOCKS); - renamedLegacy.put("RECORD_4", Material.MUSIC_DISC_CHIRP); - renamedLegacy.put("RECORD_5", Material.MUSIC_DISC_FAR); - renamedLegacy.put("RECORD_6", Material.MUSIC_DISC_MALL); - renamedLegacy.put("RECORD_7", Material.MUSIC_DISC_MELLOHI); - renamedLegacy.put("RECORD_8", Material.MUSIC_DISC_STAL); - renamedLegacy.put("RECORD_9", Material.MUSIC_DISC_STRAD); - renamedLegacy.put("RECORD_10", Material.MUSIC_DISC_WARD); - renamedLegacy.put("RECORD_11", Material.MUSIC_DISC_11); - renamedLegacy.put("RECORD_12", Material.MUSIC_DISC_WAIT); - } - - static Material getMaterial(String material) { - try{ - return Material.valueOf(material); - }catch(IllegalArgumentException e){ - return renamedLegacy.get(material); - } - } - - static Material getDye(int colorCode){ - switch(colorCode){ - case 1: - return Material.RED_DYE; - case 2: - return Material.GREEN_DYE; - case 3: - return Material.BROWN_DYE; - case 4: - return Material.LAPIS_LAZULI; - case 5: - return Material.PURPLE_DYE; - case 6: - return Material.CYAN_DYE; - case 7: - return Material.LIGHT_GRAY_DYE; - case 8: - return Material.GRAY_DYE; - case 9: - return Material.PINK_DYE; - case 10: - return Material.LIME_DYE; - case 11: - return Material.YELLOW_DYE; - case 12: - return Material.LIGHT_BLUE_DYE; - case 13: - return Material.MAGENTA_DYE; - case 14: - return Material.ORANGE_DYE; - case 15: - return Material.WHITE_DYE; - default: - return Material.BLACK_DYE; - } - } - - static ItemStack setSkullOwner(String player){ - ItemStack head = new ItemStack(Material.PLAYER_HEAD, 1); - SkullMeta headmeta = (SkullMeta) head.getItemMeta(); - assert headmeta != null; - headmeta.setOwningPlayer(Bukkit.getOfflinePlayer(player)); - headmeta.setDisplayName(player); - head.setItemMeta(headmeta); - return head; - } -} diff --git a/SpigotCore_15/build.gradle b/SpigotCore_15/build.gradle index 7cf4806..31149fe 100644 --- a/SpigotCore_15/build.gradle +++ b/SpigotCore_15/build.gradle @@ -43,8 +43,7 @@ sourceSets { } dependencies { - implementation project(":SpigotCore_14") - implementation project(":SpigotCore_API") + implementation project(":SpigotCore_Main") compileOnly 'org.projectlombok:lombok:1.18.6' testCompileOnly 'org.projectlombok:lombok:1.18.6' @@ -52,5 +51,4 @@ dependencies { testAnnotationProcessor 'org.projectlombok:lombok:1.18.6' compileOnly files("${project.rootDir}/lib/Spigot-1.15.jar") - compileOnly files("${project.rootDir}/lib/WorldEdit-1.15.jar") } diff --git a/SpigotCore_15/src/de/steamwar/chunk/Chunk_15.java b/SpigotCore_15/src/de/steamwar/core/CraftbukkitWrapper15.java similarity index 74% rename from SpigotCore_15/src/de/steamwar/chunk/Chunk_15.java rename to SpigotCore_15/src/de/steamwar/core/CraftbukkitWrapper15.java index 8a8b636..d5b908f 100644 --- a/SpigotCore_15/src/de/steamwar/chunk/Chunk_15.java +++ b/SpigotCore_15/src/de/steamwar/core/CraftbukkitWrapper15.java @@ -1,6 +1,6 @@ -/* +/* 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 @@ -17,17 +17,24 @@ along with this program. If not, see . */ -package de.steamwar.chunk; +package de.steamwar.core; +import net.minecraft.server.v1_15_R1.MinecraftServer; import net.minecraft.server.v1_15_R1.PacketPlayOutMapChunk; import org.bukkit.craftbukkit.v1_15_R1.CraftChunk; import org.bukkit.craftbukkit.v1_15_R1.entity.CraftPlayer; import org.bukkit.entity.Player; -public class Chunk_15 { - private Chunk_15(){} +public class CraftbukkitWrapper15 implements CraftbukkitWrapper.ICraftbukkitWrapper { - public static void sendChunk(Player p, int chunkX, int chunkZ){ + @Override + public void sendChunk(Player p, int chunkX, int chunkZ) { ((CraftPlayer)p).getHandle().playerConnection.sendPacket(new PacketPlayOutMapChunk(((CraftChunk)p.getWorld().getChunkAt(chunkX, chunkZ)).getHandle(), 65535)); } + + @SuppressWarnings("deprecation") + @Override + public double[] getSpigotTPS() { + return MinecraftServer.getServer().recentTps; + } } diff --git a/SpigotCore_15/src/de/steamwar/core/SpigotTPS_15.java b/SpigotCore_15/src/de/steamwar/core/SpigotTPS_15.java deleted file mode 100644 index 46c1186..0000000 --- a/SpigotCore_15/src/de/steamwar/core/SpigotTPS_15.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - 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 . -*/ - -package de.steamwar.core; - -import net.minecraft.server.v1_15_R1.MinecraftServer; - -public class SpigotTPS_15 { - - private SpigotTPS_15(){} - - static double[] getTps(){ - return MinecraftServer.getServer().recentTps; - } - -} diff --git a/SpigotCore_8/build.gradle b/SpigotCore_8/build.gradle index cb5ff47..f5207ab 100644 --- a/SpigotCore_8/build.gradle +++ b/SpigotCore_8/build.gradle @@ -43,7 +43,7 @@ sourceSets { } dependencies { - implementation project(":SpigotCore_API") + implementation project(":SpigotCore_Main") compileOnly 'org.projectlombok:lombok:1.18.6' testCompileOnly 'org.projectlombok:lombok:1.18.6' diff --git a/SpigotCore_8/src/de/steamwar/comms/BungeeReceiver_8.java b/SpigotCore_8/src/de/steamwar/core/BountifulWrapper8.java similarity index 85% rename from SpigotCore_8/src/de/steamwar/comms/BungeeReceiver_8.java rename to SpigotCore_8/src/de/steamwar/core/BountifulWrapper8.java index 2b2ce08..2337739 100644 --- a/SpigotCore_8/src/de/steamwar/comms/BungeeReceiver_8.java +++ b/SpigotCore_8/src/de/steamwar/core/BountifulWrapper8.java @@ -17,14 +17,15 @@ along with this program. If not, see . */ -package de.steamwar.comms; +package de.steamwar.core; import org.bukkit.Sound; import org.bukkit.entity.Player; -public class BungeeReceiver_8 { +public class BountifulWrapper8 implements BountifulWrapper.IBountifulWrapper { - public static void playPling(Player player) { + @Override + public void playPling(Player player) { player.playSound(player.getLocation(), Sound.ORB_PICKUP, 1, 1); } } diff --git a/SpigotCore_8/src/de/steamwar/chunk/Chunk_8.java b/SpigotCore_8/src/de/steamwar/core/CraftbukkitWrapper8.java similarity index 76% rename from SpigotCore_8/src/de/steamwar/chunk/Chunk_8.java rename to SpigotCore_8/src/de/steamwar/core/CraftbukkitWrapper8.java index 404c158..149664c 100644 --- a/SpigotCore_8/src/de/steamwar/chunk/Chunk_8.java +++ b/SpigotCore_8/src/de/steamwar/core/CraftbukkitWrapper8.java @@ -1,6 +1,6 @@ -/* +/* 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 @@ -17,17 +17,23 @@ along with this program. If not, see . */ -package de.steamwar.chunk; +package de.steamwar.core; +import net.minecraft.server.v1_8_R3.MinecraftServer; import net.minecraft.server.v1_8_R3.PacketPlayOutMapChunk; import org.bukkit.craftbukkit.v1_8_R3.CraftChunk; import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer; import org.bukkit.entity.Player; -public class Chunk_8 { - private Chunk_8(){} +public class CraftbukkitWrapper8 implements CraftbukkitWrapper.ICraftbukkitWrapper { - public static void sendChunk(Player p, int chunkX, int chunkZ){ + @Override + public void sendChunk(Player p, int chunkX, int chunkZ) { ((CraftPlayer)p).getHandle().playerConnection.sendPacket(new PacketPlayOutMapChunk(((CraftChunk)p.getWorld().getChunkAt(chunkX, chunkZ)).getHandle(), true, 65535)); } + + @Override + public double[] getSpigotTPS() { + return MinecraftServer.getServer().recentTps; + } } diff --git a/SpigotCore_8/src/de/steamwar/sql/Schematic_8.java b/SpigotCore_8/src/de/steamwar/core/FlatteningWrapper8.java similarity index 87% rename from SpigotCore_8/src/de/steamwar/sql/Schematic_8.java rename to SpigotCore_8/src/de/steamwar/core/FlatteningWrapper8.java index 29974ab..6aaa7ab 100644 --- a/SpigotCore_8/src/de/steamwar/sql/Schematic_8.java +++ b/SpigotCore_8/src/de/steamwar/core/FlatteningWrapper8.java @@ -1,6 +1,6 @@ -/* +/* 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 @@ -17,8 +17,9 @@ along with this program. If not, see . */ -package de.steamwar.sql; +package de.steamwar.core; +import com.comphenix.tinyprotocol.Reflection; import com.google.common.base.Preconditions; import com.google.common.collect.Maps; import com.sk89q.jnbt.*; @@ -36,8 +37,13 @@ import com.sk89q.worldedit.extent.clipboard.io.SchematicReader; import com.sk89q.worldedit.regions.CuboidRegion; import com.sk89q.worldedit.session.ClipboardHolder; import com.sk89q.worldedit.world.registry.WorldData; +import de.steamwar.scoreboard.SWScoreboard; +import de.steamwar.sql.NoClipboardException; import org.bukkit.Bukkit; +import org.bukkit.Material; import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; +import org.bukkit.inventory.meta.SkullMeta; import javax.annotation.Nullable; import java.io.ByteArrayOutputStream; @@ -49,10 +55,41 @@ import java.util.List; import java.util.Map; import java.util.stream.Collectors; -class Schematic_8 { - private Schematic_8(){} +public class FlatteningWrapper8 implements FlatteningWrapper.IFlatteningWrapper { - static byte[] getPlayerClipboard(Player player) { + private static final Reflection.FieldAccessor scoreboardName = Reflection.getField(SWScoreboard.scoreboardObjective, String.class, 1); + + @Override + public void setScoreboardTitle(Object packet, String title) { + scoreboardName.set(packet, title); + } + + @Override + public Material getMaterial(String material) { + try{ + return Material.valueOf(material); + }catch(IllegalArgumentException e){ + return Material.STONE; + } + } + + @Override + public Material getDye(int colorCode) { + return Material.INK_SACK; + } + + @Override + public ItemStack setSkullOwner(String player) { + ItemStack head = new ItemStack(Material.SKULL_ITEM, 1, (short) 3); + SkullMeta headmeta = (SkullMeta) head.getItemMeta(); + headmeta.setOwner(player); + headmeta.setDisplayName(player); + head.setItemMeta(headmeta); + return head; + } + + @Override + public byte[] getPlayerClipboard(Player player, boolean schemFormat) { ClipboardHolder clipboardHolder; try { clipboardHolder = getWorldEditPlugin().getSession(player).getClipboard(); @@ -73,7 +110,8 @@ class Schematic_8 { return outputStream.toByteArray(); } - static void setPlayerClipboard(Player player, InputStream is, boolean schemFormat) { + @Override + public void setPlayerClipboard(Player player, InputStream is, boolean schemFormat) { WorldData world = new BukkitWorld(player.getWorld()).getWorldData(); Clipboard clipboard; try { @@ -86,7 +124,8 @@ class Schematic_8 { getWorldEditPlugin().getWorldEdit().getSessionManager().get(actor).setClipboard(new ClipboardHolder(clipboard, world)); } - static Clipboard getClipboard(InputStream is, boolean schemFormat) throws IOException { + @Override + public Clipboard getClipboard(InputStream is, boolean schemFormat) throws IOException { if(schemFormat) return new SpongeSchematicReader(new NBTInputStream(is)).read(WorldEdit.getInstance().getServer().getWorlds().get(0).getWorldData()); else @@ -97,7 +136,7 @@ class Schematic_8 { return (WorldEditPlugin) Bukkit.getPluginManager().getPlugin("WorldEdit"); } - public static class SpongeSchematicReader implements ClipboardReader { + private static class SpongeSchematicReader implements ClipboardReader { private final NBTInputStream inputStream; private int schematicVersion = -1; @@ -132,7 +171,7 @@ class Schematic_8 { } private BlockArrayClipboard readSchematic(CompoundTag schematicTag) throws IOException { - final Map ids = IDConverter.getMap(); + final Map ids = IDConverter8.getMap(); Map schematic = schematicTag.getValue(); int width = (requireTag(schematic, "Width", ShortTag.class)).getValue(); @@ -181,7 +220,7 @@ class Schematic_8 { String palettePart = iterator.next(); id = requireTag(paletteObject, palettePart, IntTag.class).getValue(); - IDConverter.BlockTypeID blockID = ids.get(palettePart); + IDConverter8.BlockTypeID blockID = ids.get(palettePart); if(blockID == null){ blockID = ids.get(palettePart.split("\\[")[0]); } diff --git a/SpigotCore_8/src/de/steamwar/sql/IDConverter.java b/SpigotCore_8/src/de/steamwar/core/IDConverter8.java similarity index 90% rename from SpigotCore_8/src/de/steamwar/sql/IDConverter.java rename to SpigotCore_8/src/de/steamwar/core/IDConverter8.java index b503bde..fdbf70b 100644 --- a/SpigotCore_8/src/de/steamwar/sql/IDConverter.java +++ b/SpigotCore_8/src/de/steamwar/core/IDConverter8.java @@ -17,7 +17,7 @@ along with this program. If not, see . */ -package de.steamwar.sql; +package de.steamwar.core; import org.bukkit.configuration.file.YamlConfiguration; @@ -26,12 +26,12 @@ import java.util.HashMap; import java.util.Map; import java.util.Objects; -class IDConverter { - private IDConverter(){} +class IDConverter8 { + private IDConverter8(){} static Map getMap(){ Map ids = new HashMap<>(); - YamlConfiguration legacy = YamlConfiguration.loadConfiguration(new InputStreamReader(Objects.requireNonNull(IDConverter.class.getClassLoader().getResourceAsStream("legacy.yml")))); + YamlConfiguration legacy = YamlConfiguration.loadConfiguration(new InputStreamReader(Objects.requireNonNull(IDConverter8.class.getClassLoader().getResourceAsStream("legacy.yml")))); for(String blockString : legacy.getKeys(false)){ String blockNum = legacy.getString(blockString); String[] block = blockNum.split(":"); diff --git a/SpigotCore_8/src/de/steamwar/core/SpigotTPS_8.java b/SpigotCore_8/src/de/steamwar/core/SpigotTPS_8.java deleted file mode 100644 index aeb94d1..0000000 --- a/SpigotCore_8/src/de/steamwar/core/SpigotTPS_8.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - 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 . -*/ - -package de.steamwar.core; - -import net.minecraft.server.v1_8_R3.MinecraftServer; - -public class SpigotTPS_8 { - - private SpigotTPS_8(){} - - static double[] getTps(){ - return MinecraftServer.getServer().recentTps; - } - -} diff --git a/SpigotCore_8/src/de/steamwar/message/Message_8.java b/SpigotCore_8/src/de/steamwar/core/WorldOfColorWrapper8.java similarity index 84% rename from SpigotCore_8/src/de/steamwar/message/Message_8.java rename to SpigotCore_8/src/de/steamwar/core/WorldOfColorWrapper8.java index 61b897b..73cf7fd 100644 --- a/SpigotCore_8/src/de/steamwar/message/Message_8.java +++ b/SpigotCore_8/src/de/steamwar/core/WorldOfColorWrapper8.java @@ -17,16 +17,16 @@ along with this program. If not, see . */ -package de.steamwar.message; +package de.steamwar.core; import org.bukkit.entity.Player; import java.util.Locale; -class Message_8 { - private Message_8(){} +public class WorldOfColorWrapper8 implements WorldOfColorWrapper.IWorldOfColorWrapper { - static Locale getLocale(Player player){ + @Override + public Locale getLocale(Player player){ return Locale.forLanguageTag(player.spigot().getLocale()); } } diff --git a/SpigotCore_9/build.gradle b/SpigotCore_9/build.gradle index a6ea4c5..e0e40ad 100644 --- a/SpigotCore_9/build.gradle +++ b/SpigotCore_9/build.gradle @@ -43,8 +43,7 @@ sourceSets { } dependencies { - implementation project(":SpigotCore_8") - implementation project(":SpigotCore_API") + implementation project(":SpigotCore_Main") compileOnly 'org.projectlombok:lombok:1.18.6' testCompileOnly 'org.projectlombok:lombok:1.18.6' @@ -52,5 +51,4 @@ dependencies { testAnnotationProcessor 'org.projectlombok:lombok:1.18.6' compileOnly files("${project.rootDir}/lib/Spigot-1.9.jar") - compileOnly files("${project.rootDir}/lib/WorldEdit-1.12.jar") } diff --git a/SpigotCore_9/src/de/steamwar/comms/BungeeReceiver_9.java b/SpigotCore_9/src/de/steamwar/core/BountifulWrapper9.java similarity index 85% rename from SpigotCore_9/src/de/steamwar/comms/BungeeReceiver_9.java rename to SpigotCore_9/src/de/steamwar/core/BountifulWrapper9.java index 685b65a..632606c 100644 --- a/SpigotCore_9/src/de/steamwar/comms/BungeeReceiver_9.java +++ b/SpigotCore_9/src/de/steamwar/core/BountifulWrapper9.java @@ -17,14 +17,15 @@ along with this program. If not, see . */ -package de.steamwar.comms; +package de.steamwar.core; import org.bukkit.Sound; import org.bukkit.entity.Player; -public class BungeeReceiver_9 { +public class BountifulWrapper9 implements BountifulWrapper.IBountifulWrapper { - public static void playpling(Player player) { + @Override + public void playPling(Player player) { player.playSound(player.getLocation(), Sound.ENTITY_EXPERIENCE_ORB_PICKUP, 1, 1); } } diff --git a/SpigotCore_9/src/de/steamwar/chunk/Chunk_9.java b/SpigotCore_9/src/de/steamwar/core/CraftbukkitWrapper9.java similarity index 74% rename from SpigotCore_9/src/de/steamwar/chunk/Chunk_9.java rename to SpigotCore_9/src/de/steamwar/core/CraftbukkitWrapper9.java index b4792fa..6cce09e 100644 --- a/SpigotCore_9/src/de/steamwar/chunk/Chunk_9.java +++ b/SpigotCore_9/src/de/steamwar/core/CraftbukkitWrapper9.java @@ -1,6 +1,6 @@ -/* +/* 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 @@ -17,17 +17,24 @@ along with this program. If not, see . */ -package de.steamwar.chunk; +package de.steamwar.core; +import net.minecraft.server.v1_9_R2.MinecraftServer; import net.minecraft.server.v1_9_R2.PacketPlayOutMapChunk; import org.bukkit.craftbukkit.v1_9_R2.CraftChunk; import org.bukkit.craftbukkit.v1_9_R2.entity.CraftPlayer; import org.bukkit.entity.Player; -public class Chunk_9 { - private Chunk_9(){} +public class CraftbukkitWrapper9 implements CraftbukkitWrapper.ICraftbukkitWrapper { - public static void sendChunk(Player p, int chunkX, int chunkZ){ + @Override + public void sendChunk(Player p, int chunkX, int chunkZ) { ((CraftPlayer)p).getHandle().playerConnection.sendPacket(new PacketPlayOutMapChunk(((CraftChunk)p.getWorld().getChunkAt(chunkX, chunkZ)).getHandle(), 65535)); } + + @SuppressWarnings("deprecation") + @Override + public double[] getSpigotTPS() { + return MinecraftServer.getServer().recentTps; + } } diff --git a/SpigotCore_9/src/de/steamwar/core/SpigotTPS_9.java b/SpigotCore_9/src/de/steamwar/core/SpigotTPS_9.java deleted file mode 100644 index 6a0ba28..0000000 --- a/SpigotCore_9/src/de/steamwar/core/SpigotTPS_9.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - 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 . -*/ - -package de.steamwar.core; - -import net.minecraft.server.v1_9_R2.MinecraftServer; - -public class SpigotTPS_9 { - - private SpigotTPS_9(){} - - static double[] getTps(){ - return MinecraftServer.getServer().recentTps; - } - -} diff --git a/SpigotCore_API/build.gradle b/SpigotCore_API/build.gradle deleted file mode 100644 index f2bf8a1..0000000 --- a/SpigotCore_API/build.gradle +++ /dev/null @@ -1,52 +0,0 @@ -/* - * 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 . - */ - -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.6' - testCompileOnly 'org.projectlombok:lombok:1.18.6' - annotationProcessor 'org.projectlombok:lombok:1.18.6' - testAnnotationProcessor 'org.projectlombok:lombok:1.18.6' - - compileOnly files("${project.rootDir}/lib/Spigot-1.15.jar") -} \ No newline at end of file diff --git a/SpigotCore_API/settings.gradle b/SpigotCore_API/settings.gradle deleted file mode 100644 index ada3e44..0000000 --- a/SpigotCore_API/settings.gradle +++ /dev/null @@ -1,20 +0,0 @@ -/* - * 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 = 'SpigotCore_API' \ No newline at end of file diff --git a/SpigotCore_Main/build.gradle b/SpigotCore_Main/build.gradle index 78a10e1..06f85b7 100644 --- a/SpigotCore_Main/build.gradle +++ b/SpigotCore_Main/build.gradle @@ -43,14 +43,6 @@ sourceSets { } dependencies { - implementation project(":SpigotCore_8") - implementation project(":SpigotCore_9") - implementation project(":SpigotCore_10") - implementation project(":SpigotCore_12") - implementation project(":SpigotCore_14") - implementation project(":SpigotCore_15") - implementation project(":SpigotCore_API") - compileOnly 'org.projectlombok:lombok:1.18.6' testCompileOnly 'org.projectlombok:lombok:1.18.6' annotationProcessor 'org.projectlombok:lombok:1.18.6' @@ -58,7 +50,6 @@ dependencies { compileOnly files("${project.rootDir}/lib/Spigot-1.15.jar") compileOnly files("${project.rootDir}/lib/WorldEdit-1.12.jar") - compileOnly files("${project.rootDir}/lib/ProtocolLib.jar") compileOnly 'net.wesjd:anvilgui:1.4.0-SNAPSHOT' } diff --git a/SpigotCore_Main/src/com/comphenix/tinyprotocol/Reflection.java b/SpigotCore_Main/src/com/comphenix/tinyprotocol/Reflection.java new file mode 100644 index 0000000..1e18232 --- /dev/null +++ b/SpigotCore_Main/src/com/comphenix/tinyprotocol/Reflection.java @@ -0,0 +1,411 @@ +package com.comphenix.tinyprotocol; + +import org.bukkit.Bukkit; + +import java.lang.reflect.Constructor; +import java.lang.reflect.Field; +import java.lang.reflect.Method; +import java.util.Arrays; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +/** + * An utility class that simplifies reflection in Bukkit plugins. + * + * @author Kristian + */ +public final class Reflection { + /** + * An interface for invoking a specific constructor. + */ + public interface ConstructorInvoker { + /** + * Invoke a constructor for a specific class. + * + * @param arguments - the arguments to pass to the constructor. + * @return The constructed object. + */ + public Object invoke(Object... arguments); + } + + /** + * An interface for invoking a specific method. + */ + public interface MethodInvoker { + /** + * Invoke a method on a specific target object. + * + * @param target - the target object, or NULL for a static method. + * @param arguments - the arguments to pass to the method. + * @return The return value, or NULL if is void. + */ + public Object invoke(Object target, Object... arguments); + } + + /** + * An interface for retrieving the field content. + * + * @param - field type. + */ + public interface FieldAccessor { + /** + * Retrieve the content of a field. + * + * @param target - the target object, or NULL for a static field. + * @return The value of the field. + */ + public T get(Object target); + + /** + * Set the content of a field. + * + * @param target - the target object, or NULL for a static field. + * @param value - the new value of the field. + */ + public void set(Object target, Object value); + + /** + * Determine if the given object has this field. + * + * @param target - the object to test. + * @return TRUE if it does, FALSE otherwise. + */ + public boolean hasField(Object target); + } + + // Deduce the net.minecraft.server.v* package + private static String OBC_PREFIX = Bukkit.getServer().getClass().getPackage().getName(); + private static String NMS_PREFIX = OBC_PREFIX.replace("org.bukkit.craftbukkit", "net.minecraft.server"); + private static String VERSION = OBC_PREFIX.replace("org.bukkit.craftbukkit", "").replace(".", ""); + + // Variable replacement + private static Pattern MATCH_VARIABLE = Pattern.compile("\\{([^\\}]+)\\}"); + + private Reflection() { + // Seal class + } + + /** + * Retrieve a field accessor for a specific field type and name. + * + * @param target - the target type. + * @param name - the name of the field, or NULL to ignore. + * @param fieldType - a compatible field type. + * @return The field accessor. + */ + public static FieldAccessor getField(Class target, String name, Class fieldType) { + return getField(target, name, fieldType, 0); + } + + /** + * Retrieve a field accessor for a specific field type and name. + * + * @param className - lookup name of the class, see {@link #getClass(String)}. + * @param name - the name of the field, or NULL to ignore. + * @param fieldType - a compatible field type. + * @return The field accessor. + */ + public static FieldAccessor getField(String className, String name, Class fieldType) { + return getField(getClass(className), name, fieldType, 0); + } + + /** + * Retrieve a field accessor for a specific field type and name. + * + * @param target - the target type. + * @param fieldType - a compatible field type. + * @param index - the number of compatible fields to skip. + * @return The field accessor. + */ + public static FieldAccessor getField(Class target, Class fieldType, int index) { + return getField(target, null, fieldType, index); + } + + /** + * Retrieve a field accessor for a specific field type and name. + * + * @param className - lookup name of the class, see {@link #getClass(String)}. + * @param fieldType - a compatible field type. + * @param index - the number of compatible fields to skip. + * @return The field accessor. + */ + public static FieldAccessor getField(String className, Class fieldType, int index) { + return getField(getClass(className), fieldType, index); + } + + // Common method + private static FieldAccessor getField(Class target, String name, Class fieldType, int index) { + for (final Field field : target.getDeclaredFields()) { + if ((name == null || field.getName().equals(name)) && fieldType.isAssignableFrom(field.getType()) && index-- <= 0) { + field.setAccessible(true); + + // A function for retrieving a specific field value + return new FieldAccessor() { + + @Override + @SuppressWarnings("unchecked") + public T get(Object target) { + try { + return (T) field.get(target); + } catch (IllegalAccessException e) { + throw new RuntimeException("Cannot access reflection.", e); + } + } + + @Override + public void set(Object target, Object value) { + try { + field.set(target, value); + } catch (IllegalAccessException e) { + throw new RuntimeException("Cannot access reflection.", e); + } + } + + @Override + public boolean hasField(Object target) { + // target instanceof DeclaringClass + return field.getDeclaringClass().isAssignableFrom(target.getClass()); + } + }; + } + } + + // Search in parent classes + if (target.getSuperclass() != null) + return getField(target.getSuperclass(), name, fieldType, index); + + throw new IllegalArgumentException("Cannot find field with type " + fieldType); + } + + /** + * Search for the first publicly and privately defined method of the given name and parameter count. + * + * @param className - lookup name of the class, see {@link #getClass(String)}. + * @param methodName - the method name, or NULL to skip. + * @param params - the expected parameters. + * @return An object that invokes this specific method. + * @throws IllegalStateException If we cannot find this method. + */ + public static MethodInvoker getMethod(String className, String methodName, Class... params) { + return getTypedMethod(getClass(className), methodName, null, params); + } + + /** + * Search for the first publicly and privately defined method of the given name and parameter count. + * + * @param clazz - a class to start with. + * @param methodName - the method name, or NULL to skip. + * @param params - the expected parameters. + * @return An object that invokes this specific method. + * @throws IllegalStateException If we cannot find this method. + */ + public static MethodInvoker getMethod(Class clazz, String methodName, Class... params) { + return getTypedMethod(clazz, methodName, null, params); + } + + /** + * Search for the first publicly and privately defined method of the given name and parameter count. + * + * @param clazz - a class to start with. + * @param methodName - the method name, or NULL to skip. + * @param returnType - the expected return type, or NULL to ignore. + * @param params - the expected parameters. + * @return An object that invokes this specific method. + * @throws IllegalStateException If we cannot find this method. + */ + public static MethodInvoker getTypedMethod(Class clazz, String methodName, Class returnType, Class... params) { + for (final Method method : clazz.getDeclaredMethods()) { + if ((methodName == null || method.getName().equals(methodName)) + && (returnType == null || method.getReturnType().equals(returnType)) + && Arrays.equals(method.getParameterTypes(), params)) { + method.setAccessible(true); + + return new MethodInvoker() { + + @Override + public Object invoke(Object target, Object... arguments) { + try { + return method.invoke(target, arguments); + } catch (Exception e) { + throw new RuntimeException("Cannot invoke method " + method, e); + } + } + + }; + } + } + + // Search in every superclass + if (clazz.getSuperclass() != null) + return getMethod(clazz.getSuperclass(), methodName, params); + + throw new IllegalStateException(String.format("Unable to find method %s (%s).", methodName, Arrays.asList(params))); + } + + /** + * Search for the first publically and privately defined constructor of the given name and parameter count. + * + * @param className - lookup name of the class, see {@link #getClass(String)}. + * @param params - the expected parameters. + * @return An object that invokes this constructor. + * @throws IllegalStateException If we cannot find this method. + */ + public static ConstructorInvoker getConstructor(String className, Class... params) { + return getConstructor(getClass(className), params); + } + + /** + * Search for the first publically and privately defined constructor of the given name and parameter count. + * + * @param clazz - a class to start with. + * @param params - the expected parameters. + * @return An object that invokes this constructor. + * @throws IllegalStateException If we cannot find this method. + */ + public static ConstructorInvoker getConstructor(Class clazz, Class... params) { + for (final Constructor constructor : clazz.getDeclaredConstructors()) { + if (Arrays.equals(constructor.getParameterTypes(), params)) { + constructor.setAccessible(true); + + return new ConstructorInvoker() { + + @Override + public Object invoke(Object... arguments) { + try { + return constructor.newInstance(arguments); + } catch (Exception e) { + throw new RuntimeException("Cannot invoke constructor " + constructor, e); + } + } + + }; + } + } + + throw new IllegalStateException(String.format("Unable to find constructor for %s (%s).", clazz, Arrays.asList(params))); + } + + /** + * Retrieve a class from its full name, without knowing its type on compile time. + *

+ * This is useful when looking up fields by a NMS or OBC type. + *

+ * + * @see {@link #getClass()} for more information. + * @param lookupName - the class name with variables. + * @return The class. + */ + public static Class getUntypedClass(String lookupName) { + @SuppressWarnings({ "rawtypes", "unchecked" }) + Class clazz = (Class) getClass(lookupName); + return clazz; + } + + /** + * Retrieve a class from its full name. + *

+ * Strings enclosed with curly brackets - such as {TEXT} - will be replaced according to the following table: + *

+ * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
VariableContent
{nms}Actual package name of net.minecraft.server.VERSION
{obc}Actual pacakge name of org.bukkit.craftbukkit.VERSION
{version}The current Minecraft package VERSION, if any.
+ * + * @param lookupName - the class name with variables. + * @return The looked up class. + * @throws IllegalArgumentException If a variable or class could not be found. + */ + public static Class getClass(String lookupName) { + return getCanonicalClass(expandVariables(lookupName)); + } + + /** + * Retrieve a class in the net.minecraft.server.VERSION.* package. + * + * @param name - the name of the class, excluding the package. + * @throws IllegalArgumentException If the class doesn't exist. + */ + public static Class getMinecraftClass(String name) { + return getCanonicalClass(NMS_PREFIX + "." + name); + } + + /** + * Retrieve a class in the org.bukkit.craftbukkit.VERSION.* package. + * + * @param name - the name of the class, excluding the package. + * @throws IllegalArgumentException If the class doesn't exist. + */ + public static Class getCraftBukkitClass(String name) { + return getCanonicalClass(OBC_PREFIX + "." + name); + } + + /** + * Retrieve a class by its canonical name. + * + * @param canonicalName - the canonical name. + * @return The class. + */ + private static Class getCanonicalClass(String canonicalName) { + try { + return Class.forName(canonicalName); + } catch (ClassNotFoundException e) { + throw new IllegalArgumentException("Cannot find " + canonicalName, e); + } + } + + /** + * Expand variables such as "{nms}" and "{obc}" to their corresponding packages. + * + * @param name - the full name of the class. + * @return The expanded string. + */ + private static String expandVariables(String name) { + StringBuffer output = new StringBuffer(); + Matcher matcher = MATCH_VARIABLE.matcher(name); + + while (matcher.find()) { + String variable = matcher.group(1); + String replacement = ""; + + // Expand all detected variables + if ("nms".equalsIgnoreCase(variable)) + replacement = NMS_PREFIX; + else if ("obc".equalsIgnoreCase(variable)) + replacement = OBC_PREFIX; + else if ("version".equalsIgnoreCase(variable)) + replacement = VERSION; + else + throw new IllegalArgumentException("Unknown variable: " + variable); + + // Assume the expanded variables are all packages, and append a dot + if (replacement.length() > 0 && matcher.end() < name.length() && name.charAt(matcher.end()) != '.') + replacement += "."; + matcher.appendReplacement(output, Matcher.quoteReplacement(replacement)); + } + + matcher.appendTail(output); + return output.toString(); + } + + public static Object newInstance(Class clazz) { + try { + return clazz.newInstance(); + } catch (InstantiationException | IllegalAccessException e) { + throw new SecurityException("Could not create object", e); + } + } +} diff --git a/SpigotCore_Main/src/com/comphenix/tinyprotocol/TinyProtocol.java b/SpigotCore_Main/src/com/comphenix/tinyprotocol/TinyProtocol.java new file mode 100644 index 0000000..3f754f3 --- /dev/null +++ b/SpigotCore_Main/src/com/comphenix/tinyprotocol/TinyProtocol.java @@ -0,0 +1,509 @@ +package com.comphenix.tinyprotocol; + +import com.comphenix.tinyprotocol.Reflection.FieldAccessor; +import com.comphenix.tinyprotocol.Reflection.MethodInvoker; +import com.google.common.collect.Lists; +import com.google.common.collect.MapMaker; +import com.mojang.authlib.GameProfile; +import io.netty.channel.*; +import org.bukkit.Bukkit; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.HandlerList; +import org.bukkit.event.Listener; +import org.bukkit.event.player.PlayerLoginEvent; +import org.bukkit.event.server.PluginDisableEvent; +import org.bukkit.plugin.Plugin; +import org.bukkit.scheduler.BukkitRunnable; + +import java.util.*; +import java.util.concurrent.atomic.AtomicInteger; +import java.util.logging.Level; + +/** + * Represents a very tiny alternative to ProtocolLib. + *

+ * It now supports intercepting packets during login and status ping (such as OUT_SERVER_PING)! + * + * @author Kristian + */ +public abstract class TinyProtocol { + private static final AtomicInteger ID = new AtomicInteger(0); + + // Used in order to lookup a channel + private static final MethodInvoker getPlayerHandle = Reflection.getMethod("{obc}.entity.CraftPlayer", "getHandle"); + private static final FieldAccessor getConnection = Reflection.getField("{nms}.EntityPlayer", "playerConnection", Object.class); + private static final FieldAccessor getManager = Reflection.getField("{nms}.PlayerConnection", "networkManager", Object.class); + private static final FieldAccessor getChannel = Reflection.getField("{nms}.NetworkManager", Channel.class, 0); + + // Looking up ServerConnection + private static final Class minecraftServerClass = Reflection.getUntypedClass("{nms}.MinecraftServer"); + private static final Class serverConnectionClass = Reflection.getUntypedClass("{nms}.ServerConnection"); + private static final FieldAccessor getMinecraftServer = Reflection.getField("{obc}.CraftServer", minecraftServerClass, 0); + private static final FieldAccessor getServerConnection = Reflection.getField(minecraftServerClass, serverConnectionClass, 0); + private static final MethodInvoker getNetworkMarkers = Reflection.getTypedMethod(serverConnectionClass, null, List.class, serverConnectionClass); + + // Packets we have to intercept + private static final Class PACKET_LOGIN_IN_START = Reflection.getMinecraftClass("PacketLoginInStart"); + private static final FieldAccessor getGameProfile = Reflection.getField(PACKET_LOGIN_IN_START, GameProfile.class, 0); + + // Speedup channel lookup + private Map channelLookup = new MapMaker().weakValues().makeMap(); + private Listener listener; + + // Channels that have already been removed + private Set uninjectedChannels = Collections.newSetFromMap(new MapMaker().weakKeys().makeMap()); + + // List of network markers + private List networkManagers; + + // Injected channel handlers + private List serverChannels = Lists.newArrayList(); + private ChannelInboundHandlerAdapter serverChannelHandler; + private ChannelInitializer beginInitProtocol; + private ChannelInitializer endInitProtocol; + + // Current handler name + private String handlerName; + + protected volatile boolean closed; + protected Plugin plugin; + + /** + * Construct a new instance of TinyProtocol, and start intercepting packets for all connected clients and future clients. + *

+ * You can construct multiple instances per plugin. + * + * @param plugin - the plugin. + */ + public TinyProtocol(final Plugin plugin) { + this.plugin = plugin; + + // Compute handler name + this.handlerName = getHandlerName(); + + // Prepare existing players + registerBukkitEvents(); + + try { + registerChannelHandler(); + registerPlayers(plugin); + } catch (IllegalArgumentException ex) { + // Damn you, late bind + plugin.getLogger().info("[TinyProtocol] Delaying server channel injection due to late bind."); + + new BukkitRunnable() { + @Override + public void run() { + registerChannelHandler(); + registerPlayers(plugin); + plugin.getLogger().info("[TinyProtocol] Late bind injection successful."); + } + }.runTask(plugin); + } + } + + private void createServerChannelHandler() { + // Handle connected channels + endInitProtocol = new ChannelInitializer() { + + @Override + protected void initChannel(Channel channel) throws Exception { + try { + // This can take a while, so we need to stop the main thread from interfering + synchronized (networkManagers) { + // Stop injecting channels + if (!closed) { + channel.eventLoop().submit(() -> injectChannelInternal(channel)); + } + } + } catch (Exception e) { + plugin.getLogger().log(Level.SEVERE, "Cannot inject incomming channel " + channel, e); + } + } + + }; + + // This is executed before Minecraft's channel handler + beginInitProtocol = new ChannelInitializer() { + + @Override + protected void initChannel(Channel channel) throws Exception { + channel.pipeline().addLast(endInitProtocol); + } + + }; + + serverChannelHandler = new ChannelInboundHandlerAdapter() { + + @Override + public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception { + Channel channel = (Channel) msg; + + // Prepare to initialize ths channel + channel.pipeline().addFirst(beginInitProtocol); + ctx.fireChannelRead(msg); + } + + }; + } + + /** + * Register bukkit events. + */ + private void registerBukkitEvents() { + listener = new Listener() { + + @EventHandler(priority = EventPriority.LOWEST) + public final void onPlayerLogin(PlayerLoginEvent e) { + if (closed) + return; + + Channel channel = getChannel(e.getPlayer()); + + // Don't inject players that have been explicitly uninjected + if (!uninjectedChannels.contains(channel)) { + injectPlayer(e.getPlayer()); + } + } + + @EventHandler + public final void onPluginDisable(PluginDisableEvent e) { + if (e.getPlugin().equals(plugin)) { + close(); + } + } + + }; + + plugin.getServer().getPluginManager().registerEvents(listener, plugin); + } + + @SuppressWarnings("unchecked") + private void registerChannelHandler() { + Object mcServer = getMinecraftServer.get(Bukkit.getServer()); + Object serverConnection = getServerConnection.get(mcServer); + boolean looking = true; + + // We need to synchronize against this list + networkManagers = (List) getNetworkMarkers.invoke(null, serverConnection); + createServerChannelHandler(); + + // Find the correct list, or implicitly throw an exception + for (int i = 0; looking; i++) { + List list = Reflection.getField(serverConnection.getClass(), List.class, i).get(serverConnection); + + for (Object item : list) { + if (!ChannelFuture.class.isInstance(item)) + break; + + // Channel future that contains the server connection + Channel serverChannel = ((ChannelFuture) item).channel(); + + serverChannels.add(serverChannel); + serverChannel.pipeline().addFirst(serverChannelHandler); + looking = false; + } + } + } + + private void unregisterChannelHandler() { + if (serverChannelHandler == null) + return; + + for (Channel serverChannel : serverChannels) { + final ChannelPipeline pipeline = serverChannel.pipeline(); + + // Remove channel handler + serverChannel.eventLoop().execute(new Runnable() { + + @Override + public void run() { + try { + pipeline.remove(serverChannelHandler); + } catch (NoSuchElementException e) { + // That's fine + } + } + + }); + } + } + + private void registerPlayers(Plugin plugin) { + for (Player player : plugin.getServer().getOnlinePlayers()) { + injectPlayer(player); + } + } + + /** + * Invoked when the server is starting to send a packet to a player. + *

+ * Note that this is not executed on the main thread. + * + * @param receiver - the receiving player, NULL for early login/status packets. + * @param channel - the channel that received the packet. Never NULL. + * @param packet - the packet being sent. + * @return The packet to send instead, or NULL to cancel the transmission. + */ + public Object onPacketOutAsync(Player receiver, Channel channel, Object packet) { + return packet; + } + + /** + * Invoked when the server has received a packet from a given player. + *

+ * Use {@link Channel#remoteAddress()} to get the remote address of the client. + * + * @param sender - the player that sent the packet, NULL for early login/status packets. + * @param channel - channel that received the packet. Never NULL. + * @param packet - the packet being received. + * @return The packet to recieve instead, or NULL to cancel. + */ + public Object onPacketInAsync(Player sender, Channel channel, Object packet) { + return packet; + } + + /** + * Send a packet to a particular player. + *

+ * Note that {@link #onPacketOutAsync(Player, Channel, Object)} will be invoked with this packet. + * + * @param player - the destination player. + * @param packet - the packet to send. + */ + public void sendPacket(Player player, Object packet) { + sendPacket(getChannel(player), packet); + } + + /** + * Send a packet to a particular client. + *

+ * Note that {@link #onPacketOutAsync(Player, Channel, Object)} will be invoked with this packet. + * + * @param channel - client identified by a channel. + * @param packet - the packet to send. + */ + public void sendPacket(Channel channel, Object packet) { + channel.pipeline().writeAndFlush(packet); + } + + /** + * Pretend that a given packet has been received from a player. + *

+ * Note that {@link #onPacketInAsync(Player, Channel, Object)} will be invoked with this packet. + * + * @param player - the player that sent the packet. + * @param packet - the packet that will be received by the server. + */ + public void receivePacket(Player player, Object packet) { + receivePacket(getChannel(player), packet); + } + + /** + * Pretend that a given packet has been received from a given client. + *

+ * Note that {@link #onPacketInAsync(Player, Channel, Object)} will be invoked with this packet. + * + * @param channel - client identified by a channel. + * @param packet - the packet that will be received by the server. + */ + public void receivePacket(Channel channel, Object packet) { + channel.pipeline().context("encoder").fireChannelRead(packet); + } + + /** + * Retrieve the name of the channel injector, default implementation is "tiny-" + plugin name + "-" + a unique ID. + *

+ * Note that this method will only be invoked once. It is no longer necessary to override this to support multiple instances. + * + * @return A unique channel handler name. + */ + protected String getHandlerName() { + return "tiny-" + plugin.getName() + "-" + ID.incrementAndGet(); + } + + /** + * Add a custom channel handler to the given player's channel pipeline, allowing us to intercept sent and received packets. + *

+ * This will automatically be called when a player has logged in. + * + * @param player - the player to inject. + */ + public void injectPlayer(Player player) { + injectChannelInternal(getChannel(player)).player = player; + } + + /** + * Add a custom channel handler to the given channel. + * + * @param channel - the channel to inject. + * @return The intercepted channel, or NULL if it has already been injected. + */ + public void injectChannel(Channel channel) { + injectChannelInternal(channel); + } + + /** + * Add a custom channel handler to the given channel. + * + * @param channel - the channel to inject. + * @return The packet interceptor. + */ + private PacketInterceptor injectChannelInternal(Channel channel) { + try { + PacketInterceptor interceptor = (PacketInterceptor) channel.pipeline().get(handlerName); + + // Inject our packet interceptor + if (interceptor == null) { + interceptor = new PacketInterceptor(); + channel.pipeline().addBefore("packet_handler", handlerName, interceptor); + uninjectedChannels.remove(channel); + } + + return interceptor; + } catch (IllegalArgumentException e) { + // Try again + return (PacketInterceptor) channel.pipeline().get(handlerName); + } + } + + /** + * Retrieve the Netty channel associated with a player. This is cached. + * + * @param player - the player. + * @return The Netty channel. + */ + public Channel getChannel(Player player) { + Channel channel = channelLookup.get(player.getName()); + + // Lookup channel again + if (channel == null) { + Object connection = getConnection.get(getPlayerHandle.invoke(player)); + Object manager = getManager.get(connection); + + channelLookup.put(player.getName(), channel = getChannel.get(manager)); + } + + return channel; + } + + /** + * Uninject a specific player. + * + * @param player - the injected player. + */ + public void uninjectPlayer(Player player) { + uninjectChannel(getChannel(player)); + } + + /** + * Uninject a specific channel. + *

+ * This will also disable the automatic channel injection that occurs when a player has properly logged in. + * + * @param channel - the injected channel. + */ + public void uninjectChannel(final Channel channel) { + // No need to guard against this if we're closing + if (!closed) { + uninjectedChannels.add(channel); + } + + // See ChannelInjector in ProtocolLib, line 590 + channel.eventLoop().execute(new Runnable() { + + @Override + public void run() { + channel.pipeline().remove(handlerName); + } + + }); + } + + /** + * Determine if the given player has been injected by TinyProtocol. + * + * @param player - the player. + * @return TRUE if it is, FALSE otherwise. + */ + public boolean hasInjected(Player player) { + return hasInjected(getChannel(player)); + } + + /** + * Determine if the given channel has been injected by TinyProtocol. + * + * @param channel - the channel. + * @return TRUE if it is, FALSE otherwise. + */ + public boolean hasInjected(Channel channel) { + return channel.pipeline().get(handlerName) != null; + } + + /** + * Cease listening for packets. This is called automatically when your plugin is disabled. + */ + public final void close() { + if (!closed) { + closed = true; + + // Remove our handlers + for (Player player : plugin.getServer().getOnlinePlayers()) { + uninjectPlayer(player); + } + + // Clean up Bukkit + HandlerList.unregisterAll(listener); + unregisterChannelHandler(); + } + } + + /** + * Channel handler that is inserted into the player's channel pipeline, allowing us to intercept sent and received packets. + * + * @author Kristian + */ + private final class PacketInterceptor extends ChannelDuplexHandler { + // Updated by the login event + public volatile Player player; + + @Override + public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception { + // Intercept channel + final Channel channel = ctx.channel(); + handleLoginStart(channel, msg); + + try { + msg = onPacketInAsync(player, channel, msg); + } catch (Exception e) { + plugin.getLogger().log(Level.SEVERE, "Error in onPacketInAsync().", e); + } + + if (msg != null) { + super.channelRead(ctx, msg); + } + } + + @Override + public void write(ChannelHandlerContext ctx, Object msg, ChannelPromise promise) throws Exception { + try { + msg = onPacketOutAsync(player, ctx.channel(), msg); + } catch (Exception e) { + plugin.getLogger().log(Level.SEVERE, "Error in onPacketOutAsync().", e); + } + + if (msg != null) { + super.write(ctx, msg, promise); + } + } + + private void handleLoginStart(Channel channel, Object packet) { + if (PACKET_LOGIN_IN_START.isInstance(packet)) { + GameProfile profile = getGameProfile.get(packet); + channelLookup.put(profile.getName(), channel); + } + } + } +} diff --git a/SpigotCore_15/src/de/steamwar/authlib/AuthlibInjector_15.java b/SpigotCore_Main/src/de/steamwar/authlib/AuthlibInjector_15.java similarity index 100% rename from SpigotCore_15/src/de/steamwar/authlib/AuthlibInjector_15.java rename to SpigotCore_Main/src/de/steamwar/authlib/AuthlibInjector_15.java diff --git a/SpigotCore_Main/src/de/steamwar/comms/BungeeReceiver.java b/SpigotCore_Main/src/de/steamwar/comms/BungeeReceiver.java index 594e82b..021414e 100644 --- a/SpigotCore_Main/src/de/steamwar/comms/BungeeReceiver.java +++ b/SpigotCore_Main/src/de/steamwar/comms/BungeeReceiver.java @@ -23,8 +23,9 @@ import com.google.common.io.ByteArrayDataInput; import com.google.common.io.ByteStreams; import de.steamwar.comms.handlers.BungeeHandler; import de.steamwar.comms.handlers.InventoryHandler; -import de.steamwar.core.VersionedRunnable; -import de.steamwar.sql.*; +import de.steamwar.core.BountifulWrapper; +import de.steamwar.sql.BauweltMember; +import de.steamwar.sql.SteamwarUser; import org.bukkit.Bukkit; import org.bukkit.entity.Player; import org.bukkit.plugin.messaging.PluginMessageListener; @@ -46,8 +47,7 @@ public class BungeeReceiver implements PluginMessageListener { UUID uuid = SteamwarUser.get(byteArrayDataInput.readInt()).getUUID(); if(Bukkit.getPlayer(uuid).isOnline()) { Player player = Bukkit.getPlayer(uuid); - VersionedRunnable.call(new VersionedRunnable(() -> BungeeReceiver_8.playPling(player), 8), - new VersionedRunnable(() -> BungeeReceiver_9.playpling(player), 9)); + BountifulWrapper.impl.playPling(player); } }); diff --git a/SpigotCore_Main/src/de/steamwar/core/BountifulWrapper.java b/SpigotCore_Main/src/de/steamwar/core/BountifulWrapper.java new file mode 100644 index 0000000..26069de --- /dev/null +++ b/SpigotCore_Main/src/de/steamwar/core/BountifulWrapper.java @@ -0,0 +1,32 @@ +/* + 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 . +*/ + +package de.steamwar.core; + +import org.bukkit.entity.Player; + +public class BountifulWrapper { + private BountifulWrapper() {} + + public static final IBountifulWrapper impl = VersionDependent.getVersionImpl(Core.getInstance()); + + public interface IBountifulWrapper { + void playPling(Player player); + } +} diff --git a/SpigotCore_Main/src/de/steamwar/core/CraftbukkitWrapper.java b/SpigotCore_Main/src/de/steamwar/core/CraftbukkitWrapper.java new file mode 100644 index 0000000..f3ad54e --- /dev/null +++ b/SpigotCore_Main/src/de/steamwar/core/CraftbukkitWrapper.java @@ -0,0 +1,33 @@ +/* + This file is a part of the SteamWar software. + + Copyright (C) 2021 SteamWar.de-Serverteam + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see . +*/ + +package de.steamwar.core; + +import org.bukkit.entity.Player; + +public class CraftbukkitWrapper { + private CraftbukkitWrapper() {} + + public static final ICraftbukkitWrapper impl = VersionDependent.getVersionImpl(Core.getInstance()); + + public interface ICraftbukkitWrapper { + void sendChunk(Player p, int chunkX, int chunkZ); + double[] getSpigotTPS(); + } +} diff --git a/SpigotCore_8/src/de/steamwar/inventory/SWItem_8.java b/SpigotCore_Main/src/de/steamwar/core/FlatteningWrapper.java similarity index 50% rename from SpigotCore_8/src/de/steamwar/inventory/SWItem_8.java rename to SpigotCore_Main/src/de/steamwar/core/FlatteningWrapper.java index 746134f..17179b8 100644 --- a/SpigotCore_8/src/de/steamwar/inventory/SWItem_8.java +++ b/SpigotCore_Main/src/de/steamwar/core/FlatteningWrapper.java @@ -1,6 +1,6 @@ -/* +/* 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 @@ -17,33 +17,31 @@ along with this program. If not, see . */ -package de.steamwar.inventory; +package de.steamwar.core; +import com.sk89q.worldedit.extent.clipboard.Clipboard; import org.bukkit.Material; +import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; -import org.bukkit.inventory.meta.SkullMeta; -class SWItem_8 { - private SWItem_8(){} +import java.io.IOException; +import java.io.InputStream; - static Material getMaterial(String material){ - try{ - return Material.valueOf(material); - }catch(IllegalArgumentException e){ - return Material.STONE; - } - } +public class FlatteningWrapper { + private FlatteningWrapper() {} - static Material getDye(){ - return Material.INK_SACK; - } + public static final IFlatteningWrapper impl = VersionDependent.getVersionImpl(Core.getInstance()); + + public interface IFlatteningWrapper { + void setScoreboardTitle(Object packet, String title); + + Material getMaterial(String material); + Material getDye(int colorCode); + ItemStack setSkullOwner(String player); + + byte[] getPlayerClipboard(Player player, boolean schemFormat); + void setPlayerClipboard(Player player, InputStream is, boolean schemFormat); + Clipboard getClipboard(InputStream is, boolean schemFormat) throws IOException; - static ItemStack setSkullOwner(String player){ - ItemStack head = new ItemStack(Material.SKULL_ITEM, 1, (short) 3); - SkullMeta headmeta = (SkullMeta) head.getItemMeta(); - headmeta.setOwner(player); - headmeta.setDisplayName(player); - head.setItemMeta(headmeta); - return head; } } diff --git a/SpigotCore_Main/src/de/steamwar/core/TPSWatcher.java b/SpigotCore_Main/src/de/steamwar/core/TPSWatcher.java index cb92fcf..826213c 100644 --- a/SpigotCore_Main/src/de/steamwar/core/TPSWatcher.java +++ b/SpigotCore_Main/src/de/steamwar/core/TPSWatcher.java @@ -79,12 +79,7 @@ public class TPSWatcher { } private static double[] getSpigotTPS() { - return VersionedCallable.call(new VersionedCallable<>(SpigotTPS_8::getTps, 8), - new VersionedCallable<>(SpigotTPS_9::getTps, 9), - new VersionedCallable<>(SpigotTPS_10::getTps, 10), - new VersionedCallable<>(SpigotTPS_12::getTps, 12), - new VersionedCallable<>(SpigotTPS_14::getTps, 14), - new VersionedCallable<>(SpigotTPS_15::getTps, 15)); + return CraftbukkitWrapper.impl.getSpigotTPS(); } private static double round(double d) { diff --git a/SpigotCore_Main/src/de/steamwar/core/VersionDependent.java b/SpigotCore_Main/src/de/steamwar/core/VersionDependent.java new file mode 100644 index 0000000..5e8ec24 --- /dev/null +++ b/SpigotCore_Main/src/de/steamwar/core/VersionDependent.java @@ -0,0 +1,46 @@ +/* + This file is a part of the SteamWar software. + + Copyright (C) 2021 SteamWar.de-Serverteam + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see . +*/ + +package de.steamwar.core; + +import org.bukkit.plugin.Plugin; + +import java.lang.reflect.InvocationTargetException; + +public class VersionDependent { + private VersionDependent() {} + + public static T getVersionImpl(Plugin plugin) { + return getVersionImpl(plugin, (new Exception()).getStackTrace()[1].getClassName()); + } + + public static T getVersionImpl(Plugin plugin, String className){ + ClassLoader loader = plugin.getClass().getClassLoader(); + for(int version = Core.getVersion(); version >= 8; version--) { + try { + return ((Class) Class.forName(className + version, true, loader)).getDeclaredConstructor().newInstance(); + } catch (InstantiationException | IllegalAccessException | InvocationTargetException | NoSuchMethodException e) { + throw new SecurityException("Could not load version dependent class", e); + } catch (ClassNotFoundException e) { + // try next version + } + } + throw new SecurityException("Unable to find version dependent implementation for " + className); + } +} diff --git a/SpigotCore_Main/src/de/steamwar/core/VersionedCallable.java b/SpigotCore_Main/src/de/steamwar/core/VersionedCallable.java index 2846fb1..0da1b6f 100644 --- a/SpigotCore_Main/src/de/steamwar/core/VersionedCallable.java +++ b/SpigotCore_Main/src/de/steamwar/core/VersionedCallable.java @@ -33,6 +33,7 @@ public class VersionedCallable { this.minVersion = minVersion; } + @Deprecated public static T call(VersionedCallable... versionedCallables) { for (int i = versionedCallables.length - 1; i >= 0; i--) { VersionedCallable versionedCallable = versionedCallables[i]; diff --git a/SpigotCore_Main/src/de/steamwar/core/VersionedRunnable.java b/SpigotCore_Main/src/de/steamwar/core/VersionedRunnable.java index fc65517..604169a 100644 --- a/SpigotCore_Main/src/de/steamwar/core/VersionedRunnable.java +++ b/SpigotCore_Main/src/de/steamwar/core/VersionedRunnable.java @@ -31,6 +31,7 @@ public class VersionedRunnable { this.minVersion = minVersion; } + @Deprecated public static void call(VersionedRunnable... versionedRunnables) { for (int i = versionedRunnables.length - 1; i >= 0; i--) { VersionedRunnable versionedRunnable = versionedRunnables[i]; diff --git a/SpigotCore_Main/src/de/steamwar/core/WorldOfColorWrapper.java b/SpigotCore_Main/src/de/steamwar/core/WorldOfColorWrapper.java new file mode 100644 index 0000000..70f7269 --- /dev/null +++ b/SpigotCore_Main/src/de/steamwar/core/WorldOfColorWrapper.java @@ -0,0 +1,34 @@ +/* + 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 . +*/ + +package de.steamwar.core; + +import org.bukkit.entity.Player; + +import java.util.Locale; + +public class WorldOfColorWrapper { + private WorldOfColorWrapper() {} + + public static final IWorldOfColorWrapper impl = VersionDependent.getVersionImpl(Core.getInstance()); + + public interface IWorldOfColorWrapper { + Locale getLocale(Player player); + } +} diff --git a/SpigotCore_Main/src/de/steamwar/core/events/ChunkListener.java b/SpigotCore_Main/src/de/steamwar/core/events/ChunkListener.java index d6bf688..f61068c 100644 --- a/SpigotCore_Main/src/de/steamwar/core/events/ChunkListener.java +++ b/SpigotCore_Main/src/de/steamwar/core/events/ChunkListener.java @@ -19,64 +19,45 @@ package de.steamwar.core.events; -import com.comphenix.protocol.PacketType; -import com.comphenix.protocol.ProtocolLibrary; -import com.comphenix.protocol.events.PacketAdapter; -import com.comphenix.protocol.events.PacketContainer; -import com.comphenix.protocol.events.PacketEvent; -import com.comphenix.protocol.injector.server.TemporaryPlayer; -import com.comphenix.protocol.reflect.StructureModifier; -import de.steamwar.chunk.*; +import com.comphenix.tinyprotocol.Reflection; +import com.comphenix.tinyprotocol.TinyProtocol; import de.steamwar.core.Core; -import de.steamwar.core.VersionedRunnable; +import de.steamwar.core.CraftbukkitWrapper; import de.steamwar.sql.SteamwarUser; -import org.bukkit.Bukkit; +import io.netty.channel.Channel; import org.bukkit.entity.Player; -import java.util.logging.Level; - public class ChunkListener { private ChunkListener(){} + private static final Class mapChunkPacket = Reflection.getClass("{nms}.PacketPlayOutMapChunk"); + private static final Reflection.FieldAccessor fullChunk = Reflection.getField(mapChunkPacket, boolean.class, 0); + private static final Reflection.FieldAccessor chunkX = Reflection.getField(mapChunkPacket, int.class, 0); + private static final Reflection.FieldAccessor chunkZ = Reflection.getField(mapChunkPacket, int.class, 1); + + public static final TinyProtocol protocol = new TinyProtocol(Core.getInstance()){ + @Override + public Object onPacketOutAsync(Player receiver, Channel channel, Object packet) { + if ( + !mapChunkPacket.isInstance(packet) || + !SteamwarUser.get(receiver.getUniqueId()).isBedrock() || + fullChunk.get(packet) + ) + return packet; + + //TODO: Test ViaVersion prior or post + //TODO: Test if this can be done async? + //TODO: Nicer way: generate new and send new + CraftbukkitWrapper.impl.sendChunk(receiver, chunkX.get(packet), chunkZ.get(packet)); + return null; + } + }; + public static void init(){ - ProtocolLibrary.getProtocolManager().addPacketListener(new PacketAdapter(Core.getInstance(), PacketType.Play.Server.MAP_CHUNK) { - @Override - public void onPacketSending(PacketEvent e) { - Player p = e.getPlayer(); - if(p instanceof TemporaryPlayer) - return; - - try{ - SteamwarUser user = SteamwarUser.get(p.getUniqueId()); - if(!user.isBedrock()) - return; - }catch(UnsupportedOperationException ex){ - Bukkit.getLogger().log(Level.SEVERE, "Could not get uuid", ex); - return; - } - - PacketContainer packet = e.getPacket(); - StructureModifier fullChunk = packet.getBooleans(); - if(fullChunk.read(0)) - return; - - e.setCancelled(true); - - StructureModifier ints = packet.getIntegers(); - int chunkX = ints.read(0); - int chunkZ = ints.read(1); - - sendChunk(p, chunkX, chunkZ); - } - }); + //triggering } - public static void sendChunk(Player p, int chunkX, int chunkZ){ - VersionedRunnable.call(new VersionedRunnable(() -> Chunk_8.sendChunk(p, chunkX, chunkZ), 8), - new VersionedRunnable(() -> Chunk_9.sendChunk(p, chunkX, chunkZ), 9), - new VersionedRunnable(() -> Chunk_10.sendChunk(p, chunkX, chunkZ), 10), - new VersionedRunnable(() -> Chunk_12.sendChunk(p, chunkX, chunkZ), 12), - new VersionedRunnable(() -> Chunk_14.sendChunk(p, chunkX, chunkZ), 14), - new VersionedRunnable(() -> Chunk_15.sendChunk(p, chunkX, chunkZ), 15)); + public static void sendChunk(Player p, int chunkX, int chunkZ) { + CraftbukkitWrapper.impl.sendChunk(p, chunkX, chunkZ); } } diff --git a/SpigotCore_Main/src/de/steamwar/inventory/SWItem.java b/SpigotCore_Main/src/de/steamwar/inventory/SWItem.java index d82a9af..02e89b2 100644 --- a/SpigotCore_Main/src/de/steamwar/inventory/SWItem.java +++ b/SpigotCore_Main/src/de/steamwar/inventory/SWItem.java @@ -21,7 +21,7 @@ package de.steamwar.inventory; import com.google.gson.JsonArray; import com.google.gson.JsonObject; -import de.steamwar.core.VersionedCallable; +import de.steamwar.core.FlatteningWrapper; import org.bukkit.Material; import org.bukkit.OfflinePlayer; import org.bukkit.enchantments.Enchantment; @@ -44,24 +44,21 @@ public class SWItem { public static SWItem getPlayerSkull(String playerName){ SWItem p = new SWItem(); - ItemStack head = VersionedCallable.call(new VersionedCallable<>(() -> SWItem_8.setSkullOwner(playerName), 8), - new VersionedCallable<>(() -> SWItem_14.setSkullOwner(playerName), 14)); + ItemStack head = FlatteningWrapper.impl.setSkullOwner(playerName); p.setItemStack(head); return p; } public static Material getMaterial(String material){ try{ - return VersionedCallable.call(new VersionedCallable<>(() -> SWItem_8.getMaterial(material), 8), - new VersionedCallable<>(() -> SWItem_14.getMaterial(material), 14)); + return FlatteningWrapper.impl.getMaterial(material); }catch(IllegalArgumentException e){ return Material.STONE; } } public static Material getDye(int colorCode){ - return VersionedCallable.call(new VersionedCallable<>(SWItem_8::getDye, 8), - new VersionedCallable<>(() -> SWItem_14.getDye(colorCode), 14)); + return FlatteningWrapper.impl.getDye(colorCode); } public SWItem() { diff --git a/SpigotCore_Main/src/de/steamwar/message/Message.java b/SpigotCore_Main/src/de/steamwar/message/Message.java index 7ae38e0..e277ee1 100644 --- a/SpigotCore_Main/src/de/steamwar/message/Message.java +++ b/SpigotCore_Main/src/de/steamwar/message/Message.java @@ -19,7 +19,7 @@ package de.steamwar.message; -import de.steamwar.core.VersionedCallable; +import de.steamwar.core.WorldOfColorWrapper; import net.md_5.bungee.api.ChatMessageType; import net.md_5.bungee.api.chat.ClickEvent; import net.md_5.bungee.api.chat.HoverEvent; @@ -73,8 +73,7 @@ public class Message { } private Locale getLocale(Player player){ - return VersionedCallable.call(new VersionedCallable<>(() -> Message_8.getLocale(player), 8), - new VersionedCallable<>(() -> Message_12.getLocale(player), 12)); + return WorldOfColorWrapper.impl.getLocale(player); } /* Send a message to one player */ diff --git a/SpigotCore_Main/src/de/steamwar/scoreboard/SWScoreboard.java b/SpigotCore_Main/src/de/steamwar/scoreboard/SWScoreboard.java index 809fc30..c01b56b 100644 --- a/SpigotCore_Main/src/de/steamwar/scoreboard/SWScoreboard.java +++ b/SpigotCore_Main/src/de/steamwar/scoreboard/SWScoreboard.java @@ -19,57 +19,72 @@ package de.steamwar.scoreboard; -import com.comphenix.protocol.PacketType; -import com.comphenix.protocol.ProtocolLibrary; -import com.comphenix.protocol.ProtocolManager; -import com.comphenix.protocol.events.PacketContainer; -import com.comphenix.protocol.wrappers.WrappedChatComponent; +import com.comphenix.tinyprotocol.Reflection; import de.steamwar.core.Core; -import de.steamwar.core.VersionedRunnable; +import de.steamwar.core.FlatteningWrapper; +import de.steamwar.core.events.ChunkListener; import org.bukkit.Bukkit; import org.bukkit.entity.Player; -import java.lang.reflect.InvocationTargetException; import java.util.HashMap; import java.util.Map; public class SWScoreboard { private SWScoreboard() {} - private static final ProtocolManager manager = ProtocolLibrary.getProtocolManager(); + public static final Class scoreboardObjective = Reflection.getClass("{nms}.PacketPlayOutScoreboardObjective"); + private static final Reflection.FieldAccessor scoreboardName = Reflection.getField(scoreboardObjective, String.class, 0); + private static final Reflection.FieldAccessor scoreboardAction = Reflection.getField(scoreboardObjective, int.class, 0); + private static final Class scoreboardDisplayEnum = Reflection.getClass("{nms}.IScoreboardCriteria$EnumScoreboardHealthDisplay"); + private static final Reflection.FieldAccessor scoreboardDisplayType = Reflection.getField(scoreboardObjective, scoreboardDisplayEnum, 0); + private static final Object displayTypeIntegers = scoreboardDisplayEnum.getEnumConstants()[0]; + + private static final Class scoreboardScore = Reflection.getClass("{nms}.PacketPlayOutScoreboardScore"); + private static final Reflection.FieldAccessor scoreName = Reflection.getField(scoreboardScore, String.class, 0); + private static final Reflection.FieldAccessor scoreScoreboardName = Reflection.getField(scoreboardScore, String.class, 1); + private static final Reflection.FieldAccessor scoreValue = Reflection.getField(scoreboardScore, int.class, 0); + private static final Class scoreActionEnum = Reflection.getClass("{nms}.ScoreboardServer$Action"); + private static final Reflection.FieldAccessor scoreAction = Reflection.getField(scoreboardScore, scoreActionEnum, 0); + private static final Object scoreActionChange = scoreActionEnum.getEnumConstants()[0]; + private static final HashMap playerBoards = new HashMap<>(); //Object -> Scoreboard | Alle Versionen in der Map! private static int toggle = 0; // Scoreboard 0 updates while scoreboard 1 is presenting. toggle marks the current active scoreboard private static final String SIDEBAR = "Sidebar"; - private static final PacketContainer[] DELETE_SCOREBOARD = new PacketContainer[2]; - private static final PacketContainer[] DISPLAY_SIDEBAR = new PacketContainer[2]; + private static final Object[] DELETE_SCOREBOARD = new Object[2]; + private static final Object[] DISPLAY_SIDEBAR = new Object[2]; static { - setScoreboardConstants(0); - setScoreboardConstants(1); + Class scoreboardDisplayObjective = Reflection.getClass("{nms}.PacketPlayOutScoreboardDisplayObjective"); + Reflection.FieldAccessor scoreboardDisplayName = Reflection.getField(scoreboardDisplayObjective, String.class, 0); + Reflection.FieldAccessor scoreboardDisplaySlot = Reflection.getField(scoreboardDisplayObjective, int.class, 0); + for(int id = 0; id < 2; id++) { + DELETE_SCOREBOARD[id] = Reflection.newInstance(scoreboardObjective); + scoreboardName.set(DELETE_SCOREBOARD[id], SIDEBAR + id); + scoreboardAction.set(DELETE_SCOREBOARD[id], 1); //1 to remove + + DISPLAY_SIDEBAR[id] = Reflection.newInstance(scoreboardDisplayObjective); + scoreboardDisplayName.set(DISPLAY_SIDEBAR[id], SIDEBAR + id); + scoreboardDisplaySlot.set(DISPLAY_SIDEBAR[id], 1); // 1 = Sidebar + } + Bukkit.getScheduler().runTaskTimer(Core.getInstance(), () -> { toggle ^= 1; // Toggle between 0 and 1 for(Map.Entry scoreboard : playerBoards.entrySet()) { Player player = scoreboard.getKey(); ScoreboardCallback callback = scoreboard.getValue(); - try { - manager.sendServerPacket(player, DELETE_SCOREBOARD[toggle]); - manager.sendServerPacket(player, createSidebarPacket(callback.getTitle())); - for(Map.Entry score : callback.getData().entrySet()){ - manager.sendServerPacket(player, createScorePacket(score.getKey(), score.getValue())); - } - } catch (InvocationTargetException e) { - throw new SecurityException("Could not send scoreboard packets", e); + + ChunkListener.protocol.sendPacket(player, DELETE_SCOREBOARD[toggle]); + ChunkListener.protocol.sendPacket(player, createSidebarPacket(callback.getTitle())); + for(Map.Entry score : callback.getData().entrySet()){ + ChunkListener.protocol.sendPacket(player, createScorePacket(score.getKey(), score.getValue())); } + Bukkit.getScheduler().runTaskLater(Core.getInstance(), () -> { if(!player.isOnline()) return; - try { - ProtocolLibrary.getProtocolManager().sendServerPacket(player, DISPLAY_SIDEBAR[toggle]); - } catch (InvocationTargetException e) { - throw new SecurityException("Could not send DISPLAY_SIDEBAR", e); - } + ChunkListener.protocol.sendPacket(player, DISPLAY_SIDEBAR[toggle]); }, 2); } }, 10, 5); @@ -81,52 +96,27 @@ public class SWScoreboard { } public static void removeScoreboard(Player player) { - if(playerBoards.remove(player) == null) + if(playerBoards.remove(player) == null || !player.isOnline()) return; - try { - ProtocolLibrary.getProtocolManager().sendServerPacket(player, DELETE_SCOREBOARD[toggle]); - } catch (InvocationTargetException e) { - throw new SecurityException("Could not send DELETE_PACKET", e); - } + ChunkListener.protocol.sendPacket(player, DELETE_SCOREBOARD[toggle]); } - private static PacketContainer createSidebarPacket(String name){ - PacketContainer packet = manager.createPacket(PacketType.Play.Server.SCOREBOARD_OBJECTIVE); - packet.getStrings().write(0, SIDEBAR + toggle); - packet.getIntegers().write(0, 0); //0 to create - VersionedRunnable.call(new VersionedRunnable(() -> packet.getStrings().write(1, name), 8), - new VersionedRunnable(() -> packet.getChatComponents().write(0, WrappedChatComponent.fromText(name)), 14)); - packet.getEnumModifier(RenderType.class, 2).write(0, RenderType.INTEGER); + private static Object createSidebarPacket(String name){ + Object packet = Reflection.newInstance(scoreboardObjective); + scoreboardName.set(packet, SIDEBAR + toggle); + scoreboardAction.set(packet, 0); //0 to create + FlatteningWrapper.impl.setScoreboardTitle(packet, name); + scoreboardDisplayType.set(packet, displayTypeIntegers); return packet; } - private static PacketContainer createScorePacket(String name, int value){ - PacketContainer packet = manager.createPacket(PacketType.Play.Server.SCOREBOARD_SCORE); - packet.getStrings().write(0, name); - packet.getIntegers().write(0, value); - packet.getStrings().write(1, SIDEBAR + toggle); - packet.getEnumModifier(Action.class, 3).write(0, Action.CHANGE); + private static Object createScorePacket(String name, int value){ + Object packet = Reflection.newInstance(scoreboardScore); + scoreName.set(packet, name); + scoreScoreboardName.set(packet, SIDEBAR + toggle); + scoreValue.set(packet, value); + scoreAction.set(packet, scoreActionChange); return packet; } - - private enum Action{ - CHANGE, - REMOVE - } - - private enum RenderType{ - INTEGER, - HEART - } - - private static void setScoreboardConstants(int id){ - DELETE_SCOREBOARD[id] = manager.createPacket(PacketType.Play.Server.SCOREBOARD_OBJECTIVE); - DELETE_SCOREBOARD[id].getStrings().write(0, SIDEBAR + id); - DELETE_SCOREBOARD[id].getIntegers().write(0, 1); //1 to remove - - DISPLAY_SIDEBAR[id] = manager.createPacket(PacketType.Play.Server.SCOREBOARD_DISPLAY_OBJECTIVE); - DISPLAY_SIDEBAR[id].getStrings().write(0, SIDEBAR + id); - DISPLAY_SIDEBAR[id].getIntegers().write(0, 1); // 1 = Sidebar - } } diff --git a/SpigotCore_API/src/de/steamwar/scoreboard/ScoreboardCallback.java b/SpigotCore_Main/src/de/steamwar/scoreboard/ScoreboardCallback.java similarity index 100% rename from SpigotCore_API/src/de/steamwar/scoreboard/ScoreboardCallback.java rename to SpigotCore_Main/src/de/steamwar/scoreboard/ScoreboardCallback.java diff --git a/SpigotCore_API/src/de/steamwar/sql/NoClipboardException.java b/SpigotCore_Main/src/de/steamwar/sql/NoClipboardException.java similarity index 100% rename from SpigotCore_API/src/de/steamwar/sql/NoClipboardException.java rename to SpigotCore_Main/src/de/steamwar/sql/NoClipboardException.java diff --git a/SpigotCore_Main/src/de/steamwar/sql/Schematic.java b/SpigotCore_Main/src/de/steamwar/sql/Schematic.java index a7d8c45..b12a375 100644 --- a/SpigotCore_Main/src/de/steamwar/sql/Schematic.java +++ b/SpigotCore_Main/src/de/steamwar/sql/Schematic.java @@ -20,8 +20,7 @@ package de.steamwar.sql; import com.sk89q.worldedit.extent.clipboard.Clipboard; -import de.steamwar.core.VersionedCallable; -import de.steamwar.core.VersionedRunnable; +import de.steamwar.core.FlatteningWrapper; import org.bukkit.entity.Player; import java.io.IOException; @@ -197,8 +196,11 @@ public class Schematic { } public static Clipboard clipboardFromStream(InputStream is, boolean schemFormat) { - return VersionedCallable.call(new VersionedCallable<>(() -> Schematic_8.getClipboard(is, schemFormat), 8), - new VersionedCallable<>(() -> Schematic_14.getClipboard(is, schemFormat), 14)); + try { + return FlatteningWrapper.impl.getClipboard(is, schemFormat); + } catch (IOException e) { + throw new SecurityException("Could not read schem", e); + } } public Clipboard load() throws IOException, NoClipboardException { @@ -207,8 +209,7 @@ public class Schematic { public void loadToPlayer(Player player) throws IOException, NoClipboardException { InputStream is = schemData(); - VersionedRunnable.call(new VersionedRunnable(() -> Schematic_8.setPlayerClipboard(player, is, schemFormat), 8), - new VersionedRunnable(() -> Schematic_14.setPlayerClipboard(player, is, schemFormat), 14)); + FlatteningWrapper.impl.setPlayerClipboard(player, is, schemFormat); } public void saveOldFormatFromPlayer(Player player) throws IOException, NoClipboardException { @@ -231,21 +232,11 @@ public class Schematic { private void saveFromPlayer(Player player, boolean newFormat) throws IOException, NoClipboardException { Blob blob = SQL.blob(); - VersionedRunnable.call(new VersionedRunnable(() -> { - try { - blob.setBytes(1, Schematic_8.getPlayerClipboard(player)); - } catch (SQLException e) { - throw new RuntimeException(e.getMessage(), e); - } - updateDatabase(blob, false); - }, 8), new VersionedRunnable(() -> { - try { - blob.setBytes(1, Schematic_14.getPlayerClipboard(player, newFormat)); - } catch (SQLException exception) { - throw new RuntimeException(exception.getMessage(), exception); - } - updateDatabase(blob, newFormat); - }, 14)); + try { + blob.setBytes(1, FlatteningWrapper.impl.getPlayerClipboard(player, newFormat)); + } catch (SQLException e) { + throw new SecurityException(e.getMessage(), e); + } } private void updateDatabase(Blob blob, boolean newFormat) { diff --git a/SpigotCore_Main/src/plugin.yml b/SpigotCore_Main/src/plugin.yml index 370fc34..8eee87b 100644 --- a/SpigotCore_Main/src/plugin.yml +++ b/SpigotCore_Main/src/plugin.yml @@ -5,8 +5,6 @@ api-version: "1.13" load: STARTUP softdepend: - WorldEdit -depend: - - ProtocolLib main: de.steamwar.core.Core commands: \ No newline at end of file diff --git a/build.gradle b/build.gradle index a310072..87b87f4 100644 --- a/build.gradle +++ b/build.gradle @@ -79,6 +79,12 @@ allprojects { dependencies { implementation project(":SpigotCore_Main") + implementation project(":SpigotCore_8") + implementation project(":SpigotCore_9") + implementation project(":SpigotCore_10") + implementation project(":SpigotCore_12") + implementation project(":SpigotCore_14") + implementation project(":SpigotCore_15") } task buildProject { From 6f116804b7bc7549ea8c3f3eabff39cca045b831 Mon Sep 17 00:00:00 2001 From: Lixfel Date: Sat, 11 Sep 2021 02:09:48 +0200 Subject: [PATCH 05/24] making authlib injector multiversional --- .../steamwar/authlib/AuthlibInjector_15.java | 33 ------------------- .../src/de/steamwar/core/Core.java | 2 +- .../{ => core}/authlib/AuthlibInjector.java | 28 +++++----------- .../SteamwarGameProfileRepository.java | 2 +- 4 files changed, 10 insertions(+), 55 deletions(-) delete mode 100644 SpigotCore_Main/src/de/steamwar/authlib/AuthlibInjector_15.java rename SpigotCore_Main/src/de/steamwar/{ => core}/authlib/AuthlibInjector.java (51%) rename SpigotCore_Main/src/de/steamwar/{ => core}/authlib/SteamwarGameProfileRepository.java (98%) diff --git a/SpigotCore_Main/src/de/steamwar/authlib/AuthlibInjector_15.java b/SpigotCore_Main/src/de/steamwar/authlib/AuthlibInjector_15.java deleted file mode 100644 index 9864a31..0000000 --- a/SpigotCore_Main/src/de/steamwar/authlib/AuthlibInjector_15.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * 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 . - */ - -package de.steamwar.authlib; - -import net.minecraft.server.v1_15_R1.MinecraftServer; - -public class AuthlibInjector_15 { - - static Class getMinecraftClass() { - return MinecraftServer.class; - } - - static Object getMinecraftServerInstance() { - return MinecraftServer.getServer(); - } -} diff --git a/SpigotCore_Main/src/de/steamwar/core/Core.java b/SpigotCore_Main/src/de/steamwar/core/Core.java index 62f8849..bba0e3d 100644 --- a/SpigotCore_Main/src/de/steamwar/core/Core.java +++ b/SpigotCore_Main/src/de/steamwar/core/Core.java @@ -19,7 +19,7 @@ package de.steamwar.core; -import de.steamwar.authlib.AuthlibInjector; +import de.steamwar.core.authlib.AuthlibInjector; import de.steamwar.comms.BungeeReceiver; import de.steamwar.core.events.ChattingEvent; import de.steamwar.core.events.ChunkListener; diff --git a/SpigotCore_Main/src/de/steamwar/authlib/AuthlibInjector.java b/SpigotCore_Main/src/de/steamwar/core/authlib/AuthlibInjector.java similarity index 51% rename from SpigotCore_Main/src/de/steamwar/authlib/AuthlibInjector.java rename to SpigotCore_Main/src/de/steamwar/core/authlib/AuthlibInjector.java index f12bd3d..ace4936 100644 --- a/SpigotCore_Main/src/de/steamwar/authlib/AuthlibInjector.java +++ b/SpigotCore_Main/src/de/steamwar/core/authlib/AuthlibInjector.java @@ -17,31 +17,19 @@ * along with this program. If not, see . */ -package de.steamwar.authlib; +package de.steamwar.core.authlib; +import com.comphenix.tinyprotocol.Reflection; +import com.mojang.authlib.GameProfileRepository; import com.mojang.authlib.yggdrasil.YggdrasilGameProfileRepository; -import de.steamwar.core.Core; -import de.steamwar.core.VersionedCallable; - -import java.lang.reflect.Field; public class AuthlibInjector { + private AuthlibInjector() {} public static void inject() { - if (Core.getVersion() != 15) { - return; - } - - try { - Class minecraftServerClass = VersionedCallable.call(new VersionedCallable<>(() -> AuthlibInjector_15.getMinecraftClass(), 15)); - Field repo = minecraftServerClass.getDeclaredField("gameProfileRepository"); - repo.setAccessible(true); - Object instance = VersionedCallable.call(new VersionedCallable<>(() -> AuthlibInjector_15.getMinecraftServerInstance(), 15)); - repo.set(instance, new SteamwarGameProfileRepository((YggdrasilGameProfileRepository) repo.get(instance))); - } catch (NoSuchFieldException e) { - e.printStackTrace(); - } catch (IllegalAccessException e) { - e.printStackTrace(); - } + Class minecraftServerClass = Reflection.getClass("{nms}.MinecraftServer"); + Reflection.FieldAccessor gameProfile = Reflection.getField(minecraftServerClass, GameProfileRepository.class, 0); + Object minecraftServer = Reflection.getTypedMethod(minecraftServerClass, "getServer", minecraftServerClass).invoke(null); + gameProfile.set(minecraftServer, new SteamwarGameProfileRepository((YggdrasilGameProfileRepository) gameProfile.get(minecraftServer))); } } diff --git a/SpigotCore_Main/src/de/steamwar/authlib/SteamwarGameProfileRepository.java b/SpigotCore_Main/src/de/steamwar/core/authlib/SteamwarGameProfileRepository.java similarity index 98% rename from SpigotCore_Main/src/de/steamwar/authlib/SteamwarGameProfileRepository.java rename to SpigotCore_Main/src/de/steamwar/core/authlib/SteamwarGameProfileRepository.java index 3a4ebae..9045de1 100644 --- a/SpigotCore_Main/src/de/steamwar/authlib/SteamwarGameProfileRepository.java +++ b/SpigotCore_Main/src/de/steamwar/core/authlib/SteamwarGameProfileRepository.java @@ -17,7 +17,7 @@ * along with this program. If not, see . */ -package de.steamwar.authlib; +package de.steamwar.core.authlib; import com.mojang.authlib.Agent; import com.mojang.authlib.GameProfile; From 95b9551c704fc8c9a20604d286f53bb317cd4462 Mon Sep 17 00:00:00 2001 From: Lixfel Date: Sat, 11 Sep 2021 16:19:43 +0200 Subject: [PATCH 06/24] Flatteningfix, vanilla java error logger (<1.12 support!) --- .../de/steamwar/core/FlatteningWrapper14.java | 5 +- .../src/de/steamwar/core/Core.java | 8 +- .../src/de/steamwar/core/ErrorHandler.java | 140 ++++++++++++++++++ .../src/de/steamwar/core/ErrorLogger.java | 63 -------- .../src/de/steamwar/inventory/SWItem.java | 1 + .../src/de/steamwar/sql/SWException.java | 93 +----------- 6 files changed, 149 insertions(+), 161 deletions(-) create mode 100644 SpigotCore_Main/src/de/steamwar/core/ErrorHandler.java delete mode 100644 SpigotCore_Main/src/de/steamwar/core/ErrorLogger.java diff --git a/SpigotCore_14/src/de/steamwar/core/FlatteningWrapper14.java b/SpigotCore_14/src/de/steamwar/core/FlatteningWrapper14.java index b5da68a..63ded8e 100644 --- a/SpigotCore_14/src/de/steamwar/core/FlatteningWrapper14.java +++ b/SpigotCore_14/src/de/steamwar/core/FlatteningWrapper14.java @@ -256,9 +256,8 @@ public class FlatteningWrapper14 implements FlatteningWrapper.IFlatteningWrapper renamedLegacy.put("RECORD_12", Material.MUSIC_DISC_WAIT); } - private static final Class chatComponent = Reflection.getClass("{nms}.ChatComponentText"); - private static final Reflection.FieldAccessor scoreboardName = Reflection.getField(SWScoreboard.scoreboardObjective, chatComponent, 0); - private static final Reflection.ConstructorInvoker chatComponentConstructor = Reflection.getConstructor(chatComponent, String.class); + private static final Reflection.FieldAccessor scoreboardName = Reflection.getField(SWScoreboard.scoreboardObjective, Reflection.getClass("{nms}.IChatBaseComponent"), 0); + private static final Reflection.ConstructorInvoker chatComponentConstructor = Reflection.getConstructor(Reflection.getClass("{nms}.ChatComponentText"), String.class); @Override public void setScoreboardTitle(Object packet, String title) { diff --git a/SpigotCore_Main/src/de/steamwar/core/Core.java b/SpigotCore_Main/src/de/steamwar/core/Core.java index bba0e3d..46ceb2f 100644 --- a/SpigotCore_Main/src/de/steamwar/core/Core.java +++ b/SpigotCore_Main/src/de/steamwar/core/Core.java @@ -19,8 +19,8 @@ package de.steamwar.core; -import de.steamwar.core.authlib.AuthlibInjector; import de.steamwar.comms.BungeeReceiver; +import de.steamwar.core.authlib.AuthlibInjector; import de.steamwar.core.events.ChattingEvent; import de.steamwar.core.events.ChunkListener; import de.steamwar.core.events.PlayerJoinedEvent; @@ -57,14 +57,14 @@ public class Core extends JavaPlugin{ @Override public void onEnable() { + new ErrorHandler(); + Bukkit.getPluginManager().registerEvents(new PlayerJoinedEvent(), this); Bukkit.getPluginManager().registerEvents(new ChattingEvent(), this); Bukkit.getPluginManager().registerEvents(new WorldLoadEvent(), this); - ChunkListener.init(); - if(version >= 12) - ErrorLogger.init(); getServer().getMessenger().registerIncomingPluginChannel(this, "sw:bridge", new BungeeReceiver()); getServer().getMessenger().registerOutgoingPluginChannel(this, "sw:bridge"); + ChunkListener.init(); AuthlibInjector.inject(); } diff --git a/SpigotCore_Main/src/de/steamwar/core/ErrorHandler.java b/SpigotCore_Main/src/de/steamwar/core/ErrorHandler.java new file mode 100644 index 0000000..324fe15 --- /dev/null +++ b/SpigotCore_Main/src/de/steamwar/core/ErrorHandler.java @@ -0,0 +1,140 @@ +/* + 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 . +*/ + +package de.steamwar.core; + +import de.steamwar.sql.SWException; + +import java.io.ByteArrayOutputStream; +import java.io.PrintStream; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.logging.Handler; +import java.util.logging.Level; +import java.util.logging.LogRecord; +import java.util.logging.Logger; + +public class ErrorHandler extends Handler { + + private boolean logDisabled = false; + + public ErrorHandler(){ + Logger.getLogger("").addHandler(this); + } + + @Override + public void publish(LogRecord logRecord) { + if(logRecord.getLevel().intValue() < Level.WARNING.intValue()) + return; + + if(logDisabled) + return; + + String message = logRecord.getMessage(); + for(String reason : ignoreStartsWith) + if(message.startsWith(reason)) + return; + for(String reason : ignoreContains) + if(message.contains(reason)) + return; + + switch (message) { + case "The server has stopped responding!": + logDisabled = true; + return; + case "------------------------------": + message = "Server stopped responding"; + logDisabled = true; + break; + case "Exception stopping the server": + logDisabled = true; + break; + default: + } + + ByteArrayOutputStream stacktraceOutput = new ByteArrayOutputStream(); + logRecord.getThrown().printStackTrace(new PrintStream(stacktraceOutput)); + String stacktrace = stacktraceOutput.toString(); + if(stacktrace.contains("POI data mismatch")) + return; + + SWException.log(message, stacktrace); + } + + @Override + public void flush() { + //This is task of the database + } + + @Override + public void close() throws SecurityException { + //Done in the database + } + + private static final List ignoreStartsWith; + private static final List ignoreContains; + + static { + List startsWith = new ArrayList<>(); + startsWith.add("Could not save the list after adding a user."); + startsWith.add("Could not save spigot.yml"); + startsWith.add("Failed to save operators list:"); + startsWith.add("Block at"); + startsWith.add("POI data mismatch"); + startsWith.add("handleDisconnection() called twice"); + startsWith.add("**** SERVER IS RUNNING IN OFFLINE/INSECURE MODE!"); + startsWith.add("The server will make no attempt to authenticate usernames. Beware."); + startsWith.add("Whilst this makes it possible to use BungeeCord,"); + startsWith.add("Please see http://www.spigotmc.org/wiki/firewall-guide/ for further information."); + startsWith.add("To change this, set \"online-mode\" to \"true\" in the server.properties file."); + startsWith.add("This crash report has been saved to:"); + startsWith.add("Could not pass event PlayerQuitEvent to WorldEditSUI"); + startsWith.add("[ViaVersion] "); + startsWith.add("[ViaBackwards] "); + startsWith.add("Something went wrong upgrading!"); + startsWith.add("Tried to load unrecognized recipe"); + startsWith.add("Invalid BlockState in palette:"); + startsWith.add("Could not register alias"); + startsWith.add("Can't keep up! Is the server overloaded?"); + startsWith.add("\tat "); + startsWith.add("java.lang.Exception"); + startsWith.add("An exceptionCaught()"); + startsWith.add("Exception verifying"); + startsWith.add("[WorldEditSUI]"); + startsWith.add("Unsupported key:"); + startsWith.add("ThrownPotion entity"); + startsWith.add("Couldn't load custom particle"); + startsWith.add("Chunk file at ["); + startsWith.add("Ignoring unknown attribute"); + startsWith.add("Skipping player strafe phase because no player was found"); + startsWith.add("Couldn't save chunk; already in use by another instance of Minecraft?"); + startsWith.add("Failed to save player data for "); + startsWith.add("Failed to check session lock for world located at"); + startsWith.add("Saving oversized chunk "); + ignoreStartsWith = Collections.unmodifiableList(startsWith); + + List contains = new ArrayList<>(); + contains.add("moved too quickly!"); + contains.add("moved wrongly!"); + contains.add("was kicked for floating too long!"); + contains.add("just tried to change non-editable sign"); + ignoreContains = Collections.unmodifiableList(contains); + } +} diff --git a/SpigotCore_Main/src/de/steamwar/core/ErrorLogger.java b/SpigotCore_Main/src/de/steamwar/core/ErrorLogger.java deleted file mode 100644 index b4ba2f1..0000000 --- a/SpigotCore_Main/src/de/steamwar/core/ErrorLogger.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - 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 . -*/ - -package de.steamwar.core; - -import de.steamwar.sql.SWException; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.core.Appender; -import org.apache.logging.log4j.core.Core; -import org.apache.logging.log4j.core.LogEvent; -import org.apache.logging.log4j.core.LoggerContext; -import org.apache.logging.log4j.core.appender.AbstractAppender; -import org.apache.logging.log4j.core.config.plugins.Plugin; -import org.apache.logging.log4j.core.config.plugins.PluginAttribute; -import org.apache.logging.log4j.core.config.plugins.PluginFactory; -import org.apache.logging.log4j.spi.StandardLevel; - -@Plugin(name = "ErrorLogger", category = Core.CATEGORY_NAME, elementType = Appender.ELEMENT_TYPE) -public class ErrorLogger extends AbstractAppender { - - public static void init(){ - final LoggerContext lc = (LoggerContext) LogManager.getContext(false); - ErrorLogger el = ErrorLogger.createAppender("SWErrorLogger"); - el.start(); - lc.getConfiguration().addAppender(el); - lc.getRootLogger().addAppender(lc.getConfiguration().getAppender(el.getName())); - lc.updateLoggers(); - } - - private ErrorLogger(String name) { - super(name, null, null); - } - - @PluginFactory - public static ErrorLogger createAppender( - @PluginAttribute("name") String name) { - return new ErrorLogger(name); - } - - @Override - public void append(LogEvent logEvent) { - if(logEvent.getLevel().intLevel() > StandardLevel.WARN.intLevel()) - return; - - SWException.log(logEvent); - } -} diff --git a/SpigotCore_Main/src/de/steamwar/inventory/SWItem.java b/SpigotCore_Main/src/de/steamwar/inventory/SWItem.java index 02e89b2..9f7c2b0 100644 --- a/SpigotCore_Main/src/de/steamwar/inventory/SWItem.java +++ b/SpigotCore_Main/src/de/steamwar/inventory/SWItem.java @@ -87,6 +87,7 @@ public class SWItem { this(material, (byte)0, name, lore, enchanted, c); } + @SuppressWarnings("deprecation") public SWItem(Material material, byte meta, String name, List lore, boolean enchanted, InvCallback c) { try { itemStack = new ItemStack(material, 1, (short)0, meta); diff --git a/SpigotCore_Main/src/de/steamwar/sql/SWException.java b/SpigotCore_Main/src/de/steamwar/sql/SWException.java index efee8ad..850c124 100644 --- a/SpigotCore_Main/src/de/steamwar/sql/SWException.java +++ b/SpigotCore_Main/src/de/steamwar/sql/SWException.java @@ -19,101 +19,13 @@ package de.steamwar.sql; -import org.apache.logging.log4j.core.LogEvent; import org.bukkit.Bukkit; import org.bukkit.entity.Player; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - public class SWException { private SWException(){} - private static boolean logDisabled = false; - private static final List ignorereasons; - - static { - List reasons = new ArrayList<>(); - reasons.add("Could not save the list after adding a user."); - reasons.add("Could not save spigot.yml"); - reasons.add("Failed to save operators list:"); - reasons.add("Block at"); - reasons.add("POI data mismatch"); - reasons.add("handleDisconnection() called twice"); - reasons.add("**** SERVER IS RUNNING IN OFFLINE/INSECURE MODE!"); - reasons.add("The server will make no attempt to authenticate usernames. Beware."); - reasons.add("Whilst this makes it possible to use BungeeCord,"); - reasons.add("Please see http://www.spigotmc.org/wiki/firewall-guide/ for further information."); - reasons.add("To change this, set \"online-mode\" to \"true\" in the server.properties file."); - reasons.add("This crash report has been saved to:"); - reasons.add("Could not pass event PlayerQuitEvent to WorldEditSUI"); - reasons.add("[ViaVersion] "); - reasons.add("[ViaBackwards] "); - reasons.add("Something went wrong upgrading!"); - reasons.add("Tried to load unrecognized recipe"); - reasons.add("Invalid BlockState in palette:"); - reasons.add("Could not register alias"); - reasons.add("Can't keep up! Is the server overloaded?"); - reasons.add("\tat "); - reasons.add("java.lang.Exception"); - reasons.add("An exceptionCaught()"); - reasons.add("Exception verifying"); - reasons.add("[WorldEditSUI]"); - reasons.add("Unsupported key:"); - reasons.add("ThrownPotion entity"); - reasons.add("Couldn't load custom particle"); - reasons.add("Chunk file at ["); - reasons.add("Ignoring unknown attribute"); - reasons.add("Skipping player strafe phase because no player was found"); - reasons.add("Couldn't save chunk; already in use by another instance of Minecraft?"); - reasons.add("Failed to save player data for "); - reasons.add("Failed to check session lock for world located at"); - reasons.add("Saving oversized chunk "); - ignorereasons = Collections.unmodifiableList(reasons); - } - - public static void log(LogEvent logEvent){ - if(logDisabled) - return; - - String message = logEvent.getMessage().getFormattedMessage(); - for(String reason : ignorereasons) - if(message.startsWith(reason)) - return; - - if(message.contains("moved too quickly!") || message.contains("moved wrongly!") || message.contains("was kicked for floating too long!") || message.contains("just tried to change non-editable sign")) - return; - - switch (message) { - case "The server has stopped responding!": - logDisabled = true; - return; - case "------------------------------": - message = "Server stopped responding"; - logDisabled = true; - break; - case "Exception stopping the server": - logDisabled = true; - break; - default: - } - - StringBuilder stacktrace = new StringBuilder(logEvent.getSource().toString()); - Throwable throwable = logEvent.getThrown(); - while(throwable != null){ - stacktrace.append("\nCaused by ").append(throwable.getClass().getName()).append(": ").append(throwable.getMessage()); - - for(StackTraceElement ste : throwable.getStackTrace()) - stacktrace.append("\n").append(ste.toString()); - - throwable = throwable.getCause(); - } - - String st = stacktrace.toString(); - if(st.contains("POI data mismatch")) - return; - + public static void log(String message, String stacktrace){ message += "\n"; for(Player player : Bukkit.getOnlinePlayers()) message += player.getName() + " "; @@ -124,7 +36,6 @@ public class SWException { else server = Bukkit.getWorlds().get(0).getName(); - SQL.update("INSERT INTO Exception (server, message, stacktrace) VALUES (?, ?, ?)", - server, message, st); + SQL.update("INSERT INTO Exception (server, message, stacktrace) VALUES (?, ?, ?)", server, message, stacktrace); } } From acdf57dc407702d0a3334c43f58cc69ab33fa9e7 Mon Sep 17 00:00:00 2001 From: yoyosource Date: Sat, 11 Sep 2021 16:50:43 +0200 Subject: [PATCH 07/24] Hotfix AnvilGUI Error --- SpigotCore_Main/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SpigotCore_Main/build.gradle b/SpigotCore_Main/build.gradle index 78a10e1..61c121f 100644 --- a/SpigotCore_Main/build.gradle +++ b/SpigotCore_Main/build.gradle @@ -59,7 +59,7 @@ dependencies { compileOnly files("${project.rootDir}/lib/Spigot-1.15.jar") compileOnly files("${project.rootDir}/lib/WorldEdit-1.12.jar") compileOnly files("${project.rootDir}/lib/ProtocolLib.jar") - compileOnly 'net.wesjd:anvilgui:1.4.0-SNAPSHOT' + implementation 'net.wesjd:anvilgui:1.4.0-SNAPSHOT' } processResources { From ef2553e6ac46e2db6d7831ab3f7f06d8fe70e3eb Mon Sep 17 00:00:00 2001 From: Lixfel Date: Sat, 11 Sep 2021 16:51:36 +0200 Subject: [PATCH 08/24] Fix Messagesystem for 1.8 --- .../src/de/steamwar/core/BountifulWrapper8.java | 10 ++++++++++ .../src/de/steamwar/core/BountifulWrapper9.java | 7 +++++++ .../src/de/steamwar/core/BountifulWrapper.java | 4 ++++ SpigotCore_Main/src/de/steamwar/message/Message.java | 6 ++++-- 4 files changed, 25 insertions(+), 2 deletions(-) diff --git a/SpigotCore_8/src/de/steamwar/core/BountifulWrapper8.java b/SpigotCore_8/src/de/steamwar/core/BountifulWrapper8.java index 2337739..8c08082 100644 --- a/SpigotCore_8/src/de/steamwar/core/BountifulWrapper8.java +++ b/SpigotCore_8/src/de/steamwar/core/BountifulWrapper8.java @@ -19,7 +19,12 @@ package de.steamwar.core; +import net.md_5.bungee.api.ChatMessageType; +import net.md_5.bungee.api.chat.BaseComponent; +import net.minecraft.server.v1_8_R3.ChatComponentText; +import net.minecraft.server.v1_8_R3.PacketPlayOutChat; import org.bukkit.Sound; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer; import org.bukkit.entity.Player; public class BountifulWrapper8 implements BountifulWrapper.IBountifulWrapper { @@ -28,4 +33,9 @@ public class BountifulWrapper8 implements BountifulWrapper.IBountifulWrapper { public void playPling(Player player) { player.playSound(player.getLocation(), Sound.ORB_PICKUP, 1, 1); } + + @Override + public void sendMessage(Player player, ChatMessageType type, BaseComponent... msg) { + ((CraftPlayer) player).getHandle().playerConnection.sendPacket(new PacketPlayOutChat(new ChatComponentText(BaseComponent.toLegacyText(msg)), (byte)type.ordinal())); + } } diff --git a/SpigotCore_9/src/de/steamwar/core/BountifulWrapper9.java b/SpigotCore_9/src/de/steamwar/core/BountifulWrapper9.java index 632606c..d12a37d 100644 --- a/SpigotCore_9/src/de/steamwar/core/BountifulWrapper9.java +++ b/SpigotCore_9/src/de/steamwar/core/BountifulWrapper9.java @@ -19,6 +19,8 @@ package de.steamwar.core; +import net.md_5.bungee.api.ChatMessageType; +import net.md_5.bungee.api.chat.BaseComponent; import org.bukkit.Sound; import org.bukkit.entity.Player; @@ -28,4 +30,9 @@ public class BountifulWrapper9 implements BountifulWrapper.IBountifulWrapper { public void playPling(Player player) { player.playSound(player.getLocation(), Sound.ENTITY_EXPERIENCE_ORB_PICKUP, 1, 1); } + + @Override + public void sendMessage(Player player, ChatMessageType type, BaseComponent... msg) { + player.spigot().sendMessage(type, msg); + } } diff --git a/SpigotCore_Main/src/de/steamwar/core/BountifulWrapper.java b/SpigotCore_Main/src/de/steamwar/core/BountifulWrapper.java index 26069de..8b22c31 100644 --- a/SpigotCore_Main/src/de/steamwar/core/BountifulWrapper.java +++ b/SpigotCore_Main/src/de/steamwar/core/BountifulWrapper.java @@ -19,6 +19,8 @@ package de.steamwar.core; +import net.md_5.bungee.api.ChatMessageType; +import net.md_5.bungee.api.chat.BaseComponent; import org.bukkit.entity.Player; public class BountifulWrapper { @@ -28,5 +30,7 @@ public class BountifulWrapper { public interface IBountifulWrapper { void playPling(Player player); + + void sendMessage(Player player, ChatMessageType type, BaseComponent... msg); } } diff --git a/SpigotCore_Main/src/de/steamwar/message/Message.java b/SpigotCore_Main/src/de/steamwar/message/Message.java index e277ee1..efdf651 100644 --- a/SpigotCore_Main/src/de/steamwar/message/Message.java +++ b/SpigotCore_Main/src/de/steamwar/message/Message.java @@ -19,6 +19,7 @@ package de.steamwar.message; +import de.steamwar.core.BountifulWrapper; import de.steamwar.core.WorldOfColorWrapper; import net.md_5.bungee.api.ChatMessageType; import net.md_5.bungee.api.chat.ClickEvent; @@ -108,10 +109,11 @@ public class Message { msg.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, TextComponent.fromLegacyText(onHover))); if(onClick != null) msg.setClickEvent(onClick); + if(sender instanceof Player) - ((Player)sender).spigot().sendMessage(type, msg); + BountifulWrapper.impl.sendMessage((Player)sender, type, msg); else - sender.spigot().sendMessage(msg); + sender.sendMessage(msg.toPlainText()); } /* Send message to all players */ From 2b1e7c33229b2f578d205e8e94b9d417bb8390ce Mon Sep 17 00:00:00 2001 From: Lixfel Date: Sat, 11 Sep 2021 18:24:28 +0200 Subject: [PATCH 09/24] Fix SWScoreboard <= 1.12, Remove todos --- .../src/de/steamwar/core/FlatteningWrapper14.java | 9 +++++++++ .../src/de/steamwar/core/FlatteningWrapper8.java | 8 ++++++++ .../src/de/steamwar/core/FlatteningWrapper.java | 1 + .../src/de/steamwar/core/events/ChunkListener.java | 3 --- .../src/de/steamwar/scoreboard/SWScoreboard.java | 7 ++----- 5 files changed, 20 insertions(+), 8 deletions(-) diff --git a/SpigotCore_14/src/de/steamwar/core/FlatteningWrapper14.java b/SpigotCore_14/src/de/steamwar/core/FlatteningWrapper14.java index 63ded8e..af35928 100644 --- a/SpigotCore_14/src/de/steamwar/core/FlatteningWrapper14.java +++ b/SpigotCore_14/src/de/steamwar/core/FlatteningWrapper14.java @@ -264,6 +264,15 @@ public class FlatteningWrapper14 implements FlatteningWrapper.IFlatteningWrapper scoreboardName.set(packet, chatComponentConstructor.invoke(title)); } + private static final Class scoreActionEnum = Reflection.getClass("{nms}.ScoreboardServer$Action"); + private static final Reflection.FieldAccessor scoreAction = Reflection.getField(SWScoreboard.scoreboardScore, scoreActionEnum, 0); + private static final Object scoreActionChange = scoreActionEnum.getEnumConstants()[0]; + + @Override + public void setScoreAction(Object packet) { + scoreAction.set(packet, scoreActionChange); + } + @Override public Material getMaterial(String material) { try{ diff --git a/SpigotCore_8/src/de/steamwar/core/FlatteningWrapper8.java b/SpigotCore_8/src/de/steamwar/core/FlatteningWrapper8.java index 6aaa7ab..720d73f 100644 --- a/SpigotCore_8/src/de/steamwar/core/FlatteningWrapper8.java +++ b/SpigotCore_8/src/de/steamwar/core/FlatteningWrapper8.java @@ -58,12 +58,20 @@ import java.util.stream.Collectors; public class FlatteningWrapper8 implements FlatteningWrapper.IFlatteningWrapper { private static final Reflection.FieldAccessor scoreboardName = Reflection.getField(SWScoreboard.scoreboardObjective, String.class, 1); + private static final Class scoreActionEnum = Reflection.getClass("{nms}.PacketPlayOutScoreboardScore$EnumScoreboardAction"); + private static final Reflection.FieldAccessor scoreAction = Reflection.getField(SWScoreboard.scoreboardScore, scoreActionEnum, 0); + private static final Object scoreActionChange = scoreActionEnum.getEnumConstants()[0]; @Override public void setScoreboardTitle(Object packet, String title) { scoreboardName.set(packet, title); } + @Override + public void setScoreAction(Object packet) { + scoreAction.set(packet, scoreActionChange); + } + @Override public Material getMaterial(String material) { try{ diff --git a/SpigotCore_Main/src/de/steamwar/core/FlatteningWrapper.java b/SpigotCore_Main/src/de/steamwar/core/FlatteningWrapper.java index 17179b8..ad75bce 100644 --- a/SpigotCore_Main/src/de/steamwar/core/FlatteningWrapper.java +++ b/SpigotCore_Main/src/de/steamwar/core/FlatteningWrapper.java @@ -34,6 +34,7 @@ public class FlatteningWrapper { public interface IFlatteningWrapper { void setScoreboardTitle(Object packet, String title); + void setScoreAction(Object packet); Material getMaterial(String material); Material getDye(int colorCode); diff --git a/SpigotCore_Main/src/de/steamwar/core/events/ChunkListener.java b/SpigotCore_Main/src/de/steamwar/core/events/ChunkListener.java index f61068c..fe285fe 100644 --- a/SpigotCore_Main/src/de/steamwar/core/events/ChunkListener.java +++ b/SpigotCore_Main/src/de/steamwar/core/events/ChunkListener.java @@ -45,9 +45,6 @@ public class ChunkListener { ) return packet; - //TODO: Test ViaVersion prior or post - //TODO: Test if this can be done async? - //TODO: Nicer way: generate new and send new CraftbukkitWrapper.impl.sendChunk(receiver, chunkX.get(packet), chunkZ.get(packet)); return null; } diff --git a/SpigotCore_Main/src/de/steamwar/scoreboard/SWScoreboard.java b/SpigotCore_Main/src/de/steamwar/scoreboard/SWScoreboard.java index c01b56b..67cbeaa 100644 --- a/SpigotCore_Main/src/de/steamwar/scoreboard/SWScoreboard.java +++ b/SpigotCore_Main/src/de/steamwar/scoreboard/SWScoreboard.java @@ -39,13 +39,10 @@ public class SWScoreboard { private static final Reflection.FieldAccessor scoreboardDisplayType = Reflection.getField(scoreboardObjective, scoreboardDisplayEnum, 0); private static final Object displayTypeIntegers = scoreboardDisplayEnum.getEnumConstants()[0]; - private static final Class scoreboardScore = Reflection.getClass("{nms}.PacketPlayOutScoreboardScore"); + public static final Class scoreboardScore = Reflection.getClass("{nms}.PacketPlayOutScoreboardScore"); private static final Reflection.FieldAccessor scoreName = Reflection.getField(scoreboardScore, String.class, 0); private static final Reflection.FieldAccessor scoreScoreboardName = Reflection.getField(scoreboardScore, String.class, 1); private static final Reflection.FieldAccessor scoreValue = Reflection.getField(scoreboardScore, int.class, 0); - private static final Class scoreActionEnum = Reflection.getClass("{nms}.ScoreboardServer$Action"); - private static final Reflection.FieldAccessor scoreAction = Reflection.getField(scoreboardScore, scoreActionEnum, 0); - private static final Object scoreActionChange = scoreActionEnum.getEnumConstants()[0]; private static final HashMap playerBoards = new HashMap<>(); //Object -> Scoreboard | Alle Versionen in der Map! private static int toggle = 0; // Scoreboard 0 updates while scoreboard 1 is presenting. toggle marks the current active scoreboard @@ -116,7 +113,7 @@ public class SWScoreboard { scoreName.set(packet, name); scoreScoreboardName.set(packet, SIDEBAR + toggle); scoreValue.set(packet, value); - scoreAction.set(packet, scoreActionChange); + FlatteningWrapper.impl.setScoreAction(packet); return packet; } } From 5672c5f9cce2056ddddf12a94ce9c253a96e41b7 Mon Sep 17 00:00:00 2001 From: yoyosource Date: Sat, 11 Sep 2021 21:27:34 +0200 Subject: [PATCH 10/24] Update settings.gradle and remove SpigotCore_API --- settings.gradle | 1 - 1 file changed, 1 deletion(-) diff --git a/settings.gradle b/settings.gradle index bba0961..44cbeeb 100644 --- a/settings.gradle +++ b/settings.gradle @@ -20,7 +20,6 @@ rootProject.name = 'SpigotCore' include 'SpigotCore_Main' -include 'SpigotCore_API' include 'SpigotCore_15' include 'SpigotCore_14' include 'SpigotCore_12' From c2cc958b2a2f88aa1faa0a8dbc75778db0dc32f4 Mon Sep 17 00:00:00 2001 From: yoyosource Date: Sat, 11 Sep 2021 21:47:37 +0200 Subject: [PATCH 11/24] Test new pluginupdate pipeline --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index 1a2c8f1..dc56501 100644 --- a/gradle.properties +++ b/gradle.properties @@ -19,4 +19,4 @@ org.gradle.daemon = true org.gradle.parallel = true -org.gradle.workers.max = 1 \ No newline at end of file +org.gradle.workers.max = 4 \ No newline at end of file From 7292fb83565f8473c728319c5b41382aee8d4009 Mon Sep 17 00:00:00 2001 From: yoyosource Date: Sat, 11 Sep 2021 21:48:36 +0200 Subject: [PATCH 12/24] Test new pluginupdate pipeline --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index dc56501..cd26dde 100644 --- a/gradle.properties +++ b/gradle.properties @@ -19,4 +19,4 @@ org.gradle.daemon = true org.gradle.parallel = true -org.gradle.workers.max = 4 \ No newline at end of file +org.gradle.workers.max = 2 \ No newline at end of file From 3fe33a5369538aeb474dc0e52b61908f50c00733 Mon Sep 17 00:00:00 2001 From: yoyosource Date: Sat, 11 Sep 2021 21:49:38 +0200 Subject: [PATCH 13/24] Test new pluginupdate pipeline --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index cd26dde..dc56501 100644 --- a/gradle.properties +++ b/gradle.properties @@ -19,4 +19,4 @@ org.gradle.daemon = true org.gradle.parallel = true -org.gradle.workers.max = 2 \ No newline at end of file +org.gradle.workers.max = 4 \ No newline at end of file From 36bb22e7458f5dae3f6458988d1de88808748298 Mon Sep 17 00:00:00 2001 From: Lixfel Date: Sat, 11 Sep 2021 22:45:50 +0200 Subject: [PATCH 14/24] No Lombok. --- SpigotCore_10/build.gradle | 5 ----- SpigotCore_12/build.gradle | 5 ----- SpigotCore_14/build.gradle | 5 ----- SpigotCore_15/build.gradle | 5 ----- SpigotCore_8/build.gradle | 5 ----- SpigotCore_8/src/de/steamwar/core/FlatteningWrapper8.java | 2 -- SpigotCore_9/build.gradle | 5 ----- SpigotCore_Main/build.gradle | 5 ----- 8 files changed, 37 deletions(-) diff --git a/SpigotCore_10/build.gradle b/SpigotCore_10/build.gradle index bd21efa..34ef6f9 100644 --- a/SpigotCore_10/build.gradle +++ b/SpigotCore_10/build.gradle @@ -45,10 +45,5 @@ sourceSets { dependencies { implementation project(":SpigotCore_Main") - compileOnly 'org.projectlombok:lombok:1.18.6' - testCompileOnly 'org.projectlombok:lombok:1.18.6' - annotationProcessor 'org.projectlombok:lombok:1.18.6' - testAnnotationProcessor 'org.projectlombok:lombok:1.18.6' - compileOnly files("${project.rootDir}/lib/Spigot-1.10.jar") } diff --git a/SpigotCore_12/build.gradle b/SpigotCore_12/build.gradle index 48c917b..5ee8ca9 100644 --- a/SpigotCore_12/build.gradle +++ b/SpigotCore_12/build.gradle @@ -45,10 +45,5 @@ sourceSets { dependencies { implementation project(":SpigotCore_Main") - compileOnly 'org.projectlombok:lombok:1.18.6' - testCompileOnly 'org.projectlombok:lombok:1.18.6' - annotationProcessor 'org.projectlombok:lombok:1.18.6' - testAnnotationProcessor 'org.projectlombok:lombok:1.18.6' - compileOnly files("${project.rootDir}/lib/Spigot-1.12.jar") } diff --git a/SpigotCore_14/build.gradle b/SpigotCore_14/build.gradle index 5ed491e..688968a 100644 --- a/SpigotCore_14/build.gradle +++ b/SpigotCore_14/build.gradle @@ -45,11 +45,6 @@ sourceSets { dependencies { implementation project(":SpigotCore_Main") - compileOnly 'org.projectlombok:lombok:1.18.6' - testCompileOnly 'org.projectlombok:lombok:1.18.6' - annotationProcessor 'org.projectlombok:lombok:1.18.6' - testAnnotationProcessor 'org.projectlombok:lombok:1.18.6' - compileOnly files("${project.rootDir}/lib/Spigot-1.14.jar") compileOnly files("${project.rootDir}/lib/WorldEdit-1.15.jar") } diff --git a/SpigotCore_15/build.gradle b/SpigotCore_15/build.gradle index 31149fe..76dc3ee 100644 --- a/SpigotCore_15/build.gradle +++ b/SpigotCore_15/build.gradle @@ -45,10 +45,5 @@ sourceSets { dependencies { implementation project(":SpigotCore_Main") - compileOnly 'org.projectlombok:lombok:1.18.6' - testCompileOnly 'org.projectlombok:lombok:1.18.6' - annotationProcessor 'org.projectlombok:lombok:1.18.6' - testAnnotationProcessor 'org.projectlombok:lombok:1.18.6' - compileOnly files("${project.rootDir}/lib/Spigot-1.15.jar") } diff --git a/SpigotCore_8/build.gradle b/SpigotCore_8/build.gradle index f5207ab..8007cef 100644 --- a/SpigotCore_8/build.gradle +++ b/SpigotCore_8/build.gradle @@ -45,11 +45,6 @@ sourceSets { dependencies { implementation project(":SpigotCore_Main") - compileOnly 'org.projectlombok:lombok:1.18.6' - testCompileOnly 'org.projectlombok:lombok:1.18.6' - annotationProcessor 'org.projectlombok:lombok:1.18.6' - testAnnotationProcessor 'org.projectlombok:lombok:1.18.6' - compileOnly files("${project.rootDir}/lib/Spigot-1.8.jar") compileOnly files("${project.rootDir}/lib/WorldEdit-1.12.jar") } diff --git a/SpigotCore_8/src/de/steamwar/core/FlatteningWrapper8.java b/SpigotCore_8/src/de/steamwar/core/FlatteningWrapper8.java index 720d73f..e6dcdb8 100644 --- a/SpigotCore_8/src/de/steamwar/core/FlatteningWrapper8.java +++ b/SpigotCore_8/src/de/steamwar/core/FlatteningWrapper8.java @@ -45,7 +45,6 @@ import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.meta.SkullMeta; -import javax.annotation.Nullable; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.InputStream; @@ -324,7 +323,6 @@ public class FlatteningWrapper8 implements FlatteningWrapper.IFlatteningWrapper } } - @Nullable private static T getTag(Map items, String key, Class expected) { if (!items.containsKey(key)) { return null; diff --git a/SpigotCore_9/build.gradle b/SpigotCore_9/build.gradle index e0e40ad..064f759 100644 --- a/SpigotCore_9/build.gradle +++ b/SpigotCore_9/build.gradle @@ -45,10 +45,5 @@ sourceSets { dependencies { implementation project(":SpigotCore_Main") - compileOnly 'org.projectlombok:lombok:1.18.6' - testCompileOnly 'org.projectlombok:lombok:1.18.6' - annotationProcessor 'org.projectlombok:lombok:1.18.6' - testAnnotationProcessor 'org.projectlombok:lombok:1.18.6' - compileOnly files("${project.rootDir}/lib/Spigot-1.9.jar") } diff --git a/SpigotCore_Main/build.gradle b/SpigotCore_Main/build.gradle index a14ad0e..59c9f89 100644 --- a/SpigotCore_Main/build.gradle +++ b/SpigotCore_Main/build.gradle @@ -43,11 +43,6 @@ sourceSets { } dependencies { - compileOnly 'org.projectlombok:lombok:1.18.6' - testCompileOnly 'org.projectlombok:lombok:1.18.6' - annotationProcessor 'org.projectlombok:lombok:1.18.6' - testAnnotationProcessor 'org.projectlombok:lombok:1.18.6' - compileOnly files("${project.rootDir}/lib/Spigot-1.15.jar") compileOnly files("${project.rootDir}/lib/WorldEdit-1.12.jar") implementation 'net.wesjd:anvilgui:1.4.0-SNAPSHOT' From 5c2dceeda22fdc5c481a58c759153fc2b7cd31a7 Mon Sep 17 00:00:00 2001 From: Lixfel Date: Sun, 12 Sep 2021 08:14:52 +0200 Subject: [PATCH 15/24] Hotfix schematic saving --- SpigotCore_Main/src/de/steamwar/sql/Schematic.java | 1 + 1 file changed, 1 insertion(+) diff --git a/SpigotCore_Main/src/de/steamwar/sql/Schematic.java b/SpigotCore_Main/src/de/steamwar/sql/Schematic.java index b12a375..d1e326b 100644 --- a/SpigotCore_Main/src/de/steamwar/sql/Schematic.java +++ b/SpigotCore_Main/src/de/steamwar/sql/Schematic.java @@ -237,6 +237,7 @@ public class Schematic { } catch (SQLException e) { throw new SecurityException(e.getMessage(), e); } + updateDatabase(blob, newFormat); } private void updateDatabase(Blob blob, boolean newFormat) { From 5017809c7e7f9a0889ac4a732a6124dfbb3125ee Mon Sep 17 00:00:00 2001 From: Lixfel Date: Sun, 12 Sep 2021 16:56:20 +0200 Subject: [PATCH 16/24] Hotfix errorhandler --- SpigotCore_Main/src/de/steamwar/core/ErrorHandler.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/SpigotCore_Main/src/de/steamwar/core/ErrorHandler.java b/SpigotCore_Main/src/de/steamwar/core/ErrorHandler.java index 324fe15..0bc0815 100644 --- a/SpigotCore_Main/src/de/steamwar/core/ErrorHandler.java +++ b/SpigotCore_Main/src/de/steamwar/core/ErrorHandler.java @@ -70,7 +70,8 @@ public class ErrorHandler extends Handler { } ByteArrayOutputStream stacktraceOutput = new ByteArrayOutputStream(); - logRecord.getThrown().printStackTrace(new PrintStream(stacktraceOutput)); + if(logRecord.getThrown() != null) + logRecord.getThrown().printStackTrace(new PrintStream(stacktraceOutput)); String stacktrace = stacktraceOutput.toString(); if(stacktrace.contains("POI data mismatch")) return; From 2f91da922f384e60f76eca8ecd7f5ca01670218a Mon Sep 17 00:00:00 2001 From: Lixfel Date: Tue, 14 Sep 2021 21:04:38 +0200 Subject: [PATCH 17/24] Hotfix tinyprotocol --- .../src/com/comphenix/tinyprotocol/TinyProtocol.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/SpigotCore_Main/src/com/comphenix/tinyprotocol/TinyProtocol.java b/SpigotCore_Main/src/com/comphenix/tinyprotocol/TinyProtocol.java index 3f754f3..8dc6ea3 100644 --- a/SpigotCore_Main/src/com/comphenix/tinyprotocol/TinyProtocol.java +++ b/SpigotCore_Main/src/com/comphenix/tinyprotocol/TinyProtocol.java @@ -42,7 +42,16 @@ public abstract class TinyProtocol { private static final Class serverConnectionClass = Reflection.getUntypedClass("{nms}.ServerConnection"); private static final FieldAccessor getMinecraftServer = Reflection.getField("{obc}.CraftServer", minecraftServerClass, 0); private static final FieldAccessor getServerConnection = Reflection.getField(minecraftServerClass, serverConnectionClass, 0); - private static final MethodInvoker getNetworkMarkers = Reflection.getTypedMethod(serverConnectionClass, null, List.class, serverConnectionClass); + private static final MethodInvoker getNetworkMarkers; + static { + MethodInvoker networkMarkers; + try { + networkMarkers = Reflection.getTypedMethod(serverConnectionClass, null, List.class, serverConnectionClass); + } catch (IllegalStateException e) { + networkMarkers = Reflection.getTypedMethod(serverConnectionClass, null, Queue.class, serverConnectionClass); + } + getNetworkMarkers = networkMarkers; + } // Packets we have to intercept private static final Class PACKET_LOGIN_IN_START = Reflection.getMinecraftClass("PacketLoginInStart"); From 0ba50c80e5a66949f3fe17303e55c0be970d48f9 Mon Sep 17 00:00:00 2001 From: Lixfel Date: Tue, 14 Sep 2021 21:14:15 +0200 Subject: [PATCH 18/24] Hotfix tinyprotocol --- .../src/com/comphenix/tinyprotocol/TinyProtocol.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/SpigotCore_Main/src/com/comphenix/tinyprotocol/TinyProtocol.java b/SpigotCore_Main/src/com/comphenix/tinyprotocol/TinyProtocol.java index 8dc6ea3..3d2e41a 100644 --- a/SpigotCore_Main/src/com/comphenix/tinyprotocol/TinyProtocol.java +++ b/SpigotCore_Main/src/com/comphenix/tinyprotocol/TinyProtocol.java @@ -47,7 +47,7 @@ public abstract class TinyProtocol { MethodInvoker networkMarkers; try { networkMarkers = Reflection.getTypedMethod(serverConnectionClass, null, List.class, serverConnectionClass); - } catch (IllegalStateException e) { + } catch (IllegalStateException e) { // Paper, wtf why. networkMarkers = Reflection.getTypedMethod(serverConnectionClass, null, Queue.class, serverConnectionClass); } getNetworkMarkers = networkMarkers; @@ -65,7 +65,7 @@ public abstract class TinyProtocol { private Set uninjectedChannels = Collections.newSetFromMap(new MapMaker().weakKeys().makeMap()); // List of network markers - private List networkManagers; + private Collection networkManagers; // Injected channel handlers private List serverChannels = Lists.newArrayList(); @@ -196,7 +196,7 @@ public abstract class TinyProtocol { boolean looking = true; // We need to synchronize against this list - networkManagers = (List) getNetworkMarkers.invoke(null, serverConnection); + networkManagers = (Collection) getNetworkMarkers.invoke(null, serverConnection); createServerChannelHandler(); // Find the correct list, or implicitly throw an exception From 1186e84020906c529579a78785ef534af4e293be Mon Sep 17 00:00:00 2001 From: Lixfel Date: Thu, 16 Sep 2021 12:51:43 +0200 Subject: [PATCH 19/24] Hotfix separate WEWrapping from Flattening to allow WE-Less SpigotCore --- .../de/steamwar/core/FlatteningWrapper14.java | 600 +----------------- .../de/steamwar/core/WorldEditWrapper14.java | 599 +++++++++++++++++ .../de/steamwar/core/FlatteningWrapper8.java | 267 -------- .../de/steamwar/core/WorldEditWrapper8.java | 266 ++++++++ .../de/steamwar/core/FlatteningWrapper.java | 10 - .../de/steamwar/core/WorldEditWrapper.java | 26 + .../src/de/steamwar/sql/Schematic.java | 8 +- 7 files changed, 897 insertions(+), 879 deletions(-) create mode 100644 SpigotCore_14/src/de/steamwar/core/WorldEditWrapper14.java create mode 100644 SpigotCore_8/src/de/steamwar/core/WorldEditWrapper8.java create mode 100644 SpigotCore_Main/src/de/steamwar/core/WorldEditWrapper.java diff --git a/SpigotCore_14/src/de/steamwar/core/FlatteningWrapper14.java b/SpigotCore_14/src/de/steamwar/core/FlatteningWrapper14.java index af35928..3a28106 100644 --- a/SpigotCore_14/src/de/steamwar/core/FlatteningWrapper14.java +++ b/SpigotCore_14/src/de/steamwar/core/FlatteningWrapper14.java @@ -20,48 +20,14 @@ package de.steamwar.core; import com.comphenix.tinyprotocol.Reflection; -import com.google.common.collect.ImmutableList; -import com.google.common.collect.Maps; -import com.sk89q.jnbt.*; -import com.sk89q.worldedit.EmptyClipboardException; -import com.sk89q.worldedit.WorldEdit; -import com.sk89q.worldedit.WorldEditException; -import com.sk89q.worldedit.bukkit.WorldEditPlugin; -import com.sk89q.worldedit.extension.input.InputParseException; -import com.sk89q.worldedit.extension.input.ParserContext; -import com.sk89q.worldedit.extension.platform.Actor; -import com.sk89q.worldedit.extension.platform.Capability; -import com.sk89q.worldedit.extension.platform.Platform; -import com.sk89q.worldedit.extent.clipboard.BlockArrayClipboard; -import com.sk89q.worldedit.extent.clipboard.Clipboard; -import com.sk89q.worldedit.extent.clipboard.io.BuiltInClipboardFormat; -import com.sk89q.worldedit.extent.clipboard.io.ClipboardFormat; -import com.sk89q.worldedit.extent.clipboard.io.ClipboardWriter; -import com.sk89q.worldedit.extent.clipboard.io.NBTSchematicReader; -import com.sk89q.worldedit.extent.clipboard.io.legacycompat.*; -import com.sk89q.worldedit.math.BlockVector3; -import com.sk89q.worldedit.regions.CuboidRegion; -import com.sk89q.worldedit.regions.Region; -import com.sk89q.worldedit.session.ClipboardHolder; -import com.sk89q.worldedit.world.DataFixer; -import com.sk89q.worldedit.world.block.BlockState; -import com.sk89q.worldedit.world.block.BlockTypes; -import com.sk89q.worldedit.world.registry.LegacyMapper; import de.steamwar.scoreboard.SWScoreboard; -import de.steamwar.sql.NoClipboardException; import org.bukkit.Bukkit; import org.bukkit.Material; -import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.meta.SkullMeta; -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.util.*; -import java.util.stream.Collectors; - -import static com.google.common.base.Preconditions.checkNotNull; +import java.util.HashMap; +import java.util.Map; public class FlatteningWrapper14 implements FlatteningWrapper.IFlatteningWrapper { @@ -331,566 +297,4 @@ public class FlatteningWrapper14 implements FlatteningWrapper.IFlatteningWrapper head.setItemMeta(headmeta); return head; } - - private static final ClipboardFormat SCHEMATIC = BuiltInClipboardFormat.MCEDIT_SCHEMATIC; - private static final ClipboardFormat SCHEM = BuiltInClipboardFormat.SPONGE_SCHEMATIC; - - @Override - public byte[] getPlayerClipboard(Player player, boolean schemFormat) { - ClipboardHolder clipboardHolder; - try { - clipboardHolder = getWorldEditPlugin().getSession(player).getClipboard(); - } catch (EmptyClipboardException e) { - throw new NoClipboardException(); - } - - Clipboard clipboard = clipboardHolder.getClipboard(); - if(clipboard == null) - throw new NoClipboardException(); - - ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); - try{ - if(schemFormat){ - ClipboardWriter writer = SCHEM.getWriter(outputStream); - writer.write(clipboard); - writer.close(); - }else{ - SCHEMATIC.getWriter(outputStream).write(clipboard); - } - }catch(NullPointerException e){ - throw new RuntimeException(e.getMessage(), new IOException(e)); - } catch (IOException e) { - throw new RuntimeException(e.getMessage(), e); - } - return outputStream.toByteArray(); - } - - @Override - public void setPlayerClipboard(Player player, InputStream is, boolean schemFormat) { - Clipboard clipboard = null; - try { - clipboard = getClipboard(is, schemFormat); - } catch (IOException e) { - throw new RuntimeException(e.getMessage(), e); - } - - if (clipboard == null) - throw new NoClipboardException(); - - Actor actor = getWorldEditPlugin().wrapCommandSender(player); - getWorldEditPlugin().getWorldEdit().getSessionManager().get(actor).setClipboard(new ClipboardHolder(clipboard)); - } - - @Override - public Clipboard getClipboard(InputStream is, boolean schemFormat) throws IOException { - try { - if(schemFormat){ - return new SpongeSchematicReader(new NBTInputStream(is)).read(); - }else{ - return new MCEditSchematicReader(new NBTInputStream(is)).read(); - } - } catch (NullPointerException e) { - throw new NoClipboardException(); - } - } - - private static WorldEditPlugin getWorldEditPlugin() { - return (WorldEditPlugin) Bukkit.getPluginManager().getPlugin("WorldEdit"); - } - - private static class MCEditSchematicReader extends NBTSchematicReader { - - private final NBTInputStream inputStream; - private final DataFixer fixer; - private boolean faweSchem = false; - private static final ImmutableList COMPATIBILITY_HANDLERS - = ImmutableList.of( - new SignCompatibilityHandler(), - new FlowerPotCompatibilityHandler(), - new NoteBlockCompatibilityHandler(), - new SkullBlockCompatibilityHandler() - ); - - /** - * Create a new instance. - * - * @param inputStream the input stream to read from - */ - MCEditSchematicReader(NBTInputStream inputStream) { - checkNotNull(inputStream); - this.inputStream = inputStream; - this.fixer = null; - } - - @Override - public Clipboard read() throws IOException { - // Schematic tag - NamedTag rootTag = inputStream.readNamedTag(); - if (!rootTag.getName().equals("Schematic")) { - throw new IOException("Tag 'Schematic' does not exist or is not first"); - } - CompoundTag schematicTag = (CompoundTag) rootTag.getTag(); - - // Check - Map schematic = schematicTag.getValue(); - if (!schematic.containsKey("Blocks")) { - throw new IOException("Schematic file is missing a 'Blocks' tag"); - } - - // Check type of Schematic - String materials = requireTag(schematic, "Materials", StringTag.class).getValue(); - if (!materials.equals("Alpha")) { - throw new IOException("Schematic file is not an Alpha schematic"); - } - - // ==================================================================== - // Metadata - // ==================================================================== - - BlockVector3 origin; - Region region; - - // Get information - short width = requireTag(schematic, "Width", ShortTag.class).getValue(); - short height = requireTag(schematic, "Height", ShortTag.class).getValue(); - short length = requireTag(schematic, "Length", ShortTag.class).getValue(); - - int originX = 0; - int originY = 0; - int originZ = 0; - try { - originX = requireTag(schematic, "WEOriginX", IntTag.class).getValue(); - originY = requireTag(schematic, "WEOriginY", IntTag.class).getValue(); - originZ = requireTag(schematic, "WEOriginZ", IntTag.class).getValue(); - BlockVector3 min = BlockVector3.at(originX, originY, originZ); - - int offsetX = requireTag(schematic, "WEOffsetX", IntTag.class).getValue(); - int offsetY = requireTag(schematic, "WEOffsetY", IntTag.class).getValue(); - int offsetZ = requireTag(schematic, "WEOffsetZ", IntTag.class).getValue(); - BlockVector3 offset = BlockVector3.at(offsetX, offsetY, offsetZ); - - origin = min.subtract(offset); - region = new CuboidRegion(min, min.add(width, height, length).subtract(BlockVector3.ONE)); - } catch (IOException ignored) { - origin = BlockVector3.ZERO; - region = new CuboidRegion(origin, origin.add(width, height, length).subtract(BlockVector3.ONE)); - } - - // ==================================================================== - // Blocks - // ==================================================================== - - // Get blocks - byte[] blockId = requireTag(schematic, "Blocks", ByteArrayTag.class).getValue(); - byte[] blockData = requireTag(schematic, "Data", ByteArrayTag.class).getValue(); - byte[] addId = new byte[0]; - short[] blocks = new short[blockId.length]; // Have to later combine IDs - - // We support 4096 block IDs using the same method as vanilla Minecraft, where - // the highest 4 bits are stored in a separate byte array. - if (schematic.containsKey("AddBlocks")) { - addId = requireTag(schematic, "AddBlocks", ByteArrayTag.class).getValue(); - } - - // Combine the AddBlocks data with the first 8-bit block ID - for (int index = 0; index < blockId.length; index++) { - if ((index >> 1) >= addId.length) { // No corresponding AddBlocks index - blocks[index] = (short) (blockId[index] & 0xFF); - } else { - if ((index & 1) == 0) { - blocks[index] = (short) (((addId[index >> 1] & 0x0F) << 8) + (blockId[index] & 0xFF)); - } else { - blocks[index] = (short) (((addId[index >> 1] & 0xF0) << 4) + (blockId[index] & 0xFF)); - } - } - } - - // Need to pull out tile entities - final ListTag tileEntityTag = getTag(schematic, "TileEntities", ListTag.class); - List tileEntities = tileEntityTag == null ? new ArrayList<>() : tileEntityTag.getValue(); - Map> tileEntitiesMap = new HashMap<>(); - Map blockStates = new HashMap<>(); - - for (Tag tag : tileEntities) { - if (!(tag instanceof CompoundTag)) continue; - CompoundTag t = (CompoundTag) tag; - int x = t.getInt("x"); - int y = t.getInt("y"); - int z = t.getInt("z"); - int index = y * width * length + z * width + x; - if(index < 0 || index >= blocks.length) - faweSchem = true; - } - - for (Tag tag : tileEntities) { - if (!(tag instanceof CompoundTag)) continue; - CompoundTag t = (CompoundTag) tag; - Map values = new HashMap<>(t.getValue()); - String id = t.getString("id"); - values.put("id", new StringTag(convertBlockEntityId(id))); - int x = t.getInt("x"); - int y = t.getInt("y"); - int z = t.getInt("z"); - if(faweSchem){ - x -= originX; - y -= originY; - z -= originZ; - } - - int index = y * width * length + z * width + x; - - try{ - BlockState block = getBlockState(blocks[index], blockData[index]); - BlockState newBlock = block; - if (newBlock != null) { - for (NBTCompatibilityHandler handler : COMPATIBILITY_HANDLERS) { - if (handler.isAffectedBlock(newBlock)) { - newBlock = handler.updateNBT(block, values); - if (newBlock == null || values.isEmpty()) { - break; - } - } - } - } - if (values.isEmpty()) { - t = null; - } else { - t = new CompoundTag(values); - } - - if (fixer != null && t != null) { - t = fixer.fixUp(DataFixer.FixTypes.BLOCK_ENTITY, t, -1); - } - - BlockVector3 vec = BlockVector3.at(x, y, z); - if (t != null) { - tileEntitiesMap.put(vec, t.getValue()); - } - blockStates.put(vec, newBlock); - }catch(ArrayIndexOutOfBoundsException e){ - //ignored - } - } - - BlockArrayClipboard clipboard = new BlockArrayClipboard(region); - clipboard.setOrigin(origin); - - - for (int x = 0; x < width; ++x) { - for (int y = 0; y < height; ++y) { - for (int z = 0; z < length; ++z) { - int index = y * width * length + z * width + x; - BlockVector3 pt = BlockVector3.at(x, y, z); - BlockState state = blockStates.computeIfAbsent(pt, p -> getBlockState(blocks[index], blockData[index])); - - try { - if (state != null) { - if (tileEntitiesMap.containsKey(pt)) { - clipboard.setBlock(region.getMinimumPoint().add(pt), state.toBaseBlock(new CompoundTag(tileEntitiesMap.get(pt)))); - } else { - clipboard.setBlock(region.getMinimumPoint().add(pt), state); - } - } - } catch (WorldEditException ignored) { // BlockArrayClipboard won't throw this - } - } - } - } - - return clipboard; - } - - private String convertBlockEntityId(String id) { - switch (id) { - case "Cauldron": - return "brewing_stand"; - case "Control": - return "command_block"; - case "DLDetector": - return "daylight_detector"; - case "Trap": - return "dispenser"; - case "EnchantTable": - return "enchanting_table"; - case "EndGateway": - return "end_gateway"; - case "AirPortal": - return "end_portal"; - case "EnderChest": - return "ender_chest"; - case "FlowerPot": - return "flower_pot"; - case "RecordPlayer": - return "jukebox"; - case "MobSpawner": - return "mob_spawner"; - case "Music": - case "noteblock": - return "note_block"; - case "Structure": - return "structure_block"; - case "Chest": - return "chest"; - case "Sign": - return "sign"; - case "Banner": - return "banner"; - case "Beacon": - return "beacon"; - case "Comparator": - return "comparator"; - case "Dropper": - return "dropper"; - case "Furnace": - return "furnace"; - case "Hopper": - return "hopper"; - case "Skull": - return "skull"; - default: - return id; - } - } - - private BlockState getBlockState(int id, int data) { - return LegacyMapper.getInstance().getBlockFromLegacy(id, data); - } - - @Override - public void close() throws IOException { - inputStream.close(); - } - } - private static class SpongeSchematicReader extends NBTSchematicReader { - - private final NBTInputStream inputStream; - private DataFixer fixer = null; - private int schematicVersion = -1; - private int dataVersion = -1; - private boolean faweSchem = false; - - /** - * Create a new instance. - * - * @param inputStream the input stream to read from - */ - public SpongeSchematicReader(NBTInputStream inputStream) { - checkNotNull(inputStream); - this.inputStream = inputStream; - } - - @Override - public Clipboard read() throws IOException { - CompoundTag schematicTag = getBaseTag(); - Map schematic = schematicTag.getValue(); - - final Platform platform = WorldEdit.getInstance().getPlatformManager() - .queryCapability(Capability.WORLD_EDITING); - int liveDataVersion = platform.getDataVersion(); - - if (schematicVersion == 1) { - dataVersion = 1631; // this is a relatively safe assumption unless someone imports a schematic from 1.12, e.g. sponge 7.1- - fixer = platform.getDataFixer(); - return readVersion1(schematicTag); - } else if (schematicVersion == 2) { - dataVersion = requireTag(schematic, "DataVersion", IntTag.class).getValue(); - if (dataVersion < liveDataVersion) { - fixer = platform.getDataFixer(); - } - - return readVersion1(schematicTag); - } - throw new IOException("This schematic version is currently not supported"); - } - - @Override - public OptionalInt getDataVersion() { - try { - CompoundTag schematicTag = getBaseTag(); - Map schematic = schematicTag.getValue(); - if (schematicVersion == 1) { - return OptionalInt.of(1631); - } else if (schematicVersion == 2) { - return OptionalInt.of(requireTag(schematic, "DataVersion", IntTag.class).getValue()); - } - return OptionalInt.empty(); - } catch (IOException e) { - return OptionalInt.empty(); - } - } - - private CompoundTag getBaseTag() throws IOException { - NamedTag rootTag = inputStream.readNamedTag(); - if (!rootTag.getName().equals("Schematic")) { - throw new IOException("Tag 'Schematic' does not exist or is not first"); - } - CompoundTag schematicTag = (CompoundTag) rootTag.getTag(); - - // Check - Map schematic = schematicTag.getValue(); - - schematicVersion = requireTag(schematic, "Version", IntTag.class).getValue(); - return schematicTag; - } - - private BlockArrayClipboard readVersion1(CompoundTag schematicTag) throws IOException { - BlockVector3 origin; - Region region; - Map schematic = schematicTag.getValue(); - - int width = requireTag(schematic, "Width", ShortTag.class).getValue(); - int height = requireTag(schematic, "Height", ShortTag.class).getValue(); - int length = requireTag(schematic, "Length", ShortTag.class).getValue(); - - IntArrayTag offsetTag = getTag(schematic, "Offset", IntArrayTag.class); - int[] offsetParts; - if (offsetTag != null) { - offsetParts = offsetTag.getValue(); - if (offsetParts.length != 3) { - throw new IOException("Invalid offset specified in schematic."); - } - } else { - offsetParts = new int[] {0, 0, 0}; - } - - BlockVector3 min = BlockVector3.at(offsetParts[0], offsetParts[1], offsetParts[2]); - - CompoundTag metadataTag = getTag(schematic, "Metadata", CompoundTag.class); - int offsetX = 0; - int offsetY = 0; - int offsetZ = 0; - if (metadataTag != null && metadataTag.containsKey("WEOffsetX")) { - // We appear to have WorldEdit Metadata - Map metadata = metadataTag.getValue(); - offsetX = requireTag(metadata, "WEOffsetX", IntTag.class).getValue(); - offsetY = requireTag(metadata, "WEOffsetY", IntTag.class).getValue(); - offsetZ = requireTag(metadata, "WEOffsetZ", IntTag.class).getValue(); - BlockVector3 offset = BlockVector3.at(offsetX, offsetY, offsetZ); - origin = min.subtract(offset); - region = new CuboidRegion(min, min.add(width, height, length).subtract(BlockVector3.ONE)); - } else { - origin = min; - region = new CuboidRegion(origin, origin.add(width, height, length).subtract(BlockVector3.ONE)); - } - - IntTag paletteMaxTag = getTag(schematic, "PaletteMax", IntTag.class); - Map paletteObject = requireTag(schematic, "Palette", CompoundTag.class).getValue(); - if (paletteMaxTag != null && paletteObject.size() != paletteMaxTag.getValue()) { - throw new IOException("Block palette size does not match expected size."); - } - - Map palette = new HashMap<>(); - - ParserContext parserContext = new ParserContext(); - parserContext.setRestricted(false); - parserContext.setTryLegacy(false); - parserContext.setPreferringWildcard(false); - - for (String palettePart : paletteObject.keySet()) { - int id = requireTag(paletteObject, palettePart, IntTag.class).getValue(); - if (fixer != null) { - palettePart = fixer.fixUp(DataFixer.FixTypes.BLOCK_STATE, palettePart, dataVersion); - } - BlockState state; - try { - state = WorldEdit.getInstance().getBlockFactory().parseFromInput(palettePart, parserContext).toImmutableState(); - } catch (InputParseException e) { - state = BlockTypes.AIR.getDefaultState(); - } - palette.put(id, state); - } - - byte[] blocks = requireTag(schematic, "BlockData", ByteArrayTag.class).getValue(); - - Map> tileEntitiesMap = new HashMap<>(); - ListTag tileEntities = getTag(schematic, "BlockEntities", ListTag.class); - if (tileEntities == null) { - tileEntities = getTag(schematic, "TileEntities", ListTag.class); - } - if (tileEntities != null) { - List> tileEntityTags = tileEntities.getValue().stream() - .map(tag -> (CompoundTag) tag) - .map(CompoundTag::getValue) - .collect(Collectors.toList()); - - for (Map tileEntity : tileEntityTags) { - int[] pos = requireTag(tileEntity, "Pos", IntArrayTag.class).getValue(); - if(pos[0] < 0 || pos[0] >= width || pos[1] < 0 || pos[1] >= height || pos[2] < 0 || pos[2] >= length) - faweSchem = true; - } - - for (Map tileEntity : tileEntityTags) { - int[] pos = requireTag(tileEntity, "Pos", IntArrayTag.class).getValue(); - final BlockVector3 pt = BlockVector3.at(pos[0], pos[1], pos[2]); - Map values = Maps.newHashMap(tileEntity); - if(faweSchem){ - values.put("x", new IntTag(pt.getBlockX() - offsetX)); - values.put("y", new IntTag(pt.getBlockY() - offsetY)); - values.put("z", new IntTag(pt.getBlockZ() - offsetZ)); - }else{ - values.put("x", new IntTag(pt.getBlockX())); - values.put("y", new IntTag(pt.getBlockY())); - values.put("z", new IntTag(pt.getBlockZ())); - } - values.put("id", values.get("Id")); - values.remove("Id"); - values.remove("Pos"); - if (fixer != null) { - tileEntity = fixer.fixUp(DataFixer.FixTypes.BLOCK_ENTITY, new CompoundTag(values), dataVersion).getValue(); - } else { - tileEntity = values; - } - tileEntitiesMap.put(pt, tileEntity); - } - } - - BlockArrayClipboard clipboard = new BlockArrayClipboard(region); - clipboard.setOrigin(origin); - - int index = 0; - int i = 0; - int value; - int varintLength; - while (i < blocks.length) { - value = 0; - varintLength = 0; - - while (true) { - value |= (blocks[i] & 127) << (varintLength++ * 7); - if (varintLength > 5) { - throw new IOException("VarInt too big (probably corrupted data)"); - } - if ((blocks[i] & 128) != 128) { - i++; - break; - } - i++; - } - // index = (y * length * width) + (z * width) + x - int y = index / (width * length); - int z = (index % (width * length)) / width; - int x = (index % (width * length)) % width; - BlockState state = palette.get(value); - BlockVector3 pt = BlockVector3.at(x, y, z); - try { - if (tileEntitiesMap.containsKey(pt)) { - clipboard.setBlock(clipboard.getMinimumPoint().add(pt), state.toBaseBlock(new CompoundTag(tileEntitiesMap.get(pt)))); - } else { - clipboard.setBlock(clipboard.getMinimumPoint().add(pt), state); - } - } catch (WorldEditException e) { - throw new IOException("Failed to load a block in the schematic"); - } - - index++; - } - - return clipboard; - } - - @Override - public void close() throws IOException { - inputStream.close(); - } - } } diff --git a/SpigotCore_14/src/de/steamwar/core/WorldEditWrapper14.java b/SpigotCore_14/src/de/steamwar/core/WorldEditWrapper14.java new file mode 100644 index 0000000..96b135b --- /dev/null +++ b/SpigotCore_14/src/de/steamwar/core/WorldEditWrapper14.java @@ -0,0 +1,599 @@ +package de.steamwar.core; + +import com.google.common.collect.ImmutableList; +import com.google.common.collect.Maps; +import com.sk89q.jnbt.*; +import com.sk89q.worldedit.EmptyClipboardException; +import com.sk89q.worldedit.WorldEdit; +import com.sk89q.worldedit.WorldEditException; +import com.sk89q.worldedit.extension.input.InputParseException; +import com.sk89q.worldedit.extension.input.ParserContext; +import com.sk89q.worldedit.extension.platform.Actor; +import com.sk89q.worldedit.extension.platform.Capability; +import com.sk89q.worldedit.extension.platform.Platform; +import com.sk89q.worldedit.extent.clipboard.BlockArrayClipboard; +import com.sk89q.worldedit.extent.clipboard.Clipboard; +import com.sk89q.worldedit.extent.clipboard.io.BuiltInClipboardFormat; +import com.sk89q.worldedit.extent.clipboard.io.ClipboardFormat; +import com.sk89q.worldedit.extent.clipboard.io.ClipboardWriter; +import com.sk89q.worldedit.extent.clipboard.io.NBTSchematicReader; +import com.sk89q.worldedit.extent.clipboard.io.legacycompat.*; +import com.sk89q.worldedit.math.BlockVector3; +import com.sk89q.worldedit.regions.CuboidRegion; +import com.sk89q.worldedit.regions.Region; +import com.sk89q.worldedit.session.ClipboardHolder; +import com.sk89q.worldedit.world.DataFixer; +import com.sk89q.worldedit.world.block.BlockState; +import com.sk89q.worldedit.world.block.BlockTypes; +import com.sk89q.worldedit.world.registry.LegacyMapper; +import de.steamwar.sql.NoClipboardException; +import org.bukkit.entity.Player; + +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.util.*; +import java.util.stream.Collectors; + +import static com.google.common.base.Preconditions.checkNotNull; + +public class WorldEditWrapper14 implements WorldEditWrapper.IWorldEditWrapper { + + private static final ClipboardFormat SCHEMATIC = BuiltInClipboardFormat.MCEDIT_SCHEMATIC; + private static final ClipboardFormat SCHEM = BuiltInClipboardFormat.SPONGE_SCHEMATIC; + + @Override + public byte[] getPlayerClipboard(Player player, boolean schemFormat) { + ClipboardHolder clipboardHolder; + try { + clipboardHolder = WorldEditWrapper.getWorldEditPlugin().getSession(player).getClipboard(); + } catch (EmptyClipboardException e) { + throw new NoClipboardException(); + } + + Clipboard clipboard = clipboardHolder.getClipboard(); + if(clipboard == null) + throw new NoClipboardException(); + + ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); + try{ + if(schemFormat){ + ClipboardWriter writer = SCHEM.getWriter(outputStream); + writer.write(clipboard); + writer.close(); + }else{ + SCHEMATIC.getWriter(outputStream).write(clipboard); + } + }catch(NullPointerException e){ + throw new RuntimeException(e.getMessage(), new IOException(e)); + } catch (IOException e) { + throw new RuntimeException(e.getMessage(), e); + } + return outputStream.toByteArray(); + } + + @Override + public void setPlayerClipboard(Player player, InputStream is, boolean schemFormat) { + Clipboard clipboard = null; + try { + clipboard = getClipboard(is, schemFormat); + } catch (IOException e) { + throw new RuntimeException(e.getMessage(), e); + } + + if (clipboard == null) + throw new NoClipboardException(); + + Actor actor = WorldEditWrapper.getWorldEditPlugin().wrapCommandSender(player); + WorldEditWrapper.getWorldEditPlugin().getWorldEdit().getSessionManager().get(actor).setClipboard(new ClipboardHolder(clipboard)); + } + + @Override + public Clipboard getClipboard(InputStream is, boolean schemFormat) throws IOException { + try { + if(schemFormat){ + return new SpongeSchematicReader(new NBTInputStream(is)).read(); + }else{ + return new MCEditSchematicReader(new NBTInputStream(is)).read(); + } + } catch (NullPointerException e) { + throw new NoClipboardException(); + } + } + + private static class MCEditSchematicReader extends NBTSchematicReader { + + private final NBTInputStream inputStream; + private final DataFixer fixer; + private boolean faweSchem = false; + private static final ImmutableList COMPATIBILITY_HANDLERS + = ImmutableList.of( + new SignCompatibilityHandler(), + new FlowerPotCompatibilityHandler(), + new NoteBlockCompatibilityHandler(), + new SkullBlockCompatibilityHandler() + ); + + /** + * Create a new instance. + * + * @param inputStream the input stream to read from + */ + MCEditSchematicReader(NBTInputStream inputStream) { + checkNotNull(inputStream); + this.inputStream = inputStream; + this.fixer = null; + } + + @Override + public Clipboard read() throws IOException { + // Schematic tag + NamedTag rootTag = inputStream.readNamedTag(); + if (!rootTag.getName().equals("Schematic")) { + throw new IOException("Tag 'Schematic' does not exist or is not first"); + } + CompoundTag schematicTag = (CompoundTag) rootTag.getTag(); + + // Check + Map schematic = schematicTag.getValue(); + if (!schematic.containsKey("Blocks")) { + throw new IOException("Schematic file is missing a 'Blocks' tag"); + } + + // Check type of Schematic + String materials = requireTag(schematic, "Materials", StringTag.class).getValue(); + if (!materials.equals("Alpha")) { + throw new IOException("Schematic file is not an Alpha schematic"); + } + + // ==================================================================== + // Metadata + // ==================================================================== + + BlockVector3 origin; + Region region; + + // Get information + short width = requireTag(schematic, "Width", ShortTag.class).getValue(); + short height = requireTag(schematic, "Height", ShortTag.class).getValue(); + short length = requireTag(schematic, "Length", ShortTag.class).getValue(); + + int originX = 0; + int originY = 0; + int originZ = 0; + try { + originX = requireTag(schematic, "WEOriginX", IntTag.class).getValue(); + originY = requireTag(schematic, "WEOriginY", IntTag.class).getValue(); + originZ = requireTag(schematic, "WEOriginZ", IntTag.class).getValue(); + BlockVector3 min = BlockVector3.at(originX, originY, originZ); + + int offsetX = requireTag(schematic, "WEOffsetX", IntTag.class).getValue(); + int offsetY = requireTag(schematic, "WEOffsetY", IntTag.class).getValue(); + int offsetZ = requireTag(schematic, "WEOffsetZ", IntTag.class).getValue(); + BlockVector3 offset = BlockVector3.at(offsetX, offsetY, offsetZ); + + origin = min.subtract(offset); + region = new CuboidRegion(min, min.add(width, height, length).subtract(BlockVector3.ONE)); + } catch (IOException ignored) { + origin = BlockVector3.ZERO; + region = new CuboidRegion(origin, origin.add(width, height, length).subtract(BlockVector3.ONE)); + } + + // ==================================================================== + // Blocks + // ==================================================================== + + // Get blocks + byte[] blockId = requireTag(schematic, "Blocks", ByteArrayTag.class).getValue(); + byte[] blockData = requireTag(schematic, "Data", ByteArrayTag.class).getValue(); + byte[] addId = new byte[0]; + short[] blocks = new short[blockId.length]; // Have to later combine IDs + + // We support 4096 block IDs using the same method as vanilla Minecraft, where + // the highest 4 bits are stored in a separate byte array. + if (schematic.containsKey("AddBlocks")) { + addId = requireTag(schematic, "AddBlocks", ByteArrayTag.class).getValue(); + } + + // Combine the AddBlocks data with the first 8-bit block ID + for (int index = 0; index < blockId.length; index++) { + if ((index >> 1) >= addId.length) { // No corresponding AddBlocks index + blocks[index] = (short) (blockId[index] & 0xFF); + } else { + if ((index & 1) == 0) { + blocks[index] = (short) (((addId[index >> 1] & 0x0F) << 8) + (blockId[index] & 0xFF)); + } else { + blocks[index] = (short) (((addId[index >> 1] & 0xF0) << 4) + (blockId[index] & 0xFF)); + } + } + } + + // Need to pull out tile entities + final ListTag tileEntityTag = getTag(schematic, "TileEntities", ListTag.class); + List tileEntities = tileEntityTag == null ? new ArrayList<>() : tileEntityTag.getValue(); + Map> tileEntitiesMap = new HashMap<>(); + Map blockStates = new HashMap<>(); + + for (Tag tag : tileEntities) { + if (!(tag instanceof CompoundTag)) continue; + CompoundTag t = (CompoundTag) tag; + int x = t.getInt("x"); + int y = t.getInt("y"); + int z = t.getInt("z"); + int index = y * width * length + z * width + x; + if(index < 0 || index >= blocks.length) + faweSchem = true; + } + + for (Tag tag : tileEntities) { + if (!(tag instanceof CompoundTag)) continue; + CompoundTag t = (CompoundTag) tag; + Map values = new HashMap<>(t.getValue()); + String id = t.getString("id"); + values.put("id", new StringTag(convertBlockEntityId(id))); + int x = t.getInt("x"); + int y = t.getInt("y"); + int z = t.getInt("z"); + if(faweSchem){ + x -= originX; + y -= originY; + z -= originZ; + } + + int index = y * width * length + z * width + x; + + try{ + BlockState block = getBlockState(blocks[index], blockData[index]); + BlockState newBlock = block; + if (newBlock != null) { + for (NBTCompatibilityHandler handler : COMPATIBILITY_HANDLERS) { + if (handler.isAffectedBlock(newBlock)) { + newBlock = handler.updateNBT(block, values); + if (newBlock == null || values.isEmpty()) { + break; + } + } + } + } + if (values.isEmpty()) { + t = null; + } else { + t = new CompoundTag(values); + } + + if (fixer != null && t != null) { + t = fixer.fixUp(DataFixer.FixTypes.BLOCK_ENTITY, t, -1); + } + + BlockVector3 vec = BlockVector3.at(x, y, z); + if (t != null) { + tileEntitiesMap.put(vec, t.getValue()); + } + blockStates.put(vec, newBlock); + }catch(ArrayIndexOutOfBoundsException e){ + //ignored + } + } + + BlockArrayClipboard clipboard = new BlockArrayClipboard(region); + clipboard.setOrigin(origin); + + + for (int x = 0; x < width; ++x) { + for (int y = 0; y < height; ++y) { + for (int z = 0; z < length; ++z) { + int index = y * width * length + z * width + x; + BlockVector3 pt = BlockVector3.at(x, y, z); + BlockState state = blockStates.computeIfAbsent(pt, p -> getBlockState(blocks[index], blockData[index])); + + try { + if (state != null) { + if (tileEntitiesMap.containsKey(pt)) { + clipboard.setBlock(region.getMinimumPoint().add(pt), state.toBaseBlock(new CompoundTag(tileEntitiesMap.get(pt)))); + } else { + clipboard.setBlock(region.getMinimumPoint().add(pt), state); + } + } + } catch (WorldEditException ignored) { // BlockArrayClipboard won't throw this + } + } + } + } + + return clipboard; + } + + private String convertBlockEntityId(String id) { + switch (id) { + case "Cauldron": + return "brewing_stand"; + case "Control": + return "command_block"; + case "DLDetector": + return "daylight_detector"; + case "Trap": + return "dispenser"; + case "EnchantTable": + return "enchanting_table"; + case "EndGateway": + return "end_gateway"; + case "AirPortal": + return "end_portal"; + case "EnderChest": + return "ender_chest"; + case "FlowerPot": + return "flower_pot"; + case "RecordPlayer": + return "jukebox"; + case "MobSpawner": + return "mob_spawner"; + case "Music": + case "noteblock": + return "note_block"; + case "Structure": + return "structure_block"; + case "Chest": + return "chest"; + case "Sign": + return "sign"; + case "Banner": + return "banner"; + case "Beacon": + return "beacon"; + case "Comparator": + return "comparator"; + case "Dropper": + return "dropper"; + case "Furnace": + return "furnace"; + case "Hopper": + return "hopper"; + case "Skull": + return "skull"; + default: + return id; + } + } + + private BlockState getBlockState(int id, int data) { + return LegacyMapper.getInstance().getBlockFromLegacy(id, data); + } + + @Override + public void close() throws IOException { + inputStream.close(); + } + } + private static class SpongeSchematicReader extends NBTSchematicReader { + + private final NBTInputStream inputStream; + private DataFixer fixer = null; + private int schematicVersion = -1; + private int dataVersion = -1; + private boolean faweSchem = false; + + /** + * Create a new instance. + * + * @param inputStream the input stream to read from + */ + public SpongeSchematicReader(NBTInputStream inputStream) { + checkNotNull(inputStream); + this.inputStream = inputStream; + } + + @Override + public Clipboard read() throws IOException { + CompoundTag schematicTag = getBaseTag(); + Map schematic = schematicTag.getValue(); + + final Platform platform = WorldEdit.getInstance().getPlatformManager() + .queryCapability(Capability.WORLD_EDITING); + int liveDataVersion = platform.getDataVersion(); + + if (schematicVersion == 1) { + dataVersion = 1631; // this is a relatively safe assumption unless someone imports a schematic from 1.12, e.g. sponge 7.1- + fixer = platform.getDataFixer(); + return readVersion1(schematicTag); + } else if (schematicVersion == 2) { + dataVersion = requireTag(schematic, "DataVersion", IntTag.class).getValue(); + if (dataVersion < liveDataVersion) { + fixer = platform.getDataFixer(); + } + + return readVersion1(schematicTag); + } + throw new IOException("This schematic version is currently not supported"); + } + + @Override + public OptionalInt getDataVersion() { + try { + CompoundTag schematicTag = getBaseTag(); + Map schematic = schematicTag.getValue(); + if (schematicVersion == 1) { + return OptionalInt.of(1631); + } else if (schematicVersion == 2) { + return OptionalInt.of(requireTag(schematic, "DataVersion", IntTag.class).getValue()); + } + return OptionalInt.empty(); + } catch (IOException e) { + return OptionalInt.empty(); + } + } + + private CompoundTag getBaseTag() throws IOException { + NamedTag rootTag = inputStream.readNamedTag(); + if (!rootTag.getName().equals("Schematic")) { + throw new IOException("Tag 'Schematic' does not exist or is not first"); + } + CompoundTag schematicTag = (CompoundTag) rootTag.getTag(); + + // Check + Map schematic = schematicTag.getValue(); + + schematicVersion = requireTag(schematic, "Version", IntTag.class).getValue(); + return schematicTag; + } + + private BlockArrayClipboard readVersion1(CompoundTag schematicTag) throws IOException { + BlockVector3 origin; + Region region; + Map schematic = schematicTag.getValue(); + + int width = requireTag(schematic, "Width", ShortTag.class).getValue(); + int height = requireTag(schematic, "Height", ShortTag.class).getValue(); + int length = requireTag(schematic, "Length", ShortTag.class).getValue(); + + IntArrayTag offsetTag = getTag(schematic, "Offset", IntArrayTag.class); + int[] offsetParts; + if (offsetTag != null) { + offsetParts = offsetTag.getValue(); + if (offsetParts.length != 3) { + throw new IOException("Invalid offset specified in schematic."); + } + } else { + offsetParts = new int[] {0, 0, 0}; + } + + BlockVector3 min = BlockVector3.at(offsetParts[0], offsetParts[1], offsetParts[2]); + + CompoundTag metadataTag = getTag(schematic, "Metadata", CompoundTag.class); + int offsetX = 0; + int offsetY = 0; + int offsetZ = 0; + if (metadataTag != null && metadataTag.containsKey("WEOffsetX")) { + // We appear to have WorldEdit Metadata + Map metadata = metadataTag.getValue(); + offsetX = requireTag(metadata, "WEOffsetX", IntTag.class).getValue(); + offsetY = requireTag(metadata, "WEOffsetY", IntTag.class).getValue(); + offsetZ = requireTag(metadata, "WEOffsetZ", IntTag.class).getValue(); + BlockVector3 offset = BlockVector3.at(offsetX, offsetY, offsetZ); + origin = min.subtract(offset); + region = new CuboidRegion(min, min.add(width, height, length).subtract(BlockVector3.ONE)); + } else { + origin = min; + region = new CuboidRegion(origin, origin.add(width, height, length).subtract(BlockVector3.ONE)); + } + + IntTag paletteMaxTag = getTag(schematic, "PaletteMax", IntTag.class); + Map paletteObject = requireTag(schematic, "Palette", CompoundTag.class).getValue(); + if (paletteMaxTag != null && paletteObject.size() != paletteMaxTag.getValue()) { + throw new IOException("Block palette size does not match expected size."); + } + + Map palette = new HashMap<>(); + + ParserContext parserContext = new ParserContext(); + parserContext.setRestricted(false); + parserContext.setTryLegacy(false); + parserContext.setPreferringWildcard(false); + + for (String palettePart : paletteObject.keySet()) { + int id = requireTag(paletteObject, palettePart, IntTag.class).getValue(); + if (fixer != null) { + palettePart = fixer.fixUp(DataFixer.FixTypes.BLOCK_STATE, palettePart, dataVersion); + } + BlockState state; + try { + state = WorldEdit.getInstance().getBlockFactory().parseFromInput(palettePart, parserContext).toImmutableState(); + } catch (InputParseException e) { + state = BlockTypes.AIR.getDefaultState(); + } + palette.put(id, state); + } + + byte[] blocks = requireTag(schematic, "BlockData", ByteArrayTag.class).getValue(); + + Map> tileEntitiesMap = new HashMap<>(); + ListTag tileEntities = getTag(schematic, "BlockEntities", ListTag.class); + if (tileEntities == null) { + tileEntities = getTag(schematic, "TileEntities", ListTag.class); + } + if (tileEntities != null) { + List> tileEntityTags = tileEntities.getValue().stream() + .map(tag -> (CompoundTag) tag) + .map(CompoundTag::getValue) + .collect(Collectors.toList()); + + for (Map tileEntity : tileEntityTags) { + int[] pos = requireTag(tileEntity, "Pos", IntArrayTag.class).getValue(); + if(pos[0] < 0 || pos[0] >= width || pos[1] < 0 || pos[1] >= height || pos[2] < 0 || pos[2] >= length) + faweSchem = true; + } + + for (Map tileEntity : tileEntityTags) { + int[] pos = requireTag(tileEntity, "Pos", IntArrayTag.class).getValue(); + final BlockVector3 pt = BlockVector3.at(pos[0], pos[1], pos[2]); + Map values = Maps.newHashMap(tileEntity); + if(faweSchem){ + values.put("x", new IntTag(pt.getBlockX() - offsetX)); + values.put("y", new IntTag(pt.getBlockY() - offsetY)); + values.put("z", new IntTag(pt.getBlockZ() - offsetZ)); + }else{ + values.put("x", new IntTag(pt.getBlockX())); + values.put("y", new IntTag(pt.getBlockY())); + values.put("z", new IntTag(pt.getBlockZ())); + } + values.put("id", values.get("Id")); + values.remove("Id"); + values.remove("Pos"); + if (fixer != null) { + tileEntity = fixer.fixUp(DataFixer.FixTypes.BLOCK_ENTITY, new CompoundTag(values), dataVersion).getValue(); + } else { + tileEntity = values; + } + tileEntitiesMap.put(pt, tileEntity); + } + } + + BlockArrayClipboard clipboard = new BlockArrayClipboard(region); + clipboard.setOrigin(origin); + + int index = 0; + int i = 0; + int value; + int varintLength; + while (i < blocks.length) { + value = 0; + varintLength = 0; + + while (true) { + value |= (blocks[i] & 127) << (varintLength++ * 7); + if (varintLength > 5) { + throw new IOException("VarInt too big (probably corrupted data)"); + } + if ((blocks[i] & 128) != 128) { + i++; + break; + } + i++; + } + // index = (y * length * width) + (z * width) + x + int y = index / (width * length); + int z = (index % (width * length)) / width; + int x = (index % (width * length)) % width; + BlockState state = palette.get(value); + BlockVector3 pt = BlockVector3.at(x, y, z); + try { + if (tileEntitiesMap.containsKey(pt)) { + clipboard.setBlock(clipboard.getMinimumPoint().add(pt), state.toBaseBlock(new CompoundTag(tileEntitiesMap.get(pt)))); + } else { + clipboard.setBlock(clipboard.getMinimumPoint().add(pt), state); + } + } catch (WorldEditException e) { + throw new IOException("Failed to load a block in the schematic"); + } + + index++; + } + + return clipboard; + } + + @Override + public void close() throws IOException { + inputStream.close(); + } + } +} diff --git a/SpigotCore_8/src/de/steamwar/core/FlatteningWrapper8.java b/SpigotCore_8/src/de/steamwar/core/FlatteningWrapper8.java index e6dcdb8..371c799 100644 --- a/SpigotCore_8/src/de/steamwar/core/FlatteningWrapper8.java +++ b/SpigotCore_8/src/de/steamwar/core/FlatteningWrapper8.java @@ -20,40 +20,11 @@ package de.steamwar.core; import com.comphenix.tinyprotocol.Reflection; -import com.google.common.base.Preconditions; -import com.google.common.collect.Maps; -import com.sk89q.jnbt.*; -import com.sk89q.worldedit.*; -import com.sk89q.worldedit.blocks.BaseBlock; -import com.sk89q.worldedit.bukkit.BukkitWorld; -import com.sk89q.worldedit.bukkit.WorldEditPlugin; -import com.sk89q.worldedit.extension.input.ParserContext; -import com.sk89q.worldedit.extension.platform.Actor; -import com.sk89q.worldedit.extent.clipboard.BlockArrayClipboard; -import com.sk89q.worldedit.extent.clipboard.Clipboard; -import com.sk89q.worldedit.extent.clipboard.io.ClipboardFormat; -import com.sk89q.worldedit.extent.clipboard.io.ClipboardReader; -import com.sk89q.worldedit.extent.clipboard.io.SchematicReader; -import com.sk89q.worldedit.regions.CuboidRegion; -import com.sk89q.worldedit.session.ClipboardHolder; -import com.sk89q.worldedit.world.registry.WorldData; import de.steamwar.scoreboard.SWScoreboard; -import de.steamwar.sql.NoClipboardException; -import org.bukkit.Bukkit; import org.bukkit.Material; -import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.meta.SkullMeta; -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.stream.Collectors; - public class FlatteningWrapper8 implements FlatteningWrapper.IFlatteningWrapper { private static final Reflection.FieldAccessor scoreboardName = Reflection.getField(SWScoreboard.scoreboardObjective, String.class, 1); @@ -94,242 +65,4 @@ public class FlatteningWrapper8 implements FlatteningWrapper.IFlatteningWrapper head.setItemMeta(headmeta); return head; } - - @Override - public byte[] getPlayerClipboard(Player player, boolean schemFormat) { - ClipboardHolder clipboardHolder; - try { - clipboardHolder = getWorldEditPlugin().getSession(player).getClipboard(); - } catch (EmptyClipboardException e) { - throw new NoClipboardException(); - } - - Clipboard clipboard = clipboardHolder.getClipboard(); - if(clipboard == null) - throw new NoClipboardException(); - - ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); - try { - ClipboardFormat.SCHEMATIC.getWriter(outputStream).write(clipboard, clipboardHolder.getWorldData()); - } catch (IOException e) { - throw new RuntimeException(e.getMessage(), e); - } - return outputStream.toByteArray(); - } - - @Override - public void setPlayerClipboard(Player player, InputStream is, boolean schemFormat) { - WorldData world = new BukkitWorld(player.getWorld()).getWorldData(); - Clipboard clipboard; - try { - clipboard = getClipboard(is, schemFormat); - } catch (IOException e) { - throw new RuntimeException(e); - } - - Actor actor = getWorldEditPlugin().wrapCommandSender(player); - getWorldEditPlugin().getWorldEdit().getSessionManager().get(actor).setClipboard(new ClipboardHolder(clipboard, world)); - } - - @Override - public Clipboard getClipboard(InputStream is, boolean schemFormat) throws IOException { - if(schemFormat) - return new SpongeSchematicReader(new NBTInputStream(is)).read(WorldEdit.getInstance().getServer().getWorlds().get(0).getWorldData()); - else - return new SchematicReader(new NBTInputStream(is)).read(WorldEdit.getInstance().getServer().getWorlds().get(0).getWorldData()); - } - - private static WorldEditPlugin getWorldEditPlugin() { - return (WorldEditPlugin) Bukkit.getPluginManager().getPlugin("WorldEdit"); - } - - private static class SpongeSchematicReader implements ClipboardReader { - - private final NBTInputStream inputStream; - private int schematicVersion = -1; - - SpongeSchematicReader(NBTInputStream inputStream) { - Preconditions.checkNotNull(inputStream); - this.inputStream = inputStream; - } - - @Override - public Clipboard read(WorldData worldData) throws IOException { - CompoundTag schematicTag = this.getBaseTag(); - if (this.schematicVersion == 1) { - return this.readSchematic(schematicTag); - } else if (this.schematicVersion == 2) { - return this.readSchematic(schematicTag); - } else { - throw new IOException("This schematic version is currently not supported"); - } - } - - private CompoundTag getBaseTag() throws IOException { - NamedTag rootTag = this.inputStream.readNamedTag(); - if (!rootTag.getName().equals("Schematic")) { - throw new IOException("Tag 'Schematic' does not exist or is not first"); - } else { - CompoundTag schematicTag = (CompoundTag)rootTag.getTag(); - Map schematic = schematicTag.getValue(); - this.schematicVersion = (requireTag(schematic, "Version", IntTag.class)).getValue(); - return schematicTag; - } - } - - private BlockArrayClipboard readSchematic(CompoundTag schematicTag) throws IOException { - final Map ids = IDConverter8.getMap(); - - Map schematic = schematicTag.getValue(); - int width = (requireTag(schematic, "Width", ShortTag.class)).getValue(); - int height = (requireTag(schematic, "Height", ShortTag.class)).getValue(); - int length = (requireTag(schematic, "Length", ShortTag.class)).getValue(); - IntArrayTag offsetTag = getTag(schematic, "Offset", IntArrayTag.class); - int[] offsetParts; - if (offsetTag != null) { - offsetParts = offsetTag.getValue(); - if (offsetParts.length != 3) - throw new IOException("Invalid offset specified in schematic."); - } else { - offsetParts = new int[]{0, 0, 0}; - } - - BlockVector min = new BlockVector(offsetParts[0], offsetParts[1], offsetParts[2]); - CompoundTag metadataTag = getTag(schematic, "Metadata", CompoundTag.class); - Vector origin; - CuboidRegion region; - if (metadataTag != null && metadataTag.containsKey("WEOffsetX")) { - Map metadata = metadataTag.getValue(); - int offsetX = (requireTag(metadata, "WEOffsetX", IntTag.class)).getValue(); - int offsetY = (requireTag(metadata, "WEOffsetY", IntTag.class)).getValue(); - int offsetZ = (requireTag(metadata, "WEOffsetZ", IntTag.class)).getValue(); - BlockVector offset = new BlockVector(offsetX, offsetY, offsetZ); - origin = min.subtract(offset); - region = new CuboidRegion(min, min.add(width, height, length).subtract(BlockVector.ONE)); - } else { - origin = min; - region = new CuboidRegion(min, min.add(width, height, length).subtract(BlockVector.ONE)); - } - - IntTag paletteMaxTag = getTag(schematic, "PaletteMax", IntTag.class); - Map paletteObject = requireTag(schematic, "Palette", CompoundTag.class).getValue(); - if (paletteMaxTag != null && paletteObject.size() != paletteMaxTag.getValue()) - throw new IOException("Block palette size does not match expected size."); - - Map palette = new HashMap<>(); - ParserContext parserContext = new ParserContext(); - parserContext.setRestricted(false); - parserContext.setPreferringWildcard(false); - - int id; - BaseBlock state; - for(Iterator iterator = paletteObject.keySet().iterator(); iterator.hasNext(); palette.put(id, state)) { - String palettePart = iterator.next(); - id = requireTag(paletteObject, palettePart, IntTag.class).getValue(); - - IDConverter8.BlockTypeID blockID = ids.get(palettePart); - if(blockID == null){ - blockID = ids.get(palettePart.split("\\[")[0]); - } - - if(blockID == null){ - state = new BaseBlock(0); //AIR - }else{ - state = new BaseBlock(blockID.getBlockId(), blockID.getDataId()); - } - } - - byte[] blocks = requireTag(schematic, "BlockData", ByteArrayTag.class).getValue(); - Map> tileEntitiesMap = new HashMap<>(); - ListTag tileEntities = getTag(schematic, "BlockEntities", ListTag.class); - if (tileEntities == null) { - tileEntities = getTag(schematic, "TileEntities", ListTag.class); - } - - if (tileEntities != null) { - List> tileEntityTags = tileEntities.getValue().stream().map((tag) -> - (CompoundTag)tag - ).map(CompoundTag::getValue).collect(Collectors.toList()); - - BlockVector pt; - Map tileEntity; - for(Iterator> var20 = tileEntityTags.iterator(); var20.hasNext(); tileEntitiesMap.put(pt, tileEntity)) { - tileEntity = var20.next(); - int[] pos = requireTag(tileEntity, "Pos", IntArrayTag.class).getValue(); - pt = new BlockVector(pos[0], pos[1], pos[2]); - Map values = Maps.newHashMap(tileEntity); - values.put("x", new IntTag(pt.getBlockX())); - values.put("y", new IntTag(pt.getBlockY())); - values.put("z", new IntTag(pt.getBlockZ())); - values.put("id", values.get("Id")); - values.remove("Id"); - values.remove("Pos"); - tileEntity = values; - } - } - - BlockArrayClipboard clipboard = new BlockArrayClipboard(region); - clipboard.setOrigin(origin); - int index = 0; - - for(int i = 0; i < blocks.length; ++index) { - int value = 0; - int varintLength = 0; - - while(true) { - value |= (blocks[i] & 127) << varintLength++ * 7; - if (varintLength > 5) { - throw new IOException("VarInt too big (probably corrupted data)"); - } - - if ((blocks[i] & 128) != 128) { - ++i; - int y = index / (width * length); - int z = index % (width * length) / width; - int x = index % (width * length) % width; - BaseBlock block = palette.get(value); - BlockVector pt = new BlockVector(x, y, z); - - try { - if (tileEntitiesMap.containsKey(pt)) { - block.setNbtData(new CompoundTag(tileEntitiesMap.get(pt))); - clipboard.setBlock(clipboard.getMinimumPoint().add(pt), block); - } else { - clipboard.setBlock(clipboard.getMinimumPoint().add(pt), block); - } - break; - } catch (WorldEditException var30) { - throw new IOException("Failed to load a block in the schematic"); - } - } - - ++i; - } - } - - return clipboard; - } - - private static T requireTag(Map items, String key, Class expected) throws IOException { - if (!items.containsKey(key)) { - throw new IOException("Schematic file is missing a \"" + key + "\" tag"); - } else { - Tag tag = items.get(key); - if (!expected.isInstance(tag)) { - throw new IOException(key + " tag is not of tag type " + expected.getName()); - } else { - return expected.cast(tag); - } - } - } - - private static T getTag(Map items, String key, Class expected) { - if (!items.containsKey(key)) { - return null; - } else { - Tag test = items.get(key); - return !expected.isInstance(test) ? null : expected.cast(test); - } - } - } } diff --git a/SpigotCore_8/src/de/steamwar/core/WorldEditWrapper8.java b/SpigotCore_8/src/de/steamwar/core/WorldEditWrapper8.java new file mode 100644 index 0000000..3e243bd --- /dev/null +++ b/SpigotCore_8/src/de/steamwar/core/WorldEditWrapper8.java @@ -0,0 +1,266 @@ +package de.steamwar.core; + +import com.google.common.base.Preconditions; +import com.google.common.collect.Maps; +import com.sk89q.jnbt.*; +import com.sk89q.worldedit.*; +import com.sk89q.worldedit.blocks.BaseBlock; +import com.sk89q.worldedit.bukkit.BukkitWorld; +import com.sk89q.worldedit.extension.input.ParserContext; +import com.sk89q.worldedit.extension.platform.Actor; +import com.sk89q.worldedit.extent.clipboard.BlockArrayClipboard; +import com.sk89q.worldedit.extent.clipboard.Clipboard; +import com.sk89q.worldedit.extent.clipboard.io.ClipboardFormat; +import com.sk89q.worldedit.extent.clipboard.io.ClipboardReader; +import com.sk89q.worldedit.extent.clipboard.io.SchematicReader; +import com.sk89q.worldedit.regions.CuboidRegion; +import com.sk89q.worldedit.session.ClipboardHolder; +import com.sk89q.worldedit.world.registry.WorldData; +import de.steamwar.sql.NoClipboardException; +import org.bukkit.entity.Player; + +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +public class WorldEditWrapper8 implements WorldEditWrapper.IWorldEditWrapper { + + @Override + public byte[] getPlayerClipboard(Player player, boolean schemFormat) { + ClipboardHolder clipboardHolder; + try { + clipboardHolder = WorldEditWrapper.getWorldEditPlugin().getSession(player).getClipboard(); + } catch (EmptyClipboardException e) { + throw new NoClipboardException(); + } + + Clipboard clipboard = clipboardHolder.getClipboard(); + if(clipboard == null) + throw new NoClipboardException(); + + ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); + try { + ClipboardFormat.SCHEMATIC.getWriter(outputStream).write(clipboard, clipboardHolder.getWorldData()); + } catch (IOException e) { + throw new RuntimeException(e.getMessage(), e); + } + return outputStream.toByteArray(); + } + + @Override + public void setPlayerClipboard(Player player, InputStream is, boolean schemFormat) { + WorldData world = new BukkitWorld(player.getWorld()).getWorldData(); + Clipboard clipboard; + try { + clipboard = getClipboard(is, schemFormat); + } catch (IOException e) { + throw new RuntimeException(e); + } + + Actor actor = WorldEditWrapper.getWorldEditPlugin().wrapCommandSender(player); + WorldEditWrapper.getWorldEditPlugin().getWorldEdit().getSessionManager().get(actor).setClipboard(new ClipboardHolder(clipboard, world)); + } + + @Override + public Clipboard getClipboard(InputStream is, boolean schemFormat) throws IOException { + if(schemFormat) + return new SpongeSchematicReader(new NBTInputStream(is)).read(WorldEdit.getInstance().getServer().getWorlds().get(0).getWorldData()); + else + return new SchematicReader(new NBTInputStream(is)).read(WorldEdit.getInstance().getServer().getWorlds().get(0).getWorldData()); + } + + private static class SpongeSchematicReader implements ClipboardReader { + + private final NBTInputStream inputStream; + private int schematicVersion = -1; + + SpongeSchematicReader(NBTInputStream inputStream) { + Preconditions.checkNotNull(inputStream); + this.inputStream = inputStream; + } + + @Override + public Clipboard read(WorldData worldData) throws IOException { + CompoundTag schematicTag = this.getBaseTag(); + if (this.schematicVersion == 1) { + return this.readSchematic(schematicTag); + } else if (this.schematicVersion == 2) { + return this.readSchematic(schematicTag); + } else { + throw new IOException("This schematic version is currently not supported"); + } + } + + private CompoundTag getBaseTag() throws IOException { + NamedTag rootTag = this.inputStream.readNamedTag(); + if (!rootTag.getName().equals("Schematic")) { + throw new IOException("Tag 'Schematic' does not exist or is not first"); + } else { + CompoundTag schematicTag = (CompoundTag)rootTag.getTag(); + Map schematic = schematicTag.getValue(); + this.schematicVersion = (requireTag(schematic, "Version", IntTag.class)).getValue(); + return schematicTag; + } + } + + private BlockArrayClipboard readSchematic(CompoundTag schematicTag) throws IOException { + final Map ids = IDConverter8.getMap(); + + Map schematic = schematicTag.getValue(); + int width = (requireTag(schematic, "Width", ShortTag.class)).getValue(); + int height = (requireTag(schematic, "Height", ShortTag.class)).getValue(); + int length = (requireTag(schematic, "Length", ShortTag.class)).getValue(); + IntArrayTag offsetTag = getTag(schematic, "Offset", IntArrayTag.class); + int[] offsetParts; + if (offsetTag != null) { + offsetParts = offsetTag.getValue(); + if (offsetParts.length != 3) + throw new IOException("Invalid offset specified in schematic."); + } else { + offsetParts = new int[]{0, 0, 0}; + } + + BlockVector min = new BlockVector(offsetParts[0], offsetParts[1], offsetParts[2]); + CompoundTag metadataTag = getTag(schematic, "Metadata", CompoundTag.class); + Vector origin; + CuboidRegion region; + if (metadataTag != null && metadataTag.containsKey("WEOffsetX")) { + Map metadata = metadataTag.getValue(); + int offsetX = (requireTag(metadata, "WEOffsetX", IntTag.class)).getValue(); + int offsetY = (requireTag(metadata, "WEOffsetY", IntTag.class)).getValue(); + int offsetZ = (requireTag(metadata, "WEOffsetZ", IntTag.class)).getValue(); + BlockVector offset = new BlockVector(offsetX, offsetY, offsetZ); + origin = min.subtract(offset); + region = new CuboidRegion(min, min.add(width, height, length).subtract(BlockVector.ONE)); + } else { + origin = min; + region = new CuboidRegion(min, min.add(width, height, length).subtract(BlockVector.ONE)); + } + + IntTag paletteMaxTag = getTag(schematic, "PaletteMax", IntTag.class); + Map paletteObject = requireTag(schematic, "Palette", CompoundTag.class).getValue(); + if (paletteMaxTag != null && paletteObject.size() != paletteMaxTag.getValue()) + throw new IOException("Block palette size does not match expected size."); + + Map palette = new HashMap<>(); + ParserContext parserContext = new ParserContext(); + parserContext.setRestricted(false); + parserContext.setPreferringWildcard(false); + + int id; + BaseBlock state; + for(Iterator iterator = paletteObject.keySet().iterator(); iterator.hasNext(); palette.put(id, state)) { + String palettePart = iterator.next(); + id = requireTag(paletteObject, palettePart, IntTag.class).getValue(); + + IDConverter8.BlockTypeID blockID = ids.get(palettePart); + if(blockID == null){ + blockID = ids.get(palettePart.split("\\[")[0]); + } + + if(blockID == null){ + state = new BaseBlock(0); //AIR + }else{ + state = new BaseBlock(blockID.getBlockId(), blockID.getDataId()); + } + } + + byte[] blocks = requireTag(schematic, "BlockData", ByteArrayTag.class).getValue(); + Map> tileEntitiesMap = new HashMap<>(); + ListTag tileEntities = getTag(schematic, "BlockEntities", ListTag.class); + if (tileEntities == null) { + tileEntities = getTag(schematic, "TileEntities", ListTag.class); + } + + if (tileEntities != null) { + List> tileEntityTags = tileEntities.getValue().stream().map((tag) -> + (CompoundTag)tag + ).map(CompoundTag::getValue).collect(Collectors.toList()); + + BlockVector pt; + Map tileEntity; + for(Iterator> var20 = tileEntityTags.iterator(); var20.hasNext(); tileEntitiesMap.put(pt, tileEntity)) { + tileEntity = var20.next(); + int[] pos = requireTag(tileEntity, "Pos", IntArrayTag.class).getValue(); + pt = new BlockVector(pos[0], pos[1], pos[2]); + Map values = Maps.newHashMap(tileEntity); + values.put("x", new IntTag(pt.getBlockX())); + values.put("y", new IntTag(pt.getBlockY())); + values.put("z", new IntTag(pt.getBlockZ())); + values.put("id", values.get("Id")); + values.remove("Id"); + values.remove("Pos"); + tileEntity = values; + } + } + + BlockArrayClipboard clipboard = new BlockArrayClipboard(region); + clipboard.setOrigin(origin); + int index = 0; + + for(int i = 0; i < blocks.length; ++index) { + int value = 0; + int varintLength = 0; + + while(true) { + value |= (blocks[i] & 127) << varintLength++ * 7; + if (varintLength > 5) { + throw new IOException("VarInt too big (probably corrupted data)"); + } + + if ((blocks[i] & 128) != 128) { + ++i; + int y = index / (width * length); + int z = index % (width * length) / width; + int x = index % (width * length) % width; + BaseBlock block = palette.get(value); + BlockVector pt = new BlockVector(x, y, z); + + try { + if (tileEntitiesMap.containsKey(pt)) { + block.setNbtData(new CompoundTag(tileEntitiesMap.get(pt))); + clipboard.setBlock(clipboard.getMinimumPoint().add(pt), block); + } else { + clipboard.setBlock(clipboard.getMinimumPoint().add(pt), block); + } + break; + } catch (WorldEditException var30) { + throw new IOException("Failed to load a block in the schematic"); + } + } + + ++i; + } + } + + return clipboard; + } + + private static T requireTag(Map items, String key, Class expected) throws IOException { + if (!items.containsKey(key)) { + throw new IOException("Schematic file is missing a \"" + key + "\" tag"); + } else { + Tag tag = items.get(key); + if (!expected.isInstance(tag)) { + throw new IOException(key + " tag is not of tag type " + expected.getName()); + } else { + return expected.cast(tag); + } + } + } + + private static T getTag(Map items, String key, Class expected) { + if (!items.containsKey(key)) { + return null; + } else { + Tag test = items.get(key); + return !expected.isInstance(test) ? null : expected.cast(test); + } + } + } +} diff --git a/SpigotCore_Main/src/de/steamwar/core/FlatteningWrapper.java b/SpigotCore_Main/src/de/steamwar/core/FlatteningWrapper.java index ad75bce..ca673c0 100644 --- a/SpigotCore_Main/src/de/steamwar/core/FlatteningWrapper.java +++ b/SpigotCore_Main/src/de/steamwar/core/FlatteningWrapper.java @@ -19,14 +19,9 @@ package de.steamwar.core; -import com.sk89q.worldedit.extent.clipboard.Clipboard; import org.bukkit.Material; -import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; -import java.io.IOException; -import java.io.InputStream; - public class FlatteningWrapper { private FlatteningWrapper() {} @@ -39,10 +34,5 @@ public class FlatteningWrapper { Material getMaterial(String material); Material getDye(int colorCode); ItemStack setSkullOwner(String player); - - byte[] getPlayerClipboard(Player player, boolean schemFormat); - void setPlayerClipboard(Player player, InputStream is, boolean schemFormat); - Clipboard getClipboard(InputStream is, boolean schemFormat) throws IOException; - } } diff --git a/SpigotCore_Main/src/de/steamwar/core/WorldEditWrapper.java b/SpigotCore_Main/src/de/steamwar/core/WorldEditWrapper.java new file mode 100644 index 0000000..920bc9f --- /dev/null +++ b/SpigotCore_Main/src/de/steamwar/core/WorldEditWrapper.java @@ -0,0 +1,26 @@ +package de.steamwar.core; + +import com.sk89q.worldedit.bukkit.WorldEditPlugin; +import com.sk89q.worldedit.extent.clipboard.Clipboard; +import org.bukkit.Bukkit; +import org.bukkit.entity.Player; + +import java.io.IOException; +import java.io.InputStream; + +public class WorldEditWrapper { + private WorldEditWrapper() {} + + public static final IWorldEditWrapper impl = VersionDependent.getVersionImpl(Core.getInstance()); + + public interface IWorldEditWrapper { + byte[] getPlayerClipboard(Player player, boolean schemFormat); + void setPlayerClipboard(Player player, InputStream is, boolean schemFormat); + Clipboard getClipboard(InputStream is, boolean schemFormat) throws IOException; + + } + + static WorldEditPlugin getWorldEditPlugin() { + return (WorldEditPlugin) Bukkit.getPluginManager().getPlugin("WorldEdit"); + } +} diff --git a/SpigotCore_Main/src/de/steamwar/sql/Schematic.java b/SpigotCore_Main/src/de/steamwar/sql/Schematic.java index d1e326b..400fc89 100644 --- a/SpigotCore_Main/src/de/steamwar/sql/Schematic.java +++ b/SpigotCore_Main/src/de/steamwar/sql/Schematic.java @@ -20,7 +20,7 @@ package de.steamwar.sql; import com.sk89q.worldedit.extent.clipboard.Clipboard; -import de.steamwar.core.FlatteningWrapper; +import de.steamwar.core.WorldEditWrapper; import org.bukkit.entity.Player; import java.io.IOException; @@ -197,7 +197,7 @@ public class Schematic { public static Clipboard clipboardFromStream(InputStream is, boolean schemFormat) { try { - return FlatteningWrapper.impl.getClipboard(is, schemFormat); + return WorldEditWrapper.impl.getClipboard(is, schemFormat); } catch (IOException e) { throw new SecurityException("Could not read schem", e); } @@ -209,7 +209,7 @@ public class Schematic { public void loadToPlayer(Player player) throws IOException, NoClipboardException { InputStream is = schemData(); - FlatteningWrapper.impl.setPlayerClipboard(player, is, schemFormat); + WorldEditWrapper.impl.setPlayerClipboard(player, is, schemFormat); } public void saveOldFormatFromPlayer(Player player) throws IOException, NoClipboardException { @@ -233,7 +233,7 @@ public class Schematic { private void saveFromPlayer(Player player, boolean newFormat) throws IOException, NoClipboardException { Blob blob = SQL.blob(); try { - blob.setBytes(1, FlatteningWrapper.impl.getPlayerClipboard(player, newFormat)); + blob.setBytes(1, WorldEditWrapper.impl.getPlayerClipboard(player, newFormat)); } catch (SQLException e) { throw new SecurityException(e.getMessage(), e); } From 35dc58076000db5752de80148523fe02a704adc0 Mon Sep 17 00:00:00 2001 From: Lixfel Date: Thu, 16 Sep 2021 12:54:09 +0200 Subject: [PATCH 20/24] Hotfix compilation chain --- SpigotCore_Main/src/de/steamwar/core/Core.java | 1 + 1 file changed, 1 insertion(+) diff --git a/SpigotCore_Main/src/de/steamwar/core/Core.java b/SpigotCore_Main/src/de/steamwar/core/Core.java index 46ceb2f..b49d3a5 100644 --- a/SpigotCore_Main/src/de/steamwar/core/Core.java +++ b/SpigotCore_Main/src/de/steamwar/core/Core.java @@ -31,6 +31,7 @@ import org.bukkit.plugin.java.JavaPlugin; public class Core extends JavaPlugin{ + private static Core instance; private static final int version; From 498bb337cddd20d8581130254575958d24d54747 Mon Sep 17 00:00:00 2001 From: Lixfel Date: Thu, 16 Sep 2021 18:43:32 +0200 Subject: [PATCH 21/24] Improve Schem performance --- SpigotCore_Main/src/de/steamwar/sql/Schematic.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SpigotCore_Main/src/de/steamwar/sql/Schematic.java b/SpigotCore_Main/src/de/steamwar/sql/Schematic.java index 400fc89..b5a6181 100644 --- a/SpigotCore_Main/src/de/steamwar/sql/Schematic.java +++ b/SpigotCore_Main/src/de/steamwar/sql/Schematic.java @@ -103,7 +103,7 @@ public class Schematic { public static List getSchemsAccessibleByUser(int schemOwner){ try{ - ResultSet schematic = SQL.select("SELECT s.SchemID, s.SchemName, s.SchemOwner, s.Item, s.SchemType, s.Rank, s.SchemFormat FROM Schematic s LEFT JOIN SchemMember sm ON sm.SchemName = s.SchemName AND sm.SchemOwner = s.SchemOwner WHERE s.SchemOwner = ? OR sm.Member = ? GROUP BY s.SchemID ORDER BY s.SchemName", schemOwner, schemOwner); + ResultSet schematic = SQL.select("SELECT s.SchemID, s.SchemName, s.SchemOwner, s.Item, s.SchemType, s.Rank, s.SchemFormat FROM Schematic s LEFT JOIN SchemMember sm ON sm.SchemName = s.SchemName AND sm.SchemOwner = s.SchemOwner WHERE s.SchemOwner = ? OR sm.Member = ? ORDER BY s.SchemName", schemOwner, schemOwner); List schematics = new ArrayList<>(); while(schematic.next()) schematics.add(new Schematic(schematic)); From 13d1b12e337e059e6f824066f2d60d81c476c368 Mon Sep 17 00:00:00 2001 From: Lixfel Date: Thu, 16 Sep 2021 18:48:24 +0200 Subject: [PATCH 22/24] Fix schem duplicates --- SpigotCore_Main/src/de/steamwar/sql/Schematic.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SpigotCore_Main/src/de/steamwar/sql/Schematic.java b/SpigotCore_Main/src/de/steamwar/sql/Schematic.java index b5a6181..5a1485c 100644 --- a/SpigotCore_Main/src/de/steamwar/sql/Schematic.java +++ b/SpigotCore_Main/src/de/steamwar/sql/Schematic.java @@ -103,7 +103,7 @@ public class Schematic { public static List getSchemsAccessibleByUser(int schemOwner){ try{ - ResultSet schematic = SQL.select("SELECT s.SchemID, s.SchemName, s.SchemOwner, s.Item, s.SchemType, s.Rank, s.SchemFormat FROM Schematic s LEFT JOIN SchemMember sm ON sm.SchemName = s.SchemName AND sm.SchemOwner = s.SchemOwner WHERE s.SchemOwner = ? OR sm.Member = ? ORDER BY s.SchemName", schemOwner, schemOwner); + ResultSet schematic = SQL.select("SELECT s.SchemID, s.SchemName, s.SchemOwner, s.Item, s.SchemType, s.Rank, s.SchemFormat FROM Schematic s LEFT JOIN SchemMember sm ON sm.SchemName = s.SchemName AND sm.SchemOwner = s.SchemOwner WHERE s.SchemOwner = ? OR (sm.Member = ? AND s.SchemOwner != ?) ORDER BY s.SchemName", schemOwner, schemOwner, schemOwner); List schematics = new ArrayList<>(); while(schematic.next()) schematics.add(new Schematic(schematic)); From 6a3d82bc1df914da0e3ef7e412474fcb979ae030 Mon Sep 17 00:00:00 2001 From: Lixfel Date: Thu, 16 Sep 2021 18:53:34 +0200 Subject: [PATCH 23/24] Fix schem duplicates --- SpigotCore_Main/src/de/steamwar/sql/Schematic.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SpigotCore_Main/src/de/steamwar/sql/Schematic.java b/SpigotCore_Main/src/de/steamwar/sql/Schematic.java index 5a1485c..c08bcec 100644 --- a/SpigotCore_Main/src/de/steamwar/sql/Schematic.java +++ b/SpigotCore_Main/src/de/steamwar/sql/Schematic.java @@ -103,7 +103,7 @@ public class Schematic { public static List getSchemsAccessibleByUser(int schemOwner){ try{ - ResultSet schematic = SQL.select("SELECT s.SchemID, s.SchemName, s.SchemOwner, s.Item, s.SchemType, s.Rank, s.SchemFormat FROM Schematic s LEFT JOIN SchemMember sm ON sm.SchemName = s.SchemName AND sm.SchemOwner = s.SchemOwner WHERE s.SchemOwner = ? OR (sm.Member = ? AND s.SchemOwner != ?) ORDER BY s.SchemName", schemOwner, schemOwner, schemOwner); + ResultSet schematic = SQL.select("SELECT DISTINCT s.SchemID, s.SchemName, s.SchemOwner, s.Item, s.SchemType, s.Rank, s.SchemFormat FROM Schematic s LEFT JOIN SchemMember sm ON sm.SchemName = s.SchemName AND sm.SchemOwner = s.SchemOwner WHERE s.SchemOwner = ? OR sm.Member = ? ORDER BY s.SchemName", schemOwner, schemOwner); List schematics = new ArrayList<>(); while(schematic.next()) schematics.add(new Schematic(schematic)); From 6d20b7bb2a32a1c87d3476cf3af7202fe6bd9f2f Mon Sep 17 00:00:00 2001 From: Lixfel Date: Thu, 16 Sep 2021 21:50:52 +0200 Subject: [PATCH 24/24] New SQL API + SchemByUserAndType speedup --- .../src/de/steamwar/core/Core.java | 2 +- SpigotCore_Main/src/de/steamwar/sql/SQL.java | 131 ++++++++++++++---- .../src/de/steamwar/sql/Schematic.java | 14 +- 3 files changed, 112 insertions(+), 35 deletions(-) diff --git a/SpigotCore_Main/src/de/steamwar/core/Core.java b/SpigotCore_Main/src/de/steamwar/core/Core.java index b49d3a5..319d199 100644 --- a/SpigotCore_Main/src/de/steamwar/core/Core.java +++ b/SpigotCore_Main/src/de/steamwar/core/Core.java @@ -71,7 +71,7 @@ public class Core extends JavaPlugin{ @Override public void onDisable(){ - SQL.closeConnection(); + SQL.close(); } public static Core getInstance() { diff --git a/SpigotCore_Main/src/de/steamwar/sql/SQL.java b/SpigotCore_Main/src/de/steamwar/sql/SQL.java index bbe2701..65546cd 100644 --- a/SpigotCore_Main/src/de/steamwar/sql/SQL.java +++ b/SpigotCore_Main/src/de/steamwar/sql/SQL.java @@ -24,18 +24,18 @@ import org.bukkit.configuration.file.YamlConfiguration; import java.io.File; import java.sql.*; +import java.util.ArrayList; +import java.util.List; +import java.util.logging.Level; public class SQL { - private SQL(){} - private static final String host; - private static final String port; - private static final String database; - private static final String user; - private static final String password; private static Connection con; + private static String url; + private static String user; + private static String password; static{ File file = new File(Core.getInstance().getDataFolder(), "MySQL.yml"); @@ -44,20 +44,47 @@ public class SQL { if(!file.exists()) throw new SecurityException("SQL-ConfigFile not found!"); - host = config.getString("HOST"); - port = config.getString("PORT"); - database = config.getString("DATABASE"); + url = "jdbc:mysql://" + config.getString("HOST") + ":" + config.getString("PORT") + "/" + config.getString("DATABASE"); user = config.getString("USER"); password = config.getString("PASSWORD"); connect(); } - - public static void closeConnection() { + + private static void connect() { + try { + con = DriverManager.getConnection(url + "?autoreconnect=true", user, password); + } catch (SQLException e) { + throw new SecurityException("Could not start SQL connection", e); + } + } + + public static void close() { + for (Statement statement : Statement.statements) { + try { + statement.st.close(); + } catch (SQLException e) { + Core.getInstance().getLogger().log(Level.INFO, "Could not close statement", e); + } + } + try { con.close(); - }catch (SQLException e) { - throw new SecurityException("Could not close connection", e); + } catch (SQLException e) { + Core.getInstance().getLogger().log(Level.WARNING, "Could not close SQL-Connection", e); + } + } + + private static void reset(SQLException e) { + Core.getInstance().getLogger().log(Level.WARNING, "SQL Exception thrown", e); + close(); + connect(); + try { + for (Statement statement : Statement.statements) { + statement.init(); + } + } catch (SQLException ex) { + throw new SecurityException("Could not reprepare SQL Statements", ex); } } @@ -65,7 +92,7 @@ public class SQL { try { prepare(qry, objects).executeUpdate(); } catch (SQLException e) { - reconnect(); + reset(e); try { prepare(qry, objects).executeUpdate(); } catch (SQLException ex) { @@ -78,7 +105,7 @@ public class SQL { try { return prepare(qry, objects).executeQuery(); } catch (SQLException e) { - reconnect(); + reset(e); try { return prepare(qry, objects).executeQuery(); } catch (SQLException ex) { @@ -91,7 +118,7 @@ public class SQL { try { return con.createBlob(); } catch (SQLException e) { - reconnect(); + reset(e); try { return con.createBlob(); } catch (SQLException ex) { @@ -108,18 +135,66 @@ public class SQL { return st; } - private static void connect() { - try { - con = DriverManager.getConnection("jdbc:mysql://" + host + ":" + port + "/" + database + "?autoreconnect=true", user, password); - if(con.isClosed()) - throw new SQLException("Could not connect to database!"); - }catch (SQLException e) { - throw new SecurityException("No connection to database.", e); + public static class Statement { + private static final List statements = new ArrayList<>(); + + private final String sql; + private PreparedStatement st; + + Statement(String sql) { + this.sql = sql; + statements.add(this); + try { + init(); + } catch (SQLException e) { + reset(e); + } + } + + private synchronized void init() throws SQLException { + st = con.prepareStatement(sql); + } + + T select(ResultSetUser user, Object... objects) { + return prepare(() -> { + ResultSet rs = st.executeQuery(); + T result = user.use(rs); + rs.close(); + return result; + }, objects); + } + + void update(Object... objects) { + prepare(st::executeUpdate, objects); + } + + private synchronized T prepare(SQLRunnable runnable, Object... objects) { + try { + setObjects(objects); + return runnable.run(); + } catch (SQLException e) { + reset(e); + try { + setObjects(objects); + return runnable.run(); + } catch (SQLException ex) { + throw new SecurityException("Could not execute SQL statement", ex); + } + } + } + + private void setObjects(Object... objects) throws SQLException { + for (int i = 0; i < objects.length; i++) { + st.setObject(i + 1, objects[i]); + } + } + + interface ResultSetUser { + T use(ResultSet rs) throws SQLException; + } + + private interface SQLRunnable { + T run() throws SQLException; } } - - private static void reconnect(){ - closeConnection(); - connect(); - } } diff --git a/SpigotCore_Main/src/de/steamwar/sql/Schematic.java b/SpigotCore_Main/src/de/steamwar/sql/Schematic.java index c08bcec..dbbd123 100644 --- a/SpigotCore_Main/src/de/steamwar/sql/Schematic.java +++ b/SpigotCore_Main/src/de/steamwar/sql/Schematic.java @@ -35,6 +35,8 @@ import java.util.zip.GZIPInputStream; public class Schematic { + private static final SQL.Statement getSchemsOfType = new SQL.Statement("SELECT DISTINCT s.SchemID, s.SchemName, s.SchemOwner, s.Item, s.SchemType, s.Rank, s.SchemFormat FROM Schematic s LEFT JOIN SchemMember sm ON sm.SchemName = s.SchemName AND sm.SchemOwner = s.SchemOwner WHERE s.SchemType = ? AND (s.SchemOwner = ? OR sm.Member = ?) ORDER BY s.SchemName"); + private final int schemID; private final String schemName; private final int schemOwner; @@ -118,12 +120,12 @@ public class Schematic { } public static List getSchemsOfType(int schemOwner, SchematicType schemType){ - //Unsauber, dafür auch geaddede Schematics dabei - List schems = getSchemsAccessibleByUser(schemOwner); - for(int i = schems.size()-1; i >= 0; i--) - if(!schems.get(i).getSchemType().equals(schemType)) - schems.remove(i); - return schems; + return getSchemsOfType.select(rs -> { + List schematics = new ArrayList<>(); + while(rs.next()) + schematics.add(new Schematic(rs)); + return schematics; + }, schemType.toDB(), schemOwner, schemOwner); } public static List getAllSchemsOfType(SchematicType schemType){