diff --git a/.gitignore b/.gitignore
index abc78ba..299861e 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,2 +1,3 @@
/.gradle/
/build/
+.DS_Store
\ No newline at end of file
diff --git a/.idea/compiler.xml b/.idea/compiler.xml
index e7e2fe9..e57bcfd 100644
--- a/.idea/compiler.xml
+++ b/.idea/compiler.xml
@@ -2,11 +2,11 @@
-
+
-
-
+
+
\ No newline at end of file
diff --git a/.idea/gradle.xml b/.idea/gradle.xml
index 1aa6d66..4341618 100644
--- a/.idea/gradle.xml
+++ b/.idea/gradle.xml
@@ -4,17 +4,16 @@
+
+
-
-
+
-
-
diff --git a/.idea/jarRepositories.xml b/.idea/jarRepositories.xml
index e9e84f2..8c24d9d 100644
--- a/.idea/jarRepositories.xml
+++ b/.idea/jarRepositories.xml
@@ -26,5 +26,30 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/Gradle__com_destroystokyo_paper_paper_api_1_14_R0_1_SNAPSHOT.xml b/.idea/libraries/Gradle__com_destroystokyo_paper_paper_api_1_14_R0_1_SNAPSHOT.xml
deleted file mode 100644
index 621cf3e..0000000
--- a/.idea/libraries/Gradle__com_destroystokyo_paper_paper_api_1_14_R0_1_SNAPSHOT.xml
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/libraries/Gradle__com_google_code_findbugs_jsr305_1_3_9.xml b/.idea/libraries/Gradle__com_google_code_findbugs_jsr305_1_3_9.xml
deleted file mode 100644
index 63b7b35..0000000
--- a/.idea/libraries/Gradle__com_google_code_findbugs_jsr305_1_3_9.xml
+++ /dev/null
@@ -1,9 +0,0 @@
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/libraries/Gradle__com_google_code_gson_gson_2_8_0.xml b/.idea/libraries/Gradle__com_google_code_gson_gson_2_8_0.xml
index 4df3586..cba1324 100644
--- a/.idea/libraries/Gradle__com_google_code_gson_gson_2_8_0.xml
+++ b/.idea/libraries/Gradle__com_google_code_gson_gson_2_8_0.xml
@@ -3,9 +3,7 @@
-
-
-
+
diff --git a/.idea/libraries/Gradle__com_google_guava_guava_21_0.xml b/.idea/libraries/Gradle__com_google_guava_guava_21_0.xml
index 6a2cc5c..32b92b3 100644
--- a/.idea/libraries/Gradle__com_google_guava_guava_21_0.xml
+++ b/.idea/libraries/Gradle__com_google_guava_guava_21_0.xml
@@ -3,9 +3,7 @@
-
-
-
+
diff --git a/.idea/libraries/Gradle__io_papermc_paper_paper_api_1_17_1_R0_1_SNAPSHOT.xml b/.idea/libraries/Gradle__io_papermc_paper_paper_api_1_17_1_R0_1_SNAPSHOT.xml
new file mode 100644
index 0000000..e18a339
--- /dev/null
+++ b/.idea/libraries/Gradle__io_papermc_paper_paper_api_1_17_1_R0_1_SNAPSHOT.xml
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/Gradle__it_unimi_dsi_fastutil_8_2_2.xml b/.idea/libraries/Gradle__it_unimi_dsi_fastutil_8_2_2.xml
new file mode 100644
index 0000000..863f8e8
--- /dev/null
+++ b/.idea/libraries/Gradle__it_unimi_dsi_fastutil_8_2_2.xml
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/Gradle__junit_junit_4_12.xml b/.idea/libraries/Gradle__junit_junit_4_12.xml
deleted file mode 100644
index 8609c60..0000000
--- a/.idea/libraries/Gradle__junit_junit_4_12.xml
+++ /dev/null
@@ -1,14 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/libraries/Gradle__net_kyori_adventure_api_4_9_1.xml b/.idea/libraries/Gradle__net_kyori_adventure_api_4_9_1.xml
new file mode 100644
index 0000000..b93e939
--- /dev/null
+++ b/.idea/libraries/Gradle__net_kyori_adventure_api_4_9_1.xml
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/Gradle__net_kyori_adventure_key_4_9_1.xml b/.idea/libraries/Gradle__net_kyori_adventure_key_4_9_1.xml
new file mode 100644
index 0000000..b4a2833
--- /dev/null
+++ b/.idea/libraries/Gradle__net_kyori_adventure_key_4_9_1.xml
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/Gradle__net_kyori_adventure_text_serializer_gson_4_9_1.xml b/.idea/libraries/Gradle__net_kyori_adventure_text_serializer_gson_4_9_1.xml
new file mode 100644
index 0000000..a9a11cb
--- /dev/null
+++ b/.idea/libraries/Gradle__net_kyori_adventure_text_serializer_gson_4_9_1.xml
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/Gradle__net_kyori_adventure_text_serializer_legacy_4_9_1.xml b/.idea/libraries/Gradle__net_kyori_adventure_text_serializer_legacy_4_9_1.xml
new file mode 100644
index 0000000..059d4fa
--- /dev/null
+++ b/.idea/libraries/Gradle__net_kyori_adventure_text_serializer_legacy_4_9_1.xml
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/Gradle__net_kyori_adventure_text_serializer_plain_4_9_1.xml b/.idea/libraries/Gradle__net_kyori_adventure_text_serializer_plain_4_9_1.xml
new file mode 100644
index 0000000..2d6efdc
--- /dev/null
+++ b/.idea/libraries/Gradle__net_kyori_adventure_text_serializer_plain_4_9_1.xml
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/Gradle__net_kyori_examination_api_1_3_0.xml b/.idea/libraries/Gradle__net_kyori_examination_api_1_3_0.xml
new file mode 100644
index 0000000..8023c57
--- /dev/null
+++ b/.idea/libraries/Gradle__net_kyori_examination_api_1_3_0.xml
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/Gradle__net_kyori_examination_string_1_3_0.xml b/.idea/libraries/Gradle__net_kyori_examination_string_1_3_0.xml
new file mode 100644
index 0000000..d5c7138
--- /dev/null
+++ b/.idea/libraries/Gradle__net_kyori_examination_string_1_3_0.xml
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/Gradle__net_md_5_bungeecord_chat_1_13_SNAPSHOT.xml b/.idea/libraries/Gradle__net_md_5_bungeecord_chat_1_13_SNAPSHOT.xml
deleted file mode 100644
index 0befea1..0000000
--- a/.idea/libraries/Gradle__net_md_5_bungeecord_chat_1_13_SNAPSHOT.xml
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/libraries/Gradle__net_md_5_bungeecord_chat_1_16_R0_4.xml b/.idea/libraries/Gradle__net_md_5_bungeecord_chat_1_16_R0_4.xml
new file mode 100644
index 0000000..7cdeab3
--- /dev/null
+++ b/.idea/libraries/Gradle__net_md_5_bungeecord_chat_1_16_R0_4.xml
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/Gradle__org_apache_logging_log4j_log4j_api_2_14_1.xml b/.idea/libraries/Gradle__org_apache_logging_log4j_log4j_api_2_14_1.xml
new file mode 100644
index 0000000..544bf1e
--- /dev/null
+++ b/.idea/libraries/Gradle__org_apache_logging_log4j_log4j_api_2_14_1.xml
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/Gradle__org_checkerframework_checker_qual_3_18_0.xml b/.idea/libraries/Gradle__org_checkerframework_checker_qual_3_18_0.xml
new file mode 100644
index 0000000..ad46851
--- /dev/null
+++ b/.idea/libraries/Gradle__org_checkerframework_checker_qual_3_18_0.xml
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/Gradle__org_hamcrest_hamcrest_core_1_3.xml b/.idea/libraries/Gradle__org_hamcrest_hamcrest_core_1_3.xml
deleted file mode 100644
index 8262f72..0000000
--- a/.idea/libraries/Gradle__org_hamcrest_hamcrest_core_1_3.xml
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/libraries/Gradle__org_jetbrains_annotations_22_0_0.xml b/.idea/libraries/Gradle__org_jetbrains_annotations_22_0_0.xml
new file mode 100644
index 0000000..a9c34e9
--- /dev/null
+++ b/.idea/libraries/Gradle__org_jetbrains_annotations_22_0_0.xml
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/Gradle__org_ow2_asm_asm_7_1.xml b/.idea/libraries/Gradle__org_ow2_asm_asm_7_1.xml
deleted file mode 100644
index 07d6c28..0000000
--- a/.idea/libraries/Gradle__org_ow2_asm_asm_7_1.xml
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/libraries/Gradle__org_ow2_asm_asm_analysis_7_1.xml b/.idea/libraries/Gradle__org_ow2_asm_asm_analysis_7_1.xml
deleted file mode 100644
index c5189f6..0000000
--- a/.idea/libraries/Gradle__org_ow2_asm_asm_analysis_7_1.xml
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/libraries/Gradle__org_ow2_asm_asm_commons_7_1.xml b/.idea/libraries/Gradle__org_ow2_asm_asm_commons_7_1.xml
deleted file mode 100644
index 0de9fa3..0000000
--- a/.idea/libraries/Gradle__org_ow2_asm_asm_commons_7_1.xml
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/libraries/Gradle__org_slf4j_slf4j_api_1_7_25.xml b/.idea/libraries/Gradle__org_slf4j_slf4j_api_1_7_25.xml
deleted file mode 100644
index dd23f3e..0000000
--- a/.idea/libraries/Gradle__org_slf4j_slf4j_api_1_7_25.xml
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/libraries/Gradle__org_slf4j_slf4j_api_1_7_30.xml b/.idea/libraries/Gradle__org_slf4j_slf4j_api_1_7_30.xml
new file mode 100644
index 0000000..14d740d
--- /dev/null
+++ b/.idea/libraries/Gradle__org_slf4j_slf4j_api_1_7_30.xml
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/Gradle__org_spigotmc_spigot_1_17_R0_1_SNAPSHOT.xml b/.idea/libraries/Gradle__org_spigotmc_spigot_1_17_R0_1_SNAPSHOT.xml
new file mode 100644
index 0000000..4dfb502
--- /dev/null
+++ b/.idea/libraries/Gradle__org_spigotmc_spigot_1_17_R0_1_SNAPSHOT.xml
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/Gradle__org_yaml_snakeyaml_1_23.xml b/.idea/libraries/Gradle__org_yaml_snakeyaml_1_23.xml
deleted file mode 100644
index 1166353..0000000
--- a/.idea/libraries/Gradle__org_yaml_snakeyaml_1_23.xml
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/libraries/Gradle__org_ow2_asm_asm_tree_7_1.xml b/.idea/libraries/Gradle__org_yaml_snakeyaml_1_28.xml
similarity index 50%
rename from .idea/libraries/Gradle__org_ow2_asm_asm_tree_7_1.xml
rename to .idea/libraries/Gradle__org_yaml_snakeyaml_1_28.xml
index 5e1d644..38b7621 100644
--- a/.idea/libraries/Gradle__org_ow2_asm_asm_tree_7_1.xml
+++ b/.idea/libraries/Gradle__org_yaml_snakeyaml_1_28.xml
@@ -1,11 +1,11 @@
-
+
-
+
-
+
\ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
index 305dac1..efe4544 100644
--- a/.idea/misc.xml
+++ b/.idea/misc.xml
@@ -5,7 +5,10 @@
-
+
+
+
+
\ No newline at end of file
diff --git a/.idea/modules/VulnerabilityPatcher.main.iml b/.idea/modules/VulnerabilityPatcher.main.iml
index a738fbf..2a98fc9 100644
--- a/.idea/modules/VulnerabilityPatcher.main.iml
+++ b/.idea/modules/VulnerabilityPatcher.main.iml
@@ -1,5 +1,5 @@
-
+
@@ -9,11 +9,16 @@
- PAPER
+ SPIGOT
+ MCP
+ ADVENTURE
+
+
+
@@ -23,65 +28,27 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/modules/VulnerabilityPatcher.test.iml b/.idea/modules/VulnerabilityPatcher.test.iml
index 1ae1ada..4e89df5 100644
--- a/.idea/modules/VulnerabilityPatcher.test.iml
+++ b/.idea/modules/VulnerabilityPatcher.test.iml
@@ -1,5 +1,5 @@
-
+
@@ -19,66 +19,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/modules/me.cooljwb.vulnerabilitypatcher.VulnerabilityPatcher.iml b/.idea/modules/me.cooljwb.vulnerabilitypatcher.VulnerabilityPatcher.iml
index d7610d0..fc32c96 100644
--- a/.idea/modules/me.cooljwb.vulnerabilitypatcher.VulnerabilityPatcher.iml
+++ b/.idea/modules/me.cooljwb.vulnerabilitypatcher.VulnerabilityPatcher.iml
@@ -1,5 +1,5 @@
-
+
diff --git a/.idea/modules/me.cooljwb.vulnerabilitypatcher.VulnerabilityPatcher.main.iml b/.idea/modules/me.cooljwb.vulnerabilitypatcher.VulnerabilityPatcher.main.iml
index 0fd33be..511f54e 100644
--- a/.idea/modules/me.cooljwb.vulnerabilitypatcher.VulnerabilityPatcher.main.iml
+++ b/.idea/modules/me.cooljwb.vulnerabilitypatcher.VulnerabilityPatcher.main.iml
@@ -9,4 +9,8 @@
+
+
+
+
\ No newline at end of file
diff --git a/.idea/modules/me.cooljwb.vulnerabilitypatcher.VulnerabilityPatcher.test.iml b/.idea/modules/me.cooljwb.vulnerabilitypatcher.VulnerabilityPatcher.test.iml
index 0fd33be..511f54e 100644
--- a/.idea/modules/me.cooljwb.vulnerabilitypatcher.VulnerabilityPatcher.test.iml
+++ b/.idea/modules/me.cooljwb.vulnerabilitypatcher.VulnerabilityPatcher.test.iml
@@ -9,4 +9,8 @@
+
+
+
+
\ No newline at end of file
diff --git a/.idea/runConfigurations.xml b/.idea/runConfigurations.xml
new file mode 100644
index 0000000..797acea
--- /dev/null
+++ b/.idea/runConfigurations.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index 9fd122f..a6ac1b3 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -1,20 +1,79 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
@@ -43,13 +102,13 @@
-
+
-
-
+
+
@@ -75,27 +134,131 @@
-
+
+
+
+
+
+
+
-
-
+
+
+
-
+
+
+
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ true
+ true
+ false
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ true
+ true
+ false
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ true
+ true
+ false
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ true
+ true
+ false
+
+
@@ -112,10 +275,21 @@
- true
+ true
+ true
+ false
+
+
+
+
+
+
+
+
+
@@ -126,6 +300,9 @@
1557533923338
+
+
+
1595202547911
@@ -136,6 +313,9 @@
+
+
+
@@ -149,33 +329,8 @@
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/build.gradle b/build.gradle
index 27df3c3..78b610d 100644
--- a/build.gradle
+++ b/build.gradle
@@ -3,37 +3,24 @@ apply plugin: 'java'
group = pluginGroup
version = pluginVersion
-sourceCompatibility = 11
-targetCompatibility = 11
+sourceCompatibility = 16
+targetCompatibility = 16
repositories {
mavenCentral()
+ mavenLocal()
maven {
name = 'destroystokyo-repo'
url = 'https://repo.destroystokyo.com/repository/maven-public/'
}
- maven {
- name = 'sonatype'
- url = 'https://oss.sonatype.org/content/groups/public/'
- }
+ maven { url = 'https://oss.sonatype.org/content/repositories/snapshots' }
+ maven { url = 'https://oss.sonatype.org/content/repositories/central' }
+ maven { url = 'https://repo.codemc.io/repository/nms/' }
}
dependencies {
- testCompile group: 'junit', name: 'junit', version: '4.12'
- compile 'com.destroystokyo.paper:paper-api:1.13.2-R0.1-SNAPSHOT'
- compile 'com.destroystokyo.paper:paper-api:1.14-R0.1-SNAPSHOT'
- compile files('libs/Spigot-1.13.2.jar')
- compile files('libs/Spigot-1.14.jar')
- compile files('libs/Spigot-1.15.jar')
- compile files('libs/Spigot-1.16.jar')
- compile files('libs/Spigot-1.16.2.jar')
- compile files('libs/Spigot-1.16.5.jar')
+ compileOnly 'org.spigotmc:spigot:1.17-R0.1-SNAPSHOT'
+ compileOnly 'io.papermc.paper:paper-api:1.17.1-R0.1-SNAPSHOT'
}
import org.apache.tools.ant.filters.ReplaceTokens
-
-processResources {
- from(sourceSets.main.resources.srcDirs) {
- filter ReplaceTokens, tokens: [version: version]
- }
-}
diff --git a/gradle.properties b/gradle.properties
index cd12f8e..4be0c13 100644
--- a/gradle.properties
+++ b/gradle.properties
@@ -1,2 +1,2 @@
pluginGroup=me.cooljwb.vulnerabilitypatcher
-pluginVersion=v1.9.4
\ No newline at end of file
+pluginVersion=v1.9.5
\ No newline at end of file
diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar
index 99340b4..e708b1c 100644
Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
index 68ca99a..ffed3a2 100644
--- a/gradle/wrapper/gradle-wrapper.properties
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
+distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-6.8.3-bin.zip
diff --git a/gradlew b/gradlew
old mode 100644
new mode 100755
index cccdd3d..4f906e0
--- a/gradlew
+++ b/gradlew
@@ -1,5 +1,21 @@
#!/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
@@ -28,7 +44,7 @@ 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=""
+DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
@@ -66,6 +82,7 @@ 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
@@ -109,10 +126,11 @@ if $darwin; then
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
fi
-# For Cygwin, switch paths to Windows format before running java
-if $cygwin ; then
+# 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
@@ -138,19 +156,19 @@ if $cygwin ; then
else
eval `echo args$i`="\"$arg\""
fi
- i=$((i+1))
+ 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" ;;
+ 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
@@ -159,14 +177,9 @@ save () {
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
echo " "
}
-APP_ARGS=$(save "$@")
+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"
-# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
-if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
- cd "$(dirname "$0")"
-fi
-
exec "$JAVACMD" "$@"
diff --git a/gradlew.bat b/gradlew.bat
index f955316..ac1b06f 100644
--- a/gradlew.bat
+++ b/gradlew.bat
@@ -1,84 +1,89 @@
-@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=
-
-@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
+@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 Resolve any "." and ".." in APP_HOME to make it shorter.
+for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
+
+@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 execute
+
+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 execute
+
+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
+
+: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 %*
+
+: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/libs/.idea/$PRODUCT_WORKSPACE_FILE$ b/libs/.idea/$PRODUCT_WORKSPACE_FILE$
deleted file mode 100644
index 3733e0d..0000000
--- a/libs/.idea/$PRODUCT_WORKSPACE_FILE$
+++ /dev/null
@@ -1,19 +0,0 @@
-
-
-
-
-
-
- 1.8
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/libs/.idea/.gitignore b/libs/.idea/.gitignore
deleted file mode 100644
index 5c98b42..0000000
--- a/libs/.idea/.gitignore
+++ /dev/null
@@ -1,2 +0,0 @@
-# Default ignored files
-/workspace.xml
\ No newline at end of file
diff --git a/libs/.idea/checkstyle-idea.xml b/libs/.idea/checkstyle-idea.xml
deleted file mode 100644
index 8b279ec..0000000
--- a/libs/.idea/checkstyle-idea.xml
+++ /dev/null
@@ -1,16 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/libs/.idea/libs.iml b/libs/.idea/libs.iml
deleted file mode 100644
index d6ebd48..0000000
--- a/libs/.idea/libs.iml
+++ /dev/null
@@ -1,9 +0,0 @@
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/libs/.idea/modules.xml b/libs/.idea/modules.xml
deleted file mode 100644
index 560b159..0000000
--- a/libs/.idea/modules.xml
+++ /dev/null
@@ -1,8 +0,0 @@
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/libs/.idea/vcs.xml b/libs/.idea/vcs.xml
deleted file mode 100644
index 6c0b863..0000000
--- a/libs/.idea/vcs.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
-
-
-
\ No newline at end of file
diff --git a/libs/Spigot-1.14.jar b/libs/Spigot-1.14.jar
deleted file mode 100644
index 7f65164..0000000
Binary files a/libs/Spigot-1.14.jar and /dev/null differ
diff --git a/libs/Spigot-1.15.jar b/libs/Spigot-1.15.jar
deleted file mode 100644
index f79153f..0000000
Binary files a/libs/Spigot-1.15.jar and /dev/null differ
diff --git a/libs/Spigot-1.16.2.jar b/libs/Spigot-1.16.2.jar
deleted file mode 100644
index dd6e426..0000000
Binary files a/libs/Spigot-1.16.2.jar and /dev/null differ
diff --git a/libs/Spigot-1.16.5.jar b/libs/Spigot-1.16.5.jar
deleted file mode 100644
index 3fb345a..0000000
Binary files a/libs/Spigot-1.16.5.jar and /dev/null differ
diff --git a/libs/Spigot-1.16.jar b/libs/Spigot-1.16.jar
deleted file mode 100644
index bc2bea1..0000000
Binary files a/libs/Spigot-1.16.jar and /dev/null differ
diff --git a/libs/spigot-1.13.2.jar b/libs/spigot-1.13.2.jar
deleted file mode 100644
index 8aa1bbe..0000000
Binary files a/libs/spigot-1.13.2.jar and /dev/null differ
diff --git a/out/production/resources/config.yml b/out/production/resources/config.yml
deleted file mode 100644
index af95a9c..0000000
--- a/out/production/resources/config.yml
+++ /dev/null
@@ -1,46 +0,0 @@
-# VulnerabilityPatcher by CoolJWB.
-
-# Patches: DeathPotions, DeathItems, CrashItems, Books, RougeEntity, Arrows, Riptide, FollowRange, DisconnectItems, EntityTag.
-# All patches added in the list below will be activated on server startup.
-Patches:
- - DeathPotions
- - DeathItems
- - CrashItems
- - Books
- - RougeEntity
- - Arrows
- - Riptide
- - FollowRange
- - DisconnectItems
- - EntityTag
- - Blocks
- - StructureBlocks
-
-# All entities added below will be blocked to use in a spawn egg.
-BlockedEntityTags:
- - lightning_bolt
- - falling_block
- - area_effect_cloud
-
-Commands:
- Help:
- Permission: vulnerability.help
- Version:
- Permission: vulnerability.version
- Reload:
- Permission: vulnerability.reload
- BlockTags:
- Permission: vulnerability.tags.block
- UnblockTags:
- Permission: vulnerability.tags.unblock
- EnablePatch:
- Permission: vulnerability.patch.enable
- DisablePatch:
- Permission: vulnerability.patch.disable
-
-Notify:
- Enabled: false
- Permission: vulnerability.notify
-
-# DevMode should be set to false, unless you're a developer of this plugin.
-DevMode: false
\ No newline at end of file
diff --git a/out/production/resources/plugin.yml b/out/production/resources/plugin.yml
deleted file mode 100644
index 78678c2..0000000
--- a/out/production/resources/plugin.yml
+++ /dev/null
@@ -1,12 +0,0 @@
-name: VulnerabilityPatcher
-version: 0.3.1
-main: me.cooljwb.vulnerabilitypatcher.VulnerabilityPatcher
-api-version: 1.13
-authors: [CoolJWB]
-description: The brand new v0.3 VulnerabilityPatcher for Paper 1.13.2 servers.
-commands:
- vulnerabilitypatcher:
- aliases: [vp]
- description: The main command for VulnerabilityPatcher.
- getnbt:
- description: Reveals an items NBT data.
\ No newline at end of file
diff --git a/src/main/java/me/cooljwb/vulnerabilitypatcher/VulnerabilityPatcher.java b/src/main/java/me/cooljwb/vulnerabilitypatcher/VulnerabilityPatcher.java
index 8701e86..9c5a019 100644
--- a/src/main/java/me/cooljwb/vulnerabilitypatcher/VulnerabilityPatcher.java
+++ b/src/main/java/me/cooljwb/vulnerabilitypatcher/VulnerabilityPatcher.java
@@ -81,21 +81,8 @@ public final class VulnerabilityPatcher extends JavaPlugin
{
switch (version)
{
- case "1.13.2":
- case "1.14":
- case "1.14.1":
- case "1.14.2":
- case "1.14.3":
- case "1.14.4":
- case "1.15":
- case "1.15.1":
- case "1.15.2":
- case "1.16":
- case "1.16.1":
- case "1.16.2":
- case "1.16.3":
- case "1.16.4":
- case "1.16.5":
+ case "1.17":
+ case "1.17.1":
return true;
default:
log.log(Level.WARNING, String.format("[%s] Server version %s may not work fully or at all with %s-%s, try an earlier plugin version or a newer server version.", pluginName, version, pluginName, pluginVersion));
diff --git a/src/main/java/me/cooljwb/vulnerabilitypatcher/modifiers/NBTModifier.java b/src/main/java/me/cooljwb/vulnerabilitypatcher/modifiers/NBTModifier.java
index e9c2ab2..6772b62 100644
--- a/src/main/java/me/cooljwb/vulnerabilitypatcher/modifiers/NBTModifier.java
+++ b/src/main/java/me/cooljwb/vulnerabilitypatcher/modifiers/NBTModifier.java
@@ -36,38 +36,15 @@ public class NBTModifier
{
private Logger log = Logger.getLogger("Minecraft"); // Get the server logger.
- private NBTModifier_1_13_2 nbt_1_13_2 = new NBTModifier_1_13_2();
- private NBTModifier_1_14 nbt_1_14 = new NBTModifier_1_14();
- private NBTModifier_1_15 nbt_1_15 = new NBTModifier_1_15();
- private NBTModifier_1_16 nbt_1_16 = new NBTModifier_1_16();
- private NBTModifier_1_16_2 nbt_1_16_2 = new NBTModifier_1_16_2();
- private NBTModifier_1_16_3 nbt_1_16_3 = new NBTModifier_1_16_3();
+ private NBTModifier_1_17_1 nbt_1_17_1 = new NBTModifier_1_17_1();
public static String getVersion()
{
switch (Bukkit.getVersion().substring((Bukkit.getVersion().indexOf(":") + 1), Bukkit.getVersion().indexOf(")")).trim())
{
- case "1.13.2":
- return "1.13.2";
- case "1.14":
- case "1.14.1":
- case "1.14.2":
- case "1.14.3":
- case "1.14.4":
- return "1.14";
- case "1.15":
- case "1.15.1":
- case "1.15.2":
- return "1.15";
- case "1.16":
- case "1.16.1":
- return "1.16";
- case "1.16.2":
- case "1.16.3":
- return "1.16.2";
- case "1.16.4":
- case "1.16.5":
- return "1.16.5";
+ case "1.17":
+ case "1.17.1":
+ return "1.17";
default:
return "";
}
@@ -77,18 +54,8 @@ public class NBTModifier
{
switch (getVersion())
{
- case "1.13.2":
- return nbt_1_13_2.itemToString(item);
- case "1.14":
- return nbt_1_14.itemToString(item);
- case "1.15":
- return nbt_1_15.itemToString(item);
- case "1.16":
- return nbt_1_16.itemToString(item);
- case "1.16.2":
- return nbt_1_16_2.itemToString(item);
- case "1.16.5":
- return nbt_1_16_3.itemToString(item);
+ case "1.17":
+ return nbt_1_17_1.itemToString(item);
default:
return "";
}
@@ -98,18 +65,8 @@ public class NBTModifier
{
switch (getVersion())
{
- case "1.13.2":
- return nbt_1_13_2.removePlayerdata(player);
- case "1.14":
- return nbt_1_14.removePlayerdata(player);
- case "1.15":
- return nbt_1_15.removePlayerdata(player);
- case "1.16":
- return nbt_1_16.removePlayerdata(player);
- case "1.16.2":
- return nbt_1_16_2.removePlayerdata(player);
- case "1.16.5":
- return nbt_1_16_3.removePlayerdata(player);
+ case "1.17":
+ return nbt_1_17_1.removePlayerdata(player);
}
return false;
}
@@ -118,24 +75,8 @@ public class NBTModifier
{
switch (getVersion())
{
- case "1.13.2":
- nbt_1_13_2.resetMeta(player, item, mainhand);
- break;
- case "1.14":
- nbt_1_14.resetMeta(player, item, mainhand);
- break;
- case "1.15":
- nbt_1_15.resetMeta(player, item, mainhand);
- break;
- case "1.16":
- nbt_1_16.resetMeta(player, item, mainhand);
- break;
- case "1.16.2":
- nbt_1_16_2.resetMeta(player, item, mainhand);
- break;
- case "1.16.5":
- nbt_1_16_3.resetMeta(player, item, mainhand);
- break;
+ case "1.17":
+ nbt_1_17_1.resetMeta(player, item, mainhand);
}
}
@@ -143,18 +84,8 @@ public class NBTModifier
{
switch (getVersion())
{
- case "1.13.2":
- return nbt_1_13_2.isPlayer(source);
- case "1.14":
- return nbt_1_14.isPlayer(source);
- case "1.15":
- return nbt_1_15.isPlayer(source);
- case "1.16":
- return nbt_1_16.isPlayer(source);
- case "1.16.2":
- return nbt_1_16_2.isPlayer(source);
- case "1.16.5":
- return nbt_1_16_3.isPlayer(source);
+ case "1.17":
+ return nbt_1_17_1.isPlayer(source);
default:
return false;
}
@@ -164,18 +95,8 @@ public class NBTModifier
{
switch (getVersion())
{
- case "1.13.2":
- return nbt_1_13_2.getArrowDamage(arrow);
- case "1.14":
- return nbt_1_14.getArrowDamage(arrow);
- case "1.15":
- return nbt_1_15.getArrowDamage(arrow);
- case "1.16":
- return nbt_1_16.getArrowDamage(arrow);
- case "1.16.2":
- return nbt_1_16_2.getArrowDamage(arrow);
- case "1.16.5":
- return nbt_1_16_3.getArrowDamage(arrow);
+ case "1.17":
+ return nbt_1_17_1.getArrowDamage(arrow);
default:
return 0;
}
@@ -185,23 +106,8 @@ public class NBTModifier
{
switch (getVersion())
{
- case "1.13.2":
- nbt_1_13_2.setArrowDamage(arrow, amount);
- break;
- case "1.14":
- nbt_1_14.setArrowDamage(arrow, amount);
- break;
- case "1.15":
- nbt_1_15.setArrowDamage(arrow, amount);
- break;
- case "1.16":
- nbt_1_16.setArrowDamage(arrow, amount);
- break;
- case "1.16.2":
- nbt_1_16_2.setArrowDamage(arrow, amount);
- break;
- case "1.16.5":
- nbt_1_16_3.setArrowDamage(arrow, amount);
+ case "1.17":
+ nbt_1_17_1.setArrowDamage(arrow, amount);
break;
}
}
@@ -210,18 +116,8 @@ public class NBTModifier
{
switch (getVersion())
{
- case "1.13.2":
- return nbt_1_13_2.getFireworkEffectSize(firework);
- case "1.14":
- return nbt_1_14.getFireworkEffectSize(firework);
- case "1.15":
- return nbt_1_15.getFireworkEffectSize(firework);
- case "1.16":
- return nbt_1_16.getFireworkEffectSize(firework);
- case "1.16.2":
- return nbt_1_16_2.getFireworkEffectSize(firework);
- case "1.16.5":
- return nbt_1_16_3.getFireworkEffectSize(firework);
+ case "1.17":
+ return nbt_1_17_1.getFireworkEffectSize(firework);
default:
return 0;
}
@@ -231,18 +127,8 @@ public class NBTModifier
{
switch (getVersion())
{
- case "1.13.2":
- return nbt_1_13_2.hasFireworkLargeEffect(firework);
- case "1.14":
- return nbt_1_14.hasFireworkLargeEffect(firework);
- case "1.15":
- return nbt_1_15.hasFireworkLargeEffect(firework);
- case "1.16":
- return nbt_1_16.hasFireworkLargeEffect(firework);
- case "1.16.2":
- return nbt_1_16_2.hasFireworkLargeEffect(firework);
- case "1.16.5":
- return nbt_1_16_3.hasFireworkLargeEffect(firework);
+ case "1.17":
+ return nbt_1_17_1.hasFireworkLargeEffect(firework);
default:
return false;
}
@@ -252,18 +138,8 @@ public class NBTModifier
{
switch (getVersion())
{
- case "1.13.2":
- return nbt_1_13_2.isCrashItem(item);
- case "1.14":
- return nbt_1_14.isCrashItem(item);
- case "1.15":
- return nbt_1_15.isCrashItem(item);
- case "1.16":
- return nbt_1_16.isCrashItem(item);
- case "1.16.2":
- return nbt_1_16_2.isCrashItem(item);
- case "1.16.5":
- return nbt_1_16_3.isCrashItem(item);
+ case "1.17":
+ return nbt_1_17_1.isCrashItem(item);
default:
return false;
}
@@ -273,18 +149,8 @@ public class NBTModifier
{
switch (getVersion())
{
- case "1.13.2":
- return nbt_1_13_2.containsCrashItem(item);
- case "1.14":
- return nbt_1_14.containsCrashItem(item);
- case "1.15":
- return nbt_1_15.containsCrashItem(item);
- case "1.16":
- return nbt_1_16.containsCrashItem(item);
- case "1.16.2":
- return nbt_1_16_2.containsCrashItem(item);
- case "1.16.5":
- return nbt_1_16_3.containsCrashItem(item);
+ case "1.17":
+ return nbt_1_17_1.containsCrashItem(item);
default:
return false;
}
@@ -294,18 +160,8 @@ public class NBTModifier
{
switch (getVersion())
{
- case "1.13.2":
- return nbt_1_13_2.isDeathItem(item);
- case "1.14":
- return nbt_1_14.isDeathItem(item);
- case "1.15":
- return nbt_1_15.isDeathItem(item);
- case "1.16":
- return nbt_1_16.isDeathItem(item);
- case "1.16.2":
- return nbt_1_16_2.isDeathItem(item);
- case "1.16.5":
- return nbt_1_16_3.isDeathItem(item);
+ case "1.17":
+ return nbt_1_17_1.isDeathItem(item);
default:
return false;
}
@@ -315,18 +171,8 @@ public class NBTModifier
{
switch (getVersion())
{
- case "1.13.2":
- return nbt_1_13_2.containsDeathItem(item);
- case "1.14":
- return nbt_1_14.containsDeathItem(item);
- case "1.15":
- return nbt_1_15.containsDeathItem(item);
- case "1.16":
- return nbt_1_16.containsDeathItem(item);
- case "1.16.2":
- return nbt_1_16_2.containsDeathItem(item);
- case "1.16.5":
- return nbt_1_16_3.containsDeathItem(item);
+ case "1.17":
+ return nbt_1_17_1.containsDeathItem(item);
default:
return false;
}
@@ -336,18 +182,8 @@ public class NBTModifier
{
switch (getVersion())
{
- case "1.13.2":
- return nbt_1_13_2.isDisconnectItem(entity);
- case "1.14":
- return nbt_1_14.isDisconnectItem(entity);
- case "1.15":
- return nbt_1_15.isDisconnectItem(entity);
- case "1.16":
- return nbt_1_16.isDisconnectItem(entity);
- case "1.16.2":
- return nbt_1_16_2.isDisconnectItem(entity);
- case "1.16.5":
- return nbt_1_16_3.isDisconnectItem(entity);
+ case "1.17":
+ return nbt_1_17_1.isDisconnectItem(entity);
default:
return false;
}
@@ -357,18 +193,8 @@ public class NBTModifier
{
switch (getVersion())
{
- case "1.13.2":
- return nbt_1_13_2.isDisconnectItem(item);
- case "1.14":
- return nbt_1_14.isDisconnectItem(item);
- case "1.15":
- return nbt_1_15.isDisconnectItem(item);
- case "1.16":
- return nbt_1_16.isDisconnectItem(item);
- case "1.16.2":
- return nbt_1_16_2.isDisconnectItem(item);
- case "1.16.5":
- return nbt_1_16_3.isDisconnectItem(item);
+ case "1.17":
+ return nbt_1_17_1.isDisconnectItem(item);
default:
return false;
}
@@ -378,18 +204,8 @@ public class NBTModifier
{
switch (getVersion())
{
- case "1.13.2":
- return nbt_1_13_2.containsDisconnectItem(item);
- case "1.14":
- return nbt_1_14.containsDisconnectItem(item);
- case "1.15":
- return nbt_1_15.containsDisconnectItem(item);
- case "1.16":
- return nbt_1_16.containsDisconnectItem(item);
- case "1.16.2":
- return nbt_1_16_2.containsDisconnectItem(item);
- case "1.16.5":
- return nbt_1_16_3.containsDisconnectItem(item);
+ case "1.17":
+ return nbt_1_17_1.containsDisconnectItem(item);
default:
return false;
}
@@ -400,22 +216,7 @@ public class NBTModifier
switch (getVersion())
{
case "1.13.2":
- nbt_1_13_2.removeInvalidValues(entity);
- break;
- case "1.14":
- nbt_1_14.removeInvalidValues(entity);
- break;
- case "1.15":
- nbt_1_15.removeInvalidValues(entity);
- break;
- case "1.16":
- nbt_1_16.removeInvalidValues(entity);
- break;
- case "1.16.2":
- nbt_1_16_2.removeInvalidValues(entity);
- break;
- case "1.16.5":
- nbt_1_16_3.removeInvalidValues(entity);
+ nbt_1_17_1.removeInvalidValues(entity);
break;
}
}
@@ -424,42 +225,12 @@ public class NBTModifier
{
switch (getVersion())
{
- case "1.13.2":
+ case "1.17":
if (item != null && item.getType().name().equalsIgnoreCase("spawn_egg"))
{
return true;
}
- return nbt_1_13_2.isDangerousEgg(item);
- case "1.14":
- if (item != null && item.getItemMeta() instanceof SpawnEggMeta)
- {
- return true;
- }
- return nbt_1_14.isDangerousEgg(item);
- case "1.15":
- if (item != null && item.getItemMeta() instanceof SpawnEggMeta)
- {
- return true;
- }
- return nbt_1_15.isDangerousEgg(item);
- case "1.16":
- if (item != null && item.getItemMeta() instanceof SpawnEggMeta)
- {
- return true;
- }
- return nbt_1_16.isDangerousEgg(item);
- case "1.16.2":
- if (item != null && item.getItemMeta() instanceof SpawnEggMeta)
- {
- return true;
- }
- return nbt_1_16_2.isDangerousEgg(item);
- case "1.16.5":
- if (item != null && item.getItemMeta() instanceof SpawnEggMeta)
- {
- return true;
- }
- return nbt_1_16_3.isDangerousEgg(item);
+ return nbt_1_17_1.isDangerousEgg(item);
default:
return false;
}
@@ -469,23 +240,8 @@ public class NBTModifier
{
switch (getVersion())
{
- case "1.13.2":
- nbt_1_13_2.isDangerousSkull(item);
- break;
- case "1.14":
- nbt_1_14.isDangerousSkull(item);
- break;
- case "1.15":
- nbt_1_15.isDangerousSkull(item);
- break;
- case "1.16":
- nbt_1_16.isDangerousSkull(item);
- break;
- case "1.16.2":
- nbt_1_16_2.isDangerousSkull(item);
- break;
- case "1.16.5":
- nbt_1_16_3.isDangerousSkull(item);
+ case "1.17":
+ nbt_1_17_1.isDangerousSkull(item);
break;
}
return false;
@@ -493,18 +249,18 @@ public class NBTModifier
protected boolean isOversizedSign(ItemStack item)
{
- if (getVersion().equals("1.16.5"))
+ if (getVersion().equals("1.17"))
{
- return nbt_1_16_3.isOversizedSign(item);
+ return nbt_1_17_1.isOversizedSign(item);
}
return false;
}
protected void clearOversizedSign(BlockPlaceEvent event)
{
- if (getVersion().equals("1.16.5"))
+ if (getVersion().equals("1.17"))
{
- nbt_1_16_3.clearOversizedSign(event);
+ nbt_1_17_1.clearOversizedSign(event);
}
}
}
diff --git a/src/main/java/me/cooljwb/vulnerabilitypatcher/modifiers/NBTModifier_1_13_2.java b/src/main/java/me/cooljwb/vulnerabilitypatcher/modifiers/NBTModifier_1_13_2.java
deleted file mode 100644
index a434d62..0000000
--- a/src/main/java/me/cooljwb/vulnerabilitypatcher/modifiers/NBTModifier_1_13_2.java
+++ /dev/null
@@ -1,487 +0,0 @@
-package me.cooljwb.vulnerabilitypatcher.modifiers;
-
-import com.mojang.brigadier.exceptions.CommandSyntaxException;
-import me.cooljwb.vulnerabilitypatcher.Variables;
-import me.cooljwb.vulnerabilitypatcher.VulnerabilityPatcher;
-import me.cooljwb.vulnerabilitypatcher.patches.Patches;
-import net.minecraft.server.v1_13_R2.MojangsonParser;
-import net.minecraft.server.v1_13_R2.NBTBase;
-import net.minecraft.server.v1_13_R2.NBTTagCompound;
-import net.minecraft.server.v1_13_R2.NBTTagList;
-import org.bukkit.Bukkit;
-import org.bukkit.Material;
-import org.bukkit.craftbukkit.v1_13_R2.entity.CraftEntity;
-import org.bukkit.craftbukkit.v1_13_R2.entity.CraftItem;
-import org.bukkit.craftbukkit.v1_13_R2.entity.CraftPlayer;
-import org.bukkit.craftbukkit.v1_13_R2.inventory.CraftItemStack;
-import org.bukkit.entity.Arrow;
-import org.bukkit.entity.Entity;
-import org.bukkit.entity.Firework;
-import org.bukkit.entity.Player;
-import org.bukkit.inventory.ItemStack;
-import org.bukkit.inventory.meta.BookMeta;
-import org.bukkit.inventory.meta.SpawnEggMeta;
-import org.bukkit.projectiles.ProjectileSource;
-
-import java.io.File;
-import java.util.HashMap;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-public class NBTModifier_1_13_2
-{
-
- private Logger log = Logger.getLogger("Minecraft");
-
- /* Misc */
- public void log(Level level, String message)
- {
- log.log(level, String.format("[%s] %s", VulnerabilityPatcher.pluginName, message));
- }
-
- private void fired_countermeasure(String reason)
- {
- if (Patches.devmode)
- {
- log(Level.INFO, String.format("Fired countermeasure in %s reason: %s", getClass().getName(), reason));
- }
- }
-
- private NBTTagCompound getItemNBT(ItemStack item)
- {
- if (item != null)
- {
- net.minecraft.server.v1_13_R2.ItemStack nmsItemStack = CraftItemStack.asNMSCopy(item);
- if (nmsItemStack != null)
- {
- return nmsItemStack.getTag();
- }
- }
- return null;
- }
-
- private NBTTagCompound getEntityNBT(Entity entity)
- {
- net.minecraft.server.v1_13_R2.Entity nmsEntity = ((CraftEntity) entity).getHandle();
- NBTTagCompound tag = new NBTTagCompound();
- nmsEntity.save(tag);
- return tag;
- }
-
- private void setEntityNBT(Entity entity, NBTTagCompound nbtTagCompound)
- {
- net.minecraft.server.v1_13_R2.Entity nmsEntity = ((CraftEntity) entity).getHandle();
- nmsEntity.f(nbtTagCompound);
- }
-
- public NBTTagList getAttributeList(ItemStack item)
- {
- NBTTagCompound itemtag = getItemNBT(item);
-
- if (item != null && itemtag != null && itemtag.hasKey("AttributeModifiers"))
- {
- return getItemNBT(item).getList("AttributeModifiers", 10);
- }
- return null;
- }
-
- String itemToString(ItemStack item)
- {
- if (item != null)
- {
- net.minecraft.server.v1_13_R2.ItemStack nmsItemStack = CraftItemStack.asNMSCopy(item);
-
- if (nmsItemStack.hasTag())
- {
- return nmsItemStack.getTag().toString();
- }
- }
- return "";
- }
-
- boolean removePlayerdata(String player)
- {
- if (Bukkit.getPlayer(player) != null)
- {
- ((CraftEntity) Bukkit.getPlayer(player)).getHandle().f(new NBTTagCompound());
- return true;
- }
- else if (Bukkit.getOfflinePlayer(player) != null)
- {
- File file = new File(Bukkit.getServer().getWorldContainer() + "/world/playerdata/" + Bukkit.getOfflinePlayer(player).getUniqueId().toString() + ".dat");
- return file.delete();
- }
- return false;
- }
-
- void resetMeta(Player player, ItemStack item, boolean mainhand)
- {
- net.minecraft.server.v1_13_R2.ItemStack nmsItemStack = CraftItemStack.asNMSCopy(item);
-
- if (nmsItemStack.hasTag() && nmsItemStack.getTag().hasKey("pages"))
- {
- String pages = nmsItemStack.getTag().getList("pages", 8).toString();
- if (pages.contains("clickEvent") || pages.contains("hoverEvent"))
- {
- BookMeta meta = (BookMeta) item.getItemMeta();
- ItemStack book = new ItemStack(Material.WRITTEN_BOOK);
-
- meta.setPages(meta.getPages());
- book.setItemMeta(meta);
-
- if (mainhand)
- {
- player.getInventory().setItemInMainHand(book);
- }
- else
- {
- player.getInventory().setItemInOffHand(book);
- }
- }
- }
- }
-
- boolean isPlayer(ProjectileSource source)
- {
- return source instanceof CraftPlayer;
- }
-
- double getArrowDamage(Arrow arrow)
- {
- return getEntityNBT(arrow).hasKey("damage") ? getEntityNBT(arrow).getDouble("damage") : 0;
- }
-
- void setArrowDamage(Arrow arrow, double amount)
- {
- NBTTagCompound tag = getEntityNBT(arrow);
- if (tag.hasKey("damage"))
- {
- tag.setDouble("damage", amount);
- setEntityNBT(arrow, tag);
- }
- }
-
- int getFireworkEffectSize(Firework firework)
- {
- NBTTagCompound tag = getEntityNBT(firework);
- if (tag.hasKey("FireworksItem") && tag.getCompound("FireworksItem").hasKey("tag") && tag.getCompound("FireworksItem").getCompound("tag").hasKey("Fireworks") && tag.getCompound("FireworksItem").getCompound("tag").getCompound("Fireworks").hasKey("Explosions"))
- {
- return tag.getCompound("FireworksItem").getCompound("tag").getCompound("Fireworks").getList("Explosions", 10).size();
- }
- return 0;
- }
-
- boolean hasFireworkLargeEffect(Firework firework)
- {
- NBTTagCompound tag = getEntityNBT(firework);
- if (tag.hasKey("FireworksItem") && tag.getCompound("FireworksItem").hasKey("tag") && tag.getCompound("FireworksItem").getCompound("tag").hasKey("Fireworks") && tag.getCompound("FireworksItem").getCompound("tag").getCompound("Fireworks").hasKey("Explosions"))
- {
- NBTTagList explosions = tag.getCompound("FireworksItem").getCompound("tag").getCompound("Fireworks").getList("Explosions", 10);
- for (int x = 0; x <= (explosions.size() - 1); x++)
- {
- if (explosions.getCompound(x).getInt("Type") == 1 || explosions.getCompound(x).getInt("Type") == 3)
- {
- return true;
- }
- }
- }
- return false;
- }
-
- boolean isCrashItem(ItemStack item)
- {
- if (item != null)
- {
- net.minecraft.server.v1_13_R2.ItemStack nmsItemStack = CraftItemStack.asNMSCopy(item);
-
- if (nmsItemStack.getTag() != null)
- {
- NBTTagCompound itemtag = nmsItemStack.getTag();
-
- if (itemtag.toString().contains("translation.test.invalid"))
- {
- fired_countermeasure("isCrashItem");
- return true;
- }
- }
- }
- return false;
- }
-
- boolean containsCrashItem(ItemStack item)
- {
- if (item != null)
- {
- net.minecraft.server.v1_13_R2.ItemStack nmsItemStack = CraftItemStack.asNMSCopy(item);
-
- if (nmsItemStack.getTag() != null)
- {
- NBTTagCompound blockentitytag = nmsItemStack.getTag().getCompound("BlockEntityTag");
- NBTTagList itemlist = blockentitytag.getList("Items", 10);
-
- for (int a = 0; a <= itemlist.size(); a++)
- {
- NBTTagCompound itemtag = itemlist.getCompound(a).getCompound("tag");
-
- if (itemtag.toString().contains("translation.test.invalid"))
- {
- fired_countermeasure("containsCrashItem");
- return true;
- }
- }
- }
- }
- return false;
- }
-
- boolean isDeathItem(ItemStack item)
- {
- net.minecraft.server.v1_13_R2.ItemStack nmsItemStack = CraftItemStack.asNMSCopy(item);
-
- if (nmsItemStack != null && nmsItemStack.hasTag())
- {
- return isDeathItem(nmsItemStack.getTag());
- }
- return false;
- }
-
- private boolean isDeathItem(NBTTagCompound item)
- {
- if (item != null)
- {
- NBTTagList attrlist = item.getList("AttributeModifiers", 10);
-
- if (attrlist != null)
- {
- for (int i = 0; i < attrlist.size(); i++)
- {
- NBTTagCompound compound = (NBTTagCompound) attrlist.get(i);
- if ((compound.getString("Name").equalsIgnoreCase("MAX_HEALTH") || compound.getString("AttributeName").equalsIgnoreCase("generic.maxhealth")) && compound.getDouble("Amount") <= 0)
- {
- fired_countermeasure("isDeathItem");
- return true;
- }
- }
- }
- }
- return false;
- }
-
- boolean containsDeathItem(ItemStack item)
- {
- if (item != null)
- {
- net.minecraft.server.v1_13_R2.ItemStack nmsItemStack = CraftItemStack.asNMSCopy(item);
-
- if (nmsItemStack.getTag() != null)
- {
- NBTTagCompound blockentitytag = nmsItemStack.getTag().getCompound("BlockEntityTag");
- NBTTagList itemlist = blockentitytag.getList("Items", 10);
-
- for (int a = 0; a <= itemlist.size(); a++)
- {
- NBTTagList attrlist = itemlist.getCompound(a).getCompound("tag").getList("AttributeModifiers", 10);
-
- for (int b = 0; b <= attrlist.size(); b++)
- {
- String attribute_name = attrlist.getCompound(b).getString("AttributeName");
- String name = attrlist.getCompound(b).getString("Name");
- Double amount = attrlist.getCompound(b).getDouble("Amount");
-
- if ((name.equalsIgnoreCase("MAX_HEALTH") || attribute_name.equalsIgnoreCase("generic.maxhealth")) && amount <= 0)
- {
- fired_countermeasure("containsDeathItem");
- return true;
- }
- }
- }
- }
- }
- return false;
- }
-
- boolean isDisconnectItem(ItemStack item)
- {
- net.minecraft.server.v1_13_R2.ItemStack nmsItemStack = CraftItemStack.asNMSCopy(item);
-
- if (nmsItemStack != null && nmsItemStack.hasTag())
- {
- return isDisconnectItem(nmsItemStack.getTag());
- }
- return false;
- }
-
- boolean isDisconnectItem(Entity entity)
- {
- if (entity instanceof CraftItem)
- {
- return isDisconnectItem(entity);
- }
- return false;
- }
-
- private boolean isDisconnectItem(NBTTagCompound item)
- {
- if (item != null)
- {
- if (item.hasKey("CustomPotionColor") && item.getInt("CustomPotionColor") < 0)
- {
- fired_countermeasure("isCustomPotionColorDisconnectItem");
- return true;
- }
-
-
- else if ((item.getCompound("display").hasKey("color") && item.getCompound("display").getInt("color") < 0))
- {
- fired_countermeasure("isDisplayColorDisconnectItem");
- return true;
- }
-
- else if (item.getCompound("BlockEntityTag").hasKey("Patterns"))
- {
- NBTTagList patterns = item.getCompound("BlockEntityTag").getList("Patterns", 10);
- for (int x = 0; x <= (patterns.size() - 1); x++)
- {
- if (patterns.get(x).getTypeId() == 10)
- {
- if (patterns.getCompound(x).hasKey("Color") && patterns.getCompound(x).getInt("Color") < 0)
- {
- return true;
- }
- }
- }
-
- for (NBTBase base : item.getCompound("BlockEntityTag").getList("Patterns", 10))
- {
- if (base.asString().contains("Color:-1"))
- {
- fired_countermeasure("isDisplayBannedColorDisconnectItem");
- return true;
- }
- }
- }
-
- else if (item.toString().length() > 262140 || isMovementDisconnectItem(item) || isInvalidAttributeName(item))
- {
- fired_countermeasure("isLargeNBTDisconnectItem");
- return true;
- }
- }
- return false;
- }
-
- boolean containsDisconnectItem(ItemStack item)
- {
- if (item != null)
- {
- net.minecraft.server.v1_13_R2.ItemStack nmsItemStack = CraftItemStack.asNMSCopy(item);
-
- if (nmsItemStack != null && nmsItemStack.getTag() != null)
- {
- NBTTagList items = nmsItemStack.getTag().getCompound("BlockEntityTag").getList("Items", 10);
-
- if (items != null)
- {
- for (int a = 0; a <= items.size(); a++)
- {
- NBTTagCompound nmsitem = items.getCompound(a);
- return isDisconnectItem(nmsitem.getCompound("tag"));
- }
- }
- }
- }
- return false;
- }
-
- private boolean isMovementDisconnectItem(NBTTagCompound tag)
- {
- if (tag != null)
- {
- NBTTagList attrlist = tag.getList("AttributeModifiers", 10);
- if (attrlist != null)
- {
- HashMap attributes = new HashMap<>();
-
- for (int a = 0; a <= attrlist.size(); a++)
- {
- NBTTagCompound attribute = attrlist.getCompound(a);
-
- if (attribute.getString("AttributeName").equalsIgnoreCase("generic.movementspeed") && attributes.containsKey(attribute.getString("AttributeName").toLowerCase()) && !Float.isFinite(attribute.getFloat("Amount")))
- {
- fired_countermeasure("isMovementDisconnectItem");
- return true;
- }
-
- attributes.put(attribute.getString("AttributeName").toLowerCase(), attribute.getFloat("Amount"));
- }
- }
- }
- return false;
- }
-
- private boolean isInvalidAttributeName(NBTTagCompound tag)
- {
- if (tag != null)
- {
- NBTTagList attrlist = tag.getList("AttributeModifiers", 10);
-
- if (attrlist != null)
- {
- for (int a = 0; a <= attrlist.size(); a++)
- {
- NBTTagCompound attribute = attrlist.getCompound(a);
-
- if (attribute != null && attribute.getString("AttributeName").toLowerCase() != "")
- {
- if (!Variables.LeagacyAttributes.liststr.contains(attribute.getString("AttributeName").toLowerCase()))
- {
- fired_countermeasure("isInvalidAttributeNameDisconnectItem");
- return true;
- }
- }
- }
- }
- }
- return false;
- }
-
- void removeInvalidValues(Entity entity)
- {
- NBTTagCompound tag = getEntityNBT(entity);
- if (tag.toString().contains("Color:-"))
- {
- try
- {
- MojangsonParser.parse(tag.toString().replaceAll("Color:-", ""));
- }
- catch (CommandSyntaxException e)
- {
- e.printStackTrace();
- }
- }
- }
-
- boolean isDangerousEgg(ItemStack item)
- {
- if (item != null && item.getItemMeta() instanceof SpawnEggMeta)
- {
- net.minecraft.server.v1_13_R2.ItemStack nmsItemStack = org.bukkit.craftbukkit.v1_13_R2.inventory.CraftItemStack.asNMSCopy(item);
- return nmsItemStack.hasTag() && VulnerabilityPatcher.main.getConfig().getStringList("BlockedEntityTags").contains(nmsItemStack.getTag().getCompound("EntityTag").getString("id").replaceAll("minecraft:", ""));
- }
- return false;
- }
-
- boolean isDangerousSkull(ItemStack item)
- {
- if (item != null && item.hasItemMeta())
- {
- NBTTagCompound tag = CraftItemStack.asNMSCopy(item).getTag();
-
- if (tag != null && tag.hasKey("SkullOwner") && tag.getString("SkullOwner").trim().equals(""))
- {
- return true;
- }
- }
- return false;
- }
-}
diff --git a/src/main/java/me/cooljwb/vulnerabilitypatcher/modifiers/NBTModifier_1_14.java b/src/main/java/me/cooljwb/vulnerabilitypatcher/modifiers/NBTModifier_1_14.java
deleted file mode 100644
index 97f2239..0000000
--- a/src/main/java/me/cooljwb/vulnerabilitypatcher/modifiers/NBTModifier_1_14.java
+++ /dev/null
@@ -1,506 +0,0 @@
-package me.cooljwb.vulnerabilitypatcher.modifiers;
-
-import com.mojang.brigadier.exceptions.CommandSyntaxException;
-import me.cooljwb.vulnerabilitypatcher.Variables;
-import me.cooljwb.vulnerabilitypatcher.VulnerabilityPatcher;
-import me.cooljwb.vulnerabilitypatcher.patches.Patches;
-import net.minecraft.server.v1_14_R1.MojangsonParser;
-import net.minecraft.server.v1_14_R1.NBTBase;
-import net.minecraft.server.v1_14_R1.NBTTagCompound;
-import net.minecraft.server.v1_14_R1.NBTTagList;
-import org.bukkit.Bukkit;
-import org.bukkit.Material;
-import org.bukkit.craftbukkit.v1_14_R1.entity.CraftEntity;
-import org.bukkit.craftbukkit.v1_14_R1.entity.CraftItem;
-import org.bukkit.craftbukkit.v1_14_R1.entity.CraftPlayer;
-import org.bukkit.craftbukkit.v1_14_R1.inventory.CraftItemStack;
-import org.bukkit.entity.Arrow;
-import org.bukkit.entity.Entity;
-import org.bukkit.entity.Firework;
-import org.bukkit.entity.Player;
-import org.bukkit.inventory.ItemStack;
-import org.bukkit.inventory.meta.BookMeta;
-import org.bukkit.inventory.meta.SpawnEggMeta;
-import org.bukkit.projectiles.ProjectileSource;
-
-import java.io.File;
-import java.util.HashMap;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-/*
- * Copyright 2019 CoolJWB
- *
- * 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
- *
- * http://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.
- */
-
-/**
- * This class is a function port to 1.14
- * Date: 2020-06-13
- *
- * @author CoolJWB
- */
-
-public class NBTModifier_1_14
-{
-
- private Logger log = Logger.getLogger("Minecraft");
-
- /* Misc */
- public void log(Level level, String message)
- {
- log.log(level, String.format("[%s] %s", VulnerabilityPatcher.pluginName, message));
- }
-
- private void fired_countermeasure(String reason)
- {
- if (Patches.devmode)
- {
- log(Level.INFO, String.format("Fired countermeasure in %s reason: %s", getClass().getName(), reason));
- }
- }
-
- private NBTTagCompound getItemNBT(ItemStack item)
- {
- if (item != null)
- {
- net.minecraft.server.v1_14_R1.ItemStack nmsItemStack = CraftItemStack.asNMSCopy(item);
- if (nmsItemStack != null)
- {
- return nmsItemStack.getTag();
- }
- }
- return null;
- }
-
- private NBTTagCompound getEntityNBT(Entity entity)
- {
- net.minecraft.server.v1_14_R1.Entity nmsEntity = ((CraftEntity) entity).getHandle();
- NBTTagCompound tag = new NBTTagCompound();
- nmsEntity.save(tag);
- return tag;
- }
-
- private void setEntityNBT(Entity entity, NBTTagCompound nbtTagCompound)
- {
- net.minecraft.server.v1_14_R1.Entity nmsEntity = ((CraftEntity) entity).getHandle();
- nmsEntity.f(nbtTagCompound);
- }
-
- public NBTTagList getAttributeList(ItemStack item)
- {
- NBTTagCompound itemtag = getItemNBT(item);
-
- if (item != null && itemtag != null && itemtag.hasKey("AttributeModifiers"))
- {
- return getItemNBT(item).getList("AttributeModifiers", 10);
- }
- return null;
- }
-
- String itemToString(ItemStack item)
- {
- if (item != null)
- {
- net.minecraft.server.v1_14_R1.ItemStack nmsItemStack = CraftItemStack.asNMSCopy(item);
-
- if (nmsItemStack.hasTag())
- {
- return nmsItemStack.getTag().toString();
- }
- }
- return "";
- }
-
- boolean removePlayerdata(String player)
- {
- if (Bukkit.getPlayer(player) != null)
- {
- ((CraftEntity) Bukkit.getPlayer(player)).getHandle().f(new net.minecraft.server.v1_14_R1.NBTTagCompound());
- return true;
- }
- else if (Bukkit.getOfflinePlayer(player) != null)
- {
- File file = new File(Bukkit.getServer().getWorldContainer() + "/world/playerdata/" + Bukkit.getOfflinePlayer(player).getUniqueId().toString() + ".dat");
- return file.delete();
- }
- return false;
- }
-
- void resetMeta(Player player, ItemStack item, boolean mainhand)
- {
- net.minecraft.server.v1_14_R1.ItemStack nmsItemStack = CraftItemStack.asNMSCopy(item);
-
- if (nmsItemStack.hasTag() && nmsItemStack.getTag().hasKey("pages"))
- {
- String pages = nmsItemStack.getTag().getList("pages", 8).toString();
- if (pages.contains("clickEvent") || pages.contains("hoverEvent"))
- {
- BookMeta meta = (BookMeta) item.getItemMeta();
- ItemStack book = new ItemStack(Material.WRITTEN_BOOK);
-
- meta.setPages(meta.getPages());
- book.setItemMeta(meta);
-
- if (mainhand)
- {
- player.getInventory().setItemInMainHand(book);
- }
- else
- {
- player.getInventory().setItemInOffHand(book);
- }
- }
- }
- }
-
- boolean isPlayer(ProjectileSource source)
- {
- return source instanceof CraftPlayer;
- }
-
- double getArrowDamage(Arrow arrow)
- {
- return getEntityNBT(arrow).hasKey("damage") ? getEntityNBT(arrow).getDouble("damage") : 0;
- }
-
- void setArrowDamage(Arrow arrow, double amount)
- {
- NBTTagCompound tag = getEntityNBT(arrow);
- if (tag.hasKey("damage"))
- {
- tag.setDouble("damage", amount);
- setEntityNBT(arrow, tag);
- }
- }
-
- int getFireworkEffectSize(Firework firework)
- {
- NBTTagCompound tag = getEntityNBT(firework);
- if (tag.hasKey("FireworksItem") && tag.getCompound("FireworksItem").hasKey("tag") && tag.getCompound("FireworksItem").getCompound("tag").hasKey("Fireworks") && tag.getCompound("FireworksItem").getCompound("tag").getCompound("Fireworks").hasKey("Explosions"))
- {
- return tag.getCompound("FireworksItem").getCompound("tag").getCompound("Fireworks").getList("Explosions", 10).size();
- }
- return 0;
- }
-
- boolean hasFireworkLargeEffect(Firework firework)
- {
- NBTTagCompound tag = getEntityNBT(firework);
- if (tag.hasKey("FireworksItem") && tag.getCompound("FireworksItem").hasKey("tag") && tag.getCompound("FireworksItem").getCompound("tag").hasKey("Fireworks") && tag.getCompound("FireworksItem").getCompound("tag").getCompound("Fireworks").hasKey("Explosions"))
- {
- NBTTagList explosions = tag.getCompound("FireworksItem").getCompound("tag").getCompound("Fireworks").getList("Explosions", 10);
- for (int x = 0; x <= (explosions.size() - 1); x++)
- {
- if (explosions.getCompound(x).getInt("Type") == 1 || explosions.getCompound(x).getInt("Type") == 3)
- {
- return true;
- }
- }
- }
- return false;
- }
-
- boolean isCrashItem(ItemStack item)
- {
- if (item != null)
- {
- net.minecraft.server.v1_14_R1.ItemStack nmsItemStack = CraftItemStack.asNMSCopy(item);
-
- if (nmsItemStack.getTag() != null)
- {
- NBTTagCompound itemtag = nmsItemStack.getTag();
-
- if (itemtag.toString().contains("translation.test.invalid"))
- {
- fired_countermeasure("isCrashItem");
- return true;
- }
- }
- }
- return false;
- }
-
- boolean containsCrashItem(ItemStack item)
- {
- if (item != null)
- {
- net.minecraft.server.v1_14_R1.ItemStack nmsItemStack = CraftItemStack.asNMSCopy(item);
-
- if (nmsItemStack.getTag() != null)
- {
- NBTTagCompound blockentitytag = nmsItemStack.getTag().getCompound("BlockEntityTag");
- NBTTagList itemlist = blockentitytag.getList("Items", 10);
-
- for (int a = 0; a <= itemlist.size(); a++)
- {
- NBTTagCompound itemtag = itemlist.getCompound(a).getCompound("tag");
-
- if (itemtag.toString().contains("translation.test.invalid"))
- {
- fired_countermeasure("containsCrashItem");
- return true;
- }
- }
- }
- }
- return false;
- }
-
- boolean isDeathItem(ItemStack item)
- {
- net.minecraft.server.v1_14_R1.ItemStack nmsItemStack = CraftItemStack.asNMSCopy(item);
-
- if (nmsItemStack != null && nmsItemStack.hasTag())
- return isDeathItem(nmsItemStack.getTag());
- return false;
- }
-
- private boolean isDeathItem(NBTTagCompound item)
- {
- if (item != null)
- {
- NBTTagList attrlist = item.getList("AttributeModifiers", 10);
-
- if (attrlist != null)
- {
- for (int i = 0; i < attrlist.size(); i++)
- {
- NBTTagCompound compound = (NBTTagCompound) attrlist.get(i);
- if ((compound.getString("Name").equalsIgnoreCase("MAX_HEALTH") || compound.getString("AttributeName").equalsIgnoreCase("generic.maxhealth")) && compound.getDouble("Amount") <= 0)
- {
- fired_countermeasure("isDeathItem");
- return true;
- }
- }
- }
- }
- return false;
- }
-
- boolean containsDeathItem(ItemStack item)
- {
- if (item != null)
- {
- net.minecraft.server.v1_14_R1.ItemStack nmsItemStack = CraftItemStack.asNMSCopy(item);
-
- if (nmsItemStack.getTag() != null)
- {
- NBTTagCompound blockentitytag = nmsItemStack.getTag().getCompound("BlockEntityTag");
- NBTTagList itemlist = blockentitytag.getList("Items", 10);
-
- for (int a = 0; a <= itemlist.size(); a++)
- {
- NBTTagList attrlist = itemlist.getCompound(a).getCompound("tag").getList("AttributeModifiers", 10);
-
- for (int b = 0; b <= attrlist.size(); b++)
- {
- String attribute_name = attrlist.getCompound(b).getString("AttributeName");
- String name = attrlist.getCompound(b).getString("Name");
- Double amount = attrlist.getCompound(b).getDouble("Amount");
-
- if ((name.equalsIgnoreCase("MAX_HEALTH") || attribute_name.equalsIgnoreCase("generic.maxhealth")) && amount <= 0)
- {
- fired_countermeasure("containsDeathItem");
- return true;
- }
- }
- }
- }
- }
- return false;
- }
-
- boolean isDisconnectItem(ItemStack item)
- {
- net.minecraft.server.v1_14_R1.ItemStack nmsItemStack = CraftItemStack.asNMSCopy(item);
-
- if (nmsItemStack != null && nmsItemStack.hasTag())
- {
- return isDisconnectItem(nmsItemStack.getTag());
- }
- return false;
- }
-
- boolean isDisconnectItem(Entity entity)
- {
- if (entity instanceof CraftItem)
- return isDisconnectItem((CraftItem) entity);
- return false;
- }
-
- private boolean isDisconnectItem(NBTTagCompound item)
- {
- if (item != null)
- {
- if (item.hasKey("CustomPotionColor") && item.getInt("CustomPotionColor") < 0)
- {
- fired_countermeasure("isCustomPotionColorDisconnectItem");
- return true;
- }
-
-
- else if ((item.getCompound("display").hasKey("color") && item.getCompound("display").getInt("color") < 0))
- {
- fired_countermeasure("isDisplayColorDisconnectItem");
- return true;
- }
-
- else if (item.getCompound("BlockEntityTag").hasKey("Patterns"))
- {
- NBTTagList patterns = item.getCompound("BlockEntityTag").getList("Patterns", 10);
- for (int x = 0; x <= (patterns.size() - 1); x++)
- {
- if (patterns.get(x).getTypeId() == 10)
- {
- if (patterns.getCompound(x).hasKey("Color") && patterns.getCompound(x).getInt("Color") < 0)
- {
- return true;
- }
- }
- }
-
- for (NBTBase base : item.getCompound("BlockEntityTag").getList("Patterns", 10))
- {
- if (base.asString().contains("Color:-1"))
- {
- fired_countermeasure("isDisplayBannedColorDisconnectItem");
- return true;
- }
- }
- }
-
- else if (item.toString().length() > 262140 || isMovementDisconnectItem(item) || isInvalidAttributeName(item))
- {
- fired_countermeasure("isLargeNBTDisconnectItem");
- return true;
- }
- }
- return false;
- }
-
- boolean containsDisconnectItem(ItemStack item)
- {
- if (item != null)
- {
- net.minecraft.server.v1_14_R1.ItemStack nmsItemStack = CraftItemStack.asNMSCopy(item);
-
- if (nmsItemStack != null && nmsItemStack.getTag() != null)
- {
- NBTTagList items = nmsItemStack.getTag().getCompound("BlockEntityTag").getList("Items", 10);
-
- if (items != null)
- {
- for (int x = 0; x <= (items.size() - 1); x++)
- {
- NBTTagCompound nmsitem = items.getCompound(x);
- return isDisconnectItem(nmsitem.getCompound("tag"));
- }
- }
- }
- }
- return false;
- }
-
- private boolean isMovementDisconnectItem(NBTTagCompound tag)
- {
- if (tag != null)
- {
- NBTTagList attrlist = tag.getList("AttributeModifiers", 10);
- if (attrlist != null)
- {
- HashMap attributes = new HashMap<>();
-
- for (int a = 0; a <= attrlist.size(); a++)
- {
- NBTTagCompound attribute = attrlist.getCompound(a);
-
- if (attribute.getString("AttributeName").equalsIgnoreCase("generic.movementspeed") && attributes.containsKey(attribute.getString("AttributeName").toLowerCase()) && !Float.isFinite(attribute.getFloat("Amount")))
- {
- fired_countermeasure("isMovementDisconnectItem");
- return true;
- }
-
- attributes.put(attribute.getString("AttributeName").toLowerCase(), attribute.getFloat("Amount"));
- }
- }
- }
- return false;
- }
-
- private boolean isInvalidAttributeName(NBTTagCompound tag)
- {
- if (tag != null)
- {
- NBTTagList attrlist = tag.getList("AttributeModifiers", 10);
-
- if (attrlist != null)
- {
- for (int a = 0; a <= attrlist.size(); a++)
- {
- NBTTagCompound attribute = attrlist.getCompound(a);
-
- if (attribute != null && attribute.getString("AttributeName").toLowerCase() != "")
- {
- if (!Variables.LeagacyAttributes.liststr.contains(attribute.getString("AttributeName").toLowerCase()))
- {
- fired_countermeasure("isInvalidAttributeNameDisconnectItem");
- return true;
- }
- }
- }
- }
- }
- return false;
- }
-
- void removeInvalidValues(Entity entity)
- {
- NBTTagCompound tag = getEntityNBT(entity);
- if (tag.asString().contains("Color:-"))
- {
- try
- {
- setEntityNBT(entity, MojangsonParser.parse(tag.asString().replaceAll("Color:-", "")));
- }
- catch (CommandSyntaxException e)
- {
- e.printStackTrace();
- }
- }
- }
-
- boolean isDangerousEgg(ItemStack item)
- {
- if (item != null && item.getItemMeta() instanceof SpawnEggMeta)
- {
- net.minecraft.server.v1_14_R1.ItemStack nmsItemStack = CraftItemStack.asNMSCopy(item);
- return nmsItemStack.hasTag() && VulnerabilityPatcher.main.getConfig().getStringList("BlockedEntityTags").contains(nmsItemStack.getTag().getCompound("EntityTag").getString("id").replaceAll("minecraft:", ""));
- }
- return false;
- }
-
- boolean isDangerousSkull(ItemStack item)
- {
- if (item != null && item.hasItemMeta())
- {
- NBTTagCompound tag = CraftItemStack.asNMSCopy(item).getTag();
-
- if (tag != null && tag.hasKey("SkullOwner") && tag.getString("SkullOwner").trim().equals(""))
- {
- return true;
- }
- }
- return false;
- }
-}
diff --git a/src/main/java/me/cooljwb/vulnerabilitypatcher/modifiers/NBTModifier_1_15.java b/src/main/java/me/cooljwb/vulnerabilitypatcher/modifiers/NBTModifier_1_15.java
deleted file mode 100644
index 462ddae..0000000
--- a/src/main/java/me/cooljwb/vulnerabilitypatcher/modifiers/NBTModifier_1_15.java
+++ /dev/null
@@ -1,510 +0,0 @@
-package me.cooljwb.vulnerabilitypatcher.modifiers;
-
-import com.mojang.brigadier.exceptions.CommandSyntaxException;
-import me.cooljwb.vulnerabilitypatcher.Variables;
-import me.cooljwb.vulnerabilitypatcher.VulnerabilityPatcher;
-import me.cooljwb.vulnerabilitypatcher.patches.Patches;
-import net.minecraft.server.v1_15_R1.MojangsonParser;
-import net.minecraft.server.v1_15_R1.NBTBase;
-import net.minecraft.server.v1_15_R1.NBTTagCompound;
-import net.minecraft.server.v1_15_R1.NBTTagList;
-import org.bukkit.Bukkit;
-import org.bukkit.Material;
-import org.bukkit.craftbukkit.v1_15_R1.entity.CraftEntity;
-import org.bukkit.craftbukkit.v1_15_R1.entity.CraftItem;
-import org.bukkit.craftbukkit.v1_15_R1.entity.CraftPlayer;
-import org.bukkit.craftbukkit.v1_15_R1.inventory.CraftItemStack;
-import org.bukkit.entity.Arrow;
-import org.bukkit.entity.Entity;
-import org.bukkit.entity.Firework;
-import org.bukkit.entity.Player;
-import org.bukkit.inventory.ItemStack;
-import org.bukkit.inventory.meta.BookMeta;
-import org.bukkit.inventory.meta.SpawnEggMeta;
-import org.bukkit.projectiles.ProjectileSource;
-
-import java.io.File;
-import java.util.HashMap;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-/*
- * Copyright 2019 CoolJWB
- *
- * 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
- *
- * http://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.
- */
-
-/**
- * This class is a function port to 1.15
- * Date: 2020-06-13
- *
- * @author CoolJWB
- */
-
-public class NBTModifier_1_15
-{
-
- private Logger log = Logger.getLogger("Minecraft");
-
- /* Misc */
- public void log(Level level, String message)
- {
- log.log(level, String.format("[%s] %s", VulnerabilityPatcher.pluginName, message));
- }
-
- private void fired_countermeasure(String reason)
- {
- if (Patches.devmode)
- {
- log(Level.INFO, String.format("Fired countermeasure in %s reason: %s", getClass().getName(), reason));
- }
- }
-
- private NBTTagCompound getItemNBT(ItemStack item)
- {
- if (item != null)
- {
- net.minecraft.server.v1_15_R1.ItemStack nmsItemStack = CraftItemStack.asNMSCopy(item);
- if (nmsItemStack != null)
- {
- return nmsItemStack.getTag();
- }
- }
- return null;
- }
-
- private NBTTagCompound getEntityNBT(Entity entity)
- {
- net.minecraft.server.v1_15_R1.Entity nmsEntity = ((CraftEntity) entity).getHandle();
- NBTTagCompound tag = new NBTTagCompound();
- nmsEntity.save(tag);
- return tag;
- }
-
- private void setEntityNBT(Entity entity, NBTTagCompound nbtTagCompound)
- {
- net.minecraft.server.v1_15_R1.Entity nmsEntity = ((CraftEntity) entity).getHandle();
- nmsEntity.f(nbtTagCompound);
- }
-
- public NBTTagList getAttributeList(ItemStack item)
- {
- NBTTagCompound itemtag = getItemNBT(item);
-
- if (item != null && itemtag != null && itemtag.hasKey("AttributeModifiers"))
- {
- return getItemNBT(item).getList("AttributeModifiers", 10);
- }
- return null;
- }
-
- String itemToString(ItemStack item)
- {
- if (item != null)
- {
- net.minecraft.server.v1_15_R1.ItemStack nmsItemStack = CraftItemStack.asNMSCopy(item);
-
- if (nmsItemStack.hasTag())
- {
- return nmsItemStack.getTag().toString();
- }
- }
- return "";
- }
-
- boolean removePlayerdata(String player)
- {
- if (Bukkit.getPlayer(player) != null)
- {
- ((CraftEntity) Bukkit.getPlayer(player)).getHandle().f(new net.minecraft.server.v1_15_R1.NBTTagCompound());
- return true;
- }
- else if (Bukkit.getOfflinePlayer(player) != null)
- {
- File file = new File(Bukkit.getServer().getWorldContainer() + "/world/playerdata/" + Bukkit.getOfflinePlayer(player).getUniqueId().toString() + ".dat");
- return file.delete();
- }
- return false;
- }
-
- void resetMeta(Player player, ItemStack item, boolean mainhand)
- {
- net.minecraft.server.v1_15_R1.ItemStack nmsItemStack = CraftItemStack.asNMSCopy(item);
-
- if (nmsItemStack.hasTag() && nmsItemStack.getTag().hasKey("pages"))
- {
- String pages = nmsItemStack.getTag().getList("pages", 8).toString();
- if (pages.contains("clickEvent") || pages.contains("hoverEvent"))
- {
- BookMeta meta = (BookMeta) item.getItemMeta();
- ItemStack book = new ItemStack(Material.WRITTEN_BOOK);
-
- meta.setPages(meta.getPages());
- book.setItemMeta(meta);
-
- if (mainhand)
- {
- player.getInventory().setItemInMainHand(book);
- }
- else
- {
- player.getInventory().setItemInOffHand(book);
- }
- }
- }
- }
-
- boolean isPlayer(ProjectileSource source)
- {
- return source instanceof CraftPlayer;
- }
-
- double getArrowDamage(Arrow arrow)
- {
- return getEntityNBT(arrow).hasKey("damage") ? getEntityNBT(arrow).getDouble("damage") : 0;
- }
-
- void setArrowDamage(Arrow arrow, double amount)
- {
- NBTTagCompound tag = getEntityNBT(arrow);
- if (tag.hasKey("damage"))
- {
- tag.setDouble("damage", amount);
- setEntityNBT(arrow, tag);
- }
- }
-
- int getFireworkEffectSize(Firework firework)
- {
- NBTTagCompound tag = getEntityNBT(firework);
- if (tag.hasKey("FireworksItem") && tag.getCompound("FireworksItem").hasKey("tag") && tag.getCompound("FireworksItem").getCompound("tag").hasKey("Fireworks") && tag.getCompound("FireworksItem").getCompound("tag").getCompound("Fireworks").hasKey("Explosions"))
- {
- return tag.getCompound("FireworksItem").getCompound("tag").getCompound("Fireworks").getList("Explosions", 10).size();
- }
- return 0;
- }
-
- boolean hasFireworkLargeEffect(Firework firework)
- {
- NBTTagCompound tag = getEntityNBT(firework);
- if (tag.hasKey("FireworksItem") && tag.getCompound("FireworksItem").hasKey("tag") && tag.getCompound("FireworksItem").getCompound("tag").hasKey("Fireworks") && tag.getCompound("FireworksItem").getCompound("tag").getCompound("Fireworks").hasKey("Explosions"))
- {
- NBTTagList explosions = tag.getCompound("FireworksItem").getCompound("tag").getCompound("Fireworks").getList("Explosions", 10);
- for (int x = 0; x <= (explosions.size() - 1); x++)
- {
- if (explosions.getCompound(x).getInt("Type") == 1 || explosions.getCompound(x).getInt("Type") == 3)
- {
- return true;
- }
- }
- }
- return false;
- }
-
- boolean isCrashItem(ItemStack item)
- {
- if (item != null)
- {
- net.minecraft.server.v1_15_R1.ItemStack nmsItemStack = CraftItemStack.asNMSCopy(item);
-
- if (nmsItemStack.getTag() != null)
- {
- NBTTagCompound itemtag = nmsItemStack.getTag();
-
- if (itemtag.toString().contains("translation.test.invalid"))
- {
- fired_countermeasure("isCrashItem");
- return true;
- }
- }
- }
- return false;
- }
-
- boolean containsCrashItem(ItemStack item)
- {
- if (item != null)
- {
- net.minecraft.server.v1_15_R1.ItemStack nmsItemStack = CraftItemStack.asNMSCopy(item);
-
- if (nmsItemStack.getTag() != null)
- {
- NBTTagCompound blockentitytag = nmsItemStack.getTag().getCompound("BlockEntityTag");
- NBTTagList itemlist = blockentitytag.getList("Items", 10);
-
- for (int a = 0; a <= itemlist.size(); a++)
- {
- NBTTagCompound itemtag = itemlist.getCompound(a).getCompound("tag");
-
- if (itemtag.toString().contains("translation.test.invalid"))
- {
- fired_countermeasure("containsCrashItem");
- return true;
- }
- }
- }
- }
- return false;
- }
-
- boolean isDeathItem(ItemStack item)
- {
- net.minecraft.server.v1_15_R1.ItemStack nmsItemStack = CraftItemStack.asNMSCopy(item);
-
- if (nmsItemStack != null && nmsItemStack.hasTag())
- {
- return isDeathItem(nmsItemStack.getTag());
- }
- return false;
- }
-
- private boolean isDeathItem(NBTTagCompound item)
- {
- if (item != null)
- {
- NBTTagList attrlist = item.getList("AttributeModifiers", 10);
-
- if (attrlist != null)
- {
- for (int i = 0; i < attrlist.size(); i++)
- {
- NBTTagCompound compound = (NBTTagCompound) attrlist.get(i);
- if ((compound.getString("Name").equalsIgnoreCase("MAX_HEALTH") || compound.getString("AttributeName").equalsIgnoreCase("generic.maxhealth")) && compound.getDouble("Amount") <= 0)
- {
- fired_countermeasure("isDeathItem");
- return true;
- }
- }
- }
- }
- return false;
- }
-
- boolean containsDeathItem(ItemStack item)
- {
- if (item != null)
- {
- net.minecraft.server.v1_15_R1.ItemStack nmsItemStack = CraftItemStack.asNMSCopy(item);
-
- if (nmsItemStack.getTag() != null)
- {
- NBTTagCompound blockentitytag = nmsItemStack.getTag().getCompound("BlockEntityTag");
- NBTTagList itemlist = blockentitytag.getList("Items", 10);
-
- for (int a = 0; a <= itemlist.size(); a++)
- {
- NBTTagList attrlist = itemlist.getCompound(a).getCompound("tag").getList("AttributeModifiers", 10);
-
- for (int b = 0; b <= attrlist.size(); b++)
- {
- String attribute_name = attrlist.getCompound(b).getString("AttributeName");
- String name = attrlist.getCompound(b).getString("Name");
- Double amount = attrlist.getCompound(b).getDouble("Amount");
-
- if ((name.equalsIgnoreCase("MAX_HEALTH") || attribute_name.equalsIgnoreCase("generic.maxhealth")) && amount <= 0)
- {
- fired_countermeasure("containsDeathItem");
- return true;
- }
- }
- }
- }
- }
- return false;
- }
-
- boolean isDisconnectItem(ItemStack item)
- {
- net.minecraft.server.v1_15_R1.ItemStack nmsItemStack = CraftItemStack.asNMSCopy(item);
-
- if (nmsItemStack != null && nmsItemStack.hasTag())
- {
- return isDisconnectItem(nmsItemStack.getTag());
- }
- return false;
- }
-
- boolean isDisconnectItem(Entity entity)
- {
- if (entity instanceof CraftItem)
- {
- return isDisconnectItem((CraftItem) entity);
- }
- return false;
- }
-
- private boolean isDisconnectItem(NBTTagCompound item)
- {
- if (item != null)
- {
- if (item.hasKey("CustomPotionColor") && item.getInt("CustomPotionColor") < 0)
- {
- fired_countermeasure("isCustomPotionColorDisconnectItem");
- return true;
- }
-
-
- else if ((item.getCompound("display").hasKey("color") && item.getCompound("display").getInt("color") < 0))
- {
- fired_countermeasure("isDisplayColorDisconnectItem");
- return true;
- }
-
- else if (item.getCompound("BlockEntityTag").hasKey("Patterns"))
- {
- NBTTagList patterns = item.getCompound("BlockEntityTag").getList("Patterns", 10);
- for (int x = 0; x <= (patterns.size() - 1); x++)
- {
- if (patterns.get(x).getTypeId() == 10)
- {
- if (patterns.getCompound(x).hasKey("Color") && patterns.getCompound(x).getInt("Color") < 0)
- {
- return true;
- }
- }
- }
-
- for (NBTBase base : item.getCompound("BlockEntityTag").getList("Patterns", 10))
- {
- if (base.asString().contains("Color:-1"))
- {
- fired_countermeasure("isDisplayBannedColorDisconnectItem");
- return true;
- }
- }
- }
-
- else if (item.toString().length() > 262140 || isMovementDisconnectItem(item) || isInvalidAttributeName(item))
- {
- fired_countermeasure("isLargeNBTDisconnectItem");
- return true;
- }
- }
- return false;
- }
-
- boolean containsDisconnectItem(ItemStack item)
- {
- if (item != null)
- {
- net.minecraft.server.v1_15_R1.ItemStack nmsItemStack = CraftItemStack.asNMSCopy(item);
-
- if (nmsItemStack != null && nmsItemStack.getTag() != null)
- {
- NBTTagList items = nmsItemStack.getTag().getCompound("BlockEntityTag").getList("Items", 10);
-
- if (items != null)
- {
- for (int x = 0; x <= (items.size() - 1); x++)
- {
- NBTTagCompound nmsitem = items.getCompound(x);
- return isDisconnectItem(nmsitem.getCompound("tag"));
- }
- }
- }
- }
- return false;
- }
-
- private boolean isMovementDisconnectItem(NBTTagCompound tag)
- {
- if (tag != null)
- {
- NBTTagList attrlist = tag.getList("AttributeModifiers", 10);
- if (attrlist != null)
- {
- HashMap attributes = new HashMap<>();
-
- for (int a = 0; a <= attrlist.size(); a++)
- {
- NBTTagCompound attribute = attrlist.getCompound(a);
-
- if (attribute.getString("AttributeName").equalsIgnoreCase("generic.movementspeed") && attributes.containsKey(attribute.getString("AttributeName").toLowerCase()) && !Float.isFinite(attribute.getFloat("Amount")))
- {
- fired_countermeasure("isMovementDisconnectItem");
- return true;
- }
-
- attributes.put(attribute.getString("AttributeName").toLowerCase(), attribute.getFloat("Amount"));
- }
- }
- }
- return false;
- }
-
- private boolean isInvalidAttributeName(NBTTagCompound tag)
- {
- if (tag != null)
- {
- NBTTagList attrlist = tag.getList("AttributeModifiers", 10);
-
- if (attrlist != null)
- {
- for (int a = 0; a <= attrlist.size(); a++)
- {
- NBTTagCompound attribute = attrlist.getCompound(a);
-
- if (attribute != null && attribute.getString("AttributeName").toLowerCase() != "")
- {
- if (!Variables.LeagacyAttributes.liststr.contains(attribute.getString("AttributeName").toLowerCase()))
- {
- fired_countermeasure("isInvalidAttributeNameDisconnectItem");
- return true;
- }
- }
- }
- }
- }
- return false;
- }
-
- void removeInvalidValues(Entity entity)
- {
- NBTTagCompound tag = getEntityNBT(entity);
- if (tag.asString().contains("Color:-"))
- {
- try
- {
- setEntityNBT(entity, MojangsonParser.parse(tag.asString().replaceAll("Color:-", "")));
- }
- catch (CommandSyntaxException e)
- {
- e.printStackTrace();
- }
- }
- }
-
- boolean isDangerousEgg(ItemStack item)
- {
- if (item != null && item.getItemMeta() instanceof SpawnEggMeta)
- {
- net.minecraft.server.v1_15_R1.ItemStack nmsItemStack = CraftItemStack.asNMSCopy(item);
- return nmsItemStack.hasTag() && VulnerabilityPatcher.main.getConfig().getStringList("BlockedEntityTags").contains(nmsItemStack.getTag().getCompound("EntityTag").getString("id").replaceAll("minecraft:", ""));
- }
- return false;
- }
-
- boolean isDangerousSkull(ItemStack item)
- {
- if (item != null && item.hasItemMeta())
- {
- NBTTagCompound tag = CraftItemStack.asNMSCopy(item).getTag();
-
- if (tag != null && tag.hasKey("SkullOwner") && tag.getString("SkullOwner").trim().equals(""))
- {
- return true;
- }
- }
- return false;
- }
-}
diff --git a/src/main/java/me/cooljwb/vulnerabilitypatcher/modifiers/NBTModifier_1_16.java b/src/main/java/me/cooljwb/vulnerabilitypatcher/modifiers/NBTModifier_1_16.java
deleted file mode 100644
index ba560ca..0000000
--- a/src/main/java/me/cooljwb/vulnerabilitypatcher/modifiers/NBTModifier_1_16.java
+++ /dev/null
@@ -1,506 +0,0 @@
-package me.cooljwb.vulnerabilitypatcher.modifiers;
-
-import com.mojang.brigadier.exceptions.CommandSyntaxException;
-import me.cooljwb.vulnerabilitypatcher.Variables;
-import me.cooljwb.vulnerabilitypatcher.VulnerabilityPatcher;
-import me.cooljwb.vulnerabilitypatcher.patches.Patches;
-import net.minecraft.server.v1_16_R1.MojangsonParser;
-import net.minecraft.server.v1_16_R1.NBTBase;
-import net.minecraft.server.v1_16_R1.NBTTagCompound;
-import net.minecraft.server.v1_16_R1.NBTTagList;
-import org.bukkit.Bukkit;
-import org.bukkit.Material;
-import org.bukkit.craftbukkit.v1_16_R1.entity.CraftEntity;
-import org.bukkit.craftbukkit.v1_16_R1.entity.CraftItem;
-import org.bukkit.craftbukkit.v1_16_R1.entity.CraftPlayer;
-import org.bukkit.craftbukkit.v1_16_R1.inventory.CraftItemStack;
-import org.bukkit.entity.Arrow;
-import org.bukkit.entity.Entity;
-import org.bukkit.entity.Firework;
-import org.bukkit.entity.Player;
-import org.bukkit.inventory.ItemStack;
-import org.bukkit.inventory.meta.BookMeta;
-import org.bukkit.inventory.meta.SpawnEggMeta;
-import org.bukkit.projectiles.ProjectileSource;
-
-import java.io.File;
-import java.util.HashMap;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-import java.util.regex.Pattern;
-
-/**
- * This class is a function port to 1.15
- * Date: 2020-06-13
- *
- * @author CoolJWB
- */
-
-public class NBTModifier_1_16
-{
-
- private Logger log = Logger.getLogger("Minecraft");
-
- /* Misc */
- public void log(Level level, String message)
- {
- log.log(level, String.format("[%s] %s", VulnerabilityPatcher.pluginName, message));
- }
-
- private void fired_countermeasure(String reason)
- {
- if (Patches.devmode)
- {
- log(Level.INFO, String.format("Fired countermeasure in %s reason: %s", getClass().getName(), reason));
- }
- }
-
- private NBTTagCompound getItemNBT(ItemStack item)
- {
- if (item != null)
- {
- net.minecraft.server.v1_16_R1.ItemStack nmsItemStack = CraftItemStack.asNMSCopy(item);
- if (nmsItemStack != null)
- {
- return nmsItemStack.getTag();
- }
- }
- return null;
- }
-
- private NBTTagCompound getEntityNBT(Entity entity)
- {
- net.minecraft.server.v1_16_R1.Entity nmsEntity = ((CraftEntity) entity).getHandle();
- NBTTagCompound tag = new NBTTagCompound();
- nmsEntity.save(tag);
- return tag;
- }
-
- private void setEntityNBT(Entity entity, NBTTagCompound nbtTagCompound)
- {
- net.minecraft.server.v1_16_R1.Entity nmsEntity = ((CraftEntity) entity).getHandle();
- nmsEntity.save(nbtTagCompound);
- }
-
- public NBTTagList getAttributeList(ItemStack item)
- {
- NBTTagCompound itemtag = getItemNBT(item);
-
- if (item != null && itemtag != null && itemtag.hasKey("AttributeModifiers"))
- {
- return getItemNBT(item).getList("AttributeModifiers", 10);
- }
- return null;
- }
-
- String itemToString(ItemStack item)
- {
- if (item != null)
- {
- net.minecraft.server.v1_16_R1.ItemStack nmsItemStack = CraftItemStack.asNMSCopy(item);
-
- if (nmsItemStack.hasTag())
- {
- return nmsItemStack.getTag().toString();
- }
- }
- return "";
- }
-
- boolean removePlayerdata(String player)
- {
- if (Bukkit.getPlayer(player) != null)
- {
- ((CraftEntity) Bukkit.getPlayer(player)).getHandle().save(new net.minecraft.server.v1_16_R1.NBTTagCompound());
- return true;
- }
- else if (Bukkit.getOfflinePlayer(player) != null)
- {
- File file = new File(Bukkit.getServer().getWorldContainer() + "/world/playerdata/" + Bukkit.getOfflinePlayer(player).getUniqueId().toString() + ".dat");
- return file.delete();
- }
- return false;
- }
-
- void resetMeta(Player player, ItemStack item, boolean mainhand)
- {
- net.minecraft.server.v1_16_R1.ItemStack nmsItemStack = CraftItemStack.asNMSCopy(item);
-
- if (nmsItemStack.hasTag() && nmsItemStack.getTag().hasKey("pages"))
- {
- String pages = nmsItemStack.getTag().getList("pages", 8).toString();
- if (pages.contains("clickEvent") || pages.contains("hoverEvent"))
- {
- BookMeta meta = (BookMeta) item.getItemMeta();
- ItemStack book = new ItemStack(Material.WRITTEN_BOOK);
-
- meta.setPages(meta.getPages());
- book.setItemMeta(meta);
-
- if (mainhand)
- {
- player.getInventory().setItemInMainHand(book);
- }
- else
- {
- player.getInventory().setItemInOffHand(book);
- }
- }
- }
- }
-
- boolean isPlayer(ProjectileSource source)
- {
- return source instanceof CraftPlayer;
- }
-
- double getArrowDamage(Arrow arrow)
- {
- return getEntityNBT(arrow).hasKey("damage") ? getEntityNBT(arrow).getDouble("damage") : 0;
- }
-
- void setArrowDamage(Arrow arrow, double amount)
- {
- NBTTagCompound tag = getEntityNBT(arrow);
- if (tag.hasKey("damage"))
- {
- tag.setDouble("damage", amount);
- setEntityNBT(arrow, tag);
- }
- }
-
- int getFireworkEffectSize(Firework firework)
- {
- NBTTagCompound tag = getEntityNBT(firework);
- if (tag.hasKey("FireworksItem") && tag.getCompound("FireworksItem").hasKey("tag") && tag.getCompound("FireworksItem").getCompound("tag").hasKey("Fireworks") && tag.getCompound("FireworksItem").getCompound("tag").getCompound("Fireworks").hasKey("Explosions"))
- {
- return tag.getCompound("FireworksItem").getCompound("tag").getCompound("Fireworks").getList("Explosions", 10).size();
- }
- return 0;
- }
-
- boolean hasFireworkLargeEffect(Firework firework)
- {
- NBTTagCompound tag = getEntityNBT(firework);
- if (tag.hasKey("FireworksItem") && tag.getCompound("FireworksItem").hasKey("tag") && tag.getCompound("FireworksItem").getCompound("tag").hasKey("Fireworks") && tag.getCompound("FireworksItem").getCompound("tag").getCompound("Fireworks").hasKey("Explosions"))
- {
- NBTTagList explosions = tag.getCompound("FireworksItem").getCompound("tag").getCompound("Fireworks").getList("Explosions", 10);
- for (int x = 0; x <= (explosions.size() - 1); x++)
- {
- if (explosions.getCompound(x).getInt("Type") == 1 || explosions.getCompound(x).getInt("Type") == 3)
- {
- return true;
- }
- }
- }
- return false;
- }
-
- boolean isCrashItem(ItemStack item)
- {
- if (item != null)
- {
- net.minecraft.server.v1_16_R1.ItemStack nmsItemStack = CraftItemStack.asNMSCopy(item);
-
- if (nmsItemStack.getTag() != null)
- {
- NBTTagCompound itemtag = nmsItemStack.getTag();
-
- if (itemtag.toString().contains("translation.test.invalid"))
- {
- fired_countermeasure("isCrashItem");
- return true;
- }
- }
- }
- return false;
- }
-
- boolean containsCrashItem(ItemStack item)
- {
- if (item != null)
- {
- net.minecraft.server.v1_16_R1.ItemStack nmsItemStack = CraftItemStack.asNMSCopy(item);
-
- if (nmsItemStack.getTag() != null)
- {
- Pattern pattern = Pattern.compile("([a-z0-9/._-])");
- NBTTagCompound blockEntityTag = nmsItemStack.getTag().getCompound("BlockEntityTag");
- NBTTagList itemlist = blockEntityTag.getList("Items", 10);
-
- for (int a = 0; a <= itemlist.size(); a++)
- {
- NBTTagCompound itemtag = itemlist.getCompound(a).getCompound("tag");
-
- if (itemtag.toString().contains("translation.test.invalid")
- || (blockEntityTag.hasKey("LootTable") && !pattern.matcher(blockEntityTag.getString("LootTable")).find()))
- {
- fired_countermeasure("containsCrashItem");
- return true;
- }
- }
- }
- }
- return false;
- }
-
- boolean isDeathItem(ItemStack item)
- {
- net.minecraft.server.v1_16_R1.ItemStack nmsItemStack = CraftItemStack.asNMSCopy(item);
-
- if (nmsItemStack != null && nmsItemStack.hasTag())
- {
- return isDeathItem(nmsItemStack.getTag());
- }
- return false;
- }
-
- private boolean isDeathItem(NBTTagCompound item)
- {
- if (item != null)
- {
- NBTTagList attrlist = item.getList("AttributeModifiers", 10);
-
- if (attrlist != null)
- {
- for (int i = 0; i < attrlist.size(); i++)
- {
- NBTTagCompound compound = (NBTTagCompound) attrlist.get(i);
- if ((compound.getString("Name").equalsIgnoreCase("MAX_HEALTH") || compound.getString("AttributeName").equalsIgnoreCase("generic.max_health")) && compound.getDouble("Amount") <= 0)
- {
- fired_countermeasure("isDeathItem");
- return true;
- }
- }
- }
- }
- return false;
- }
-
- boolean containsDeathItem(ItemStack item)
- {
- if (item != null)
- {
- net.minecraft.server.v1_16_R1.ItemStack nmsItemStack = CraftItemStack.asNMSCopy(item);
-
- if (nmsItemStack.getTag() != null)
- {
- NBTTagCompound blockentitytag = nmsItemStack.getTag().getCompound("BlockEntityTag");
- NBTTagList itemlist = blockentitytag.getList("Items", 10);
-
- for (int a = 0; a <= itemlist.size(); a++)
- {
- NBTTagList attrlist = itemlist.getCompound(a).getCompound("tag").getList("AttributeModifiers", 10);
-
- for (int b = 0; b <= attrlist.size(); b++)
- {
- String attribute_name = attrlist.getCompound(b).getString("AttributeName");
- String name = attrlist.getCompound(b).getString("Name");
- Double amount = attrlist.getCompound(b).getDouble("Amount");
-
- if ((name.equalsIgnoreCase("MAX_HEALTH") || attribute_name.equalsIgnoreCase("generic.max_health")) && amount <= 0)
- {
- fired_countermeasure("containsDeathItem");
- return true;
- }
- }
- }
- }
- }
- return false;
- }
-
- boolean isDisconnectItem(ItemStack item)
- {
- net.minecraft.server.v1_16_R1.ItemStack nmsItemStack = CraftItemStack.asNMSCopy(item);
-
- if (nmsItemStack != null && nmsItemStack.hasTag())
- {
- return isDisconnectItem(nmsItemStack.getTag());
- }
- return false;
- }
-
- boolean isDisconnectItem(Entity entity)
- {
- if (entity instanceof CraftItem)
- {
- return isDisconnectItem((CraftItem) entity);
- }
- return false;
- }
-
- private boolean isDisconnectItem(NBTTagCompound item)
- {
- if (item != null)
- {
- if (item.hasKey("CustomPotionColor") && item.getInt("CustomPotionColor") < 0)
- {
- fired_countermeasure("isCustomPotionColorDisconnectItem");
- return true;
- }
-
-
- else if ((item.getCompound("display").hasKey("color") && item.getCompound("display").getInt("color") < 0))
- {
- fired_countermeasure("isDisplayColorDisconnectItem");
- return true;
- }
-
- else if (item.getCompound("BlockEntityTag").hasKey("Patterns"))
- {
- NBTTagList patterns = item.getCompound("BlockEntityTag").getList("Patterns", 10);
- for (int x = 0; x <= (patterns.size() - 1); x++)
- {
- if (patterns.get(x).getTypeId() == 10)
- {
- if (patterns.getCompound(x).hasKey("Color") && patterns.getCompound(x).getInt("Color") < 0)
- {
- return true;
- }
- }
- }
-
- for (NBTBase base : item.getCompound("BlockEntityTag").getList("Patterns", 10))
- {
- if (base.asString().contains("Color:-1"))
- {
- fired_countermeasure("isDisplayBannedColorDisconnectItem");
- return true;
- }
- }
- }
-
- else if (item.toString().length() > 262140)
- {
- fired_countermeasure("isLargeNBTDisconnectItem");
- return true;
- }
-
- else if (isMovementDisconnectItem(item) /*|| isInvalidAttributeName(item)*/)
- {
- return true;
- }
- }
- return false;
- }
-
- boolean containsDisconnectItem(ItemStack item)
- {
- if (item != null)
- {
- net.minecraft.server.v1_16_R1.ItemStack nmsItemStack = CraftItemStack.asNMSCopy(item);
-
- if (nmsItemStack != null && nmsItemStack.getTag() != null)
- {
- NBTTagList items = nmsItemStack.getTag().getCompound("BlockEntityTag").getList("Items", 10);
-
- if (items != null)
- {
- for (int x = 0; x <= (items.size() - 1); x++)
- {
- NBTTagCompound nmsitem = items.getCompound(x);
- return isDisconnectItem(nmsitem.getCompound("tag"));
- }
- }
- }
- }
- return false;
- }
-
- private boolean isMovementDisconnectItem(NBTTagCompound tag)
- {
- if (tag != null)
- {
- NBTTagList attrlist = tag.getList("AttributeModifiers", 10);
- if (attrlist != null)
- {
- HashMap attributes = new HashMap<>();
-
- for (int a = 0; a <= attrlist.size(); a++)
- {
- NBTTagCompound attribute = attrlist.getCompound(a);
-
- if (attribute.getString("AttributeName").equalsIgnoreCase("generic.movement_speed") && attributes.containsKey(attribute.getString("AttributeName").toLowerCase()) && !Float.isFinite(attribute.getFloat("Amount")))
- {
- fired_countermeasure("isMovementDisconnectItem");
- return true;
- }
-
- attributes.put(attribute.getString("AttributeName").toLowerCase(), attribute.getFloat("Amount"));
- }
- }
- }
- return false;
- }
-
- /**
- * Does not have any use as this is patched in newer versions and only causes issues.
- */
- @Deprecated
- private boolean isInvalidAttributeName(NBTTagCompound tag)
- {
- if (tag != null)
- {
- NBTTagList attrlist = tag.getList("AttributeModifiers", 10);
-
- if (attrlist != null)
- {
- for (int a = 0; a <= attrlist.size(); a++)
- {
- NBTTagCompound attribute = attrlist.getCompound(a);
-
- if (attribute != null && attribute.getString("AttributeName").toLowerCase() != "")
- {
- if (!Variables.Attributes.liststr.contains(attribute.getString("AttributeName").toLowerCase()))
- {
- fired_countermeasure("isInvalidAttributeNameDisconnectItem");
- return true;
- }
- }
- }
- }
- }
- return false;
- }
-
- void removeInvalidValues(Entity entity)
- {
- NBTTagCompound tag = getEntityNBT(entity);
- if (tag.asString().contains("Color:-"))
- {
- try
- {
- setEntityNBT(entity, MojangsonParser.parse(tag.asString().replaceAll("Color:-", "")));
- }
- catch (CommandSyntaxException e)
- {
- e.printStackTrace();
- }
- }
- }
-
- boolean isDangerousEgg(ItemStack item)
- {
- if (item != null && item.getItemMeta() instanceof SpawnEggMeta)
- {
- net.minecraft.server.v1_16_R1.ItemStack nmsItemStack = CraftItemStack.asNMSCopy(item);
- return nmsItemStack.hasTag() && VulnerabilityPatcher.main.getConfig().getStringList("BlockedEntityTags").contains(nmsItemStack.getTag().getCompound("EntityTag").getString("id").replaceAll("minecraft:", ""));
- }
- return false;
- }
-
- boolean isDangerousSkull(ItemStack item)
- {
- if (item != null && item.hasItemMeta())
- {
- NBTTagCompound tag = CraftItemStack.asNMSCopy(item).getTag();
-
- if (tag != null && tag.hasKey("SkullOwner") && tag.getString("SkullOwner").trim().equals(""))
- {
- return true;
- }
- }
- return false;
- }
-}
diff --git a/src/main/java/me/cooljwb/vulnerabilitypatcher/modifiers/NBTModifier_1_16_2.java b/src/main/java/me/cooljwb/vulnerabilitypatcher/modifiers/NBTModifier_1_16_2.java
deleted file mode 100644
index a800573..0000000
--- a/src/main/java/me/cooljwb/vulnerabilitypatcher/modifiers/NBTModifier_1_16_2.java
+++ /dev/null
@@ -1,526 +0,0 @@
-package me.cooljwb.vulnerabilitypatcher.modifiers;
-
-import com.mojang.brigadier.exceptions.CommandSyntaxException;
-import me.cooljwb.vulnerabilitypatcher.Variables;
-import me.cooljwb.vulnerabilitypatcher.VulnerabilityPatcher;
-import me.cooljwb.vulnerabilitypatcher.patches.Patches;
-import net.minecraft.server.v1_16_R2.MojangsonParser;
-import net.minecraft.server.v1_16_R2.NBTBase;
-import net.minecraft.server.v1_16_R2.NBTTagCompound;
-import net.minecraft.server.v1_16_R2.NBTTagList;
-import org.bukkit.Bukkit;
-import org.bukkit.Material;
-import org.bukkit.World;
-import org.bukkit.craftbukkit.v1_16_R2.entity.CraftEntity;
-import org.bukkit.craftbukkit.v1_16_R2.entity.CraftItem;
-import org.bukkit.craftbukkit.v1_16_R2.entity.CraftPlayer;
-import org.bukkit.craftbukkit.v1_16_R2.inventory.CraftItemStack;
-import org.bukkit.entity.Arrow;
-import org.bukkit.entity.Entity;
-import org.bukkit.entity.Firework;
-import org.bukkit.entity.Player;
-import org.bukkit.inventory.ItemStack;
-import org.bukkit.inventory.meta.BookMeta;
-import org.bukkit.inventory.meta.SpawnEggMeta;
-import org.bukkit.projectiles.ProjectileSource;
-
-import java.io.File;
-import java.util.HashMap;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-import java.util.regex.Pattern;
-
-/*
- * Copyright 2019 CoolJWB
- *
- * 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
- *
- * http://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.
- */
-
-/**
- * This class is a function port to 1.15
- * Date: 2020-06-13
- *
- * @author CoolJWB
- */
-
-public class NBTModifier_1_16_2
-{
-
- private Logger log = Logger.getLogger("Minecraft");
-
- /* Misc */
- public void log(Level level, String message)
- {
- log.log(level, String.format("[%s] %s", VulnerabilityPatcher.pluginName, message));
- }
-
- private void fired_countermeasure(String reason)
- {
- if (Patches.devmode)
- {
- log(Level.INFO, String.format("Fired countermeasure in %s reason: %s", getClass().getName(), reason));
- }
- }
-
- private NBTTagCompound getItemNBT(ItemStack item)
- {
- if (item != null)
- {
- net.minecraft.server.v1_16_R2.ItemStack nmsItemStack = CraftItemStack.asNMSCopy(item);
- if (nmsItemStack != null)
- {
- return nmsItemStack.getTag();
- }
- }
- return null;
- }
-
- private NBTTagCompound getEntityNBT(Entity entity)
- {
- net.minecraft.server.v1_16_R2.Entity nmsEntity = ((CraftEntity) entity).getHandle();
- NBTTagCompound tag = new NBTTagCompound();
- nmsEntity.save(tag);
- return tag;
- }
-
- private void setEntityNBT(Entity entity, NBTTagCompound nbtTagCompound)
- {
- net.minecraft.server.v1_16_R2.Entity nmsEntity = ((CraftEntity) entity).getHandle();
- nmsEntity.save(nbtTagCompound);
- }
-
- public NBTTagList getAttributeList(ItemStack item)
- {
- NBTTagCompound itemtag = getItemNBT(item);
-
- if (item != null && itemtag != null && itemtag.hasKey("AttributeModifiers"))
- {
- return getItemNBT(item).getList("AttributeModifiers", 10);
- }
- return null;
- }
-
- String itemToString(ItemStack item)
- {
- if (item != null)
- {
- net.minecraft.server.v1_16_R2.ItemStack nmsItemStack = CraftItemStack.asNMSCopy(item);
-
- if (nmsItemStack.hasTag())
- {
- return nmsItemStack.getTag().toString();
- }
- }
- return "";
- }
-
- boolean removePlayerdata(String player)
- {
- boolean success = false;
- for (World world : Bukkit.getWorlds())
- {
- File localUUIDfile = new File(Bukkit.getServer().getWorldContainer() + "/" + world.getName() + "/playerdata/" + Bukkit.getOfflinePlayer(player).getUniqueId().toString() + ".dat");
-
- if (localUUIDfile.exists())
- {
- if (localUUIDfile.delete())
- {
- success = true;
- }
- }
- }
- return success;
- }
-
- void resetMeta(Player player, ItemStack item, boolean mainhand)
- {
- net.minecraft.server.v1_16_R2.ItemStack nmsItemStack = CraftItemStack.asNMSCopy(item);
-
- if (nmsItemStack.hasTag() && nmsItemStack.getTag().hasKey("pages"))
- {
- String pages = nmsItemStack.getTag().getList("pages", 8).toString();
- if (pages.contains("clickEvent") || pages.contains("hoverEvent"))
- {
- BookMeta meta = (BookMeta) item.getItemMeta();
- ItemStack book = new ItemStack(Material.WRITTEN_BOOK);
-
- meta.setPages(meta.getPages());
- book.setItemMeta(meta);
-
- if (mainhand)
- {
- player.getInventory().setItemInMainHand(book);
- }
- else
- {
- player.getInventory().setItemInOffHand(book);
- }
- }
- }
- }
-
- boolean isPlayer(ProjectileSource source)
- {
- return source instanceof CraftPlayer;
- }
-
- double getArrowDamage(Arrow arrow)
- {
- return getEntityNBT(arrow).hasKey("damage") ? getEntityNBT(arrow).getDouble("damage") : 0;
- }
-
- void setArrowDamage(Arrow arrow, double amount)
- {
- NBTTagCompound tag = getEntityNBT(arrow);
- if (tag.hasKey("damage"))
- {
- tag.setDouble("damage", amount);
- setEntityNBT(arrow, tag);
- }
- }
-
- int getFireworkEffectSize(Firework firework)
- {
- NBTTagCompound tag = getEntityNBT(firework);
- if (tag.hasKey("FireworksItem") && tag.getCompound("FireworksItem").hasKey("tag") && tag.getCompound("FireworksItem").getCompound("tag").hasKey("Fireworks") && tag.getCompound("FireworksItem").getCompound("tag").getCompound("Fireworks").hasKey("Explosions"))
- {
- return tag.getCompound("FireworksItem").getCompound("tag").getCompound("Fireworks").getList("Explosions", 10).size();
- }
- return 0;
- }
-
- boolean hasFireworkLargeEffect(Firework firework)
- {
- NBTTagCompound tag = getEntityNBT(firework);
- if (tag.hasKey("FireworksItem") && tag.getCompound("FireworksItem").hasKey("tag") && tag.getCompound("FireworksItem").getCompound("tag").hasKey("Fireworks") && tag.getCompound("FireworksItem").getCompound("tag").getCompound("Fireworks").hasKey("Explosions"))
- {
- NBTTagList explosions = tag.getCompound("FireworksItem").getCompound("tag").getCompound("Fireworks").getList("Explosions", 10);
- for (int x = 0; x <= (explosions.size() - 1); x++)
- {
- if (explosions.getCompound(x).getInt("Type") == 1 || explosions.getCompound(x).getInt("Type") == 3)
- {
- return true;
- }
- }
- }
- return false;
- }
-
- boolean isCrashItem(ItemStack item)
- {
- if (item != null)
- {
- net.minecraft.server.v1_16_R2.ItemStack nmsItemStack = CraftItemStack.asNMSCopy(item);
-
- if (nmsItemStack.getTag() != null)
- {
- NBTTagCompound itemtag = nmsItemStack.getTag();
-
- if (itemtag.toString().contains("translation.test.invalid"))
- {
- fired_countermeasure("isCrashItem");
- return true;
- }
- }
- }
- return false;
- }
-
- boolean containsCrashItem(ItemStack item)
- {
- if (item != null)
- {
- net.minecraft.server.v1_16_R2.ItemStack nmsItemStack = CraftItemStack.asNMSCopy(item);
-
- if (nmsItemStack.getTag() != null)
- {
- Pattern pattern = Pattern.compile("([a-z0-9/._-])");
- NBTTagCompound blockEntityTag = nmsItemStack.getTag().getCompound("BlockEntityTag");
- NBTTagList itemlist = blockEntityTag.getList("Items", 10);
-
- for (int a = 0; a <= itemlist.size(); a++)
- {
- NBTTagCompound itemtag = itemlist.getCompound(a).getCompound("tag");
-
- if (itemtag.toString().contains("translation.test.invalid")
- || (blockEntityTag.hasKey("LootTable") && !pattern.matcher(blockEntityTag.getString("LootTable")).find()))
- {
- fired_countermeasure("containsCrashItem");
- return true;
- }
- }
- }
- }
- return false;
- }
-
- boolean isDeathItem(ItemStack item)
- {
- net.minecraft.server.v1_16_R2.ItemStack nmsItemStack = CraftItemStack.asNMSCopy(item);
-
- if (nmsItemStack != null && nmsItemStack.hasTag())
- {
- return isDeathItem(nmsItemStack.getTag());
- }
- return false;
- }
-
- private boolean isDeathItem(NBTTagCompound item)
- {
- if (item != null)
- {
- NBTTagList attrlist = item.getList("AttributeModifiers", 10);
-
- if (attrlist != null)
- {
- for (int i = 0; i < attrlist.size(); i++)
- {
- NBTTagCompound compound = (NBTTagCompound) attrlist.get(i);
- if ((compound.getString("Name").equalsIgnoreCase("MAX_HEALTH") || compound.getString("AttributeName").equalsIgnoreCase("generic.max_health")) && compound.getDouble("Amount") <= 0)
- {
- fired_countermeasure("isDeathItem");
- return true;
- }
- }
- }
- }
- return false;
- }
-
- boolean containsDeathItem(ItemStack item)
- {
- if (item != null)
- {
- net.minecraft.server.v1_16_R2.ItemStack nmsItemStack = CraftItemStack.asNMSCopy(item);
-
- if (nmsItemStack.getTag() != null)
- {
- NBTTagCompound blockentitytag = nmsItemStack.getTag().getCompound("BlockEntityTag");
- NBTTagList itemlist = blockentitytag.getList("Items", 10);
-
- for (int a = 0; a <= itemlist.size(); a++)
- {
- NBTTagList attrlist = itemlist.getCompound(a).getCompound("tag").getList("AttributeModifiers", 10);
-
- for (int b = 0; b <= attrlist.size(); b++)
- {
- String attribute_name = attrlist.getCompound(b).getString("AttributeName");
- String name = attrlist.getCompound(b).getString("Name");
- Double amount = attrlist.getCompound(b).getDouble("Amount");
-
- if ((name.equalsIgnoreCase("MAX_HEALTH") || attribute_name.equalsIgnoreCase("generic.max_health")) && amount <= 0)
- {
- fired_countermeasure("containsDeathItem");
- return true;
- }
- }
- }
- }
- }
- return false;
- }
-
- boolean isDisconnectItem(ItemStack item)
- {
- net.minecraft.server.v1_16_R2.ItemStack nmsItemStack = CraftItemStack.asNMSCopy(item);
-
- if (nmsItemStack != null && nmsItemStack.hasTag())
- {
- return isDisconnectItem(nmsItemStack.getTag());
- }
- return false;
- }
-
- boolean isDisconnectItem(Entity entity)
- {
- if (entity instanceof CraftItem)
- {
- return isDisconnectItem((CraftItem) entity);
- }
- return false;
- }
-
- private boolean isDisconnectItem(NBTTagCompound item)
- {
- if (item != null)
- {
- if (item.hasKey("CustomPotionColor") && item.getInt("CustomPotionColor") < 0)
- {
- fired_countermeasure("isCustomPotionColorDisconnectItem");
- return true;
- }
-
-
- else if ((item.getCompound("display").hasKey("color") && item.getCompound("display").getInt("color") < 0))
- {
- fired_countermeasure("isDisplayColorDisconnectItem");
- return true;
- }
-
- else if (item.getCompound("BlockEntityTag").hasKey("Patterns"))
- {
- NBTTagList patterns = item.getCompound("BlockEntityTag").getList("Patterns", 10);
- for (int x = 0; x <= (patterns.size() - 1); x++)
- {
- if (patterns.get(x).getTypeId() == 10)
- {
- if (patterns.getCompound(x).hasKey("Color") && patterns.getCompound(x).getInt("Color") < 0)
- {
- return true;
- }
- }
- }
-
- for (NBTBase base : item.getCompound("BlockEntityTag").getList("Patterns", 10))
- {
- if (base.asString().contains("Color:-1"))
- {
- fired_countermeasure("isDisplayBannedColorDisconnectItem");
- return true;
- }
- }
- }
-
- else if (item.toString().length() > 262140)
- {
- fired_countermeasure("isLargeNBTDisconnectItem");
- return true;
- }
-
- else if (isMovementDisconnectItem(item) /*|| isInvalidAttributeName(item)*/)
- {
- return true;
- }
- }
- return false;
- }
-
- boolean containsDisconnectItem(ItemStack item)
- {
- if (item != null)
- {
- net.minecraft.server.v1_16_R2.ItemStack nmsItemStack = CraftItemStack.asNMSCopy(item);
-
- if (nmsItemStack != null && nmsItemStack.getTag() != null)
- {
- NBTTagList items = nmsItemStack.getTag().getCompound("BlockEntityTag").getList("Items", 10);
-
- if (items != null)
- {
- for (int x = 0; x <= (items.size() - 1); x++)
- {
- NBTTagCompound nmsitem = items.getCompound(x);
- return isDisconnectItem(nmsitem.getCompound("tag"));
- }
- }
- }
- }
- return false;
- }
-
- private boolean isMovementDisconnectItem(NBTTagCompound tag)
- {
- if (tag != null)
- {
- NBTTagList attrlist = tag.getList("AttributeModifiers", 10);
- if (attrlist != null)
- {
- HashMap attributes = new HashMap<>();
-
- for (int a = 0; a <= attrlist.size(); a++)
- {
- NBTTagCompound attribute = attrlist.getCompound(a);
-
- if (attribute.getString("AttributeName").equalsIgnoreCase("generic.movement_speed") && attributes.containsKey(attribute.getString("AttributeName").toLowerCase()) && !Float.isFinite(attribute.getFloat("Amount")))
- {
- fired_countermeasure("isMovementDisconnectItem");
- return true;
- }
-
- attributes.put(attribute.getString("AttributeName").toLowerCase(), attribute.getFloat("Amount"));
- }
- }
- }
- return false;
- }
-
- /**
- * Does not have any use as this is patched in newer versions and only causes issues.
- */
- @Deprecated
- private boolean isInvalidAttributeName(NBTTagCompound tag)
- {
- if (tag != null)
- {
- NBTTagList attrlist = tag.getList("AttributeModifiers", 10);
-
- if (attrlist != null)
- {
- for (int a = 0; a <= attrlist.size(); a++)
- {
- NBTTagCompound attribute = attrlist.getCompound(a);
-
- if (attribute != null && attribute.getString("AttributeName").toLowerCase() != "")
- {
- if (!Variables.Attributes.liststr.contains(attribute.getString("AttributeName").toLowerCase()))
- {
- fired_countermeasure("isInvalidAttributeNameDisconnectItem");
- return true;
- }
- }
- }
- }
- }
- return false;
- }
-
- void removeInvalidValues(Entity entity)
- {
- NBTTagCompound tag = getEntityNBT(entity);
- if (tag.asString().contains("Color:-"))
- {
- try
- {
- setEntityNBT(entity, MojangsonParser.parse(tag.asString().replaceAll("Color:-", "")));
- }
- catch (CommandSyntaxException e)
- {
- e.printStackTrace();
- }
- }
- }
-
- boolean isDangerousEgg(ItemStack item)
- {
- if (item != null && item.getItemMeta() instanceof SpawnEggMeta)
- {
- net.minecraft.server.v1_16_R2.ItemStack nmsItemStack = CraftItemStack.asNMSCopy(item);
- return nmsItemStack.hasTag() && VulnerabilityPatcher.main.getConfig().getStringList("BlockedEntityTags").contains(nmsItemStack.getTag().getCompound("EntityTag").getString("id").replaceAll("minecraft:", ""));
- }
- return false;
- }
-
- boolean isDangerousSkull(ItemStack item)
- {
- if (item != null && item.hasItemMeta())
- {
- NBTTagCompound tag = CraftItemStack.asNMSCopy(item).getTag();
-
- if (tag != null && tag.hasKey("SkullOwner") && tag.getString("SkullOwner").trim().equals(""))
- {
- return true;
- }
- }
- return false;
- }
-}
diff --git a/src/main/java/me/cooljwb/vulnerabilitypatcher/modifiers/NBTModifier_1_16_3.java b/src/main/java/me/cooljwb/vulnerabilitypatcher/modifiers/NBTModifier_1_17_1.java
similarity index 91%
rename from src/main/java/me/cooljwb/vulnerabilitypatcher/modifiers/NBTModifier_1_16_3.java
rename to src/main/java/me/cooljwb/vulnerabilitypatcher/modifiers/NBTModifier_1_17_1.java
index ff6a495..86716b8 100644
--- a/src/main/java/me/cooljwb/vulnerabilitypatcher/modifiers/NBTModifier_1_16_3.java
+++ b/src/main/java/me/cooljwb/vulnerabilitypatcher/modifiers/NBTModifier_1_17_1.java
@@ -4,17 +4,17 @@ import com.mojang.brigadier.exceptions.CommandSyntaxException;
import me.cooljwb.vulnerabilitypatcher.Variables;
import me.cooljwb.vulnerabilitypatcher.VulnerabilityPatcher;
import me.cooljwb.vulnerabilitypatcher.patches.Patches;
-import net.minecraft.server.v1_16_R3.MojangsonParser;
-import net.minecraft.server.v1_16_R3.NBTBase;
-import net.minecraft.server.v1_16_R3.NBTTagCompound;
-import net.minecraft.server.v1_16_R3.NBTTagList;
+import net.minecraft.nbt.MojangsonParser;
+import net.minecraft.nbt.NBTBase;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.nbt.NBTTagList;
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.World;
-import org.bukkit.craftbukkit.v1_16_R3.entity.CraftEntity;
-import org.bukkit.craftbukkit.v1_16_R3.entity.CraftItem;
-import org.bukkit.craftbukkit.v1_16_R3.entity.CraftPlayer;
-import org.bukkit.craftbukkit.v1_16_R3.inventory.CraftItemStack;
+import org.bukkit.craftbukkit.v1_17_R1.entity.CraftEntity;
+import org.bukkit.craftbukkit.v1_17_R1.entity.CraftItem;
+import org.bukkit.craftbukkit.v1_17_R1.entity.CraftPlayer;
+import org.bukkit.craftbukkit.v1_17_R1.inventory.CraftItemStack;
import org.bukkit.entity.Arrow;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Firework;
@@ -31,7 +31,7 @@ import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.regex.Pattern;
-public class NBTModifier_1_16_3
+public class NBTModifier_1_17_1
{
private Logger log = Logger.getLogger("Minecraft");
@@ -54,7 +54,7 @@ public class NBTModifier_1_16_3
{
if (item != null)
{
- net.minecraft.server.v1_16_R3.ItemStack nmsItemStack = CraftItemStack.asNMSCopy(item);
+ net.minecraft.world.item.ItemStack nmsItemStack = CraftItemStack.asNMSCopy(item);
if (nmsItemStack != null)
{
return nmsItemStack.getTag();
@@ -65,7 +65,7 @@ public class NBTModifier_1_16_3
private NBTTagCompound getEntityNBT(Entity entity)
{
- net.minecraft.server.v1_16_R3.Entity nmsEntity = ((CraftEntity) entity).getHandle();
+ net.minecraft.world.entity.Entity nmsEntity = ((CraftEntity) entity).getHandle();
NBTTagCompound tag = new NBTTagCompound();
nmsEntity.save(tag);
return tag;
@@ -73,7 +73,7 @@ public class NBTModifier_1_16_3
private void setEntityNBT(Entity entity, NBTTagCompound nbtTagCompound)
{
- net.minecraft.server.v1_16_R3.Entity nmsEntity = ((CraftEntity) entity).getHandle();
+ net.minecraft.world.entity.Entity nmsEntity = ((CraftEntity) entity).getHandle();
nmsEntity.save(nbtTagCompound);
}
@@ -92,7 +92,7 @@ public class NBTModifier_1_16_3
{
if (item != null)
{
- net.minecraft.server.v1_16_R3.ItemStack nmsItemStack = CraftItemStack.asNMSCopy(item);
+ net.minecraft.world.item.ItemStack nmsItemStack = CraftItemStack.asNMSCopy(item);
if (nmsItemStack.hasTag())
{
@@ -122,7 +122,7 @@ public class NBTModifier_1_16_3
void resetMeta(Player player, ItemStack item, boolean mainhand)
{
- net.minecraft.server.v1_16_R3.ItemStack nmsItemStack = CraftItemStack.asNMSCopy(item);
+ net.minecraft.world.item.ItemStack nmsItemStack = CraftItemStack.asNMSCopy(item);
if (nmsItemStack.hasTag() && nmsItemStack.getTag().hasKey("pages"))
{
@@ -198,7 +198,7 @@ public class NBTModifier_1_16_3
{
if (item != null)
{
- net.minecraft.server.v1_16_R3.ItemStack nmsItemStack = CraftItemStack.asNMSCopy(item);
+ net.minecraft.world.item.ItemStack nmsItemStack = CraftItemStack.asNMSCopy(item);
if (nmsItemStack.getTag() != null)
{
@@ -218,7 +218,7 @@ public class NBTModifier_1_16_3
{
if (item != null)
{
- net.minecraft.server.v1_16_R3.ItemStack nmsItemStack = CraftItemStack.asNMSCopy(item);
+ net.minecraft.world.item.ItemStack nmsItemStack = CraftItemStack.asNMSCopy(item);
if (nmsItemStack.getTag() != null)
{
@@ -244,7 +244,7 @@ public class NBTModifier_1_16_3
boolean isDeathItem(ItemStack item)
{
- net.minecraft.server.v1_16_R3.ItemStack nmsItemStack = CraftItemStack.asNMSCopy(item);
+ net.minecraft.world.item.ItemStack nmsItemStack = CraftItemStack.asNMSCopy(item);
if (nmsItemStack != null && nmsItemStack.hasTag())
{
@@ -279,7 +279,7 @@ public class NBTModifier_1_16_3
{
if (item != null)
{
- net.minecraft.server.v1_16_R3.ItemStack nmsItemStack = CraftItemStack.asNMSCopy(item);
+ net.minecraft.world.item.ItemStack nmsItemStack = CraftItemStack.asNMSCopy(item);
if (nmsItemStack.getTag() != null)
{
@@ -310,7 +310,7 @@ public class NBTModifier_1_16_3
boolean isDisconnectItem(ItemStack item)
{
- net.minecraft.server.v1_16_R3.ItemStack nmsItemStack = CraftItemStack.asNMSCopy(item);
+ net.minecraft.world.item.ItemStack nmsItemStack = CraftItemStack.asNMSCopy(item);
if (nmsItemStack != null && nmsItemStack.hasTag())
{
@@ -387,7 +387,7 @@ public class NBTModifier_1_16_3
{
if (item != null)
{
- net.minecraft.server.v1_16_R3.ItemStack nmsItemStack = CraftItemStack.asNMSCopy(item);
+ net.minecraft.world.item.ItemStack nmsItemStack = CraftItemStack.asNMSCopy(item);
if (nmsItemStack != null && nmsItemStack.getTag() != null)
{
@@ -482,7 +482,7 @@ public class NBTModifier_1_16_3
{
if (item != null && item.getItemMeta() instanceof SpawnEggMeta)
{
- net.minecraft.server.v1_16_R3.ItemStack nmsItemStack = CraftItemStack.asNMSCopy(item);
+ net.minecraft.world.item.ItemStack nmsItemStack = CraftItemStack.asNMSCopy(item);
return nmsItemStack.hasTag() && VulnerabilityPatcher.main.getConfig().getStringList("BlockedEntityTags").contains(nmsItemStack.getTag().getCompound("EntityTag").getString("id").replaceAll("minecraft:", ""));
}
return false;
@@ -506,7 +506,7 @@ public class NBTModifier_1_16_3
{
if (item != null && item.getType().name().contains("SIGN"))
{
- net.minecraft.server.v1_16_R3.ItemStack nmsItem = CraftItemStack.asNMSCopy(item);
+ net.minecraft.world.item.ItemStack nmsItem = CraftItemStack.asNMSCopy(item);
NBTTagCompound tag = nmsItem.getTag();
if (tag != null)
{
@@ -524,7 +524,7 @@ public class NBTModifier_1_16_3
void clearOversizedSign(BlockPlaceEvent event)
{
ItemStack item = event.getItemInHand();
- net.minecraft.server.v1_16_R3.ItemStack nmsItem = CraftItemStack.asNMSCopy(item);
+ net.minecraft.world.item.ItemStack nmsItem = CraftItemStack.asNMSCopy(item);
NBTTagCompound tag = nmsItem.getTag().getCompound("BlockEntityTag");
String text1 = tag.hasKey("Text1") ? tag.getString("Text1").toLowerCase() : "";
String text2 = tag.hasKey("Text2") ? tag.getString("Text2").toLowerCase() : "";
diff --git a/src/main/java/me/cooljwb/vulnerabilitypatcher/patches/Arrows.java b/src/main/java/me/cooljwb/vulnerabilitypatcher/patches/Arrows.java
index 7079310..69d47f3 100644
--- a/src/main/java/me/cooljwb/vulnerabilitypatcher/patches/Arrows.java
+++ b/src/main/java/me/cooljwb/vulnerabilitypatcher/patches/Arrows.java
@@ -85,7 +85,7 @@ public class Arrows extends Patches implements Listener
if (event.getEntity() instanceof SpectralArrow)
{
SpectralArrow spec_arrow = (SpectralArrow) event.getEntity();
- damage = getArrowDamage(spec_arrow);
+ damage = getArrowDamage((Arrow) spec_arrow);
knockback = spec_arrow.getKnockbackStrength();
if (knockback > 10)
@@ -97,7 +97,7 @@ public class Arrows extends Patches implements Listener
if (damage < 0 || damage > 214748364)
{
fired_countermeasure("ArrowDamage: " + damage);
- setArrowDamage(spec_arrow, 0);
+ setArrowDamage((Arrow) spec_arrow, 0);
}
}
else
diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml
index 18d9ad5..888e123 100644
--- a/src/main/resources/plugin.yml
+++ b/src/main/resources/plugin.yml
@@ -1,6 +1,6 @@
name: VulnerabilityPatcher
-version: "1.9.4"
-api-version: 1.13
+version: "1.9.5"
+api-version: "1.17"
main: me.cooljwb.vulnerabilitypatcher.VulnerabilityPatcher
authors: [CoolJWB]
description: Patches vulnerabilities that cause server instabilaty.