Merge branch 'development'

This commit is contained in:
Christian Koop 2021-07-08 17:50:27 +02:00
commit e65dcc67cb
No known key found for this signature in database
GPG Key ID: 89A8181384E010A3
350 changed files with 15595 additions and 15446 deletions

311
.editorconfig Normal file
View File

@ -0,0 +1,311 @@
[*]
charset = utf-8
end_of_line = lf
indent_size = 4
indent_style = space
insert_final_newline = true
# max_line_length = 120
tab_width = 4
trim_trailing_whitespace = true
ij_continuation_indent_size = 8
ij_formatter_off_tag = @formatter:off
ij_formatter_on_tag = @formatter:on
ij_formatter_tags_enabled = false
ij_smart_tabs = false
ij_visual_guides = none
ij_wrap_on_typing = false
[*.java]
ij_smart_tabs = true
ij_java_align_consecutive_assignments = false
ij_java_align_consecutive_variable_declarations = false
ij_java_align_group_field_declarations = false
ij_java_align_multiline_annotation_parameters = false
ij_java_align_multiline_array_initializer_expression = false
ij_java_align_multiline_assignment = false
ij_java_align_multiline_binary_operation = false
ij_java_align_multiline_chained_methods = false
ij_java_align_multiline_extends_list = false
ij_java_align_multiline_for = true
ij_java_align_multiline_method_parentheses = false
ij_java_align_multiline_parameters = true
ij_java_align_multiline_parameters_in_calls = false
ij_java_align_multiline_parenthesized_expression = false
ij_java_align_multiline_records = true
ij_java_align_multiline_resources = true
ij_java_align_multiline_ternary_operation = false
ij_java_align_multiline_text_blocks = false
ij_java_align_multiline_throws_list = false
ij_java_align_subsequent_simple_methods = false
ij_java_align_throws_keyword = false
ij_java_annotation_parameter_wrap = off
ij_java_array_initializer_new_line_after_left_brace = false
ij_java_array_initializer_right_brace_on_new_line = false
ij_java_array_initializer_wrap = off
ij_java_assert_statement_colon_on_next_line = false
ij_java_assert_statement_wrap = off
ij_java_assignment_wrap = off
ij_java_binary_operation_sign_on_next_line = false
ij_java_binary_operation_wrap = off
ij_java_blank_lines_after_anonymous_class_header = 0
ij_java_blank_lines_after_class_header = 0
ij_java_blank_lines_after_imports = 1
ij_java_blank_lines_after_package = 1
ij_java_blank_lines_around_class = 1
ij_java_blank_lines_around_field = 0
ij_java_blank_lines_around_field_in_interface = 0
ij_java_blank_lines_around_initializer = 1
ij_java_blank_lines_around_method = 1
ij_java_blank_lines_around_method_in_interface = 1
ij_java_blank_lines_before_class_end = 0
ij_java_blank_lines_before_imports = 1
ij_java_blank_lines_before_method_body = 0
ij_java_blank_lines_before_package = 0
ij_java_block_brace_style = end_of_line
ij_java_block_comment_at_first_column = true
ij_java_builder_methods = none
ij_java_call_parameters_new_line_after_left_paren = false
ij_java_call_parameters_right_paren_on_new_line = false
ij_java_call_parameters_wrap = off
ij_java_case_statement_on_separate_line = true
ij_java_catch_on_new_line = false
ij_java_class_annotation_wrap = split_into_lines
ij_java_class_brace_style = end_of_line
ij_java_class_count_to_use_import_on_demand = 15
ij_java_class_names_in_javadoc = 1
ij_java_do_not_indent_top_level_class_members = false
ij_java_do_not_wrap_after_single_annotation = false
ij_java_do_while_brace_force = never
ij_java_doc_add_blank_line_after_description = true
ij_java_doc_add_blank_line_after_param_comments = true
ij_java_doc_add_blank_line_after_return = true
ij_java_doc_add_p_tag_on_empty_lines = true
ij_java_doc_align_exception_comments = true
ij_java_doc_align_param_comments = true
ij_java_doc_do_not_wrap_if_one_line = true
ij_java_doc_enable_formatting = true
ij_java_doc_enable_leading_asterisks = true
ij_java_doc_indent_on_continuation = true
ij_java_doc_keep_empty_lines = true
ij_java_doc_keep_empty_parameter_tag = true
ij_java_doc_keep_empty_return_tag = true
ij_java_doc_keep_empty_throws_tag = true
ij_java_doc_keep_invalid_tags = true
ij_java_doc_param_description_on_new_line = false
ij_java_doc_preserve_line_breaks = false
ij_java_doc_use_throws_not_exception_tag = true
ij_java_else_on_new_line = false
ij_java_enum_constants_wrap = off
ij_java_extends_keyword_wrap = off
ij_java_extends_list_wrap = off
ij_java_field_annotation_wrap = split_into_lines
ij_java_finally_on_new_line = false
ij_java_for_brace_force = never
ij_java_for_statement_new_line_after_left_paren = false
ij_java_for_statement_right_paren_on_new_line = false
ij_java_for_statement_wrap = off
ij_java_generate_final_locals = false
ij_java_generate_final_parameters = false
ij_java_if_brace_force = never
ij_java_imports_layout = *, |, javax.**, java.**, |, $*
ij_java_indent_case_from_switch = true
ij_java_insert_inner_class_imports = false
ij_java_insert_override_annotation = true
ij_java_keep_blank_lines_before_right_brace = 0
ij_java_keep_blank_lines_between_package_declaration_and_header = 0
ij_java_keep_blank_lines_in_code = 1
ij_java_keep_blank_lines_in_declarations = 1
ij_java_keep_builder_methods_indents = false
ij_java_keep_control_statement_in_one_line = true
ij_java_keep_first_column_comment = true
ij_java_keep_indents_on_empty_lines = false
ij_java_keep_line_breaks = true
ij_java_keep_multiple_expressions_in_one_line = false
ij_java_keep_simple_blocks_in_one_line = false
ij_java_keep_simple_classes_in_one_line = true
ij_java_keep_simple_lambdas_in_one_line = true
ij_java_keep_simple_methods_in_one_line = true
ij_java_label_indent_absolute = false
ij_java_label_indent_size = 0
ij_java_lambda_brace_style = end_of_line
ij_java_layout_static_imports_separately = true
ij_java_line_comment_add_space = false
ij_java_line_comment_at_first_column = true
ij_java_method_annotation_wrap = split_into_lines
ij_java_method_brace_style = end_of_line
ij_java_method_call_chain_wrap = off
ij_java_method_parameters_new_line_after_left_paren = false
ij_java_method_parameters_right_paren_on_new_line = false
ij_java_method_parameters_wrap = off
ij_java_modifier_list_wrap = false
ij_java_names_count_to_use_import_on_demand = 9
ij_java_new_line_after_lparen_in_record_header = false
ij_java_packages_to_use_import_on_demand = _java.awt.*, _javax.swing.*
ij_java_parameter_annotation_wrap = off
ij_java_parentheses_expression_new_line_after_left_paren = false
ij_java_parentheses_expression_right_paren_on_new_line = false
ij_java_place_assignment_sign_on_next_line = false
ij_java_prefer_longer_names = true
ij_java_prefer_parameters_wrap = false
ij_java_record_components_wrap = normal
ij_java_repeat_synchronized = true
ij_java_replace_instanceof_and_cast = true
ij_java_replace_null_check = true
ij_java_replace_sum_lambda_with_method_ref = true
ij_java_resource_list_new_line_after_left_paren = false
ij_java_resource_list_right_paren_on_new_line = false
ij_java_resource_list_wrap = off
ij_java_rparen_on_new_line_in_record_header = false
ij_java_space_after_closing_angle_bracket_in_type_argument = false
ij_java_space_after_colon = true
ij_java_space_after_comma = true
ij_java_space_after_comma_in_type_arguments = true
ij_java_space_after_for_semicolon = true
ij_java_space_after_quest = true
ij_java_space_after_type_cast = true
ij_java_space_before_annotation_array_initializer_left_brace = false
ij_java_space_before_annotation_parameter_list = false
ij_java_space_before_array_initializer_left_brace = true
ij_java_space_before_catch_keyword = true
ij_java_space_before_catch_left_brace = true
ij_java_space_before_catch_parentheses = true
ij_java_space_before_class_left_brace = true
ij_java_space_before_colon = true
ij_java_space_before_colon_in_foreach = true
ij_java_space_before_comma = false
ij_java_space_before_do_left_brace = true
ij_java_space_before_else_keyword = true
ij_java_space_before_else_left_brace = true
ij_java_space_before_finally_keyword = true
ij_java_space_before_finally_left_brace = true
ij_java_space_before_for_left_brace = true
ij_java_space_before_for_parentheses = true
ij_java_space_before_for_semicolon = false
ij_java_space_before_if_left_brace = true
ij_java_space_before_if_parentheses = true
ij_java_space_before_method_call_parentheses = false
ij_java_space_before_method_left_brace = true
ij_java_space_before_method_parentheses = false
ij_java_space_before_opening_angle_bracket_in_type_parameter = false
ij_java_space_before_quest = true
ij_java_space_before_switch_left_brace = true
ij_java_space_before_switch_parentheses = true
ij_java_space_before_synchronized_left_brace = true
ij_java_space_before_synchronized_parentheses = true
ij_java_space_before_try_left_brace = true
ij_java_space_before_try_parentheses = true
ij_java_space_before_type_parameter_list = false
ij_java_space_before_while_keyword = true
ij_java_space_before_while_left_brace = true
ij_java_space_before_while_parentheses = true
ij_java_space_inside_one_line_enum_braces = false
ij_java_space_within_empty_array_initializer_braces = true
ij_java_space_within_empty_method_call_parentheses = false
ij_java_space_within_empty_method_parentheses = false
ij_java_spaces_around_additive_operators = true
ij_java_spaces_around_assignment_operators = true
ij_java_spaces_around_bitwise_operators = true
ij_java_spaces_around_equality_operators = true
ij_java_spaces_around_lambda_arrow = true
ij_java_spaces_around_logical_operators = true
ij_java_spaces_around_method_ref_dbl_colon = false
ij_java_spaces_around_multiplicative_operators = true
ij_java_spaces_around_relational_operators = true
ij_java_spaces_around_shift_operators = true
ij_java_spaces_around_type_bounds_in_type_parameters = true
ij_java_spaces_around_unary_operator = false
ij_java_spaces_within_angle_brackets = false
ij_java_spaces_within_annotation_parentheses = false
ij_java_spaces_within_array_initializer_braces = false
ij_java_spaces_within_braces = true
ij_java_spaces_within_brackets = false
ij_java_spaces_within_cast_parentheses = false
ij_java_spaces_within_catch_parentheses = false
ij_java_spaces_within_for_parentheses = false
ij_java_spaces_within_if_parentheses = false
ij_java_spaces_within_method_call_parentheses = false
ij_java_spaces_within_method_parentheses = false
ij_java_spaces_within_parentheses = false
ij_java_spaces_within_record_header = false
ij_java_spaces_within_switch_parentheses = false
ij_java_spaces_within_synchronized_parentheses = false
ij_java_spaces_within_try_parentheses = false
ij_java_spaces_within_while_parentheses = false
ij_java_special_else_if_treatment = true
ij_java_subclass_name_suffix = Impl
ij_java_ternary_operation_signs_on_next_line = false
ij_java_ternary_operation_wrap = off
ij_java_test_name_suffix = Test
ij_java_throws_keyword_wrap = off
ij_java_throws_list_wrap = off
ij_java_use_external_annotations = false
ij_java_use_fq_class_names = false
ij_java_use_relative_indents = false
ij_java_use_single_class_imports = true
ij_java_variable_annotation_wrap = off
ij_java_visibility = public
ij_java_while_brace_force = never
ij_java_while_on_new_line = false
ij_java_wrap_comments = false
ij_java_wrap_first_method_in_call_chain = false
ij_java_wrap_long_lines = false
[*.properties]
ij_properties_align_group_field_declarations = false
ij_properties_keep_blank_lines = false
ij_properties_key_value_delimiter = equals
ij_properties_spaces_around_key_value_delimiter = false
[.editorconfig]
ij_editorconfig_align_group_field_declarations = false
ij_editorconfig_space_after_colon = false
ij_editorconfig_space_after_comma = true
ij_editorconfig_space_before_colon = false
ij_editorconfig_space_before_comma = false
ij_editorconfig_spaces_around_assignment_operators = true
[{*.ant, *.fxml, *.jhm, *.jnlp, *.jrxml, *.pom, *.rng, *.tld, *.wsdl, *.xml, *.xsd, *.xsl, *.xslt, *.xul}]
ij_xml_align_attributes = true
ij_xml_align_text = false
ij_xml_attribute_wrap = normal
ij_xml_block_comment_at_first_column = true
ij_xml_keep_blank_lines = 2
ij_xml_keep_indents_on_empty_lines = false
ij_xml_keep_line_breaks = true
ij_xml_keep_line_breaks_in_text = true
ij_xml_keep_whitespaces = false
ij_xml_keep_whitespaces_around_cdata = preserve
ij_xml_keep_whitespaces_inside_cdata = false
ij_xml_line_comment_at_first_column = true
ij_xml_space_after_tag_name = false
ij_xml_space_around_equals_in_attribute = false
ij_xml_space_inside_empty_tag = false
ij_xml_text_wrap = normal
[{*.markdown, *.md}]
indent_size = 2
tab_width = 2
ij_markdown_force_one_space_after_blockquote_symbol = true
ij_markdown_force_one_space_after_header_symbol = true
ij_markdown_force_one_space_after_list_bullet = true
ij_markdown_force_one_space_between_words = true
ij_markdown_keep_indents_on_empty_lines = false
ij_markdown_max_lines_around_block_elements = 1
ij_markdown_max_lines_around_header = 1
ij_markdown_max_lines_between_paragraphs = 1
ij_markdown_min_lines_around_block_elements = 1
ij_markdown_min_lines_around_header = 1
ij_markdown_min_lines_between_paragraphs = 1
[{*.yaml, *.yml, *.lang}]
indent_size = 2
ij_yaml_align_values_properties = do_not_align
ij_yaml_autoinsert_sequence_marker = true
ij_yaml_block_mapping_on_new_line = false
ij_yaml_indent_sequence_value = true
ij_yaml_keep_indents_on_empty_lines = false
ij_yaml_keep_line_breaks = true
ij_yaml_sequence_on_new_line = false
ij_yaml_space_before_colon = false
ij_yaml_spaces_within_braces = true
ij_yaml_spaces_within_brackets = true

