Compare commits
93
Commits
async_update
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
28af582f03
|
||
|
|
fe109deb90
|
||
|
|
74be800cba
|
||
|
|
b2eae919a6 | ||
|
|
eadea9dfd2 | ||
|
|
f8019b121e | ||
|
|
09cbbf86a4 | ||
|
|
6dfb33d8c7 | ||
|
|
4c75021292 | ||
|
|
a247c6595d | ||
|
|
06cf6f7eb9 | ||
|
|
0ea3ce25c8 | ||
|
|
0b8e6b1bfd | ||
|
|
0937c1902f | ||
|
|
508277be5a | ||
|
|
ffd216406e | ||
|
|
7d003b593b | ||
|
|
1dae3b26d1 | ||
|
|
64d2cd07d9 | ||
|
|
785346b4c7 | ||
|
|
d7980ca28a | ||
|
|
9643481fe9 | ||
|
|
6326c5c032 | ||
|
|
b1e29ccb49 | ||
|
|
574e53c055 | ||
|
|
595c1bada1 | ||
|
|
cf57e019cb | ||
|
|
bff2281a35 | ||
|
|
9b63cfaaa7 | ||
|
|
80b36e2b60 | ||
|
|
98c0202017 | ||
|
|
5bed4248bb | ||
|
|
5e40f2dad6 | ||
|
|
e6503b92e1 | ||
|
|
5ef150838b | ||
|
|
bb3ce43fe1 | ||
|
|
d1243bdfd1 | ||
|
|
e26e389bd1 | ||
|
|
2e7bac2a0c | ||
|
|
b6822e84f7 | ||
|
|
ecdb5bac27 | ||
|
|
8761b9ed0a | ||
|
|
78d5135c9b | ||
|
|
a3b1767823 | ||
|
|
57c06090b0 | ||
|
|
0a3f0957af | ||
|
|
f35b00afd8 | ||
|
|
2aeee753af | ||
|
|
2d799324f0 | ||
|
|
119ce0070d | ||
|
|
0317ba55be | ||
|
|
66c5a2a65f | ||
|
|
9a9f190545 | ||
|
|
4ddd8b49d2 | ||
|
|
68cf3471a9 | ||
|
|
a59f6d53c5 | ||
|
|
6dcb168a0d | ||
|
|
dce95a49e8 | ||
|
|
87b54cdfa3 | ||
|
|
bfc80089f6 | ||
|
|
a5e3348871 | ||
|
|
ad45996184 | ||
|
|
bf5f32fa3b | ||
|
|
e38c586f32 | ||
|
|
115d796318 | ||
|
|
e4ff9d9bc4 | ||
|
|
0b4ab8a8c3 | ||
|
|
1f12ea1b4e | ||
|
|
92dea5f792 | ||
|
|
266528949e | ||
|
|
08f4e1ad92 | ||
|
|
c9eba7b4a8 | ||
|
|
891ad41d48 | ||
|
|
8898b11234 | ||
|
|
33e6b7e4eb | ||
|
|
5be8617df3 | ||
|
|
58dde196a3 | ||
|
|
8e6cc93b71 | ||
|
|
4cc0831ce0 | ||
|
|
b556148536 | ||
|
|
1292e2413a | ||
|
|
f2a5b41871 | ||
|
|
8ddb47b593 | ||
|
|
aff15f8f35 | ||
|
|
adda4cf2fa | ||
|
|
f341763c28 | ||
|
|
9c673ceb71 | ||
|
|
1230b5d973 | ||
|
|
2171651b67 | ||
|
|
304eca3efd | ||
|
|
99b4010c83 | ||
|
|
25f2669ed9 | ||
|
|
b2f8857978 |
No files matched your search
@@ -0,0 +1 @@
|
||||
.gitea/CODEOWNERS linguist-detectable=false
|
||||
@@ -0,0 +1,3 @@
|
||||
# Pull requests request review from the eligible staff team(s).
|
||||
# One approval from either an Admin or Developer satisfies branch protection.
|
||||
* @trueog/Admins @trueog/Developers
|
||||
@@ -1,36 +0,0 @@
|
||||
---
|
||||
name: Bug Report
|
||||
about: Bug report for IllegalStack
|
||||
title: ''
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
<!-- ⚠️⚠️ Do Not Delete This! You must follow this template. ⚠️⚠️ -->
|
||||
<!--- Incomplete reports will be marked as invalid, and closed, with few exceptions.-->
|
||||
|
||||
**Required Information**
|
||||
- FAVS Version Number (`/version IllegalStack`):
|
||||
- Spigot/Paper Version Number (`/version`):
|
||||
- Output of `/version`:
|
||||
|
||||
**Describe the bug**
|
||||
A clear and concise description of what the bug is.
|
||||
|
||||
**To Reproduce**
|
||||
Steps to reproduce the behavior:
|
||||
1. Run to '...'
|
||||
2. Click on '....'
|
||||
3. Scroll down to '....'
|
||||
4. See error
|
||||
|
||||
**Plugins being used on the server**
|
||||
<!--- Optional but recommended - issue "/plugins" in-game or in console and copy/paste the list -->
|
||||
|
||||
**Checklist**:
|
||||
<!--- Make sure you've completed the following steps (put an "X" between of brackets): -->
|
||||
- [] I included all information required in the sections above
|
||||
- [] I made sure there are no duplicates of this report [(Use Search)](https://github.com/dniym/IllegalStack/issues?q=is%3Aissue+is%3Aopen+)
|
||||
- [] I made sure I am using an up-to-date version of [IllegalStack](https://www.spigotmc.org/resources/44411/)
|
||||
- [] I made sure the bug/error is not caused by any other plugin
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
blank_issues_enabled: false
|
||||
contact_links:
|
||||
- name: IllegalStack Discord
|
||||
url: https://discord.gg/Gsx4QaT
|
||||
about: Our support Discord, please ask questions and seek support here.
|
||||
@@ -1,19 +0,0 @@
|
||||
---
|
||||
name: Feature request
|
||||
about: Suggest an idea for this project
|
||||
title: ''
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
**Is your feature request related to a problem? Please describe.**
|
||||
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
|
||||
|
||||
**Describe the solution you'd like**
|
||||
A clear and concise description of what you want to happen.
|
||||
|
||||
**Describe alternatives you've considered**
|
||||
A clear and concise description of any alternative solutions or features you've considered.
|
||||
|
||||
**Additional context**
|
||||
Add any other context or screenshots about the feature request here.
|
||||
-17
@@ -3,22 +3,6 @@
|
||||
*.sh
|
||||
*.prefs
|
||||
|
||||
### Maven ###
|
||||
/mvn
|
||||
/target/lib
|
||||
/target/maven-archiver
|
||||
/target/classes
|
||||
/target/maven-status
|
||||
pom.xml.tag
|
||||
pom.xml.releaseBackup
|
||||
pom.xml.versionsBackup
|
||||
pom.xml.next
|
||||
release.properties
|
||||
dependency-reduced-pom.xml
|
||||
buildNumber.properties
|
||||
.mvn/timing.properties
|
||||
out/
|
||||
|
||||
### Java ###
|
||||
*.class
|
||||
|
||||
@@ -128,7 +112,6 @@ local.properties
|
||||
# STS (Spring Tool Suite)
|
||||
.springBeans
|
||||
/target/
|
||||
checkstyle.xml
|
||||
classes/
|
||||
*.bat
|
||||
docs/
|
||||
|
||||
@@ -1,13 +1,36 @@
|
||||
# IllegalStack
|
||||
A spigot based plugin dedicated to fixing glitches and exploits that have made it into final Minecraft releases.
|
||||
# IllegalStack-OG
|
||||
|
||||
## Links
|
||||
(NOTE: CONCERNING CUSTOM OR UNRELEASED OR SPECIAL BUILDS OR JARS. THE ONLY PLACE YOU SHOULD EVER DOWNLOAD THIS OR ANY OTHER PLUGIN IS DIRECTLY FROM THE AUTHORS LINKS. NEVER TRUST SOMEONE THAT RANDOMLY MESSAGES YOU OR JOINS YOUR SERVER CLAIMING TO HAVE A NEW VERSION AS IT WILL LIKELY CONTAIN MALICIOUS CODE TO TAKE OVER OR DESTROY YOUR SERVER!)
|
||||
- [Spigot](https://www.spigotmc.org/resources/dupe-fixes-illegal-stack-remover.44411/) <- OFFICIAL DOWNLOAD LINK
|
||||
- [Wiki](https://github.com/dniym/IllegalStack/wiki/FAQ)
|
||||
- [Discord](https://discord.gg/Gsx4QaT)
|
||||
A fork of IllegalStack maintained by [TrueOG Network](https://true-og.net). IllegalStack is a Spigot-based plugin dedicated to fixing glitches and exploits that have made it into final Minecraft releases.
|
||||
|
||||
## Building this project
|
||||
## Changes from IllegalStack
|
||||
|
||||
Gradle is the recommended way to build the project. Use `./gradlew build` in the main project directory to build the project.
|
||||
The output is located at `/build/libs/IllegalStack.jar`.
|
||||
- Completely removed references to the proprietary JetsMinions API. — @NotAlexNoyle
|
||||
|
||||
- Disabled automatic configuration updates and migrations. — @NotAlexNoyle
|
||||
|
||||
- Builds with TrueOG Network's config file, including detailed inline documentation. — @NotAlexNoyle
|
||||
|
||||
- Updated Gradle from 8.1.1 to 8.14.3 and modernized the build tooling. — @NotAlexNoyle
|
||||
|
||||
- Optimized the hopper transfer event handler (`onHopperXfer`) to reduce CPU overhead. — @NotAlexNoyle
|
||||
- `CheckEntireInventory` skips `RemoveItemTypesCheck` when `RemoveItemsOfType` is empty. — @NotAlexNoyle
|
||||
- `CheckEntireInventory` returns early when none of its sub-checks are enabled. — @NotAlexNoyle
|
||||
- The `DisableInWorlds` check runs before `CheckEntireInventory`, allowing disabled worlds to skip the expensive inventory scan. — @NotAlexNoyle
|
||||
|
||||
- Added thread-safe APIs that allow other plugins to exempt players from timer-based item checks. — @NotAlexNoyle
|
||||
|
||||
- Fixed vanilla default attribute modifiers being treated as illegal custom attributes. — @NotAlexNoyle
|
||||
|
||||
- Fixed dyed leather armor and other items with legitimate vanilla metadata being removed by creative-slot protection. — @NotAlexNoyle
|
||||
|
||||
- Refined `BlockBadItemsFromCreativeTab` to reject unsafe attribute payloads without rejecting ordinary metadata, and added automated tests for the behavior. — @NotAlexNoyle
|
||||
|
||||
- Removed hardcoded operator bypasses so protections consistently respect the permission system. — @GWServer
|
||||
|
||||
- Fixed modern server-version detection and changed configured item-name and item-lore startup logging to concise entry counts. — @NotAlexNoyle
|
||||
|
||||
## Building
|
||||
|
||||
> ./gradlew clean build eclipse
|
||||
|
||||
The usable jar is located at `/build/libs/IllegalStack<version>.jar`.
|
||||
+117
-55
@@ -1,76 +1,138 @@
|
||||
/* ------------------------------ Plugins ------------------------------ */
|
||||
plugins {
|
||||
java
|
||||
`java-library`
|
||||
|
||||
idea
|
||||
eclipse
|
||||
id("java") // Import Java plugin.
|
||||
id("java-library") // Import Java Library plugin.
|
||||
id("com.diffplug.spotless") version "8.1.0" // Import Spotless plugin.
|
||||
id("com.gradleup.shadow") version "8.3.9" // Import Shadow plugin.
|
||||
id("checkstyle") // Import Checkstyle plugin.
|
||||
eclipse // Import Eclipse plugin.
|
||||
kotlin("jvm") version "2.1.21" // Import Kotlin JVM plugin.
|
||||
}
|
||||
|
||||
/* --------------------------- JDK / Kotlin ---------------------------- */
|
||||
java {
|
||||
sourceCompatibility = JavaVersion.VERSION_17 // Compile with JDK 17 compatibility.
|
||||
toolchain { // Select Java toolchain.
|
||||
languageVersion.set(JavaLanguageVersion.of(17)) // Use JDK 17.
|
||||
}
|
||||
}
|
||||
|
||||
kotlin { jvmToolchain(17) }
|
||||
|
||||
/* ----------------------------- Metadata ------------------------------ */
|
||||
|
||||
version = "2.9.16" // Declare plugin version (will be in .jar).
|
||||
|
||||
group = "net.trueog.illegalstack-og" // Declare bundle identifier.
|
||||
|
||||
val apiVersion = "1.19" // Declare minecraft server target version.
|
||||
|
||||
/* ----------------------------- Resources ----------------------------- */
|
||||
tasks.named<ProcessResources>("processResources") {
|
||||
val props = mapOf("version" to version, "apiVersion" to apiVersion)
|
||||
inputs.properties(props) // Indicates to rerun if version changes.
|
||||
filesMatching("plugin.yml") { expand(props) }
|
||||
from("LICENSE") { into("/") } // Bundle licenses into jarfiles.
|
||||
}
|
||||
|
||||
/* ---------------------------- Repos ---------------------------------- */
|
||||
repositories {
|
||||
mavenCentral()
|
||||
mavenCentral() // Import the Maven Central Maven Repository.
|
||||
gradlePluginPortal() // Import the Gradle Plugin Portal Maven Repository.
|
||||
maven {
|
||||
name = "OSS Sonatype"
|
||||
url = uri("https://oss.sonatype.org/content/repositories/snapshots/")
|
||||
}
|
||||
} // Import the OSS Sonatype Maven Repository.
|
||||
maven { url = uri("https://repo.papermc.io/repository/maven-public/") } // Import the PaperMC Maven Repository.
|
||||
maven {
|
||||
name = "Spigot"
|
||||
url = uri("https://hub.spigotmc.org/nexus/content/repositories/snapshots/")
|
||||
}
|
||||
maven {
|
||||
name = "ProtocolLib"
|
||||
url = uri("https://repo.dmulloy2.net/nexus/repository/public/")
|
||||
}
|
||||
maven {
|
||||
name = "Magic"
|
||||
url = uri("https://maven.elmakers.com/repository/")
|
||||
}
|
||||
maven {
|
||||
name = "CodeMC"
|
||||
url = uri("https://repo.codemc.org/repository/maven-public/")
|
||||
}
|
||||
maven {
|
||||
name = "JitPack"
|
||||
url = uri("https://jitpack.io")
|
||||
}
|
||||
flatDir {
|
||||
dirs = setOf(file("libs"), file("$rootDir/libs"))
|
||||
}
|
||||
} // Import the ProtocolLib Maven Repository.
|
||||
maven { url = uri("https://maven.elmakers.com/repository/") } // Import the Magic plugin Maven Repository.
|
||||
maven { url = uri("https://repo.codemc.org/repository/maven-public/") } // Import the CodeMC Maven Repository.
|
||||
maven { url = uri("https://jitpack.io") } // Import the Jitpack Maven Repository.
|
||||
}
|
||||
|
||||
/* ---------------------- Java project deps ---------------------------- */
|
||||
dependencies {
|
||||
compileOnly("org.spigotmc:spigot-api:1.19.2-R0.1-SNAPSHOT")
|
||||
compileOnly("com.comphenix.protocol:ProtocolLib:4.7.0-SNAPSHOT")
|
||||
implementation("com.elmakers.mine.bukkit:MagicAPI:8.6")
|
||||
implementation("de.tr7zw:item-nbt-api-plugin:2.8.0")
|
||||
implementation("com.github.TheBusyBiscuit:Slimefun4:RC-30")
|
||||
implementation("io.netty:netty-all:4.1.65.Final")
|
||||
implementation("com.gmail.nossr50.mcMMO:mcMMO:2.1.200") { isTransitive = false }
|
||||
|
||||
|
||||
implementation("fr.minuskube.inv:smart-invs:1.2.7")
|
||||
implementation("com.github.CraftingStore:MinecraftPlugin:master-SNAPSHOT")
|
||||
compileOnly(":JetsMinions")
|
||||
compileOnlyApi("org.apache.logging.log4j:log4j-api:2.0.1")
|
||||
compileOnly("org.jetbrains:annotations:21.0.1")
|
||||
compileOnly("com.github.brcdev-minecraft:shopgui-api:3.0.0")
|
||||
compileOnly("dev.folia:folia-api:1.19.4-R0.1-SNAPSHOT") // Declare Folia API to be packaged.
|
||||
compileOnly(files("libs/ProtocolLib-5.0.jar")) // Import Legacy ProtocolLib API.
|
||||
compileOnly("com.elmakers.mine.bukkit:MagicAPI:10.2") // Import Magic API.
|
||||
compileOnly("de.tr7zw:item-nbt-api-plugin:2.14.1") // Import Item NBT API.
|
||||
compileOnly("com.github.TheBusyBiscuit:Slimefun4:RC-30") { isTransitive = false } // Import SlimeFun4.
|
||||
compileOnly("io.netty:netty-all:4.1.110.Final") { // Import netty API.
|
||||
because(
|
||||
"The version aligns with the version used by Minecraft itself." +
|
||||
"The minecraft server ships netty as well, so we don't need to include it in the jar."
|
||||
)
|
||||
}
|
||||
compileOnly("com.gmail.nossr50.mcMMO:mcMMO:2.1.217") { isTransitive = false } // Import mcMMO API.
|
||||
compileOnly("fr.minuskube.inv:smart-invs:1.2.7") // Import SmartInvs API.
|
||||
compileOnly("com.github.brcdev-minecraft:shopgui-api:3.0.0") // Import ShopGUI API.
|
||||
|
||||
testImplementation("dev.folia:folia-api:1.19.4-R0.1-SNAPSHOT")
|
||||
testImplementation(platform("org.junit:junit-bom:5.13.3"))
|
||||
testImplementation("org.junit.jupiter:junit-jupiter")
|
||||
testImplementation("org.mockito:mockito-core:5.14.2")
|
||||
testRuntimeOnly("org.junit.platform:junit-platform-launcher")
|
||||
}
|
||||
|
||||
the<JavaPluginExtension>().toolchain {
|
||||
languageVersion.set(JavaLanguageVersion.of(16))
|
||||
tasks.test { useJUnitPlatform() }
|
||||
|
||||
/* ---------------------- Reproducible jars ---------------------------- */
|
||||
tasks.withType<AbstractArchiveTask>().configureEach { // Ensure reproducible .jars
|
||||
isPreserveFileTimestamps = false
|
||||
isReproducibleFileOrder = true
|
||||
}
|
||||
|
||||
configurations.all {
|
||||
attributes.attribute(TargetJvmVersion.TARGET_JVM_VERSION_ATTRIBUTE, 16)
|
||||
/* ----------------------------- Shadow -------------------------------- */
|
||||
tasks.shadowJar {
|
||||
exclude("io.github.miniplaceholders.*") // Exclude the MiniPlaceholders package from being shadowed.
|
||||
archiveClassifier.set("") // Use empty string instead of null.
|
||||
minimize()
|
||||
}
|
||||
|
||||
tasks.compileJava.configure {
|
||||
options.release.set(8)
|
||||
tasks.jar { archiveClassifier.set("part") } // Applies to root jarfile only.
|
||||
|
||||
tasks.build { dependsOn(tasks.spotlessApply, tasks.shadowJar) } // Build depends on spotless and shadow.
|
||||
|
||||
/* --------------------------- Javac opts ------------------------------- */
|
||||
tasks.withType<JavaCompile>().configureEach {
|
||||
options.compilerArgs.add("-parameters") // Enable reflection for java code.
|
||||
options.isFork = true // Run javac in its own process.
|
||||
options.compilerArgs.add("-Xlint:deprecation") // Trigger deprecation warning messages.
|
||||
options.encoding = "UTF-8" // Use UTF-8 file encoding.
|
||||
}
|
||||
|
||||
version = "2.7.1"
|
||||
|
||||
tasks.named<Copy>("processResources") {
|
||||
filesMatching("plugin.yml") {
|
||||
expand("version" to project.version)
|
||||
/* ----------------------------- Auto Formatting ------------------------ */
|
||||
spotless {
|
||||
java {
|
||||
eclipse().configFile("config/formatter/eclipse-java-formatter.xml") // Eclipse java formatting.
|
||||
leadingTabsToSpaces() // Convert leftover leading tabs to spaces.
|
||||
removeUnusedImports() // Remove imports that aren't being called.
|
||||
}
|
||||
kotlinGradle {
|
||||
ktfmt().kotlinlangStyle().configure { it.setMaxWidth(120) } // JetBrains Kotlin formatting.
|
||||
target("build.gradle.kts", "settings.gradle.kts") // Gradle files to format.
|
||||
}
|
||||
}
|
||||
|
||||
checkstyle {
|
||||
toolVersion = "10.18.1"
|
||||
config = resources.text.fromFile(file("config/checkstyle/checkstyle.xml"))
|
||||
isIgnoreFailures = true
|
||||
isShowViolations = true
|
||||
configProperties["basedir"] = rootProject.projectDir.absolutePath
|
||||
}
|
||||
|
||||
tasks.withType<Checkstyle>().configureEach {
|
||||
configDirectory.set(layout.projectDirectory.dir("config/checkstyle"))
|
||||
inputs.file("config/checkstyle/checkstyle.xml")
|
||||
classpath = files()
|
||||
}
|
||||
|
||||
tasks.named("compileJava") {
|
||||
dependsOn("spotlessApply") // Run spotless before compiling with the JDK.
|
||||
}
|
||||
|
||||
tasks.named("spotlessCheck") {
|
||||
dependsOn("spotlessApply") // Run spotless before checking if spotless ran.
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
<?xml version="1.0"?>
|
||||
<!DOCTYPE module PUBLIC
|
||||
"-//Checkstyle//DTD Checkstyle Configuration 1.3//EN"
|
||||
"https://checkstyle.org/dtds/configuration_1_3.dtd">
|
||||
<module name="Checker">
|
||||
|
||||
<module name="FileTabCharacter">
|
||||
<property name="eachLine" value="true"/>
|
||||
<property name="severity" value="error"/>
|
||||
</module>
|
||||
|
||||
<module name="TreeWalker">
|
||||
<module name="FinalLocalVariable"/>
|
||||
<module name="AvoidStarImport"/>
|
||||
<module name="Indentation">
|
||||
<property name="severity" value="ignore"/>
|
||||
</module>
|
||||
</module>
|
||||
|
||||
<module name="RegexpSingleline">
|
||||
<property name="format" value="\borg\.junit\.jupiter\.api\.Assertions\.fail\s*\(\s*"Not yet implemented"\s*\)\s*;"/>
|
||||
<property name="message" value="Remove placeholder fail() and implement the test."/>
|
||||
<property name="ignoreCase" value="true"/>
|
||||
<property name="severity" value="warning"/>
|
||||
</module>
|
||||
|
||||
<module name="RegexpSingleline">
|
||||
<property name="format" value="(?<!\w)fail\s*\(\s*"Not yet implemented"\s*\)\s*;"/>
|
||||
<property name="message" value="Remove placeholder fail() and implement the test."/>
|
||||
<property name="severity" value="warning"/>
|
||||
</module>
|
||||
|
||||
</module>
|
||||
|
||||
@@ -0,0 +1,404 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<profiles version="23">
|
||||
<profile kind="CodeFormatterProfile" name="TrueOG Network Formatting" version="23">
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_ellipsis" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_for_statment" value="common_lines"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.comment.format_javadoc_comments" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.indentation.size" value="4"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_enum_constant_declaration" value="common_lines"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.align_with_spaces" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.continuation_indentation" value="2"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.number_of_blank_lines_before_code_block" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_switch_case_expressions" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.blank_lines_after_package" value="1"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.comment.indent_root_tags" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.wrap_before_or_operator_multicatch" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.enabling_tag" value="@formatter:on"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.comment.count_line_length_from_starting_position" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_record_components" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.wrap_before_multiplicative_operator" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_parameterized_type_references" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_logical_operator" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.keep_annotation_declaration_on_one_line" value="one_line_never"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_record_declaration" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_enum_constant" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_multiplicative_operator" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_abstract_method" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.keep_enum_constant_declaration_on_one_line" value="one_line_never"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.align_variable_declarations_on_columns" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_union_type_in_multicatch" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body" value="1"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_catch_clause" value="common_lines"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_multiplicative_operator" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.keep_anonymous_type_declaration_on_one_line" value="one_line_never"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_switch_case_expressions" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.wrap_before_shift_operator" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_block" value="next_line_on_wrap"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.number_of_blank_lines_at_end_of_code_block" value="1"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_bitwise_operator" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_type_parameters" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_compact_loops" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.keep_simple_for_body_on_same_line" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.wrap_before_switch_case_arrow_operator" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_unary_operator" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_annotation" value="common_lines"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_ellipsis" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_try_resources" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_annotations_on_enum_constant" value="49"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.text_block_indentation" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.align_type_members_on_columns" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_assignment" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_module_statements" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.comment.align_tags_names_descriptions" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.keep_if_then_body_block_on_one_line" value="one_line_never"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration" value="1"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.align_assignment_statements_on_columns" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_permitted_types" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_block_in_case" value="next_line_on_wrap"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_conditional_expression_chain" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.comment.format_header" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_type_annotations" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.wrap_before_assertion_message_operator" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_method_declaration" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.align_fields_grouping_blank_lines" value="2147483647"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_bitwise_operator" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration" value="next_line_on_wrap"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_resources_in_try" value="80"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.comment.format_source_code" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_field" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_method" value="1"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_not_operator" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_type_annotation" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.comment.format_html" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_method_delcaration" value="common_lines"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_compact_if" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.indent_empty_lines" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_type_arguments" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_unary_operator" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_annotations_on_package" value="49"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_label" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_arrow_in_switch_case" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_permitted_types_in_type_declaration" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_record_header" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.wrap_before_bitwise_operator" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.comment.javadoc_do_not_separate_block_tags" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_try" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_lambda_arrow" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.comment.indent_tag_description" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_record_constructor" value="next_line_on_wrap"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_string_concatenation" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_multiple_fields" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_array_initializer" value="next_line_on_wrap"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_shift_operator" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_shift_operator" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.keep_simple_do_while_body_on_same_line" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_record_components" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_expressions_in_for_loop_header" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.wrap_before_additive_operator" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.keep_simple_getter_setter_on_one_line" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_block_in_case_after_arrow" value="next_line_on_wrap"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_string_concatenation" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_lambda_arrow" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.join_lines_in_comments" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_record_declaration" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_relational_operator" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.blank_lines_between_import_groups" value="1"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_logical_operator" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_method_invocation" value="common_lines"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.blank_lines_after_imports" value="1"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_record_declaration" value="common_lines"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_switch_statement" value="common_lines"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_arrow_in_switch_default" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.disabling_tag" value="@formatter:off"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_enum_constants" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_imports" value="1"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.number_of_blank_lines_at_end_of_method_body" value="1"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_if_while_statement" value="common_lines"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_arrow_in_switch_case" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations" value="1"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.keep_switch_body_block_on_one_line" value="one_line_never"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.indent_statements_compare_to_block" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration" value="next_line_on_wrap"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_expressions_in_switch_case_with_arrow" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.comment.align_tags_descriptions_grouped" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.comment.line_length" value="80"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.use_on_off_tags" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.keep_method_body_on_one_line" value="one_line_never"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.keep_loop_body_block_on_one_line" value="one_line_never"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_method_declaration" value="next_line_on_wrap"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.keep_type_declaration_on_one_line" value="one_line_never"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_additive_operator" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_record_constructor" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_relational_operator" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.keep_record_declaration_on_one_line" value="one_line_never"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration" value="next_line_on_wrap"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_lambda_body" value="next_line_on_wrap"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.compact_else_if" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_try" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_annotations_on_parameter" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_relational_operator" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve" value="1"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.align_arrows_in_switch_on_columns" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_additive_operator" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_string_concatenation" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.comment.format_line_comments" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.align_selector_in_method_invocation_on_expression_first_line" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_record_declaration" value="next_line_on_wrap"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.keep_switch_case_with_arrow_on_one_line" value="one_line_never"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_expressions_in_switch_case_with_colon" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.number_of_blank_lines_after_code_block" value="1"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_conditional_expression" value="80"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_annotations_on_type" value="49"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_annotations_on_local_variable" value="49"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration" value="next_line_on_wrap"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_arrow_in_switch_default" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.comment.insert_new_line_between_different_tags" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_additive_operator" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.join_wrapped_lines" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_annotations_on_field" value="49"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.wrap_before_conditional_operator" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.join_line_comments" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_shift_operator" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_try_clause" value="common_lines"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.keep_code_block_on_one_line" value="one_line_never"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_record_components" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.tabulation.size" value="4"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_bitwise_operator" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_try" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_try_resources" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer" value="2"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_record_declaration" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.wrap_before_assignment_operator" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_switch" value="next_line_on_wrap"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_switch_case_with_arrow" value="20"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.keep_lambda_body_block_on_one_line" value="one_line_never"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_annotations_on_method" value="49"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.keep_record_constructor_on_one_line" value="one_line_never"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_record_declaration" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_assertion_message" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk" value="1"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_member_type" value="1"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_logical_operator" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_record_declaration" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_semicolon" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.wrap_before_relational_operator" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.comment.format_block_comments" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.blank_lines_after_last_class_body_declaration" value="1"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.indent_statements_compare_to_body" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.keep_simple_while_body_on_same_line" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.wrap_before_logical_operator" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.blank_lines_between_statement_group_in_switch" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_lambda_declaration" value="common_lines"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_permitted_types" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.keep_enum_declaration_on_one_line" value="one_line_never"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_enum_constant" value="next_line_on_wrap"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_type_declaration" value="next_line_on_wrap"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_multiplicative_operator" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_package" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.comment.indent_parameter_description" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_code_block" value="1"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.tabulation.char" value="space"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.wrap_before_string_concatenation" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.lineSplit" value="120"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch" value="insert"/>
|
||||
</profile>
|
||||
</profiles>
|
||||
Vendored
BIN
Binary file not shown.
+4
-3
@@ -1,6 +1,7 @@
|
||||
#Thu Jun 11 18:49:09 CEST 2020
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.1.1-all.zip
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
zipStorePath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.3-bin.zip
|
||||
networkTimeout=10000
|
||||
validateDistributionUrl=true
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
@@ -1,78 +1,129 @@
|
||||
#!/usr/bin/env sh
|
||||
#!/bin/sh
|
||||
|
||||
#
|
||||
# Copyright © 2015-2021 the original 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.
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
##############################################################################
|
||||
##
|
||||
## Gradle start up script for UN*X
|
||||
##
|
||||
#
|
||||
# Gradle start up script for POSIX generated by Gradle.
|
||||
#
|
||||
# Important for running:
|
||||
#
|
||||
# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
|
||||
# noncompliant, but you have some other compliant shell such as ksh or
|
||||
# bash, then to run this script, type that shell name before the whole
|
||||
# command line, like:
|
||||
#
|
||||
# ksh Gradle
|
||||
#
|
||||
# Busybox and similar reduced shells will NOT work, because this script
|
||||
# requires all of these POSIX shell features:
|
||||
# * functions;
|
||||
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
|
||||
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
|
||||
# * compound commands having a testable exit status, especially «case»;
|
||||
# * various built-in commands including «command», «set», and «ulimit».
|
||||
#
|
||||
# Important for patching:
|
||||
#
|
||||
# (2) This script targets any POSIX shell, so it avoids extensions provided
|
||||
# by Bash, Ksh, etc; in particular arrays are avoided.
|
||||
#
|
||||
# The "traditional" practice of packing multiple parameters into a
|
||||
# space-separated string is a well documented source of bugs and security
|
||||
# problems, so this is (mostly) avoided, by progressively accumulating
|
||||
# options in "$@", and eventually passing that to Java.
|
||||
#
|
||||
# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
|
||||
# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
|
||||
# see the in-line comments for details.
|
||||
#
|
||||
# There are tweaks for specific operating systems such as AIX, CygWin,
|
||||
# Darwin, MinGW, and NonStop.
|
||||
#
|
||||
# (3) This script is generated from the Groovy template
|
||||
# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
||||
# within the Gradle project.
|
||||
#
|
||||
# You can find Gradle at https://github.com/gradle/gradle/.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
# Attempt to set APP_HOME
|
||||
|
||||
# Resolve links: $0 may be a link
|
||||
PRG="$0"
|
||||
# Need this for relative symlinks.
|
||||
while [ -h "$PRG" ] ; do
|
||||
ls=`ls -ld "$PRG"`
|
||||
link=`expr "$ls" : '.*-> \(.*\)$'`
|
||||
if expr "$link" : '/.*' > /dev/null; then
|
||||
PRG="$link"
|
||||
else
|
||||
PRG=`dirname "$PRG"`"/$link"
|
||||
fi
|
||||
app_path=$0
|
||||
|
||||
# Need this for daisy-chained symlinks.
|
||||
while
|
||||
APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
|
||||
[ -h "$app_path" ]
|
||||
do
|
||||
ls=$( ls -ld "$app_path" )
|
||||
link=${ls#*' -> '}
|
||||
case $link in #(
|
||||
/*) app_path=$link ;; #(
|
||||
*) app_path=$APP_HOME$link ;;
|
||||
esac
|
||||
done
|
||||
SAVED="`pwd`"
|
||||
cd "`dirname \"$PRG\"`/" >/dev/null
|
||||
APP_HOME="`pwd -P`"
|
||||
cd "$SAVED" >/dev/null
|
||||
|
||||
APP_NAME="Gradle"
|
||||
APP_BASE_NAME=`basename "$0"`
|
||||
|
||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
DEFAULT_JVM_OPTS=""
|
||||
# This is normally unused
|
||||
# shellcheck disable=SC2034
|
||||
APP_BASE_NAME=${0##*/}
|
||||
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
|
||||
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit
|
||||
|
||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||
MAX_FD="maximum"
|
||||
MAX_FD=maximum
|
||||
|
||||
warn () {
|
||||
echo "$*"
|
||||
}
|
||||
} >&2
|
||||
|
||||
die () {
|
||||
echo
|
||||
echo "$*"
|
||||
echo
|
||||
exit 1
|
||||
}
|
||||
} >&2
|
||||
|
||||
# OS specific support (must be 'true' or 'false').
|
||||
cygwin=false
|
||||
msys=false
|
||||
darwin=false
|
||||
nonstop=false
|
||||
case "`uname`" in
|
||||
CYGWIN* )
|
||||
cygwin=true
|
||||
;;
|
||||
Darwin* )
|
||||
darwin=true
|
||||
;;
|
||||
MINGW* )
|
||||
msys=true
|
||||
;;
|
||||
NONSTOP* )
|
||||
nonstop=true
|
||||
;;
|
||||
case "$( uname )" in #(
|
||||
CYGWIN* ) cygwin=true ;; #(
|
||||
Darwin* ) darwin=true ;; #(
|
||||
MSYS* | MINGW* ) msys=true ;; #(
|
||||
NONSTOP* ) nonstop=true ;;
|
||||
esac
|
||||
|
||||
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||
CLASSPATH="\\\"\\\""
|
||||
|
||||
|
||||
# Determine the Java command to use to start the JVM.
|
||||
if [ -n "$JAVA_HOME" ] ; then
|
||||
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
||||
# IBM's JDK on AIX uses strange locations for the executables
|
||||
JAVACMD="$JAVA_HOME/jre/sh/java"
|
||||
JAVACMD=$JAVA_HOME/jre/sh/java
|
||||
else
|
||||
JAVACMD="$JAVA_HOME/bin/java"
|
||||
JAVACMD=$JAVA_HOME/bin/java
|
||||
fi
|
||||
if [ ! -x "$JAVACMD" ] ; then
|
||||
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
||||
@@ -81,92 +132,120 @@ Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
else
|
||||
JAVACMD="java"
|
||||
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
JAVACMD=java
|
||||
if ! command -v java >/dev/null 2>&1
|
||||
then
|
||||
die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
fi
|
||||
|
||||
# Increase the maximum file descriptors if we can.
|
||||
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
|
||||
MAX_FD_LIMIT=`ulimit -H -n`
|
||||
if [ $? -eq 0 ] ; then
|
||||
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
|
||||
MAX_FD="$MAX_FD_LIMIT"
|
||||
fi
|
||||
ulimit -n $MAX_FD
|
||||
if [ $? -ne 0 ] ; then
|
||||
warn "Could not set maximum file descriptor limit: $MAX_FD"
|
||||
fi
|
||||
else
|
||||
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
|
||||
fi
|
||||
fi
|
||||
|
||||
# For Darwin, add options to specify how the application appears in the dock
|
||||
if $darwin; then
|
||||
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
|
||||
fi
|
||||
|
||||
# For Cygwin, switch paths to Windows format before running java
|
||||
if $cygwin ; then
|
||||
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
|
||||
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
|
||||
JAVACMD=`cygpath --unix "$JAVACMD"`
|
||||
|
||||
# We build the pattern for arguments to be converted via cygpath
|
||||
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
|
||||
SEP=""
|
||||
for dir in $ROOTDIRSRAW ; do
|
||||
ROOTDIRS="$ROOTDIRS$SEP$dir"
|
||||
SEP="|"
|
||||
done
|
||||
OURCYGPATTERN="(^($ROOTDIRS))"
|
||||
# Add a user-defined pattern to the cygpath arguments
|
||||
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
|
||||
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
|
||||
fi
|
||||
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||
i=0
|
||||
for arg in "$@" ; do
|
||||
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
|
||||
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
|
||||
|
||||
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
|
||||
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
|
||||
else
|
||||
eval `echo args$i`="\"$arg\""
|
||||
fi
|
||||
i=$((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" ;;
|
||||
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
|
||||
case $MAX_FD in #(
|
||||
max*)
|
||||
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
|
||||
# shellcheck disable=SC2039,SC3045
|
||||
MAX_FD=$( ulimit -H -n ) ||
|
||||
warn "Could not query maximum file descriptor limit"
|
||||
esac
|
||||
case $MAX_FD in #(
|
||||
'' | soft) :;; #(
|
||||
*)
|
||||
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
|
||||
# shellcheck disable=SC2039,SC3045
|
||||
ulimit -n "$MAX_FD" ||
|
||||
warn "Could not set maximum file descriptor limit to $MAX_FD"
|
||||
esac
|
||||
fi
|
||||
|
||||
# Escape application args
|
||||
save () {
|
||||
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
|
||||
echo " "
|
||||
}
|
||||
APP_ARGS=$(save "$@")
|
||||
# Collect all arguments for the java command, stacking in reverse order:
|
||||
# * args from the command line
|
||||
# * the main class name
|
||||
# * -classpath
|
||||
# * -D...appname settings
|
||||
# * --module-path (only if needed)
|
||||
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
|
||||
|
||||
# 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"
|
||||
# For Cygwin or MSYS, switch paths to Windows format before running java
|
||||
if "$cygwin" || "$msys" ; then
|
||||
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
|
||||
CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
|
||||
|
||||
# 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")"
|
||||
JAVACMD=$( cygpath --unix "$JAVACMD" )
|
||||
|
||||
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||
for arg do
|
||||
if
|
||||
case $arg in #(
|
||||
-*) false ;; # don't mess with options #(
|
||||
/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
|
||||
[ -e "$t" ] ;; #(
|
||||
*) false ;;
|
||||
esac
|
||||
then
|
||||
arg=$( cygpath --path --ignore --mixed "$arg" )
|
||||
fi
|
||||
# Roll the args list around exactly as many times as the number of
|
||||
# args, so each arg winds up back in the position where it started, but
|
||||
# possibly modified.
|
||||
#
|
||||
# NB: a `for` loop captures its iteration list before it begins, so
|
||||
# changing the positional parameters here affects neither the number of
|
||||
# iterations, nor the values presented in `arg`.
|
||||
shift # remove old arg
|
||||
set -- "$@" "$arg" # push replacement arg
|
||||
done
|
||||
fi
|
||||
|
||||
|
||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||
|
||||
# Collect all arguments for the java command:
|
||||
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
|
||||
# and any embedded shellness will be escaped.
|
||||
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
|
||||
# treated as '${Hostname}' itself on the command line.
|
||||
|
||||
set -- \
|
||||
"-Dorg.gradle.appname=$APP_BASE_NAME" \
|
||||
-classpath "$CLASSPATH" \
|
||||
-jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \
|
||||
"$@"
|
||||
|
||||
# Stop when "xargs" is not available.
|
||||
if ! command -v xargs >/dev/null 2>&1
|
||||
then
|
||||
die "xargs is not available"
|
||||
fi
|
||||
|
||||
# Use "xargs" to parse quoted args.
|
||||
#
|
||||
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
|
||||
#
|
||||
# In Bash we could simply go:
|
||||
#
|
||||
# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
|
||||
# set -- "${ARGS[@]}" "$@"
|
||||
#
|
||||
# but POSIX shell has neither arrays nor command substitution, so instead we
|
||||
# post-process each arg (as a line of input to sed) to backslash-escape any
|
||||
# character that might be a shell metacharacter, then use eval to reverse
|
||||
# that process (while maintaining the separation between arguments), and wrap
|
||||
# the whole thing up as a single "set" statement.
|
||||
#
|
||||
# This will of course break if any of these variables contains a newline or
|
||||
# an unmatched quote.
|
||||
#
|
||||
|
||||
eval "set -- $(
|
||||
printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
|
||||
xargs -n1 |
|
||||
sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
|
||||
tr '\n' ' '
|
||||
)" '"$@"'
|
||||
|
||||
exec "$JAVACMD" "$@"
|
||||
Vendored
+94
-84
@@ -1,84 +1,94 @@
|
||||
@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
|
||||
@rem SPDX-License-Identifier: Apache-2.0
|
||||
@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=.
|
||||
@rem This is normally unused
|
||||
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% equ 0 goto execute
|
||||
|
||||
echo. 1>&2
|
||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
|
||||
echo. 1>&2
|
||||
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
|
||||
echo location of your Java installation. 1>&2
|
||||
|
||||
goto fail
|
||||
|
||||
:findJavaFromJavaHome
|
||||
set JAVA_HOME=%JAVA_HOME:"=%
|
||||
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||
|
||||
if exist "%JAVA_EXE%" goto execute
|
||||
|
||||
echo. 1>&2
|
||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
|
||||
echo. 1>&2
|
||||
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
|
||||
echo location of your Java installation. 1>&2
|
||||
|
||||
goto fail
|
||||
|
||||
:execute
|
||||
@rem Setup the command line
|
||||
|
||||
set CLASSPATH=
|
||||
|
||||
|
||||
@rem Execute Gradle
|
||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %*
|
||||
|
||||
:end
|
||||
@rem End local scope for the variables with windows NT shell
|
||||
if %ERRORLEVEL% equ 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!
|
||||
set EXIT_CODE=%ERRORLEVEL%
|
||||
if %EXIT_CODE% equ 0 set EXIT_CODE=1
|
||||
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
|
||||
exit /b %EXIT_CODE%
|
||||
|
||||
:mainEnd
|
||||
if "%OS%"=="Windows_NT" endlocal
|
||||
|
||||
:omega
|
||||
@@ -0,0 +1,339 @@
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 2, June 1991
|
||||
|
||||
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
License is intended to guarantee your freedom to share and change free
|
||||
software--to make sure the software is free for all its users. This
|
||||
General Public License applies to most of the Free Software
|
||||
Foundation's software and to any other program whose authors commit to
|
||||
using it. (Some other Free Software Foundation software is covered by
|
||||
the GNU Lesser General Public License instead.) You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
this service if you wish), that you receive source code or can get it
|
||||
if you want it, that you can change the software or use pieces of it
|
||||
in new free programs; and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
anyone to deny you these rights or to ask you to surrender the rights.
|
||||
These restrictions translate to certain responsibilities for you if you
|
||||
distribute copies of the software, or if you modify it.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must give the recipients all the rights that
|
||||
you have. You must make sure that they, too, receive or can get the
|
||||
source code. And you must show them these terms so they know their
|
||||
rights.
|
||||
|
||||
We protect your rights with two steps: (1) copyright the software, and
|
||||
(2) offer you this license which gives you legal permission to copy,
|
||||
distribute and/or modify the software.
|
||||
|
||||
Also, for each author's protection and ours, we want to make certain
|
||||
that everyone understands that there is no warranty for this free
|
||||
software. If the software is modified by someone else and passed on, we
|
||||
want its recipients to know that what they have is not the original, so
|
||||
that any problems introduced by others will not reflect on the original
|
||||
authors' reputations.
|
||||
|
||||
Finally, any free program is threatened constantly by software
|
||||
patents. We wish to avoid the danger that redistributors of a free
|
||||
program will individually obtain patent licenses, in effect making the
|
||||
program proprietary. To prevent this, we have made it clear that any
|
||||
patent must be licensed for everyone's free use or not licensed at all.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License applies to any program or other work which contains
|
||||
a notice placed by the copyright holder saying it may be distributed
|
||||
under the terms of this General Public License. The "Program", below,
|
||||
refers to any such program or work, and a "work based on the Program"
|
||||
means either the Program or any derivative work under copyright law:
|
||||
that is to say, a work containing the Program or a portion of it,
|
||||
either verbatim or with modifications and/or translated into another
|
||||
language. (Hereinafter, translation is included without limitation in
|
||||
the term "modification".) Each licensee is addressed as "you".
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running the Program is not restricted, and the output from the Program
|
||||
is covered only if its contents constitute a work based on the
|
||||
Program (independent of having been made by running the Program).
|
||||
Whether that is true depends on what the Program does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Program's
|
||||
source code as you receive it, in any medium, provided that you
|
||||
conspicuously and appropriately publish on each copy an appropriate
|
||||
copyright notice and disclaimer of warranty; keep intact all the
|
||||
notices that refer to this License and to the absence of any warranty;
|
||||
and give any other recipients of the Program a copy of this License
|
||||
along with the Program.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy, and
|
||||
you may at your option offer warranty protection in exchange for a fee.
|
||||
|
||||
2. You may modify your copy or copies of the Program or any portion
|
||||
of it, thus forming a work based on the Program, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
a) You must cause the modified files to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
b) You must cause any work that you distribute or publish, that in
|
||||
whole or in part contains or is derived from the Program or any
|
||||
part thereof, to be licensed as a whole at no charge to all third
|
||||
parties under the terms of this License.
|
||||
|
||||
c) If the modified program normally reads commands interactively
|
||||
when run, you must cause it, when started running for such
|
||||
interactive use in the most ordinary way, to print or display an
|
||||
announcement including an appropriate copyright notice and a
|
||||
notice that there is no warranty (or else, saying that you provide
|
||||
a warranty) and that users may redistribute the program under
|
||||
these conditions, and telling the user how to view a copy of this
|
||||
License. (Exception: if the Program itself is interactive but
|
||||
does not normally print such an announcement, your work based on
|
||||
the Program is not required to print an announcement.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Program,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Program, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Program.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Program
|
||||
with the Program (or with a work based on the Program) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may copy and distribute the Program (or a work based on it,
|
||||
under Section 2) in object code or executable form under the terms of
|
||||
Sections 1 and 2 above provided that you also do one of the following:
|
||||
|
||||
a) Accompany it with the complete corresponding machine-readable
|
||||
source code, which must be distributed under the terms of Sections
|
||||
1 and 2 above on a medium customarily used for software interchange; or,
|
||||
|
||||
b) Accompany it with a written offer, valid for at least three
|
||||
years, to give any third party, for a charge no more than your
|
||||
cost of physically performing source distribution, a complete
|
||||
machine-readable copy of the corresponding source code, to be
|
||||
distributed under the terms of Sections 1 and 2 above on a medium
|
||||
customarily used for software interchange; or,
|
||||
|
||||
c) Accompany it with the information you received as to the offer
|
||||
to distribute corresponding source code. (This alternative is
|
||||
allowed only for noncommercial distribution and only if you
|
||||
received the program in object code or executable form with such
|
||||
an offer, in accord with Subsection b above.)
|
||||
|
||||
The source code for a work means the preferred form of the work for
|
||||
making modifications to it. For an executable work, complete source
|
||||
code means all the source code for all modules it contains, plus any
|
||||
associated interface definition files, plus the scripts used to
|
||||
control compilation and installation of the executable. However, as a
|
||||
special exception, the source code distributed need not include
|
||||
anything that is normally distributed (in either source or binary
|
||||
form) with the major components (compiler, kernel, and so on) of the
|
||||
operating system on which the executable runs, unless that component
|
||||
itself accompanies the executable.
|
||||
|
||||
If distribution of executable or object code is made by offering
|
||||
access to copy from a designated place, then offering equivalent
|
||||
access to copy the source code from the same place counts as
|
||||
distribution of the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
4. You may not copy, modify, sublicense, or distribute the Program
|
||||
except as expressly provided under this License. Any attempt
|
||||
otherwise to copy, modify, sublicense or distribute the Program is
|
||||
void, and will automatically terminate your rights under this License.
|
||||
However, parties who have received copies, or rights, from you under
|
||||
this License will not have their licenses terminated so long as such
|
||||
parties remain in full compliance.
|
||||
|
||||
5. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Program or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Program (or any work based on the
|
||||
Program), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Program or works based on it.
|
||||
|
||||
6. Each time you redistribute the Program (or any work based on the
|
||||
Program), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute or modify the Program subject to
|
||||
these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties to
|
||||
this License.
|
||||
|
||||
7. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Program at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Program by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Program.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under
|
||||
any particular circumstance, the balance of the section is intended to
|
||||
apply and the section as a whole is intended to apply in other
|
||||
circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system, which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
8. If the distribution and/or use of the Program is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Program under this License
|
||||
may add an explicit geographical distribution limitation excluding
|
||||
those countries, so that distribution is permitted only in or among
|
||||
countries not thus excluded. In such case, this License incorporates
|
||||
the limitation as if written in the body of this License.
|
||||
|
||||
9. The Free Software Foundation may publish revised and/or new versions
|
||||
of the General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Program
|
||||
specifies a version number of this License which applies to it and "any
|
||||
later version", you have the option of following the terms and conditions
|
||||
either of that version or of any later version published by the Free
|
||||
Software Foundation. If the Program does not specify a version number of
|
||||
this License, you may choose any version ever published by the Free Software
|
||||
Foundation.
|
||||
|
||||
10. If you wish to incorporate parts of the Program into other free
|
||||
programs whose distribution conditions are different, write to the author
|
||||
to ask for permission. For software which is copyrighted by the Free
|
||||
Software Foundation, write to the Free Software Foundation; we sometimes
|
||||
make exceptions for this. Our decision will be guided by the two goals
|
||||
of preserving the free status of all derivatives of our free software and
|
||||
of promoting the sharing and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
||||
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
||||
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
|
||||
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
|
||||
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
|
||||
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
|
||||
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
|
||||
REPAIR OR CORRECTION.
|
||||
|
||||
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
||||
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
||||
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
|
||||
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
|
||||
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
|
||||
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
||||
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
convey the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along
|
||||
with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program is interactive, make it output a short notice like this
|
||||
when it starts in an interactive mode:
|
||||
|
||||
Gnomovision version 69, Copyright (C) year name of author
|
||||
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, the commands you use may
|
||||
be called something other than `show w' and `show c'; they could even be
|
||||
mouse-clicks or menu items--whatever suits your program.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your
|
||||
school, if any, to sign a "copyright disclaimer" for the program, if
|
||||
necessary. Here is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
|
||||
`Gnomovision' (which makes passes at compilers) written by James Hacker.
|
||||
|
||||
<signature of Ty Coon>, 1 April 1989
|
||||
Ty Coon, President of Vice
|
||||
|
||||
This General Public License does not permit incorporating your program into
|
||||
proprietary programs. If your program is a subroutine library, you may
|
||||
consider it more useful to permit linking proprietary applications with the
|
||||
library. If this is what you want to do, use the GNU Lesser General
|
||||
Public License instead of this License.
|
||||
Binary file not shown.
@@ -1,33 +0,0 @@
|
||||
main: main.java.me.dniym.IllegalStack
|
||||
name: IllegalStack
|
||||
version: "${version}"
|
||||
api-version: 1.13
|
||||
description: Closes some dupe bugs still present in vanilla minecraft.
|
||||
author: dNiym
|
||||
softdepend: [Magic, Factions, NBTAPI, ProtocolLib, CraftingStore, DynamicShop, ClueScrolls, mcMMO, JetsMinions, SmartInvs, FactionsX]
|
||||
loadbefore: [MythicDrops]
|
||||
website: https://www.spigotmc.org/resources/44411/
|
||||
commands:
|
||||
istack:
|
||||
description: allows access to the /istack command
|
||||
permission: illegalstack.help
|
||||
usage: "Usage: /istack"
|
||||
permissions:
|
||||
illegalstack.admin:
|
||||
description: Allows users to use the /istack protections command
|
||||
default: op
|
||||
illegalstack.help:
|
||||
description: Allows users with this perm to use the /istack command
|
||||
default: op
|
||||
illegalstack.notify:
|
||||
description: Allows users with this perm to receive in game notifications of offenses and to teleport to those locations.
|
||||
default: op
|
||||
illegalstack.enchantbypass:
|
||||
description: Allows users with this perm to have items that break the vanilla enchant limits.
|
||||
default: false
|
||||
illegalstack.removeitemsoftypebypass:
|
||||
description: Allows users with this perm to bypass the check that removes items of a specific type.
|
||||
default: false
|
||||
illegalstack.overstack:
|
||||
description: Allows users with this perm to have items in this list that are greater than the vanilla stack size.
|
||||
default: false
|
||||
+1
-1
@@ -1 +1 @@
|
||||
rootProject.name = "IllegalStack"
|
||||
rootProject.name = "IllegalStack-OG"
|
||||
File diff suppressed because it is too large.
Load diff
@@ -11,52 +11,64 @@ import org.bukkit.inventory.ItemStack;
|
||||
|
||||
public class IllegalStackAction {
|
||||
|
||||
public static boolean isCompleted(
|
||||
Protections protection,
|
||||
Entity cause,
|
||||
Block block,
|
||||
ItemStack itemInHand,
|
||||
Entity mount,
|
||||
Inventory inventory
|
||||
) {
|
||||
IllegalStackActionEvent event = new IllegalStackActionEvent(protection, cause, block, itemInHand, mount, inventory);
|
||||
public static boolean isCompleted(Protections protection, Entity cause, Block block, ItemStack itemInHand,
|
||||
Entity mount, Inventory inventory)
|
||||
{
|
||||
|
||||
IllegalStackActionEvent event = new IllegalStackActionEvent(protection, cause, block, itemInHand, mount,
|
||||
inventory);
|
||||
Bukkit.getPluginManager().callEvent(event);
|
||||
|
||||
return !event.isCancelled();
|
||||
|
||||
}
|
||||
|
||||
public static boolean isCompleted(Protections protection, Entity entity, Player player) {
|
||||
|
||||
return isCompleted(protection, player, null, null, entity, null);
|
||||
|
||||
}
|
||||
|
||||
public static boolean isCompleted(Protections protection, Player player, Block block) {
|
||||
|
||||
return isCompleted(protection, player, block, null, null, null);
|
||||
|
||||
}
|
||||
|
||||
public static boolean isCompleted(Protections protection, Player player, Block block, ItemStack itemInHand) {
|
||||
|
||||
return isCompleted(protection, player, block, itemInHand, null, null);
|
||||
|
||||
}
|
||||
|
||||
public static boolean isCompleted(Protections protection, Player player) {
|
||||
|
||||
return isCompleted(protection, player, null, null, null, null);
|
||||
|
||||
}
|
||||
|
||||
public static boolean isCompleted(Protections protection, Entity entity, Player player, Block block) {
|
||||
|
||||
return isCompleted(protection, player, block, null, entity, null);
|
||||
|
||||
}
|
||||
|
||||
public static boolean isCompleted(Protections protection, Entity entity, Entity mount) {
|
||||
|
||||
return isCompleted(protection, entity, null, null, mount, null);
|
||||
|
||||
}
|
||||
|
||||
public static boolean isCompleted(Protections protection, ItemStack item, Block block) {
|
||||
|
||||
return isCompleted(protection, null, block, item, null, null);
|
||||
|
||||
}
|
||||
|
||||
public static boolean isCompleted(Protections protection, ItemStack item, Inventory inventory) {
|
||||
|
||||
return isCompleted(protection, null, null, item, null, inventory);
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -1,6 +1,11 @@
|
||||
package main.java.me.dniym.checks;
|
||||
|
||||
|
||||
import com.google.common.collect.Multimap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import main.java.me.dniym.IllegalStack;
|
||||
import main.java.me.dniym.enums.Msg;
|
||||
import main.java.me.dniym.enums.Protections;
|
||||
import main.java.me.dniym.listeners.fListener;
|
||||
@@ -11,82 +16,217 @@ import org.bukkit.attribute.Attribute;
|
||||
import org.bukkit.attribute.AttributeModifier;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.CraftingInventory;
|
||||
import org.bukkit.inventory.EquipmentSlot;
|
||||
import org.bukkit.inventory.ItemFlag;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
|
||||
import main.java.me.dniym.IllegalStack;
|
||||
|
||||
import java.util.HashSet;
|
||||
|
||||
public class BadAttributeCheck {
|
||||
|
||||
public static void CheckStorageInventory(CraftingInventory inventory, Player player) {
|
||||
if (Protections.RemoveCustomAttributes.isEnabled() && IllegalStack.hasStorage()) {
|
||||
|
||||
if (Protections.RemoveCustomAttributes.isEnabled(inventory) && IllegalStack.hasStorage()) {
|
||||
|
||||
if (Protections.AllowBypass.isEnabled() && player.hasPermission("illegalstack.enchantbypass")) {
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
for (ItemStack itemStack : inventory.getStorageContents()) {
|
||||
|
||||
if (itemStack != null && itemStack.getType() != Material.AIR && NBTStuff.hasBadCustomData(itemStack)) {
|
||||
fListener.getLog().append2(Msg.GenericItemRemoval.getValue(
|
||||
itemStack,
|
||||
Protections.RemoveCustomAttributes,
|
||||
player,
|
||||
"Crafting Inventory"
|
||||
));
|
||||
|
||||
fListener.getLog().append2(Msg.GenericItemRemoval.getValue(itemStack,
|
||||
Protections.RemoveCustomAttributes, player, "Crafting Inventory"));
|
||||
|
||||
inventory.removeItem(itemStack);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static boolean hasBadAttributes(ItemStack is, Object obj) {
|
||||
if (!Protections.RemoveCustomAttributes.isEnabled()) {
|
||||
|
||||
if (!Protections.RemoveCustomAttributes.isEnabled(obj)) {
|
||||
|
||||
return false;
|
||||
|
||||
}
|
||||
return is != null && is.getType() != Material.AIR && checkForBadCustomData(is, obj);
|
||||
|
||||
return hasNonDefaultAttributeModifiers(is);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Pure predicate: true iff the item carries at least one AttributeModifier that
|
||||
* is NOT part of the vanilla default modifier set for its Material. Vanilla
|
||||
* defaults are exposed via ItemMeta on 1.20.5+, so a naive
|
||||
* hasAttributeModifiers() check false-positives every vanilla weapon/armor and
|
||||
* causes inventory churn when the periodic scanner rewrites the meta.
|
||||
*/
|
||||
public static boolean hasNonDefaultAttributeModifiers(ItemStack is) {
|
||||
|
||||
if (is == null || is.getType() == Material.AIR) {
|
||||
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
if (IllegalStack.isHasAttribAPI()) {
|
||||
|
||||
ItemMeta meta = is.getItemMeta();
|
||||
return meta != null && hasCustomModifier(meta, is.getType());
|
||||
|
||||
}
|
||||
|
||||
if (IllegalStack.isNbtAPI()) {
|
||||
|
||||
return NBTApiStuff.hasBadCustomDataLegacy(is);
|
||||
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
public static boolean checkForBadCustomData(ItemStack itemStack, Object obj) {
|
||||
ItemMeta itemMeta = itemStack.getItemMeta();
|
||||
|
||||
if (IllegalStack.isHasAttribAPI()) {
|
||||
if (itemMeta.hasAttributeModifiers()) {
|
||||
StringBuilder attribs = new StringBuilder();
|
||||
HashSet<Attribute> toRemove = new HashSet<>();
|
||||
for (Attribute a : itemMeta.getAttributeModifiers().keySet()) {
|
||||
|
||||
for (AttributeModifier st : itemMeta.getAttributeModifiers(a)) {
|
||||
attribs.append(" ").append(st.getName()).append(" value: ").append(st.getAmount());
|
||||
}
|
||||
toRemove.add(a);
|
||||
}
|
||||
ItemMeta itemMeta = itemStack.getItemMeta();
|
||||
if (itemMeta == null || !itemMeta.hasAttributeModifiers()) {
|
||||
|
||||
fListener.getLog().append(
|
||||
Msg.CustomAttribsRemoved3.getValue(itemStack, obj, attribs),
|
||||
Protections.RemoveCustomAttributes
|
||||
);
|
||||
return false;
|
||||
|
||||
for (Attribute remove : toRemove) {
|
||||
itemMeta.removeAttributeModifier(remove);
|
||||
}
|
||||
|
||||
for (ItemFlag iFlag : itemMeta.getItemFlags()) {
|
||||
itemMeta.removeItemFlags(iFlag);
|
||||
}
|
||||
|
||||
itemStack.setItemMeta(itemMeta);
|
||||
return true;
|
||||
}
|
||||
|
||||
Set<UUID> defaultUuids = collectDefaultModifierUuids(itemStack.getType());
|
||||
Multimap<Attribute, AttributeModifier> mods = itemMeta.getAttributeModifiers();
|
||||
|
||||
StringBuilder attribs = new StringBuilder();
|
||||
boolean anyCustom = false;
|
||||
for (Map.Entry<Attribute, AttributeModifier> entry : mods.entries()) {
|
||||
|
||||
AttributeModifier mod = entry.getValue();
|
||||
if (!defaultUuids.contains(mod.getUniqueId())) {
|
||||
|
||||
anyCustom = true;
|
||||
attribs.append(" ").append(mod.getName()).append(" value: ").append(mod.getAmount());
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (!anyCustom) {
|
||||
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
fListener.getLog().append(Msg.CustomAttribsRemoved3.getValue(itemStack, obj, attribs),
|
||||
Protections.RemoveCustomAttributes);
|
||||
|
||||
for (Map.Entry<Attribute, AttributeModifier> entry : mods.entries()) {
|
||||
|
||||
AttributeModifier mod = entry.getValue();
|
||||
if (!defaultUuids.contains(mod.getUniqueId())) {
|
||||
|
||||
itemMeta.removeAttributeModifier(entry.getKey(), mod);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
for (ItemFlag iFlag : itemMeta.getItemFlags()) {
|
||||
|
||||
itemMeta.removeItemFlags(iFlag);
|
||||
|
||||
}
|
||||
|
||||
itemStack.setItemMeta(itemMeta);
|
||||
return true;
|
||||
|
||||
} else if (IllegalStack.isNbtAPI()) {
|
||||
|
||||
return NBTApiStuff.checkForBadCustomDataLegacy(itemStack, obj);
|
||||
|
||||
} else {
|
||||
fListener.getLog().append(
|
||||
Msg.StaffNoNBTAPI.getValue(Protections.RemoveCustomAttributes.name()),
|
||||
Protections.RemoveCustomAttributes
|
||||
);
|
||||
|
||||
fListener.getLog().append(Msg.StaffNoNBTAPI.getValue(Protections.RemoveCustomAttributes.name()),
|
||||
Protections.RemoveCustomAttributes);
|
||||
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
private static boolean hasCustomModifier(ItemMeta meta, Material type) {
|
||||
|
||||
if (!meta.hasAttributeModifiers()) {
|
||||
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
Set<UUID> defaultUuids = collectDefaultModifierUuids(type);
|
||||
Multimap<Attribute, AttributeModifier> mods = meta.getAttributeModifiers();
|
||||
for (AttributeModifier mod : mods.values()) {
|
||||
|
||||
if (!defaultUuids.contains(mod.getUniqueId())) {
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
public static Set<UUID> collectDefaultModifierUuidsPublic(Material type) {
|
||||
|
||||
return collectDefaultModifierUuids(type);
|
||||
|
||||
}
|
||||
|
||||
private static Set<UUID> collectDefaultModifierUuids(Material type) {
|
||||
|
||||
Set<UUID> uuids = new HashSet<>();
|
||||
for (EquipmentSlot slot : EquipmentSlot.values()) {
|
||||
|
||||
try {
|
||||
|
||||
Multimap<Attribute, AttributeModifier> defaults = type.getDefaultAttributeModifiers(slot);
|
||||
if (defaults == null) {
|
||||
|
||||
continue;
|
||||
|
||||
}
|
||||
|
||||
for (AttributeModifier defMod : defaults.values()) {
|
||||
|
||||
uuids.add(defMod.getUniqueId());
|
||||
|
||||
}
|
||||
|
||||
} catch (Throwable ignored) {
|
||||
|
||||
// Method may not exist on older servers, or the slot is incompatible
|
||||
// with this material. Degrade gracefully: treat as no defaults known
|
||||
// for that slot.
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return uuids;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,113 @@
|
||||
package main.java.me.dniym.checks;
|
||||
|
||||
import main.java.me.dniym.IllegalStack;
|
||||
import main.java.me.dniym.enums.Msg;
|
||||
import main.java.me.dniym.enums.Protections;
|
||||
import main.java.me.dniym.listeners.fListener;
|
||||
import main.java.me.dniym.utils.NBTStuff;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.entity.Projectile;
|
||||
import org.bukkit.entity.ThrownPotion;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
import org.bukkit.inventory.meta.PotionMeta;
|
||||
import org.bukkit.potion.PotionData;
|
||||
import org.bukkit.potion.PotionEffect;
|
||||
import org.bukkit.potion.PotionType;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class BadPotionCheck {
|
||||
|
||||
public static void checkPotion(ItemStack is, Player p) {
|
||||
|
||||
if (!is.hasItemMeta())
|
||||
return;
|
||||
ItemMeta im = is.getItemMeta();
|
||||
if (Protections.PreventInvalidPotions.isEnabled() && im instanceof PotionMeta) {
|
||||
|
||||
if (Protections.AllowBypass.isEnabled() && p.hasPermission("illegalstack.enchantbypass"))
|
||||
return;
|
||||
|
||||
if (IllegalStack.isHasMCMMO()
|
||||
&& NBTStuff.hasNbtTag("IllegalStack", is, "mcmmoitem", Protections.PreventInvalidPotions))
|
||||
return;
|
||||
|
||||
PotionMeta potion = (PotionMeta) is.getItemMeta();
|
||||
PotionData pd = potion.getBasePotionData();
|
||||
if (pd.getType() == PotionType.UNCRAFTABLE
|
||||
|| (potion.hasCustomEffects() && !potion.getCustomEffects().isEmpty()))
|
||||
{
|
||||
|
||||
if (pd.getType() == PotionType.UNCRAFTABLE && potion.getCustomEffects().isEmpty())
|
||||
return;
|
||||
|
||||
p.getInventory().remove(is);
|
||||
StringBuilder efx = new StringBuilder();
|
||||
for (PotionEffect ce : potion.getCustomEffects()) {
|
||||
|
||||
efx.append(ce.getType().getName()).append(" amplifier: ").append(ce.getAmplifier())
|
||||
.append(" duration: ").append(ce.getDuration()).append(",");
|
||||
|
||||
}
|
||||
|
||||
fListener.getLog().append(Msg.InvalidPotionRemoved.getValue(p, efx.toString()),
|
||||
Protections.PreventInvalidPotions);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static boolean isInvalidPotion(@NotNull Projectile proj) {
|
||||
|
||||
if (proj instanceof ThrownPotion) {
|
||||
|
||||
ThrownPotion tp = (ThrownPotion) proj;
|
||||
Player p = null;
|
||||
if (proj.getShooter() instanceof Player)
|
||||
p = ((Player) proj.getShooter());
|
||||
|
||||
if (p != null && Protections.AllowBypass.isEnabled() && p.hasPermission("illegalstack.enchantbypass"))
|
||||
return false;
|
||||
|
||||
PotionMeta potion = null;
|
||||
|
||||
if (IllegalStack.isPaperServer())
|
||||
potion = (PotionMeta) tp.getPotionMeta();
|
||||
else
|
||||
potion = (PotionMeta) tp.getItem().getItemMeta();
|
||||
|
||||
PotionData pd = potion.getBasePotionData();
|
||||
|
||||
PotionType pt = null;
|
||||
|
||||
if (pd.getType() == PotionType.UNCRAFTABLE
|
||||
|| (potion.hasCustomEffects() && !potion.getCustomEffects().isEmpty()))
|
||||
{
|
||||
|
||||
if (pd.getType() == PotionType.UNCRAFTABLE && potion.getCustomEffects().isEmpty())
|
||||
return false;
|
||||
|
||||
// p.getInventory().remove(is);
|
||||
StringBuilder efx = new StringBuilder();
|
||||
for (PotionEffect ce : potion.getCustomEffects()) {
|
||||
|
||||
efx.append(ce.getType().getName()).append(" amplifier: ").append(ce.getAmplifier())
|
||||
.append(" duration: ").append(ce.getDuration()).append(",");
|
||||
|
||||
}
|
||||
|
||||
fListener.getLog().append(Msg.InvalidThrownPotionRemoved.getValue(p, efx.toString()),
|
||||
Protections.PreventInvalidPotions);
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,11 +1,12 @@
|
||||
package main.java.me.dniym.checks;
|
||||
|
||||
|
||||
import main.java.me.dniym.IllegalStack;
|
||||
import main.java.me.dniym.actions.IllegalStackAction;
|
||||
import main.java.me.dniym.enums.Msg;
|
||||
import main.java.me.dniym.enums.Protections;
|
||||
import main.java.me.dniym.listeners.fListener;
|
||||
import main.java.me.dniym.utils.NBTStuff;
|
||||
import main.java.me.dniym.utils.Scheduler;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.BlockState;
|
||||
@@ -14,129 +15,185 @@ import org.bukkit.block.ShulkerBox;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.BlockStateMeta;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
import main.java.me.dniym.IllegalStack;
|
||||
|
||||
public class CheckUtils {
|
||||
|
||||
public static boolean CheckEntireContainer(Container container) {
|
||||
|
||||
boolean added = false;
|
||||
for (ItemStack itemStack : container.getInventory()) {
|
||||
|
||||
if (itemStack != null && IllegalStack.hasShulkers() && itemStack.getType().name().contains("SHULKER_BOX")) {
|
||||
|
||||
int tagSize = NBTStuff.isBadShulker(itemStack);
|
||||
if (tagSize > 0 && IllegalStackAction.isCompleted(
|
||||
Protections.DestroyInvalidShulkers,
|
||||
itemStack,
|
||||
container.getInventory()
|
||||
)) {
|
||||
fListener.getLog().append(
|
||||
Msg.StaffBadShulkerRemoved.getValue(container.getLocation(), tagSize),
|
||||
Protections.DestroyInvalidShulkers
|
||||
);
|
||||
if (tagSize > 0 && IllegalStackAction.isCompleted(Protections.DestroyInvalidShulkers, itemStack,
|
||||
container.getInventory()))
|
||||
{
|
||||
|
||||
fListener.getLog().append(Msg.StaffBadShulkerRemoved.getValue(container.getLocation(), tagSize),
|
||||
Protections.DestroyInvalidShulkers);
|
||||
itemStack.setType(Material.AIR);
|
||||
return true;
|
||||
|
||||
} else {
|
||||
|
||||
if (itemStack.getItemMeta() instanceof BlockStateMeta) {
|
||||
|
||||
BlockStateMeta im = (BlockStateMeta) itemStack.getItemMeta();
|
||||
boolean remove = false;
|
||||
if (im.getBlockState() instanceof ShulkerBox) {
|
||||
|
||||
BlockState shulk = im.getBlockState();
|
||||
ShulkerBox shulker = (ShulkerBox) shulk;
|
||||
Inventory inv = Bukkit.createInventory(null, shulker.getInventory().getSize(), "IScontainerCheck");
|
||||
Inventory inv = Bukkit.createInventory(null, shulker.getInventory().getSize(),
|
||||
"IScontainerCheck");
|
||||
for (ItemStack itemStack1 : shulker.getInventory().getContents()) {
|
||||
|
||||
if (itemStack1 == null) {
|
||||
|
||||
continue;
|
||||
|
||||
}
|
||||
|
||||
tagSize = NBTStuff.isBadShulker(itemStack1);
|
||||
if (tagSize > 0 && IllegalStackAction.isCompleted(
|
||||
Protections.DestroyInvalidShulkers,
|
||||
itemStack1,
|
||||
shulker.getInventory()
|
||||
)) {
|
||||
if (tagSize > 0 && IllegalStackAction.isCompleted(Protections.DestroyInvalidShulkers,
|
||||
itemStack1, shulker.getInventory()))
|
||||
{
|
||||
|
||||
fListener.getLog().append(
|
||||
Msg.StaffBadShulkerRemoved.getValue(container.getLocation(), tagSize),
|
||||
Protections.DestroyInvalidShulkers
|
||||
);
|
||||
Protections.DestroyInvalidShulkers);
|
||||
itemStack1.setType(Material.AIR);
|
||||
remove = true;
|
||||
|
||||
}
|
||||
|
||||
if (!remove) {
|
||||
|
||||
remove = OverstackedItemCheck.CheckContainer(itemStack1, container);
|
||||
|
||||
}
|
||||
|
||||
if (!remove) {
|
||||
|
||||
remove = IllegalEnchantCheck.isIllegallyEnchanted(itemStack1, container);
|
||||
|
||||
}
|
||||
|
||||
if (!remove) {
|
||||
|
||||
remove = RemoveItemTypesCheck.shouldRemove(itemStack1, container);
|
||||
|
||||
}
|
||||
|
||||
if (remove) {
|
||||
|
||||
inv.removeItem(itemStack1);
|
||||
added = true;
|
||||
|
||||
}
|
||||
}
|
||||
if (added) {
|
||||
new BukkitRunnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
shulker.getInventory().setContents(inv.getContents());
|
||||
im.setBlockState(shulker);
|
||||
itemStack.setItemMeta(im);
|
||||
}
|
||||
}.runTaskLater(IllegalStack.getPlugin(), 4);
|
||||
return true;
|
||||
//shulk.update(true);
|
||||
//shulk.setBlockData(shulker.getBlockData());
|
||||
//im.setBlockState(shulk);
|
||||
|
||||
}
|
||||
|
||||
if (added) {
|
||||
|
||||
Scheduler.runTaskLater(IllegalStack.getPlugin(), () -> {
|
||||
|
||||
shulker.getInventory().setContents(inv.getContents());
|
||||
im.setBlockState(shulker);
|
||||
itemStack.setItemMeta(im);
|
||||
|
||||
}, 4, shulker.getLocation());
|
||||
return true;
|
||||
// shulk.update(true);
|
||||
// shulk.setBlockData(shulker.getBlockData());
|
||||
// im.setBlockState(shulk);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (OverstackedItemCheck.CheckContainer(itemStack, container)) {
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
if (IllegalEnchantCheck.isIllegallyEnchanted(itemStack, container)) {
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
public static boolean CheckEntireInventory(Inventory inv) {
|
||||
|
||||
for (int i = 0; i < inv.getContents().length; i++) {
|
||||
ItemStack is = inv.getContents()[i];
|
||||
boolean checkRemoveTypes = !Protections.RemoveItemTypes.getTxtSet().isEmpty();
|
||||
boolean checkEnchants = Protections.FixIllegalEnchantmentLevels.isEnabled();
|
||||
boolean checkAttributes = Protections.RemoveCustomAttributes.isEnabled();
|
||||
boolean checkOverstack = Protections.RemoveOverstackedItems.isEnabled();
|
||||
|
||||
if (!checkRemoveTypes && !checkEnchants && !checkAttributes && !checkOverstack) {
|
||||
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
for (ItemStack is : inv.getContents()) {
|
||||
|
||||
if (is == null) {
|
||||
|
||||
continue;
|
||||
|
||||
}
|
||||
if (RemoveItemTypesCheck.shouldRemove(is, inv)) {
|
||||
|
||||
if (checkRemoveTypes && RemoveItemTypesCheck.shouldRemove(is, inv)) {
|
||||
|
||||
return true;
|
||||
} else if (IllegalEnchantCheck.isIllegallyEnchanted(is, inv)) {
|
||||
|
||||
} else if (checkEnchants && IllegalEnchantCheck.isIllegallyEnchanted(is, inv)) {
|
||||
|
||||
return true;
|
||||
} else if (BadAttributeCheck.hasBadAttributes(is, inv)) {
|
||||
|
||||
} else if (checkAttributes && BadAttributeCheck.hasBadAttributes(is, inv)) {
|
||||
|
||||
return true;
|
||||
} else if (OverstackedItemCheck.CheckContainer(is, inv)) {
|
||||
|
||||
} else if (checkOverstack && OverstackedItemCheck.CheckContainer(is, inv)) {
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (!fListener.is18() && IllegalStack.hasStorage()) {
|
||||
if (checkOverstack && !fListener.is18() && IllegalStack.hasStorage()) {
|
||||
|
||||
for (ItemStack is : inv.getStorageContents()) {
|
||||
|
||||
if (OverstackedItemCheck.CheckContainer(is, inv)) {
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package main.java.me.dniym.checks;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
/**
|
||||
* Classifies payloads received through the creative-slot packet.
|
||||
*
|
||||
* <p>
|
||||
* Vanilla metadata is not itself evidence of an unsafe payload. Other
|
||||
* configured protections remain responsible for overstacked items, illegal
|
||||
* enchantments, banned types, and name or lore rules.
|
||||
* </p>
|
||||
*/
|
||||
public final class CreativeItemCheck {
|
||||
|
||||
private CreativeItemCheck() {
|
||||
|
||||
}
|
||||
|
||||
public static boolean hasUnsafePayload(ItemStack stack) {
|
||||
|
||||
if (stack == null || stack.getType() == Material.AIR) {
|
||||
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
return BadAttributeCheck.hasNonDefaultAttributeModifiers(stack);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
package main.java.me.dniym.checks;
|
||||
|
||||
import java.util.HashSet;
|
||||
import main.java.me.dniym.IllegalStack;
|
||||
import main.java.me.dniym.enums.Msg;
|
||||
import main.java.me.dniym.enums.Protections;
|
||||
@@ -13,137 +14,200 @@ import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import java.util.HashSet;
|
||||
|
||||
public class IllegalEnchantCheck {
|
||||
|
||||
public static boolean CheckForIllegalEnchants(ItemStack itemStack, Object obj) {
|
||||
|
||||
if (itemStack != null && (obj instanceof Inventory || obj instanceof Container)) {
|
||||
|
||||
return isIllegallyEnchanted(itemStack, obj);
|
||||
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
public static boolean CheckStorageInventory(Inventory inv, Player player) {
|
||||
|
||||
if (!IllegalStack.hasStorage()) {
|
||||
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
boolean invalid = false;
|
||||
for (ItemStack itemStack : inv.getStorageContents()) {
|
||||
if (itemStack != null && itemStack.getType() != Material.AIR && (invalid = isIllegallyEnchanted(
|
||||
itemStack,
|
||||
inv,
|
||||
true
|
||||
))) {
|
||||
fListener.getLog().append2(Msg.GenericItemRemoval.getValue(
|
||||
itemStack,
|
||||
Protections.FixIllegalEnchantmentLevels,
|
||||
player,
|
||||
"Crafting Inventory"
|
||||
));
|
||||
|
||||
if (itemStack != null && itemStack.getType() != Material.AIR
|
||||
&& (invalid = isIllegallyEnchanted(itemStack, inv, true)))
|
||||
{
|
||||
|
||||
fListener.getLog().append2(Msg.GenericItemRemoval.getValue(itemStack,
|
||||
Protections.FixIllegalEnchantmentLevels, player, "Crafting Inventory"));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return invalid;
|
||||
|
||||
}
|
||||
|
||||
public static boolean isIllegallyEnchanted(ItemStack itemStack, Object obj) {
|
||||
|
||||
return isIllegallyEnchanted(itemStack, obj, false);
|
||||
|
||||
}
|
||||
|
||||
public static boolean isIllegallyEnchanted(ItemStack itemStack, Object obj, boolean silent) {
|
||||
|
||||
if (itemStack == null) {
|
||||
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
if (Protections.FixIllegalEnchantmentLevels.isEnabled() && !itemStack.getEnchantments().isEmpty()) {
|
||||
if (!Protections.OnlyFunctionInWorlds.getTxtSet().isEmpty()) {//world list isnt empty
|
||||
if (Protections.FixIllegalEnchantmentLevels.isEnabled(obj) && !itemStack.getEnchantments().isEmpty()) {
|
||||
|
||||
if (!Protections.OnlyFunctionInWorlds.getTxtSet().isEmpty()) { // world list isnt empty
|
||||
|
||||
Location loc = null;
|
||||
|
||||
if (obj instanceof Inventory) {
|
||||
|
||||
loc = ((Inventory) obj).getLocation();
|
||||
|
||||
} else if (obj instanceof Location) {
|
||||
|
||||
loc = ((Location) obj);
|
||||
|
||||
} else if (obj instanceof Container) {
|
||||
|
||||
loc = ((Container) obj).getLocation();
|
||||
|
||||
}
|
||||
|
||||
if (loc != null && !Protections.OnlyFunctionInWorlds.getTxtSet().contains(loc
|
||||
.getWorld()
|
||||
.getName())) //isnt in a checked world
|
||||
if (loc != null && !Protections.OnlyFunctionInWorlds.getTxtSet().contains(loc.getWorld().getName())) // isnt
|
||||
// in
|
||||
// a
|
||||
// checked
|
||||
// world
|
||||
{
|
||||
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
HashSet<Enchantment> replace = new HashSet<>();
|
||||
for (Enchantment enchantment : itemStack.getEnchantments().keySet()) {
|
||||
|
||||
if (itemStack.getEnchantmentLevel(enchantment) > enchantment.getMaxLevel()) {
|
||||
|
||||
if (SlimefunCompat.isValid(itemStack, enchantment)) {
|
||||
|
||||
continue;
|
||||
|
||||
}
|
||||
|
||||
if (IllegalStack.isEpicRename() && ((enchantment == Enchantment.LURE || enchantment == Enchantment.ARROW_INFINITE) && itemStack
|
||||
.getEnchantmentLevel(
|
||||
enchantment) == 4341)) {
|
||||
if (IllegalStack.isEpicRename()
|
||||
&& ((enchantment == Enchantment.LURE || enchantment == Enchantment.ARROW_INFINITE)
|
||||
&& itemStack.getEnchantmentLevel(enchantment) == 4341))
|
||||
{
|
||||
|
||||
continue;
|
||||
|
||||
}
|
||||
|
||||
if (Protections.EnchantedItemWhitelist.isWhitelisted(itemStack)) {
|
||||
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
if (Protections.CustomEnchantOverride.isAllowedEnchant(
|
||||
enchantment,
|
||||
itemStack.getEnchantmentLevel(enchantment)
|
||||
)) {
|
||||
if (Protections.CustomEnchantOverride.isAllowedEnchant(enchantment,
|
||||
itemStack.getEnchantmentLevel(enchantment)))
|
||||
{
|
||||
|
||||
continue;
|
||||
|
||||
}
|
||||
|
||||
if (Protections.DestroyIllegallyEnchantedItemsInstead.isEnabled()) {
|
||||
if (Protections.DestroyIllegallyEnchantedItemsInstead.isEnabled(obj)) {
|
||||
|
||||
if (!silent) {
|
||||
fListener.getLog().append2(Msg.DestroyedEnchantedItem.getValue(obj, itemStack, enchantment));
|
||||
|
||||
fListener.getLog().append(Msg.DestroyedEnchantedItem.getValue(obj, itemStack, enchantment),
|
||||
Protections.DestroyIllegallyEnchantedItemsInstead);
|
||||
|
||||
}
|
||||
|
||||
itemStack.setType(Material.AIR);
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
if (enchantment.canEnchantItem(itemStack)) {
|
||||
|
||||
if (!silent) {
|
||||
fListener.getLog().append2(Msg.IllegalEnchantLevel.getValue(obj, itemStack, enchantment));
|
||||
|
||||
fListener.getLog().append(Msg.IllegalEnchantLevel.getValue(obj, itemStack, enchantment),
|
||||
Protections.FixIllegalEnchantmentLevels);
|
||||
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
if (!silent) {
|
||||
|
||||
fListener.getLog().append2(Msg.IllegalEnchantType.getValue(obj, itemStack, enchantment));
|
||||
|
||||
}
|
||||
|
||||
replace.add(enchantment);
|
||||
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
if (!enchantment.canEnchantItem(itemStack)) {
|
||||
|
||||
if (SlimefunCompat.isValid(itemStack, enchantment)) {
|
||||
|
||||
continue;
|
||||
|
||||
}
|
||||
|
||||
replace.add(enchantment);
|
||||
if (!silent) {
|
||||
|
||||
fListener.getLog().append2(Msg.IllegalEnchantType.getValue(obj, itemStack, enchantment));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
for (Enchantment en : replace) {
|
||||
|
||||
itemStack.removeEnchantment(en);
|
||||
if (en.canEnchantItem(itemStack)) {
|
||||
|
||||
itemStack.addEnchantment(en, en.getMaxLevel());
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -2,6 +2,7 @@ package main.java.me.dniym.checks;
|
||||
|
||||
import main.java.me.dniym.IllegalStack;
|
||||
import main.java.me.dniym.enums.Protections;
|
||||
import main.java.me.dniym.utils.Scheduler;
|
||||
import main.java.me.dniym.utils.SlimefunCompat;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.block.Block;
|
||||
@@ -11,124 +12,175 @@ import org.bukkit.enchantments.Enchantment;
|
||||
import org.bukkit.inventory.InventoryHolder;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.BlockStateMeta;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
public class IrritatingLegacyChecks {
|
||||
|
||||
public static boolean isIllegallyEnchanted(ItemStack itemStack) {
|
||||
|
||||
if (itemStack == null) {
|
||||
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
if (Protections.FixIllegalEnchantmentLevels.isEnabled() && !itemStack.getEnchantments().isEmpty()) {
|
||||
|
||||
for (Enchantment enchantment : itemStack.getEnchantments().keySet()) {
|
||||
|
||||
if (itemStack.getEnchantmentLevel(enchantment) > enchantment.getMaxLevel()) {
|
||||
|
||||
if (SlimefunCompat.isValid(itemStack, enchantment)) {
|
||||
|
||||
continue;
|
||||
|
||||
}
|
||||
|
||||
if (IllegalStack.isEpicRename() && ((enchantment == Enchantment.LURE || enchantment == Enchantment.ARROW_INFINITE) && itemStack
|
||||
.getEnchantmentLevel(
|
||||
enchantment) == 4341)) {
|
||||
if (IllegalStack.isEpicRename()
|
||||
&& ((enchantment == Enchantment.LURE || enchantment == Enchantment.ARROW_INFINITE)
|
||||
&& itemStack.getEnchantmentLevel(enchantment) == 4341))
|
||||
{
|
||||
|
||||
continue;
|
||||
|
||||
}
|
||||
|
||||
if (Protections.EnchantedItemWhitelist.isWhitelisted(itemStack)) {
|
||||
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
if (Protections.CustomEnchantOverride.isAllowedEnchant(
|
||||
enchantment,
|
||||
itemStack.getEnchantmentLevel(enchantment)
|
||||
)) {
|
||||
if (Protections.CustomEnchantOverride.isAllowedEnchant(enchantment,
|
||||
itemStack.getEnchantmentLevel(enchantment)))
|
||||
{
|
||||
|
||||
continue;
|
||||
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
} else {
|
||||
|
||||
if (!enchantment.canEnchantItem(itemStack)) {
|
||||
|
||||
if (SlimefunCompat.isValid(itemStack, enchantment)) {
|
||||
|
||||
continue;
|
||||
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
public static boolean CheckItem(ItemStack item, Location location) {
|
||||
|
||||
boolean cancel = false;
|
||||
|
||||
if (item.hasItemMeta() && IllegalStack.hasShulkers()) { //check for shulkers
|
||||
if (item.hasItemMeta() && IllegalStack.hasShulkers()) { // check for shulkers
|
||||
|
||||
final BlockStateMeta blockStateMeta = (BlockStateMeta) item.getItemMeta();
|
||||
if (blockStateMeta.getBlockState() instanceof ShulkerBox) {
|
||||
|
||||
final ShulkerBox shulker = (ShulkerBox) blockStateMeta.getBlockState();
|
||||
for (ItemStack itemStack : shulker.getInventory().getContents()) {
|
||||
|
||||
boolean overstacked = false;
|
||||
boolean illegalEnchanted = false;
|
||||
if (Protections.RemoveOverstackedItems.isEnabled()) {
|
||||
|
||||
overstacked = IrritatingLegacyChecks.CheckContainer(itemStack, location);
|
||||
|
||||
}
|
||||
|
||||
if (Protections.FixIllegalEnchantmentLevels.isEnabled()) {
|
||||
|
||||
illegalEnchanted = isIllegallyEnchanted(itemStack);
|
||||
|
||||
}
|
||||
|
||||
if (overstacked || illegalEnchanted) {
|
||||
|
||||
cancel = true;
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
} else { //should be a single item.
|
||||
|
||||
} else { // should be a single item.
|
||||
|
||||
cancel = CheckForOverstackedItems(item);
|
||||
|
||||
}
|
||||
|
||||
return cancel;
|
||||
|
||||
}
|
||||
|
||||
private static boolean CheckForOverstackedItems(ItemStack item) {
|
||||
|
||||
return item.getAmount() > item.getType().getMaxStackSize();
|
||||
|
||||
}
|
||||
|
||||
public static boolean CheckContainer(ItemStack itemStack, Location loc) {
|
||||
|
||||
if (itemStack == null) {
|
||||
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
if (itemStack.getAmount() > itemStack.getMaxStackSize()) {
|
||||
|
||||
return !Protections.AllowStack.isWhitelisted(itemStack.getType().name(), null);
|
||||
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
public static boolean CheckContainer(Block block) {
|
||||
|
||||
BlockState blockState = block.getState();
|
||||
boolean invalid = false;
|
||||
|
||||
if (blockState instanceof InventoryHolder) {
|
||||
for (ItemStack itemStack : ((InventoryHolder) blockState).getInventory()) {
|
||||
if (itemStack != null && CheckItem(itemStack, block.getLocation())) {
|
||||
new BukkitRunnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
((InventoryHolder) blockState).getInventory().removeItem(itemStack);
|
||||
}
|
||||
|
||||
}.runTaskLater(IllegalStack.getPlugin(), 2);
|
||||
for (ItemStack itemStack : ((InventoryHolder) blockState).getInventory()) {
|
||||
|
||||
if (itemStack != null && CheckItem(itemStack, block.getLocation())) {
|
||||
|
||||
Scheduler.runTaskLater(IllegalStack.getPlugin(), () -> {
|
||||
|
||||
((InventoryHolder) blockState).getInventory().removeItem(itemStack);
|
||||
|
||||
}, 2, blockState.getLocation());
|
||||
invalid = true;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
return invalid;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -15,93 +15,137 @@ public class OverstackedItemCheck {
|
||||
public static boolean CheckForOverstackedItems(ItemStack itemStack, Object obj) {
|
||||
|
||||
if (itemStack != null && (obj instanceof Inventory || obj instanceof Container)) {
|
||||
|
||||
return CheckContainer(itemStack, obj);
|
||||
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
public static boolean CheckStorageInventory(Inventory inv, Player player) {
|
||||
|
||||
if (!IllegalStack.hasStorage()) {
|
||||
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
for (ItemStack is : inv.getStorageContents()) {
|
||||
|
||||
if (is != null && is.getType() != Material.AIR && CheckContainer(is, inv, true)) {
|
||||
fListener.getLog().append2(Msg.GenericItemRemoval.getValue(
|
||||
is,
|
||||
Protections.RemoveOverstackedItems,
|
||||
player,
|
||||
"Crafting Inventory"
|
||||
));
|
||||
|
||||
fListener.getLog().append2(Msg.GenericItemRemoval.getValue(is, Protections.RemoveOverstackedItems,
|
||||
player, "Crafting Inventory"));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
public static boolean CheckContainer(ItemStack itemStack, Object obj) {
|
||||
|
||||
return CheckContainer(itemStack, obj, false);
|
||||
|
||||
}
|
||||
|
||||
public static boolean CheckContainer(ItemStack is, Object obj, Boolean silent) {
|
||||
|
||||
if (is == null) {
|
||||
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
if (is.getAmount() > is.getMaxStackSize()) {
|
||||
|
||||
if (!Protections.IllegalStackMode.isEnabled()) { //in blacklist mode and on the blacklist
|
||||
if (!Protections.IllegalStackMode.isEnabled()) { // in blacklist mode and on the blacklist
|
||||
|
||||
if (Protections.FixOverstackedItemInstead.isEnabled()) {
|
||||
|
||||
if (!silent) {
|
||||
fListener.getLog().append(
|
||||
Msg.IllegalStackShorten.getValue(obj, is),
|
||||
Protections.RemoveOverstackedItems
|
||||
);
|
||||
|
||||
fListener.getLog().append(Msg.IllegalStackShorten.getValue(obj, is),
|
||||
Protections.RemoveOverstackedItems);
|
||||
|
||||
}
|
||||
|
||||
is.setAmount(is.getType().getMaxStackSize());
|
||||
return true;
|
||||
|
||||
} else {
|
||||
|
||||
if (!silent) {
|
||||
fListener.getLog().append(
|
||||
Msg.IllegalStackItemScan.getValue(obj, is),
|
||||
Protections.RemoveOverstackedItems
|
||||
);
|
||||
|
||||
fListener.getLog().append(Msg.IllegalStackItemScan.getValue(obj, is),
|
||||
Protections.RemoveOverstackedItems);
|
||||
|
||||
}
|
||||
|
||||
if (obj instanceof Inventory) {
|
||||
|
||||
((Inventory) obj).remove(is);
|
||||
|
||||
} else {
|
||||
|
||||
((Container) obj).getInventory().remove(is);
|
||||
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (Protections.AllowStack.isWhitelisted(is.getType().name(), null)) {
|
||||
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
if (Protections.FixOverstackedItemInstead.isEnabled()) {
|
||||
|
||||
if (!silent) {
|
||||
|
||||
fListener.getLog().append2(Msg.IllegalStackShorten.getValue(obj, is));
|
||||
|
||||
}
|
||||
|
||||
is.setAmount(is.getType().getMaxStackSize());
|
||||
|
||||
return true;
|
||||
|
||||
} else {
|
||||
|
||||
if (!silent) {
|
||||
|
||||
fListener.getLog().append2(Msg.IllegalStackItemScan.getValue(obj, is));
|
||||
|
||||
}
|
||||
|
||||
if (obj instanceof Inventory) {
|
||||
|
||||
((Inventory) obj).remove(is);
|
||||
|
||||
} else {
|
||||
|
||||
((Container) obj).getInventory().remove(is);
|
||||
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -13,41 +13,58 @@ public class RemoveItemTypesCheck {
|
||||
|
||||
public static boolean CheckForIllegalTypes(ItemStack itemStack, Object obj) {
|
||||
|
||||
if (itemStack != null && (obj instanceof Inventory || (IllegalStack.hasContainers() && obj instanceof Container))) {
|
||||
if (itemStack != null
|
||||
&& (obj instanceof Inventory || (IllegalStack.hasContainers() && obj instanceof Container)))
|
||||
{
|
||||
|
||||
if (shouldRemove(itemStack, obj)) {
|
||||
|
||||
if (obj instanceof Inventory) {
|
||||
|
||||
((Inventory) obj).remove(itemStack);
|
||||
|
||||
} else {
|
||||
|
||||
((Container) obj).getInventory().remove(itemStack);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
public static boolean shouldRemove(Material type) {
|
||||
|
||||
return Protections.RemoveItemTypes.isWhitelisted(type);
|
||||
|
||||
}
|
||||
|
||||
public static boolean shouldRemove(ItemStack itemStack, Object obj) {
|
||||
|
||||
|
||||
if (Protections.RemoveItemTypes.isWhitelisted(itemStack)) {
|
||||
|
||||
if (obj != null && Protections.RemoveItemTypes.notifyOnly()) {
|
||||
fListener.getLog().notify(
|
||||
Protections.RemoveItemTypes,
|
||||
" Triggered by: a container with item: " + itemStack.getType().name()
|
||||
);
|
||||
|
||||
fListener.getLog().notify(Protections.RemoveItemTypes,
|
||||
" Triggered by: a container with item: " + itemStack.getType().name());
|
||||
return false;
|
||||
|
||||
} else if (obj != null) {
|
||||
|
||||
fListener.getLog().append2(Msg.ItemTypeRemoved.getValue(obj, itemStack, null));
|
||||
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,9 +1,13 @@
|
||||
package main.java.me.dniym.commands;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import main.java.me.dniym.IllegalStack;
|
||||
import main.java.me.dniym.enums.Msg;
|
||||
import main.java.me.dniym.enums.Protections;
|
||||
import main.java.me.dniym.listeners.fListener;
|
||||
import main.java.me.dniym.utils.Scheduler;
|
||||
import main.java.me.dniym.utils.SpigotMethods;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Location;
|
||||
@@ -11,205 +15,320 @@ import org.bukkit.World;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.command.TabCompleter;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.HashSet;
|
||||
|
||||
public class IllegalStackCommand implements CommandExecutor {
|
||||
public class IllegalStackCommand implements CommandExecutor, TabCompleter {
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
|
||||
if (args.length == 1) {
|
||||
|
||||
if (args[0].equalsIgnoreCase("reload")) {
|
||||
|
||||
if (!hasPerm(sender, "illegalstack.admin")) {
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
sender.sendMessage(ChatColor.GREEN + "[IllegalStack] - All configuration settings have been reloaded.");
|
||||
IllegalStack.ReloadConfig(true);
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (args.length >= 1) {
|
||||
|
||||
if (args[0].toLowerCase().startsWith("ver")) {
|
||||
|
||||
if (!hasPerm(sender, "illegalstack.admin")) {
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
String ver = IllegalStack.getPlugin().getDescription().getVersion();
|
||||
sender.sendMessage(ChatColor.AQUA + "-----===== Illegal Stack (" + ver + ") =====-----");
|
||||
sender.sendMessage(ChatColor.GOLD + " Detected Server Version: " + IllegalStack.getVersion() + (IllegalStack.isSpigot()
|
||||
? ""
|
||||
: "Spigot"));
|
||||
sender.sendMessage(ChatColor.GOLD + " Detected Server Version: " + IllegalStack.getVersion()
|
||||
+ (IllegalStack.isSpigot() ? "" : "Spigot"));
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
if (args[0].toLowerCase().startsWith("fix")) {
|
||||
|
||||
if (sender instanceof Player) {
|
||||
|
||||
if (sender.hasPermission("IllegalStack.fixCommand")) {
|
||||
|
||||
Protections.fixEnchants(((Player) sender));
|
||||
|
||||
} else {
|
||||
|
||||
sender.sendMessage("You don't have permission to force fix enchantment levels on an item.");
|
||||
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
sender.sendMessage("This command can only be used in game by a player.");
|
||||
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
if (args[0].toLowerCase().startsWith("prot")) {
|
||||
|
||||
if (!hasPerm(sender, "illegalstack.admin")) {
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
sender.sendMessage(ChatColor.AQUA + "-----===== Illegal Stack Protections =====-----");
|
||||
sender.sendMessage(ChatColor.GOLD + " Detected Server Version: " + IllegalStack.getVersion() + (IllegalStack.isSpigot()
|
||||
? ""
|
||||
: "Spigot"));
|
||||
sender.sendMessage(ChatColor.GOLD + " Detected Server Version: " + IllegalStack.getVersion()
|
||||
+ (IllegalStack.isSpigot() ? "" : "Spigot"));
|
||||
sender.sendMessage(ChatColor.AQUA + "-" + " Version Specific Protections -");
|
||||
int parentId = 0;
|
||||
int catId = 0;
|
||||
if (args.length >= 2) {
|
||||
try {
|
||||
catId = Integer.parseInt(args[1].trim());
|
||||
} catch (NumberFormatException ex) {
|
||||
|
||||
}
|
||||
}
|
||||
if (args.length == 3) {
|
||||
try {
|
||||
parentId = Integer.parseInt(args[2].trim());
|
||||
} catch (NumberFormatException ex) {
|
||||
|
||||
}
|
||||
}
|
||||
for (Protections p : Protections.values()) {
|
||||
if (!p.getCommand().isEmpty()) {
|
||||
continue;
|
||||
}
|
||||
if (p.isVersionSpecific(IllegalStack.getVersion()) && p.isRelevantToVersion(IllegalStack.getVersion()) && p.getCatId() != 2) {
|
||||
sendProtection(sender, p, parentId, catId);
|
||||
|
||||
try {
|
||||
|
||||
catId = Integer.parseInt(args[1].trim());
|
||||
|
||||
} catch (NumberFormatException ex) {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//sender.sendMessage(ChatColor.AQUA + "- Multi-Version Protections -");
|
||||
if (args.length == 3) {
|
||||
|
||||
try {
|
||||
|
||||
parentId = Integer.parseInt(args[2].trim());
|
||||
|
||||
} catch (NumberFormatException ex) {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
for (Protections p : Protections.values()) {
|
||||
|
||||
if (!p.getCommand().isEmpty()) {
|
||||
|
||||
continue;
|
||||
|
||||
}
|
||||
|
||||
if (p.isVersionSpecific(IllegalStack.getVersion())
|
||||
&& p.isRelevantToVersion(IllegalStack.getVersion()) && p.getCatId() != 2)
|
||||
{
|
||||
|
||||
sendProtection(sender, p, parentId, catId);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// sender.sendMessage(ChatColor.AQUA + "- Multi-Version Protections -");
|
||||
sendCategory(sender, "Multi-Version Protections", (catId == 1), 1);
|
||||
if (catId == 1) {
|
||||
|
||||
for (Protections p : Protections.values()) {
|
||||
|
||||
if (!p.getCommand().isEmpty() || p.getCatId() == 2) {
|
||||
|
||||
continue;
|
||||
|
||||
}
|
||||
if (p.isRelevantToVersion(IllegalStack.getVersion()) && !p.isVersionSpecific(IllegalStack.getVersion())) {
|
||||
|
||||
if (p.isRelevantToVersion(IllegalStack.getVersion())
|
||||
&& !p.isVersionSpecific(IllegalStack.getVersion()))
|
||||
{
|
||||
|
||||
sendProtection(sender, p, parentId, catId);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
sendCategory(sender, "Misc / User Requested Features", (catId == 2), 2);
|
||||
//sender.sendMessage(ChatColor.AQUA + "- Misc / User Requested Features -");
|
||||
// sender.sendMessage(ChatColor.AQUA + "- Misc / User Requested Features -");
|
||||
if (catId == 2) {
|
||||
|
||||
for (Protections p : Protections.values()) {
|
||||
|
||||
if (!p.getCommand().isEmpty()) {
|
||||
|
||||
continue;
|
||||
|
||||
}
|
||||
|
||||
if (p.isRelevantToVersion(IllegalStack.getVersion()) && p.getCatId() == catId) {
|
||||
|
||||
sendProtection(sender, p, parentId, catId);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (args.length == 1) {
|
||||
|
||||
if (args[0].equalsIgnoreCase("enchantwhitelistmode")) {
|
||||
|
||||
if (sender instanceof Player) {
|
||||
|
||||
Player plr = (Player) sender;
|
||||
if (!fListener.getInstance().getItemWatcher().remove(plr)) {
|
||||
|
||||
fListener.getInstance().getItemWatcher().add(plr);
|
||||
plr.sendMessage(Msg.StaffEnchantBypass.getValue());
|
||||
return true;
|
||||
|
||||
} else {
|
||||
|
||||
plr.sendMessage(Msg.StaffEnchantBypassCancel.getValue());
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (args.length >= 2) {
|
||||
|
||||
if (args[0].equalsIgnoreCase("teleport")) {
|
||||
|
||||
if (!hasPerm(sender, "illegalstack.notify")) {
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
if (sender instanceof Player) {
|
||||
|
||||
if (args.length >= 4) {
|
||||
|
||||
World w = IllegalStack.getPlugin().getServer().getWorld(args[4]);
|
||||
Location loc = new Location(
|
||||
w,
|
||||
Integer.parseInt(args[1]),
|
||||
Integer.parseInt(args[2]),
|
||||
Integer.parseInt(args[3])
|
||||
);
|
||||
((Player) sender).teleport(loc);
|
||||
Location loc = new Location(w, Integer.parseInt(args[1]), Integer.parseInt(args[2]),
|
||||
Integer.parseInt(args[3]));
|
||||
if (Scheduler.FOLIA) {
|
||||
|
||||
((Player) sender).teleportAsync(loc);
|
||||
|
||||
} else {
|
||||
|
||||
((Player) sender).teleport(loc);
|
||||
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
sender.sendMessage("This command can only be used by players.");
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (args[0].equalsIgnoreCase("toggle")) {
|
||||
|
||||
if (!hasPerm(sender, "illegalstack.admin")) {
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
Protections p = Protections.getProtection(args[1]);
|
||||
if (p != null) {
|
||||
|
||||
p.toggleProtection();
|
||||
String status = "ON";
|
||||
if (!p.isEnabled()) {
|
||||
|
||||
status = "OFF";
|
||||
|
||||
}
|
||||
|
||||
fListener.getLog().append2(Msg.StaffProtectionToggleMsg.getValue(p, sender.getName(), status));
|
||||
refreshCommands(sender);
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (args.length >= 4) {
|
||||
|
||||
if (!hasPerm(sender, "illegalstack.admin")) {
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
if (args[0].equalsIgnoreCase("value")) {
|
||||
|
||||
Protections pro = Protections.getProtection(args[2]);
|
||||
if (pro == null) {
|
||||
|
||||
sender.sendMessage(Msg.StaffInvalidProtectionMsg.getValue());
|
||||
StringBuilder prots = new StringBuilder();
|
||||
for (Protections p : Protections.values()) {
|
||||
|
||||
if (p.isList()) {
|
||||
|
||||
prots.append(p.name()).append(", ");
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
sender.sendMessage(ChatColor.GRAY + prots.toString());
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
if (args[1].equalsIgnoreCase("remove")) {
|
||||
|
||||
StringBuilder val = new StringBuilder(args[3].trim());
|
||||
if (args.length >= 4) {
|
||||
|
||||
val = new StringBuilder();
|
||||
for (int i = 3; i < args.length; i++) {
|
||||
|
||||
val.append(args[i]).append(" ");
|
||||
|
||||
}
|
||||
|
||||
val = new StringBuilder(val.toString().trim());
|
||||
@@ -217,102 +336,160 @@ public class IllegalStackCommand implements CommandExecutor {
|
||||
}
|
||||
|
||||
pro.remTxtSet(val.toString(), sender);
|
||||
//refreshCommands(sender);
|
||||
// refreshCommands(sender);
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
if (args[1].equalsIgnoreCase("add")) {
|
||||
|
||||
if (pro.validate(args[3].trim(), sender)) {
|
||||
|
||||
sender.sendMessage(Msg.StaffOptionUpdated.getValue());
|
||||
//refreshCommands(sender);
|
||||
|
||||
// refreshCommands(sender);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (args.length > 0) {
|
||||
|
||||
if (args[0].equalsIgnoreCase("toggle")) {
|
||||
|
||||
if (!hasPerm(sender, "illegalstack.admin")) {
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
sender.sendMessage(ChatColor.AQUA + "-----===== Available Protection Toggles =====-----");
|
||||
StringBuilder prots = new StringBuilder();
|
||||
for (Protections p : Protections.values()) {
|
||||
|
||||
if (p.getParentId() == 0) {
|
||||
|
||||
prots.append(p.name()).append(", ");
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
sender.sendMessage(ChatColor.GRAY + prots.toString());
|
||||
sender.sendMessage(ChatColor.GOLD + "/istack toggle <protection>" + ChatColor.GRAY + " - Toggles a protection on/off");
|
||||
sender.sendMessage(ChatColor.GOLD + "/istack toggle <protection>" + ChatColor.GRAY
|
||||
+ " - Toggles a protection on/off");
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
if (args[0].equalsIgnoreCase("value")) {
|
||||
|
||||
if (!hasPerm(sender, "illegalstack.admin")) {
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
if (args.length > 3 && args[1].equalsIgnoreCase("add")) {
|
||||
|
||||
Protections pro = Protections.getProtection(args[2]);
|
||||
if (pro != Protections.ItemNamesToRemove && pro != Protections.ItemLoresToRemove) {
|
||||
|
||||
sender.sendMessage(Msg.StaffSingleWordsOnly.getValue());
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
StringBuilder text = new StringBuilder();
|
||||
for (int i = 3; i < args.length; i++) {
|
||||
|
||||
text.append(args[i]).append(" ");
|
||||
|
||||
}
|
||||
|
||||
if (pro.validate(text.toString().trim(), sender)) {
|
||||
|
||||
sender.sendMessage(Msg.StaffStringUpdated.getValue(text.toString()));
|
||||
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
if (args.length > 3 && args[1].equalsIgnoreCase("set")) {
|
||||
|
||||
Protections pro = Protections.getProtection(args[2]);
|
||||
StringBuilder text = new StringBuilder();
|
||||
for (int i = 3; i < args.length; i++) {
|
||||
|
||||
text.append(args[i]).append(" ");
|
||||
|
||||
}
|
||||
|
||||
if (pro.validate(text.toString(), sender)) {
|
||||
|
||||
sender.sendMessage(Msg.StaffOptionUpdated.getValue());
|
||||
//refreshCommands(sender);
|
||||
|
||||
// refreshCommands(sender);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
sender.sendMessage(ChatColor.AQUA + "-----===== Available Protection Options =====-----");
|
||||
sender.sendMessage(ChatColor.GOLD + "/istack values < set | remove > <protection>" + ChatColor.GRAY + " - Add/Remove a value from a protection's list");
|
||||
sender.sendMessage(ChatColor.GOLD + "/istack values < set | remove > <protection>" + ChatColor.GRAY
|
||||
+ " - Add/Remove a value from a protection's list");
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
sender.sendMessage(ChatColor.AQUA + "Illegal Stack - Available Commands");
|
||||
sender.sendMessage(ChatColor.GOLD + "/istack protections" + ChatColor.GRAY + " Shows Protection Status'");
|
||||
sender.sendMessage(ChatColor.GOLD + "/istack toggle <protection>" + ChatColor.GRAY + " - Toggles a protection on/off");
|
||||
sender.sendMessage(
|
||||
ChatColor.GOLD + "/istack toggle <protection>" + ChatColor.GRAY + " - Toggles a protection on/off");
|
||||
sender.sendMessage(ChatColor.GOLD + "/istack reload" + ChatColor.GRAY + " - Reloads config from config.yml");
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
private boolean hasPerm(CommandSender sender, String perm) {
|
||||
|
||||
if (sender.hasPermission(perm)) {
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
sender.sendMessage(Msg.StaffMsgNoPerm.getValue(perm));
|
||||
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
private void sendCategory(CommandSender sender, String category, Boolean show, int catId) {
|
||||
|
||||
Player plr = null;
|
||||
if (sender instanceof Player) {
|
||||
|
||||
plr = (Player) sender;
|
||||
|
||||
}
|
||||
|
||||
if (IllegalStack.isSpigot() && plr != null) {
|
||||
|
||||
plr.spigot().sendMessage(SpigotMethods.makeCategoryText(category, show, catId));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void sendProtection(CommandSender sender, Protections p, int parentId, int catId) {
|
||||
@@ -321,55 +498,115 @@ public class IllegalStackCommand implements CommandExecutor {
|
||||
String status = ChatColor.GREEN + " ON";
|
||||
Player plr = null;
|
||||
if (sender instanceof Player) {
|
||||
|
||||
plr = (Player) sender;
|
||||
|
||||
}
|
||||
|
||||
if (!p.isEnabled()) {
|
||||
|
||||
status = ChatColor.DARK_RED + "OFF";
|
||||
|
||||
}
|
||||
|
||||
if (IllegalStack.isSpigot() && plr != null) {
|
||||
|
||||
boolean hasKids = false;
|
||||
HashSet<Protections> kids = new HashSet<>();
|
||||
for (Protections child : Protections.values()) {
|
||||
|
||||
if (child.getParentId() == p.getProtId()) {
|
||||
|
||||
hasKids = true;
|
||||
kids.add(child);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
plr.spigot().sendMessage(SpigotMethods.makeParentText(p, status, hasKids, catId));
|
||||
for (Protections child : kids) {
|
||||
|
||||
if (parentId != 0 && parentId == p.getProtId()) {
|
||||
|
||||
plr.spigot().sendMessage(SpigotMethods.makeChildText(child, catId));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
if (!p.isList()) {
|
||||
sender.sendMessage(ChatColor.GOLD + "[" + status + ChatColor.GOLD + "] " + ChatColor.DARK_AQUA + "" + p.getDisplayName() + "");
|
||||
|
||||
sender.sendMessage(ChatColor.GOLD + "[" + status + ChatColor.GOLD + "] " + ChatColor.DARK_AQUA + ""
|
||||
+ p.getDisplayName() + "");
|
||||
|
||||
} else {
|
||||
sender.sendMessage(ChatColor.DARK_GRAY + "[" + " " + ChatColor.DARK_GRAY + "] " + ChatColor.DARK_AQUA + "" + p.getDisplayName() + " " + p
|
||||
.findValue());
|
||||
|
||||
sender.sendMessage(ChatColor.DARK_GRAY + "[" + " " + ChatColor.DARK_GRAY + "] " + ChatColor.DARK_AQUA
|
||||
+ "" + p.getDisplayName() + " " + p.findValue());
|
||||
|
||||
}
|
||||
|
||||
for (Protections child : Protections.values()) {
|
||||
|
||||
if (child.getParentId() == p.getProtId()) {
|
||||
sender.sendMessage(ChatColor.AQUA + "-> " + ChatColor.DARK_AQUA + child.getDisplayName() + " " + ChatColor.GRAY + child
|
||||
.findValue());
|
||||
|
||||
sender.sendMessage(ChatColor.AQUA + "-> " + ChatColor.DARK_AQUA + child.getDisplayName() + " "
|
||||
+ ChatColor.GRAY + child.findValue());
|
||||
line = false;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (line) {
|
||||
|
||||
sender.sendMessage(" ");
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void refreshCommands(final CommandSender sender) {
|
||||
new BukkitRunnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
IllegalStack.getPlugin().getServer().dispatchCommand(sender, "istack prot");
|
||||
|
||||
Scheduler.runTaskLater(IllegalStack.getPlugin(),
|
||||
() -> IllegalStack.getPlugin().getServer().dispatchCommand(sender, "istack prot"), 5);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public @Nullable List<String> onTabComplete(@NotNull final CommandSender sender, @NotNull final Command command,
|
||||
@NotNull final String label, final @NotNull String[] args)
|
||||
{
|
||||
|
||||
List<String> arguments = new ArrayList<>();
|
||||
arguments.add("protections");
|
||||
arguments.add("toggle");
|
||||
arguments.add("reload");
|
||||
|
||||
List<String> result = new ArrayList<>();
|
||||
if (args.length == 1) {
|
||||
|
||||
for (String a : arguments) {
|
||||
|
||||
if (a.toLowerCase().startsWith(args[0].toLowerCase())) {
|
||||
|
||||
result.add(a);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}.runTaskLater(IllegalStack.getPlugin(), 5);
|
||||
|
||||
return result;
|
||||
|
||||
}
|
||||
|
||||
return null;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -18,22 +18,22 @@ import org.bukkit.inventory.ItemStack;
|
||||
|
||||
public enum Msg {
|
||||
|
||||
//@ Location of offense
|
||||
//~name~ name of player or entity
|
||||
//~contents~ contents of an item frame
|
||||
//~removedblocks~ blocked removed
|
||||
//~author~ book author
|
||||
//~blockType block type
|
||||
//~item~
|
||||
// @ Location of offense
|
||||
// ~name~ name of player or entity
|
||||
// ~contents~ contents of an item frame
|
||||
// ~removedblocks~ blocked removed
|
||||
// ~author~ book author
|
||||
// ~blockType block type
|
||||
// ~item~
|
||||
|
||||
PluginPrefix("[IllegalStack] -"),
|
||||
PluginTeleportText(ChatColor.GOLD + "Click to teleport here"),
|
||||
PluginPrefix("[IllegalStack] -"), PluginTeleportText(ChatColor.GOLD + "Click to teleport here"),
|
||||
|
||||
ChestRemoved("removed a chest from a ~entity~ @"),
|
||||
ChestPrevented("prevented ~player~ from putting a chest on a ~entity~ @"),
|
||||
StaffChestPunishment(
|
||||
"punished ~player~ for continuing to try to put chests on a creature. A ~entity~ was removed, the player's inventory has been cleared and the player has been kicked from the server. @"),
|
||||
BookRemoved("Found a book with characters that do NOT match the specified character set and removed it.. Author was: ~author~"),
|
||||
BookRemoved(
|
||||
"Found a book with characters that do NOT match the specified character set and removed it.. Author was: ~author~"),
|
||||
TooManyPages("Found a book with too many pages and removed it from the inventory of ~name~"),
|
||||
SignRemoved("Found a sign not matching the allowed character set in the world @"),
|
||||
SignRemovedOnPlace(
|
||||
@@ -59,6 +59,7 @@ public enum Msg {
|
||||
ItemTypeRemovedPlayerOnPlace("~name~ attempted to place a blacklisted item type: ~item~, it has been removed"),
|
||||
ItemTypeRemovedPlayerOnDrop("~name~ attempted to drop a blacklisted item type: ~item~, it has been removed"),
|
||||
ItemTypeRemoved("Found a blacklisted item type: ~item~ in ~player~'s inventory, it has been removed"),
|
||||
VexEjected("Found a vex trapped in a boat, it has been set free @"),
|
||||
SilkTouchBookBlocked("Stopped ~name~ from breaking ~block~ using a silk touch book @"),
|
||||
|
||||
PistonHeadRemoval("A piston head was exploded.. removing an orphan piston base @"),
|
||||
@@ -72,18 +73,23 @@ public enum Msg {
|
||||
IllegalStackUnstack(
|
||||
"Unstacked an illegal stack of: ~item~ (~amount~) triggered by player: ~name~. ~lost~ items were unable to fit and lost."),
|
||||
InvalidPotionRemoved("Removed invalid potion from ~name~ had the following effects: ~effects~"),
|
||||
InvalidThrownPotionRemoved("Removed an invalid potion thrown by ~name~ with the following effects: ~effects~"),
|
||||
|
||||
UnbreakableItemCleared("Removed Unbreakable flag from ~item~ found on player ~name~"),
|
||||
CustomAttribsRemoved("Removed Custom Attributes on ~item~ held by ~name~ (~attributes~)"),
|
||||
CustomAttribsRemoved2("Removed ~item~ with Custom Attributes worn by ~name~ (~attributes~)"),
|
||||
CustomAttribsRemoved3("Removed ~item~ with Custom attributes found in ~name~'s inventory (~attributes~)"),
|
||||
GlideActivateMaxBuild("Prevented ~name~ from activating an elytra while above the max build height. @"),
|
||||
GlideAboveMaxBuild("Player ~name~ was using an elytra above the max build height, disabling glide. @"),
|
||||
CorrectedPlayerLocation("(possible pearl glitch into block) Corrected an enderpearl teleport location for ~player~ @"),
|
||||
CorrectedPlayerLocation(
|
||||
"(possible pearl glitch into block) Corrected an enderpearl teleport location for ~player~ @"),
|
||||
StoppedPushableArmorStand("Prevented an armor stand from being lifted straight up via a piston @"),
|
||||
StoppedPushableEntity("Prevented an entity (armor stand/end crystal) from being pushed into another entity @"),
|
||||
RemovedRenamedItem("Removed a renamed item ~item~ from the inventory of ~name~"),
|
||||
BlockedTripwireDupe(
|
||||
"Player ~name~ attempted to place a tripwire hook on a trap door, it has been removed (PreventTripwireDupe = true)"),
|
||||
BlockedStringDupe("Removed a string that would have been broken by water.. Possible string dupe @"),
|
||||
|
||||
GenericItemRemoval("~item~ removed by protection ~protection~, found on source ~source~"),
|
||||
PlayerTrappedPortalMsg(
|
||||
"&cSorry ~name~ but that portal appears to not have a valid exit! You would be trapped if you went through it!"),
|
||||
@@ -103,13 +109,16 @@ public enum Msg {
|
||||
PlayerEnchantBlocked("&cSorry ~name~ Enchanting this item is not permitted."),
|
||||
PlayerRepairBlocked("&cSorry ~name~ Repairing this item is not permitted."),
|
||||
PlayerSpawnEggBlock("&cSorry you can not use spawn eggs to change spawner types!"),
|
||||
PlayerItemCraftPrevented("&cSorry ~name~ you can not craft that item!"),
|
||||
|
||||
StaffMsgChangedSpawnerType("Player ~player~ used ~type~ to change a spawner type @"),
|
||||
StaffMsgEndGatewayVehicleRemoved("player ~name~ attempted to take a ~vehicle~ through an end gateway, it has been removed."),
|
||||
StaffMsgEndGatewayVehicleRemoved(
|
||||
"player ~name~ attempted to take a ~vehicle~ through an end gateway, it has been removed."),
|
||||
StaffMsgBlockedPortalLogin("broke a trapped nether portal @"),
|
||||
StaffMsgBlockedPortal("~player~ was prevented from going through a blocked/trapped nether portal @"),
|
||||
StaffMsgDropperExploit("Detected a hopper/dropper loop exploit and removed a dispenser/dropper @"),
|
||||
StaffMsgDispenerFlint("Detected a downward facing dispenser from dispensing flint and steel which would crash the server @"),
|
||||
StaffMsgDispenerFlint(
|
||||
"Detected a downward facing dispenser from dispensing flint and steel which would crash the server @"),
|
||||
StaffMsgSpawnerReset("A ~type~ spawner was reset to a pig spawner when broken by ~name~ @"),
|
||||
StaffMsgSpawnerOnSpawnReset("A ~type~ spawner was reset to a pig spawner when it tried to spawn a creature. @"),
|
||||
StaffMsgCreativeBlock("~name~ was prevented from loading in an illegal item via the creative saved toolbar."),
|
||||
@@ -128,12 +137,14 @@ public enum Msg {
|
||||
StaffEnchantBypassCancel("&cEnchantedItemWhitelist add item mode DISABLED."),
|
||||
StaffEnchantBypassAdded("&aAdded ~itemdata~ to the EnchantedItemWhitelist!"),
|
||||
StaffSpamFishingNotice("&a~player~ is spam fishing! ~casts~ casts without a 2 second break! @"),
|
||||
StaffAutoFishingNotice("&a~player~ appears to be using an autofishing mod.. ~count~ caught within 0.3 blocks of each other @"),
|
||||
StaffBadShulkerRemoved("Removed a hacked shulker box with an excessive amount of items in it (~size~) from ~name~ @"),
|
||||
StaffBadShulkerInWorld("Removed a dropped shulker box with an excessive amount of items in it (~size~) from the world: @"),
|
||||
StaffAutoFishingNotice(
|
||||
"&a~player~ appears to be using an autofishing mod.. ~count~ caught within 0.3 blocks of each other @"),
|
||||
StaffBadShulkerRemoved(
|
||||
"Removed a hacked shulker box with an excessive amount of items in it (~size~) from ~name~ @"),
|
||||
StaffBadShulkerInWorld(
|
||||
"Removed a dropped shulker box with an excessive amount of items in it (~size~) from the world: @"),
|
||||
StaffNoItem("You must be holding an item in your main hand to force fix it's enchantment!"),
|
||||
StaffNoEnchants("This item has no enchants to fix!"),
|
||||
StaffEnchantFixed("Corrected ~amount~ enchants on ~item~"),
|
||||
StaffNoEnchants("This item has no enchants to fix!"), StaffEnchantFixed("Corrected ~amount~ enchants on ~item~"),
|
||||
StaffNoNBTAPI(
|
||||
"NBT-Api was not found on your server and is needed for ~prot~ since it is enabled! Please download and install it from: https://www.spigotmc.org/resources/nbt-api.7939/"),
|
||||
StaffEnchantNotFixed("IllegalStack did not detect any invalid enchantments on this item."),
|
||||
@@ -143,17 +154,22 @@ public enum Msg {
|
||||
DestroyedEnchantedItem("Destroyed an Illegally Enchanted Item ~item~ ~enchant~.(~lvl) found on player: ~player~"),
|
||||
IllegalEnchantLevel("&aFixed Enchantment Level ~enchant~.(~lvl~) on ~item~ found on player: ~player~"),
|
||||
IllegalEnchantType(
|
||||
"&aCould not fix Enchantment ~enchant~.(~lvl~) on ~item~ found on player: ~player~ this enchantment is not valid for this item type!");
|
||||
"&aCould not fix Enchantment ~enchant~.(~lvl~) on ~item~ found on player: ~player~ this enchantment is not valid "
|
||||
+ "for this item type!"),
|
||||
PreventedItemCraft("~player~ was prevented from crafting ~item~ as per DisableCraftingRecipes settings");
|
||||
|
||||
private static final Logger LOGGER = LogManager.getLogger("IllegalStack/" + Msg.class.getSimpleName());
|
||||
|
||||
private String value;
|
||||
|
||||
Msg(String val) {
|
||||
|
||||
this.setValue(val);
|
||||
|
||||
}
|
||||
|
||||
public String getValue(String variable) {
|
||||
|
||||
String val = value;
|
||||
val = val.replace("~perm~", variable);
|
||||
val = val.replace("~prot~", variable);
|
||||
@@ -164,9 +180,11 @@ public enum Msg {
|
||||
val = val.replace("@", "@" + variable);
|
||||
val = val.replace("~value~", variable);
|
||||
return ChatColor.translateAlternateColorCodes('&', val);
|
||||
|
||||
}
|
||||
|
||||
public String getValue(Location location, String types) {
|
||||
|
||||
String val = value;
|
||||
val = val.replace("@", "@ " + location.toString());
|
||||
val = val.replace("~removedblocks~", types);
|
||||
@@ -174,22 +192,28 @@ public enum Msg {
|
||||
val = val.replace("~item~", types);
|
||||
val = val.replace("~name~", types);
|
||||
return ChatColor.translateAlternateColorCodes('&', val);
|
||||
|
||||
}
|
||||
|
||||
public String getValue(ItemStack is, Protections prot, Player plr, String source) {
|
||||
|
||||
String val = value;
|
||||
|
||||
val = val.replace("~item~", is.getType().name());
|
||||
val = val.replace("~protection~", prot.getDisplayName());
|
||||
val = val.replace("~source~", source);
|
||||
if (plr != null) {
|
||||
|
||||
val = plr.getName() + " - " + val;
|
||||
|
||||
}
|
||||
|
||||
return ChatColor.translateAlternateColorCodes('&', val);
|
||||
|
||||
}
|
||||
|
||||
public String getValue(Player player, String displayName) {
|
||||
|
||||
String val = value;
|
||||
val = val.replace("@", "@ " + player.getLocation());
|
||||
val = val.replace("~item~", displayName);
|
||||
@@ -199,42 +223,52 @@ public enum Msg {
|
||||
val = val.replace("~block~", displayName);
|
||||
val = val.replace("~effects~", displayName);
|
||||
return ChatColor.translateAlternateColorCodes('&', val);
|
||||
|
||||
}
|
||||
|
||||
public String getValue(HumanEntity le, String value) {
|
||||
|
||||
String val = value;
|
||||
|
||||
val = val.replace("~author~", value);
|
||||
val = val.replace("~name~", le.getName());
|
||||
return val;
|
||||
|
||||
}
|
||||
|
||||
public String getValue(Player p, Location loc) {
|
||||
|
||||
String val = value;
|
||||
|
||||
val = val.replace("~player~", p.getName());
|
||||
val = val.replace("@", "@ " + loc.toString());
|
||||
return val;
|
||||
|
||||
}
|
||||
|
||||
public String getValue(String source, Location loc) {
|
||||
|
||||
String val = value;
|
||||
val = val.replace("~type~", source);
|
||||
val = val.replace("~player~", source);
|
||||
val = val.replace("@", "@ " + loc.toString());
|
||||
return val;
|
||||
|
||||
}
|
||||
|
||||
public String getValue(Player p, Integer count, Location loc) {
|
||||
|
||||
String val = value;
|
||||
|
||||
val = val.replace("~player~", p.getName());
|
||||
val = val.replace("@", "@ " + loc.toString());
|
||||
val = val.replace("~count~", count.toString());
|
||||
return val;
|
||||
|
||||
}
|
||||
|
||||
public String getValue(Player p, Entity ent) {
|
||||
|
||||
String val = value;
|
||||
|
||||
val = val.replace("~name~", p.getName());
|
||||
@@ -243,83 +277,124 @@ public enum Msg {
|
||||
val = val.replace("~vehicle~", ent.getType().name());
|
||||
val = val.replace("@", "@ " + ent.getLocation());
|
||||
return val;
|
||||
|
||||
}
|
||||
|
||||
public String getValue(Entity ent1, Entity ent2) {
|
||||
|
||||
String val = value;
|
||||
|
||||
if (ent1 instanceof Player) {
|
||||
|
||||
val = val.replace("~entity~", ent1.getName());
|
||||
|
||||
} else {
|
||||
|
||||
val = val.replace("~entity~", ent1.getType().name());
|
||||
|
||||
}
|
||||
|
||||
val = val.replace("~vehicle~", ent2.getType().name());
|
||||
val = val.replace("@", "@ " + ent1.getLocation());
|
||||
return val;
|
||||
|
||||
}
|
||||
|
||||
public String getValue(Location loc, ItemStack is) {
|
||||
String val = value;
|
||||
|
||||
String val = value;
|
||||
|
||||
val = val.replace("@", "@ " + loc.toString());
|
||||
val = val.replace("~item~", is.getType().name());
|
||||
val = val.replace("~amount~", "" + is.getAmount());
|
||||
return ChatColor.translateAlternateColorCodes('&', val);
|
||||
|
||||
}
|
||||
|
||||
public String getValue(Object obj, ItemStack is, Enchantment en) {
|
||||
|
||||
|
||||
String val = value;
|
||||
|
||||
val = val.replace("~item~", is.getType().name());
|
||||
if (en == null) {
|
||||
|
||||
val = val.replace("~enchant~", "");
|
||||
|
||||
} else {
|
||||
|
||||
val = val.replace("~enchant~", en.getName());
|
||||
val = val.replace("~lvl~", is.getEnchantmentLevel(en) + "");
|
||||
|
||||
}
|
||||
|
||||
if (obj instanceof BlockState) {
|
||||
|
||||
val = val.replace("~player~", "a " + ((BlockState) obj).getBlock().getType().name() + "'s inventory");
|
||||
|
||||
} else if (obj instanceof Player) {
|
||||
|
||||
val = val.replace("~player~", ((Player) obj).getName());
|
||||
|
||||
} else if (obj instanceof Inventory) {
|
||||
|
||||
val = val.replace("~player~", ((Inventory) obj).getType().name() + " - ");
|
||||
|
||||
} else if (obj instanceof Location) {
|
||||
|
||||
val = val.replace("~player~", "a shulker box");
|
||||
|
||||
} else if (obj instanceof Container) {
|
||||
|
||||
val = val.replace("~player~", ((Container) obj).getType().name());
|
||||
|
||||
}
|
||||
|
||||
Location loc = null;
|
||||
|
||||
if (obj instanceof BlockState) {
|
||||
|
||||
loc = ((BlockState) obj).getLocation();
|
||||
|
||||
}
|
||||
|
||||
if (obj instanceof Player) {
|
||||
|
||||
loc = ((Player) obj).getLocation();
|
||||
|
||||
} else if (obj instanceof Block) {
|
||||
|
||||
loc = ((Block) obj).getLocation();
|
||||
|
||||
} else if (obj instanceof Inventory) {
|
||||
|
||||
loc = ((Inventory) obj).getLocation();
|
||||
|
||||
} else if (obj instanceof Location) {
|
||||
|
||||
loc = ((Location) obj);
|
||||
|
||||
} else if (obj instanceof Container) {
|
||||
|
||||
loc = ((Container) obj).getLocation();
|
||||
|
||||
}
|
||||
|
||||
if (loc != null) {
|
||||
|
||||
val = val.replace("@", "@ " + loc);
|
||||
|
||||
} else {
|
||||
|
||||
val = val.replace("@", "@ UNKNOWN ");
|
||||
|
||||
}
|
||||
|
||||
return val;
|
||||
|
||||
}
|
||||
|
||||
public String getValue(Player p, ItemStack is, Enchantment en) {
|
||||
|
||||
String val = value;
|
||||
|
||||
val = val.replace("~item~", is.getType().name());
|
||||
@@ -332,34 +407,46 @@ public enum Msg {
|
||||
}
|
||||
|
||||
public String getValue(Player p, EntityType et) {
|
||||
|
||||
String val = value;
|
||||
|
||||
val = val.replace("@", "@ " + p.getLocation());
|
||||
val = val.replace("~type~", et.name());
|
||||
val = val.replace("~name~", p.getName());
|
||||
return ChatColor.translateAlternateColorCodes('&', val);
|
||||
|
||||
}
|
||||
|
||||
|
||||
public String getValue(Object obj, ItemStack is) {
|
||||
|
||||
if (obj instanceof Inventory) {
|
||||
|
||||
if (((Inventory) obj).getHolder() instanceof Player) {
|
||||
|
||||
Inventory inv = (Inventory) obj;
|
||||
return getValue((Player) inv.getHolder(), is);
|
||||
|
||||
} else {
|
||||
|
||||
return getValue(((Inventory) obj).getLocation(), is);
|
||||
|
||||
}
|
||||
|
||||
} else if (obj instanceof Container) {
|
||||
|
||||
return getValue(((Container) obj), is);
|
||||
|
||||
}
|
||||
|
||||
LOGGER.error(
|
||||
"An unknown object {} was passed to IllegalStack during a logging operation please report this to dNiym at the spigot forums or on the IllegalStack Discord.",
|
||||
obj.toString()
|
||||
);
|
||||
obj.toString());
|
||||
return "???";
|
||||
|
||||
}
|
||||
|
||||
public String getValue(Container c, ItemStack is) {
|
||||
|
||||
String val = value;
|
||||
|
||||
val = val.replace("@", "@ " + c.getLocation());
|
||||
@@ -367,9 +454,11 @@ public enum Msg {
|
||||
val = val.replace("~name~", c.getType().name());
|
||||
val = val.replace("~amount~", "" + is.getAmount());
|
||||
return ChatColor.translateAlternateColorCodes('&', val);
|
||||
|
||||
}
|
||||
|
||||
public String getValue(Player p, ItemStack is) {
|
||||
|
||||
String val = value;
|
||||
|
||||
val = val.replace("@", "@ " + p.getLocation());
|
||||
@@ -378,52 +467,56 @@ public enum Msg {
|
||||
val = val.replace("~amount~", "" + is.getAmount());
|
||||
|
||||
return ChatColor.translateAlternateColorCodes('&', val);
|
||||
|
||||
}
|
||||
|
||||
public String getValue(ItemStack is, Object obj, StringBuilder list) {
|
||||
|
||||
String val = value;
|
||||
|
||||
if (obj instanceof Player) {
|
||||
|
||||
val = val.replace("@", "@ " + ((Player) obj).getLocation());
|
||||
val = val.replace("~name~", ((Player) obj).getName());
|
||||
|
||||
} else if (obj instanceof Inventory) {
|
||||
|
||||
Inventory inv = null;
|
||||
inv = (Inventory) obj;
|
||||
if (inv.getHolder() instanceof Container) {
|
||||
val = val.replace(
|
||||
"~name~",
|
||||
((Container) inv.getHolder())
|
||||
.getLocation()
|
||||
.getBlock()
|
||||
.getType()
|
||||
.name() + " @" + ((Container) inv.getHolder()).getLocation()
|
||||
);
|
||||
|
||||
val = val.replace("~name~", ((Container) inv.getHolder()).getLocation().getBlock().getType().name()
|
||||
+ " @" + ((Container) inv.getHolder()).getLocation());
|
||||
|
||||
} else if (inv.getHolder() instanceof DoubleChest) {
|
||||
val = val.replace(
|
||||
"~name~",
|
||||
((DoubleChest) inv.getHolder()).getLocation().getBlock().getType().name() + " @" + inv
|
||||
.getLocation()
|
||||
.toString()
|
||||
);
|
||||
|
||||
val = val.replace("~name~", ((DoubleChest) inv.getHolder()).getLocation().getBlock().getType().name()
|
||||
+ " @" + inv.getLocation().toString());
|
||||
|
||||
} else if (inv.getHolder() instanceof Player) {
|
||||
|
||||
val = val.replace("~name~", ((Player) inv.getHolder()).getName() + " @" + inv.getLocation().toString());
|
||||
|
||||
} else {
|
||||
|
||||
LOGGER.error(
|
||||
"IllegalStack was supposed to send a message detailing an inventory but could not determine its type! Please contact dNiym at the IllegalStack discord or on Spigot with this message: {} ",
|
||||
obj.toString()
|
||||
);
|
||||
}
|
||||
}
|
||||
obj.toString());
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
val = val.replace("~item~", is.getType().name());
|
||||
val = val.replace("~amount~", "" + is.getAmount());
|
||||
val = val.replace("~attributes~", list);
|
||||
|
||||
return ChatColor.translateAlternateColorCodes('&', val);
|
||||
|
||||
}
|
||||
|
||||
public String getValue(Player p, ItemStack is, String list) {
|
||||
|
||||
String val = value;
|
||||
|
||||
val = val.replace("@", "@ " + p.getLocation());
|
||||
@@ -432,49 +525,62 @@ public enum Msg {
|
||||
val = val.replace("~amount~", "" + is.getAmount());
|
||||
val = val.replace("~attributes~", list);
|
||||
return ChatColor.translateAlternateColorCodes('&', val);
|
||||
|
||||
}
|
||||
|
||||
public String getConfigVal() {
|
||||
|
||||
return ChatColor.translateAlternateColorCodes('&', value);
|
||||
|
||||
}
|
||||
|
||||
public String getValue() {
|
||||
|
||||
return value;
|
||||
|
||||
}
|
||||
|
||||
public void setValue(String value) {
|
||||
|
||||
this.value = value;
|
||||
|
||||
}
|
||||
|
||||
public String getValue(Protections p, String name, String status) {
|
||||
|
||||
String val = value;
|
||||
|
||||
val = val.replace("~protection~", p.name());
|
||||
val = val.replace("~name~", name);
|
||||
val = val.replace("~status~", "" + status);
|
||||
return ChatColor.translateAlternateColorCodes('&', val);
|
||||
|
||||
}
|
||||
|
||||
public String getValue(Player p, int size) {
|
||||
|
||||
String val = value;
|
||||
|
||||
val = val.replace("@", "@ " + p.getLocation());
|
||||
val = val.replace("~size~", "" + size);
|
||||
val = val.replace("~name~", p.getName());
|
||||
|
||||
|
||||
return ChatColor.translateAlternateColorCodes('&', val);
|
||||
|
||||
}
|
||||
|
||||
public String getValue(Location loc, int size) {
|
||||
|
||||
String val = value;
|
||||
|
||||
val = val.replace("@", "@ " + loc.toString());
|
||||
val = val.replace("~size~", "" + size);
|
||||
return ChatColor.translateAlternateColorCodes('&', val);
|
||||
|
||||
}
|
||||
|
||||
public String getValue(Player p, ItemStack is, int lostItems) {
|
||||
|
||||
String val = value;
|
||||
|
||||
val = val.replace("@", "@ " + p.getLocation());
|
||||
@@ -483,6 +589,7 @@ public enum Msg {
|
||||
val = val.replace("~amount~", "" + is.getAmount());
|
||||
val = val.replace("~lost~", "" + lostItems);
|
||||
return ChatColor.translateAlternateColorCodes('&', val);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,51 @@
|
||||
package main.java.me.dniym.enums;
|
||||
|
||||
public enum ServerVersion {
|
||||
|
||||
v1_8_R1, v1_8_R2, v1_8_R3, v1_9_R1, v1_9_R2, v1_10_R1, v1_11_R1, v1_12_R1, v1_13_R1, v1_13_R2, v1_14_R1, v1_15_R1,
|
||||
v1_16_R1, v1_16_R2, v1_16_R3, v1_17_R1, v1_18_R1, v1_18_R2, v1_19_R1, v1_19_R2, v1_19_R3, v1_20_R1, v1_20_R2,
|
||||
v1_20_R3, v1_20_R4, v1_20_R5, v1_21_R1;
|
||||
|
||||
public boolean serverVersionEqual(ServerVersion version) {
|
||||
|
||||
return this.equals(version);
|
||||
|
||||
}
|
||||
|
||||
public boolean serverVersionGreaterThanOrEqual(ServerVersion version) {
|
||||
|
||||
return this.ordinal() >= version.ordinal();
|
||||
|
||||
}
|
||||
|
||||
public boolean serverVersionGreaterThan(ServerVersion version1, ServerVersion version2) {
|
||||
|
||||
return version1.ordinal() > version2.ordinal();
|
||||
|
||||
}
|
||||
|
||||
public boolean serverVersionLessThan(ServerVersion version1, ServerVersion version2) {
|
||||
|
||||
return version1.ordinal() < version2.ordinal();
|
||||
|
||||
}
|
||||
|
||||
public String getServerVersionName() {
|
||||
|
||||
return this.name();
|
||||
|
||||
}
|
||||
|
||||
public int getOrdinalServerVersionNumber() {
|
||||
|
||||
return this.ordinal();
|
||||
|
||||
}
|
||||
|
||||
public int getServerMajorVersionNumber() {
|
||||
|
||||
return Integer.parseInt(this.name().split("_")[1]);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -20,14 +20,10 @@ public class IllegalStackActionEvent extends Event implements Cancellable {
|
||||
private Entity mount;
|
||||
private Inventory affectedInventory;
|
||||
|
||||
public IllegalStackActionEvent(
|
||||
Protections protections,
|
||||
Entity entity,
|
||||
Block block,
|
||||
ItemStack itemStack,
|
||||
Entity entity1,
|
||||
Inventory inventory
|
||||
) {
|
||||
public IllegalStackActionEvent(Protections protections, Entity entity, Block block, ItemStack itemStack,
|
||||
Entity entity1, Inventory inventory)
|
||||
{
|
||||
|
||||
this.protection = protections;
|
||||
this.setCause(entity);
|
||||
this.block = block;
|
||||
@@ -38,76 +34,102 @@ public class IllegalStackActionEvent extends Event implements Cancellable {
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
|
||||
return handlers;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCancelled() {
|
||||
|
||||
return cancelled;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCancelled(boolean cancel) {
|
||||
|
||||
cancelled = cancel;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
|
||||
return handlers;
|
||||
|
||||
}
|
||||
|
||||
public Protections getProtection() {
|
||||
|
||||
return protection;
|
||||
|
||||
}
|
||||
|
||||
public void setProtection(Protections protection) {
|
||||
|
||||
this.protection = protection;
|
||||
|
||||
}
|
||||
|
||||
public Block getBlock() {
|
||||
|
||||
return block;
|
||||
|
||||
}
|
||||
|
||||
public void setBlock(Block block) {
|
||||
|
||||
this.block = block;
|
||||
|
||||
}
|
||||
|
||||
public ItemStack getItem() {
|
||||
|
||||
return item;
|
||||
|
||||
}
|
||||
|
||||
public void setItem(ItemStack item) {
|
||||
this.item = item;
|
||||
}
|
||||
|
||||
this.item = item;
|
||||
|
||||
}
|
||||
|
||||
public Entity getMount() {
|
||||
return mount;
|
||||
}
|
||||
|
||||
return mount;
|
||||
|
||||
}
|
||||
|
||||
public void setMount(Entity mount) {
|
||||
this.mount = mount;
|
||||
}
|
||||
|
||||
this.mount = mount;
|
||||
|
||||
}
|
||||
|
||||
public Entity getCause() {
|
||||
return cause;
|
||||
}
|
||||
|
||||
return cause;
|
||||
|
||||
}
|
||||
|
||||
public void setCause(Entity cause) {
|
||||
this.cause = cause;
|
||||
}
|
||||
|
||||
this.cause = cause;
|
||||
|
||||
}
|
||||
|
||||
public Inventory getAffectedInventory() {
|
||||
|
||||
return affectedInventory;
|
||||
|
||||
}
|
||||
|
||||
|
||||
public void setAffectedInventory(Inventory affectedInventory) {
|
||||
|
||||
this.affectedInventory = affectedInventory;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -13,44 +13,61 @@ public class IllegalStackLogEvent extends Event implements Cancellable {
|
||||
private Protections protection = null;
|
||||
|
||||
public IllegalStackLogEvent(String message, Protections prot) {
|
||||
|
||||
this.setMessage(message);
|
||||
this.setProtection(prot);
|
||||
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
|
||||
return handlers;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCancelled() {
|
||||
|
||||
return cancelled;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCancelled(boolean cancel) {
|
||||
|
||||
cancelled = cancel;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
|
||||
return handlers;
|
||||
|
||||
}
|
||||
|
||||
public String getMessage() {
|
||||
|
||||
return message;
|
||||
|
||||
}
|
||||
|
||||
public void setMessage(String message) {
|
||||
|
||||
this.message = message;
|
||||
|
||||
}
|
||||
|
||||
public Protections getProtection() {
|
||||
|
||||
return protection;
|
||||
|
||||
}
|
||||
|
||||
public void setProtection(Protections protection) {
|
||||
|
||||
this.protection = protection;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,13 +1,12 @@
|
||||
package main.java.me.dniym.fishing;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.FishHook;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.FishHook;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class FishAttempt {
|
||||
|
||||
@@ -22,96 +21,154 @@ public class FishAttempt {
|
||||
private final List<Location> BLACKLIST = new ArrayList<>();
|
||||
|
||||
public FishAttempt(Player p) {
|
||||
|
||||
attempts.put(p.getUniqueId(), this);
|
||||
|
||||
}
|
||||
|
||||
public static FishAttempt findPlayer(Player p) {
|
||||
|
||||
if (attempts.containsKey(p.getUniqueId())) {
|
||||
|
||||
return attempts.get(p.getUniqueId());
|
||||
|
||||
}
|
||||
|
||||
return new FishAttempt(p);
|
||||
|
||||
}
|
||||
|
||||
public static FishHook findHook(Player player) {
|
||||
|
||||
for (FishHook fh : player.getWorld().getEntitiesByClass(FishHook.class)) {
|
||||
|
||||
if (fh.getShooter() instanceof Player) {
|
||||
|
||||
if (fh.getShooter() == player) {
|
||||
|
||||
return fh;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return null;
|
||||
|
||||
}
|
||||
|
||||
public void fishCaught(Location hookLoc) {
|
||||
|
||||
if (lastLocation == null || lastLocation.getWorld() != hookLoc.getWorld()) {
|
||||
|
||||
lastLocation = hookLoc;
|
||||
|
||||
}
|
||||
|
||||
Location testLoc = hookLoc.clone();
|
||||
testLoc.setY(lastLocation.getY());
|
||||
|
||||
if (lastLocation.getWorld() == testLoc.getWorld() && lastLocation.distance(testLoc) <= range) {
|
||||
|
||||
setSameSpotCount(getSameSpotCount() + 1);
|
||||
|
||||
} else {
|
||||
|
||||
setSameSpotCount(1);
|
||||
lastLocation = hookLoc;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void addAttempt() {
|
||||
|
||||
if (System.currentTimeMillis() >= lastFish) {
|
||||
|
||||
count = 1;
|
||||
|
||||
} else {
|
||||
|
||||
count++;
|
||||
|
||||
}
|
||||
|
||||
lastFish = System.currentTimeMillis() + spamThreshold;
|
||||
|
||||
}
|
||||
|
||||
public int getCount() {
|
||||
|
||||
return count;
|
||||
|
||||
}
|
||||
|
||||
public void setCount(int count) {
|
||||
|
||||
this.count = count;
|
||||
|
||||
}
|
||||
|
||||
public int getSameSpotCount() {
|
||||
|
||||
return sameSpotCount;
|
||||
|
||||
}
|
||||
|
||||
public void setSameSpotCount(int sameSpotCount) {
|
||||
|
||||
this.sameSpotCount = sameSpotCount;
|
||||
|
||||
}
|
||||
|
||||
public void reset() {
|
||||
|
||||
sameSpotCount = 0;
|
||||
lastLocation = null;
|
||||
|
||||
}
|
||||
|
||||
public void blackList(Location location) {
|
||||
|
||||
if (getBLACKLIST().size() > 3) {
|
||||
|
||||
getBLACKLIST().remove(0);
|
||||
|
||||
}
|
||||
|
||||
getBLACKLIST().add(location);
|
||||
|
||||
}
|
||||
|
||||
public List<Location> getBLACKLIST() {
|
||||
|
||||
return BLACKLIST;
|
||||
|
||||
}
|
||||
|
||||
public boolean isBlackListedSpot(Location location) {
|
||||
|
||||
for (Location l : BLACKLIST) {
|
||||
|
||||
Location testLoc = l.clone();
|
||||
testLoc.setY(location.getY());
|
||||
if (location.getWorld() != testLoc.getWorld()) {
|
||||
|
||||
continue;
|
||||
|
||||
}
|
||||
|
||||
if (testLoc.distance(location) <= range) {
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -3,23 +3,16 @@ package main.java.me.dniym.listeners;
|
||||
import main.java.me.dniym.IllegalStack;
|
||||
import main.java.me.dniym.enums.Msg;
|
||||
import main.java.me.dniym.enums.Protections;
|
||||
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.block.BlockState;
|
||||
import org.bukkit.block.CreatureSpawner;
|
||||
import org.bukkit.entity.EnderPearl;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.entity.Snowball;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.block.Action;
|
||||
import org.bukkit.event.entity.ProjectileHitEvent;
|
||||
import org.bukkit.event.entity.SpawnerSpawnEvent;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
@@ -30,6 +23,7 @@ public class Listener113 implements Listener {
|
||||
IllegalStack plugin;
|
||||
|
||||
public Listener113(IllegalStack illegalStack) {
|
||||
|
||||
plugin = illegalStack;
|
||||
plugin.getServer().getPluginManager().registerEvents(this, plugin);
|
||||
LOGGER.info("Enabling 1.13+ Checks");
|
||||
@@ -38,72 +32,64 @@ public class Listener113 implements Listener {
|
||||
|
||||
@EventHandler
|
||||
public void spawnerSpawnEvent(SpawnerSpawnEvent e) {
|
||||
|
||||
if(Protections.SpawnerReset.isEnabled()) {
|
||||
|
||||
|
||||
CreatureSpawner cs = e.getSpawner();
|
||||
EntityType et = e.getEntityType();
|
||||
if(et != null && Protections.ResetSpawnersOfTypeOnSpawn.isWhitelisted(et))
|
||||
{
|
||||
e.setCancelled(true);
|
||||
EntityType oldType = cs.getSpawnedType();
|
||||
cs.setSpawnedType(EntityType.PIG);
|
||||
cs.setBlockData(cs.getBlockData());
|
||||
cs.update(true);
|
||||
fListener.getLog().append(Msg.StaffMsgSpawnerOnSpawnReset.getValue(oldType.name(), e.getLocation()), Protections.ResetSpawnersOfTypeOnSpawn);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (Protections.SpawnerReset.isEnabled(e.getLocation())) {
|
||||
|
||||
CreatureSpawner cs = e.getSpawner();
|
||||
EntityType et = e.getEntityType();
|
||||
if (et != null && Protections.ResetSpawnersOfTypeOnSpawn.isWhitelisted(et)) {
|
||||
|
||||
e.setCancelled(true);
|
||||
EntityType oldType = cs.getSpawnedType();
|
||||
cs.setSpawnedType(EntityType.PIG);
|
||||
cs.setBlockData(cs.getBlockData());
|
||||
cs.update(true);
|
||||
fListener.getLog().append(Msg.StaffMsgSpawnerOnSpawnReset.getValue(oldType.name(), e.getLocation()),
|
||||
Protections.ResetSpawnersOfTypeOnSpawn);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@EventHandler
|
||||
public void spawnerChangeCheck(PlayerInteractEvent event) {
|
||||
if (Protections.PreventSpawnEggsOnSpawners.isEnabled()) {
|
||||
|
||||
if (Protections.PreventSpawnEggsOnSpawners.isEnabled(event.getPlayer())) {
|
||||
|
||||
Player plr = event.getPlayer();
|
||||
ItemStack is = plr.getInventory().getItemInMainHand();
|
||||
|
||||
if (is == null) {
|
||||
|
||||
is = plr.getInventory().getItemInOffHand();
|
||||
|
||||
}
|
||||
|
||||
if (is != null && is.getType().name().toLowerCase().contains("spawn_egg")) {
|
||||
|
||||
if (event.getAction() == Action.RIGHT_CLICK_BLOCK) {
|
||||
|
||||
Block blk = event.getClickedBlock();
|
||||
if (blk.getType() == Material.SPAWNER && !event.getPlayer().isOp()) {
|
||||
if (blk.getType() == Material.SPAWNER) {
|
||||
|
||||
plr.sendMessage(Msg.PlayerSpawnEggBlock.getValue());
|
||||
event.setCancelled(true);
|
||||
|
||||
} else if (blk.getType() == Material.SPAWNER) {
|
||||
fListener.getLog().append(
|
||||
Msg.StaffMsgChangedSpawnerType.getValue(plr, is.getType().name()),
|
||||
Protections.PreventSpawnEggsOnSpawners
|
||||
);
|
||||
|
||||
fListener.getLog().append(Msg.StaffMsgChangedSpawnerType.getValue(plr, is.getType().name()),
|
||||
Protections.PreventSpawnEggsOnSpawners);
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onSnowballHit(ProjectileHitEvent e) {
|
||||
|
||||
if (Protections.MeltSnowballsInWater.isEnabled()) {
|
||||
if (!(e.getEntity() instanceof Snowball) || e.getHitBlock() == null) {
|
||||
return;
|
||||
}
|
||||
if(e.getHitBlock().getType() == Material.WATER || e.getHitBlock().getType() == Material.BUBBLE_COLUMN)
|
||||
e.getEntity().remove();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -1,14 +1,18 @@
|
||||
package main.java.me.dniym.listeners;
|
||||
|
||||
import io.netty.util.internal.ThreadLocalRandom;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.UUID;
|
||||
import main.java.me.dniym.IllegalStack;
|
||||
import main.java.me.dniym.checks.BadPotionCheck;
|
||||
import main.java.me.dniym.enums.Msg;
|
||||
import main.java.me.dniym.enums.Protections;
|
||||
import main.java.me.dniym.timers.fTimer;
|
||||
|
||||
import main.java.me.dniym.utils.Scheduler;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
@@ -19,6 +23,7 @@ import org.bukkit.enchantments.Enchantment;
|
||||
import org.bukkit.entity.EnderPearl;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.FallingBlock;
|
||||
import org.bukkit.entity.FishHook;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.entity.Projectile;
|
||||
import org.bukkit.entity.Villager;
|
||||
@@ -42,95 +47,125 @@ import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.Merchant;
|
||||
import org.bukkit.inventory.MerchantInventory;
|
||||
import org.bukkit.inventory.meta.EnchantmentStorageMeta;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.UUID;
|
||||
|
||||
public class Listener114 implements Listener {
|
||||
final Logger LOGGER = LogManager.getLogger("IllegalStack/" + Listener114.class.getSimpleName());
|
||||
private static final BlockFace[] faces = {BlockFace.EAST, BlockFace.WEST, BlockFace.SOUTH, BlockFace.NORTH};
|
||||
|
||||
final Logger LOGGER = LogManager.getLogger("IllegalStack/" + Listener114.class.getSimpleName());
|
||||
private static final BlockFace[] faces = { BlockFace.EAST, BlockFace.WEST, BlockFace.SOUTH, BlockFace.NORTH };
|
||||
HashMap<UUID, Long> lastTrade = new HashMap<>();
|
||||
HashSet<Material> consumables = new HashSet<>();
|
||||
IllegalStack plugin;
|
||||
|
||||
public Listener114(IllegalStack illegalStack) {
|
||||
|
||||
plugin = illegalStack;
|
||||
|
||||
Material[] consume = new Material[]{Material.APPLE, Material.BAKED_POTATO, Material.BEETROOT, Material.BEETROOT_SOUP, Material.BREAD, Material.CARROT,
|
||||
Material.CHORUS_FRUIT, Material.COOKED_CHICKEN, Material.COOKED_COD, Material.COOKED_MUTTON, Material.COOKED_PORKCHOP, Material.COOKED_SALMON,
|
||||
Material.COOKED_RABBIT, Material.COOKIE, Material.DRIED_KELP, Material.GOLDEN_APPLE, Material.ENCHANTED_GOLDEN_APPLE, Material.GOLDEN_CARROT,
|
||||
Material.MELON_SLICE, Material.MUSHROOM_STEW, Material.POISONOUS_POTATO, Material.POTATO, Material.PUFFERFISH, Material.PUMPKIN_PIE, Material.RABBIT_STEW,
|
||||
Material.BEEF, Material.CHICKEN, Material.COD, Material.MUTTON, Material.PORKCHOP, Material.RABBIT, Material.SALMON, Material.ROTTEN_FLESH,
|
||||
Material.SPIDER_EYE, Material.COOKED_BEEF, Material.SUSPICIOUS_STEW, Material.SWEET_BERRIES, Material.TROPICAL_FISH, Material.MILK_BUCKET,
|
||||
Material.POTION};
|
||||
|
||||
Material[] consume = new Material[] { Material.APPLE, Material.BAKED_POTATO, Material.BEETROOT,
|
||||
Material.BEETROOT_SOUP, Material.BREAD, Material.CARROT, Material.CHORUS_FRUIT, Material.COOKED_CHICKEN,
|
||||
Material.COOKED_COD, Material.COOKED_MUTTON, Material.COOKED_PORKCHOP, Material.COOKED_SALMON,
|
||||
Material.COOKED_RABBIT, Material.COOKIE, Material.DRIED_KELP, Material.GOLDEN_APPLE,
|
||||
Material.ENCHANTED_GOLDEN_APPLE, Material.GOLDEN_CARROT, Material.MELON_SLICE, Material.MUSHROOM_STEW,
|
||||
Material.POISONOUS_POTATO, Material.POTATO, Material.PUFFERFISH, Material.PUMPKIN_PIE,
|
||||
Material.RABBIT_STEW, Material.BEEF, Material.CHICKEN, Material.COD, Material.MUTTON, Material.PORKCHOP,
|
||||
Material.RABBIT, Material.SALMON, Material.ROTTEN_FLESH, Material.SPIDER_EYE, Material.COOKED_BEEF,
|
||||
Material.SUSPICIOUS_STEW, Material.SWEET_BERRIES, Material.TROPICAL_FISH, Material.MILK_BUCKET,
|
||||
Material.POTION };
|
||||
consumables.addAll(Arrays.asList(consume));
|
||||
|
||||
plugin.getServer().getPluginManager().registerEvents(this, plugin);
|
||||
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onChestDispense(BlockDispenseArmorEvent e) {
|
||||
if (Protections.DisableChestsOnMobs.isEnabled()) {
|
||||
|
||||
if (Protections.DisableChestsOnMobs.isEnabled(e.getBlock().getLocation())) {
|
||||
|
||||
if (e.getItem().getType() == Material.CHEST) {
|
||||
|
||||
e.setCancelled(true);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void OnVillagerTransform(EntityTransformEvent e) {
|
||||
|
||||
if (Protections.ZombieVillagerTransformChance.getIntValue() < 100) {
|
||||
if (Protections.ZombieVillagerTransformChance.getIntValue() < 100
|
||||
&& !Protections.ZombieVillagerTransformChance.isDisabledInWorld(e.getEntity().getWorld()))
|
||||
{
|
||||
|
||||
for (Entity ent : e.getTransformedEntities()) {
|
||||
|
||||
if (ent instanceof ZombieVillager) {
|
||||
|
||||
if (Protections.ZombieVillagerTransformChance.getIntValue() <= 0) {
|
||||
|
||||
e.setCancelled(true);
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
int roll = ThreadLocalRandom.current().nextInt(1, 100);
|
||||
|
||||
if (roll > Protections.ZombieVillagerTransformChance.getIntValue()) {
|
||||
|
||||
e.setCancelled(true);
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void OnVillagerInteract(PlayerInteractEntityEvent e) {
|
||||
if (Protections.DisableInWorlds.getTxtSet().contains(e.getPlayer().getWorld().getName())) {
|
||||
return;
|
||||
}
|
||||
if (Protections.PreventVillagerSwimExploit.isEnabled()) {
|
||||
if (e.getRightClicked() != null && e.getRightClicked() instanceof Villager && e.getRightClicked() instanceof Merchant) {
|
||||
|
||||
if (Protections.PreventVillagerSwimExploit.isEnabled(e.getPlayer())) {
|
||||
|
||||
if (e.getRightClicked() != null && e.getRightClicked() instanceof Villager
|
||||
&& e.getRightClicked() instanceof Merchant)
|
||||
{
|
||||
|
||||
boolean cancel = false;
|
||||
|
||||
Villager v = (Villager) e.getRightClicked();
|
||||
|
||||
if (v.getLocation().getBlock().getType() == Material.WATER) {
|
||||
|
||||
cancel = true;
|
||||
|
||||
}
|
||||
|
||||
Block down = v.getLocation().getBlock();
|
||||
if (down.getBlockData() instanceof Waterlogged) {
|
||||
|
||||
Waterlogged wl = (Waterlogged) down.getBlockData();
|
||||
if (wl.isWaterlogged()) {
|
||||
|
||||
cancel = true;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (cancel) {
|
||||
|
||||
e.setCancelled(true);
|
||||
e.getPlayer().sendMessage(Msg.PlayerSwimExploitMsg.getValue());
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -138,225 +173,313 @@ public class Listener114 implements Listener {
|
||||
@EventHandler
|
||||
public void onBlockBreak(BlockBreakEvent e) {
|
||||
|
||||
if (Protections.SilkTouchBookExploit.isEnabled(e.getPlayer())) {
|
||||
|
||||
if (Protections.SilkTouchBookExploit.isEnabled()) {
|
||||
Player p = e.getPlayer();
|
||||
if (p != null && p.getInventory().getItemInMainHand() != null) {
|
||||
|
||||
ItemStack is = p.getInventory().getItemInMainHand();
|
||||
if (is.getType() == Material.ENCHANTED_BOOK) {
|
||||
|
||||
EnchantmentStorageMeta enchantmentStorageMeta = (EnchantmentStorageMeta) is.getItemMeta();
|
||||
for (Enchantment enchantment : enchantmentStorageMeta.getStoredEnchants().keySet()) {
|
||||
|
||||
if (enchantment.equals(Enchantment.SILK_TOUCH)) {
|
||||
if (e.getBlock().getType() == Material.CHEST || e.getBlock().getType() == Material.TRAPPED_CHEST) {
|
||||
|
||||
if (e.getBlock().getType() == Material.CHEST
|
||||
|| e.getBlock().getType() == Material.TRAPPED_CHEST)
|
||||
{
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
e.setCancelled(true);
|
||||
fListener.getLog().append2(Msg.SilkTouchBookBlocked.getValue(p, e.getBlock().getType().name()));
|
||||
fListener.getLog()
|
||||
.append2(Msg.SilkTouchBookBlocked.getValue(p, e.getBlock().getType().name()));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void LockMerchantTrades(InventoryOpenEvent e) {
|
||||
|
||||
if (Protections.PreventCommandsInBed.isEnabled(e.getPlayer()) && e.getPlayer().isSleeping()) {
|
||||
|
||||
if (Protections.DisableInWorlds.getTxtSet().contains(e.getPlayer().getWorld().getName())) {
|
||||
return;
|
||||
}
|
||||
if (Protections.PreventCommandsInBed.isEnabled() && e.getPlayer().isSleeping()) {
|
||||
e.setCancelled(true);
|
||||
return;
|
||||
|
||||
}
|
||||
if (!Protections.VillagerTradeCheesing.isEnabled()) {
|
||||
|
||||
if (!Protections.VillagerTradeCheesing.isEnabled(e.getPlayer())) {
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
if (e.getInventory() instanceof MerchantInventory) {
|
||||
|
||||
MerchantInventory mi = (MerchantInventory) e.getInventory();
|
||||
if (mi.getHolder() instanceof WanderingTrader) {
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
if (mi.getHolder() instanceof Villager) {
|
||||
|
||||
Villager v = (Villager) mi.getHolder();
|
||||
|
||||
if (v.getVillagerExperience() == 0) {
|
||||
|
||||
v.setVillagerExperience(1);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void PreventVillagerRestock(VillagerReplenishTradeEvent e) {
|
||||
if (Protections.DisableInWorlds.getTxtSet().contains(e.getEntity().getWorld().getName())) {
|
||||
return;
|
||||
}
|
||||
if (!Protections.VillagerTradeCheesing.isEnabled()) {
|
||||
|
||||
if (!Protections.VillagerTradeCheesing.isEnabled(e.getEntity().getWorld())) {
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
if (Protections.VillagerRestockTime.getIntValue() <= 0 || !fListener.getIs114()) {
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
//if the villager is not in the list, add them with a new empty timestamp.
|
||||
|
||||
// if the villager is not in the list, add them with a new empty timestamp.
|
||||
if (!lastTrade.containsKey(e.getEntity().getUniqueId())) {
|
||||
|
||||
lastTrade.put(e.getEntity().getUniqueId(), 0L);
|
||||
|
||||
}
|
||||
|
||||
if (System.currentTimeMillis() >= lastTrade.get(e.getEntity().getUniqueId())) {
|
||||
//timestamp is either empty or has expired, allow a restock.
|
||||
lastTrade.put(
|
||||
e.getEntity().getUniqueId(),
|
||||
System.currentTimeMillis() + 60000L * Protections.VillagerRestockTime.getIntValue()
|
||||
);
|
||||
|
||||
// timestamp is either empty or has expired, allow a restock.
|
||||
lastTrade.put(e.getEntity().getUniqueId(),
|
||||
System.currentTimeMillis() + 60000L * Protections.VillagerRestockTime.getIntValue());
|
||||
|
||||
} else {
|
||||
//timestamp has not expired do not allow restocking.
|
||||
|
||||
// timestamp has not expired do not allow restocking.
|
||||
e.setCancelled(true);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onHandSwap(PlayerSwapHandItemsEvent e) {
|
||||
if (!Protections.PreventFoodDupe.isEnabled()) {
|
||||
|
||||
if (!Protections.PreventFoodDupe.isEnabled(e.getPlayer())) {
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
ItemStack item1 = e.getMainHandItem();
|
||||
ItemStack item2 = e.getOffHandItem();
|
||||
if (item1 == null || item2 == null) {
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
if (consumables.contains(item1.getType()) && consumables.contains(item2.getType()) && item1.getType() == item2.getType()) {
|
||||
|
||||
if (consumables.contains(item1.getType()) && consumables.contains(item2.getType())
|
||||
&& item1.getType() == item2.getType())
|
||||
{
|
||||
|
||||
if (item1.getAmount() == 1 && item2.getAmount() == 1) {
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
e.getPlayer().getInventory().setItemInMainHand(new ItemStack(Material.AIR));
|
||||
e.getPlayer().getInventory().setItemInOffHand(new ItemStack(Material.AIR));
|
||||
e.setCancelled(true);
|
||||
new BukkitRunnable() {
|
||||
Scheduler.runTaskLater(IllegalStack.getPlugin(), () -> {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
e.getPlayer().getInventory().setItemInMainHand(item1);
|
||||
e.getPlayer().getInventory().setItemInOffHand(item2);
|
||||
}
|
||||
e.getPlayer().getInventory().setItemInMainHand(item1);
|
||||
e.getPlayer().getInventory().setItemInOffHand(item2);
|
||||
|
||||
}, 3, e.getPlayer());
|
||||
|
||||
}.runTaskLater(IllegalStack.getPlugin(), 3);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onPortal(PortalCreateEvent event) {
|
||||
if (Protections.DisableInWorlds.isWhitelisted(event.getWorld().getName())) {
|
||||
return;
|
||||
|
||||
if (Protections.PreventBedrockDestruction.isEnabled(event.getWorld())) {
|
||||
|
||||
for (BlockState b : event.getBlocks()) {
|
||||
|
||||
if (fListener.getUnbreakable().contains(b.getType())) {
|
||||
|
||||
// Blocking breaking of unbreakable blocks.
|
||||
LOGGER.info("Portal tried to break an unbreakable block: {}", b.getType().name());
|
||||
event.setCancelled(true);
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
if (b.getY() > b.getWorld().getMaxHeight()) {
|
||||
|
||||
// Blocking portals spawning at world height limit, preventing from
|
||||
// https://i.imgur.com/mqAXdpU.png
|
||||
event.setCancelled(true);
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (Protections.PreventBedrockDestruction.isEnabled()) {
|
||||
|
||||
|
||||
for (BlockState b : event.getBlocks()) {
|
||||
if (fListener.getUnbreakable().contains(b.getType())) {
|
||||
//Blocking breaking of unbreakable blocks.
|
||||
LOGGER.info("Portal tried to break an unbreakable block: {}", b.getType().name());
|
||||
event.setCancelled(true);
|
||||
break;
|
||||
}
|
||||
if (b.getY() > b.getWorld().getMaxHeight()) {
|
||||
//Blocking portals spawning at world height limit, preventing from https://i.imgur.com/mqAXdpU.png
|
||||
event.setCancelled(true);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@EventHandler
|
||||
public void onPearlHit(ProjectileHitEvent e) {
|
||||
|
||||
if (Protections.PreventPearlGlassPhasing.isEnabled()) {
|
||||
if (!(e.getEntity() instanceof EnderPearl) || e.getHitBlock() == null || !(e
|
||||
.getEntity()
|
||||
.getShooter() instanceof Player) || e.getHitBlockFace() != BlockFace.UP) {
|
||||
if (Protections.PreventPearlGlassPhasing.isEnabled(e.getEntity().getLocation())) {
|
||||
|
||||
if (!(e.getEntity() instanceof EnderPearl) || e.getHitBlock() == null
|
||||
|| !(e.getEntity().getShooter() instanceof Player) || e.getHitBlockFace() != BlockFace.UP)
|
||||
{
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
for (BlockFace face : faces) {
|
||||
|
||||
Block next = e.getHitBlock().getRelative(face);
|
||||
Block above = next.getRelative(BlockFace.UP);
|
||||
Player p = ((Player) e.getEntity().getShooter());
|
||||
if (!fListener.getAirBlocks().contains(above.getType())) {
|
||||
|
||||
if (!fListener.getInstance().getGlassBlocks().contains(above.getType())) {
|
||||
|
||||
continue;
|
||||
|
||||
}
|
||||
|
||||
Location l = e.getHitBlock().getRelative(e.getHitBlockFace()).getLocation().add(0.5, 0.5, 0.5);
|
||||
fListener.getInstance().getTeleGlitch().put(p.getUniqueId(), l);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onItemSwitch(PlayerItemHeldEvent e) {
|
||||
if (!Protections.PreventFoodDupe.isEnabled()) {
|
||||
|
||||
if (!Protections.PreventFoodDupe.isEnabled(e.getPlayer())) {
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
ItemStack item1 = e.getPlayer().getInventory().getItem(e.getPreviousSlot());
|
||||
ItemStack item2 = e.getPlayer().getInventory().getItem(e.getNewSlot());
|
||||
if (item1 == null || item2 == null) {
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
if (consumables.contains(item1.getType()) && consumables.contains(item2.getType()) && item1.getType() == item2.getType()) {
|
||||
if (consumables.contains(item1.getType()) && consumables.contains(item2.getType())
|
||||
&& item1.getType() == item2.getType())
|
||||
{
|
||||
|
||||
if (item1.getAmount() == 1 && item2.getAmount() == 1) {
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
int tSlot = e.getNewSlot();
|
||||
ItemStack tFood = e.getPlayer().getInventory().getItem(tSlot);
|
||||
if (tFood == null) {
|
||||
|
||||
tSlot = e.getPreviousSlot();
|
||||
tFood = e.getPlayer().getInventory().getItem(tSlot);
|
||||
|
||||
}
|
||||
|
||||
final int slot = tSlot;
|
||||
final ItemStack food = tFood;
|
||||
e.getPlayer().getInventory().setItem(slot, new ItemStack(Material.AIR));
|
||||
new BukkitRunnable() {
|
||||
Scheduler.runTaskLater(IllegalStack.getPlugin(), () -> e.getPlayer().getInventory().setItem(slot, food), 3,
|
||||
e.getPlayer());
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
e.getPlayer().getInventory().setItem(slot, food);
|
||||
}
|
||||
}.runTaskLater(IllegalStack.getPlugin(), 3);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onProjectileLaunch(ProjectileLaunchEvent e) {
|
||||
if (Protections.PreventProjectileExploit.isEnabled()) {
|
||||
|
||||
if (e.getEntity() instanceof FishHook)
|
||||
return;
|
||||
if (Protections.PreventProjectileExploit2.isEnabled(e.getEntity().getLocation())) {
|
||||
|
||||
fTimer.trackProjectile(e.getEntity());
|
||||
|
||||
}
|
||||
|
||||
if (Protections.PreventInvalidPotions.isEnabled() && e.getEntity() != null)
|
||||
e.setCancelled(BadPotionCheck.isInvalidPotion(e.getEntity()));
|
||||
|
||||
}
|
||||
|
||||
@EventHandler// (ignoreCancelled = false, priority=EventPriority.LOWEST)
|
||||
@EventHandler // (ignoreCancelled = false, priority=EventPriority.LOWEST)
|
||||
public void onFallingBlockSpawn(EntitySpawnEvent e) {
|
||||
if (e.getEntity() instanceof Projectile && Protections.PreventProjectileExploit.isEnabled()) {
|
||||
|
||||
if (e.getEntity() instanceof Projectile && !(e.getEntity() instanceof FishHook)
|
||||
&& Protections.PreventProjectileExploit2.isEnabled(e.getEntity().getLocation()))
|
||||
{
|
||||
|
||||
fTimer.trackProjectile((Projectile) e.getEntity());
|
||||
|
||||
}
|
||||
|
||||
if (!(e.getEntity() instanceof FallingBlock) || !Protections.PreventVibratingBlocks.isEnabled()) {
|
||||
return;
|
||||
}
|
||||
if (!(e.getEntity() instanceof FallingBlock)
|
||||
|| !Protections.PreventVibratingBlocks.isEnabled(e.getLocation()))
|
||||
{
|
||||
|
||||
if (Protections.DisableInWorlds.isWhitelisted(e.getEntity().getWorld().getName())) {
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
fTimer.trackBlock((FallingBlock) e.getEntity());
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -19,27 +19,38 @@ public class Listener116 implements Listener {
|
||||
|
||||
@EventHandler
|
||||
public void onEntitySpawn(EntitySpawnEvent e) {
|
||||
|
||||
if (Protections.PreventPiglinDupe.isEnabled() && e.getEntity() instanceof Piglin) {
|
||||
|
||||
Piglin p = (Piglin) e.getEntity();
|
||||
p.setCanPickupItems(false);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onEntityPickup(EntityPickupItemEvent e) {
|
||||
|
||||
if (Protections.PreventPiglinDupe.isEnabled() && e.getEntity() instanceof Piglin) {
|
||||
|
||||
e.setCancelled(true);
|
||||
Piglin pig = (Piglin) e.getEntity();
|
||||
pig.setCanPickupItems(false);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onEntityDeath(EntityDeathEvent e) {
|
||||
|
||||
if (Protections.PreventPiglinDupe.isEnabled() && e.getEntity() instanceof Piglin) {
|
||||
|
||||
e.getDrops().clear();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -4,7 +4,7 @@ import main.java.me.dniym.IllegalStack;
|
||||
import main.java.me.dniym.enums.Msg;
|
||||
import main.java.me.dniym.enums.Protections;
|
||||
import main.java.me.dniym.utils.NBTStuff;
|
||||
|
||||
import main.java.me.dniym.utils.Scheduler;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.bukkit.Material;
|
||||
@@ -17,88 +17,122 @@ import org.bukkit.event.inventory.PrepareAnvilEvent;
|
||||
import org.bukkit.event.player.PlayerSwapHandItemsEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
public class ProtectionListener implements Listener {
|
||||
|
||||
IllegalStack plugin;
|
||||
private static final Logger LOGGER = LogManager.getLogger("IllegalStack/" + ProtectionListener.class.getSimpleName());
|
||||
private static final Logger LOGGER = LogManager
|
||||
.getLogger("IllegalStack/" + ProtectionListener.class.getSimpleName());
|
||||
|
||||
public ProtectionListener(IllegalStack illegalStack) {
|
||||
|
||||
this.plugin = illegalStack;
|
||||
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerSwapHandItemsEvent(PlayerSwapHandItemsEvent e) {
|
||||
|
||||
if (!Protections.PreventItemSwapLagExploit.isEnabled()) {
|
||||
return;
|
||||
}
|
||||
if (!fListener.getInstance().getSwapDelay().containsKey(e.getPlayer())) {
|
||||
fListener.getInstance().getSwapDelay().put(e.getPlayer(), 0L);
|
||||
}
|
||||
if (System.currentTimeMillis() < fListener.getInstance().getSwapDelay().get(e.getPlayer())) {
|
||||
e.setCancelled(true);
|
||||
} else {
|
||||
fListener.getInstance().getSwapDelay().put(e.getPlayer(), System.currentTimeMillis() + 750L);
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
if (!fListener.getInstance().getSwapDelay().containsKey(e.getPlayer())) {
|
||||
|
||||
fListener.getInstance().getSwapDelay().put(e.getPlayer(), 0L);
|
||||
|
||||
}
|
||||
|
||||
if (System.currentTimeMillis() < fListener.getInstance().getSwapDelay().get(e.getPlayer())) {
|
||||
|
||||
e.setCancelled(true);
|
||||
|
||||
} else {
|
||||
|
||||
fListener.getInstance().getSwapDelay().put(e.getPlayer(), System.currentTimeMillis() + 750L);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onElytraFlight(EntityToggleGlideEvent e) {
|
||||
|
||||
if (Protections.PreventInfiniteElytraFlight.isEnabled() && e.isGliding() && e.getEntity() instanceof Player) {
|
||||
|
||||
Player p = (Player) e.getEntity();
|
||||
if (p.getLocation().getBlockY() >= 255) {
|
||||
|
||||
fListener.getLog().append2(Msg.GlideActivateMaxBuild.getValue(p, ""));
|
||||
p.setGliding(false);
|
||||
e.setCancelled(true);
|
||||
}
|
||||
new BukkitRunnable() {
|
||||
final Player player = p;
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
if (player.getLocation().getBlockY() > 255 && player.isGliding()) {
|
||||
fListener.getLog().append2(Msg.GlideAboveMaxBuild.getValue(p, ""));
|
||||
player.setGliding(false);
|
||||
}
|
||||
}
|
||||
|
||||
Scheduler.runTaskLater(this.plugin, () -> {
|
||||
|
||||
if (p.getLocation().getBlockY() > 255 && p.isGliding()) {
|
||||
|
||||
fListener.getLog().append2(Msg.GlideAboveMaxBuild.getValue(p, ""));
|
||||
p.setGliding(false);
|
||||
|
||||
}
|
||||
}.runTaskLater(this.plugin, 3250);
|
||||
|
||||
}, 3250, p);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onBlockForm(BlockFormEvent e) {
|
||||
|
||||
if (!Protections.PreventCobbleGenerators.isEnabled()) {
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
if (e.getNewState().getType() == Material.COBBLESTONE) {
|
||||
|
||||
e.setCancelled(true);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onRepairAttempt(PrepareAnvilEvent e) {
|
||||
|
||||
if (Protections.BlockRepairsInstead.isEnabled()) {
|
||||
|
||||
ItemStack is = e.getResult();
|
||||
if (NBTStuff.hasNbtTag("IllegalStack", is, "NoRepair", Protections.BlockRepairsInstead)) {
|
||||
|
||||
e.setResult(new ItemStack(Material.AIR, 1));
|
||||
e.getView().close();
|
||||
fListener.getLog().append2(Msg.PlayerRepairBlocked.getValue(e.getView().getPlayer().getName()));
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
if (is != null && is.hasItemMeta()) {
|
||||
|
||||
ItemMeta im = is.getItemMeta();
|
||||
if (Protections.RemoveItemsMatchingName.loreNameMatch(im)) {
|
||||
|
||||
e.setResult(new ItemStack(Material.AIR, 1));
|
||||
e.getView().close();
|
||||
fListener.getLog().append2(Msg.PlayerRepairBlocked.getValue(e.getView().getPlayer().getName()));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
File diff suppressed because it is too large.
Load diff
@@ -2,69 +2,71 @@ package main.java.me.dniym.listeners;
|
||||
|
||||
import com.gmail.nossr50.events.skills.abilities.McMMOPlayerAbilityActivateEvent;
|
||||
import com.gmail.nossr50.events.skills.abilities.McMMOPlayerAbilityDeactivateEvent;
|
||||
import java.util.HashSet;
|
||||
import java.util.UUID;
|
||||
import main.java.me.dniym.IllegalStack;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.UUID;
|
||||
|
||||
public class mcMMOListener implements Listener {
|
||||
|
||||
private static final HashSet<UUID> mcMMOactive = new HashSet<>();
|
||||
private final IllegalStack plugin;
|
||||
|
||||
public mcMMOListener(IllegalStack illegalStack) {
|
||||
|
||||
this.plugin = illegalStack;
|
||||
|
||||
}
|
||||
|
||||
public static boolean ismcMMOActive(Player player) {
|
||||
|
||||
if (mcMMOactive == null) {
|
||||
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
return mcMMOactive.contains(player.getUniqueId());
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
@EventHandler
|
||||
public void onPotionBrew(McMMOPlayerBrewEvent e) {
|
||||
BrewingStand bs =(BrewingStand) e.getBrewingStand();
|
||||
for(int i = 0; i < bs.getInventory().getStorageContents().length;i++) {
|
||||
ItemStack is = bs.getInventory().getStorageContents()[i];
|
||||
|
||||
if(is == null)
|
||||
continue;
|
||||
|
||||
if(is.getType() == Material.POTION || is.getType() == Material.SPLASH_POTION)
|
||||
{
|
||||
int slot = i;
|
||||
|
||||
new BukkitRunnable()
|
||||
{
|
||||
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
|
||||
bs.getInventory().setItem(slot, NBTStuff.addNBTTag(is, "mcmmoitem"));
|
||||
|
||||
}
|
||||
}.runTaskLater(this.plugin, 12);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
*/
|
||||
* @EventHandler public void onPotionBrew(McMMOPlayerBrewEvent e) { BrewingStand
|
||||
* bs =(BrewingStand) e.getBrewingStand(); ItemStack[] storageContents =
|
||||
* bs.getInventory().getStorageContents(); for(int i = 0; i <
|
||||
* storageContents.length;i++) { ItemStack is = storageContents[i];
|
||||
*
|
||||
* if(is == null) continue;
|
||||
*
|
||||
* if(is.getType() == Material.POTION || is.getType() == Material.SPLASH_POTION)
|
||||
* { int slot = i;
|
||||
*
|
||||
* new BukkitRunnable() {
|
||||
*
|
||||
* @Override public void run() {
|
||||
*
|
||||
* bs.getInventory().setItem(slot, NBTStuff.addNBTTag(is, "mcmmoitem"));
|
||||
*
|
||||
* } }.runTaskLater(this.plugin, 12);
|
||||
*
|
||||
* }
|
||||
*
|
||||
* } }
|
||||
*/
|
||||
@EventHandler
|
||||
public void onAbilActivate(McMMOPlayerAbilityActivateEvent e) {
|
||||
|
||||
mcMMOactive.add(e.getPlayer().getUniqueId());
|
||||
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onAbilDeactivate(McMMOPlayerAbilityDeactivateEvent e) {
|
||||
|
||||
mcMMOactive.remove(e.getPlayer().getUniqueId());
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -4,10 +4,14 @@ import com.comphenix.protocol.PacketType;
|
||||
import com.comphenix.protocol.ProtocolLibrary;
|
||||
import com.comphenix.protocol.events.PacketAdapter;
|
||||
import com.comphenix.protocol.events.PacketEvent;
|
||||
import java.util.HashMap;
|
||||
import java.util.UUID;
|
||||
import main.java.me.dniym.IllegalStack;
|
||||
import main.java.me.dniym.checks.CreativeItemCheck;
|
||||
import main.java.me.dniym.enums.Msg;
|
||||
import main.java.me.dniym.enums.Protections;
|
||||
import main.java.me.dniym.timers.fTimer;
|
||||
import main.java.me.dniym.utils.Scheduler;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.bukkit.Material;
|
||||
@@ -17,180 +21,169 @@ import org.bukkit.entity.Horse;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.UUID;
|
||||
|
||||
public class pLisbListener {
|
||||
|
||||
private static final Logger LOGGER = LogManager.getLogger("IllegalStack/" + pLisbListener.class.getSimpleName());
|
||||
|
||||
Plugin plugin;
|
||||
int debug = 0;
|
||||
HashMap<UUID, Long> messageDelay = new HashMap<>();
|
||||
|
||||
|
||||
public pLisbListener(IllegalStack illegalStack) {
|
||||
|
||||
plugin = illegalStack;
|
||||
|
||||
//ProtocolLibrary.getProtocolManager().addPacketListener(new BookCrashExploitCheck(plugin));
|
||||
if (Protections.BlockBadItemsFromCreativeTab.isEnabled()) {
|
||||
ProtocolLibrary.getProtocolManager().addPacketListener(
|
||||
new PacketAdapter(plugin, PacketType.Play.Client.SET_CREATIVE_SLOT) {
|
||||
@Override
|
||||
public void onPacketReceiving(PacketEvent event) {
|
||||
if (!Protections.BlockBadItemsFromCreativeTab.isEnabled() || event.getPlayer().isOp() || event
|
||||
.getPlayer()
|
||||
.hasPermission("illegalstack.admin")) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
ItemStack stack = event.getPacket().getItemModifier().readSafely(0);
|
||||
if (stack != null && stack.hasItemMeta()) {
|
||||
stack = new ItemStack(Material.AIR);
|
||||
final Player player = event.getPlayer();
|
||||
plugin.getServer().getScheduler().runTaskLater(plugin, player::updateInventory, 5L);
|
||||
event.setCancelled(true);
|
||||
Msg.StaffMsgCreativeBlock.getValue(event.getPlayer().getName());
|
||||
}
|
||||
} catch (IndexOutOfBoundsException ex) {
|
||||
LOGGER.error(
|
||||
"An error receiving a SET_CREATIVE_SLOT packet has occurred, you are probably using paper and have BlockBadItemsFromCreativeTab turned on. This setting is needed very rarely, and ONLY if you have regular non-op players with access to /gmc.");
|
||||
}
|
||||
|
||||
ProtocolLibrary.getProtocolManager().addPacketListener(new PacketAdapter(
|
||||
PacketAdapter.params(plugin, PacketType.Play.Client.SET_CREATIVE_SLOT).optionAsync())
|
||||
{
|
||||
|
||||
@Override
|
||||
public void onPacketReceiving(PacketEvent event) {
|
||||
|
||||
if (!Protections.BlockBadItemsFromCreativeTab.isEnabled()
|
||||
|| event.getPlayer().hasPermission("illegalstack.admin"))
|
||||
{
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
try {
|
||||
|
||||
final ItemStack stack = event.getPacket().getItemModifier().readSafely(0);
|
||||
if (CreativeItemCheck.hasUnsafePayload(stack)) {
|
||||
|
||||
final Player player = event.getPlayer();
|
||||
Scheduler.runTaskLater(plugin, () -> {
|
||||
|
||||
player.updateInventory();
|
||||
fListener.getLog().append(Msg.StaffMsgCreativeBlock.getValue(player.getName()),
|
||||
Protections.BlockBadItemsFromCreativeTab);
|
||||
|
||||
}, 5L, player);
|
||||
event.setCancelled(true);
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
} catch (IndexOutOfBoundsException ex) {
|
||||
|
||||
LOGGER.error(
|
||||
"An error receiving a SET_CREATIVE_SLOT packet has occurred, you are probably using paper and have BlockBadItemsFromCreativeTab turned on. This setting is needed very rarely, and ONLY if you have regular non-op players with access to /gmc.");
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
if (Protections.DisableChestsOnMobs.isEnabled()) {
|
||||
|
||||
ProtocolLibrary.getProtocolManager().addPacketListener(
|
||||
new PacketAdapter(plugin, PacketType.Play.Client.USE_ENTITY) {
|
||||
new PacketAdapter(PacketAdapter.params(plugin, PacketType.Play.Client.USE_ENTITY).optionAsync())
|
||||
{
|
||||
|
||||
@Override
|
||||
public void onPacketReceiving(PacketEvent event) {
|
||||
|
||||
if (event.getPacket().getIntegers().read(0) <= 0) {
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
if (IllegalStack.hasChestedAnimals()) {
|
||||
if (IllegalStack.hasChestedAnimals() && Protections.DisableChestsOnMobs.isEnabled()) {
|
||||
|
||||
if (event.isAsync()) {
|
||||
//event.setCancelled(true);
|
||||
new BukkitRunnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
Entity entity;
|
||||
try {
|
||||
entity = event
|
||||
.getPacket()
|
||||
.getEntityModifier(event.getPlayer().getWorld())
|
||||
.read(0);
|
||||
} catch (RuntimeException ex) {
|
||||
//LOGGER.error("Async Packet - Couldn't get an entity from id: ", ex);
|
||||
return;
|
||||
}
|
||||
if (entity instanceof Horse && ((Horse) entity).isTamed()) {
|
||||
ItemStack is = event.getPlayer().getInventory().getItemInHand();
|
||||
if (!fListener.is18() && (is == null || is.getType() != Material.CHEST)) {
|
||||
is = event.getPlayer().getInventory().getItemInOffHand();
|
||||
}
|
||||
if (is == null || is.getType() != Material.CHEST) {
|
||||
return;
|
||||
}
|
||||
exploitMessage(event.getPlayer(), entity);
|
||||
event.setCancelled(true);
|
||||
fTimer.getPunish().put(event.getPlayer(), entity);
|
||||
return;
|
||||
}
|
||||
|
||||
if (entity instanceof ChestedHorse && ((ChestedHorse) entity).isTamed()) {
|
||||
ItemStack is = event.getPlayer().getInventory().getItemInMainHand();
|
||||
if (is == null || is.getType() != Material.CHEST) {
|
||||
is = event.getPlayer().getInventory().getItemInOffHand();
|
||||
}
|
||||
if (is == null || is.getType() != Material.CHEST) {
|
||||
return;
|
||||
}
|
||||
exploitMessage(event.getPlayer(), entity);
|
||||
event.setCancelled(true);
|
||||
|
||||
((ChestedHorse) entity).setCarryingChest(true);
|
||||
((ChestedHorse) entity).setCarryingChest(false);
|
||||
fTimer.getPunish().put(event.getPlayer(), entity);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}.runTaskLater(this.plugin, 1);
|
||||
} else {
|
||||
|
||||
try {
|
||||
Entity entity = null;
|
||||
try {
|
||||
event.getPacket().getEntityModifier(event.getPlayer().getWorld()).read(0);
|
||||
} catch (RuntimeException ex) {
|
||||
LOGGER.info("No entity available from id. ", ex);
|
||||
return;
|
||||
}
|
||||
if (entity instanceof ChestedHorse && ((ChestedHorse) entity).isTamed()) {
|
||||
ItemStack is = event.getPlayer().getInventory().getItemInMainHand();
|
||||
if (is == null || is.getType() != Material.CHEST) {
|
||||
is = event.getPlayer().getInventory().getItemInOffHand();
|
||||
}
|
||||
if (is == null || is.getType() != Material.CHEST) {
|
||||
return;
|
||||
}
|
||||
exploitMessage(event.getPlayer(), entity);
|
||||
|
||||
event.setCancelled(true);
|
||||
// event.setPacket(new PacketContainer(Packet));
|
||||
((ChestedHorse) entity).setCarryingChest(true);
|
||||
((ChestedHorse) entity).setCarryingChest(false);
|
||||
fTimer.getPunish().put(event.getPlayer(), entity);
|
||||
}
|
||||
} catch (IndexOutOfBoundsException ex) {
|
||||
LOGGER.error("An error receiving a USE_ENTITY packet has occurred.", ex);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
Entity entity;
|
||||
try {
|
||||
|
||||
Entity entity = event.getPacket().getEntityModifier(event.getPlayer().getWorld()).read(0);
|
||||
entity = event.getPacket().getEntityModifier(event.getPlayer().getWorld()).read(0);
|
||||
|
||||
} catch (RuntimeException ex) {
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
Scheduler.runTaskLater(this.plugin, () -> {
|
||||
|
||||
if (entity instanceof Horse && ((Horse) entity).isTamed()) {
|
||||
|
||||
ItemStack is = event.getPlayer().getInventory().getItemInHand();
|
||||
if (!fListener.is18() && (is == null || is.getType() != Material.CHEST)) {
|
||||
|
||||
is = event.getPlayer().getInventory().getItemInOffHand();
|
||||
|
||||
}
|
||||
|
||||
if (is == null || is.getType() != Material.CHEST) {
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
exploitMessage(event.getPlayer(), entity);
|
||||
event.setCancelled(true);
|
||||
fTimer.getPunish().put(event.getPlayer(), entity);
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
if (entity instanceof ChestedHorse && ((ChestedHorse) entity).isTamed()) {
|
||||
|
||||
ItemStack is = event.getPlayer().getInventory().getItemInMainHand();
|
||||
if (is == null || is.getType() != Material.CHEST) {
|
||||
|
||||
is = event.getPlayer().getInventory().getItemInOffHand();
|
||||
|
||||
}
|
||||
|
||||
if (is == null || is.getType() != Material.CHEST) {
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
exploitMessage(event.getPlayer(), entity);
|
||||
event.setCancelled(true);
|
||||
|
||||
((ChestedHorse) entity).setCarryingChest(true);
|
||||
((ChestedHorse) entity).setCarryingChest(false);
|
||||
fTimer.getPunish().put(event.getPlayer(), entity);
|
||||
|
||||
}
|
||||
} catch (IndexOutOfBoundsException ex) {
|
||||
LOGGER.error("An error receiving a USE_ENTITY packet has occurred, ", ex);
|
||||
}
|
||||
|
||||
}, 1, entity);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void exploitMessage(Player p, Entity ent) {
|
||||
|
||||
if (!messageDelay.containsKey(p.getUniqueId())) {
|
||||
|
||||
messageDelay.put(p.getUniqueId(), 0L);
|
||||
|
||||
}
|
||||
|
||||
if (System.currentTimeMillis() > messageDelay.get(p.getUniqueId())) {
|
||||
|
||||
p.sendMessage(Msg.PlayerDisabledHorseChestMsg.getValue());
|
||||
fListener.getLog().append2(Msg.ChestPrevented.getValue(p, ent));
|
||||
messageDelay.put(p.getUniqueId(), System.currentTimeMillis() + 2000L);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,11 @@
|
||||
package main.java.me.dniym.logging;
|
||||
|
||||
import java.io.BufferedWriter;
|
||||
import java.io.File;
|
||||
import java.io.FileWriter;
|
||||
import java.io.IOException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import main.java.me.dniym.IllegalStack;
|
||||
import main.java.me.dniym.enums.Msg;
|
||||
import main.java.me.dniym.enums.Protections;
|
||||
@@ -9,37 +15,32 @@ import net.md_5.bungee.api.chat.ClickEvent.Action;
|
||||
import net.md_5.bungee.api.chat.ComponentBuilder;
|
||||
import net.md_5.bungee.api.chat.HoverEvent;
|
||||
import net.md_5.bungee.api.chat.TextComponent;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.io.BufferedWriter;
|
||||
import java.io.File;
|
||||
import java.io.FileWriter;
|
||||
import java.io.IOException;
|
||||
import java.util.Calendar;
|
||||
|
||||
public class Log {
|
||||
|
||||
private static final Logger LOGGER = LogManager.getLogger("IllegalStack/" + Log.class.getSimpleName());
|
||||
private static final SimpleDateFormat dateFormat = new SimpleDateFormat("MM/dd/yy HH:mm:ss");
|
||||
IllegalStack plugin;
|
||||
File file;
|
||||
Calendar date;
|
||||
|
||||
public Log(IllegalStack plugin) {
|
||||
|
||||
this.plugin = plugin;
|
||||
if (Protections.LogOffensesInSeparateFile.isEnabled()) {
|
||||
|
||||
file = new File(plugin.getDataFolder() + "/OffenseLog.txt");
|
||||
|
||||
}
|
||||
date = Calendar.getInstance();
|
||||
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public void append2(String message) {
|
||||
|
||||
this.append(message, null);
|
||||
|
||||
}
|
||||
@@ -47,79 +48,111 @@ public class Log {
|
||||
public void append(String message, Protections prot) {
|
||||
|
||||
if (prot != null) {
|
||||
|
||||
IllegalStackLogEvent event = new IllegalStackLogEvent(message, prot);
|
||||
Bukkit.getPluginManager().callEvent(event);
|
||||
|
||||
if (event.isCancelled()) {
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (Protections.LogOffensesInSeparateFile.isEnabled()) {
|
||||
|
||||
try {
|
||||
LOGGER.info(message);
|
||||
|
||||
IllegalStack.getLogger(message);
|
||||
BufferedWriter bw = new BufferedWriter(new FileWriter(file, true));
|
||||
bw.append(dateStamp()).append(message).append("\r\n");
|
||||
bw.append(dateStamp() + " - ").append(message).append("\r\n");
|
||||
bw.close();
|
||||
|
||||
} catch (IOException e) {
|
||||
|
||||
e.printStackTrace();
|
||||
|
||||
}
|
||||
|
||||
} else {
|
||||
LOGGER.info(message);
|
||||
|
||||
IllegalStack.getLogger(message);
|
||||
|
||||
}
|
||||
|
||||
if (Protections.InGameNotifications.isEnabled()) {
|
||||
|
||||
for (Player p : IllegalStack.getPlugin().getServer().getOnlinePlayers()) {
|
||||
|
||||
if (p.hasPermission("illegalstack.notify")) {
|
||||
|
||||
message = cleanMessage(message);
|
||||
|
||||
if (IllegalStack.isSpigot() && message.contains("@")) {
|
||||
|
||||
TextComponent msg = new TextComponent(message);
|
||||
msg.setHoverEvent(new HoverEvent(
|
||||
HoverEvent.Action.SHOW_TEXT,
|
||||
new ComponentBuilder(Msg.PluginTeleportText.getValue()).create()
|
||||
));
|
||||
msg.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT,
|
||||
new ComponentBuilder(Msg.PluginTeleportText.getValue()).create()));
|
||||
msg.setClickEvent(new ClickEvent(Action.RUN_COMMAND, getTeleportLoc(message)));
|
||||
p.spigot().sendMessage(msg);
|
||||
|
||||
} else {
|
||||
|
||||
p.sendMessage(Msg.PluginPrefix.getValue() + ChatColor.RESET + message);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private String getTeleportLoc(String message) {
|
||||
|
||||
String[] words = message.split("@");
|
||||
String[] coords = words[1].split(" ");
|
||||
String position = "";
|
||||
|
||||
try {
|
||||
|
||||
int x = Integer.parseInt(coords[2]);
|
||||
int y = Integer.parseInt(coords[3]);
|
||||
int z = Integer.parseInt(coords[4]);
|
||||
position = "/istack teleport " + x + " " + y + " " + z + " " + ChatColor.stripColor(coords[1]);
|
||||
|
||||
} catch (NumberFormatException ex) {
|
||||
LOGGER.error("Failed to get position");
|
||||
|
||||
IllegalStack.getLogger("Failed to get position");
|
||||
for (int i = 0; i < coords.length; i++) {
|
||||
LOGGER.error("Coord: {} {}", i, coords[i]);
|
||||
|
||||
IllegalStack.getLogger("Coord: " + i + " " + coords[i]);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return position;
|
||||
|
||||
}
|
||||
|
||||
public String cleanMessage(String message) {
|
||||
|
||||
if (message.contains("@Location{") || message.contains("@ Location{")) {
|
||||
|
||||
String msg = message.substring(message.indexOf('@'));
|
||||
String[] words = msg.split(",");
|
||||
String[] wld = words[0].split("name=");
|
||||
|
||||
msg = wld[0].split("@")[0];
|
||||
/*
|
||||
for(int i = 0; i < words.length;i++)
|
||||
|
||||
for(int i = 0; i < wld.length;i++)
|
||||
*/
|
||||
/*
|
||||
* for(int i = 0; i < words.length;i++)
|
||||
*
|
||||
* for(int i = 0; i < wld.length;i++)
|
||||
*/
|
||||
|
||||
String world = wld[1].substring(0, wld[1].indexOf("}"));
|
||||
int x = (int) Double.parseDouble(words[1].substring(2));
|
||||
@@ -127,100 +160,95 @@ public class Log {
|
||||
int z = (int) Double.parseDouble(words[3].substring(2));
|
||||
|
||||
if (Protections.PlayerOffenseNotifications.isEnabled()) {
|
||||
|
||||
World w = IllegalStack.getPlugin().getServer().getWorld(world);
|
||||
Location offense = new Location(w, x, y, z);
|
||||
for (Player p : w.getPlayers()) {
|
||||
|
||||
if (p.getLocation().distance(offense) <= 10) {
|
||||
//[IllegalStack] -Stopped Retraction Dupe Glitch & Removed Piston @ Location{world=CraftWorld{name=event},x=-266.0,y=81.0,z=-238.0,pitch=0.0,yaw=0.0}
|
||||
|
||||
// [IllegalStack] -Stopped Retraction Dupe Glitch & Removed Piston @
|
||||
// Location{world=CraftWorld{name=event},x=-266.0,y=81.0,z=-238.0,pitch=0.0,yaw=0.0}
|
||||
String mNear = message.substring(0, message.indexOf('@'));
|
||||
mNear = Msg.PluginPrefix.getValue() + " " + Msg.PlayerNearbyNotification.getValue(mNear);
|
||||
p.sendMessage(mNear);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
String coords = "@ " + ChatColor.AQUA + world + " " + x + " " + y + " " + z;
|
||||
//message = message + " @ " + ChatColor.AQUA + world + " " + x + " " + y + " " + z;
|
||||
// message = message + " @ " + ChatColor.AQUA + world + " " + x + " " + y + " "
|
||||
// + z;
|
||||
message = message.substring(0, message.indexOf('@')) + " " + coords;
|
||||
|
||||
}
|
||||
|
||||
return message;
|
||||
|
||||
}
|
||||
|
||||
public String dateStamp() {
|
||||
String now;
|
||||
|
||||
now = monthFromNumber(date.get(Calendar.MONTH)) + " " + date.get(Calendar.DAY_OF_MONTH) + " " + date.get(Calendar.YEAR) + " (" + date
|
||||
.get(Calendar.HOUR) + ":" +
|
||||
date.get(Calendar.MINUTE) + ":" + date.get(Calendar.SECOND) + ") - ";
|
||||
return now;
|
||||
}
|
||||
Date date = new Date(System.currentTimeMillis());
|
||||
return dateFormat.format(date);
|
||||
|
||||
public String monthFromNumber(int month) {
|
||||
|
||||
switch (month) {
|
||||
case 1:
|
||||
return "January";
|
||||
case 2:
|
||||
return "February";
|
||||
case 3:
|
||||
return "March";
|
||||
case 4:
|
||||
return "April";
|
||||
case 5:
|
||||
return "May";
|
||||
case 6:
|
||||
return "June";
|
||||
case 7:
|
||||
return "July";
|
||||
case 8:
|
||||
return "August";
|
||||
case 9:
|
||||
return "September";
|
||||
case 10:
|
||||
return "October";
|
||||
case 11:
|
||||
return "November";
|
||||
case 12:
|
||||
return "December";
|
||||
}
|
||||
return "Unknown";
|
||||
}
|
||||
|
||||
public void notify(Protections prot, String message) {
|
||||
|
||||
if (Protections.LogOffensesInSeparateFile.isEnabled()) {
|
||||
|
||||
try {
|
||||
LOGGER.info("(Notification Only) {} {}", prot.name(), message);
|
||||
|
||||
IllegalStack.getLogger("(Notification Only) " + prot.name() + " " + message);
|
||||
BufferedWriter bw = new BufferedWriter(new FileWriter(file, true));
|
||||
bw.append(dateStamp()).append(message).append("\r\n");
|
||||
bw.close();
|
||||
|
||||
} catch (IOException e) {
|
||||
|
||||
e.printStackTrace();
|
||||
|
||||
}
|
||||
|
||||
} else {
|
||||
LOGGER.info("(Notification Only) {}", message);
|
||||
|
||||
IllegalStack.getLogger("(Notification Only) " + message);
|
||||
|
||||
}
|
||||
|
||||
if (Protections.LogOffensesInSeparateFile.isEnabled()) {
|
||||
|
||||
for (Player p : IllegalStack.getPlugin().getServer().getOnlinePlayers()) {
|
||||
|
||||
if (p.hasPermission("illegalstack.notify")) {
|
||||
|
||||
message = cleanMessage(message);
|
||||
|
||||
if (IllegalStack.isSpigot() && message.contains("@")) {
|
||||
|
||||
TextComponent msg = new TextComponent(ChatColor.GREEN + "(Notification Only) " + message);
|
||||
msg.setHoverEvent(new HoverEvent(
|
||||
HoverEvent.Action.SHOW_TEXT,
|
||||
new ComponentBuilder(Msg.PluginTeleportText.getValue()).create()
|
||||
));
|
||||
msg.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT,
|
||||
new ComponentBuilder(Msg.PluginTeleportText.getValue()).create()));
|
||||
msg.setClickEvent(new ClickEvent(Action.RUN_COMMAND, getTeleportLoc(message)));
|
||||
p.spigot().sendMessage(msg);
|
||||
|
||||
} else {
|
||||
p.sendMessage(ChatColor.RED + "[IllegalStack] - (Notification Only)" + ChatColor.RESET + message);
|
||||
|
||||
p.sendMessage(
|
||||
ChatColor.RED + "[IllegalStack] - (Notification Only)" + ChatColor.RESET + message);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
File diff suppressed because it is too large.
Load diff
@@ -1,128 +1,204 @@
|
||||
package main.java.me.dniym.timers;
|
||||
|
||||
import java.nio.charset.Charset;
|
||||
import java.util.HashSet;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import main.java.me.dniym.IllegalStack;
|
||||
import main.java.me.dniym.enums.Msg;
|
||||
import main.java.me.dniym.enums.Protections;
|
||||
import main.java.me.dniym.listeners.fListener;
|
||||
import main.java.me.dniym.utils.Scheduler;
|
||||
import net.md_5.bungee.api.ChatColor;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockState;
|
||||
import org.bukkit.block.Sign;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.nio.charset.Charset;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
|
||||
public class sTimer implements Runnable {
|
||||
|
||||
private static final HashMap<Block, Player> signBlock = new HashMap<>();
|
||||
private static final HashSet<BlockState[]> entList = new HashSet<>();
|
||||
private static final HashSet<String> checkedChunks = new HashSet<>();
|
||||
private static final Map<Block, Player> signBlock = new ConcurrentHashMap<>();
|
||||
private static final Set<BlockState[]> entList = ConcurrentHashMap.newKeySet();
|
||||
private static final Set<String> checkedChunks = ConcurrentHashMap.newKeySet();
|
||||
private static final Logger LOGGER = LogManager.getLogger("IllegalStack/" + sTimer.class.getSimpleName());
|
||||
private static long signCheck = 0L;
|
||||
private static long chunkScan = 0L;
|
||||
private static boolean scanChunks = false;
|
||||
|
||||
public sTimer() {
|
||||
|
||||
if (Protections.DestroyBadSignsonChunkLoad.isEnabled()) {
|
||||
|
||||
scanChunks = true;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static long getSignCheck() {
|
||||
|
||||
return signCheck;
|
||||
|
||||
}
|
||||
|
||||
public static void setSignCheck(long signCheck) {
|
||||
|
||||
sTimer.signCheck = signCheck;
|
||||
|
||||
}
|
||||
|
||||
public static void checkSign(Block block, Player player) {
|
||||
|
||||
signBlock.put(block, player);
|
||||
if (signCheck == -1L) {
|
||||
|
||||
signCheck = System.currentTimeMillis() + 4000L;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static void checkChunk(String chunkID, BlockState[] tileEntities) {
|
||||
|
||||
if (!checkedChunks.contains(chunkID)) {
|
||||
|
||||
entList.add(tileEntities);
|
||||
checkedChunks.add(chunkID);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
|
||||
if (!Protections.DestroyBadSignsonChunkLoad.isEnabled() || Protections.DestroyBadSignsonChunkLoad.notifyOnly()) {
|
||||
return;
|
||||
if (!IllegalStack.isIsHybridEnvironment() && IllegalStack.isPaperServer()
|
||||
&& IllegalStack.getMajorServerVersion() >= 16)
|
||||
{
|
||||
|
||||
if (IllegalStack.isDisable() || Bukkit.getServer().isStopping()) {
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (IllegalStack.isDisable()) {
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
if (!Protections.DestroyBadSignsonChunkLoad.isEnabled()
|
||||
|| Protections.DestroyBadSignsonChunkLoad.notifyOnly())
|
||||
{
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
if (getSignCheck() != -1L && System.currentTimeMillis() >= getSignCheck()) {
|
||||
|
||||
for (Block b : signBlock.keySet()) {
|
||||
BlockState st = b.getState();
|
||||
if (st instanceof Sign) {
|
||||
Sign sign = (Sign) st;
|
||||
boolean illegal = false;
|
||||
for (String line : sign.getLines()) {
|
||||
if (!Charset.forName(Protections.ValidCharset.getTxtValue()).newEncoder().canEncode(ChatColor.stripColor(
|
||||
line))) {
|
||||
illegal = true;
|
||||
LOGGER.info(
|
||||
"Found a sign with illegal chars: line with invalid text was: {} @ {}",
|
||||
line,
|
||||
sign.getLocation().toString()
|
||||
);
|
||||
|
||||
Scheduler.executeOrScheduleSync(IllegalStack.getPlugin(), () -> {
|
||||
|
||||
BlockState st = b.getState();
|
||||
if (st instanceof Sign) {
|
||||
|
||||
Sign sign = (Sign) st;
|
||||
boolean illegal = false;
|
||||
for (String line : sign.getLines()) {
|
||||
|
||||
if (!Charset.forName(Protections.ValidCharset.getTxtValue()).newEncoder()
|
||||
.canEncode(ChatColor.stripColor(line)))
|
||||
{
|
||||
|
||||
illegal = true;
|
||||
LOGGER.info("Found a sign with illegal chars: line with invalid text was: {} @ {}",
|
||||
line, sign.getLocation().toString());
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Player p = signBlock.get(sign.getBlock());
|
||||
if (illegal) {
|
||||
|
||||
if (p != null) {
|
||||
|
||||
fListener.getLog().append2(Msg.SignRemovedOnPlace.getValue(sign.getLocation(),
|
||||
signBlock.get(b).getName()));
|
||||
|
||||
}
|
||||
|
||||
sign.getBlock().setType(Material.AIR);
|
||||
p.kickPlayer(Msg.SignKickPlayerMsg.getValue());
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Player p = signBlock.get(sign.getBlock());
|
||||
if (illegal) {
|
||||
if (p != null) {
|
||||
fListener.getLog().append2(Msg.SignRemovedOnPlace.getValue(
|
||||
sign.getLocation(),
|
||||
signBlock.get(b).getName()
|
||||
));
|
||||
}
|
||||
sign.getBlock().setType(Material.AIR);
|
||||
p.kickPlayer(Msg.SignKickPlayerMsg.getValue());
|
||||
}
|
||||
}
|
||||
}, b.getLocation());
|
||||
|
||||
}
|
||||
|
||||
signBlock.clear();
|
||||
setSignCheck(-1L);
|
||||
|
||||
}
|
||||
|
||||
if (System.currentTimeMillis() >= chunkScan && scanChunks) {
|
||||
|
||||
HashSet<Block> found = new HashSet<>();
|
||||
for (BlockState[] bs : entList) {
|
||||
|
||||
for (BlockState st : bs) {
|
||||
|
||||
if (st instanceof Sign) {
|
||||
|
||||
Sign sign = (Sign) st;
|
||||
for (String line : sign.getLines()) {
|
||||
if (!Charset
|
||||
.forName(Protections.ValidCharset.getTxtValue())
|
||||
.newEncoder()
|
||||
.canEncode(ChatColor.stripColor(line))) {
|
||||
sign.getBlock().setType(Material.AIR);
|
||||
|
||||
if (!Charset.forName(Protections.ValidCharset.getTxtValue()).newEncoder()
|
||||
.canEncode(ChatColor.stripColor(line)))
|
||||
{
|
||||
|
||||
Scheduler.executeOrScheduleSync(IllegalStack.getPlugin(),
|
||||
() -> sign.getBlock().setType(Material.AIR), sign.getLocation());
|
||||
found.add(sign.getBlock());
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (!found.isEmpty()) {
|
||||
|
||||
for (Block b : found) {
|
||||
|
||||
fListener.getLog().append2(Msg.SignRemoved.getValue(b.getLocation(), ""));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
chunkScan = System.currentTimeMillis() + 5000L;
|
||||
entList.clear();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
package main.java.me.dniym.timers;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import main.java.me.dniym.IllegalStack;
|
||||
import main.java.me.dniym.util.TrackedProjectile;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Entity;
|
||||
|
||||
public class syncTimer implements Runnable {
|
||||
|
||||
IllegalStack plugin;
|
||||
Long nextScan = 0l;
|
||||
int scanDelay = 3;
|
||||
|
||||
private static Set<Entity> entitiesToRemove = new HashSet<Entity>();
|
||||
|
||||
public syncTimer(IllegalStack illegalStack) {
|
||||
|
||||
this.plugin = illegalStack;
|
||||
this.nextScan = System.currentTimeMillis() + (scanDelay * 1000);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
|
||||
if (!IllegalStack.isIsHybridEnvironment() && IllegalStack.isPaperServer()
|
||||
&& IllegalStack.getMajorServerVersion() >= 16)
|
||||
{
|
||||
|
||||
if (IllegalStack.isDisable() || Bukkit.getServer().isStopping()) {
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (IllegalStack.isDisable()) {
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
if (System.currentTimeMillis() >= nextScan) {
|
||||
|
||||
TrackedProjectile.manage();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static void removeEntity(Entity ent) {
|
||||
|
||||
getEntitiesToRemove().add(ent);
|
||||
|
||||
}
|
||||
|
||||
public static Set<Entity> getEntitiesToRemove() {
|
||||
|
||||
return entitiesToRemove;
|
||||
|
||||
}
|
||||
|
||||
public static void setEntitiesToRemove(Set<Entity> entitiesToRemove) {
|
||||
|
||||
syncTimer.entitiesToRemove = entitiesToRemove;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,122 @@
|
||||
package main.java.me.dniym.util;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import main.java.me.dniym.IllegalStack;
|
||||
import main.java.me.dniym.enums.Protections;
|
||||
import main.java.me.dniym.utils.Scheduler;
|
||||
import org.bukkit.entity.Arrow;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Projectile;
|
||||
import org.bukkit.entity.ThrowableProjectile;
|
||||
|
||||
public class TrackedProjectile {
|
||||
|
||||
private static final Set<TrackedProjectile> trackedProjectiles = new HashSet<TrackedProjectile>();
|
||||
private Long despawnTimestamp = 0l;
|
||||
private Entity entity;
|
||||
|
||||
public TrackedProjectile(Projectile proj) {
|
||||
|
||||
if (alreadyTracked(proj) || !shouldTrack(proj))
|
||||
return;
|
||||
|
||||
entity = proj;
|
||||
despawnTimestamp = System.currentTimeMillis() + (Protections.ProjectileDespawnDelay.getIntValue() * 1000);
|
||||
trackedProjectiles.add(this);
|
||||
|
||||
}
|
||||
|
||||
private boolean shouldTrack(Projectile proj) {
|
||||
|
||||
if (proj != null) {
|
||||
|
||||
if (proj instanceof Arrow || proj instanceof ThrowableProjectile)
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
public static boolean alreadyTracked(Entity ent) {
|
||||
|
||||
for (TrackedProjectile tp : trackedProjectiles)
|
||||
if (ent.equals(tp.entity))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
public static void manage() {
|
||||
|
||||
Set<TrackedProjectile> removed = new HashSet<>();
|
||||
|
||||
for (TrackedProjectile tp : trackedProjectiles) {
|
||||
|
||||
if (System.currentTimeMillis() > tp.despawnTimestamp) {
|
||||
|
||||
// projectile has expired remove it.
|
||||
if (tp.entity != null) {
|
||||
|
||||
tp.entity.getScheduler().run(IllegalStack.getPlugin(), task -> {
|
||||
|
||||
removed.add(tp);
|
||||
tp.entity.remove();
|
||||
|
||||
}, null);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
trackedProjectiles.removeAll(removed);
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* I cannot figure out why this will not work async. Doing this async always
|
||||
* seems to result in the server crashing.. I suspected the problem was due to
|
||||
* the ProjectileLaunchEvent is fired twice whenever a projectile is launched,
|
||||
* this seemed to be causing 4 objects to get tracked when 2 were fired..
|
||||
* However the crash persists whenever I try to do this async it pukes. Nothing
|
||||
* that is going on here is difficult to do sync. I have moved this to a sync
|
||||
* timer and it works flawlessly...
|
||||
*/
|
||||
public static void manageAsync() {
|
||||
|
||||
Set<TrackedProjectile> removed = new HashSet<>();
|
||||
|
||||
for (TrackedProjectile tp : trackedProjectiles) {
|
||||
|
||||
if (System.currentTimeMillis() > tp.despawnTimestamp) {
|
||||
|
||||
// projectile has expired remove it.
|
||||
if (tp.entity != null) {
|
||||
|
||||
removed.add(tp);
|
||||
Entity remove = tp.entity;
|
||||
// tp.entity.remove();
|
||||
Scheduler.executeOrScheduleSync(IllegalStack.getPlugin(), () -> {
|
||||
|
||||
remove.remove();
|
||||
|
||||
}, remove);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// IllegalStack.getLogger("There are " + trackedProjectiles.size() + "
|
||||
// projectiles being tracked");
|
||||
trackedProjectiles.removeAll(removed);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -11,29 +11,41 @@ import org.bukkit.plugin.Plugin;
|
||||
public class BookCrashExploitCheck extends PacketAdapter {
|
||||
|
||||
public BookCrashExploitCheck(final Plugin plugin) {
|
||||
|
||||
super(plugin, PacketType.Play.Client.WINDOW_CLICK);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPacketReceiving(final PacketEvent event) {
|
||||
|
||||
Player player = event.getPlayer();
|
||||
StructureModifier<Integer> integers = event.getPacket().getIntegers();
|
||||
|
||||
if (player != null) {
|
||||
|
||||
final InventoryView inventoryView = event.getPlayer().getOpenInventory();
|
||||
|
||||
if (inventoryView != null && integers.size() > 1) {
|
||||
|
||||
final int slot = integers.read(1) - 3;
|
||||
final int maxSlots = inventoryView.countSlots();
|
||||
PacketAttack pa = PacketAttack.findPlayer(player.getUniqueId());
|
||||
if (slot > maxSlots || slot < 0) {
|
||||
|
||||
event.setCancelled(pa.addAttempt(event, "WINDOW_INVALID_CLICK"));
|
||||
|
||||
} else {
|
||||
|
||||
event.setCancelled(pa.addAttempt(event, "WINDOW_CLICK_SPAM"));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
} //else
|
||||
//event.setCancelled(true);
|
||||
|
||||
} // else
|
||||
// event.setCancelled(true);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,73 +1,58 @@
|
||||
package main.java.me.dniym.utils;
|
||||
/*
|
||||
package main.java.me.dniym.utils;
|
||||
|
||||
public class DropExploit {
|
||||
private static final HashSet<DropExploit> trackedBlocks = new HashSet<>();
|
||||
private final Block block;
|
||||
private final HashMap<ItemStack, Long> items = new HashMap<>();
|
||||
private final int id = 0;
|
||||
|
||||
public DropExploit(Block block) {
|
||||
this.block = block;
|
||||
trackedBlocks.add(this);
|
||||
}
|
||||
|
||||
public static DropExploit findBlock(Block block) {
|
||||
|
||||
for (DropExploit de : trackedBlocks)
|
||||
if (de.block.equals(block))
|
||||
return de;
|
||||
return new DropExploit(block);
|
||||
}
|
||||
|
||||
public boolean tick(ItemStack item) {
|
||||
NBTItem nbti = new NBTItem(item);
|
||||
|
||||
//if( !nbti.hasKey("TimeStamp")) {
|
||||
if (nbti.getLong("TimeStamp") == null || nbti.getLong("TimeStamp") == 0) {
|
||||
nbti.setLong("TimeStamp", System.currentTimeMillis() + 2500L);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (System.currentTimeMillis() >= nbti.getLong("TimeStamp")) {
|
||||
nbti.setLong("TimeStamp", System.currentTimeMillis() + 2500L);
|
||||
return false;
|
||||
}
|
||||
fListener.getLog().append2(Msg.StaffMsgDropperExploit.getValue(block.getLocation().toString()));
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean tick(ItemStack item) {
|
||||
|
||||
NamespacedKey ts = new NamespacedKey(IllegalStack.getPlugin(), "timeStamp");
|
||||
|
||||
if (!item.hasItemMeta() || !item.getItemMeta().getPersistentDataContainer().has(ts, PersistentDataType.LONG)) {
|
||||
if (item.hasItemMeta())
|
||||
setData(item);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (System.currentTimeMillis() >= item.getItemMeta().getPersistentDataContainer().get(ts, PersistentDataType.LONG)) {
|
||||
setData(item);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
fListener.getLog().append2(Msg.StaffMsgDropperExploit.getValue(block.getLocation().toString()));
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
private void setData(ItemStack item) {
|
||||
|
||||
ItemMeta meta = item.getItemMeta();
|
||||
PersistentDataContainer data = meta.getPersistentDataContainer();
|
||||
NamespacedKey ts = new NamespacedKey(IllegalStack.getPlugin(), "timeStamp");
|
||||
meta.getPersistentDataContainer().set(ts, PersistentDataType.LONG, System.currentTimeMillis() + 2500l);
|
||||
item.setItemMeta(meta);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
* package main.java.me.dniym.utils;
|
||||
*
|
||||
* public class DropExploit { private static final HashSet<DropExploit>
|
||||
* trackedBlocks = new HashSet<>(); private final Block block; private final
|
||||
* HashMap<ItemStack, Long> items = new HashMap<>(); private final int id = 0;
|
||||
*
|
||||
* public DropExploit(Block block) { this.block = block;
|
||||
* trackedBlocks.add(this); }
|
||||
*
|
||||
* public static DropExploit findBlock(Block block) {
|
||||
*
|
||||
* for (DropExploit de : trackedBlocks) if (de.block.equals(block)) return de;
|
||||
* return new DropExploit(block); }
|
||||
*
|
||||
* public boolean tick(ItemStack item) { NBTItem nbti = new NBTItem(item);
|
||||
*
|
||||
* //if( !nbti.hasKey("TimeStamp")) { if (nbti.getLong("TimeStamp") == null ||
|
||||
* nbti.getLong("TimeStamp") == 0) { nbti.setLong("TimeStamp",
|
||||
* System.currentTimeMillis() + 2500L); return false; }
|
||||
*
|
||||
* if (System.currentTimeMillis() >= nbti.getLong("TimeStamp")) {
|
||||
* nbti.setLong("TimeStamp", System.currentTimeMillis() + 2500L); return false;
|
||||
* } fListener.getLog().append2(Msg.StaffMsgDropperExploit.getValue(block.
|
||||
* getLocation().toString())); return true; }
|
||||
*
|
||||
* public boolean tick(ItemStack item) {
|
||||
*
|
||||
* NamespacedKey ts = new NamespacedKey(IllegalStack.getPlugin(), "timeStamp");
|
||||
*
|
||||
* if (!item.hasItemMeta() ||
|
||||
* !item.getItemMeta().getPersistentDataContainer().has(ts,
|
||||
* PersistentDataType.LONG)) { if (item.hasItemMeta()) setData(item); return
|
||||
* false; }
|
||||
*
|
||||
* if (System.currentTimeMillis() >=
|
||||
* item.getItemMeta().getPersistentDataContainer().get(ts,
|
||||
* PersistentDataType.LONG)) { setData(item); return false; }
|
||||
*
|
||||
*
|
||||
* fListener.getLog().append2(Msg.StaffMsgDropperExploit.getValue(block.
|
||||
* getLocation().toString())); return true;
|
||||
*
|
||||
* }
|
||||
*
|
||||
* private void setData(ItemStack item) {
|
||||
*
|
||||
* ItemMeta meta = item.getItemMeta(); PersistentDataContainer data =
|
||||
* meta.getPersistentDataContainer(); NamespacedKey ts = new
|
||||
* NamespacedKey(IllegalStack.getPlugin(), "timeStamp");
|
||||
* meta.getPersistentDataContainer().set(ts, PersistentDataType.LONG,
|
||||
* System.currentTimeMillis() + 2500l); item.setItemMeta(meta);
|
||||
*
|
||||
* }
|
||||
*
|
||||
* }
|
||||
*/
|
||||
@@ -8,6 +8,7 @@
|
||||
*/
|
||||
package main.java.me.dniym.utils;
|
||||
|
||||
import java.util.Arrays;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.HumanEntity;
|
||||
@@ -20,43 +21,43 @@ import org.bukkit.inventory.InventoryHolder;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
public class GuiObject implements InventoryHolder, Listener {
|
||||
|
||||
private final Inventory inv;
|
||||
|
||||
public GuiObject() {
|
||||
// Create a new inventory, with "this" owner for comparison with other inventories, a size of nine, called example
|
||||
|
||||
// Create a new inventory, with "this" owner for comparison with other
|
||||
// inventories, a size of nine, called
|
||||
// example
|
||||
inv = Bukkit.createInventory(this, 9, "Example");
|
||||
|
||||
// Put the items into the inventory
|
||||
initializeItems();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Inventory getInventory() {
|
||||
|
||||
return inv;
|
||||
|
||||
}
|
||||
|
||||
// You can call this whenever you want to put the items in or use your existing gui code
|
||||
// You can call this whenever you want to put the items in or use your existing
|
||||
// gui code
|
||||
public void initializeItems() {
|
||||
inv.addItem(createGuiItem(
|
||||
Material.DIAMOND_SWORD,
|
||||
"Example Sword",
|
||||
"�aFirst line of the lore",
|
||||
"�bSecond line of the lore"
|
||||
));
|
||||
inv.addItem(createGuiItem(
|
||||
Material.IRON_HELMET,
|
||||
"�bExample Helmet",
|
||||
"�aFirst line of the lore",
|
||||
"�bSecond line of the lore"
|
||||
));
|
||||
|
||||
inv.addItem(createGuiItem(Material.DIAMOND_SWORD, "Example Sword", "�aFirst line of the lore",
|
||||
"�bSecond line of the lore"));
|
||||
inv.addItem(createGuiItem(Material.IRON_HELMET, "�bExample Helmet", "�aFirst line of the lore",
|
||||
"�bSecond line of the lore"));
|
||||
|
||||
}
|
||||
|
||||
// Nice little method to create a gui item with a custom name, and description
|
||||
protected ItemStack createGuiItem(final Material material, final String name, final String... lore) {
|
||||
|
||||
final ItemStack item = new ItemStack(material, 1);
|
||||
final ItemMeta meta = item.getItemMeta();
|
||||
|
||||
@@ -66,32 +67,44 @@ public class GuiObject implements InventoryHolder, Listener {
|
||||
meta.setLore(Arrays.asList(lore));
|
||||
item.setItemMeta(meta);
|
||||
return item;
|
||||
|
||||
}
|
||||
|
||||
// You can open the inventory with this
|
||||
public void openInventory(final HumanEntity ent) {
|
||||
|
||||
ent.openInventory(inv);
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Highly recommend using this method as you can easily identify YOUR custom inventory object by simply doing
|
||||
* if (inventory.getHolder() instanceof GuiObject)
|
||||
* Highly recommend using this method as you can easily identify YOUR custom
|
||||
* inventory object by simply doing if (inventory.getHolder() instanceof
|
||||
* GuiObject)
|
||||
*/
|
||||
|
||||
@EventHandler
|
||||
public void onInventoryClick(final InventoryClickEvent e) {
|
||||
|
||||
if (e.getInventory().getHolder() != this) {
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
e.setCancelled(true);
|
||||
final ItemStack clickedItem = e.getCurrentItem();
|
||||
// verify current item is not null
|
||||
if (clickedItem == null || clickedItem.getType() == Material.AIR) {
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
final Player p = (Player) e.getWhoClicked();
|
||||
// Using slots click is a best option for your inventory click's
|
||||
p.sendMessage("You clicked at slot " + e.getRawSlot());
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -12,18 +12,24 @@ public class MagicHook {
|
||||
public static boolean isMagicItem(ItemStack is) {
|
||||
|
||||
if (magicApi == null) {
|
||||
|
||||
getApi();
|
||||
|
||||
}
|
||||
|
||||
return magicApi.isBrush(is) || magicApi.isSpell(is) || magicApi.isUpgrade(is) || magicApi.isWand(is);
|
||||
|
||||
}
|
||||
|
||||
private static void getApi() {
|
||||
|
||||
Plugin magicPlugin = Bukkit.getPluginManager().getPlugin("Magic");
|
||||
if (!(magicPlugin instanceof MagicAPI)) {
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
magicApi = ((MagicAPI) magicPlugin);
|
||||
|
||||
}
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
package main.java.me.dniym.utils;
|
||||
|
||||
|
||||
import de.tr7zw.nbtapi.NBTCompound;
|
||||
import de.tr7zw.nbtapi.NBTCompoundList;
|
||||
import de.tr7zw.nbtapi.NBTEntity;
|
||||
import de.tr7zw.nbtapi.NBTItem;
|
||||
import de.tr7zw.nbtapi.NBTListCompound;
|
||||
import de.tr7zw.nbtapi.iface.ReadWriteNBT;
|
||||
import main.java.me.dniym.enums.Msg;
|
||||
import main.java.me.dniym.enums.Protections;
|
||||
import main.java.me.dniym.listeners.fListener;
|
||||
@@ -23,36 +22,52 @@ public class NBTApiStuff {
|
||||
private static final Logger LOGGER = LogManager.getLogger("IllegalStack/" + NBTApiStuff.class.getSimpleName());
|
||||
|
||||
public static ItemStack checkTimestampLegacy(ItemStack item) {
|
||||
//Old backwards compatible version
|
||||
|
||||
// Old backwards compatible version
|
||||
NBTItem nbti = new NBTItem(item);
|
||||
|
||||
if (System.currentTimeMillis() >= nbti.getLong("TimeStamp")) {
|
||||
|
||||
nbti.removeKey("TimeStamp");
|
||||
nbti.setLong("TimeStamp", System.currentTimeMillis() + 4500L);
|
||||
|
||||
} else {
|
||||
//looped item?
|
||||
return null; //return null if the item is looping
|
||||
|
||||
// looped item?
|
||||
return null; // return null if the item is looping
|
||||
|
||||
}
|
||||
return nbti.getItem(); //return the item with an updated timestamp.
|
||||
|
||||
return nbti.getItem(); // return the item with an updated timestamp.
|
||||
|
||||
}
|
||||
|
||||
public static ItemStack addNBTTagLegacy(ItemStack item, String value) {
|
||||
|
||||
NBTItem nbti = new NBTItem(item);
|
||||
if (!nbti.hasKey(value)) {
|
||||
|
||||
nbti.setString(value, value);
|
||||
return nbti.getItem();
|
||||
|
||||
}
|
||||
|
||||
return null;
|
||||
|
||||
}
|
||||
|
||||
public static ItemStack updateTimeStampLegacy(ItemStack item) {
|
||||
|
||||
NBTItem nbti = new NBTItem(item);
|
||||
if (!nbti.hasKey("TimeStamp")) {
|
||||
|
||||
nbti.setLong("TimeStamp", (System.currentTimeMillis() + 4500L));
|
||||
return nbti.getItem();
|
||||
|
||||
}
|
||||
|
||||
return null;
|
||||
|
||||
}
|
||||
|
||||
public static void getEntityTags(Entity ent) {
|
||||
@@ -64,90 +79,110 @@ public class NBTApiStuff {
|
||||
|
||||
NBTCompound tag = nbtent.getCompound("Offers");
|
||||
LOGGER.info("offers-> {} - {}", tag.asNBTString(), tag.getType("Recipes"));
|
||||
for (NBTListCompound s : nbtent.getCompound("Offers").getCompoundList("Recipes")) {
|
||||
for (ReadWriteNBT s : nbtent.getCompound("Offers").getCompoundList("Recipes")) {
|
||||
|
||||
if (s.getInteger("specialPrice") < -8) {
|
||||
|
||||
LOGGER.info("Old Price: {}", s.getInteger("specialPrice"));
|
||||
s.setInteger("specialPrice", -8);
|
||||
LOGGER.info("Updated Price: {}", s.getInteger("specialPrice"));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//for(NBTListCompound s:nbtent.getCompoundList("Gossips"))
|
||||
//for(String s:nbtent.getKeys())
|
||||
// for(NBTListCompound s:nbtent.getCompoundList("Gossips"))
|
||||
// for(String s:nbtent.getKeys())
|
||||
}
|
||||
|
||||
public static boolean hasNbtTagLegacy(ItemStack item, String tag) {
|
||||
|
||||
NBTItem nbti = new NBTItem(item);
|
||||
return nbti.hasKey(tag);
|
||||
|
||||
}
|
||||
|
||||
public static int isBadShulkerLegacy(ItemStack is) {
|
||||
/*
|
||||
NBTItem nbti2 = new NBTItem(is);
|
||||
for(String key:nbti2.getKeys())
|
||||
{
|
||||
|
||||
NBTCompoundList nbtList = nbti2.getCompoundList(key);
|
||||
|
||||
if(nbti2.getType(key) == NBTType.NBTTagList)
|
||||
{
|
||||
NBTTagList nestedList = nbti2.getObject(key, NBTTagList.class);
|
||||
if(nestedList != null) {
|
||||
|
||||
} else {
|
||||
nbti2.removeKey(key);
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
/*
|
||||
* NBTItem nbti2 = new NBTItem(is); for(String key:nbti2.getKeys()) {
|
||||
*
|
||||
* NBTCompoundList nbtList = nbti2.getCompoundList(key);
|
||||
*
|
||||
* if(nbti2.getType(key) == NBTType.NBTTagList) { NBTTagList nestedList =
|
||||
* nbti2.getObject(key, NBTTagList.class); if(nestedList != null) {
|
||||
*
|
||||
* } else { nbti2.removeKey(key); } } }
|
||||
*/
|
||||
|
||||
if (is.getType().name().contains("SHULKER_BOX")) {
|
||||
|
||||
NBTItem nbti = new NBTItem(is);
|
||||
NBTCompound tag = nbti.getCompound("BlockEntityTag");
|
||||
if (tag == null) {
|
||||
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
NBTCompoundList itemTag = tag.getCompoundList("Items");
|
||||
if (itemTag == null) {
|
||||
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
if (itemTag.size() > 27) {
|
||||
|
||||
return itemTag.size();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
public static void hasBadCustomDataOnArmorLegacy(Player p) {
|
||||
|
||||
ItemStack is = p.getInventory().getHelmet();
|
||||
String slot = "";
|
||||
if (hasBadCustomDataLegacy(p.getInventory().getBoots())) {
|
||||
|
||||
slot = "boots";
|
||||
p.getInventory().setBoots(new ItemStack(Material.AIR));
|
||||
|
||||
} else if (hasBadCustomDataLegacy(p.getInventory().getChestplate())) {
|
||||
|
||||
slot = "chestplate";
|
||||
p.getInventory().setChestplate(new ItemStack(Material.AIR));
|
||||
|
||||
} else if (hasBadCustomDataLegacy(p.getInventory().getHelmet())) {
|
||||
|
||||
p.getInventory().setHelmet(new ItemStack(Material.AIR));
|
||||
slot = "helmet";
|
||||
|
||||
} else if (hasBadCustomDataLegacy(p.getInventory().getLeggings())) {
|
||||
|
||||
p.getInventory().setLeggings(new ItemStack(Material.AIR));
|
||||
slot = "leggings";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (!slot.isEmpty()) {
|
||||
fListener.getLog().append2(Msg.CustomAttribsRemoved2.getValue(p, is, slot));
|
||||
}
|
||||
|
||||
fListener.getLog().append2(Msg.CustomAttribsRemoved2.getValue(p, is, slot));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static boolean hasBadCustomDataLegacy(ItemStack is) {
|
||||
|
||||
if (is == null) {
|
||||
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
NBTItem nbti = new NBTItem(is);
|
||||
@@ -158,65 +193,83 @@ public class NBTApiStuff {
|
||||
}
|
||||
|
||||
public static boolean checkForBadCustomDataLegacy(ItemStack is, Object obj) {
|
||||
|
||||
NBTItem nbti = new NBTItem(is);
|
||||
NBTCompoundList itemTag = nbti.getCompoundList("AttributeModifiers");
|
||||
if (itemTag == null) {
|
||||
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
if (itemTag.size() > 0) {
|
||||
|
||||
itemTag.clear();
|
||||
nbti.setObject("AttributeModifiers", itemTag);
|
||||
|
||||
|
||||
StringBuilder attribs = new StringBuilder();
|
||||
attribs.append("Custom Attribute Data");
|
||||
fListener.getLog().append(Msg.CustomAttribsRemoved3.getValue(is, obj, attribs), Protections.RemoveCustomAttributes);
|
||||
fListener.getLog().append(Msg.CustomAttribsRemoved3.getValue(is, obj, attribs),
|
||||
Protections.RemoveCustomAttributes);
|
||||
|
||||
if (obj instanceof Player) {
|
||||
|
||||
((Player) obj).getInventory().remove(is);
|
||||
|
||||
} else {
|
||||
|
||||
LOGGER.error(
|
||||
"The object type: {} is not accounted for in the legacy NBT Api check.. Please report this to dNiym at the IllegalStack discord or via spigot!",
|
||||
obj.toString()
|
||||
);
|
||||
obj.toString());
|
||||
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
public static void checkForBadCustomDataLegacy(ItemStack is, Player p, boolean sendToPlayer) {
|
||||
|
||||
boolean helmet = false;
|
||||
NBTItem nbti = new NBTItem(is);
|
||||
NBTCompoundList itemTag = nbti.getCompoundList("AttributeModifiers");
|
||||
if (itemTag == null) {
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
if (itemTag.size() > 0) {
|
||||
|
||||
itemTag.clear();
|
||||
nbti.setObject("AttributeModifiers", itemTag);
|
||||
|
||||
if (sendToPlayer) {
|
||||
|
||||
p.sendMessage(Msg.CustomAttribsRemoved.getValue(p, is, "Custom Attribute Data"));
|
||||
|
||||
} else {
|
||||
|
||||
fListener.getLog().append2(Msg.CustomAttribsRemoved.getValue(p, is, "Custom Attribute Data"));
|
||||
|
||||
}
|
||||
|
||||
p.getInventory().remove(is);
|
||||
|
||||
// p.getInventory().addItem(nbti.getItem());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static void isProCosmeticsLegacy(ItemStack is) {
|
||||
|
||||
NBTItem nbti = new NBTItem(is);
|
||||
nbti.hasKey("PROCOSMETICS");
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -20,14 +20,12 @@ import org.bukkit.persistence.PersistentDataContainer;
|
||||
import org.bukkit.persistence.PersistentDataType;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
|
||||
import java.awt.Image;
|
||||
import java.util.HashSet;
|
||||
|
||||
public class NBTStuff {
|
||||
|
||||
private static final Logger LOGGER = LogManager.getLogger("IllegalStack/" + NBTStuff.class.getSimpleName());
|
||||
|
||||
public static ItemStack addNBTTag(ItemStack item, String value, Protections prot) {
|
||||
|
||||
if (hasSpigotNBT() && item.hasItemMeta()) {
|
||||
|
||||
ItemMeta im = item.getItemMeta();
|
||||
@@ -39,218 +37,314 @@ public class NBTStuff {
|
||||
item.setItemMeta(im);
|
||||
|
||||
} else if (IllegalStack.isNbtAPI()) {
|
||||
|
||||
item = NBTApiStuff.addNBTTagLegacy(item, value);
|
||||
|
||||
} else {
|
||||
|
||||
Msg.StaffNoNBTAPI.getValue(prot.name());
|
||||
|
||||
}
|
||||
|
||||
return item;
|
||||
|
||||
}
|
||||
|
||||
public static ItemStack updateTimeStamp(ItemStack item, Protections prot) {
|
||||
|
||||
if (hasSpigotNBT() && item.hasItemMeta()) {
|
||||
//use the new built in methods.
|
||||
// use the new built in methods.
|
||||
|
||||
ItemMeta im = item.getItemMeta();
|
||||
|
||||
PersistentDataContainer data = im.getPersistentDataContainer();
|
||||
NamespacedKey key = new NamespacedKey(IllegalStack.getPlugin(), "timestamp");
|
||||
if (data.has(key, PersistentDataType.LONG)) {
|
||||
|
||||
return null;
|
||||
|
||||
}
|
||||
|
||||
data.set(key, PersistentDataType.LONG, (System.currentTimeMillis() + 4500L));
|
||||
item.setItemMeta(im);
|
||||
|
||||
} else if (IllegalStack.isNbtAPI()) {
|
||||
|
||||
item = NBTApiStuff.updateTimeStampLegacy(item);
|
||||
|
||||
} else {
|
||||
|
||||
Msg.StaffNoNBTAPI.getValue(prot.name());
|
||||
|
||||
}
|
||||
|
||||
return item;
|
||||
|
||||
}
|
||||
|
||||
public static ItemStack checkTimestamp(ItemStack item, Protections prot) {
|
||||
|
||||
if (hasSpigotNBT()) {
|
||||
//use the new built in methods.
|
||||
|
||||
// use the new built in methods.
|
||||
if (item.hasItemMeta()) {
|
||||
|
||||
ItemMeta im = item.getItemMeta();
|
||||
|
||||
PersistentDataContainer data = im.getPersistentDataContainer();
|
||||
NamespacedKey key = new NamespacedKey(IllegalStack.getPlugin(), "timestamp");
|
||||
if (data.has(key, PersistentDataType.LONG)) {
|
||||
|
||||
Long Timestamp = data.get(key, PersistentDataType.LONG);
|
||||
if (System.currentTimeMillis() >= Timestamp) { //timestamp expired reset it
|
||||
if (System.currentTimeMillis() >= Timestamp) { // timestamp expired reset it
|
||||
|
||||
data.set(key, PersistentDataType.LONG, System.currentTimeMillis() + 4500L);
|
||||
item.setItemMeta(im);
|
||||
|
||||
} else {
|
||||
|
||||
return null;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
} else if (IllegalStack.isNbtAPI()) {
|
||||
|
||||
item = NBTApiStuff.checkTimestampLegacy(item);
|
||||
|
||||
} else {
|
||||
|
||||
Msg.StaffNoNBTAPI.getValue(prot.name());
|
||||
|
||||
}
|
||||
|
||||
return item;
|
||||
|
||||
}
|
||||
|
||||
public static boolean hasSpigotNBT() {
|
||||
|
||||
return fListener.getInstance().is115() || fListener.getInstance().is114();
|
||||
|
||||
}
|
||||
|
||||
public static boolean isProCosmetics(ItemStack is, Protections prot) {
|
||||
|
||||
if (IllegalStack.getProCosmetics() != null) {
|
||||
|
||||
if (IllegalStack.isNbtAPI()) {
|
||||
|
||||
NBTApiStuff.isProCosmeticsLegacy(is);
|
||||
|
||||
} else {
|
||||
|
||||
Msg.StaffNoNBTAPI.getValue(prot.name());
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
public static Boolean hasNbtTag(String pluginName, ItemStack item, String tag, Protections prot) {
|
||||
|
||||
if (item == null) {
|
||||
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
Plugin plugin = Bukkit.getServer().getPluginManager().getPlugin(pluginName);
|
||||
if (plugin == null) {
|
||||
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
if (hasSpigotNBT()) {
|
||||
|
||||
if (item.hasItemMeta()) {
|
||||
|
||||
ItemMeta im = item.getItemMeta();
|
||||
|
||||
PersistentDataContainer data = im.getPersistentDataContainer();
|
||||
NamespacedKey key = new NamespacedKey(plugin, tag);
|
||||
return data.has(key, PersistentDataType.STRING);
|
||||
|
||||
}
|
||||
|
||||
} else if (IllegalStack.isNbtAPI()) {
|
||||
|
||||
return NBTApiStuff.hasNbtTagLegacy(item, tag);
|
||||
|
||||
} else {
|
||||
|
||||
Msg.StaffNoNBTAPI.getValue(prot.name());
|
||||
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
public static int isBadShulker(ItemStack is) {
|
||||
|
||||
if (!IllegalStack.isNbtAPI() && Protections.DestroyInvalidShulkers.isEnabled()) {
|
||||
|
||||
Protections.DestroyInvalidShulkers.setEnabled(false);
|
||||
LOGGER.error(
|
||||
"Protection DestroyInvalidShulkers was enabled, however NBTAPI 2.0+ was not loaded on this server, this protection will only work if NBTAPI is present and running. This protection has automatically been disabled. ");
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
if (!Protections.DestroyInvalidShulkers.isEnabled()) {
|
||||
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
return NBTApiStuff.isBadShulkerLegacy(is);
|
||||
|
||||
|
||||
}
|
||||
|
||||
public static boolean hasBadCustomData(ItemStack is) {
|
||||
|
||||
ItemMeta im = is.getItemMeta();
|
||||
return main.java.me.dniym.checks.BadAttributeCheck.hasNonDefaultAttributeModifiers(is);
|
||||
|
||||
if (IllegalStack.isHasAttribAPI() && is.hasItemMeta() && im.hasAttributeModifiers()) {
|
||||
|
||||
return true;
|
||||
} else if (IllegalStack.isNbtAPI()) {
|
||||
return NBTApiStuff.hasBadCustomDataLegacy(is);
|
||||
}
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public static void checkForNegativeDurability(ItemStack is, Player p) {
|
||||
|
||||
if (is == null) {
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
if (IllegalStack.isHasAttribAPI()) {
|
||||
|
||||
if (is.hasItemMeta() && is.getItemMeta() instanceof Damageable) {
|
||||
|
||||
Damageable dmg = (Damageable) is.getItemMeta();
|
||||
if (dmg.getDamage() > is.getType().getMaxDurability()) {
|
||||
fListener.getLog().append(Msg.IllegalStackDurability.getValue(p, is), Protections.FixNegativeDurability);
|
||||
|
||||
fListener.getLog().append(Msg.IllegalStackDurability.getValue(p, is),
|
||||
Protections.FixNegativeDurability);
|
||||
dmg.setDamage(is.getType().getMaxDurability());
|
||||
is.setItemMeta((ItemMeta) dmg);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static void checkForBadCustomData(ItemStack is, Player p, boolean sendToPlayer) {
|
||||
|
||||
if(!is.hasItemMeta())
|
||||
return;
|
||||
|
||||
if (!is.hasItemMeta())
|
||||
return;
|
||||
|
||||
ItemMeta im = is.getItemMeta();
|
||||
|
||||
if (IllegalStack.isHasAttribAPI() && im.hasAttributeModifiers()) {
|
||||
|
||||
java.util.Set<java.util.UUID> defaultUuids = main.java.me.dniym.checks.BadAttributeCheck
|
||||
.collectDefaultModifierUuidsPublic(is.getType());
|
||||
com.google.common.collect.Multimap<Attribute, AttributeModifier> mods = im.getAttributeModifiers();
|
||||
|
||||
StringBuilder attribs = new StringBuilder();
|
||||
HashSet<Attribute> toRemove = new HashSet<>();
|
||||
for (Attribute a : im.getAttributeModifiers().keySet()) {
|
||||
for (AttributeModifier st : im.getAttributeModifiers(a)) {
|
||||
attribs.append(" ").append(st.getName()).append(" value: ").append(st.getAmount());
|
||||
boolean anyCustom = false;
|
||||
for (java.util.Map.Entry<Attribute, AttributeModifier> entry : mods.entries()) {
|
||||
|
||||
AttributeModifier mod = entry.getValue();
|
||||
if (!defaultUuids.contains(mod.getUniqueId())) {
|
||||
|
||||
anyCustom = true;
|
||||
attribs.append(" ").append(mod.getName()).append(" value: ").append(mod.getAmount());
|
||||
|
||||
}
|
||||
|
||||
toRemove.add(a);
|
||||
}
|
||||
|
||||
if (!anyCustom) {
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
if (sendToPlayer) {
|
||||
|
||||
p.sendMessage(Msg.CustomAttribsRemoved.getValue(p, is, attribs.toString()));
|
||||
|
||||
} else {
|
||||
fListener.getLog().append(
|
||||
Msg.CustomAttribsRemoved.getValue(p, is, attribs.toString()),
|
||||
Protections.RemoveCustomAttributes
|
||||
);
|
||||
|
||||
fListener.getLog().append(Msg.CustomAttribsRemoved.getValue(p, is, attribs.toString()),
|
||||
Protections.RemoveCustomAttributes);
|
||||
|
||||
}
|
||||
for (Attribute remove : toRemove) {
|
||||
im.removeAttributeModifier(remove);
|
||||
|
||||
for (java.util.Map.Entry<Attribute, AttributeModifier> entry : mods.entries()) {
|
||||
|
||||
AttributeModifier mod = entry.getValue();
|
||||
if (!defaultUuids.contains(mod.getUniqueId())) {
|
||||
|
||||
im.removeAttributeModifier(entry.getKey(), mod);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
for (ItemFlag iFlag : im.getItemFlags()) {
|
||||
|
||||
im.removeItemFlags(iFlag);
|
||||
|
||||
}
|
||||
|
||||
is.setItemMeta(im);
|
||||
|
||||
} else if (IllegalStack.isNbtAPI()) {
|
||||
|
||||
NBTApiStuff.hasBadCustomDataOnArmorLegacy(p);
|
||||
NBTApiStuff.checkForBadCustomDataLegacy(is, p, sendToPlayer);
|
||||
|
||||
} else {
|
||||
|
||||
Msg.StaffNoNBTAPI.getValue(Protections.RemoveCustomAttributes.name());
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//should only ever be used on 1.15+ servers no need for legacy
|
||||
// should only ever be used on 1.15+ servers no need for legacy
|
||||
public static void addNBTTag(Entity entity, String value) {
|
||||
|
||||
if (hasSpigotNBT()) {
|
||||
|
||||
PersistentDataContainer data = entity.getPersistentDataContainer();
|
||||
NamespacedKey key = new NamespacedKey(IllegalStack.getPlugin(), value);
|
||||
|
||||
data.set(key, PersistentDataType.STRING, value);
|
||||
entity.getPersistentDataContainer().set(key, PersistentDataType.STRING, value);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//should only ever be used on 1.15+ servers no need for legacy
|
||||
// should only ever be used on 1.15+ servers no need for legacy
|
||||
public static boolean hasNbtTag(Entity entity, String tag) {
|
||||
|
||||
if (entity == null) {
|
||||
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
PersistentDataContainer data = entity.getPersistentDataContainer();
|
||||
|
||||
@@ -5,13 +5,12 @@ package main.java.me.dniym.utils;
|
||||
*/
|
||||
|
||||
import com.comphenix.protocol.events.PacketEvent;
|
||||
import main.java.me.dniym.listeners.fListener;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.UUID;
|
||||
import main.java.me.dniym.listeners.fListener;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
public class PacketAttack {
|
||||
|
||||
@@ -22,35 +21,49 @@ public class PacketAttack {
|
||||
private final HashMap<String, Integer> pAttack = new HashMap<>();
|
||||
|
||||
public PacketAttack(UUID uniqueId) {
|
||||
|
||||
playerid = uniqueId;
|
||||
attacks.add(this);
|
||||
|
||||
}
|
||||
|
||||
public static PacketAttack findPlayer(UUID uniqueId) {
|
||||
|
||||
for (PacketAttack pa : attacks) {
|
||||
|
||||
if (pa.playerid.equals(uniqueId)) {
|
||||
|
||||
return pa;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return new PacketAttack(uniqueId);
|
||||
|
||||
}
|
||||
|
||||
public boolean addAttempt(Object packetEvent, String attackType) {
|
||||
|
||||
if (!this.pAttack.containsKey(attackType)) {
|
||||
|
||||
this.pAttack.put(attackType, 0);
|
||||
|
||||
}
|
||||
|
||||
this.pAttack.put(attackType, this.pAttack.get(attackType) + 1);
|
||||
int maxAttempts = 250;
|
||||
|
||||
if (attackType.equalsIgnoreCase("WINDOW_INVALID_CLICK")) {
|
||||
|
||||
maxAttempts = 5;
|
||||
|
||||
}
|
||||
|
||||
if (attackType.equalsIgnoreCase("WINDOW_CLICK_SPAM")) {
|
||||
|
||||
maxAttempts = 80;
|
||||
|
||||
}
|
||||
|
||||
return shouldCancelPacket(packetEvent, maxAttempts, attackType);
|
||||
@@ -58,29 +71,41 @@ public class PacketAttack {
|
||||
}
|
||||
|
||||
public boolean shouldCancelPacket(Object packetEvent, int maxAttempts, String attackType) {
|
||||
|
||||
if (packetEvent instanceof PacketEvent) {
|
||||
|
||||
PacketEvent event = (PacketEvent) packetEvent;
|
||||
|
||||
if (!event.isCancelled()) {
|
||||
|
||||
int size = event.getPacket().getBytes().toString().length();
|
||||
|
||||
if (size > 2700) { //sending too large of a packet, cancel it regardless
|
||||
if (size > 2700) { // sending too large of a packet, cancel it regardless
|
||||
|
||||
fListener.getLog().append2(
|
||||
"Player sent a packet too large for the server to handle! Probably a packet attack!");
|
||||
event.getPlayer().kickPlayer("Invalid Packet Detected (packet too large)");
|
||||
return true;
|
||||
|
||||
} else if (maxAttempts > 0) {
|
||||
|
||||
if (this.pAttack.get(attackType) >= maxAttempts) {
|
||||
//player has sent too many invalid packets of a given type.
|
||||
|
||||
// player has sent too many invalid packets of a given type.
|
||||
LOGGER.info("Player sent too many bad packets of type: {} kicking them.", attackType);
|
||||
event.getPlayer().kickPlayer("Too many bad packets detected! " + attackType);
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,422 @@
|
||||
/*
|
||||
* This file is part of LotterySix.
|
||||
*
|
||||
* Copyright (C) 2023. LoohpJames <jamesloohp@gmail.com>
|
||||
* Copyright (C) 2023. Contributors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package main.java.me.dniym.utils;
|
||||
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.concurrent.Future;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.function.Supplier;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
import org.bukkit.scheduler.BukkitTask;
|
||||
|
||||
public class Scheduler {
|
||||
|
||||
public static final boolean FOLIA;
|
||||
|
||||
static {
|
||||
|
||||
boolean folia;
|
||||
try {
|
||||
|
||||
Class.forName("io.papermc.paper.threadedregions.scheduler.AsyncScheduler");
|
||||
folia = true;
|
||||
|
||||
} catch (ClassNotFoundException e) {
|
||||
|
||||
folia = false;
|
||||
|
||||
}
|
||||
|
||||
FOLIA = folia;
|
||||
|
||||
}
|
||||
|
||||
public static void executeOrScheduleSync(Plugin plugin, Runnable task, Entity entity) {
|
||||
|
||||
if (FOLIA) {
|
||||
|
||||
if (Bukkit.isOwnedByCurrentRegion(entity)) {
|
||||
|
||||
task.run();
|
||||
|
||||
} else {
|
||||
|
||||
entity.getScheduler().run(plugin, st -> task.run(), null);
|
||||
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
if (Bukkit.isPrimaryThread()) {
|
||||
|
||||
task.run();
|
||||
|
||||
} else {
|
||||
|
||||
Bukkit.getScheduler().runTask(plugin, task);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static <T> Future<T> executeOrScheduleSync(Plugin plugin, Supplier<T> task, Entity entity) {
|
||||
|
||||
if (FOLIA) {
|
||||
|
||||
if (Bukkit.isOwnedByCurrentRegion(entity)) {
|
||||
|
||||
return CompletableFuture.completedFuture(task.get());
|
||||
|
||||
} else {
|
||||
|
||||
CompletableFuture<T> future = new CompletableFuture<>();
|
||||
entity.getScheduler().run(plugin, st -> {
|
||||
|
||||
if (!future.isCancelled()) {
|
||||
|
||||
future.complete(task.get());
|
||||
|
||||
}
|
||||
|
||||
}, null);
|
||||
return future;
|
||||
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
if (Bukkit.isPrimaryThread()) {
|
||||
|
||||
return CompletableFuture.completedFuture(task.get());
|
||||
|
||||
} else {
|
||||
|
||||
return Bukkit.getScheduler().callSyncMethod(plugin, task::get);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static <T> Future<T> executeOrScheduleSync(Plugin plugin, Supplier<T> task, Location location) {
|
||||
|
||||
if (FOLIA) {
|
||||
|
||||
if (Bukkit.isOwnedByCurrentRegion(location)) {
|
||||
|
||||
return CompletableFuture.completedFuture(task.get());
|
||||
|
||||
} else {
|
||||
|
||||
CompletableFuture<T> future = new CompletableFuture<>();
|
||||
Bukkit.getRegionScheduler().execute(plugin, location, () -> {
|
||||
|
||||
if (!future.isCancelled()) {
|
||||
|
||||
future.complete(task.get());
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
return future;
|
||||
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
if (Bukkit.isPrimaryThread()) {
|
||||
|
||||
return CompletableFuture.completedFuture(task.get());
|
||||
|
||||
} else {
|
||||
|
||||
return Bukkit.getScheduler().callSyncMethod(plugin, task::get);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static void executeOrScheduleSync(Plugin plugin, Runnable task, Location location) {
|
||||
|
||||
if (FOLIA) {
|
||||
|
||||
if (Bukkit.isOwnedByCurrentRegion(location)) {
|
||||
|
||||
task.run();
|
||||
|
||||
} else {
|
||||
|
||||
Bukkit.getRegionScheduler().execute(plugin, location, task);
|
||||
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
if (Bukkit.isPrimaryThread()) {
|
||||
|
||||
task.run();
|
||||
|
||||
} else {
|
||||
|
||||
Bukkit.getScheduler().runTask(plugin, task);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static ScheduledTask runTask(Plugin plugin, Runnable task, Entity entity) {
|
||||
|
||||
if (FOLIA) {
|
||||
|
||||
return new ScheduledTask(entity.getScheduler().run(plugin, st -> task.run(), null));
|
||||
|
||||
} else {
|
||||
|
||||
return new ScheduledTask(Bukkit.getScheduler().runTask(plugin, task));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static ScheduledTask runTaskLater(Plugin plugin, Runnable task, long delay, Entity entity) {
|
||||
|
||||
if (FOLIA) {
|
||||
|
||||
return new ScheduledTask(entity.getScheduler().runDelayed(plugin, st -> task.run(), null, delay));
|
||||
|
||||
} else {
|
||||
|
||||
return new ScheduledTask(Bukkit.getScheduler().runTaskLater(plugin, task, delay));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static ScheduledTask runTaskTimer(Plugin plugin, Runnable task, long delay, long period, Entity entity) {
|
||||
|
||||
if (FOLIA) {
|
||||
|
||||
return new ScheduledTask(
|
||||
entity.getScheduler().runAtFixedRate(plugin, st -> task.run(), null, Math.max(1, delay), period));
|
||||
|
||||
} else {
|
||||
|
||||
return new ScheduledTask(Bukkit.getScheduler().runTaskTimer(plugin, task, delay, period));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static ScheduledTask runTask(Plugin plugin, Runnable task, Location location) {
|
||||
|
||||
if (FOLIA) {
|
||||
|
||||
return new ScheduledTask(Bukkit.getRegionScheduler().run(plugin, location, st -> task.run()));
|
||||
|
||||
} else {
|
||||
|
||||
return new ScheduledTask(Bukkit.getScheduler().runTask(plugin, task));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static ScheduledTask runTaskLater(Plugin plugin, Runnable task, long delay, Location location) {
|
||||
|
||||
if (FOLIA) {
|
||||
|
||||
return new ScheduledTask(Bukkit.getRegionScheduler().runDelayed(plugin, location, st -> task.run(), delay));
|
||||
|
||||
} else {
|
||||
|
||||
return new ScheduledTask(Bukkit.getScheduler().runTaskLater(plugin, task, delay));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static ScheduledTask runTaskTimer(Plugin plugin, Runnable task, long delay, long period, Location location) {
|
||||
|
||||
if (FOLIA) {
|
||||
|
||||
return new ScheduledTask(Bukkit.getRegionScheduler().runAtFixedRate(plugin, location, st -> task.run(),
|
||||
Math.max(1, delay), period));
|
||||
|
||||
} else {
|
||||
|
||||
return new ScheduledTask(Bukkit.getScheduler().runTaskTimer(plugin, task, delay, period));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static ScheduledTask runTask(Plugin plugin, Runnable task) {
|
||||
|
||||
if (FOLIA) {
|
||||
|
||||
return new ScheduledTask(Bukkit.getGlobalRegionScheduler().run(plugin, st -> task.run()));
|
||||
|
||||
} else {
|
||||
|
||||
return new ScheduledTask(Bukkit.getScheduler().runTask(plugin, task));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static ScheduledTask runTaskLater(Plugin plugin, Runnable task, long delay) {
|
||||
|
||||
if (FOLIA) {
|
||||
|
||||
return new ScheduledTask(Bukkit.getGlobalRegionScheduler().runDelayed(plugin, st -> task.run(), delay));
|
||||
|
||||
} else {
|
||||
|
||||
return new ScheduledTask(Bukkit.getScheduler().runTaskLater(plugin, task, delay));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static ScheduledTask runTaskTimer(Plugin plugin, Runnable task, long delay, long period) {
|
||||
|
||||
if (FOLIA) {
|
||||
|
||||
return new ScheduledTask(Bukkit.getGlobalRegionScheduler().runAtFixedRate(plugin, st -> task.run(),
|
||||
Math.max(1, delay), period));
|
||||
|
||||
} else {
|
||||
|
||||
return new ScheduledTask(Bukkit.getScheduler().runTaskTimer(plugin, task, delay, period));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static ScheduledTask runTaskAsynchronously(Plugin plugin, Runnable task) {
|
||||
|
||||
if (FOLIA) {
|
||||
|
||||
return new ScheduledTask(Bukkit.getAsyncScheduler().runNow(plugin, st -> task.run()));
|
||||
|
||||
} else {
|
||||
|
||||
return new ScheduledTask(Bukkit.getScheduler().runTaskAsynchronously(plugin, task));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static ScheduledTask runTaskLaterAsynchronously(Plugin plugin, Runnable task, long delay) {
|
||||
|
||||
if (FOLIA) {
|
||||
|
||||
return new ScheduledTask(
|
||||
Bukkit.getAsyncScheduler().runDelayed(plugin, st -> task.run(), delay * 50, TimeUnit.MILLISECONDS));
|
||||
|
||||
} else {
|
||||
|
||||
return new ScheduledTask(Bukkit.getScheduler().runTaskLaterAsynchronously(plugin, task, delay));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static ScheduledTask runTaskTimerAsynchronously(Plugin plugin, Runnable task, long delay, long period) {
|
||||
|
||||
if (FOLIA) {
|
||||
|
||||
return new ScheduledTask(Bukkit.getAsyncScheduler().runAtFixedRate(plugin, st -> task.run(),
|
||||
Math.max(1, delay * 50), period * 50, TimeUnit.MILLISECONDS));
|
||||
|
||||
} else {
|
||||
|
||||
return new ScheduledTask(Bukkit.getScheduler().runTaskTimerAsynchronously(plugin, task, delay, period));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static class ScheduledTask {
|
||||
|
||||
private final Object task;
|
||||
|
||||
public ScheduledTask(Object task) {
|
||||
|
||||
this.task = task;
|
||||
|
||||
}
|
||||
|
||||
public boolean isCancelled() {
|
||||
|
||||
if (FOLIA) {
|
||||
|
||||
return ((io.papermc.paper.threadedregions.scheduler.ScheduledTask) task).isCancelled();
|
||||
|
||||
} else {
|
||||
|
||||
return ((BukkitTask) task).isCancelled();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void cancel() {
|
||||
|
||||
if (FOLIA) {
|
||||
|
||||
((io.papermc.paper.threadedregions.scheduler.ScheduledTask) task).cancel();
|
||||
|
||||
} else {
|
||||
|
||||
((BukkitTask) task).cancel();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public Plugin getOwner() {
|
||||
|
||||
if (FOLIA) {
|
||||
|
||||
return ((io.papermc.paper.threadedregions.scheduler.ScheduledTask) task).getOwningPlugin();
|
||||
|
||||
} else {
|
||||
|
||||
return ((BukkitTask) task).getOwner();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -3,45 +3,61 @@ package main.java.me.dniym.utils;
|
||||
import de.tr7zw.nbtapi.NBTItem;
|
||||
import io.github.thebusybiscuit.slimefun4.api.items.SlimefunItem;
|
||||
import main.java.me.dniym.IllegalStack;
|
||||
|
||||
import org.bukkit.enchantments.Enchantment;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
|
||||
public class SlimefunCompat {
|
||||
|
||||
public static boolean isValid(Inventory inv) {
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
public static boolean isValid(ItemStack is, Enchantment en) {
|
||||
|
||||
if (is == null) {
|
||||
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
if (IllegalStack.isSlimeFun()) {
|
||||
|
||||
SlimefunItem sfi = SlimefunItem.getByItem(is);
|
||||
if (sfi != null) {
|
||||
|
||||
ItemStack sfiBase = sfi.getItem();
|
||||
//base Slimefun item does not have this enchantment.
|
||||
// base Slimefun item does not have this enchantment.
|
||||
return sfiBase.containsEnchantment(en);
|
||||
//otherwise it is a slimefun item and it does contain the enchantment.
|
||||
|
||||
// otherwise it is a slimefun item and it does contain the enchantment.
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (IllegalStack.isClueScrolls() && IllegalStack.isNbtAPI()) {
|
||||
|
||||
if (is.hasItemMeta()) {
|
||||
|
||||
NBTItem nbti = new NBTItem(is);
|
||||
for (String key : nbti.getKeys()) {
|
||||
|
||||
if (key.contains("ClueScrolls")) {
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -7,6 +7,7 @@ import net.md_5.bungee.api.chat.ClickEvent;
|
||||
import net.md_5.bungee.api.chat.ComponentBuilder;
|
||||
import net.md_5.bungee.api.chat.HoverEvent;
|
||||
import net.md_5.bungee.api.chat.TextComponent;
|
||||
import net.md_5.bungee.api.chat.hover.content.Text;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
|
||||
public class SpigotMethods {
|
||||
@@ -15,74 +16,79 @@ public class SpigotMethods {
|
||||
|
||||
String sTag = " ";
|
||||
if (!protections.isList()) {
|
||||
|
||||
sTag = ChatColor.DARK_AQUA + "[" + status + ChatColor.DARK_AQUA + "]";
|
||||
|
||||
}
|
||||
|
||||
TextComponent cLink = new TextComponent(sTag);
|
||||
if (!protections.isList()) {
|
||||
|
||||
cLink.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/istack toggle " + protections.name()));
|
||||
cLink.setHoverEvent(new HoverEvent(
|
||||
HoverEvent.Action.SHOW_TEXT,
|
||||
new ComponentBuilder("Toggle This Protection On/Off").create()
|
||||
));
|
||||
cLink.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT,
|
||||
new ComponentBuilder("Toggle This Protection On/Off").create()));
|
||||
|
||||
} else {
|
||||
|
||||
cLink = new TextComponent(ChatColor.GRAY + "[" + ChatColor.GREEN + "A");
|
||||
String cmd = "/istack value add " + protections.name();
|
||||
cLink.setClickEvent(new ClickEvent(ClickEvent.Action.SUGGEST_COMMAND, cmd));
|
||||
cLink.setHoverEvent(new HoverEvent(
|
||||
HoverEvent.Action.SHOW_TEXT,
|
||||
new ComponentBuilder("Add a value to this list").create()
|
||||
));
|
||||
cLink.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT,
|
||||
new ComponentBuilder("Add a value to this list").create()));
|
||||
TextComponent opt;
|
||||
|
||||
if (!protections.getTxtSet().isEmpty()) {
|
||||
|
||||
opt = new TextComponent(ChatColor.RED + "R");
|
||||
cmd = "/istack value remove " + protections.name();
|
||||
opt.setClickEvent(new ClickEvent(ClickEvent.Action.SUGGEST_COMMAND, cmd));
|
||||
opt.setHoverEvent(new HoverEvent(
|
||||
HoverEvent.Action.SHOW_TEXT,
|
||||
new ComponentBuilder("Remove a value from this list").create()
|
||||
));
|
||||
opt.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT,
|
||||
new ComponentBuilder("Remove a value from this list").create()));
|
||||
|
||||
cLink.addExtra(opt);
|
||||
|
||||
} else {
|
||||
|
||||
cLink.addExtra(" ");
|
||||
|
||||
}
|
||||
|
||||
opt = new TextComponent(ChatColor.AQUA + "L");
|
||||
opt.setHoverEvent(new HoverEvent(
|
||||
HoverEvent.Action.SHOW_TEXT,
|
||||
new ComponentBuilder(ChatColor.AQUA + protections.findValue()).create()
|
||||
));
|
||||
opt.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT,
|
||||
new ComponentBuilder(ChatColor.AQUA + protections.findValue()).create()));
|
||||
|
||||
cLink.addExtra(opt);
|
||||
cLink.addExtra(ChatColor.GRAY + "] ");
|
||||
|
||||
}
|
||||
|
||||
cLink.addExtra(ChatColor.GOLD + " " + protections.getDisplayName());
|
||||
TextComponent info = new TextComponent(ChatColor.GREEN + " *");
|
||||
if (!protections.getDescription().equalsIgnoreCase("")) {
|
||||
String desc = protections.getDescription() + ChatColor.AQUA + " " + protections.getVersion() + ChatColor.RESET;
|
||||
|
||||
String desc = protections.getDescription() + ChatColor.AQUA + " " + protections.getVersion()
|
||||
+ ChatColor.RESET;
|
||||
info.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder(desc).create()));
|
||||
|
||||
}
|
||||
|
||||
cLink.addExtra(info);
|
||||
|
||||
//kids
|
||||
// kids
|
||||
if (children) {
|
||||
|
||||
TextComponent opt = new TextComponent(ChatColor.YELLOW + "(more options)");
|
||||
opt.setClickEvent(new ClickEvent(
|
||||
ClickEvent.Action.RUN_COMMAND,
|
||||
"/istack prot " + catId + " " + protections.getProtId()
|
||||
));
|
||||
opt.setHoverEvent(new HoverEvent(
|
||||
HoverEvent.Action.SHOW_TEXT,
|
||||
new ComponentBuilder("Click to show/hide more options").create()
|
||||
));
|
||||
opt.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND,
|
||||
"/istack prot " + catId + " " + protections.getProtId()));
|
||||
opt.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT,
|
||||
new ComponentBuilder("Click to show/hide more options").create()));
|
||||
cLink.addExtra(opt);
|
||||
|
||||
}
|
||||
|
||||
return cLink;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static BaseComponent makeCategoryText(String category, Boolean show, int catID) {
|
||||
|
||||
@@ -90,156 +96,194 @@ public class SpigotMethods {
|
||||
String sText = ChatColor.GRAY + " (" + ChatColor.GREEN + "SHOW" + ChatColor.GRAY + ")";
|
||||
|
||||
if (show) {
|
||||
|
||||
sText = ChatColor.GRAY + " (" + ChatColor.RED + "HIDE" + ChatColor.GRAY + ")";
|
||||
|
||||
}
|
||||
|
||||
TextComponent option = new TextComponent(sText);
|
||||
option.setHoverEvent(new HoverEvent(
|
||||
HoverEvent.Action.SHOW_TEXT,
|
||||
new ComponentBuilder(ChatColor.GRAY + "Click to activate").create()
|
||||
));
|
||||
option.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT,
|
||||
new ComponentBuilder(ChatColor.GRAY + "Click to activate").create()));
|
||||
|
||||
String command = "/istack prot ";
|
||||
if (!show) {
|
||||
|
||||
if (catID == 1) {
|
||||
|
||||
command = command + 1;
|
||||
|
||||
}
|
||||
|
||||
if (catID == 2) {
|
||||
|
||||
command = command + 2;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
option.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, command));
|
||||
cLink.addExtra(option);
|
||||
return cLink;
|
||||
|
||||
}
|
||||
|
||||
public static BaseComponent makeChildText(Protections p, int catId) {
|
||||
|
||||
TextComponent cLink = new TextComponent(ChatColor.GRAY + " -> ");
|
||||
|
||||
cLink.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder(p.getDescription()).create()));
|
||||
cLink.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new Text(p.getDescription())));
|
||||
|
||||
if (p.isList()) {
|
||||
|
||||
TextComponent option = new TextComponent(ChatColor.GOLD + " [" + ChatColor.GREEN + "A");
|
||||
if (p == Protections.EnchantedItemWhitelist) {
|
||||
|
||||
option.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/istack enchantwhitelistmode"));
|
||||
option.setHoverEvent(new HoverEvent(
|
||||
HoverEvent.Action.SHOW_TEXT,
|
||||
new ComponentBuilder("Click to toggle adding EnchantedItemWhitelist add mode on/off").create()
|
||||
));
|
||||
option.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT,
|
||||
new Text("Click to toggle adding EnchantedItemWhitelist add mode on/off")));
|
||||
|
||||
} else {
|
||||
option.setClickEvent(new ClickEvent(ClickEvent.Action.SUGGEST_COMMAND, "/istack value add " + p.name()));
|
||||
option.setHoverEvent(new HoverEvent(
|
||||
HoverEvent.Action.SHOW_TEXT,
|
||||
new ComponentBuilder("Click to add a value to this list.").create()
|
||||
));
|
||||
|
||||
option.setClickEvent(
|
||||
new ClickEvent(ClickEvent.Action.SUGGEST_COMMAND, "/istack value add " + p.name()));
|
||||
option.setHoverEvent(
|
||||
new HoverEvent(HoverEvent.Action.SHOW_TEXT, new Text("Click to add a value to this list.")));
|
||||
|
||||
}
|
||||
|
||||
cLink.addExtra(option);
|
||||
if (!p.getTxtSet().isEmpty()) {
|
||||
|
||||
option = new TextComponent(ChatColor.RED + "R");
|
||||
option.setClickEvent(new ClickEvent(ClickEvent.Action.SUGGEST_COMMAND, "/istack value remove " + p.name()));
|
||||
option.setHoverEvent(new HoverEvent(
|
||||
HoverEvent.Action.SHOW_TEXT,
|
||||
new ComponentBuilder("Click to remove a value from this list.").create()
|
||||
));
|
||||
option.setClickEvent(
|
||||
new ClickEvent(ClickEvent.Action.SUGGEST_COMMAND, "/istack value remove " + p.name()));
|
||||
option.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT,
|
||||
new Text("Click to remove a value from this list.")));
|
||||
cLink.addExtra(option);
|
||||
|
||||
} else {
|
||||
|
||||
cLink.addExtra(" ");
|
||||
|
||||
}
|
||||
|
||||
option = new TextComponent(ChatColor.GRAY + "L" + ChatColor.GOLD + "] ");
|
||||
option.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder(p.findValue()).create()));
|
||||
option.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new Text(p.findValue())));
|
||||
cLink.addExtra(option);
|
||||
|
||||
} else if (p.getIntValue() >= 0) {
|
||||
|
||||
int val = 0;
|
||||
if (p.getConfigValue() instanceof Integer) {
|
||||
|
||||
val = (Integer) p.getConfigValue();
|
||||
|
||||
}
|
||||
|
||||
String pad = "";
|
||||
if (val <= 9) {
|
||||
|
||||
pad = " ";
|
||||
|
||||
} else if (val <= 99) {
|
||||
|
||||
pad = " ";
|
||||
|
||||
}
|
||||
|
||||
|
||||
TextComponent option = new TextComponent(ChatColor.GRAY + " [" + p.findValue() + pad + "] ");
|
||||
option.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder(p.findValue()).create()));
|
||||
option.setHoverEvent(new HoverEvent(
|
||||
HoverEvent.Action.SHOW_TEXT,
|
||||
new ComponentBuilder(ChatColor.GREEN + "(Click to change)").create()
|
||||
));
|
||||
option.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new Text(p.findValue())));
|
||||
option.setHoverEvent(
|
||||
new HoverEvent(HoverEvent.Action.SHOW_TEXT, new Text(ChatColor.GREEN + "(Click to change)")));
|
||||
String command = "/istack value set " + p.name();
|
||||
option.setClickEvent(new ClickEvent(ClickEvent.Action.SUGGEST_COMMAND, command));
|
||||
|
||||
cLink.addExtra(option);
|
||||
|
||||
} else if (!p.getTxtValue().isEmpty()) {
|
||||
TextComponent option = new TextComponent(ChatColor.GRAY + " [" + ChatColor.GREEN + "TXT" + ChatColor.GRAY + "] ");
|
||||
option.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder(p.findValue()).create()));
|
||||
option.setHoverEvent(new HoverEvent(
|
||||
HoverEvent.Action.SHOW_TEXT,
|
||||
new ComponentBuilder(ChatColor.GRAY + p.findValue() + ChatColor.GREEN + " (Click to change)").create()
|
||||
));
|
||||
|
||||
TextComponent option = new TextComponent(
|
||||
ChatColor.GRAY + " [" + ChatColor.GREEN + "TXT" + ChatColor.GRAY + "] ");
|
||||
option.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new Text(p.findValue())));
|
||||
option.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT,
|
||||
new Text(ChatColor.GRAY + p.findValue() + ChatColor.GREEN + " (Click to change)")));
|
||||
String command = "/istack value set " + p.name() + " " + p.getConfigValue();
|
||||
option.setClickEvent(new ClickEvent(ClickEvent.Action.SUGGEST_COMMAND, command));
|
||||
cLink.addExtra(option);
|
||||
|
||||
} else {
|
||||
|
||||
String status = ChatColor.GREEN + " ON";
|
||||
if (!p.isEnabled()) {
|
||||
|
||||
status = ChatColor.DARK_RED + "OFF";
|
||||
|
||||
}
|
||||
|
||||
TextComponent option = new TextComponent(ChatColor.GOLD + " [" + status + ChatColor.GOLD + "] ");
|
||||
option.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder("Click to toggle").create()));
|
||||
option.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new Text("Click to toggle")));
|
||||
String command = "/istack toggle " + p.name();
|
||||
option.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, command + " " + catId));
|
||||
cLink.addExtra(option);
|
||||
|
||||
}
|
||||
|
||||
cLink.addExtra(ChatColor.DARK_AQUA + p.getDisplayName());
|
||||
if (!p.getDescription().equalsIgnoreCase("")) {
|
||||
|
||||
String desc = p.getDescription();
|
||||
cLink.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new Text(desc)));
|
||||
|
||||
cLink.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder(desc).create()));
|
||||
}
|
||||
|
||||
|
||||
return cLink;
|
||||
|
||||
}
|
||||
|
||||
public static String wordWrap(String text, int length) {
|
||||
|
||||
StringBuilder newString = new StringBuilder();
|
||||
if (text.length() <= length) {
|
||||
|
||||
return text;
|
||||
|
||||
}
|
||||
|
||||
String[] words = text.split(" ");
|
||||
|
||||
if (words.length == 0) {
|
||||
|
||||
newString = new StringBuilder(longWord(text, length));
|
||||
|
||||
}
|
||||
|
||||
if (words.length > 1) {
|
||||
|
||||
String temp1 = "";
|
||||
for (String word : words) {
|
||||
|
||||
if (temp1.length() > length) {
|
||||
|
||||
newString.append("\n").append(temp1);
|
||||
temp1 = word;
|
||||
|
||||
} else {
|
||||
|
||||
if (!temp1.equalsIgnoreCase("")) {
|
||||
|
||||
temp1 = temp1 + " " + word;
|
||||
|
||||
} else {
|
||||
|
||||
temp1 = word;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
newString.append(" ").append(words[words.length - 1]);
|
||||
|
||||
}
|
||||
@@ -249,31 +293,45 @@ public class SpigotMethods {
|
||||
}
|
||||
|
||||
public static String longWord(String text, int length) {
|
||||
|
||||
String[] words = text.split(" ");
|
||||
int counter = 0;
|
||||
StringBuilder newString = new StringBuilder();
|
||||
for (int i = 0; i < words[0].length(); i++) {
|
||||
|
||||
if (counter == length - 2) {
|
||||
|
||||
newString.append(words[0].charAt(i)).append("-\n");
|
||||
counter = 0;
|
||||
|
||||
} else {
|
||||
|
||||
newString.append(words[0].charAt(i));
|
||||
counter++;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return newString.toString();
|
||||
|
||||
}
|
||||
|
||||
public static boolean isNPC(LivingEntity ent) {
|
||||
|
||||
if (ent == null)
|
||||
return false;
|
||||
|
||||
return ent.hasMetadata("shopkeeper") || ent.hasMetadata("NPC");
|
||||
|
||||
}
|
||||
|
||||
private static final class FlagFontInfo {
|
||||
|
||||
static int getPxLength(char c) {
|
||||
|
||||
switch (c) {
|
||||
|
||||
case 'i':
|
||||
case ':':
|
||||
return 1;
|
||||
@@ -287,11 +345,15 @@ public class SpigotMethods {
|
||||
return 4;
|
||||
default:
|
||||
return 5;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
static int getPxLength(String string) {
|
||||
|
||||
return string.chars().reduce(0, (p, i) -> p + getPxLength((char) i) + 1);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,178 @@
|
||||
ConfigVersion: '2.0' # [INFO] Internal config version. Do not change manually.
|
||||
|
||||
Exploits:
|
||||
MineCart:
|
||||
MinecartBlockWhiteList: [STONE_CUTTER] # [ACTIVE] Blocks that won't trigger minecart glitch removal. Leave empty for strict behavior.
|
||||
PreventMinecartGlitch: true # [ACTIVE] Fixes various minecart-related glitches.
|
||||
RemoveExistingGlitchedMinecarts: false # [ACTIVE] Cleans up old glitched minecarts if true. Temporary measure due to large performance impact.
|
||||
PreventHeadInsideBlocks: false # [ACTIVE] Prevents player's head clipping through blocks while in minecart.
|
||||
|
||||
Minecart:
|
||||
AlsoPreventHeadInside:
|
||||
- COMPOSTER # [ACTIVE] Extends head-inside-block protection to these blocks.
|
||||
|
||||
Enchants:
|
||||
RemoveUnbreakableFlag: true # [ACTIVE] Strips Unbreakable tag from items.
|
||||
OnlyFunctionInWorlds: [] # [ACTIVE] Limits enchant scan to listed worlds. Empty = all.
|
||||
AllowBypass: false # [ACTIVE] Enables permission bypass for enchant enforcement.
|
||||
EnchantedItemWhitelist: [] # [ACTIVE] Only these items are scanned. Empty = all.
|
||||
FixIllegalEnchants: true # [ACTIVE] Fixes over-level enchants.
|
||||
DestroyIllegallyEnchantedItemsInstead: false # [ACTIVE] Destroys instead of fixing items.
|
||||
RemoveCustomAttributes: true # [ACTIVE] Removes attribute modifiers like +100 attack damage.
|
||||
CustomEnchantOverride: [] # [ACTIVE] Custom allow-list of enchantments to ignore.
|
||||
|
||||
PortalDupe:
|
||||
NetherWhiteList: [] # [ACTIVE] List of entities allowed through Nether portal.
|
||||
BlockNonPlayersInEndPortal: false # [ACTIVE] Prevents entities from entering End portals.
|
||||
EndWhiteListMode: false # [ACTIVE] Interprets EndWhiteList as a whitelist.
|
||||
NotifyBlockedPortalAttempts: true # [ACTIVE] Staff get notified if entity blocked from portal.
|
||||
EndWhiteList: [] # [ACTIVE] Entities allowed through End portal.
|
||||
NetherWhiteListMode: false # [ACTIVE] Interprets NetherWhiteList as a whitelist.
|
||||
BlockNonPlayersInNetherPortal: false # [ACTIVE] Prevents entities from entering Nether portal.
|
||||
|
||||
Nether:
|
||||
BlockBuildingAboveNether: true # [ACTIVE] Prevents placing blocks above Y-level.
|
||||
NetherYLevel: 128 # [ACTIVE] Y-threshold used by Nether ceiling checks.
|
||||
ExcludeNetherWorldFromHeightCheck: [] # [ACTIVE] World exclusion for Nether roof checks.
|
||||
KillPlayersBelowNether: false # [UNUSED] No effect in 1.19.4 (below worldbedrock enforcement removed).
|
||||
BlockPlayersAboveNether: true # [ACTIVE] Prevents player from staying above Nether ceiling.
|
||||
EnsureSafeTeleportLocationIfAboveCeiling: true # [ACTIVE] Finds safe location when teleporting player off roof.
|
||||
|
||||
Other:
|
||||
PreventItemSwapLagExploit: true # [ACTIVE] Blocks item swap-based lag machines.
|
||||
PreventBedExplosions: false # [ACTIVE] Prevents bed explosions in Nether/End.
|
||||
PreventNestedShulkers: true # [ACTIVE] Prevents shulker-in-shulker dupe setups.
|
||||
PreventCommandsInBed: false # [ACTIVE] Blocks command usage from bed GUI.
|
||||
PreventMinecartsInBoats: true # [ACTIVE] Fixes minecart-in-boat duplication.
|
||||
PreventRailDupe: false # [ACTIVE] Prevents powered rail duplication.
|
||||
PreventEndPortalDestruction: true # [LEGACY] No effect in modern versions.
|
||||
PreventBedrockDestruction: true # [LEGACY] No effect in modern versions.
|
||||
PreventHoppersToUnloadedChunks: true # [ACTIVE] Stops hoppers interacting across chunk borders.
|
||||
PreventInvalidPotions: true # [ACTIVE] Removes glitch potions with invalid NBT.
|
||||
|
||||
3rdParty:
|
||||
BlockCMIShulkerStacking: false # [ACTIVE] Blocks shulker opening exploit if using CMI.
|
||||
|
||||
1_14_Exploits:
|
||||
Traders:
|
||||
BlockVillagerTradeCheesing: true # [ACTIVE] Prevents cycling trades via workstation break.
|
||||
VillagerRestockTime: 10 # [ACTIVE] Forces minimum delay before villager restock.
|
||||
ZombieVillagerTransformChance: 50 # [ACTIVE] Controls zombification chance (0-100).
|
||||
|
||||
1_13_Exploits:
|
||||
Entities:
|
||||
ProjectileDespawnDelay: 22 # [ACTIVE] Ticks before projectiles despawn to prevent spam.
|
||||
PreventProjectileExploit2: false # [INACTIVE] Secondary projectile dupe fix.
|
||||
|
||||
NetherPortal:
|
||||
PreventPortalTrap: true # [ACTIVE] Blocks portals with no safe destination.
|
||||
|
||||
OverStack:
|
||||
GroupStack: [] # [ACTIVE] Per-group allow-list for overstacked items.
|
||||
AllowStack: [] # [ACTIVE] Items allowed to override stack limits.
|
||||
PreventOverStackedItemInHoppers: false # [ACTIVE] Removes overstacked items when moved by hopper.
|
||||
StackWhiteListMode: false # [ACTIVE] Treat AllowStack as whitelist.
|
||||
FixOverstackedItemInstead: true # [ACTIVE] Cuts stack to max instead of removing it.
|
||||
RemoveItemsOfType: [] # [ACTIVE] Items in this list are removed completely.
|
||||
RemoveOverstackedItems: true # [ACTIVE] Core overstack enforcement toggle. Must be true for FixOverstackedItemInstead to function.
|
||||
|
||||
Looting:
|
||||
PreventLootingExploit: true # [ACTIVE] Fixes XP/orb looting abuse.
|
||||
|
||||
FishMod:
|
||||
WarnPlayerThenKickInsteadOfNotify: false # [ACTIVE] False = notify staff. True = warn and kick.
|
||||
WatchForAutoFishMod: true # [ACTIVE] Monitors auto-fishing pattern.
|
||||
MaxFishToNotifyStaffThenBlock: 10 # [ACTIVE] Number of fish before staff alert + block.
|
||||
MaxFishAllowedBeforeKick: 32 # [ACTIVE] Number of fish before auto-kick.
|
||||
|
||||
RecordDupe: true # [LEGACY] Disables record duplication trick.
|
||||
|
||||
Teleport:
|
||||
PearlPhasing: false # [ACTIVE] Blocks pearl phase-through-walls. trueog/AntiPearlGlitch-OG does this better.
|
||||
|
||||
TNTDupe:
|
||||
PreventIndirectTNTPowerDupe: false # [ACTIVE] Stops indirect redstone TNT duplication.
|
||||
|
||||
BookExploit:
|
||||
DisableBookWriting: false # [ACTIVE] Disables Book & Quill editing.
|
||||
|
||||
EndGateway:
|
||||
PreventEndGatewayCrashExploit: true # [LEGACY] Prevents crash exploit with gateway coords.
|
||||
|
||||
1_15_Exploits:
|
||||
Dupes:
|
||||
PreventTripwireDupe: true # [ACTIVE] Prevents door/tripwire duplication.
|
||||
PreventStringDupe: true # [ACTIVE] Prevents string duplication.
|
||||
|
||||
SignExploit:
|
||||
DestroyBadSignsOnChunkLoad: false # [LEGACY] Deletes signs with illegal NBT.
|
||||
|
||||
RNGEnchant:
|
||||
PreventRNGEnchant: true # [ACTIVE] Prevents enchant table seed manipulation.
|
||||
|
||||
DropperDupe:
|
||||
BlockLoopedDroppers: false # [ACTIVE] Stops repeat dropper abuse.
|
||||
|
||||
NegativeDurability: true # [ACTIVE] Fixes or removes items with < 0 durability.
|
||||
|
||||
Fishing:
|
||||
KickForAutoClickerFishing: true # [ACTIVE] Detects and kicks auto-clicker fishers.
|
||||
|
||||
Misc:
|
||||
LogOffensesInSeparateFile: true # [ACTIVE] Writes exploit logs to separate file.
|
||||
InGameOffenseNotifications: true # [ACTIVE] Staff see alerts in chat.
|
||||
BreakMachinesInsteadOfDroppingItems: true # [ACTIVE] Removes machine blocks without drops.
|
||||
Spawners:
|
||||
PreventSpawnEggsOnSpawners: false # [ACTIVE] Blocks using eggs on spawners.
|
||||
DisableInWorlds: [] # [ACTIVE] List of worlds where IllegalStack is disabled.
|
||||
ItemScanTimer: 5 # [ACTIVE] Delay (ticks) between item scans.
|
||||
NotifyNearbyPlayers: true # [ACTIVE] Alert nearby players when exploit blocked.
|
||||
|
||||
UserRequested:
|
||||
ItemRemoval:
|
||||
BlockEnchantingInstead: true # [ACTIVE] Prevents enchanting flagged items.
|
||||
ItemNamesToRemove: [anal, coon, cunt, dick, dildo, dyke, faggot, gipsy, goyim, gypsy, jizz, kike, nigger, orgasm, penis, porn, pussy, rape, retard, semen, vagina] # [ACTIVE] Items with these names are removed.
|
||||
BlockRepairsInstead: true # [ACTIVE] Prevents repair of flagged items.
|
||||
NameLoreStrictMatchMode: true # [ACTIVE] Uses exact match instead of contains.
|
||||
RemoveItemsMatchingName: false # [ACTIVE] Deletes items matching name/lore.
|
||||
ItemLoresToRemove: [anal, coon, cunt, dick, dildo, dyke, faggot, gipsy, goyim, gypsy, jizz, kike, nigger, orgasm, penis, porn, pussy, rape, retard, semen, vagina] # [ACTIVE] Items with these lore strings are removed.
|
||||
|
||||
Obscure:
|
||||
Misc:
|
||||
RemoveAllRenamedItems: false # [ACTIVE] Deletes all renamed items.
|
||||
HackedShulker:
|
||||
CheckGroundForBadShulkerAtLogin: false # [ACTIVE] Scan for malicious dropped shulkers. Temporary measure due to large performance impact.
|
||||
DestroyInvalidShulkers: true # [ACTIVE] Deletes crash shulkers.
|
||||
DisableCraftingRecipes: [] # [ACTIVE] Prevents crafting listed items.
|
||||
HopperCheck:
|
||||
IgnoreAllHopperChecks: false # [ACTIVE] Turns off all hopper-related protections.
|
||||
BlockBadItemsFromCreativeTab: true # [ACTIVE] Blocks creative-mode inventory exploit.
|
||||
IgnoreAllShulkerPlaceChecks: false # [ACTIVE] Allows illegal shulker placement.
|
||||
|
||||
Spawners:
|
||||
ResetSpawnersOfType: [] # [ACTIVE] Changes spawner drop type to pig when mined.
|
||||
ResetSpawnersOfTypeOnSpawn: [] # [ACTIVE] Changes spawner to pig after it spawns.
|
||||
SpawnerReset: false # [ACTIVE] Enables above spawner reset logic.
|
||||
|
||||
NetherDamage:
|
||||
DamageAmount: 5 # [ACTIVE] Damage dealt above nether roof.
|
||||
DamagePlayersAboveNether: true # [ACTIVE] Inflicts damage to players on roof.
|
||||
DamageDelay: 2 # [ACTIVE] Time between damage ticks.
|
||||
|
||||
Mobs:
|
||||
PreventZombieItemPickup: false # [ACTIVE] Prevents zombies picking up gear.
|
||||
PreventVexTrapping: true # [ACTIVE] Prevents vex-based dupe/grief exploits.
|
||||
|
||||
Cobble:
|
||||
PreventCobbleGenerators: false # [ACTIVE] Blocks water+lava cobble gen.
|
||||
|
||||
Misc:
|
||||
NotifyInsteadOfBlock: [] # [ACTIVE] Treat listed protections as notify-only.
|
||||
|
||||
Exploit:
|
||||
LagMachines:
|
||||
End Crystal: true # [ACTIVE] Blocks lag machines using end crystals.
|
||||
ArmorStand: true # [ACTIVE] Prevents armor stand spam lag.
|
||||
|
||||
Teleport:
|
||||
CorrectionNotify: true # [ACTIVE] Notify player when location is corrected.
|
||||
@@ -1,9 +1,10 @@
|
||||
main: main.java.me.dniym.IllegalStack
|
||||
name: IllegalStack
|
||||
name: IllegalStack-OG
|
||||
version: "${version}"
|
||||
api-version: 1.13
|
||||
folia-supported: true
|
||||
description: Closes some dupe bugs still present in vanilla minecraft.
|
||||
author: dNiym
|
||||
authors: [ dNiym, Loving11ish ]
|
||||
softdepend: [Magic, Factions, NBTAPI, ProtocolLib, Slimefun, CraftingStore, DynamicShop, ClueScrolls, mcMMO, JetsMinions, SmartInvs, FactionsX]
|
||||
loadbefore: [MythicDrops]
|
||||
website: https://www.spigotmc.org/resources/44411/
|
||||
@@ -30,4 +31,4 @@ permissions:
|
||||
default: false
|
||||
illegalstack.overstack:
|
||||
description: Allows users with this perm to have items in this list that are greater than the vanilla stack size.
|
||||
default: false
|
||||
default: false
|
||||
@@ -0,0 +1,87 @@
|
||||
package main.java.me.dniym.checks;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertFalse;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.mockStatic;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
import org.bukkit.inventory.meta.LeatherArmorMeta;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.mockito.MockedStatic;
|
||||
|
||||
class CreativeItemCheckTest {
|
||||
|
||||
@Test
|
||||
void allowsAnvilDisplayNameWhenNoUnsafeSignalExists() {
|
||||
|
||||
final ItemStack stack = mock(ItemStack.class);
|
||||
final ItemMeta meta = mock(ItemMeta.class);
|
||||
when(stack.getType()).thenReturn(Material.DIAMOND_SWORD);
|
||||
when(stack.hasItemMeta()).thenReturn(true);
|
||||
when(stack.getItemMeta()).thenReturn(meta);
|
||||
when(meta.hasDisplayName()).thenReturn(true);
|
||||
|
||||
try (MockedStatic<BadAttributeCheck> attributes = mockStatic(BadAttributeCheck.class)) {
|
||||
|
||||
attributes.when(() -> BadAttributeCheck.hasNonDefaultAttributeModifiers(stack)).thenReturn(false);
|
||||
assertFalse(CreativeItemCheck.hasUnsafePayload(stack));
|
||||
attributes.verify(() -> BadAttributeCheck.hasNonDefaultAttributeModifiers(stack));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
void allowsOtherVanillaMetadataWhenNoUnsafeSignalExists() {
|
||||
|
||||
final ItemStack stack = mock(ItemStack.class);
|
||||
final LeatherArmorMeta meta = mock(LeatherArmorMeta.class);
|
||||
when(stack.getType()).thenReturn(Material.LEATHER_CHESTPLATE);
|
||||
when(stack.hasItemMeta()).thenReturn(true);
|
||||
when(stack.getItemMeta()).thenReturn(meta);
|
||||
|
||||
try (MockedStatic<BadAttributeCheck> attributes = mockStatic(BadAttributeCheck.class)) {
|
||||
|
||||
attributes.when(() -> BadAttributeCheck.hasNonDefaultAttributeModifiers(stack)).thenReturn(false);
|
||||
assertFalse(CreativeItemCheck.hasUnsafePayload(stack));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
void blocksNonDefaultAttributePayload() {
|
||||
|
||||
final ItemStack stack = mock(ItemStack.class);
|
||||
when(stack.getType()).thenReturn(Material.STICK);
|
||||
|
||||
try (MockedStatic<BadAttributeCheck> attributes = mockStatic(BadAttributeCheck.class)) {
|
||||
|
||||
attributes.when(() -> BadAttributeCheck.hasNonDefaultAttributeModifiers(stack)).thenReturn(true);
|
||||
assertTrue(CreativeItemCheck.hasUnsafePayload(stack));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
void ignoresNullAndAirWithoutInspectingAttributes() {
|
||||
|
||||
final ItemStack air = mock(ItemStack.class);
|
||||
when(air.getType()).thenReturn(Material.AIR);
|
||||
|
||||
try (MockedStatic<BadAttributeCheck> attributes = mockStatic(BadAttributeCheck.class)) {
|
||||
|
||||
assertFalse(CreativeItemCheck.hasUnsafePayload(null));
|
||||
assertFalse(CreativeItemCheck.hasUnsafePayload(air));
|
||||
attributes.verifyNoInteractions();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user