Initial release of TrueOG fork

This commit is contained in:
NotAlexNoyle committed 2026-06-22 10:16:47 -04:00
1 parent 4593f37b46
commit 716633501e
27 files changed
+1745 -467

No files matched your search

+46
View File
@@ -0,0 +1,46 @@
# Compiled class file
*.class
# Log file
*.log
# BlueJ files
*.ctxt
# Mobile Tools for Java (J2ME)
.mtj.tmp/
# Package Files #
*.jar
*.war
*.nar
*.ear
*.zip
*.tar.gz
*.rar
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*
replay_pid*
# macOS system files
.DS_Store
# gradle build output files
build/
.gradle/
# eclipse project files
.settings/
.project
.classpath
.checkstyle
bin/
# IntelliJ files
.idea/
.kotlin
*.iml
*.ipr
*.iws
out/
+23 -2
View File
@@ -1,2 +1,23 @@
# AntiAutoFishing
AntiAutoFishing - Prevent Auto Fishing Mods
# AntiAutoFishing-OG
TrueOG Network's fork of AntiAutoFishing - prevent auto fishing mods.
## Changes from upstream
- **Catches bots that move around.** New timing checks flag inhuman catch intervals and lightning-fast, robotic reel-in reaction times, so auto-fishers are caught even when they shuffle position to dodge the original same-spot check.
- **The captcha actually gates fishing.** Flagged players must solve the captcha before they can keep fishing (toggle with `block-fishing-until-solved`).
- **Captcha can no longer be cheated** by clicking the target item in your own inventory.
- **New `autofish.bypass` permission** to exempt staff or trusted players from all checks.
- **Messages use MiniMessage formatting** (e.g. `<red>`, `<green>`) instead of old `&` color codes.
- **No more "phone home".** The SpigotMC update check (and its outbound web request) has been removed.
- **Cleaned-up config** with saner defaults.
Gradle Version: 8.14.3
Java Version: 17
Minecraft API: 1.19
API Jar: 1.19.4 Purpur
AntiAutoFishing-OG is released under the terms of the [GNU General Public License v3.0](https://github.com/true-og/AntiAutoFishing-OG/blob/main/LICENSE).
+110
View File
@@ -0,0 +1,110 @@
/* AntiAutoFishing-OG - Licensed under the GNU General Public License v3.0 */
/* ------------------------------ Plugins ------------------------------ */
plugins {
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.
}
/* --------------------------- JDK / Java ----------------------------- */
java {
sourceCompatibility = JavaVersion.VERSION_17 // Compile with JDK 17 compatibility.
toolchain { // Select Java toolchain.
languageVersion.set(JavaLanguageVersion.of(17)) // Use JDK 17.
vendor.set(JvmVendorSpec.GRAAL_VM) // Use GraalVM CE.
}
}
/* ----------------------------- Metadata ------------------------------ */
group = "com.codingguru" // Declare bundle identifier.
version = "2.0.2" // Declare plugin version (will be in .jar).
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() // Import the Maven Central Maven Repository.
gradlePluginPortal() // Import the Gradle Plugin Portal Maven Repository.
maven { url = uri("https://repo.purpurmc.org/snapshots") } // Import the PurpurMC Maven Repository.
maven { url = uri("file://${System.getProperty("user.home")}/.m2/repository") }
System.getProperty("SELF_MAVEN_LOCAL_REPO")?.let { // TrueOG Bootstrap mavenLocal().
val dir = file(it)
if (dir.isDirectory) {
println("Using SELF_MAVEN_LOCAL_REPO at: $it")
maven { url = uri("file://${dir.absolutePath}") }
} else {
logger.error("TrueOG Bootstrap not found, defaulting to ~/.m2 for mavenLocal()")
mavenLocal()
}
} ?: logger.error("TrueOG Bootstrap not found, defaulting to ~/.m2 for mavenLocal()")
}
/* ---------------------- Java project deps ---------------------------- */
dependencies {
compileOnly("org.purpurmc.purpur:purpur-api:1.19.4-R0.1-SNAPSHOT") // Declare Purpur API version to be packaged.
}
/* ---------------------- Reproducible jars ---------------------------- */
tasks.withType<AbstractArchiveTask>().configureEach { // Ensure reproducible .jars
isPreserveFileTimestamps = false
isReproducibleFileOrder = true
}
/* ----------------------------- Shadow -------------------------------- */
tasks.shadowJar {
archiveClassifier.set("") // Use empty string instead of null.
minimize()
}
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.
}
/* ----------------------------- 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" // Declare checkstyle version to use.
configFile = file("config/checkstyle/checkstyle.xml") // Point checkstyle to config file.
isIgnoreFailures = true // Don't fail the build if checkstyle does not pass.
isShowViolations = true // Show the violations in any IDE with the checkstyle plugin.
}
tasks.named("compileJava") {
dependsOn("spotlessApply") // Run spotless before compiling with the JDK.
}
tasks.named("spotlessCheck") {
dependsOn("spotlessApply") // Run spotless before checking if spotless ran.
}
+34
View File
@@ -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*&quot;Not yet implemented&quot;\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="(?&lt;!\w)fail\s*\(\s*&quot;Not yet implemented&quot;\s*\)\s*;"/>
<property name="message" value="Remove placeholder fail() and implement the test."/>
<property name="severity" value="warning"/>
</module>
</module>
+404
View File
@@ -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>
+7
View File
@@ -0,0 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=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
Vendored Executable
+251
View File
@@ -0,0 +1,251 @@
#!/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 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
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
# 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
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 ;; #(
MSYS* | MINGW* ) msys=true ;; #(
NONSTOP* ) nonstop=true ;;
esac
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
else
JAVACMD=$JAVA_HOME/bin/java
fi
if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
else
JAVACMD=java
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" && ! "$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
# 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.
# 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" )
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
View File
@@ -0,0 +1,94 @@
@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
-7
View File
@@ -1,7 +0,0 @@
name: AntiAutoFishing
version: 1.5
api-version: 1.13
main: com.codingguru.autofish.AntiAutoFish
authors: [CodingGuru]
folia-supported: true
commands:
-30
View File
@@ -1,30 +0,0 @@
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.codingguru</groupId>
<artifactId>antiautofishing</artifactId>
<version>2.0.2</version>
<packaging>jar</packaging>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<repositories>
<repository>
<id>papermc</id>
<url>https://repo.papermc.io/repository/maven-public/</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>io.papermc.paper</groupId>
<artifactId>paper-api</artifactId>
<version>26.1.2.build.68-stable</version>
<scope>provided</scope>
</dependency>
</dependencies>
</project>
+3
View File
@@ -0,0 +1,3 @@
/* AntiAutoFishing-OG - Licensed under the GNU General Public License v3.0 */
rootProject.name = "AntiAutoFishing-OG"
@@ -11,23 +11,27 @@ import com.codingguru.autofish.util.ConsoleUtil;
public class AntiAutoFish extends JavaPlugin {
private static AntiAutoFish INSTANCE;
private static AntiAutoFish INSTANCE;
public void onEnable() {
INSTANCE = this;
public void onEnable() {
ConsoleUtil.sendPluginSetup();
INSTANCE = this;
saveDefaultConfig();
ConsoleUtil.sendPluginSetup();
Bukkit.getPluginManager().registerEvents(new PlayerFish(), this);
Bukkit.getPluginManager().registerEvents(new PlayerQuit(), this);
Bukkit.getPluginManager().registerEvents(new InventoryClose(this), this);
Bukkit.getPluginManager().registerEvents(new InventoryClick(this), this);
}
saveDefaultConfig();
public static AntiAutoFish getInstance() {
return INSTANCE;
}
Bukkit.getPluginManager().registerEvents(new PlayerFish(), this);
Bukkit.getPluginManager().registerEvents(new PlayerQuit(), this);
Bukkit.getPluginManager().registerEvents(new InventoryClose(this), this);
Bukkit.getPluginManager().registerEvents(new InventoryClick(), this);
}
public static AntiAutoFish getInstance() {
return INSTANCE;
}
}
@@ -1,99 +0,0 @@
package com.codingguru.autofish.data;
import java.util.UUID;
import org.bukkit.Location;
import org.bukkit.entity.Player;
import com.codingguru.autofish.AntiAutoFish;
import com.codingguru.autofish.handlers.PlayerHandler;
import com.codingguru.autofish.util.ColorUtil;
public class PlayerFishingData {
private UUID uuid;
private Location location;
private long nextUse;
private int exploitNumber;
public PlayerFishingData(UUID uuid, Location location) {
this.uuid = uuid;
this.location = location;
PlayerHandler.getInstance().addFishingData(uuid, this);
}
public boolean isFishCancelled(Player player) {
if (nextUse != 0 && System.currentTimeMillis() < nextUse)
return true;
if (!getLocation().getWorld().getName().equalsIgnoreCase(player.getLocation().getWorld().getName())) {
PlayerHandler.getInstance().removeFishingData(player.getUniqueId());
return false;
}
if (AntiAutoFish.getInstance().getConfig().getBoolean("max-fish-distance.enabled")
&& getLocation().distance(player.getLocation()) > AntiAutoFish.getInstance().getConfig()
.getInt("max-fish-distance.distance")) {
PlayerHandler.getInstance().removeFishingData(player.getUniqueId());
return false;
} else {
if (!getLocation().equals(player.getLocation())) {
PlayerHandler.getInstance().removeFishingData(player.getUniqueId());
return false;
}
}
setExploitNumber(getExploitNumber() + 1);
if (AntiAutoFish.getInstance().getConfig().getBoolean("fishing-cooldown.enabled") && AntiAutoFish.getInstance()
.getConfig().getIntegerList("fishing-cooldown.exploit-numbers").contains(getExploitNumber())) {
long total = 1000 * AntiAutoFish.getInstance().getConfig().getInt("fishing-cooldown.length");
setNextUse(System.currentTimeMillis() + total);
}
if (AntiAutoFish.getInstance().getConfig().getBoolean("fishing-messages.enabled") && AntiAutoFish.getInstance()
.getConfig().getIntegerList("fishing-messages.exploit-numbers").contains(getExploitNumber())) {
player.sendMessage(
ColorUtil.replace(AntiAutoFish.getInstance().getConfig().getString("fishing-messages.message")));
}
if (AntiAutoFish.getInstance().getConfig().getBoolean("disallow-fish.enabled") && AntiAutoFish.getInstance()
.getConfig().getIntegerList("disallow-fish.exploit-numbers").contains(getExploitNumber())) {
return true;
}
if (AntiAutoFish.getInstance().getConfig().getBoolean("kicking-players.enabled") && AntiAutoFish.getInstance()
.getConfig().getIntegerList("kicking-players.exploit-numbers").contains(getExploitNumber())) {
player.kickPlayer(
ColorUtil.replace(AntiAutoFish.getInstance().getConfig().getString("kicking-players.message")));
return false;
}
return false;
}
public void setExploitNumber(int exploitNumber) {
this.exploitNumber = exploitNumber;
}
public int getExploitNumber() {
return exploitNumber;
}
public void setNextUse(long nextUse) {
this.nextUse = nextUse;
}
public long getNextUse() {
return nextUse;
}
public UUID getUUID() {
return uuid;
}
public Location getLocation() {
return location;
}
}
@@ -12,65 +12,94 @@ import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.ItemStack;
import com.codingguru.autofish.AntiAutoFish;
import com.codingguru.autofish.util.ColorUtil;
import com.codingguru.autofish.util.ConsoleUtil;
import net.kyori.adventure.text.Component;
public class CaptchaHandler {
private final static CaptchaHandler INSTANCE = new CaptchaHandler();
private static final Set<UUID> activeCaptchas = new HashSet<>();
private final static CaptchaHandler INSTANCE = new CaptchaHandler();
private static final Set<UUID> activeCaptchas = new HashSet<>();
@SuppressWarnings("deprecation")
public void openCaptcha(Player player) {
AntiAutoFish plugin = AntiAutoFish.getInstance();
String title = plugin.getConfig().getString("fishing-captcha.inventory-name", "Verify!");
public void openCaptcha(Player player) {
if (player.getOpenInventory() != null && player.getOpenInventory().getTitle().equalsIgnoreCase(title)
&& activeCaptchas.contains(player.getUniqueId()))
return;
// Skip if the captcha GUI is already open for this player.
if (activeCaptchas.contains(player.getUniqueId())
&& player.getOpenInventory().getTopInventory().getHolder() instanceof CaptchaHolder)
return;
Material targetItem = getTargetItem();
int size = plugin.getConfig().getInt("fishing-captcha.inventory-size", 36);
Inventory inv = Bukkit.createInventory(null, size, title);
AntiAutoFish plugin = AntiAutoFish.getInstance();
Component title = ColorUtil.format(plugin.getConfig().getString("fishing-captcha.inventory-name", "Verify!"));
int correctSlot = ThreadLocalRandom.current().nextInt(size);
activeCaptchas.add(player.getUniqueId());
Material targetItem = getTargetItem();
int size = plugin.getConfig().getInt("fishing-captcha.inventory-size", 36);
Inventory inv = Bukkit.createInventory(new CaptchaHolder(), size, title);
for (int i = 0; i < size; i++) {
inv.setItem(i, new ItemStack(i == correctSlot ? targetItem : Material.AIR));
}
int correctSlot = ThreadLocalRandom.current().nextInt(size);
player.openInventory(inv);
}
for (int i = 0; i < size; i++) {
public Material getTargetItem() {
String itemName = AntiAutoFish.getInstance().getConfig().getString("fishing-captcha.captcha-item", "EMERALD");
Material targetItem;
inv.setItem(i, new ItemStack(i == correctSlot ? targetItem : Material.AIR));
try {
targetItem = Material.valueOf(itemName.toUpperCase());
} catch (IllegalArgumentException e) {
ConsoleUtil.warning("Invalid item type in config: " + itemName + ". Defaulting to EMERALD.");
targetItem = Material.EMERALD;
}
}
return targetItem;
}
player.openInventory(inv);
public boolean hasPendingCaptcha(Player player) {
return activeCaptchas.contains(player.getUniqueId());
}
// Mark active only after the GUI is actually open so a failed open cannot brick
// the player's fishing.
activeCaptchas.add(player.getUniqueId());
// Reset the timing sample so a fresh, post-verification window is collected
// regardless of how the captcha ends.
TimingHandler.getInstance().clear(player.getUniqueId());
public void removeCaptcha(Player player) {
activeCaptchas.remove(player.getUniqueId());
}
}
public void completeCaptcha(Player player) {
activeCaptchas.remove(player.getUniqueId());
PlayerHandler.getInstance().removeFishingData(player.getUniqueId());
player.closeInventory();
}
public Material getTargetItem() {
String itemName = AntiAutoFish.getInstance().getConfig().getString("fishing-captcha.captcha-item", "EMERALD");
Material targetItem;
try {
targetItem = Material.valueOf(itemName.toUpperCase());
} catch (IllegalArgumentException e) {
ConsoleUtil.warning("Invalid item type in config: " + itemName + ". Defaulting to EMERALD.");
targetItem = Material.EMERALD;
}
return targetItem;
}
public boolean hasPendingCaptcha(Player player) {
return activeCaptchas.contains(player.getUniqueId());
}
public void removeCaptcha(Player player) {
activeCaptchas.remove(player.getUniqueId());
}
public void completeCaptcha(Player player) {
activeCaptchas.remove(player.getUniqueId());
PlayerHandler.getInstance().removeFishingData(player.getUniqueId());
TimingHandler.getInstance().clear(player.getUniqueId());
player.closeInventory();
}
public static CaptchaHandler getInstance() {
return INSTANCE;
}
public static CaptchaHandler getInstance() {
return INSTANCE;
}
}
@@ -0,0 +1,20 @@
package com.codingguru.autofish.handlers;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.InventoryHolder;
/**
* Marker {@link InventoryHolder} used to identify the captcha GUI without
* comparing (deprecated) inventory title strings. Any inventory whose holder is
* an instance of this class is a captcha.
*/
public class CaptchaHolder implements InventoryHolder {
@Override
public Inventory getInventory() {
return null;
}
}
@@ -10,30 +10,43 @@ import com.codingguru.autofish.model.PlayerFishingData;
public class PlayerHandler {
private final static PlayerHandler INSTANCE = new PlayerHandler();
private Map<UUID, PlayerFishingData> cachedData = new HashMap<UUID, PlayerFishingData>();
private final static PlayerHandler INSTANCE = new PlayerHandler();
private Map<UUID, PlayerFishingData> cachedData = new HashMap<UUID, PlayerFishingData>();
public PlayerFishingData getFishingData(UUID uuid, Location location) {
if (cachedData.containsKey(uuid)) {
return cachedData.get(uuid);
}
return new PlayerFishingData(uuid, location);
}
public PlayerFishingData getFishingData(UUID uuid, Location location) {
public boolean hasFishingData(UUID uuid) {
return cachedData.containsKey(uuid);
}
if (cachedData.containsKey(uuid)) {
public void addFishingData(UUID uuid, PlayerFishingData data) {
cachedData.put(uuid, data);
}
return cachedData.get(uuid);
public void removeFishingData(UUID uuid) {
cachedData.remove(uuid);
}
}
public static PlayerHandler getInstance() {
return INSTANCE;
}
return new PlayerFishingData(uuid, location);
}
public boolean hasFishingData(UUID uuid) {
return cachedData.containsKey(uuid);
}
public void addFishingData(UUID uuid, PlayerFishingData data) {
cachedData.put(uuid, data);
}
public void removeFishingData(UUID uuid) {
cachedData.remove(uuid);
}
public static PlayerHandler getInstance() {
return INSTANCE;
}
}
@@ -0,0 +1,294 @@
package com.codingguru.autofish.handlers;
import java.util.ArrayDeque;
import java.util.Deque;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
import com.codingguru.autofish.AntiAutoFish;
/**
* Detects auto-fishing from the timing of a player's catches, independent of
* their position.
*
* <p>
* Two complementary signals are combined; either one tripping flags the player:
*
* <ul>
* <li><b>Catch interval</b> &mdash; the coefficient of variation (standard
* deviation / mean) of the gaps between consecutive catches. A metronomic
* recast loop collapses this toward zero. Note that vanilla Minecraft
* randomizes the bite wait (~5-30s), so this signal mostly catches bots that
* force catches on a fixed timer.</li>
* <li><b>Reaction time</b> &mdash; the delay between a fish biting
* ({@code BITE}) and the player reeling it in ({@code CAUGHT_FISH}). Macros
* reel almost instantly and with near-zero variance; humans react in a few
* hundred milliseconds and jitter. This is the stronger signal because the
* vanilla bite timer does not pollute it.</li>
* </ul>
*
* <p>
* All access happens from Bukkit fishing events on the main server thread, so
* plain maps are sufficient.
*/
public class TimingHandler {
private final static TimingHandler INSTANCE = new TimingHandler();
/**
* A reaction longer than this is treated as not a real bite-then-reel pair and
* discarded.
*/
private static final long MAX_REACTION_NANOS = 10_000L * 1_000_000L;
private final Map<UUID, Deque<Long>> catchTimes = new HashMap<>();
private final Map<UUID, Deque<Long>> reactionTimes = new HashMap<>();
private final Map<UUID, Long> biteTimes = new HashMap<>();
/**
* Records the timestamp (nanoseconds) of a catch for interval analysis.
*/
public void recordCatch(UUID uuid, long timestamp) {
push(catchTimes.computeIfAbsent(uuid, k -> new ArrayDeque<>()), timestamp);
}
/**
* Records the moment (nanoseconds) a fish bit the player's hook.
*/
public void recordBite(UUID uuid, long timestamp) {
biteTimes.put(uuid, timestamp);
}
/**
* Records the reaction time for a catch, derived from the most recent bite for
* this player. Does nothing if no bite was seen, or if the gap is non-positive
* or implausibly large.
*/
public void recordReaction(UUID uuid, long catchTimestamp) {
final Long bite = biteTimes.remove(uuid);
if (bite == null)
return;
final long reaction = catchTimestamp - bite;
if (reaction <= 0 || reaction > MAX_REACTION_NANOS)
return;
push(reactionTimes.computeIfAbsent(uuid, k -> new ArrayDeque<>()), reaction);
}
/**
* Returns true when either the catch-interval or reaction-time signal looks
* inhuman.
*/
public boolean isSuspicious(UUID uuid) {
if (!isEnabled())
return false;
return intervalSuspicious(uuid) || reactionSuspicious(uuid);
}
public void clear(UUID uuid) {
catchTimes.remove(uuid);
reactionTimes.remove(uuid);
biteTimes.remove(uuid);
}
/* ------------------------------ Signals ------------------------------ */
private boolean intervalSuspicious(UUID uuid) {
final long[] stamps = snapshot(catchTimes.get(uuid));
if (stamps == null || stamps.length < 2)
return false;
final long[] gaps = new long[stamps.length - 1];
for (int i = 1; i < stamps.length; i++) {
gaps[i - 1] = stamps[i] - stamps[i - 1];
}
final double[] stats = meanAndStdDev(gaps);
if (stats[0] <= 0)
return false;
return (stats[1] / stats[0]) < getCvThreshold();
}
private boolean reactionSuspicious(UUID uuid) {
if (!isReactionEnabled())
return false;
final long[] reactions = snapshot(reactionTimes.get(uuid));
if (reactions == null)
return false;
final double[] stats = meanAndStdDev(reactions);
final double meanMs = stats[0] / 1_000_000.0;
if (meanMs <= 0)
return false;
// Inhumanly fast on average.
if (meanMs < getReactionFloorMs())
return true;
// Robotically consistent while still fast.
final double cv = stats[1] / stats[0];
return cv < getReactionCvThreshold() && meanMs < getReactionMaxMeanMs();
}
/* ------------------------------ Helpers ------------------------------ */
private void push(Deque<Long> deque, long value) {
final int sampleSize = getSampleSize();
deque.addLast(value);
while (deque.size() > sampleSize) {
deque.removeFirst();
}
}
/**
* Returns the deque's contents as an array, or null if it is missing or has
* fewer than min-catches entries.
*/
private long[] snapshot(Deque<Long> deque) {
if (deque == null || deque.size() < getMinCatches())
return null;
final long[] values = new long[deque.size()];
int i = 0;
for (final long value : deque) {
values[i++] = value;
}
return values;
}
/** Returns {mean, populationStandardDeviation} of the given values. */
private static double[] meanAndStdDev(long[] values) {
double sum = 0;
for (final long value : values) {
sum += value;
}
final double mean = sum / values.length;
double squaredDiff = 0;
for (final long value : values) {
final double diff = value - mean;
squaredDiff += diff * diff;
}
return new double[] { mean, Math.sqrt(squaredDiff / values.length) };
}
/* ------------------------------ Config ------------------------------- */
private boolean isEnabled() {
return AntiAutoFish.getInstance().getConfig().getBoolean("fishing-timing.enabled", true);
}
private boolean isReactionEnabled() {
return AntiAutoFish.getInstance().getConfig().getBoolean("fishing-timing.reaction-enabled", true);
}
private int getSampleSize() {
return Math.max(2, AntiAutoFish.getInstance().getConfig().getInt("fishing-timing.sample-size", 15));
}
private int getMinCatches() {
final int min = AntiAutoFish.getInstance().getConfig().getInt("fishing-timing.min-catches", 10);
return Math.max(2, Math.min(min, getSampleSize()));
}
private double getCvThreshold() {
return clampCv(AntiAutoFish.getInstance().getConfig().getDouble("fishing-timing.cv-threshold", 0.10));
}
private double getReactionCvThreshold() {
return clampCv(AntiAutoFish.getInstance().getConfig().getDouble("fishing-timing.reaction-cv-threshold", 0.15));
}
private double getReactionFloorMs() {
return Math.max(0, AntiAutoFish.getInstance().getConfig().getDouble("fishing-timing.reaction-floor-ms", 120));
}
private double getReactionMaxMeanMs() {
return Math.max(0,
AntiAutoFish.getInstance().getConfig().getDouble("fishing-timing.reaction-max-mean-ms", 400));
}
/**
* Keeps a coefficient-of-variation threshold within (0, 1]; a misconfigured
* value falls back to the default.
*/
private static double clampCv(double raw) {
if (raw <= 0)
return 0.10;
return Math.min(raw, 1.0);
}
public static TimingHandler getInstance() {
return INSTANCE;
}
}
@@ -6,42 +6,45 @@ import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.inventory.ItemStack;
import org.bukkit.plugin.java.JavaPlugin;
import com.codingguru.autofish.AntiAutoFish;
import com.codingguru.autofish.handlers.CaptchaHandler;
import com.codingguru.autofish.handlers.CaptchaHolder;
import com.codingguru.autofish.util.ColorUtil;
public class InventoryClick implements Listener {
private final JavaPlugin plugin;
@EventHandler
public void onInventoryClick(InventoryClickEvent e) {
public InventoryClick(JavaPlugin plugin) {
this.plugin = plugin;
}
if (!(e.getWhoClicked() instanceof Player))
return;
@SuppressWarnings("deprecation")
@EventHandler
public void onInventoryClick(InventoryClickEvent e) {
if (!(e.getWhoClicked() instanceof Player))
return;
// Only act on the captcha GUI.
if (!(e.getInventory().getHolder() instanceof CaptchaHolder))
return;
String configTitle = plugin.getConfig().getString("fishing-captcha.inventory-name", "Verify!");
final Player player = (Player) e.getWhoClicked();
if (!e.getView().getTitle().equals(configTitle))
return;
// Lock down every click while the captcha is open (including the player's own
// inventory).
e.setCancelled(true);
Player player = (Player) e.getWhoClicked();
// Only a click inside the captcha inventory itself can solve it.
if (e.getClickedInventory() == null || !(e.getClickedInventory().getHolder() instanceof CaptchaHolder))
return;
e.setCancelled(true);
final ItemStack clickedItem = e.getCurrentItem();
final Material targetItem = CaptchaHandler.getInstance().getTargetItem();
ItemStack clickedItem = e.getCurrentItem();
Material targetItem = CaptchaHandler.getInstance().getTargetItem();
if (clickedItem != null && clickedItem.getType() == targetItem) {
player.sendMessage(ColorUtil.format(AntiAutoFish.getInstance().getConfig()
.getString("fishing-captcha.success-message", "You have completed the captcha!")));
CaptchaHandler.getInstance().completeCaptcha(player);
}
}
if (clickedItem != null && clickedItem.getType() == targetItem) {
player.sendMessage(ColorUtil.replace(AntiAutoFish.getInstance().getConfig()
.getString("fishing-captcha.success-message", "You have completed the captcha!")));
CaptchaHandler.getInstance().completeCaptcha(player);
}
}
}
@@ -9,33 +9,47 @@ import org.bukkit.scheduler.BukkitRunnable;
import com.codingguru.autofish.AntiAutoFish;
import com.codingguru.autofish.handlers.CaptchaHandler;
import com.codingguru.autofish.handlers.CaptchaHolder;
import com.codingguru.autofish.util.ColorUtil;
public class InventoryClose implements Listener {
private final JavaPlugin plugin;
private final JavaPlugin plugin;
public InventoryClose(JavaPlugin plugin) {
this.plugin = plugin;
}
public InventoryClose(JavaPlugin plugin) {
@EventHandler
public void onInventoryClose(InventoryCloseEvent e) {
if (!(e.getPlayer() instanceof Player))
return;
this.plugin = plugin;
Player player = (Player) e.getPlayer();
}
if (!CaptchaHandler.getInstance().hasPendingCaptcha(player))
return;
@EventHandler
public void onInventoryClose(InventoryCloseEvent e) {
if (!(e.getPlayer() instanceof Player))
return;
// Only react to closing the captcha GUI itself.
if (!(e.getInventory().getHolder() instanceof CaptchaHolder))
return;
Player player = (Player) e.getPlayer();
if (!CaptchaHandler.getInstance().hasPendingCaptcha(player))
return;
new BukkitRunnable() {
@Override
public void run() {
CaptchaHandler.getInstance().openCaptcha(player);
player.sendMessage(ColorUtil.format(AntiAutoFish.getInstance().getConfig().getString(
"fishing-captcha.closed-inv-message", "You must complete the captcha to continue!")));
}
}.runTaskLater(plugin, 1L);
}
new BukkitRunnable() {
@Override
public void run() {
CaptchaHandler.getInstance().openCaptcha(player);
player.sendMessage(ColorUtil.replace(AntiAutoFish.getInstance().getConfig().getString(
"fishing-captcha.closed-inv-message", "You must complete the captcha to continue!")));
}
}.runTaskLater(plugin, 1L);
}
}
@@ -1,26 +1,78 @@
package com.codingguru.autofish.listeners;
import java.util.UUID;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerFishEvent;
import com.codingguru.autofish.AntiAutoFish;
import com.codingguru.autofish.handlers.CaptchaHandler;
import com.codingguru.autofish.handlers.PlayerHandler;
import com.codingguru.autofish.handlers.TimingHandler;
import com.codingguru.autofish.model.PlayerFishingData;
public class PlayerFish implements Listener {
@EventHandler(priority = EventPriority.LOWEST)
public void onPlayerFish(PlayerFishEvent e) {
if (e.isCancelled())
return;
@EventHandler(priority = EventPriority.LOWEST)
public void onPlayerFish(PlayerFishEvent e) {
if (e.getCaught() == null)
return;
if (e.isCancelled())
return;
PlayerFishingData cachedData = PlayerHandler.getInstance().getFishingData(e.getPlayer().getUniqueId(),
e.getPlayer().getLocation());
final Player player = e.getPlayer();
if (player.hasPermission("autofish.bypass"))
return;
final UUID uuid = player.getUniqueId();
// Stamp the moment the fish bit, so the reel-in reaction time can be measured
// on the catch.
if (e.getState() == PlayerFishEvent.State.BITE) {
TimingHandler.getInstance().recordBite(uuid, System.nanoTime());
return;
}
// Everything below only concerns a successful fish catch, not reeled-in
// entities/items.
if (e.getState() != PlayerFishEvent.State.CAUGHT_FISH)
return;
// Block all catches while an unsolved captcha is pending so the gate cannot be
// ignored.
if (CaptchaHandler.getInstance().hasPendingCaptcha(player)) {
if (AntiAutoFish.getInstance().getConfig().getBoolean("fishing-captcha.block-fishing-until-solved", true))
e.setCancelled(true);
return;
}
// Record the catch timing for position-independent bot detection.
final long now = System.nanoTime();
TimingHandler.getInstance().recordCatch(uuid, now);
TimingHandler.getInstance().recordReaction(uuid, now);
final PlayerFishingData cachedData = PlayerHandler.getInstance().getFishingData(uuid, player.getLocation());
boolean cancelled = cachedData.isFishCancelled(player);
// Inhuman catch intervals or reel-in reaction times trip the captcha gate, even
// if the bot moves around.
if (TimingHandler.getInstance().isSuspicious(uuid)) {
CaptchaHandler.getInstance().openCaptcha(player);
cancelled = true;
}
e.setCancelled(cancelled);
}
e.setCancelled(cachedData.isFishCancelled(e.getPlayer()));
}
}
@@ -6,13 +6,17 @@ import org.bukkit.event.player.PlayerQuitEvent;
import com.codingguru.autofish.handlers.CaptchaHandler;
import com.codingguru.autofish.handlers.PlayerHandler;
import com.codingguru.autofish.handlers.TimingHandler;
public class PlayerQuit implements Listener {
@EventHandler
public void onPlayerQuit(PlayerQuitEvent e) {
CaptchaHandler.getInstance().removeCaptcha(e.getPlayer());
PlayerHandler.getInstance().removeFishingData(e.getPlayer().getUniqueId());
}
@EventHandler
public void onPlayerQuit(PlayerQuitEvent e) {
CaptchaHandler.getInstance().removeCaptcha(e.getPlayer());
PlayerHandler.getInstance().removeFishingData(e.getPlayer().getUniqueId());
TimingHandler.getInstance().clear(e.getPlayer().getUniqueId());
}
}
@@ -12,95 +12,133 @@ import com.codingguru.autofish.util.ColorUtil;
public class PlayerFishingData {
private UUID uuid;
private Location location;
private long nextUse;
private int exploitNumber;
private UUID uuid;
private Location location;
private long nextUse;
private int exploitNumber;
public PlayerFishingData(UUID uuid, Location location) {
this.uuid = uuid;
this.location = location;
PlayerHandler.getInstance().addFishingData(uuid, this);
}
public PlayerFishingData(UUID uuid, Location location) {
@SuppressWarnings("deprecation")
public boolean isFishCancelled(Player player) {
if (nextUse != 0 && System.currentTimeMillis() < nextUse)
return true;
this.uuid = uuid;
this.location = location;
PlayerHandler.getInstance().addFishingData(uuid, this);
if (!getLocation().getWorld().getName().equalsIgnoreCase(player.getLocation().getWorld().getName())) {
PlayerHandler.getInstance().removeFishingData(player.getUniqueId());
return false;
}
}
if (AntiAutoFish.getInstance().getConfig().getBoolean("max-fish-distance.enabled")
&& getLocation().distance(player.getLocation()) > AntiAutoFish.getInstance().getConfig()
.getInt("max-fish-distance.distance")) {
PlayerHandler.getInstance().removeFishingData(player.getUniqueId());
return false;
} else {
if (!getLocation().equals(player.getLocation())) {
PlayerHandler.getInstance().removeFishingData(player.getUniqueId());
return false;
}
}
public boolean isFishCancelled(Player player) {
setExploitNumber(getExploitNumber() + 1);
if (nextUse != 0 && System.currentTimeMillis() < nextUse)
return true;
if (AntiAutoFish.getInstance().getConfig().getBoolean("fishing-captcha.enabled") && AntiAutoFish.getInstance()
.getConfig().getIntegerList("fishing-captcha.exploit-numbers").contains(getExploitNumber())) {
CaptchaHandler.getInstance().openCaptcha(player);
}
if (!getLocation().getWorld().getName().equalsIgnoreCase(player.getLocation().getWorld().getName())) {
if (AntiAutoFish.getInstance().getConfig().getBoolean("fishing-cooldown.enabled") && AntiAutoFish.getInstance()
.getConfig().getIntegerList("fishing-cooldown.exploit-numbers").contains(getExploitNumber())) {
long total = 1000 * AntiAutoFish.getInstance().getConfig().getInt("fishing-cooldown.length");
setNextUse(System.currentTimeMillis() + total);
}
PlayerHandler.getInstance().removeFishingData(player.getUniqueId());
return false;
if (AntiAutoFish.getInstance().getConfig().getBoolean("fishing-messages.enabled") && AntiAutoFish.getInstance()
.getConfig().getIntegerList("fishing-messages.exploit-numbers").contains(getExploitNumber())) {
player.sendMessage(
ColorUtil.replace(AntiAutoFish.getInstance().getConfig().getString("fishing-messages.message")));
}
}
if (AntiAutoFish.getInstance().getConfig().getBoolean("disallow-fish.enabled") && AntiAutoFish.getInstance()
.getConfig().getIntegerList("disallow-fish.exploit-numbers").contains(getExploitNumber())) {
return true;
}
if (AntiAutoFish.getInstance().getConfig().getBoolean("max-fish-distance.enabled")
&& getLocation().distance(player.getLocation()) > AntiAutoFish.getInstance().getConfig()
.getInt("max-fish-distance.distance"))
{
if (AntiAutoFish.getInstance().getConfig().getBoolean("kicking-players.enabled") && AntiAutoFish.getInstance()
.getConfig().getIntegerList("kicking-players.exploit-numbers").contains(getExploitNumber())) {
player.kickPlayer(
ColorUtil.replace(AntiAutoFish.getInstance().getConfig().getString("kicking-players.message")));
return false;
}
PlayerHandler.getInstance().removeFishingData(player.getUniqueId());
return false;
return false;
}
} else {
public void setExploitNumber(int exploitNumber) {
this.exploitNumber = exploitNumber;
}
if (!getLocation().equals(player.getLocation())) {
public int getExploitNumber() {
return exploitNumber;
}
PlayerHandler.getInstance().removeFishingData(player.getUniqueId());
return false;
public void setNextUse(long nextUse) {
this.nextUse = nextUse;
}
}
public long getNextUse() {
return nextUse;
}
}
public UUID getUUID() {
return uuid;
}
setExploitNumber(getExploitNumber() + 1);
public Location getLocation() {
return location;
}
if (AntiAutoFish.getInstance().getConfig().getBoolean("fishing-captcha.enabled") && AntiAutoFish.getInstance()
.getConfig().getIntegerList("fishing-captcha.exploit-numbers").contains(getExploitNumber()))
{
CaptchaHandler.getInstance().openCaptcha(player);
}
if (AntiAutoFish.getInstance().getConfig().getBoolean("fishing-cooldown.enabled") && AntiAutoFish.getInstance()
.getConfig().getIntegerList("fishing-cooldown.exploit-numbers").contains(getExploitNumber()))
{
long total = 1000 * AntiAutoFish.getInstance().getConfig().getInt("fishing-cooldown.length");
setNextUse(System.currentTimeMillis() + total);
}
if (AntiAutoFish.getInstance().getConfig().getBoolean("fishing-messages.enabled") && AntiAutoFish.getInstance()
.getConfig().getIntegerList("fishing-messages.exploit-numbers").contains(getExploitNumber()))
{
player.sendMessage(
ColorUtil.format(AntiAutoFish.getInstance().getConfig().getString("fishing-messages.message")));
}
if (AntiAutoFish.getInstance().getConfig().getBoolean("disallow-fish.enabled") && AntiAutoFish.getInstance()
.getConfig().getIntegerList("disallow-fish.exploit-numbers").contains(getExploitNumber()))
{
return true;
}
if (AntiAutoFish.getInstance().getConfig().getBoolean("kicking-players.enabled") && AntiAutoFish.getInstance()
.getConfig().getIntegerList("kicking-players.exploit-numbers").contains(getExploitNumber()))
{
player.kick(ColorUtil.format(AntiAutoFish.getInstance().getConfig().getString("kicking-players.message")));
return false;
}
return false;
}
public void setExploitNumber(int exploitNumber) {
this.exploitNumber = exploitNumber;
}
public int getExploitNumber() {
return exploitNumber;
}
public void setNextUse(long nextUse) {
this.nextUse = nextUse;
}
public long getNextUse() {
return nextUse;
}
public UUID getUUID() {
return uuid;
}
public Location getLocation() {
return location;
}
}
@@ -1,11 +1,24 @@
package com.codingguru.autofish.util;
import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.minimessage.MiniMessage;
public final class ColorUtil {
public static String replace(String s) {
return s.replaceAll("(&([a-f0-9]))", "\u00A7$2").replaceAll("&l", "\u00A7l").replaceAll("&o", "\u00A7o")
.replaceAll("&k", "\u00A7k").replaceAll("&r", "\u00A7r").replaceAll("&n", "\u00A7n")
.replaceAll("&m", "\u00A7m");
}
private static final MiniMessage MINI_MESSAGE = MiniMessage.miniMessage();
private ColorUtil() {
}
/**
* Parses a MiniMessage-formatted string into an Adventure {@link Component}. A
* null input yields an empty component.
*/
public static Component format(String message) {
return MINI_MESSAGE.deserialize(message == null ? "" : message);
}
}
@@ -1,37 +1,47 @@
package com.codingguru.autofish.util;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.command.ConsoleCommandSender;
import com.codingguru.autofish.AntiAutoFish;
@SuppressWarnings("deprecation")
import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.format.NamedTextColor;
public class ConsoleUtil {
private final static ConsoleCommandSender CONSOLE = Bukkit.getServer().getConsoleSender();
private final static ConsoleCommandSender CONSOLE = Bukkit.getServer().getConsoleSender();
public static void sendPluginSetup() {
boolean isUpdateAvailable = new UpdateUtil().hasNewUpdate();
CONSOLE.sendMessage(ChatColor.GREEN + "=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=");
CONSOLE.sendMessage(ChatColor.GREEN + "Plugin Name: " + ChatColor.YELLOW + "AntiAutoFishing");
CONSOLE.sendMessage(ChatColor.GREEN + "Plugin Version: " + ChatColor.YELLOW
+ AntiAutoFish.getInstance().getDescription().getVersion());
CONSOLE.sendMessage(ChatColor.GREEN + "Server Version: " + ChatColor.YELLOW + Bukkit.getBukkitVersion());
CONSOLE.sendMessage(ChatColor.GREEN + "Author: " + ChatColor.YELLOW + "CodingGuru");
CONSOLE.sendMessage(ChatColor.GREEN + "Discord: " + ChatColor.YELLOW + "https://discord.gg/CbJxH5NPvX");
CONSOLE.sendMessage(ChatColor.GREEN + "Updates: " + ChatColor.YELLOW
+ (isUpdateAvailable ? ChatColor.YELLOW + "A new update was found! Please update this version."
: ChatColor.YELLOW + "No new updates were found for this plugin."));
CONSOLE.sendMessage(ChatColor.GREEN + "=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=");
}
private static final String SEPARATOR = "=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=";
public static void info(String message) {
CONSOLE.sendMessage(message);
}
public static void sendPluginSetup() {
public static void warning(String message) {
CONSOLE.sendMessage("[WARNING] " + message);
}
CONSOLE.sendMessage(Component.text(SEPARATOR, NamedTextColor.GREEN));
CONSOLE.sendMessage(entry("Plugin Name: ", "AntiAutoFishing"));
CONSOLE.sendMessage(entry("Plugin Version: ", AntiAutoFish.getInstance().getPluginMeta().getVersion()));
CONSOLE.sendMessage(entry("Server Version: ", Bukkit.getBukkitVersion()));
CONSOLE.sendMessage(entry("Author: ", "CodingGuru"));
CONSOLE.sendMessage(entry("Discord: ", "https://discord.gg/CbJxH5NPvX"));
CONSOLE.sendMessage(Component.text(SEPARATOR, NamedTextColor.GREEN));
}
private static Component entry(String label, String value) {
return Component.text(label, NamedTextColor.GREEN).append(Component.text(value, NamedTextColor.YELLOW));
}
public static void info(String message) {
CONSOLE.sendMessage(Component.text(message));
}
public static void warning(String message) {
CONSOLE.sendMessage(Component.text("[WARNING] " + message, NamedTextColor.YELLOW));
}
}
@@ -1,39 +0,0 @@
package com.codingguru.autofish.util;
import java.io.IOException;
import java.io.InputStream;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.Scanner;
import com.codingguru.autofish.AntiAutoFish;
public class UpdateUtil {
private final int RESOURCE_ID = 116664;
@SuppressWarnings("deprecation")
public boolean hasNewUpdate() {
if (!AntiAutoFish.getInstance().getConfig().getBoolean("check-for-updates", true)) {
return false;
}
String currentVersion = AntiAutoFish.getInstance().getDescription().getVersion();
try (InputStream inputStream = new URI("https://api.spigotmc.org/legacy/update.php?resource=" + RESOURCE_ID)
.toURL().openStream(); Scanner scanner = new Scanner(inputStream)) {
if (scanner.hasNext()) {
String updatedVersion = scanner.next();
if (!currentVersion.equalsIgnoreCase(updatedVersion)) {
return true; // found update
}
}
} catch (IOException exception) {
} catch (URISyntaxException e) {
}
return false;
}
}
+37 -50
View File
@@ -1,70 +1,57 @@
# General Settings
check-for-updates: true # Check for new plugin updates
# AntiFishing Settings
# This is the max distance between the players last fishing location to count towards their anti fish total
# If disabled then it will only count the exact same spot (including mouse movement)
# AntiAutoFishing-OG configuration
# How far a player may move between catches and still count as the same spot.
# Stationary auto-fishers stay within this radius; humans wander out and reset.
max-fish-distance:
enabled: true
distance: 3 # The amount of blocks between last fishing location
distance: 3 # Blocks from the last fishing location.
# Player captcha appears where they need to click on the emerald to continue
# Timing analysis flags inhuman catch timing, regardless of position.
# Either check below can trip the captcha.
fishing-timing:
enabled: true
sample-size: 15 # Most recent catches kept per player.
min-catches: 10 # Catches required before judging (clamped to <= sample-size).
# Catch-interval check: how regular the gaps between catches are.
# Vanilla randomizes the bite wait (~5-30s), so this mainly catches fixed-timer bots.
cv-threshold: 0.1 # Flag when interval variation falls below this. Higher = more flags.
# Reaction check: time from a fish biting to the player reeling in. The stronger signal.
reaction-enabled: true
reaction-floor-ms: 120 # Average reaction faster than this (ms) is inhuman.
reaction-cv-threshold: 0.15 # Also flag overly consistent reactions, when fast (see below).
reaction-max-mean-ms: 400 # The reaction-cv check only applies below this average (ms).
# Captcha: the player must click the target item in a GUI to keep fishing.
# This is the response used when a player is flagged.
fishing-captcha:
enabled: true
captcha-item: 'EMERALD' # Type of item they need to click on
inventory-name: "Click the emerald to verify!"
block-fishing-until-solved: true # Cancel catches until solved. Disable if players ever get stuck.
captcha-item: 'EMERALD' # Item the player must click.
inventory-name: '<green>Click the emerald to verify!</green>'
inventory-size: 36
success-message: '&aYou have successfully verified.'
closed-inv-message: '&cYou must complete the captcha to continue.'
exploit-numbers:
- 5
# Fishing cooldown is giving a player a temporary cooldown for the amount of anti fish total
success-message: '<green>You have successfully verified.</green>'
closed-inv-message: '<red>You must complete the captcha to continue.</red>'
exploit-numbers: [5] # Same-spot catch totals that open the captcha.
# Temporary cooldown between catches at the listed same-spot totals.
fishing-cooldown:
enabled: false
length: -1 # This is in seconds
exploit-numbers: # This is the "anti fish total" (the amount of times they have fished from the same spot)
- 5
- 6
- 7
- 8
- 9
- 10
# Fishing messages is giving a player a warning message for the amount of anti fish total
length: 30 # Cooldown in seconds.
exploit-numbers: [5, 6, 7, 8, 9, 10]
# Warning message at the listed same-spot totals.
fishing-messages:
enabled: false
message: "&cPlease move around while fishing." # This is the message they will receive
exploit-numbers: # This is the "anti fish total" (the amount of times they have fished from the same spot)
- 5
- 6
- 7
- 8
- 9
- 10
# This will stop a player from fishing on these anti fish totals
message: '<red>Please move around while fishing.</red>'
exploit-numbers: [5, 6, 7, 8, 9, 10]
# Block catches at the listed same-spot totals.
disallow-fish:
enabled: false
exploit-numbers: # This is the "anti fish total" (the amount of times they have fished from the same spot)
- 5
- 6
- 7
- 8
- 9
- 10
# This will kick a player for fishing in the same spot too many times
exploit-numbers: [5, 6, 7, 8, 9, 10]
# Kick the player at the listed same-spot totals.
kicking-players:
enabled: false
message: "&cYou were detected for auto fishing." # This is the message they will receive
exploit-numbers: # This is the "anti fish total" (the amount of times they have fished from the same spot)
- 15
message: '<red>You were detected for auto fishing.</red>'
exploit-numbers: [15]
+6 -4
View File
@@ -1,7 +1,9 @@
name: AntiAutoFishing
version: 2.0.2
api-version: 1.13
version: '${version}'
api-version: '${apiVersion}'
main: com.codingguru.autofish.AntiAutoFish
authors: [CodingGuru]
folia-supported: true
commands:
permissions:
autofish.bypass:
description: Exempts a player from all auto-fishing checks.
default: op