12
.github/FUNDING.yml vendored Normal file
View File

@ -0,0 +1,12 @@
# These are supported funding model platforms
github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
patreon: songoda
open_collective: # Replace with a single Open Collective username
ko_fi: # Replace with a single Ko-fi username
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
liberapay: # Replace with a single Liberapay username
issuehunt: # Replace with a single IssueHunt username
otechie: # Replace with a single Otechie username
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']

11
.github/dependabot.yml vendored Normal file
View File

@ -0,0 +1,11 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
version: 2
updates:
- package-ecosystem: "maven" # See documentation for possible values
directory: "/" # Location of package manifests
schedule:
interval: "monthly"

View File

@ -5,20 +5,39 @@ name: Build SongodaCore
on:
push:
branches: [ master ]
branches: [ master, development ]
pull_request:
branches: [ master ]
types: [ opened, synchronize, reopened ]
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up JDK 16
uses: actions/setup-java@v1
with:
java-version: 16
- name: Build with Maven
run: mvn -B package --file pom.xml
# Setup Java
- uses: actions/setup-java@v2
with:
java-version: 16
distribution: adopt
# Checkout project files
- uses: actions/checkout@v2
# Caches
- name: 'Cache: Maven'
uses: actions/cache@v2
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-maven-
# Build project
- name: Build with Maven
run: 'mvn -B -Duser.name="GitHub Runner on $GITHUB_REPOSITORY (id=$GITHUB_RUN_ID)" clean package'
# Upload build artifacts
- name: 'Upload Build Artifact: SongodaCore-*.jar'
uses: actions/upload-artifact@v2
with:
name: SongodaCore-artifacts
path: ./Core/target/SongodaCore-*.jar

224
.gitignore vendored
View File

@ -1,214 +1,24 @@
### Eclipse ###
.metadata
bin/
tmp/
*.tmp
*.bak
*.swp
*~.nib
local.properties
.settings/
.loadpath
.recommenders
##
# JetBrains IDEs
##
/.idea/
# External tool builders
.externalToolBuilders/
# Locally stored "Eclipse launch configurations"
*.launch
# CDT- autotools
.autotools
# Java annotation processor (APT)
.factorypath
# PDT-specific (PHP Development Tools)
.buildpath
# sbteclipse plugin
.target
# Tern plugin
.tern-project
# TeXlipse plugin
.texlipse
# STS (Spring Tool Suite)
.springBeans
# Code Recommenders
.recommenders/
# Annotation Processing
.apt_generated/
# Scala IDE specific (Scala & Java development for Eclipse)
.cache-main
.scala_dependencies
.worksheet
### Eclipse Patch ###
# Eclipse Core
.project
# JDT-specific (Eclipse Java Development Tools)
.classpath
# Annotation Processing
.apt_generated
.sts4-cache/
### Intellij ###
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and WebStorm
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
# User-specific stuff
.idea/**/workspace.xml
.idea/**/tasks.xml
.idea/**/usage.statistics.xml
.idea/**/dictionaries
.idea/**/shelf
# Generated files
.idea/**/contentModel.xml
# Sensitive or high-churn files
.idea/**/dataSources/
.idea/**/dataSources.ids
.idea/**/dataSources.local.xml
.idea/**/sqlDataSources.xml
.idea/**/dynamic.xml
.idea/**/uiDesigner.xml
.idea/**/dbnavigator.xml
# Gradle
.idea/**/gradle.xml
.idea/**/libraries
# Gradle and Maven with auto-import
auto-import.
.idea/modules.xml
.idea/*.iml
.idea/modules
# Don't exclude files that might not be related to the IDE
*.iml
*.ipr
/*/*.iml
/NMS/*/*.iml
# Mongo Explorer plugin
.idea/**/mongoSettings.xml
##
# Maven
##
# Don't exclude a 'target' package by accident
/target/
/*/target/
/NMS/*/target/
# File-based project format
*.iws
# IntelliJ
out/
# mpeltonen/sbt-idea plugin
.idea_modules/
# JIRA plugin
atlassian-ide-plugin.xml
# Cursive Clojure plugin
.idea/replstate.xml
# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
fabric.properties
# Editor-based Rest Client
.idea/httpRequests
# Android studio 3.1+ serialized cache file
.idea/caches/build_file_checksums.ser
### Intellij Patch ###
# Comment Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-215987721
*.iml
modules.xml
.idea/misc.xml
*.ipr
.idea/compiler.xml
# Sonarlint plugin
.idea/**/sonarlint/
# SonarQube Plugin
.idea/**/sonarIssues.xml
# Markdown Navigator plugin
.idea/**/markdown-navigator.xml
.idea/**/markdown-navigator/
### Java ###
# 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*
### Maven ###
target/
pom.xml.tag
pom.xml.releaseBackup
pom.xml.versionsBackup
pom.xml.next
release.properties
dependency-reduced-pom.xml
buildNumber.properties
.mvn/timing.properties
.mvn/wrapper/maven-wrapper.jar
.flattened-pom.xml
### NetBeans ###
**/nbproject/private/
**/nbproject/Makefile-*.mk
**/nbproject/Package-*.bash
build/
nbbuild/
dist/
nbdist/
.nb-gradle/
### Gradle ###
.gradle
# Ignore Gradle GUI config
gradle-app.setting
# Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored)
!gradle-wrapper.jar
# Cache of project
.gradletasknamecache
# # Work around https://youtrack.jetbrains.com/issue/IDEA-116898
# gradle/wrapper/gradle-wrapper.properties
### Gradle Patch ###
**/build/
##
# Misc.
##
.DS_Store

View File

@ -1,24 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Encoding">
<file url="file://$PROJECT_DIR$/Compatibility/src" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/Core/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/NMS/NMS-API/src" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/NMS/NMS-v1_10_R1/src" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/NMS/NMS-v1_11_R1/src" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/NMS/NMS-v1_12_R1/src" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/NMS/NMS-v1_13_R1/src" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/NMS/NMS-v1_13_R2/src" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/NMS/NMS-v1_14_R1/src" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/NMS/NMS-v1_15_R1/src" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/NMS/NMS-v1_16_R1/src" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/NMS/NMS-v1_16_R2/src" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/NMS/NMS-v1_16_R3/src" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/NMS/NMS-v1_17_R1/src" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/NMS/NMS-v1_8_R1/src" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/NMS/NMS-v1_8_R2/src" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/NMS/NMS-v1_8_R3/src" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/NMS/NMS-v1_9_R1/src" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/NMS/NMS-v1_9_R2/src" charset="UTF-8" />
</component>
</project>

View File

@ -1,40 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="RemoteRepositoriesConfiguration">
<remote-repository>
<option name="id" value="spigot-repo" />
<option name="name" value="spigot-repo" />
<option name="url" value="https://hub.spigotmc.org/nexus/content/repositories/snapshots/" />
</remote-repository>
<remote-repository>
<option name="id" value="central" />
<option name="name" value="Central Repository" />
<option name="url" value="https://repo.maven.apache.org/maven2" />
</remote-repository>
<remote-repository>
<option name="id" value="central" />
<option name="name" value="Maven Central repository" />
<option name="url" value="https://repo1.maven.org/maven2" />
</remote-repository>
<remote-repository>
<option name="id" value="jitpack.io" />
<option name="name" value="jitpack.io" />
<option name="url" value="https://jitpack.io" />
</remote-repository>
<remote-repository>
<option name="id" value="CodeMC" />
<option name="name" value="CodeMC" />
<option name="url" value="https://repo.codemc.org/repository/maven-public" />
</remote-repository>
<remote-repository>
<option name="id" value="public" />
<option name="name" value="public" />
<option name="url" value="https://repo.songoda.com/repository/public/" />
</remote-repository>
<remote-repository>
<option name="id" value="jboss.community" />
<option name="name" value="JBoss Community repository" />
<option name="url" value="https://repository.jboss.org/nexus/content/repositories/public/" />
</remote-repository>
</component>
</project>

View File

@ -1,29 +1,33 @@
<project xmlns="http://maven.apache.org/POM/4.0.0">
<?xml version="1.0" encoding="UTF-8"?>
<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>
<parent>
<groupId>com.songoda</groupId>
<artifactId>SongodaCore-Modules</artifactId>
<version>2.5.7</version>
<relativePath>../</relativePath>
<version>2.5.8</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>SongodaCore-Compatibility</artifactId>
<modelVersion>4.0.0</modelVersion>
<packaging>jar</packaging>
<dependencies>
<dependency>
<groupId>org.jetbrains</groupId>
<artifactId>annotations</artifactId>
<version>13.0</version>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.17-R0.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>us.myles.viaversion-bukkit</groupId>
<artifactId>ViaVersion</artifactId>
<version>2.1.3</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>protocolsupport</groupId>
<artifactId>ProtocolSupport</artifactId>

View File

@ -21,6 +21,7 @@ public class ClientVersion {
* this value will simply be the server version.
*
* @param player Player to check
*
* @return ServerVersion that matches this player's Minecraft version
*/
public static ServerVersion getClientVersion(Player player) {

View File

@ -131,12 +131,12 @@ public enum CompatibleBiome {
if (ServerVersion.isServerVersionAtLeast(ServerVersion.V1_15)) {
try {
Class<?> classBiomeBase = ClassMapping.BIOME_BASE.getClazz(),
classCraftChunk = ClassMapping.CRAFT_CHUNK.getClazz(),
classCraftBlock = ClassMapping.CRAFT_BLOCK.getClazz(),
classChunk = ClassMapping.CHUNK.getClazz(),
classBiomeStorage = ClassMapping.BIOME_STORAGE.getClazz(),
classIRegistry = ClassMapping.I_REGISTRY.getClazz();
Class<?> classBiomeBase = ClassMapping.BIOME_BASE.getClazz(),
classCraftChunk = ClassMapping.CRAFT_CHUNK.getClazz(),
classCraftBlock = ClassMapping.CRAFT_BLOCK.getClazz(),
classChunk = ClassMapping.CHUNK.getClazz(),
classBiomeStorage = ClassMapping.BIOME_STORAGE.getClazz(),
classIRegistry = ClassMapping.I_REGISTRY.getClazz();
methodBiomeToBiomeBase = isAbove1_16_R1 ? classCraftBlock.getMethod("biomeToBiomeBase", classIRegistry, Biome.class)
: classCraftBlock.getMethod("biomeToBiomeBase", Biome.class);
@ -189,7 +189,6 @@ public enum CompatibleBiome {
return compatibleBiomes;
}
public static CompatibleBiome getBiome(Biome biome) {
return biome == null ? null : lookupMap.get(biome.name());
}
@ -252,6 +251,5 @@ public enum CompatibleBiome {
this.version = version;
this.biome = biome;
}
}
}

View File

@ -75,6 +75,7 @@ public enum CompatibleHand {
* Get item in the selected hand
*
* @param player the player to get the item from
*
* @return the item
*/
public ItemStack getItem(Player player) {

View File

@ -193,6 +193,7 @@ public enum CompatibleMaterial {
BLACKSTONE(),
BLACKSTONE_STAIRS(),
BLACKSTONE_WALL(),
BLACKSTONE_SLAB(),
BLASTSTONE_SLAB(),
CHAIN(),
CHISELED_NETHER_BRICKS(),
@ -1406,6 +1407,7 @@ public enum CompatibleMaterial {
/**
* @param amount the amount to return
*
* @return an item that resembles this material for the current server version
*/
public ItemStack getItem(int amount) {
@ -1468,6 +1470,7 @@ public enum CompatibleMaterial {
* modern material by that name.
*
* @param name item to lookup
*
* @return LegacyMaterial or null if none found
*/
public static CompatibleMaterial getMaterial(String name) {
@ -1481,6 +1484,7 @@ public enum CompatibleMaterial {
*
* @param name item to lookup
* @param def default item if this is not a valid material
*
* @return LegacyMaterial or null if none found
*/
public static CompatibleMaterial getMaterial(String name, CompatibleMaterial def) {
@ -1491,6 +1495,7 @@ public enum CompatibleMaterial {
* Lookup a Material by bukkit material.
*
* @param mat item to lookup
*
* @return LegacyMaterial or null if none found
*/
public static CompatibleMaterial getMaterial(Material mat) {
@ -1508,6 +1513,7 @@ public enum CompatibleMaterial {
* Lookup a Material by Itemstack.
*
* @param item item to lookup
*
* @return LegacyMaterial or null if none found
*/
public static CompatibleMaterial getMaterial(ItemStack item) {
@ -1523,6 +1529,7 @@ public enum CompatibleMaterial {
* Lookup a Material by Block, corrected for legacy
*
* @param block block to check
*
* @return LegacyMaterial or null if none found
*/
public static CompatibleMaterial getMaterial(Block block) {
@ -1561,6 +1568,7 @@ public enum CompatibleMaterial {
* Lookup a Material by FallingBlock, corrected for legacy
*
* @param block falling block to check
*
* @return LegacyMaterial or null if none found
*/
public static CompatibleMaterial getMaterial(FallingBlock block) {
@ -1582,6 +1590,7 @@ public enum CompatibleMaterial {
*
* @param mat material to check
* @param data data of the block
*
* @return LegacyMaterial or null if none found
*/
public static CompatibleMaterial getMaterial(Material mat, byte data) {
@ -1627,6 +1636,7 @@ public enum CompatibleMaterial {
* modern material by that name.
*
* @param name item to lookup
*
* @return LegacyMaterial or null if none found
*/
public static CompatibleMaterial getBlockMaterial(String name) {
@ -1648,6 +1658,7 @@ public enum CompatibleMaterial {
*
* @param name item to lookup
* @param def default item if this is not a valid material
*
* @return LegacyMaterial or null if none found
*/
public static CompatibleMaterial getBlockMaterial(String name, CompatibleMaterial def) {
@ -1666,6 +1677,7 @@ public enum CompatibleMaterial {
* Lookup a Block Material by bukkit material.
*
* @param mat item to lookup
*
* @return LegacyMaterial or null if none found
*/
public static CompatibleMaterial getBlockMaterial(Material mat) {
@ -1701,6 +1713,7 @@ public enum CompatibleMaterial {
* modern material by that name.
*
* @param name item to lookup
*
* @return ItemStack for this material, or null if none found
*/
public static ItemStack getItem(String name) {
@ -1716,6 +1729,7 @@ public enum CompatibleMaterial {
}
private static Method methodSetData;
static {
if (ServerVersion.isServerVersionAtOrBelow(ServerVersion.V1_12)) {
try {
@ -1733,7 +1747,7 @@ public enum CompatibleMaterial {
*/
public void applyToBlock(Block block) {
if (block == null) return;
block.setType(material);
block.setType(material);
if (data != null && data != -1 && ServerVersion.isServerVersionAtOrBelow(ServerVersion.V1_12)) {
try {
methodSetData.invoke(block, data);
@ -1747,6 +1761,7 @@ public enum CompatibleMaterial {
* Check to see if an item matches this specific material type
*
* @param item Item to check
*
* @return true if material of the ItemStack matches this item, corrected for legacy data
*/
public boolean matches(ItemStack item) {

View File

@ -1267,7 +1267,6 @@ public enum CompatibleSound {
return;
}
}
} catch (Exception e) {
System.out.println("ERROR loading " + name());
for (Version v : versions) {
@ -1412,6 +1411,5 @@ public enum CompatibleSound {
this.sound = sound;
this.compatibilityMode = compatibility;
}
}
}

View File

@ -14,12 +14,12 @@ import java.util.Map;
*/
public enum LegacyMaterialBlockType {
OAK_LEAVES("LEAVES", (byte)8, true),
SPRUCE_LEAVES("LEAVES", (byte)9, true),
BIRCH_LEAVES("LEAVES", (byte)10, true),
JUNGLE_LEAVES("LEAVES", (byte)11, true),
ACACIA_LEAVES("LEAVES_2", (byte)8, true),
DARK_OAK_LEAVES("LEAVES_2", (byte)9, true),
OAK_LEAVES("LEAVES", (byte) 8, true),
SPRUCE_LEAVES("LEAVES", (byte) 9, true),
BIRCH_LEAVES("LEAVES", (byte) 10, true),
JUNGLE_LEAVES("LEAVES", (byte) 11, true),
ACACIA_LEAVES("LEAVES_2", (byte) 8, true),
DARK_OAK_LEAVES("LEAVES_2", (byte) 9, true),
ACACIA_DOOR("ACACIA_DOOR", true),
BED("BED_BLOCK", true),
@ -70,11 +70,11 @@ public enum LegacyMaterialBlockType {
}
private LegacyMaterialBlockType(String blockMaterial) {
this(blockMaterial, (byte)-1, null,false);
this(blockMaterial, (byte) -1, null, false);
}
private LegacyMaterialBlockType(String blockMaterial, boolean requiresData) {
this(blockMaterial, (byte)-1, null, requiresData);
this(blockMaterial, (byte) -1, null, requiresData);
}
private LegacyMaterialBlockType(String blockMaterial, byte data, boolean requiresData) {
@ -82,7 +82,7 @@ public enum LegacyMaterialBlockType {
}
private LegacyMaterialBlockType(String blockMaterial, String alternateMaterial) {
this(blockMaterial, (byte)-1, alternateMaterial, false);
this(blockMaterial, (byte) -1, alternateMaterial, false);
}
private LegacyMaterialBlockType(String blockMaterial, byte data, String alternateMaterial, boolean requiresData) {
@ -123,7 +123,6 @@ public enum LegacyMaterialBlockType {
}
public static LegacyMaterialBlockType getFromLegacy(String lookup) {
return getFromLegacy(lookup, (byte)-1);
return getFromLegacy(lookup, (byte) -1);
}
}

View File

@ -50,5 +50,4 @@ public enum ServerProject {
public static boolean isServer(ServerProject... versions) {
return ArrayUtils.contains(versions, serverProject);
}
}

View File

@ -1,27 +1,28 @@
<project xmlns="http://maven.apache.org/POM/4.0.0">
<?xml version="1.0" encoding="UTF-8"?>
<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>
<parent>
<groupId>com.songoda</groupId>
<artifactId>SongodaCore-Modules</artifactId>
<version>2.5.7</version>
<relativePath>../</relativePath>
<version>2.5.8</version>
<relativePath>../pom.xml</relativePath>
</parent>
<groupId>com.songoda</groupId>
<artifactId>SongodaCore</artifactId>
<modelVersion>4.0.0</modelVersion>
<packaging>jar</packaging>
<build>
<sourceDirectory>src/main/java</sourceDirectory>
<defaultGoal>clean install</defaultGoal>
<finalName>SongodaCore-${project.version}</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
<version>3.8.1</version>
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
@ -29,42 +30,52 @@
<release>${java.release}</release>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>3.2.1</version>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.1.0</version>
<executions>
<execution>
<id>shaded</id>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<shadedArtifactAttached>false</shadedArtifactAttached>
<createDependencyReducedPom>true</createDependencyReducedPom>
<createDependencyReducedPom>false</createDependencyReducedPom>
<artifactSet>
<includes>
<include>com.songoda:*</include>
<include>com.zaxxer:HikariCP</include>
</includes>
</artifactSet>
<filters>
<filter>
<artifact>*:*</artifact>
<includes>
<include>com/</include>
<include>META-INF/MANIFEST.MF</include>
@ -76,30 +87,9 @@
</execution>
</executions>
</plugin>
<!--
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>3.1.1</version>
<configuration>
<appendAssemblyId>false</appendAssemblyId>
<descriptors>
<descriptor>../assembly.xml</descriptor>
</descriptors>
<finalName>SongodaCore-${project.version}</finalName>
</configuration>
<executions>
<execution>
<id>make-assembly</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>-->
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.spigotmc</groupId>
@ -107,135 +97,121 @@
<version>1.17</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>SongodaCore-Compatibility</artifactId>
<version>${project.version}</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<!-- Need to include all NMS modules here -->
<!-- Note when adding a new module: include the class in NmsManager -->
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>SongodaCore-NMS-API</artifactId>
<version>${project.version}</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>SongodaCore-NMS-v1_8_R1</artifactId>
<version>${project.version}</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>SongodaCore-NMS-v1_8_R2</artifactId>
<version>${project.version}</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>SongodaCore-NMS-v1_8_R3</artifactId>
<version>${project.version}</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>SongodaCore-NMS-v1_9_R1</artifactId>
<version>${project.version}</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>SongodaCore-NMS-v1_9_R2</artifactId>
<version>${project.version}</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>SongodaCore-NMS-v1_10_R1</artifactId>
<version>${project.version}</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>SongodaCore-NMS-v1_11_R1</artifactId>
<version>${project.version}</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>SongodaCore-NMS-v1_12_R1</artifactId>
<version>${project.version}</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>SongodaCore-NMS-v1_13_R1</artifactId>
<version>${project.version}</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>SongodaCore-NMS-v1_13_R2</artifactId>
<version>${project.version}</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>SongodaCore-NMS-v1_14_R1</artifactId>
<version>${project.version}</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>SongodaCore-NMS-v1_15_R1</artifactId>
<version>${project.version}</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>SongodaCore-NMS-v1_16_R1</artifactId>
<version>${project.version}</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>SongodaCore-NMS-v1_16_R2</artifactId>
<version>${project.version}</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>SongodaCore-NMS-v1_16_R3</artifactId>
<version>${project.version}</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>SongodaCore-NMS-v1_17_R1</artifactId>
<version>${project.version}</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<!-- End NMS -->
<!-- Start Plugin Hooks -->
<dependency>
<groupId>com.gmail.filoghost.holographicdisplays</groupId>
@ -243,152 +219,171 @@
<version>2.3.2</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.sainttx</groupId>
<artifactId>Holograms</artifactId>
<version>2.13</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.github.Zrips</groupId>
<artifactId>CMI-API</artifactId>
<version>7.6.2.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>net.tnemc</groupId>
<artifactId>Reserve</artifactId>
<version>0.1.3.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.black_ixx</groupId>
<artifactId>PlayerPoints</artifactId>
<version>2.1.4</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>net.milkbowl</groupId>
<artifactId>VaultAPI</artifactId>
<version>1.7.2</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.sk89q</groupId>
<artifactId>worldguard-bukkit</artifactId>
<version>7.0.4</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.sk89q</groupId>
<artifactId>worldedit-bukkit</artifactId>
<version>7.1.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.songoda</groupId>
<artifactId>UltimateStacker</artifactId>
<version>2.1.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.bgsoftware</groupId>
<artifactId>wildstacker</artifactId>
<version>3.5.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>uk.antiperson</groupId>
<artifactId>stackmob</artifactId>
<version>4-0-2</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.github.Zrips</groupId>
<artifactId>Jobs</artifactId>
<version>LATEST</version>
<version>v4.17.2</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.gmail.nossr50.mcMMO</groupId>
<artifactId>mcMMO</artifactId>
<version>2.1.50</version>
<version>2.1.200</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>net</groupId>
<artifactId>coreprotect</artifactId>
<version>2.17.5</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>me.ryanhamshire</groupId>
<artifactId>GriefPrevention</artifactId>
<version>16.16.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>me.angeschossen</groupId>
<artifactId>LandsAPI</artifactId>
<version>4.12.20</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>br.net.fabiozumbi12</groupId>
<artifactId>RedProtect</artifactId>
<version>7.7.2</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.songoda</groupId>
<artifactId>UltimateClaims</artifactId>
<version>1.3.2</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.palmergames</groupId>
<artifactId>Towny</artifactId>
<version>0.96.5.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>world.bentobox</groupId>
<artifactId>bentobox</artifactId>
<version>1.15.5</version>
<scope>provided</scope>
</dependency>
<!-- End Plugin Hooks -->
<dependency>
<groupId>com.googlecode.json-simple</groupId>
<artifactId>json-simple</artifactId>
<version>1.1</version>
</dependency>
<dependency>
<groupId>org.jetbrains</groupId>
<artifactId>annotations</artifactId>
<version>13.0</version>
</dependency>
<dependency>
<groupId>org.yaml</groupId>
<artifactId>snakeyaml</artifactId>
<version>1.26</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.25</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-nop</artifactId>
<version>1.7.25</version>
</dependency>
<dependency>
<groupId>com.zaxxer</groupId>
<artifactId>HikariCP</artifactId>
<version>3.2.0</version>
</dependency>
<dependency>
<groupId>org.xerial</groupId>
<artifactId>sqlite-jdbc</artifactId>

View File

@ -9,8 +9,6 @@ import com.songoda.core.core.PluginInfoModule;
import com.songoda.core.core.SongodaCoreCommand;
import com.songoda.core.core.SongodaCoreDiagCommand;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.command.ConsoleCommandSender;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.HandlerList;
@ -22,7 +20,6 @@ import org.bukkit.event.server.PluginEnableEvent;
import org.bukkit.plugin.ServicePriority;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.scheduler.BukkitTask;
import org.json.simple.JSONArray;
import org.json.simple.JSONObject;
import org.json.simple.parser.JSONParser;
import org.json.simple.parser.ParseException;
@ -56,7 +53,7 @@ public class SongodaCore {
/**
* This has been added as of Rev 6
*/
private final static String coreVersion = "2.5.7";
private final static String coreVersion = "2.5.8";
/**
* This is specific to the website api
@ -73,7 +70,7 @@ public class SongodaCore {
public static boolean hasShading() {
// sneaky hack to check the package name since maven tries to re-shade all references to the package string
return !SongodaCore.class.getPackage().getName().equals(new String(new char[]{'c', 'o', 'm', '.', 's', 'o', 'n', 'g', 'o', 'd', 'a', '.', 'c', 'o', 'r', 'e'}));
return !SongodaCore.class.getPackage().getName().equals(new String(new char[] {'c', 'o', 'm', '.', 's', 'o', 'n', 'g', 'o', 'd', 'a', '.', 'c', 'o', 'r', 'e'}));
}
public static void registerPlugin(JavaPlugin plugin, int pluginID, CompatibleMaterial icon) {
@ -315,7 +312,7 @@ public class SongodaCore {
if (!via && (via = event.getPlugin().getName().equals("ViaVersion"))) {
Bukkit.getOnlinePlayers().forEach(p -> ClientVersion.onLoginVia(p, getHijackedPlugin()));
} else if (!proto && (proto = event.getPlugin().getName().equals("ProtocolSupport"))) {
Bukkit.getOnlinePlayers().forEach(p -> ClientVersion.onLoginProtocol(p, getHijackedPlugin()));
Bukkit.getOnlinePlayers().forEach(p -> ClientVersion.onLoginProtocol(p, getHijackedPlugin()));
}
}
}

View File

@ -159,6 +159,7 @@ public abstract class SongodaPlugin extends JavaPlugin {
* @param localeName locale to use, eg "en_US"
* @param reload optionally reload the loaded locale if the locale didn't
* change
*
* @return true if the locale exists and was loaded successfully
*/
public boolean setLocale(String localeName, boolean reload) {

View File

@ -3,10 +3,9 @@ package com.songoda.core.chat;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.JsonObject;
import com.songoda.core.compatibility.ServerVersion;
import com.songoda.core.compatibility.ClassMapping;
import com.songoda.core.compatibility.ServerVersion;
import com.songoda.core.utils.TextUtils;
import net.minecraft.network.chat.IChatBaseComponent;
import org.bukkit.Bukkit;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;

View File

@ -50,7 +50,6 @@ public enum ColorCode {
ColorCode color = var0[i];
BY_CHAR.put(color.code, color);
}
}
public static ColorCode getByChar(char code) {

View File

@ -3,7 +3,7 @@ package com.songoda.core.chat;
import com.songoda.core.compatibility.ServerVersion;
import com.songoda.core.utils.ColorUtils;
import java.awt.*;
import java.awt.Color;
public class ColorContainer {

View File

@ -10,11 +10,9 @@ import org.bukkit.command.CommandSender;
import org.bukkit.command.PluginCommand;
import org.bukkit.command.SimpleCommandMap;
import org.bukkit.command.TabCompleter;
import org.bukkit.command.defaults.BukkitCommand;
import org.bukkit.entity.Player;
import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.java.JavaPlugin;
import org.jetbrains.annotations.NotNull;
import java.lang.reflect.Constructor;
import java.lang.reflect.Field;

View File

@ -60,7 +60,7 @@ public class MainCommand extends AbstractCommand {
sender.sendMessage(header);
} else {
new ChatMessage().fromText(String.format("#ff8080&l%s &8» &7Version %s Created with <3 by #ec4e74&l&oS#fa5b65&l&oo#ff6c55&l&on#ff7f44&l&og#ff9432&l&oo#ffaa1e&l&od#f4c009&l&oa",
plugin.getDescription().getName(), plugin.getDescription().getVersion()), sender instanceof ConsoleCommandSender)
plugin.getDescription().getName(), plugin.getDescription().getVersion()), sender instanceof ConsoleCommandSender)
.sendTo(sender);
}
sender.sendMessage(ChatColor.DARK_GRAY + "- " + ChatColor.YELLOW + "/songoda" + ChatColor.GRAY + " - Opens the Songoda plugin GUI");
@ -116,5 +116,4 @@ public class MainCommand extends AbstractCommand {
public String getDescription() {
return description;
}
}

View File

@ -30,6 +30,7 @@ public class SelectorArguments {
*
* @param sender CommandBlock or Player running the command
* @param argument argument with the selector to parse
*
* @return SelectorArguments Object for grabbing the list of entities, or null if the selector is invalid
*/
@Nullable

View File

@ -21,5 +21,4 @@ public class SimpleNestedCommand {
Stream.of(commands).forEach(command -> command.getCommands().forEach(cmd -> children.put(cmd.toLowerCase(), command)));
return this;
}
}

View File

@ -14,7 +14,19 @@ import org.yaml.snakeyaml.Yaml;
import org.yaml.snakeyaml.error.YAMLException;
import org.yaml.snakeyaml.representer.Representer;
import java.io.*;
import java.io.BufferedInputStream;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.Reader;
import java.io.StringReader;
import java.io.StringWriter;
import java.io.Writer;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
@ -155,6 +167,7 @@ public class Config extends ConfigSection {
* Set the Charset that will be used to save this config
*
* @param defaultCharset Charset to use
*
* @return this class
*/
public Config setDefaultCharset(Charset defaultCharset) {
@ -194,6 +207,7 @@ public class Config extends ConfigSection {
* All saves are done asynchronously, so this should not impact server performance.
*
* @param autosave set to true if autosaving is enabled.
*
* @return this class
*/
@NotNull
@ -211,6 +225,7 @@ public class Config extends ConfigSection {
* If the configuration is changed within this period, the timer is not reset.
*
* @param autosaveInterval time in seconds
*
* @return this class
*/
@NotNull
@ -230,6 +245,7 @@ public class Config extends ConfigSection {
* as a default setting.
*
* @param autoremove Remove settings that don't exist as defaults
*
* @return this class
*/
@NotNull
@ -513,7 +529,6 @@ public class Config extends ConfigSection {
}
} catch (IOException ex) {
}
}
public void deleteNonDefaultSettings() {

View File

@ -66,7 +66,6 @@ public class ConfigFormattingRules {
this.spaceCharTop = this.spaceCharBottom = ' ';
this.spaceSuffixTop = this.spaceSuffixBottom = "";
}
}
public static CommentStyle parseStyle(List<String> lines) {

View File

@ -129,5 +129,4 @@ public class ConfigSetting {
return mat != null ? mat : def;
}
}

View File

@ -21,6 +21,7 @@ import java.util.logging.Level;
* Used to easily store a set of one data value
*
* @param <T> DataObject class that is used to store the data
*
* @author jascotty2
* @since 2019-09-06
*/
@ -67,7 +68,7 @@ public class SimpleDataStore<T extends DataStoreObject> {
/**
* @return a directly-modifiable instance of the data mapping for this
* storage
* storage
*/
public Map<Object, T> getData() {
return data;
@ -78,8 +79,9 @@ public class SimpleDataStore<T extends DataStoreObject> {
* if this map contains no mapping for the key.
*
* @param key key whose mapping is to be retrieved from this storage
*
* @return the value associated with <tt>key</tt>, or
* <tt>null</tt> if there was no mapping for <tt>key</tt>.
* <tt>null</tt> if there was no mapping for <tt>key</tt>.
*/
@Nullable
public T get(Object key) {
@ -90,8 +92,9 @@ public class SimpleDataStore<T extends DataStoreObject> {
* Removes the mapping for the specified key from this storage if present.
*
* @param key key whose mapping is to be removed from this storage
*
* @return the previous value associated with <tt>key</tt>, or
* <tt>null</tt> if there was no mapping for <tt>key</tt>.
* <tt>null</tt> if there was no mapping for <tt>key</tt>.
*/
@Nullable
public T remove(@NotNull Object key) {
@ -107,8 +110,9 @@ public class SimpleDataStore<T extends DataStoreObject> {
* Removes the mapping for the specified key from this storage if present.
*
* @param value value whose mapping is to be removed from this storage
*
* @return the previous value associated with <tt>key</tt>, or
* <tt>null</tt> if there was no mapping for <tt>key</tt>.
* <tt>null</tt> if there was no mapping for <tt>key</tt>.
*/
@Nullable
public T remove(@NotNull T value) {
@ -128,8 +132,9 @@ public class SimpleDataStore<T extends DataStoreObject> {
* a mapping for the key, the old value is replaced.
*
* @param value value to be added
*
* @return the previous value associated with <tt>value.getKey()</tt>, or
* <tt>null</tt> if there was no mapping for <tt>value.getKey()</tt>.
* <tt>null</tt> if there was no mapping for <tt>value.getKey()</tt>.
*/
@Nullable
public T add(@NotNull T value) {

View File

@ -109,10 +109,10 @@ public class ConfigEditorGui extends SimplePagedGui {
(event) -> {
event.gui.exit();
ChatPrompt.showPrompt(plugin, event.player, "Enter a new number value for " + settingKey + ":", response -> {
if (!setNumber(event.slot, settingKey, response.getMessage().trim())) {
event.player.sendMessage(ChatColor.RED + "Error: \"" + response.getMessage().trim() + "\" is not a number!");
}
}).setOnClose(() -> event.manager.showGUI(event.player, this))
if (!setNumber(event.slot, settingKey, response.getMessage().trim())) {
event.player.sendMessage(ChatColor.RED + "Error: \"" + response.getMessage().trim() + "\" is not a number!");
}
}).setOnClose(() -> event.manager.showGUI(event.player, this))
.setOnCancel(() -> {
event.player.sendMessage(ChatColor.RED + "Edit canceled");
event.manager.showGUI(event.player, this);
@ -136,16 +136,15 @@ public class ConfigEditorGui extends SimplePagedGui {
}
event.manager.showGUI(event.player, paged);
});
} else if (val instanceof String) {
// changing a "string" value (or change to a feather for writing quill)
setButton(index, configItem(CompatibleMaterial.STRING, ChatColor.YELLOW + settingKey, node, settingKey, val.toString(), "Click to edit this setting"),
(event) -> {
event.gui.exit();
ChatPrompt.showPrompt(plugin, event.player, "Enter a new value for " + settingKey + ":", response -> {
node.set(settingKey, response.getMessage().trim());
updateValue(event.slot, settingKey);
}).setOnClose(() -> event.manager.showGUI(event.player, this))
node.set(settingKey, response.getMessage().trim());
updateValue(event.slot, settingKey);
}).setOnClose(() -> event.manager.showGUI(event.player, this))
.setOnCancel(() -> {
event.player.sendMessage(ChatColor.RED + "Edit canceled");
event.manager.showGUI(event.player, this);
@ -166,7 +165,6 @@ public class ConfigEditorGui extends SimplePagedGui {
++index;
}
}
public ConfigurationSection getCurrentNode() {

View File

@ -43,11 +43,11 @@ public class ConfigEditorListEditorGui extends SimplePagedGui {
(event) -> {
event.gui.exit();
ChatPrompt.showPrompt(event.manager.getPlugin(), event.player, "Enter a new value to add:", response -> {
values.add(response.getMessage().trim());
redraw();
}).setOnClose(() -> {
event.manager.showGUI(event.player, this);
})
values.add(response.getMessage().trim());
redraw();
}).setOnClose(() -> {
event.manager.showGUI(event.player, this);
})
.setOnCancel(() -> {
event.player.sendMessage(ChatColor.RED + "Edit canceled");
event.manager.showGUI(event.player, this);
@ -81,5 +81,4 @@ public class ConfigEditorListEditorGui extends SimplePagedGui {
// update display
update();
}
}

View File

@ -95,5 +95,4 @@ public class PluginConfigGui extends SimplePagedGui {
(event) -> event.manager.showGUI(event.player, new ConfigEditorGui(event.player, plugin, this, config.getKey(), config.getValue())));
}
}
}

View File

@ -3,5 +3,4 @@ package com.songoda.core.core;
public interface PluginInfoModule {
void run(PluginInfo plugin);
}

View File

@ -48,5 +48,4 @@ public class SongodaCoreCommand extends AbstractCommand {
protected List<String> onTab(CommandSender sender, String... args) {
return null;
}
}

View File

@ -2,9 +2,9 @@ package com.songoda.core.core;
import com.songoda.core.SongodaCore;
import com.songoda.core.commands.AbstractCommand;
import com.songoda.core.compatibility.ClassMapping;
import com.songoda.core.compatibility.ServerProject;
import com.songoda.core.compatibility.ServerVersion;
import com.songoda.core.compatibility.ClassMapping;
import org.bukkit.Bukkit;
import org.bukkit.command.CommandSender;

View File

@ -25,26 +25,26 @@ final class SongodaCoreOverviewGUI extends Gui {
final PluginInfo plugin = plugins.get(i);
if (plugin.hasUpdate()) {
setButton(i, GuiUtils.createButtonItem(plugin.icon != null ? plugin.icon : CompatibleMaterial.STONE,
ChatColor.GOLD + plugin.getJavaPlugin().getName(),
ChatColor.GRAY + "Latest Version: " + plugin.getLatestVersion(),
ChatColor.GRAY + "Installed Version: " + plugin.getJavaPlugin().getDescription().getVersion(),
"",
"Change log:",
plugin.getChangeLog(),
"",
ChatColor.GOLD + "Click for the marketplace page link.",
ChatColor.GOLD + "Right Click to edit plugin settings."
ChatColor.GOLD + plugin.getJavaPlugin().getName(),
ChatColor.GRAY + "Latest Version: " + plugin.getLatestVersion(),
ChatColor.GRAY + "Installed Version: " + plugin.getJavaPlugin().getDescription().getVersion(),
"",
"Change log:",
plugin.getChangeLog(),
"",
ChatColor.GOLD + "Click for the marketplace page link.",
ChatColor.GOLD + "Right Click to edit plugin settings."
),
ClickType.LEFT, (event) -> event.player.sendMessage(plugin.getMarketplaceLink()));
setAction(i, ClickType.RIGHT, (event) -> event.manager.showGUI(event.player, new PluginConfigGui(plugin.getJavaPlugin(), event.gui)));
highlightItem(i);
} else {
setButton(i, GuiUtils.createButtonItem(plugin.icon != null ? plugin.icon : CompatibleMaterial.STONE,
ChatColor.GOLD + plugin.getJavaPlugin().getName(),
ChatColor.GRAY + "Installed Version: " + plugin.getJavaPlugin().getDescription().getVersion(),
"",
ChatColor.GOLD + "Click for the marketplace page link.",
ChatColor.GOLD + "Right Click to edit plugin settings."
ChatColor.GOLD + plugin.getJavaPlugin().getName(),
ChatColor.GRAY + "Installed Version: " + plugin.getJavaPlugin().getDescription().getVersion(),
"",
ChatColor.GOLD + "Click for the marketplace page link.",
ChatColor.GOLD + "Right Click to edit plugin settings."
),
ClickType.LEFT, (event) -> event.player.sendMessage(plugin.getMarketplaceLink()));
setAction(i, ClickType.RIGHT, (event) -> event.manager.showGUI(event.player, new PluginConfigGui(plugin.getJavaPlugin(), event.gui)));

View File

@ -19,5 +19,4 @@ public abstract class DataMigration {
public int getRevision() {
return this.revision;
}
}

View File

@ -100,5 +100,4 @@ public class DataMigrationManager {
private String getMigrationsTableName() {
return this.dataManagerAbstract.getTablePrefix() + "migrations";
}
}

View File

@ -30,5 +30,4 @@ public interface DatabaseConnector {
interface ConnectionCallback {
void accept(Connection connection) throws SQLException;
}
}

View File

@ -51,5 +51,4 @@ public class MySQLConnector implements DatabaseConnector {
ex.printStackTrace();
}
}
}

View File

@ -57,5 +57,4 @@ public class SQLiteConnector implements DatabaseConnector {
ex.printStackTrace();
}
}
}

View File

@ -10,5 +10,4 @@ public enum BackgroundType {
private BackgroundType() {
this.key = "minecraft:textures/gui/advancements/backgrounds/" + name().toLowerCase() + ".png";
}
}

View File

@ -48,8 +48,8 @@ public class CustomizableGui extends Gui {
if (!config.isConfigurationSection("overrides")) {
config.setDefault("overrides.example.item", CompatibleMaterial.STONE.name(),
"This is the icon material you would like to replace",
"the current material with.")
"This is the icon material you would like to replace",
"the current material with.")
.setDefault("overrides.example.position", 5,
"This is the current position of the icon you would like to move.",
"The number represents the cell the icon currently resides in.")
@ -57,12 +57,11 @@ public class CustomizableGui extends Gui {
"This is just an example and does not override to any items",
"in this GUI.")
.setDefaultComment("overrides",
"For information on how to apply overrides please visit",
"https://wiki.songoda.com/Gui");
"For information on how to apply overrides please visit",
"https://wiki.songoda.com/Gui");
config.saveChanges();
}
if (!config.isConfigurationSection("disabled")) {
config.setDefault("disabled", Arrays.asList("example3", "example4", "example5"),
"All keys on this list will be disabled. You can add any items key here",
@ -108,7 +107,7 @@ public class CustomizableGui extends Gui {
}
setPrivateDefaultAction(event -> {
if (event.clickType == ClickType.SHIFT_RIGHT)
activationCount ++;
activationCount++;
if (activationCount >= 8 && event.player.hasPermission("songoda.admin")) {
showGuiKeys = !showGuiKeys;
activationCount = 0;
@ -156,7 +155,7 @@ public class CustomizableGui extends Gui {
setItem(customButton.key, customButton.row, customButton.col, customButton.createItem());
else
for (Integer position : customButton.positions)
setItem(customButton.key, position, customButton.createItem());
setItem(customButton.key, position, customButton.createItem());
}
@NotNull
@ -300,7 +299,6 @@ public class CustomizableGui extends Gui {
return this;
}
@NotNull
public Gui updateItem(@NotNull String key, int row, int col, @Nullable String name, @NotNull String... lore) {
if (customContent.isButtonDisabled(key)) return this;
@ -506,7 +504,6 @@ public class CustomizableGui extends Gui {
setConditional(c, type, action);
}
public Gui setNextPage(ItemStack item) {
applyShowGuiKeys("__NEXT__", item);
if (customContent.isButtonCustomized("__NEXT__"))
@ -617,7 +614,6 @@ public class CustomizableGui extends Gui {
this.lore = lore;
}
public String getKey() {
return key;
}

View File

@ -769,7 +769,6 @@ public class Gui {
inventory.setItem(i, item != null ? item : (unlockedCells.getOrDefault(i, false) ? AIR : blankItem));
}
return inventory;
}

View File

@ -17,5 +17,4 @@ public enum GuiType {
this.rows = rows;
this.columns = columns;
}
}

View File

@ -47,6 +47,7 @@ public class GuiUtils {
* Get a lore value that will display fine on clients using auto gui scaling
*
* @param lines lines to format
*
* @return newline and length-corrected item lore
*/
public static List<String> getSafeLore(List<String> lines) {

View File

@ -182,6 +182,5 @@ class PopupMessage {
public String getKey() {
return key;
}
}
}

View File

@ -25,5 +25,4 @@ public class GuiClickEvent extends GuiEvent {
this.clickType = event.getClick();
this.event = event;
}
}

View File

@ -9,5 +9,4 @@ public class GuiCloseEvent extends GuiEvent {
public GuiCloseEvent(GuiManager manager, Gui gui, Player player) {
super(manager, gui, player);
}
}

View File

@ -18,5 +18,4 @@ public class GuiDropItemEvent extends GuiEvent {
this.clickType = event.getClick();
this.event = event;
}
}

View File

@ -15,5 +15,4 @@ public abstract class GuiEvent {
this.gui = gui;
this.player = player;
}
}

View File

@ -9,5 +9,4 @@ public class GuiOpenEvent extends GuiEvent {
public GuiOpenEvent(GuiManager manager, Gui gui, Player player) {
super(manager, gui, player);
}
}

View File

@ -16,5 +16,4 @@ public class GuiPageEvent {
this.lastPage = lastPage;
this.page = page;
}
}

View File

@ -4,8 +4,6 @@ import com.songoda.core.hooks.economies.Economy;
import com.songoda.core.utils.NumberUtils;
import org.bukkit.OfflinePlayer;
import java.text.DecimalFormat;
/**
* A convenience class for static access to an Economy HookManager
*/
@ -61,6 +59,7 @@ public class EconomyManager {
* Format the given amount to a human-readable string in this currency
*
* @param amt amount to display
*
* @return a currency string as formatted by the economy plugin
*/
public static String formatEconomy(double amt) {
@ -71,13 +70,13 @@ public class EconomyManager {
* Get the players available balance
*
* @param player player
*
* @return the amount of available balance
*/
public static double getBalance(OfflinePlayer player) {
if (!manager.isEnabled())
return 0;
return manager.getCurrentHook().getBalance(player);
}
/**
@ -86,6 +85,7 @@ public class EconomyManager {
*
* @param player player to check
* @param cost minimum amount this player should have
*
* @return true if this player can have this amount withdrawn
*/
public static boolean hasBalance(OfflinePlayer player, double cost) {
@ -98,6 +98,7 @@ public class EconomyManager {
*
* @param player player to check
* @param cost amount to remove from this player
*
* @return true if the total amount was withdrawn successfully
*/
public static boolean withdrawBalance(OfflinePlayer player, double cost) {
@ -110,6 +111,7 @@ public class EconomyManager {
*
* @param player player to check
* @param amount amount to add to this player
*
* @return true if the total amount was added successfully
*/
public static boolean deposit(OfflinePlayer player, double amount) {

View File

@ -59,6 +59,7 @@ public class HookManager<T extends Hook> {
* the previously defined default will be used.
*
* @param name name of the plugin to use
*
* @return true if the default was set to this plugin
*/
public boolean setPreferredHook(String name) {
@ -76,6 +77,7 @@ public class HookManager<T extends Hook> {
* the previously defined default will be used.
*
* @param plugin plugin to use
*
* @return true if the default was set to this plugin
*/
public boolean setPreferredHook(PluginHook plugin) {
@ -91,6 +93,7 @@ public class HookManager<T extends Hook> {
* Try to grab the handler for this specific plugin hook.
*
* @param name plugin to use
*
* @return returns null if plugin is not enabled
*/
public T getHook(String name) {
@ -106,6 +109,7 @@ public class HookManager<T extends Hook> {
* Try to grab the handler for this specific plugin hook.
*
* @param hook plugin to use
*
* @return returns null if plugin is not enabled
*/
public T getHook(PluginHook hook) {
@ -147,6 +151,7 @@ public class HookManager<T extends Hook> {
* Check to see if a specific plugin hook is enabled.
*
* @param name plugin to check
*
* @return true if this plugin is supported and loaded
*/
public boolean isEnabled(String name) {
@ -157,6 +162,7 @@ public class HookManager<T extends Hook> {
* Check to see if a specific plugin hook is enabled.
*
* @param hook plugin to check
*
* @return true if this plugin is supported and loaded
*/
public boolean isEnabled(PluginHook hook) {
@ -180,5 +186,4 @@ public class HookManager<T extends Hook> {
public String getName() {
return defaultHook != null ? defaultHook.getName() : null;
}
}

View File

@ -88,5 +88,4 @@ public class LogManager {
if (manager.isEnabled())
manager.getCurrentHook().logInteraction(player, location);
}
}

View File

@ -227,5 +227,4 @@ public class McMMOHook {
public static boolean isBleeding(LivingEntity victim) {
return canHook ? McMMOHandler.isBleeding(victim) : false;
}
}

View File

@ -10,7 +10,12 @@ import com.songoda.core.hooks.holograms.HologramsHolograms;
import com.songoda.core.hooks.holograms.HolographicDisplaysHolograms;
import com.songoda.core.hooks.log.CoreProtectLog;
import com.songoda.core.hooks.log.Log;
import com.songoda.core.hooks.protection.*;
import com.songoda.core.hooks.protection.BentoBoxProtection;
import com.songoda.core.hooks.protection.GriefPreventionProtection;
import com.songoda.core.hooks.protection.LandsProtection;
import com.songoda.core.hooks.protection.Protection;
import com.songoda.core.hooks.protection.RedProtectProtection;
import com.songoda.core.hooks.protection.UltimateClaimsProtection;
import com.songoda.core.hooks.stackers.StackMob;
import com.songoda.core.hooks.stackers.Stacker;
import com.songoda.core.hooks.stackers.UltimateStacker;
@ -86,6 +91,7 @@ public final class PluginHook<T extends Class> {
* @param type Generic hook type for this plugin
* @param pluginName Plugin name
* @param handler Specific class that will handle this plugin, if enabled.
*
* @return instance of the PluginHook that was added
*/
public static <T extends Class> PluginHook addHook(T type, String pluginName, Class handler) {

View File

@ -42,7 +42,7 @@ public class WorldGuardHook {
* Check to see if WorldGuard is installed and hooked
*
* @return true if and only if WorldGuard exists and addHook() has been
* called and added successfully
* called and added successfully
*/
public static boolean isEnabled() {
return canHook && WorldGuardFlagHandler.isEnabled();
@ -53,6 +53,7 @@ public class WorldGuardHook {
*
* @param l location to check
* @param flag ALLOW/DENY flag to check
*
* @return flag state, or null if undefined
*/
@Nullable
@ -65,6 +66,7 @@ public class WorldGuardHook {
*
* @param c chunk to check for regions in
* @param flag ALLOW/DENY flag to check
*
* @return flag state, or null if undefined
*/
@Nullable
@ -76,6 +78,7 @@ public class WorldGuardHook {
* Check to see if the pvp flag is set and is set to ALLOW
*
* @param loc Location to check
*
* @return false if the pvp flag is not set for this region, or is set to DENY
*/
public static boolean isPvpAllowed(@NotNull Location loc) {
@ -86,6 +89,7 @@ public class WorldGuardHook {
* Check to see if the block-break flag is set and is set to ALLOW
*
* @param loc Location to check
*
* @return false if the block-break flag is not set for this region, or is set to DENY
*/
public static boolean isBreakAllowed(@NotNull Location loc) {
@ -96,6 +100,7 @@ public class WorldGuardHook {
* Check to see if the build flag is set and is set to ALLOW
*
* @param loc Location to check
*
* @return false if the build flag is not set for this region, or is set to DENY
*/
public static boolean isBuildAllowed(@NotNull Player player, @NotNull Location loc) {
@ -106,6 +111,7 @@ public class WorldGuardHook {
* Check to see if the use flag is set and is set to ALLOW
*
* @param loc Location to check
*
* @return false if the use flag is not set for this region, or is set to DENY
*/
public static boolean isInteractAllowed(@NotNull Location loc) {
@ -116,6 +122,7 @@ public class WorldGuardHook {
* Check to see if the other-explosion flag is set and is set to ALLOW
*
* @param loc Location to check
*
* @return false if the other-explosion flag is not set for this region, or is set to DENY
*/
public static boolean isExplosionsAllowed(@NotNull Location loc) {
@ -126,6 +133,7 @@ public class WorldGuardHook {
* Check to see if the mob-spawning flag is set and is set to ALLOW
*
* @param loc Location to check
*
* @return false if the mob-spawning flag is not set for this region, or is set to DENY
*/
public static boolean isMobSpawningAllowed(@NotNull Location loc) {
@ -134,6 +142,7 @@ public class WorldGuardHook {
/**
* @param loc Location to check
*
* @return A list of regions that contain this location.
*/
@NotNull
@ -143,6 +152,7 @@ public class WorldGuardHook {
/**
* @param c Chunk to check
*
* @return A list of regions that contain any part of this chunk.
*/
@NotNull

View File

@ -3,14 +3,13 @@ package com.songoda.core.hooks.economies;
import com.songoda.core.hooks.Hook;
import org.bukkit.OfflinePlayer;
import java.text.DecimalFormat;
public abstract class Economy implements Hook {
/**
* Get the players available balance
*
* @param player player
*
* @return the amount of available balance
*/
public abstract double getBalance(OfflinePlayer player);
@ -20,6 +19,7 @@ public abstract class Economy implements Hook {
*
* @param player player to check
* @param cost minimum amount this player should have
*
* @return true if this player can have this amount withdrawn
*/
public abstract boolean hasBalance(OfflinePlayer player, double cost);
@ -29,6 +29,7 @@ public abstract class Economy implements Hook {
*
* @param player player to check
* @param cost amount to remove from this player
*
* @return true if the total amount was withdrawn successfully
*/
public abstract boolean withdrawBalance(OfflinePlayer player, double cost);
@ -38,6 +39,7 @@ public abstract class Economy implements Hook {
*
* @param player player to check
* @param amount amount to add to this player
*
* @return true if the total amount was added successfully
*/
public abstract boolean deposit(OfflinePlayer player, double amount);

View File

@ -35,14 +35,12 @@ public class PlayerPointsEconomy extends Economy {
public boolean hasBalance(OfflinePlayer player, double cost) {
int amount = convertAmount(cost);
return playerPoints.getAPI().look(player.getUniqueId()) >= amount;
}
@Override
public boolean withdrawBalance(OfflinePlayer player, double cost) {
int amount = convertAmount(cost);
return playerPoints.getAPI().take(player.getUniqueId(), amount);
}
@Override

View File

@ -31,6 +31,7 @@ public abstract class Holograms implements Hook {
* Center and offset this location
*
* @param location location to offset
*
* @return copy-safe location with the applied offset.
*/
protected final Location fixLocation(Location location) {

View File

@ -2,7 +2,6 @@ package com.songoda.core.hooks.holograms;
import com.gmail.filoghost.holographicdisplays.api.Hologram;
import com.gmail.filoghost.holographicdisplays.api.HologramsAPI;
import com.gmail.filoghost.holographicdisplays.api.line.TextLine;
import org.bukkit.Location;
import org.bukkit.plugin.Plugin;

View File

@ -467,7 +467,6 @@ public class McMMOHandler {
return false;
}
return (boolean) mcmmo_SkillUtils_activationSuccessful.invoke(null, secondaryDouble, player, skillLevel, activationChance);
} catch (Exception ex1) {
Logger.getLogger(McMMOHandler.class.getName()).log(Level.SEVERE, "Failed to invoke McMMO Legacy Hook", ex1);
}
@ -511,5 +510,4 @@ public class McMMOHandler {
}
return 0;
}
}

View File

@ -18,5 +18,4 @@ public abstract class Protection implements Hook {
public abstract boolean canBreak(Player player, Location location);
public abstract boolean canInteract(Player player, Location location);
}

View File

@ -78,5 +78,4 @@ public class StackMob extends Stacker {
public int getMinStackSize(EntityType type) {
return 0;
}
}

View File

@ -32,5 +32,4 @@ public abstract class Stacker implements Hook {
public abstract void add(LivingEntity entity, int amount);
public abstract int getMinStackSize(EntityType type);
}

View File

@ -1,7 +1,6 @@
package com.songoda.core.hooks.stackers;
import com.songoda.ultimatestacker.stackable.entity.EntityStack;
import com.songoda.ultimatestacker.stackable.entity.EntityStackManager;
import com.songoda.ultimatestacker.utils.Methods;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Item;

View File

@ -75,5 +75,4 @@ public class WildStacker extends Stacker {
}
return min == -1 ? 0 : min;
}
}

View File

@ -1,7 +1,6 @@
package com.songoda.core.hooks.worldguard;
import com.sk89q.worldedit.bukkit.BukkitAdapter;
import com.sk89q.worldedit.bukkit.BukkitPlayer;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldguard.LocalPlayer;
import com.sk89q.worldguard.WorldGuard;
@ -105,7 +104,7 @@ public class WorldGuardFlagHandler {
Bukkit.getServer().getLogger().log(Level.WARNING, "Could not hook WorldGuard");
} else {
flags.put(flag, wgFlag);
Bukkit.getServer().getLogger().log(Level.WARNING, "Loaded existing {1} {0}", new Object[]{((Flag) wgFlag).getName(), wgFlag.getClass().getSimpleName()});
Bukkit.getServer().getLogger().log(Level.WARNING, "Loaded existing {1} {0}", new Object[] {((Flag) wgFlag).getName(), wgFlag.getClass().getSimpleName()});
}
}
}
@ -124,7 +123,7 @@ public class WorldGuardFlagHandler {
if (wgFlag != null) {
// we already have one
flags.put(flag, wgFlag);
Bukkit.getServer().getLogger().log(Level.WARNING, "Loaded existing {1} {0}", new Object[]{wgFlag.getName(), wgFlag.getClass().getSimpleName()});
Bukkit.getServer().getLogger().log(Level.WARNING, "Loaded existing {1} {0}", new Object[] {wgFlag.getName(), wgFlag.getClass().getSimpleName()});
return;
}
@ -223,6 +222,7 @@ public class WorldGuardFlagHandler {
*
* @param loc location to check
* @param flag ALLOW/DENY flag to check
*
* @return flag state, or null if undefined
*/
public static Boolean getBooleanFlag(Location loc, String flag, Player optionalPlayer) {
@ -253,6 +253,7 @@ public class WorldGuardFlagHandler {
*
* @param c chunk to check for regions in
* @param flag ALLOW/DENY flag to check
*
* @return flag state, or null if undefined
*/
public static Boolean getBooleanFlag(Chunk c, String flag) {
@ -346,7 +347,6 @@ public class WorldGuardFlagHandler {
return null;
}
return result == State.ALLOW;
} catch (Exception ex) {
Bukkit.getServer().getLogger().log(Level.WARNING, "Could not grab flags from WorldGuard", ex);
}
@ -405,7 +405,6 @@ public class WorldGuardFlagHandler {
return null;
}
return result == State.ALLOW;
} catch (Exception ex) {
Bukkit.getServer().getLogger().log(Level.WARNING, "Could not grab flags from WorldGuard", ex);
}

View File

@ -206,7 +206,6 @@ public class WorldGuardRegionHandler {
regions.removeAll(parentNames);
return regions;
}
private static List<String> getRegionNamesLegacy(Location loc) {

View File

@ -157,5 +157,4 @@ public class ChatPrompt implements Listener {
return message;
}
}
}

View File

@ -7,7 +7,16 @@ import org.bukkit.configuration.InvalidConfigurationException;
import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.java.JavaPlugin;
import java.io.*;
import java.io.BufferedInputStream;
import java.io.BufferedReader;
import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
@ -55,6 +64,7 @@ public class Locale {
*
* @param plugin plugin to load from
* @param name name of the default locale, eg "en_US"
*
* @return returns the loaded Locale, or null if there was an error
*/
public static Locale loadDefaultLocale(JavaPlugin plugin, String name) {
@ -67,6 +77,7 @@ public class Locale {
*
* @param plugin plugin to load from
* @param name name of the locale, eg "en_US"
*
* @return returns the loaded Locale, or null if there was an error
*/
public static Locale loadLocale(JavaPlugin plugin, String name) {
@ -85,6 +96,7 @@ public class Locale {
* Load all locales from this plugin's locale directory
*
* @param plugin plugin to load from
*
* @return returns the loaded Locales
*/
public static List<Locale> loadAllLocales(JavaPlugin plugin) {
@ -130,6 +142,7 @@ public class Locale {
* @param plugin plugin owning the locale file
* @param locale the specific locale file to save
* @param fileName where to save the file
*
* @return true if the operation was successful, false otherwise
*/
public static boolean saveDefaultLocale(JavaPlugin plugin, String locale, String fileName) {
@ -142,6 +155,7 @@ public class Locale {
* @param plugin plugin owning the locale file
* @param in file to save
* @param fileName the name of the file to save
*
* @return true if the operation was successful, false otherwise
*/
public static boolean saveLocale(Plugin plugin, InputStream in, String fileName) {
@ -369,6 +383,7 @@ public class Locale {
* Supply the Message object with the plugins prefix.
*
* @param message message to be applied
*
* @return applied message
*/
private Message supplyPrefix(Message message) {
@ -379,6 +394,7 @@ public class Locale {
* Create a new unsaved Message
*
* @param message the message to create
*
* @return the created message
*/
public Message newMessage(String message) {
@ -389,6 +405,7 @@ public class Locale {
* Get a message set for a specific node.
*
* @param node the node to get
*
* @return the message for the specified node
*/
public Message getMessage(String node) {
@ -403,6 +420,7 @@ public class Locale {
*
* @param node the node to get
* @param defaultValue the default value given that a value for the node was not found
*
* @return the message for the specified node. Default if none found
*/
public Message getMessageOrDefault(String node, String defaultValue) {

View File

@ -157,6 +157,7 @@ public class Message {
*
* @param placeholder the placeholder to replace
* @param replacement the replacement object
*
* @return the modified Message
*/
public Message processPlaceholder(String placeholder, Object replacement) {

View File

@ -4,8 +4,8 @@ import com.songoda.core.compatibility.CompatibleMaterial;
import com.songoda.core.gui.AnvilGui;
import com.songoda.core.gui.Gui;
import com.songoda.core.gui.GuiUtils;
import com.songoda.core.utils.TextUtils;
import com.songoda.core.lootables.loot.Loot;
import com.songoda.core.utils.TextUtils;
import java.util.ArrayList;
import java.util.Collections;
@ -16,7 +16,7 @@ public abstract class AbstractGuiListEditor extends Gui {
protected final Loot loot;
private final Gui returnGui;
public AbstractGuiListEditor(Loot loot ,Gui returnGui) {
public AbstractGuiListEditor(Loot loot, Gui returnGui) {
super(1, returnGui);
this.returnGui = returnGui;
this.loot = loot;
@ -27,19 +27,19 @@ public abstract class AbstractGuiListEditor extends Gui {
public void paint() {
List<String> lore = getData() == null ? new ArrayList<>() : getData();
setButton(2, GuiUtils.createButtonItem(CompatibleMaterial.OAK_FENCE_GATE,
TextUtils.formatText("&cBack")),
TextUtils.formatText("&cBack")),
(event) -> {
guiManager.showGUI(event.player, returnGui);
((GuiLootEditor) returnGui).paint();
});
setButton(6, GuiUtils.createButtonItem(CompatibleMaterial.OAK_FENCE_GATE,
TextUtils.formatText("&cBack")),
TextUtils.formatText("&cBack")),
(event) -> {
guiManager.showGUI(event.player, returnGui);
((GuiLootEditor) returnGui).paint();
});
setButton(3, GuiUtils.createButtonItem(CompatibleMaterial.ARROW,
TextUtils.formatText("&aAdd new line")),
TextUtils.formatText("&aAdd new line")),
(event -> {
AnvilGui gui = new AnvilGui(event.player, this);
gui.setAction((e -> {
@ -62,7 +62,7 @@ public abstract class AbstractGuiListEditor extends Gui {
: TextUtils.formatText(lore)));
setButton(5, GuiUtils.createButtonItem(CompatibleMaterial.ARROW,
TextUtils.formatText("&cRemove the last line")),
TextUtils.formatText("&cRemove the last line")),
(event -> {
lore.remove(lore.size() - 1);
updateData(lore);

View File

@ -6,7 +6,6 @@ import com.songoda.core.gui.Gui;
import com.songoda.core.gui.GuiUtils;
import com.songoda.core.lootables.loot.Loot;
import com.songoda.core.utils.TextUtils;
import com.songoda.core.lootables.loot.Loot;
import org.bukkit.enchantments.Enchantment;
import java.util.ArrayList;
@ -32,19 +31,19 @@ public class GuiEnchantEditor extends Gui {
public void paint() {
Map<String, Integer> lore = loot.getEnchants() == null ? new HashMap<>() : new HashMap<>(loot.getEnchants());
setButton(2, GuiUtils.createButtonItem(CompatibleMaterial.OAK_FENCE_GATE,
TextUtils.formatText("&cBack")),
TextUtils.formatText("&cBack")),
(event) -> {
guiManager.showGUI(event.player, returnGui);
((GuiLootEditor) returnGui).paint();
});
setButton(6, GuiUtils.createButtonItem(CompatibleMaterial.OAK_FENCE_GATE,
TextUtils.formatText("&cBack")),
TextUtils.formatText("&cBack")),
(event) -> {
guiManager.showGUI(event.player, returnGui);
((GuiLootEditor) returnGui).paint();
});
setButton(3, GuiUtils.createButtonItem(CompatibleMaterial.ARROW,
TextUtils.formatText("&aAdd new line")),
TextUtils.formatText("&aAdd new line")),
(event -> {
AnvilGui gui = new AnvilGui(event.player, this);
gui.setAction((e -> {
@ -84,9 +83,9 @@ public class GuiEnchantEditor extends Gui {
? TextUtils.formatText(Collections.singletonList("&cNo enchantments set..."))
: TextUtils.formatText(enchantments)));
String lastFinal = last;
String lastFinal = last;
setButton(5, GuiUtils.createButtonItem(CompatibleMaterial.ARROW,
TextUtils.formatText("&cRemove the last line")),
TextUtils.formatText("&cRemove the last line")),
(event -> {
lore.remove(lastFinal);
loot.setEnchants(lore);

View File

@ -4,10 +4,10 @@ import com.songoda.core.compatibility.CompatibleMaterial;
import com.songoda.core.gui.AnvilGui;
import com.songoda.core.gui.Gui;
import com.songoda.core.gui.GuiUtils;
import com.songoda.core.utils.TextUtils;
import com.songoda.core.lootables.loot.Loot;
import com.songoda.core.lootables.loot.LootBuilder;
import com.songoda.core.lootables.loot.LootManager;
import com.songoda.core.utils.TextUtils;
import org.bukkit.entity.EntityType;
import org.bukkit.event.inventory.ClickType;
import org.bukkit.inventory.ItemStack;
@ -42,7 +42,7 @@ public class GuiLootEditor extends Gui {
setActionForRange(0, 0, 5, 9, null);
setButton(8, GuiUtils.createButtonItem(CompatibleMaterial.OAK_DOOR,
TextUtils.formatText("&cBack")),
TextUtils.formatText("&cBack")),
(event) -> {
guiManager.showGUI(event.player, returnGui);
});
@ -60,7 +60,7 @@ public class GuiLootEditor extends Gui {
});
setButton(10, GuiUtils.createButtonItem(CompatibleMaterial.PAPER,
TextUtils.formatText("&7Name Override: &6" + (loot.getName() == null ? "None set" : loot.getName()))),
TextUtils.formatText("&7Name Override: &6" + (loot.getName() == null ? "None set" : loot.getName()))),
(event) -> {
AnvilGui gui = new AnvilGui(event.player, this);
gui.setAction((e -> {
@ -73,8 +73,8 @@ public class GuiLootEditor extends Gui {
});
setButton(11, GuiUtils.createButtonItem(CompatibleMaterial.WRITABLE_BOOK,
TextUtils.formatText("&7Lore Override:"),
TextUtils.formatText(loot.getLore() == null ? Collections.singletonList("&6None set") : loot.getLore())),
TextUtils.formatText("&7Lore Override:"),
TextUtils.formatText(loot.getLore() == null ? Collections.singletonList("&6None set") : loot.getLore())),
(event) -> guiManager.showGUI(event.player, new GuiLoreEditor(loot, this)));
List<String> enchantments = new ArrayList<>();
@ -84,22 +84,22 @@ public class GuiLootEditor extends Gui {
enchantments.add("&6" + entry.getKey() + " " + entry.getValue());
setButton(12, GuiUtils.createButtonItem(CompatibleMaterial.ENCHANTED_BOOK,
TextUtils.formatText("&7Enchantments:"),
TextUtils.formatText(enchantments.isEmpty() ? Collections.singletonList("&6None set") : enchantments)),
TextUtils.formatText("&7Enchantments:"),
TextUtils.formatText(enchantments.isEmpty() ? Collections.singletonList("&6None set") : enchantments)),
(event) -> guiManager.showGUI(event.player, new GuiEnchantEditor(loot, this)));
setButton(13, GuiUtils.createButtonItem(
loot.getBurnedMaterial() == null
? CompatibleMaterial.FIRE_CHARGE
: loot.getBurnedMaterial(),
TextUtils.formatText("&7Current Burned Material: &6"
+ (loot.getBurnedMaterial() == null
? "None"
: loot.getBurnedMaterial().name())), TextUtils.formatText(
Arrays.asList("",
"&8Click to set the burned material to",
"&8the material in your hand.")
)),
loot.getBurnedMaterial() == null
? CompatibleMaterial.FIRE_CHARGE
: loot.getBurnedMaterial(),
TextUtils.formatText("&7Current Burned Material: &6"
+ (loot.getBurnedMaterial() == null
? "None"
: loot.getBurnedMaterial().name())), TextUtils.formatText(
Arrays.asList("",
"&8Click to set the burned material to",
"&8the material in your hand.")
)),
(event) -> {
ItemStack stack = event.player.getInventory().getItemInMainHand();
loot.setBurnedMaterial(CompatibleMaterial.getMaterial(stack));
@ -107,12 +107,12 @@ public class GuiLootEditor extends Gui {
});
setButton(14, GuiUtils.createButtonItem(CompatibleMaterial.CLOCK,
TextUtils.formatText("&7Chance: &6" + loot.getChance()),
TextUtils.formatText(
Arrays.asList("",
"&8Click to edit this loots",
"&8drop chance.")
)),
TextUtils.formatText("&7Chance: &6" + loot.getChance()),
TextUtils.formatText(
Arrays.asList("",
"&8Click to edit this loots",
"&8drop chance.")
)),
(event) -> {
AnvilGui gui = new AnvilGui(event.player, this);
gui.setAction((e) -> {
@ -126,7 +126,7 @@ public class GuiLootEditor extends Gui {
});
setButton(15, GuiUtils.createButtonItem(CompatibleMaterial.REDSTONE,
TextUtils.formatText("&7Min Drop Amount: &6" + loot.getMin())),
TextUtils.formatText("&7Min Drop Amount: &6" + loot.getMin())),
(event) -> {
AnvilGui gui = new AnvilGui(event.player, this);
gui.setAction((e) -> {
@ -140,7 +140,7 @@ public class GuiLootEditor extends Gui {
});
setButton(16, GuiUtils.createButtonItem(CompatibleMaterial.GLOWSTONE_DUST,
TextUtils.formatText("&7Max Drop Amount: &6" + loot.getMax())),
TextUtils.formatText("&7Max Drop Amount: &6" + loot.getMax())),
(event) -> {
AnvilGui gui = new AnvilGui(event.player, this);
gui.setAction((e) -> {
@ -154,7 +154,7 @@ public class GuiLootEditor extends Gui {
});
setButton(17, GuiUtils.createButtonItem(CompatibleMaterial.REDSTONE,
TextUtils.formatText("&7Min Item Damage: &6" + loot.getDamageMin())),
TextUtils.formatText("&7Min Item Damage: &6" + loot.getDamageMin())),
(event) -> {
AnvilGui gui = new AnvilGui(event.player, this);
gui.setAction((e) -> {
@ -168,7 +168,7 @@ public class GuiLootEditor extends Gui {
});
setButton(18, GuiUtils.createButtonItem(CompatibleMaterial.GLOWSTONE_DUST,
TextUtils.formatText("&7Max Item Damage: &6" + loot.getDamageMax())),
TextUtils.formatText("&7Max Item Damage: &6" + loot.getDamageMax())),
(event) -> {
AnvilGui gui = new AnvilGui(event.player, this);
gui.setAction((e) -> {
@ -182,7 +182,7 @@ public class GuiLootEditor extends Gui {
});
setButton(19, GuiUtils.createButtonItem(CompatibleMaterial.CHEST,
TextUtils.formatText("&7Allow Looting Enchantment?: &6" + loot.isAllowLootingEnchant())),
TextUtils.formatText("&7Allow Looting Enchantment?: &6" + loot.isAllowLootingEnchant())),
(event) -> {
loot.setAllowLootingEnchant(!loot.isAllowLootingEnchant());
paint();
@ -190,7 +190,7 @@ public class GuiLootEditor extends Gui {
});
setButton(20, GuiUtils.createButtonItem(CompatibleMaterial.REDSTONE,
TextUtils.formatText("&7Min Child Loot Min: &6" + loot.getChildDropCountMin())),
TextUtils.formatText("&7Min Child Loot Min: &6" + loot.getChildDropCountMin())),
(event) -> {
AnvilGui gui = new AnvilGui(event.player, this);
gui.setAction((e) -> {
@ -204,7 +204,7 @@ public class GuiLootEditor extends Gui {
});
setButton(21, GuiUtils.createButtonItem(CompatibleMaterial.GLOWSTONE_DUST,
TextUtils.formatText("&7Min Child Loot Max: &6" + loot.getChildDropCountMax())),
TextUtils.formatText("&7Min Child Loot Max: &6" + loot.getChildDropCountMax())),
(event) -> {
AnvilGui gui = new AnvilGui(event.player, this);
gui.setAction((e) -> {
@ -224,8 +224,8 @@ public class GuiLootEditor extends Gui {
entities.add("&6" + entity.name());
setButton(22, GuiUtils.createButtonItem(CompatibleMaterial.ENCHANTED_BOOK,
TextUtils.formatText("&7Only Drop For:"),
TextUtils.formatText(entities)),
TextUtils.formatText("&7Only Drop For:"),
TextUtils.formatText(entities)),
(event) -> guiManager.showGUI(event.player, new GuiEntityEditor(loot, this)));
setButton(4, 0, GuiUtils.createButtonItem(CompatibleMaterial.LIME_DYE, TextUtils.formatText("&aCreate new Child Loot")),

View File

@ -4,11 +4,11 @@ import com.songoda.core.compatibility.CompatibleMaterial;
import com.songoda.core.gui.AnvilGui;
import com.songoda.core.gui.Gui;
import com.songoda.core.gui.GuiUtils;
import com.songoda.core.utils.TextUtils;
import com.songoda.core.lootables.loot.Loot;
import com.songoda.core.lootables.loot.LootBuilder;
import com.songoda.core.lootables.loot.LootManager;
import com.songoda.core.lootables.loot.Lootable;
import com.songoda.core.utils.TextUtils;
import org.bukkit.event.inventory.ClickType;
import org.bukkit.inventory.ItemStack;

View File

@ -37,7 +37,7 @@ public class DropUtils {
commands.add(drop.getCommand());
if (drop.getXp() != 0)
xp.add(drop.getXp());
xp.add(drop.getXp());
}
event.getDrops().clear();
@ -65,5 +65,4 @@ public class DropUtils {
Bukkit.dispatchCommand(Bukkit.getConsoleSender(), command);
}
}
}

View File

@ -161,7 +161,6 @@ public class Loot {
this.enchants = enchants;
}
public void setEnchantChances(Map<String, Double> enchants) {
this.enchantChances = enchants;
}

View File

@ -1,6 +1,5 @@
package com.songoda.core.lootables.loot;
import com.songoda.core.compatibility.CompatibleMaterial;
import com.songoda.core.lootables.loot.objects.EnchantChance;
import org.bukkit.entity.EntityType;
@ -35,7 +34,7 @@ public final class LootBuilder {
public LootBuilder addEnchants(Tuple... tuples) {
Map<String, Integer> enchants = new HashMap<>();
for (Tuple tuple : tuples)
enchants.put((String)tuple.getKey(), (int)tuple.getValue());
enchants.put((String) tuple.getKey(), (int) tuple.getValue());
this.loot.setEnchants(enchants);
return this;
}

View File

@ -140,7 +140,6 @@ public class LootManager {
addLootable(lootable);
reader.close();
} catch (IOException e) {
e.printStackTrace();
}
@ -164,7 +163,6 @@ public class LootManager {
Gson gson = new GsonBuilder().setPrettyPrinting().create();
gson.toJson(lootable, writer);
}
} catch (IOException e) {
e.printStackTrace();
}

View File

@ -27,7 +27,7 @@ public class Eval {
public double parse() {
nextChar();
double x = parseExpression();
if (pos < toParse.length()) throw new RuntimeException(warningMessage + "Unexpected: " + (char)ch);
if (pos < toParse.length()) throw new RuntimeException(warningMessage + "Unexpected: " + (char) ch);
return x;
}
@ -39,8 +39,8 @@ public class Eval {
private double parseExpression() {
double x = parseTerm();
for (;;) {
if (eat('+')) x += parseTerm(); // addition
for (; ; ) {
if (eat('+')) x += parseTerm(); // addition
else if (eat('-')) x -= parseTerm(); // subtraction
else return x;
}
@ -48,8 +48,8 @@ public class Eval {
private double parseTerm() {
double x = parseFactor();
for (;;) {
if (eat('*')) x *= parseFactor(); // multiplication
for (; ; ) {
if (eat('*')) x *= parseFactor(); // multiplication
else if (eat('/')) x /= parseFactor(); // division
else return x;
}
@ -77,7 +77,7 @@ public class Eval {
else if (func.equals("tan")) x = Math.tan(Math.toRadians(x));
else throw new RuntimeException(warningMessage + "Unknown function: " + func);
} else {
throw new RuntimeException(warningMessage + "Unexpected: " + (char)ch);
throw new RuntimeException(warningMessage + "Unexpected: " + (char) ch);
}
if (eat('^')) x = Math.pow(x, parseFactor()); // exponentiation

View File

@ -3,7 +3,6 @@ package com.songoda.core.utils;
import com.songoda.core.compatibility.ClassMapping;
import com.songoda.core.compatibility.CompatibleMaterial;
import com.songoda.core.compatibility.ServerVersion;
import org.bukkit.Bukkit;
import org.bukkit.Effect;
import org.bukkit.Location;
import org.bukkit.Material;
@ -62,6 +61,7 @@ public class BlockUtils {
* Interact with this block to either update redstone or open doors
*
* @param b block to update
*
* @return if this block's state was updated
*/
public static boolean tryInteract(Block b) {
@ -245,6 +245,7 @@ public class BlockUtils {
* Get the double door for the given block
*
* @param block
*
* @return
*/
public static Block getDoubleDoor(Block block) {
@ -346,7 +347,6 @@ public class BlockUtils {
.invoke(world, clazzBlockPosition.getConstructor(double.class, double.class, double.class)
.newInstance(location.getX(), location.getY(), location.getZ()),
nmsBlockData_getBlock.invoke(craftBlock_getNMS.invoke(craftBlock)));
} catch (ReflectiveOperationException e) {
e.printStackTrace();
}
@ -421,6 +421,7 @@ public class BlockUtils {
* Checks if a crop is at its max growth stage
*
* @param block The crop block to check
*
* @return true if the block is a crop and at its max growth stage
*/
public static boolean isCropFullyGrown(Block block) {
@ -442,6 +443,7 @@ public class BlockUtils {
* Gets the max growth stage for the given block
*
* @param block The crop block to check
*
* @return The max growth stage of the given crop type, or -1 if not a crop
*/
public static int getMaxGrowthStage(Block block) {
@ -463,6 +465,7 @@ public class BlockUtils {
* Gets the max growth stage for the given material
*
* @param material The material of the crop
*
* @return The max growth stage of the given crop type
*/
public static int getMaxGrowthStage(Material material) {
@ -550,6 +553,7 @@ public class BlockUtils {
* Check to see if this material does not impede player/mob movement at all.
*
* @param m material to check
*
* @return true if this material doesn't have a solid hitbox
*/
public static boolean canPassThrough(Material m) {
@ -735,6 +739,7 @@ public class BlockUtils {
* This includes blocks like slabs and stairs
*
* @param m material to check
*
* @return true if this is a block that can be walked though or up
*/
public static boolean canWalkTo(Material m) {

View File

@ -2,7 +2,6 @@ package com.songoda.core.utils;
import com.songoda.core.compatibility.ClassMapping;
import com.songoda.core.compatibility.ServerVersion;
import org.bukkit.Bukkit;
import org.bukkit.Effect;
import org.bukkit.Material;
import org.bukkit.block.Block;

View File

@ -51,7 +51,6 @@ public class ColorUtils {
public B getBlue() {
return blue;
}
}
public static ColorCode fromRGB(int r, int g, int b) {
@ -64,5 +63,4 @@ public class ColorUtils {
});
return closest.firstEntry().getValue();
}
}

View File

@ -1,7 +1,7 @@
package com.songoda.core.utils;
import com.songoda.core.compatibility.CompatibleMaterial;
import com.songoda.core.compatibility.ClassMapping;
import com.songoda.core.compatibility.CompatibleMaterial;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.LivingEntity;

View File

@ -20,6 +20,7 @@ public class ItemSerializer {
* A method to serialize an {@link ItemStack} list to Base64 String.
*
* @param items to turn into a Base64 String.
*
* @return Base64 string of the items.
*/
public static String toBase64(List<ItemStack> items) {
@ -48,6 +49,7 @@ public class ItemSerializer {
* Gets a list of ItemStacks from Base64 string.
*
* @param data Base64 string to convert to ItemStack list.
*
* @return ItemStack array created from the Base64 string.
*/
public static List<ItemStack> fromBase64(String data) {
@ -72,7 +74,9 @@ public class ItemSerializer {
/**
* Deserialize a byte array into an ItemStack.
*
* @param data Data to deserialize.
*
* @return Deserialized ItemStack.
*/
public static ItemStack deserializeItem(byte[] data) {
@ -88,7 +92,9 @@ public class ItemSerializer {
/**
* Serialize an ItemStack into a byte array.
*
* @param item Item to serialize.
*
* @return Serialized data.
*/
public static byte[] serializeItem(ItemStack item) {

View File

@ -5,10 +5,10 @@ package com.songoda.core.utils;
import com.mojang.authlib.GameProfile;
import com.mojang.authlib.properties.Property;
import com.songoda.core.compatibility.ClassMapping;
import com.songoda.core.compatibility.CompatibleHand;
import com.songoda.core.compatibility.CompatibleMaterial;
import com.songoda.core.compatibility.ServerVersion;
import com.songoda.core.compatibility.ClassMapping;
import org.apache.commons.lang.StringUtils;
import org.bukkit.Bukkit;
import org.bukkit.Material;
@ -80,7 +80,7 @@ public class ItemUtils {
private static Method methodAsBukkitCopy, methodAsNMSCopy, methodA;
static {
static {
try {
Class<?> clazzEnchantmentManager = ClassMapping.ENCHANTMENT_MANAGER.getClazz();
Class<?> clazzItemStack = ClassMapping.ITEM_STACK.getClazz();
@ -93,7 +93,6 @@ public class ItemUtils {
methodA = clazzEnchantmentManager.getMethod("a", Random.class, clazzItemStack, int.class);
else
methodA = clazzEnchantmentManager.getMethod("a", Random.class, clazzItemStack, int.class, boolean.class);
} catch (NoSuchMethodException e) {
e.printStackTrace();
}
@ -149,6 +148,7 @@ public class ItemUtils {
*
* @param item item to copy
* @param qty amount the new ItemStack should have
*
* @return a copy of the original item
*/
public static ItemStack getAsCopy(ItemStack item, int qty) {
@ -212,6 +212,7 @@ public class ItemUtils {
* Tested working 1.8-1.14
*
* @param item itemstack to create a glowing copy of
*
* @return copy of item with a blank enchantment nbt tag
*/
public static ItemStack addGlow(ItemStack item) {
@ -267,6 +268,7 @@ public class ItemUtils {
* Remove all enchantments, including hidden enchantments
*
* @param item item to clear enchants from
*
* @return copy of the item without any enchantment tag
*/
public static ItemStack removeGlow(ItemStack item) {
@ -403,7 +405,6 @@ public class ItemUtils {
Iterator<Property> iterator = ((GameProfile) cb_CraftPlayer_getProfile.invoke(craftPlayer)).getProperties().get("textures").iterator();
return iterator.hasNext() ? iterator.next().getValue() : null;
} catch (IllegalAccessException | InvocationTargetException e) {
e.printStackTrace();
return null;
@ -462,6 +463,7 @@ public class ItemUtils {
*
* @param is1 first item to compare
* @param is2 item to compare against
*
* @return true if both items are of the same material
*/
public static boolean isSimilarMaterial(ItemStack is1, ItemStack is2) {
@ -478,6 +480,7 @@ public class ItemUtils {
*
* @param inventory inventory to check
* @param item item to check against
*
* @return true if a free slot or single receiver slot is available
*/
public static boolean canMove(Inventory inventory, ItemStack item) {
@ -506,6 +509,7 @@ public class ItemUtils {
*
* @param contents inventory to check
* @param item item to check against
*
* @return true if a free slot or single receiver slot is available
*/
public static boolean canMove(ItemStack[] contents, ItemStack item) {
@ -535,6 +539,7 @@ public class ItemUtils {
* @param inventory inventory to check
* @param item item to check against
* @param reserved which slot should be reserved
*
* @return true if a free slot or single receiver slot is available
*/
public static boolean canMoveReserved(Inventory inventory, ItemStack item, int reserved) {
@ -566,6 +571,7 @@ public class ItemUtils {
* @param contents inventory to check
* @param item item to check against
* @param reserved which slot should be reserved
*
* @return true if a free slot or single receiver slot is available
*/
public static boolean canMoveReserved(ItemStack[] contents, ItemStack item, int reserved) {
@ -595,6 +601,7 @@ public class ItemUtils {
* @param amountToAdd how many of this item to attempt to add
* @param inventory a list that represents the inventory
* @param maxSize maximum number of different items this container can hold
*
* @return how many items were added
*/
public static int addAny(ItemStack item, int amountToAdd, List<ItemStack> inventory, int maxSize) {
@ -609,6 +616,7 @@ public class ItemUtils {
* @param inventory a list that represents the inventory
* @param maxSize maximum number of different items this container can hold
* @param reserved slot to reserve - will not fill this slot
*
* @return how many items were added
*/
public static int addAny(ItemStack item, int amountToAdd, List<ItemStack> inventory, int maxSize, int reserved) {
@ -651,6 +659,7 @@ public class ItemUtils {
* @param inventory a list that represents the inventory
* @param containerSize maximum number of different items this container can
* hold
*
* @return true if the item was added
*/
public static boolean addItem(ItemStack item, List<ItemStack> inventory, int containerSize) {
@ -668,6 +677,7 @@ public class ItemUtils {
* @param containerSize maximum number of different items this container can
* hold
* @param reserved slot to reserve - will not fill this slot
*
* @return true if the item was added
*/
public static boolean addItem(ItemStack item, List<ItemStack> inventory, int containerSize, int reserved) {
@ -685,6 +695,7 @@ public class ItemUtils {
* @param inventory a list that represents the inventory
* @param containerSize maximum number of different items this container can
* @param reserved slot to reserve - will not fill this slot hold
*
* @return true if the item was added
*/
public static boolean addItem(ItemStack item, int amount, List<ItemStack> inventory, int containerSize, int reserved) {
@ -701,6 +712,7 @@ public class ItemUtils {
* hold
* @param reserved slot to reserve - will not fill this slot
* @param inventorySource Material of the container
*
* @return true if the item was added
*/
public static boolean addItem(ItemStack item, int amount, List<ItemStack> inventory, int containerSize, int reserved, Material inventorySource) {
@ -732,7 +744,6 @@ public class ItemUtils {
} else {
check[3] = true;
}
}
case "SMOKER":
case "BLAST_FURNACE":
@ -749,7 +760,6 @@ public class ItemUtils {
} else {
check[0] = true;
}
}
}
}
@ -824,6 +834,7 @@ public class ItemUtils {
* @param item item to add
* @param amountToAdd how many of this item to attempt to add
* @param inventory a list that represents the inventory
*
* @return how many items were added
*/
public static int addAny(ItemStack item, int amountToAdd, Inventory inventory) {
@ -858,6 +869,7 @@ public class ItemUtils {
*
* @param item item to add
* @param inventory a list that represents the inventory hold
*
* @return true if the item was added
*/
public static boolean addItem(ItemStack item, Inventory inventory) {
@ -874,6 +886,7 @@ public class ItemUtils {
* @param amount how many of this item should be added
* @param inventory a list that represents the inventory
* @param reserved slot to reserve - will not fill this slot
*
* @return true if the item was added
*/
public static boolean addItem(ItemStack item, int amount, Inventory inventory, int reserved) {
@ -888,6 +901,7 @@ public class ItemUtils {
* @param inventory a list that represents the inventory
* @param reserved slot to reserve - will not fill this slot
* @param inventorySource Material of the container
*
* @return true if the item was added
*/
public static boolean addItem(ItemStack item, int amount, Inventory inventory, int reserved, Material inventorySource) {
@ -920,7 +934,6 @@ public class ItemUtils {
} else {
check[3] = true;
}
}
case "SMOKER":
case "BLAST_FURNACE":
@ -937,7 +950,6 @@ public class ItemUtils {
} else {
check[0] = true;
}
}
}
}
@ -1043,6 +1055,7 @@ public class ItemUtils {
* @param inventory a list that represents the inventory
* @param containerSize maximum number of different items this container can
* hold
*
* @return true if the item was added
*/
public static boolean addItem(ItemStack item, int amount, List<ItemStack> inventory, int containerSize) {

View File

@ -21,5 +21,4 @@ public class LocationUtils {
l.getY() >= y1 && l.getY() <= y2 &&
l.getZ() >= z1 && l.getZ() <= z2;
}
}

View File

@ -45,8 +45,8 @@ public class Metrics {
if (System.getProperty("bstats.relocatecheck") == null || !System.getProperty("bstats.relocatecheck").equals("false")) {
// Maven's Relocate is clever and changes strings, too. So we have to use this little "trick" ... :D
final String defaultPackage = new String(
new byte[]{'o', 'r', 'g', '.', 'b', 's', 't', 'a', 't', 's', '.', 'b', 'u', 'k', 'k', 'i', 't'});
final String examplePackage = new String(new byte[]{'y', 'o', 'u', 'r', '.', 'p', 'a', 'c', 'k', 'a', 'g', 'e'});
new byte[] {'o', 'r', 'g', '.', 'b', 's', 't', 'a', 't', 's', '.', 'b', 'u', 'k', 'k', 'i', 't'});
final String examplePackage = new String(new byte[] {'y', 'o', 'u', 'r', '.', 'p', 'a', 'c', 'k', 'a', 'g', 'e'});
// We want to make sure nobody just copy & pastes the example and use the wrong package names
if (Metrics.class.getPackage().getName().equals(defaultPackage) || Metrics.class.getPackage().getName().equals(examplePackage)) {
throw new IllegalStateException("bStats Metrics class has not been relocated correctly!");
@ -316,6 +316,7 @@ public class Metrics {
*
* @param plugin Any plugin. It's just used to get a logger instance.
* @param data The data to send.
*
* @throws Exception If the request failed.
*/
private static void sendData(Plugin plugin, JSONObject data) throws Exception {
@ -367,7 +368,9 @@ public class Metrics {
* Gzips the given String.
*
* @param str The string to gzip.
*
* @return The gzipped String.
*
* @throws IOException If the compression failed.
*/
private static byte[] compress(final String str) throws IOException {
@ -421,7 +424,6 @@ public class Metrics {
}
protected abstract JSONObject getChartData() throws Exception;
}
/**
@ -577,7 +579,6 @@ public class Metrics {
data.put("value", value);
return data;
}
}
/**
@ -622,7 +623,6 @@ public class Metrics {
data.put("values", values);
return data;
}
}
/**
@ -660,7 +660,6 @@ public class Metrics {
data.put("values", values);
return data;
}
}
/**
@ -710,5 +709,4 @@ public class Metrics {
return data;
}
}
}

View File

@ -24,7 +24,7 @@ public class NumberUtils {
if (count < 1000) return String.valueOf(count);
int exp = (int) (Math.log(count) / Math.log(1000));
return String.format("%.1f%c", count / Math.pow(1000, exp),
"kMGTPE".charAt(exp-1)).replace(".0", "");
"kMGTPE".charAt(exp - 1)).replace(".0", "");
}
public static boolean isInt(String number) {
@ -43,5 +43,4 @@ public class NumberUtils {
return false;
return s.matches("[-+]?\\d*\\.?\\d+");
}
}

View File

@ -36,6 +36,7 @@ public class PlayerUtils {
* @param sender user to check against, or null for all players
* @param startingWith optional query to test: only players whose game names
* start with this
*
* @return list of player names that are "visible" to the player
*/
public static List<String> getVisiblePlayerNames(CommandSender sender, String startingWith) {
@ -55,6 +56,7 @@ public class PlayerUtils {
* @param sender user to check against, or null for all players
* @param startingWith optional query to test: only players whose game names
* start with this
*
* @return list of player names that are "visible" to the player
*/
public static List<String> getVisiblePlayerDisplayNames(CommandSender sender, String startingWith) {
@ -74,6 +76,7 @@ public class PlayerUtils {
* @param sender user to check against, or null for all players
* @param startingWith optional query to test: only players whose game names
* start with this
*
* @return list of players that are "visible" to the player
*/
public static List<Player> getVisiblePlayers(CommandSender sender, String startingWith) {
@ -92,6 +95,7 @@ public class PlayerUtils {
*
* @param us Ourselves / who is requesting the list. Will not return this player.
* @param startsWith All names returned must start with this input string
*
* @return List of matching player IGN
*/
public static List<String> getAllPlayers(CommandSender us, String startsWith) {
@ -107,6 +111,7 @@ public class PlayerUtils {
*
* @param us Ourselves / who is requesting the list. Will not return this player.
* @param startsWith All names returned must start with this input string
*
* @return List of matching player display names
*/
public static List<String> getAllPlayersDisplay(CommandSender us, String startsWith) {
@ -122,6 +127,7 @@ public class PlayerUtils {
* Also checks player display names if there is not an exact match.
*
* @param player player to search for
*
* @return Player that closest matches the input name, or null if none found
*/
public static Player findPlayer(String player) {

Some files were not shown because too many files have changed in this diff Show More