@@ -0,0 +1,363 @@
|
||||
[*]
|
||||
charset = utf-8
|
||||
end_of_line = lf
|
||||
indent_size = 4
|
||||
indent_style = space
|
||||
insert_final_newline = false
|
||||
max_line_length = 180
|
||||
tab_width = 4
|
||||
ij_continuation_indent_size = 4
|
||||
ij_formatter_off_tag = @formatter:off
|
||||
ij_formatter_on_tag = @formatter:on
|
||||
ij_formatter_tags_enabled = true
|
||||
ij_smart_tabs = false
|
||||
ij_visual_guides =
|
||||
ij_wrap_on_typing = false
|
||||
|
||||
[*.java]
|
||||
ij_continuation_indent_size = 8
|
||||
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_deconstruction_list_components = true
|
||||
ij_java_align_multiline_extends_list = false
|
||||
ij_java_align_multiline_for = false
|
||||
ij_java_align_multiline_method_parentheses = false
|
||||
ij_java_align_multiline_parameters = false
|
||||
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 = false
|
||||
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_align_types_in_multi_catch = true
|
||||
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 = normal
|
||||
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 = true
|
||||
ij_java_binary_operation_wrap = normal
|
||||
ij_java_blank_lines_after_anonymous_class_header = 0
|
||||
ij_java_blank_lines_after_class_header = 1
|
||||
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_add_space = false
|
||||
ij_java_block_comment_at_first_column = true
|
||||
ij_java_builder_methods =
|
||||
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 = 999
|
||||
ij_java_class_names_in_javadoc = 1
|
||||
ij_java_deconstruction_list_wrap = normal
|
||||
ij_java_do_not_indent_top_level_class_members = false
|
||||
ij_java_do_not_wrap_after_single_annotation = false
|
||||
ij_java_do_not_wrap_after_single_annotation_in_parameter = false
|
||||
ij_java_do_while_brace_force = always
|
||||
ij_java_doc_add_blank_line_after_description = true
|
||||
ij_java_doc_add_blank_line_after_param_comments = false
|
||||
ij_java_doc_add_blank_line_after_return = false
|
||||
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 = false
|
||||
ij_java_doc_enable_formatting = true
|
||||
ij_java_doc_enable_leading_asterisks = true
|
||||
ij_java_doc_indent_on_continuation = false
|
||||
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_entity_dd_prefix =
|
||||
ij_java_entity_dd_suffix = EJB
|
||||
ij_java_entity_eb_prefix =
|
||||
ij_java_entity_eb_suffix = Bean
|
||||
ij_java_entity_hi_prefix =
|
||||
ij_java_entity_hi_suffix = Home
|
||||
ij_java_entity_lhi_prefix = Local
|
||||
ij_java_entity_lhi_suffix = Home
|
||||
ij_java_entity_li_prefix = Local
|
||||
ij_java_entity_li_suffix =
|
||||
ij_java_entity_pk_class = java.lang.String
|
||||
ij_java_entity_ri_prefix =
|
||||
ij_java_entity_ri_suffix =
|
||||
ij_java_entity_vo_prefix =
|
||||
ij_java_entity_vo_suffix = VO
|
||||
ij_java_enum_constants_wrap = off
|
||||
ij_java_enum_field_annotation_wrap = off
|
||||
ij_java_extends_keyword_wrap = off
|
||||
ij_java_extends_list_wrap = normal
|
||||
ij_java_field_annotation_wrap = split_into_lines
|
||||
ij_java_field_name_prefix =
|
||||
ij_java_field_name_suffix =
|
||||
ij_java_filter_class_prefix =
|
||||
ij_java_filter_class_suffix =
|
||||
ij_java_filter_dd_prefix =
|
||||
ij_java_filter_dd_suffix =
|
||||
ij_java_finally_on_new_line = false
|
||||
ij_java_for_brace_force = always
|
||||
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 = normal
|
||||
ij_java_generate_final_locals = false
|
||||
ij_java_generate_final_parameters = false
|
||||
ij_java_generate_use_type_annotation_before_type = true
|
||||
ij_java_if_brace_force = always
|
||||
ij_java_imports_layout = $*, |, *
|
||||
ij_java_indent_case_from_switch = true
|
||||
ij_java_insert_inner_class_imports = true
|
||||
ij_java_insert_override_annotation = true
|
||||
ij_java_keep_blank_lines_before_right_brace = 2
|
||||
ij_java_keep_blank_lines_between_package_declaration_and_header = 2
|
||||
ij_java_keep_blank_lines_in_code = 1
|
||||
ij_java_keep_blank_lines_in_declarations = 2
|
||||
ij_java_keep_builder_methods_indents = false
|
||||
ij_java_keep_control_statement_in_one_line = false
|
||||
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 = false
|
||||
ij_java_keep_simple_lambdas_in_one_line = false
|
||||
ij_java_keep_simple_methods_in_one_line = false
|
||||
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_add_space_on_reformat = false
|
||||
ij_java_line_comment_at_first_column = true
|
||||
ij_java_listener_class_prefix =
|
||||
ij_java_listener_class_suffix =
|
||||
ij_java_local_variable_name_prefix =
|
||||
ij_java_local_variable_name_suffix =
|
||||
ij_java_message_dd_prefix =
|
||||
ij_java_message_dd_suffix = EJB
|
||||
ij_java_message_eb_prefix =
|
||||
ij_java_message_eb_suffix = Bean
|
||||
ij_java_method_annotation_wrap = split_into_lines
|
||||
ij_java_method_brace_style = end_of_line
|
||||
ij_java_method_call_chain_wrap = normal
|
||||
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_multi_catch_types_wrap = normal
|
||||
ij_java_names_count_to_use_import_on_demand = 999
|
||||
ij_java_new_line_after_lparen_in_annotation = false
|
||||
ij_java_new_line_after_lparen_in_deconstruction_pattern = true
|
||||
ij_java_new_line_after_lparen_in_record_header = false
|
||||
ij_java_new_line_when_body_is_presented = false
|
||||
ij_java_packages_to_use_import_on_demand =
|
||||
ij_java_parameter_annotation_wrap = off
|
||||
ij_java_parameter_name_prefix =
|
||||
ij_java_parameter_name_suffix =
|
||||
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 = false
|
||||
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_annotation = false
|
||||
ij_java_rparen_on_new_line_in_deconstruction_pattern = true
|
||||
ij_java_rparen_on_new_line_in_record_header = false
|
||||
ij_java_servlet_class_prefix =
|
||||
ij_java_servlet_class_suffix =
|
||||
ij_java_servlet_dd_prefix =
|
||||
ij_java_servlet_dd_suffix =
|
||||
ij_java_session_dd_prefix =
|
||||
ij_java_session_dd_suffix = EJB
|
||||
ij_java_session_eb_prefix =
|
||||
ij_java_session_eb_suffix = Bean
|
||||
ij_java_session_hi_prefix =
|
||||
ij_java_session_hi_suffix = Home
|
||||
ij_java_session_lhi_prefix = Local
|
||||
ij_java_session_lhi_suffix = Home
|
||||
ij_java_session_li_prefix = Local
|
||||
ij_java_session_li_suffix =
|
||||
ij_java_session_ri_prefix =
|
||||
ij_java_session_ri_suffix =
|
||||
ij_java_session_si_prefix =
|
||||
ij_java_session_si_suffix = Service
|
||||
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 = false
|
||||
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_deconstruction_list = 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 = false
|
||||
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_annotation_eq = 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_inside_block_braces_when_body_is_present = 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 = false
|
||||
ij_java_spaces_within_brackets = false
|
||||
ij_java_spaces_within_cast_parentheses = false
|
||||
ij_java_spaces_within_catch_parentheses = false
|
||||
ij_java_spaces_within_deconstruction_list = 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_static_field_name_prefix =
|
||||
ij_java_static_field_name_suffix =
|
||||
ij_java_subclass_name_prefix =
|
||||
ij_java_subclass_name_suffix = Impl
|
||||
ij_java_switch_expressions_wrap = normal
|
||||
ij_java_ternary_operation_signs_on_next_line = true
|
||||
ij_java_ternary_operation_wrap = normal
|
||||
ij_java_test_name_prefix =
|
||||
ij_java_test_name_suffix = Test
|
||||
ij_java_throws_keyword_wrap = normal
|
||||
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 = always
|
||||
ij_java_while_on_new_line = false
|
||||
ij_java_wrap_comments = true
|
||||
ij_java_wrap_first_method_in_call_chain = false
|
||||
ij_java_wrap_long_lines = false
|
||||
ij_java_wrap_semicolon_after_call_chain = false
|
||||
|
||||
[{*.har,*.jsb2,*.jsb3,*.json,*.jsonc,*.png.mcmeta,*.postman_collection,*.postman_collection.json,*.postman_environment,*.postman_environment.json,.babelrc,.eslintrc,.prettierrc,.stylelintrc,.ws-context,jest.config,mcmod.info,pack.mcmeta}]
|
||||
indent_size = 2
|
||||
tab_width = 2
|
||||
ij_json_array_wrapping = split_into_lines
|
||||
ij_json_keep_blank_lines_in_code = 0
|
||||
ij_json_keep_indents_on_empty_lines = false
|
||||
ij_json_keep_line_breaks = true
|
||||
ij_json_keep_trailing_comma = false
|
||||
ij_json_object_wrapping = split_into_lines
|
||||
ij_json_property_alignment = do_not_align
|
||||
ij_json_space_after_colon = true
|
||||
ij_json_space_after_comma = true
|
||||
ij_json_space_before_colon = false
|
||||
ij_json_space_before_comma = false
|
||||
ij_json_spaces_within_braces = false
|
||||
ij_json_spaces_within_brackets = false
|
||||
ij_json_wrap_long_lines = false
|
||||
|
||||
[{*.properties,spring.handlers,spring.schemas}]
|
||||
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
|
||||
|
||||
[{*.yaml,*.yml}]
|
||||
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_line_comment_add_space = false
|
||||
ij_yaml_line_comment_add_space_on_reformat = false
|
||||
ij_yaml_line_comment_at_first_column = 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
|
||||
@@ -0,0 +1,52 @@
|
||||
name: "🔥 Bug report"
|
||||
description: Create a report to help us improve
|
||||
labels: [ "status: needs testing", "type: bug" ]
|
||||
body:
|
||||
- type: markdown
|
||||
attributes:
|
||||
value: |
|
||||
**Before You Start:**
|
||||
|
||||
This form is for submitting bug reports. If you have a usage question
|
||||
or are unsure if this is really a bug, make sure to:
|
||||
|
||||
- Ask on our [Discord Chat](https://discord.com/invite/rduPF3yk62)
|
||||
|
||||
Also try to search for your issue - it may have already been answered or even fixed in a development branch.
|
||||
However, if you find that an old, closed issue still persists in the latest version,
|
||||
you should open a new issue using the form below instead of commenting on the old issue.
|
||||
- type: textarea
|
||||
id: steps-to-reproduce
|
||||
attributes:
|
||||
label: Steps to reproduce
|
||||
description: |
|
||||
What do we need to do in order to make the bug happen? Clear and concise reproduction instructions are important for us to be able to triage your issue in a timely manner.
|
||||
placeholder: Steps to reproduce
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: expected
|
||||
attributes:
|
||||
label: What is expected?
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: actually-happening
|
||||
attributes:
|
||||
label: What is actually happening?
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: server-info
|
||||
attributes:
|
||||
label: Server Info
|
||||
description: "Minecraft version: (e.g. 1.21.4), Server version (e.g. Spigot, Paper), Plugin version (e.g. 2.17.1)"
|
||||
render: shell
|
||||
placeholder: "Minecraft version 1.21.4 on the server version Paper-386 with the Plugin version 2.17.1"
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: additional-comments
|
||||
attributes:
|
||||
label: Any additional comments?
|
||||
description: For example some background / context of how you ran into this bug.
|
||||
@@ -0,0 +1,5 @@
|
||||
blank_issues_enabled: false
|
||||
contact_links:
|
||||
- name: 🗣️ Discord Chat
|
||||
url: https://discord.com/invite/rduPF3yk62
|
||||
about: Support Discord, please ask questions and seek support here.
|
||||
@@ -0,0 +1,26 @@
|
||||
name: "✨ New feature request"
|
||||
description: Suggest an idea for this project
|
||||
labels: [ "type: feature" ]
|
||||
body:
|
||||
- type: markdown
|
||||
attributes:
|
||||
value: |
|
||||
**Before You Start:**
|
||||
|
||||
This form is only for submitting feature requests. If you have a usage question
|
||||
or are unsure if this is really a bug, make sure to:
|
||||
|
||||
- Ask on our [Discord Chat](https://discord.com/invite/rduPF3yk62)
|
||||
|
||||
Also try to search for your issue - another user may have already requested something similar!
|
||||
|
||||
- type: textarea
|
||||
id: problem-description
|
||||
attributes:
|
||||
label: What problem does this feature solve?
|
||||
description: |
|
||||
Explain your use case, context, and rationale behind this feature request. More importantly, what is the **end user experience** you are trying to build that led to the need for this feature?
|
||||
|
||||
placeholder: Problem description
|
||||
validations:
|
||||
required: true
|
||||
|
After Width: | Height: | Size: 45 KiB |
|
After Width: | Height: | Size: 217 KiB |
|
After Width: | Height: | Size: 18 KiB |
|
After Width: | Height: | Size: 35 KiB |
|
After Width: | Height: | Size: 14 KiB |
|
After Width: | Height: | Size: 38 KiB |
|
After Width: | Height: | Size: 54 KiB |
|
After Width: | Height: | Size: 17 KiB |
|
After Width: | Height: | Size: 22 KiB |
|
After Width: | Height: | Size: 28 KiB |
@@ -0,0 +1,21 @@
|
||||
{
|
||||
"extends": [
|
||||
"config:base",
|
||||
":disableDependencyDashboard"
|
||||
],
|
||||
"automerge": true,
|
||||
"ignoreDeps": [
|
||||
"org.spigotmc:spigot-api"
|
||||
],
|
||||
"labels": [
|
||||
"renovate"
|
||||
],
|
||||
"commitMessagePrefix": "chore: ",
|
||||
"rebaseWhen": "conflicted",
|
||||
"packageRules": [
|
||||
{
|
||||
"matchPackagePrefixes": ["software.amazon.awssdk"],
|
||||
"schedule": ["before 4am on the first day of the month"]
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
name: Build main
|
||||
|
||||
on: [ push, pull_request ]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
java: [ 21 ]
|
||||
fail-fast: true
|
||||
|
||||
steps:
|
||||
- name: Checkout Git Repository
|
||||
uses: actions/checkout@v5
|
||||
|
||||
- name: Set up JDK ${{ matrix.java }}
|
||||
uses: actions/setup-java@v5
|
||||
with:
|
||||
java-version: ${{ matrix.java }}
|
||||
distribution: 'temurin'
|
||||
|
||||
- name: Setup Gradle
|
||||
uses: gradle/actions/setup-gradle@v5
|
||||
|
||||
- name: Build with Gradle
|
||||
run: ./gradlew clean build
|
||||
@@ -0,0 +1,51 @@
|
||||
name: Publish to Sonatype
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ master, dev/v3 ]
|
||||
|
||||
jobs:
|
||||
publish:
|
||||
if: github.repository_owner_id == 29168243
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
java: [ 21 ]
|
||||
fail-fast: true
|
||||
steps:
|
||||
- name: Checkout Git Repository
|
||||
uses: actions/checkout@v5
|
||||
|
||||
- name: Set up JDK ${{ matrix.java }}
|
||||
uses: actions/setup-java@v5
|
||||
with:
|
||||
java-version: ${{ matrix.java }}
|
||||
distribution: 'temurin'
|
||||
|
||||
- name: Setup Gradle
|
||||
uses: gradle/actions/setup-gradle@v5
|
||||
|
||||
- name: Get Project Version
|
||||
id: version
|
||||
run: |
|
||||
VERSION=$(./gradlew -q properties --no-daemon | grep "^version:" | awk '{print $2}')
|
||||
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
|
||||
|
||||
- name: Publish to Sonatype
|
||||
env:
|
||||
ORG_GRADLE_PROJECT_sonatypeUsername: ${{ secrets.SONATYPE_USERNAME }}
|
||||
ORG_GRADLE_PROJECT_sonatypePassword: ${{ secrets.SONATYPE_PASSWORD }}
|
||||
ORG_GRADLE_PROJECT_signingKeyId: ${{ secrets.SIGNING_KEY_ID }}
|
||||
ORG_GRADLE_PROJECT_signingKey: ${{ secrets.SIGNING_KEY }}
|
||||
ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.SIGNING_PASSWORD }}
|
||||
run: |
|
||||
PROJECT_VERSION="${{ steps.version.outputs.version }}"
|
||||
echo "Detected project version: $PROJECT_VERSION"
|
||||
|
||||
if [[ "$PROJECT_VERSION" == *-SNAPSHOT ]]; then
|
||||
echo "Publishing SNAPSHOT version to Sonatype..."
|
||||
./gradlew publishAllPublicationsToSonatypeRepository --no-daemon --no-configuration-cache
|
||||
else
|
||||
echo "Publishing RELEASE version to Sonatype and closing staging repository..."
|
||||
./gradlew publishAllPublicationsToSonatypeRepository closeAndReleaseSonatypeStagingRepository --no-daemon --no-configuration-cache
|
||||
fi
|
||||
@@ -0,0 +1,125 @@
|
||||
# User-specific stuff
|
||||
.idea/
|
||||
.vscode/
|
||||
|
||||
*.iml
|
||||
*.ipr
|
||||
*.iws
|
||||
|
||||
# IntelliJ
|
||||
out/
|
||||
|
||||
# Eclipse
|
||||
.classpath
|
||||
.project
|
||||
.settings/
|
||||
plugin/bin/
|
||||
api/bin/
|
||||
|
||||
# Compiled class file
|
||||
*.class
|
||||
|
||||
# Log file
|
||||
*.log
|
||||
|
||||
# BlueJ files
|
||||
*.ctxt
|
||||
|
||||
# Package Files #
|
||||
*.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*
|
||||
|
||||
*~
|
||||
|
||||
# temporary files which can be created if a process still has a handle open of a deleted file
|
||||
.fuse_hidden*
|
||||
|
||||
# KDE directory preferences
|
||||
.directory
|
||||
|
||||
# Linux trash folder which might appear on any partition or disk
|
||||
.Trash-*
|
||||
|
||||
# .nfs files are created when an open file is removed but is still being accessed
|
||||
.nfs*
|
||||
|
||||
# General
|
||||
.DS_Store
|
||||
.AppleDouble
|
||||
.LSOverride
|
||||
|
||||
# Icon must end with two \r
|
||||
Icon
|
||||
|
||||
# Thumbnails
|
||||
._*
|
||||
|
||||
# Files that might appear in the root of a volume
|
||||
.DocumentRevisions-V100
|
||||
.fseventsd
|
||||
.Spotlight-V100
|
||||
.TemporaryItems
|
||||
.Trashes
|
||||
.VolumeIcon.icns
|
||||
.com.apple.timemachine.donotpresent
|
||||
|
||||
# Directories potentially created on remote AFP share
|
||||
.AppleDB
|
||||
.AppleDesktop
|
||||
Network Trash Folder
|
||||
Temporary Items
|
||||
.apdisk
|
||||
|
||||
# Windows thumbnail cache files
|
||||
Thumbs.db
|
||||
Thumbs.db:encryptable
|
||||
ehthumbs.db
|
||||
ehthumbs_vista.db
|
||||
|
||||
# Dump file
|
||||
*.stackdump
|
||||
|
||||
# Folder config file
|
||||
[Dd]esktop.ini
|
||||
|
||||
# Recycle Bin used on file shares
|
||||
$RECYCLE.BIN/
|
||||
|
||||
# Windows Installer files
|
||||
*.cab
|
||||
*.msi
|
||||
*.msix
|
||||
*.msm
|
||||
*.msp
|
||||
|
||||
# Windows shortcuts
|
||||
*.lnk
|
||||
|
||||
target/
|
||||
|
||||
pom.xml.tag
|
||||
pom.xml.releaseBackup
|
||||
pom.xml.versionsBackup
|
||||
pom.xml.next
|
||||
|
||||
release.properties
|
||||
dependency-reduced-pom.xml
|
||||
.mvn/timing.properties
|
||||
.mvn/wrapper/maven-wrapper.jar
|
||||
.flattened-pom.xml
|
||||
|
||||
# Common working directory
|
||||
bin/
|
||||
build/
|
||||
.gradle/
|
||||
buildSrc/build/
|
||||
buildSrc/.gradle/
|
||||
run/
|
||||
/*.jar
|
||||
@@ -0,0 +1,15 @@
|
||||
Copyright (c) 2018-2025, Thomas Meaney
|
||||
Copyright (c) contributors
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
@@ -0,0 +1,858 @@
|
||||
-----------------
|
||||
BuildSystem License
|
||||
-----------------
|
||||
|
||||
BuildSystem as a whole is licensed under:
|
||||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The GNU General Public License is a free, copyleft license for
|
||||
software and other kinds of works.
|
||||
|
||||
The licenses for most software and other practical works are designed
|
||||
to take away your freedom to share and change the works. By contrast,
|
||||
the GNU General Public License is intended to guarantee your freedom to
|
||||
share and change all versions of a program--to make sure it remains free
|
||||
software for all its users. We, the Free Software Foundation, use the
|
||||
GNU General Public License for most of our software; it applies also to
|
||||
any other work released this way by its authors. You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
them if you wish), that you receive source code or can get it if you
|
||||
want it, that you can change the software or use pieces of it in new
|
||||
free programs, and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to prevent others from denying you
|
||||
these rights or asking you to surrender the rights. Therefore, you have
|
||||
certain responsibilities if you distribute copies of the software, or if
|
||||
you modify it: responsibilities to respect the freedom of others.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must pass on to the recipients the same
|
||||
freedoms that you received. You must make sure that they, too, receive
|
||||
or can get the source code. And you must show them these terms so they
|
||||
know their rights.
|
||||
|
||||
Developers that use the GNU GPL protect your rights with two steps:
|
||||
(1) assert copyright on the software, and (2) offer you this License
|
||||
giving you legal permission to copy, distribute and/or modify it.
|
||||
|
||||
For the developers' and authors' protection, the GPL clearly explains
|
||||
that there is no warranty for this free software. For both users' and
|
||||
authors' sake, the GPL requires that modified versions be marked as
|
||||
changed, so that their problems will not be attributed erroneously to
|
||||
authors of previous versions.
|
||||
|
||||
Some devices are designed to deny users access to install or run
|
||||
modified versions of the software inside them, although the manufacturer
|
||||
can do so. This is fundamentally incompatible with the aim of
|
||||
protecting users' freedom to change the software. The systematic
|
||||
pattern of such abuse occurs in the area of products for individuals to
|
||||
use, which is precisely where it is most unacceptable. Therefore, we
|
||||
have designed this version of the GPL to prohibit the practice for those
|
||||
products. If such problems arise substantially in other domains, we
|
||||
stand ready to extend this provision to those domains in future versions
|
||||
of the GPL, as needed to protect the freedom of users.
|
||||
|
||||
Finally, every program is threatened constantly by software patents.
|
||||
States should not allow patents to restrict development and use of
|
||||
software on general-purpose computers, but in those that do, we wish to
|
||||
avoid the special danger that patents applied to a free program could
|
||||
make it effectively proprietary. To prevent this, the GPL assures that
|
||||
patents cannot be used to render the program non-free.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
TERMS AND CONDITIONS
|
||||
|
||||
0. Definitions.
|
||||
|
||||
"This License" refers to version 3 of the GNU General Public License.
|
||||
|
||||
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||
works, such as semiconductor masks.
|
||||
|
||||
"The Program" refers to any copyrightable work licensed under this
|
||||
License. Each licensee is addressed as "you". "Licensees" and
|
||||
"recipients" may be individuals or organizations.
|
||||
|
||||
To "modify" a work means to copy from or adapt all or part of the work
|
||||
in a fashion requiring copyright permission, other than the making of an
|
||||
exact copy. The resulting work is called a "modified version" of the
|
||||
earlier work or a work "based on" the earlier work.
|
||||
|
||||
A "covered work" means either the unmodified Program or a work based
|
||||
on the Program.
|
||||
|
||||
To "propagate" a work means to do anything with it that, without
|
||||
permission, would make you directly or secondarily liable for
|
||||
infringement under applicable copyright law, except executing it on a
|
||||
computer or modifying a private copy. Propagation includes copying,
|
||||
distribution (with or without modification), making available to the
|
||||
public, and in some countries other activities as well.
|
||||
|
||||
To "convey" a work means any kind of propagation that enables other
|
||||
parties to make or receive copies. Mere interaction with a user through
|
||||
a computer network, with no transfer of a copy, is not conveying.
|
||||
|
||||
An interactive user interface displays "Appropriate Legal Notices"
|
||||
to the extent that it includes a convenient and prominently visible
|
||||
feature that (1) displays an appropriate copyright notice, and (2)
|
||||
tells the user that there is no warranty for the work (except to the
|
||||
extent that warranties are provided), that licensees may convey the
|
||||
work under this License, and how to view a copy of this License. If
|
||||
the interface presents a list of user commands or options, such as a
|
||||
menu, a prominent item in the list meets this criterion.
|
||||
|
||||
1. Source Code.
|
||||
|
||||
The "source code" for a work means the preferred form of the work
|
||||
for making modifications to it. "Object code" means any non-source
|
||||
form of a work.
|
||||
|
||||
A "Standard Interface" means an interface that either is an official
|
||||
standard defined by a recognized standards body, or, in the case of
|
||||
interfaces specified for a particular programming language, one that
|
||||
is widely used among developers working in that language.
|
||||
|
||||
The "System Libraries" of an executable work include anything, other
|
||||
than the work as a whole, that (a) is included in the normal form of
|
||||
packaging a Major Component, but which is not part of that Major
|
||||
Component, and (b) serves only to enable use of the work with that
|
||||
Major Component, or to implement a Standard Interface for which an
|
||||
implementation is available to the public in source code form. A
|
||||
"Major Component", in this context, means a major essential component
|
||||
(kernel, window system, and so on) of the specific operating system
|
||||
(if any) on which the executable work runs, or a compiler used to
|
||||
produce the work, or an object code interpreter used to run it.
|
||||
|
||||
The "Corresponding Source" for a work in object code form means all
|
||||
the source code needed to generate, install, and (for an executable
|
||||
work) run the object code and to modify the work, including scripts to
|
||||
control those activities. However, it does not include the work's
|
||||
System Libraries, or general-purpose tools or generally available free
|
||||
programs which are used unmodified in performing those activities but
|
||||
which are not part of the work. For example, Corresponding Source
|
||||
includes interface definition files associated with source files for
|
||||
the work, and the source code for shared libraries and dynamically
|
||||
linked subprograms that the work is specifically designed to require,
|
||||
such as by intimate data communication or control flow between those
|
||||
subprograms and other parts of the work.
|
||||
|
||||
The Corresponding Source need not include anything that users
|
||||
can regenerate automatically from other parts of the Corresponding
|
||||
Source.
|
||||
|
||||
The Corresponding Source for a work in source code form is that
|
||||
same work.
|
||||
|
||||
2. Basic Permissions.
|
||||
|
||||
All rights granted under this License are granted for the term of
|
||||
copyright on the Program, and are irrevocable provided the stated
|
||||
conditions are met. This License explicitly affirms your unlimited
|
||||
permission to run the unmodified Program. The output from running a
|
||||
covered work is covered by this License only if the output, given its
|
||||
content, constitutes a covered work. This License acknowledges your
|
||||
rights of fair use or other equivalent, as provided by copyright law.
|
||||
|
||||
You may make, run and propagate covered works that you do not
|
||||
convey, without conditions so long as your license otherwise remains
|
||||
in force. You may convey covered works to others for the sole purpose
|
||||
of having them make modifications exclusively for you, or provide you
|
||||
with facilities for running those works, provided that you comply with
|
||||
the terms of this License in conveying all material for which you do
|
||||
not control copyright. Those thus making or running the covered works
|
||||
for you must do so exclusively on your behalf, under your direction
|
||||
and control, on terms that prohibit them from making any copies of
|
||||
your copyrighted material outside their relationship with you.
|
||||
|
||||
Conveying under any other circumstances is permitted solely under
|
||||
the conditions stated below. Sublicensing is not allowed; section 10
|
||||
makes it unnecessary.
|
||||
|
||||
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||
|
||||
No covered work shall be deemed part of an effective technological
|
||||
measure under any applicable law fulfilling obligations under article
|
||||
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||
similar laws prohibiting or restricting circumvention of such
|
||||
measures.
|
||||
|
||||
When you convey a covered work, you waive any legal power to forbid
|
||||
circumvention of technological measures to the extent such circumvention
|
||||
is effected by exercising rights under this License with respect to
|
||||
the covered work, and you disclaim any intention to limit operation or
|
||||
modification of the work as a means of enforcing, against the work's
|
||||
users, your or third parties' legal rights to forbid circumvention of
|
||||
technological measures.
|
||||
|
||||
4. Conveying Verbatim Copies.
|
||||
|
||||
You may convey verbatim copies of the Program's source code as you
|
||||
receive it, in any medium, provided that you conspicuously and
|
||||
appropriately publish on each copy an appropriate copyright notice;
|
||||
keep intact all notices stating that this License and any
|
||||
non-permissive terms added in accord with section 7 apply to the code;
|
||||
keep intact all notices of the absence of any warranty; and give all
|
||||
recipients a copy of this License along with the Program.
|
||||
|
||||
You may charge any price or no price for each copy that you convey,
|
||||
and you may offer support or warranty protection for a fee.
|
||||
|
||||
5. Conveying Modified Source Versions.
|
||||
|
||||
You may convey a work based on the Program, or the modifications to
|
||||
produce it from the Program, in the form of source code under the
|
||||
terms of section 4, provided that you also meet all of these conditions:
|
||||
|
||||
a) The work must carry prominent notices stating that you modified
|
||||
it, and giving a relevant date.
|
||||
|
||||
b) The work must carry prominent notices stating that it is
|
||||
released under this License and any conditions added under section
|
||||
7. This requirement modifies the requirement in section 4 to
|
||||
"keep intact all notices".
|
||||
|
||||
c) You must license the entire work, as a whole, under this
|
||||
License to anyone who comes into possession of a copy. This
|
||||
License will therefore apply, along with any applicable section 7
|
||||
additional terms, to the whole of the work, and all its parts,
|
||||
regardless of how they are packaged. This License gives no
|
||||
permission to license the work in any other way, but it does not
|
||||
invalidate such permission if you have separately received it.
|
||||
|
||||
d) If the work has interactive user interfaces, each must display
|
||||
Appropriate Legal Notices; however, if the Program has interactive
|
||||
interfaces that do not display Appropriate Legal Notices, your
|
||||
work need not make them do so.
|
||||
|
||||
A compilation of a covered work with other separate and independent
|
||||
works, which are not by their nature extensions of the covered work,
|
||||
and which are not combined with it such as to form a larger program,
|
||||
in or on a volume of a storage or distribution medium, is called an
|
||||
"aggregate" if the compilation and its resulting copyright are not
|
||||
used to limit the access or legal rights of the compilation's users
|
||||
beyond what the individual works permit. Inclusion of a covered work
|
||||
in an aggregate does not cause this License to apply to the other
|
||||
parts of the aggregate.
|
||||
|
||||
6. Conveying Non-Source Forms.
|
||||
|
||||
You may convey a covered work in object code form under the terms
|
||||
of sections 4 and 5, provided that you also convey the
|
||||
machine-readable Corresponding Source under the terms of this License,
|
||||
in one of these ways:
|
||||
|
||||
a) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by the
|
||||
Corresponding Source fixed on a durable physical medium
|
||||
customarily used for software interchange.
|
||||
|
||||
b) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by a
|
||||
written offer, valid for at least three years and valid for as
|
||||
long as you offer spare parts or customer support for that product
|
||||
model, to give anyone who possesses the object code either (1) a
|
||||
copy of the Corresponding Source for all the software in the
|
||||
product that is covered by this License, on a durable physical
|
||||
medium customarily used for software interchange, for a price no
|
||||
more than your reasonable cost of physically performing this
|
||||
conveying of source, or (2) access to copy the
|
||||
Corresponding Source from a network server at no charge.
|
||||
|
||||
c) Convey individual copies of the object code with a copy of the
|
||||
written offer to provide the Corresponding Source. This
|
||||
alternative is allowed only occasionally and noncommercially, and
|
||||
only if you received the object code with such an offer, in accord
|
||||
with subsection 6b.
|
||||
|
||||
d) Convey the object code by offering access from a designated
|
||||
place (gratis or for a charge), and offer equivalent access to the
|
||||
Corresponding Source in the same way through the same place at no
|
||||
further charge. You need not require recipients to copy the
|
||||
Corresponding Source along with the object code. If the place to
|
||||
copy the object code is a network server, the Corresponding Source
|
||||
may be on a different server (operated by you or a third party)
|
||||
that supports equivalent copying facilities, provided you maintain
|
||||
clear directions next to the object code saying where to find the
|
||||
Corresponding Source. Regardless of what server hosts the
|
||||
Corresponding Source, you remain obligated to ensure that it is
|
||||
available for as long as needed to satisfy these requirements.
|
||||
|
||||
e) Convey the object code using peer-to-peer transmission, provided
|
||||
you inform other peers where the object code and Corresponding
|
||||
Source of the work are being offered to the general public at no
|
||||
charge under subsection 6d.
|
||||
|
||||
A separable portion of the object code, whose source code is excluded
|
||||
from the Corresponding Source as a System Library, need not be
|
||||
included in conveying the object code work.
|
||||
|
||||
A "User Product" is either (1) a "consumer product", which means any
|
||||
tangible personal property which is normally used for personal, family,
|
||||
or household purposes, or (2) anything designed or sold for incorporation
|
||||
into a dwelling. In determining whether a product is a consumer product,
|
||||
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||
product received by a particular user, "normally used" refers to a
|
||||
typical or common use of that class of product, regardless of the status
|
||||
of the particular user or of the way in which the particular user
|
||||
actually uses, or expects or is expected to use, the product. A product
|
||||
is a consumer product regardless of whether the product has substantial
|
||||
commercial, industrial or non-consumer uses, unless such uses represent
|
||||
the only significant mode of use of the product.
|
||||
|
||||
"Installation Information" for a User Product means any methods,
|
||||
procedures, authorization keys, or other information required to install
|
||||
and execute modified versions of a covered work in that User Product from
|
||||
a modified version of its Corresponding Source. The information must
|
||||
suffice to ensure that the continued functioning of the modified object
|
||||
code is in no case prevented or interfered with solely because
|
||||
modification has been made.
|
||||
|
||||
If you convey an object code work under this section in, or with, or
|
||||
specifically for use in, a User Product, and the conveying occurs as
|
||||
part of a transaction in which the right of possession and use of the
|
||||
User Product is transferred to the recipient in perpetuity or for a
|
||||
fixed term (regardless of how the transaction is characterized), the
|
||||
Corresponding Source conveyed under this section must be accompanied
|
||||
by the Installation Information. But this requirement does not apply
|
||||
if neither you nor any third party retains the ability to install
|
||||
modified object code on the User Product (for example, the work has
|
||||
been installed in ROM).
|
||||
|
||||
The requirement to provide Installation Information does not include a
|
||||
requirement to continue to provide support service, warranty, or updates
|
||||
for a work that has been modified or installed by the recipient, or for
|
||||
the User Product in which it has been modified or installed. Access to a
|
||||
network may be denied when the modification itself materially and
|
||||
adversely affects the operation of the network or violates the rules and
|
||||
protocols for communication across the network.
|
||||
|
||||
Corresponding Source conveyed, and Installation Information provided,
|
||||
in accord with this section must be in a format that is publicly
|
||||
documented (and with an implementation available to the public in
|
||||
source code form), and must require no special password or key for
|
||||
unpacking, reading or copying.
|
||||
|
||||
7. Additional Terms.
|
||||
|
||||
"Additional permissions" are terms that supplement the terms of this
|
||||
License by making exceptions from one or more of its conditions.
|
||||
Additional permissions that are applicable to the entire Program shall
|
||||
be treated as though they were included in this License, to the extent
|
||||
that they are valid under applicable law. If additional permissions
|
||||
apply only to part of the Program, that part may be used separately
|
||||
under those permissions, but the entire Program remains governed by
|
||||
this License without regard to the additional permissions.
|
||||
|
||||
When you convey a copy of a covered work, you may at your option
|
||||
remove any additional permissions from that copy, or from any part of
|
||||
it. (Additional permissions may be written to require their own
|
||||
removal in certain cases when you modify the work.) You may place
|
||||
additional permissions on material, added by you to a covered work,
|
||||
for which you have or can give appropriate copyright permission.
|
||||
|
||||
Notwithstanding any other provision of this License, for material you
|
||||
add to a covered work, you may (if authorized by the copyright holders of
|
||||
that material) supplement the terms of this License with terms:
|
||||
|
||||
a) Disclaiming warranty or limiting liability differently from the
|
||||
terms of sections 15 and 16 of this License; or
|
||||
|
||||
b) Requiring preservation of specified reasonable legal notices or
|
||||
author attributions in that material or in the Appropriate Legal
|
||||
Notices displayed by works containing it; or
|
||||
|
||||
c) Prohibiting misrepresentation of the origin of that material, or
|
||||
requiring that modified versions of such material be marked in
|
||||
reasonable ways as different from the original version; or
|
||||
|
||||
d) Limiting the use for publicity purposes of names of licensors or
|
||||
authors of the material; or
|
||||
|
||||
e) Declining to grant rights under trademark law for use of some
|
||||
trade names, trademarks, or service marks; or
|
||||
|
||||
f) Requiring indemnification of licensors and authors of that
|
||||
material by anyone who conveys the material (or modified versions of
|
||||
it) with contractual assumptions of liability to the recipient, for
|
||||
any liability that these contractual assumptions directly impose on
|
||||
those licensors and authors.
|
||||
|
||||
All other non-permissive additional terms are considered "further
|
||||
restrictions" within the meaning of section 10. If the Program as you
|
||||
received it, or any part of it, contains a notice stating that it is
|
||||
governed by this License along with a term that is a further
|
||||
restriction, you may remove that term. If a license document contains
|
||||
a further restriction but permits relicensing or conveying under this
|
||||
License, you may add to a covered work material governed by the terms
|
||||
of that license document, provided that the further restriction does
|
||||
not survive such relicensing or conveying.
|
||||
|
||||
If you add terms to a covered work in accord with this section, you
|
||||
must place, in the relevant source files, a statement of the
|
||||
additional terms that apply to those files, or a notice indicating
|
||||
where to find the applicable terms.
|
||||
|
||||
Additional terms, permissive or non-permissive, may be stated in the
|
||||
form of a separately written license, or stated as exceptions;
|
||||
the above requirements apply either way.
|
||||
|
||||
8. Termination.
|
||||
|
||||
You may not propagate or modify a covered work except as expressly
|
||||
provided under this License. Any attempt otherwise to propagate or
|
||||
modify it is void, and will automatically terminate your rights under
|
||||
this License (including any patent licenses granted under the third
|
||||
paragraph of section 11).
|
||||
|
||||
However, if you cease all violation of this License, then your
|
||||
license from a particular copyright holder is reinstated (a)
|
||||
provisionally, unless and until the copyright holder explicitly and
|
||||
finally terminates your license, and (b) permanently, if the copyright
|
||||
holder fails to notify you of the violation by some reasonable means
|
||||
prior to 60 days after the cessation.
|
||||
|
||||
Moreover, your license from a particular copyright holder is
|
||||
reinstated permanently if the copyright holder notifies you of the
|
||||
violation by some reasonable means, this is the first time you have
|
||||
received notice of violation of this License (for any work) from that
|
||||
copyright holder, and you cure the violation prior to 30 days after
|
||||
your receipt of the notice.
|
||||
|
||||
Termination of your rights under this section does not terminate the
|
||||
licenses of parties who have received copies or rights from you under
|
||||
this License. If your rights have been terminated and not permanently
|
||||
reinstated, you do not qualify to receive new licenses for the same
|
||||
material under section 10.
|
||||
|
||||
9. Acceptance Not Required for Having Copies.
|
||||
|
||||
You are not required to accept this License in order to receive or
|
||||
run a copy of the Program. Ancillary propagation of a covered work
|
||||
occurring solely as a consequence of using peer-to-peer transmission
|
||||
to receive a copy likewise does not require acceptance. However,
|
||||
nothing other than this License grants you permission to propagate or
|
||||
modify any covered work. These actions infringe copyright if you do
|
||||
not accept this License. Therefore, by modifying or propagating a
|
||||
covered work, you indicate your acceptance of this License to do so.
|
||||
|
||||
10. Automatic Licensing of Downstream Recipients.
|
||||
|
||||
Each time you convey a covered work, the recipient automatically
|
||||
receives a license from the original licensors, to run, modify and
|
||||
propagate that work, subject to this License. You are not responsible
|
||||
for enforcing compliance by third parties with this License.
|
||||
|
||||
An "entity transaction" is a transaction transferring control of an
|
||||
organization, or substantially all assets of one, or subdividing an
|
||||
organization, or merging organizations. If propagation of a covered
|
||||
work results from an entity transaction, each party to that
|
||||
transaction who receives a copy of the work also receives whatever
|
||||
licenses to the work the party's predecessor in interest had or could
|
||||
give under the previous paragraph, plus a right to possession of the
|
||||
Corresponding Source of the work from the predecessor in interest, if
|
||||
the predecessor has it or can get it with reasonable efforts.
|
||||
|
||||
You may not impose any further restrictions on the exercise of the
|
||||
rights granted or affirmed under this License. For example, you may
|
||||
not impose a license fee, royalty, or other charge for exercise of
|
||||
rights granted under this License, and you may not initiate litigation
|
||||
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||
any patent claim is infringed by making, using, selling, offering for
|
||||
sale, or importing the Program or any portion of it.
|
||||
|
||||
11. Patents.
|
||||
|
||||
A "contributor" is a copyright holder who authorizes use under this
|
||||
License of the Program or a work on which the Program is based. The
|
||||
work thus licensed is called the contributor's "contributor version".
|
||||
|
||||
A contributor's "essential patent claims" are all patent claims
|
||||
owned or controlled by the contributor, whether already acquired or
|
||||
hereafter acquired, that would be infringed by some manner, permitted
|
||||
by this License, of making, using, or selling its contributor version,
|
||||
but do not include claims that would be infringed only as a
|
||||
consequence of further modification of the contributor version. For
|
||||
purposes of this definition, "control" includes the right to grant
|
||||
patent sublicenses in a manner consistent with the requirements of
|
||||
this License.
|
||||
|
||||
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||
patent license under the contributor's essential patent claims, to
|
||||
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||
propagate the contents of its contributor version.
|
||||
|
||||
In the following three paragraphs, a "patent license" is any express
|
||||
agreement or commitment, however denominated, not to enforce a patent
|
||||
(such as an express permission to practice a patent or covenant not to
|
||||
sue for patent infringement). To "grant" such a patent license to a
|
||||
party means to make such an agreement or commitment not to enforce a
|
||||
patent against the party.
|
||||
|
||||
If you convey a covered work, knowingly relying on a patent license,
|
||||
and the Corresponding Source of the work is not available for anyone
|
||||
to copy, free of charge and under the terms of this License, through a
|
||||
publicly available network server or other readily accessible means,
|
||||
then you must either (1) cause the Corresponding Source to be so
|
||||
available, or (2) arrange to deprive yourself of the benefit of the
|
||||
patent license for this particular work, or (3) arrange, in a manner
|
||||
consistent with the requirements of this License, to extend the patent
|
||||
license to downstream recipients. "Knowingly relying" means you have
|
||||
actual knowledge that, but for the patent license, your conveying the
|
||||
covered work in a country, or your recipient's use of the covered work
|
||||
in a country, would infringe one or more identifiable patents in that
|
||||
country that you have reason to believe are valid.
|
||||
|
||||
If, pursuant to or in connection with a single transaction or
|
||||
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||
covered work, and grant a patent license to some of the parties
|
||||
receiving the covered work authorizing them to use, propagate, modify
|
||||
or convey a specific copy of the covered work, then the patent license
|
||||
you grant is automatically extended to all recipients of the covered
|
||||
work and works based on it.
|
||||
|
||||
A patent license is "discriminatory" if it does not include within
|
||||
the scope of its coverage, prohibits the exercise of, or is
|
||||
conditioned on the non-exercise of one or more of the rights that are
|
||||
specifically granted under this License. You may not convey a covered
|
||||
work if you are a party to an arrangement with a third party that is
|
||||
in the business of distributing software, under which you make payment
|
||||
to the third party based on the extent of your activity of conveying
|
||||
the work, and under which the third party grants, to any of the
|
||||
parties who would receive the covered work from you, a discriminatory
|
||||
patent license (a) in connection with copies of the covered work
|
||||
conveyed by you (or copies made from those copies), or (b) primarily
|
||||
for and in connection with specific products or compilations that
|
||||
contain the covered work, unless you entered into that arrangement,
|
||||
or that patent license was granted, prior to 28 March 2007.
|
||||
|
||||
Nothing in this License shall be construed as excluding or limiting
|
||||
any implied license or other defenses to infringement that may
|
||||
otherwise be available to you under applicable patent law.
|
||||
|
||||
12. No Surrender of Others' Freedom.
|
||||
|
||||
If conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot convey a
|
||||
covered work so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you may
|
||||
not convey it at all. For example, if you agree to terms that obligate you
|
||||
to collect a royalty for further conveying from those to whom you convey
|
||||
the Program, the only way you could satisfy both those terms and this
|
||||
License would be to refrain entirely from conveying the Program.
|
||||
|
||||
13. Use with the GNU Affero General Public License.
|
||||
|
||||
Notwithstanding any other provision of this License, you have
|
||||
permission to link or combine any covered work with a work licensed
|
||||
under version 3 of the GNU Affero General Public License into a single
|
||||
combined work, and to convey the resulting work. The terms of this
|
||||
License will continue to apply to the part which is the covered work,
|
||||
but the special requirements of the GNU Affero General Public License,
|
||||
section 13, concerning interaction through a network will apply to the
|
||||
combination as such.
|
||||
|
||||
14. Revised Versions of this License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions of
|
||||
the GNU General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the
|
||||
Program specifies that a certain numbered version of the GNU General
|
||||
Public License "or any later version" applies to it, you have the
|
||||
option of following the terms and conditions either of that numbered
|
||||
version or of any later version published by the Free Software
|
||||
Foundation. If the Program does not specify a version number of the
|
||||
GNU General Public License, you may choose any version ever published
|
||||
by the Free Software Foundation.
|
||||
|
||||
If the Program specifies that a proxy can decide which future
|
||||
versions of the GNU General Public License can be used, that proxy's
|
||||
public statement of acceptance of a version permanently authorizes you
|
||||
to choose that version for the Program.
|
||||
|
||||
Later license versions may give you additional or different
|
||||
permissions. However, no additional obligations are imposed on any
|
||||
author or copyright holder as a result of your choosing to follow a
|
||||
later version.
|
||||
|
||||
15. Disclaimer of Warranty.
|
||||
|
||||
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
||||
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
||||
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
||||
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. Limitation of Liability.
|
||||
|
||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
||||
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
||||
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
||||
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
||||
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
||||
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGES.
|
||||
|
||||
17. Interpretation of Sections 15 and 16.
|
||||
|
||||
If the disclaimer of warranty and limitation of liability provided
|
||||
above cannot be given local legal effect according to their terms,
|
||||
reviewing courts shall apply local law that most closely approximates
|
||||
an absolute waiver of all civil liability in connection with the
|
||||
Program, unless a warranty or assumption of liability accompanies a
|
||||
copy of the Program in return for a fee.
|
||||
|
||||
----------------
|
||||
commons-lang License
|
||||
----------------
|
||||
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright [yyyy] [name of copyright owner]
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
|
||||
----------------
|
||||
LuckPerms License
|
||||
----------------
|
||||
|
||||
MIT License
|
||||
|
||||
Copyright (c) lucko (Luck) <luck@lucko.me>
|
||||
Copyright (c) contributors
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
@@ -0,0 +1,144 @@
|
||||

|
||||
|
||||
# BuildSystem   [](https://discord.com/rduPF3yk62)
|
||||
|
||||
## Table of contents
|
||||
|
||||
* [Introduction](#introduction)
|
||||
* [Links and Contacts](#links-and-contacts)
|
||||
* [Features](#features)
|
||||
* [Statistics](#statistics)
|
||||
* [Developer API](#developer-api)
|
||||
* [Contributing](#contributing)
|
||||
* [To compile...](#to-compile)
|
||||
* [Then you will find...](#then-you-will-find)
|
||||
* [Other commands](#other-commands)
|
||||
* [PR Policy](#pr-policy)
|
||||
* [License](#license)
|
||||
|
||||
## Introduction
|
||||
|
||||
**BuildSystem** is a simple but powerful - as the name already says - system for builders, with lots
|
||||
of great features for everyday usage. Manage worlds in the worlds navigator, change their permission, projects and
|
||||
status with ease. And not to forget: let each player decide which settings whey think are best for them and now the
|
||||
building can start!
|
||||
|
||||
## Links and Contacts
|
||||
|
||||
* **Full guide:**
|
||||
You can find a full guide with tutorials, commands and
|
||||
permissions [here](https://eintosti.gitbook.io/buildsystem/).
|
||||
* **Downloads:**
|
||||
* [SpigotMC](https://spigotmc.org/resources/buildsystem-1-8-1-18.60441/)
|
||||
* [Chunkfactory](https://chunkfactory.com/product/buildsystem-1-8-1-15.1049/)
|
||||
* [MC-Market](https://www.mc-market.org/resources/12399/)
|
||||
* Snapshots are available on [Jenkins](https://ci.eintosti.de/job/BuildSystem/).
|
||||
* **Support:**
|
||||
* [GitHub issue tracker](https://github.com/einTosti/BuildSystem/issues)
|
||||
* [Discord](https://discord.gg/rduPF3yk62)
|
||||
* **Donations:**
|
||||
Donations are **100%** voluntary. However, I am truly grateful for every single one of you who
|
||||
decides to do so as
|
||||
each donation helps me to continue developing the project further. If you wish to donate anything,
|
||||
you can do
|
||||
so [here](https://einTosti.com/donate).
|
||||
|
||||
## Features
|
||||
|
||||
* **100% customisable messages** and scoreboard
|
||||
* Powerful navigator which allows for an overview of all worlds. Extra GUIs for:
|
||||
- **_Not Started_**, **_In Progress_**, **_Almost Finished_** and **_Finished_** maps
|
||||
- Maps that have been put to the **_Archive_**
|
||||
- **_Private_** player maps: Each player can create their own map, if a map with their name
|
||||
doesn't exist
|
||||
* **Create worlds with ease**: When creating a world, choose from:
|
||||
- **_Predefined worlds_** _or_
|
||||
- **_Custom generators_** provided by 3rd party plugins _or_
|
||||
- **_Custom templates_** which you can add yourself
|
||||
* Easily **manage your worlds**: Choose from over 6 different statuses for each world
|
||||
* When in worlds that are set as finished, the player is invisible and can fly in adventure mode, so
|
||||
they can only have
|
||||
a look without breaking anything [bypass: `/build`]
|
||||
* Set the **permission** you need to join a worlds
|
||||
* Change what project each world is for (e.g. `"A small BedWars map"`)
|
||||
* Set the **world item**, so you can spot them faster amongst other worlds
|
||||
- You can choose from all items that are available in Minecraft
|
||||
* **Import**, **delete** and **create worlds** with ease
|
||||
* New and improved navigator!
|
||||
- Not a GUI anymore, but furthermore an interactive navigator
|
||||
- But if you rather have a "normal" GUI, the option is there for you to toggle between the
|
||||
* **Per player settings**
|
||||
* **Building tools**:
|
||||
- Toggle block physics
|
||||
- Custom speed
|
||||
- Receive player skulls
|
||||
- Change the time in a world with only a single command
|
||||
- Toggle double slab breaking
|
||||
- No-Clip
|
||||
- Open iron doors and iron trapdoors
|
||||
- Night vision
|
||||
- Disable interactions with certain blocks
|
||||
|
||||
## Statistics
|
||||
|
||||

|
||||
|
||||
## Developer API
|
||||
|
||||
**Maven:**
|
||||
|
||||
```xml
|
||||
|
||||
<dependency>
|
||||
<groupId>de.eintosti</groupId>
|
||||
<artifactId>buildsystem-api</artifactId>
|
||||
<version>version</version>
|
||||
</dependency>
|
||||
```
|
||||
|
||||
**Or alternatively, with Gradle:**
|
||||
|
||||
```kotlin
|
||||
repositories {
|
||||
mavenCentral()
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compileOnly("de.eintosti:buildsystem-api:version")
|
||||
}
|
||||
```
|
||||
|
||||
## Contributing
|
||||
|
||||
### To compile...
|
||||
|
||||
#### On Windows
|
||||
|
||||
1. Shift + right-click the folder with the directory’s files and click "Open command prompt".
|
||||
2. `gradlew clean build`
|
||||
|
||||
#### On Linux, BSD, or Mac OS X
|
||||
|
||||
1. In your terminal, navigate to the folder with directory’s files (cd /folder/of/buildsystem/files)
|
||||
2. `./gradlew clean build`
|
||||
|
||||
### Then you will find...
|
||||
|
||||
* the **BuildSystem** plugin jar `BuildSystem-<identifier>` in **buildsystem-core/build/libs**
|
||||
|
||||
### Other commands
|
||||
|
||||
* `gradlew idea` will generate an [IntelliJ IDEA](https://www.jetbrains.com/idea/) module for each
|
||||
folder.
|
||||
* `gradlew eclipse` will generate an [Eclipse](https://www.eclipse.org/downloads/) project for each
|
||||
folder. _(Possibly broken!)_
|
||||
|
||||
### PR Policy
|
||||
|
||||
I'll accept changes that make sense. You should be able to justify their existence, along with any
|
||||
maintenance costs
|
||||
that come with them.
|
||||
|
||||
## License
|
||||
|
||||
This project is licensed under the [GNU General Public License v3.0](LICENSE.txt).
|
||||
@@ -0,0 +1,12 @@
|
||||
plugins {
|
||||
id("io.github.gradle-nexus.publish-plugin") version "2.0.0"
|
||||
}
|
||||
|
||||
nexusPublishing {
|
||||
repositories {
|
||||
sonatype {
|
||||
nexusUrl.set(uri("https://ossrh-staging-api.central.sonatype.com/service/local/"))
|
||||
snapshotRepositoryUrl.set(uri("https://central.sonatype.com/repository/maven-snapshots/"))
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
import java.util.*
|
||||
|
||||
plugins {
|
||||
`kotlin-dsl`
|
||||
}
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
gradlePluginPortal()
|
||||
}
|
||||
|
||||
val properties = Properties().also { props ->
|
||||
project.projectDir.resolveSibling("gradle.properties").bufferedReader().use {
|
||||
props.load(it)
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation(gradleApi())
|
||||
}
|
||||
|
||||
kotlin {
|
||||
jvmToolchain {
|
||||
this.languageVersion.set(JavaLanguageVersion.of(21))
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
import org.gradle.api.Project
|
||||
import org.gradle.api.plugins.JavaPluginExtension
|
||||
import org.gradle.api.tasks.compile.JavaCompile
|
||||
import org.gradle.jvm.toolchain.JavaLanguageVersion
|
||||
import org.gradle.kotlin.dsl.repositories
|
||||
import org.gradle.kotlin.dsl.the
|
||||
import org.gradle.kotlin.dsl.withType
|
||||
|
||||
fun Project.applyCommonConfiguration() {
|
||||
group = rootProject.group
|
||||
version = rootProject.version
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
maven {
|
||||
name = "Spigot"
|
||||
url = uri("https://hub.spigotmc.org/nexus/content/repositories/snapshots/")
|
||||
}
|
||||
maven {
|
||||
name = "PaperMC"
|
||||
url = uri("https://repo.papermc.io/repository/maven-public/")
|
||||
}
|
||||
maven {
|
||||
name = "OSS Sonatype Snapshots"
|
||||
url = uri("https://oss.sonatype.org/content/repositories/snapshots/")
|
||||
}
|
||||
mavenLocal()
|
||||
}
|
||||
|
||||
plugins.withId("java") {
|
||||
the<JavaPluginExtension>().apply {
|
||||
toolchain {
|
||||
languageVersion.set(JavaLanguageVersion.of(21))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
tasks.withType<JavaCompile> {
|
||||
options.encoding = Charsets.UTF_8.name()
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
import org.gradle.api.Project
|
||||
import org.gradle.api.artifacts.dsl.RepositoryHandler
|
||||
import org.gradle.api.plugins.JavaPluginExtension
|
||||
import org.gradle.kotlin.dsl.apply
|
||||
import org.gradle.kotlin.dsl.ivy
|
||||
import org.gradle.kotlin.dsl.the
|
||||
|
||||
fun Project.applyCoreConfiguration() {
|
||||
applyCommonConfiguration()
|
||||
|
||||
apply(plugin = "java")
|
||||
apply(plugin = "eclipse")
|
||||
apply(plugin = "idea")
|
||||
|
||||
if (name in setOf("buildsystem-core")) {
|
||||
the<JavaPluginExtension>().withSourcesJar()
|
||||
}
|
||||
}
|
||||
|
||||
fun RepositoryHandler.modrinthMavenWorkaround(nameOrId: String, version: String, fileName: String) {
|
||||
val url = "https://api.modrinth.com/maven/maven/modrinth/$nameOrId/$version/$fileName"
|
||||
val group = "maven.modrinth.workaround"
|
||||
ivy(url.substringBeforeLast('/')) {
|
||||
name = "Modrinth Maven Workaround for $nameOrId"
|
||||
patternLayout { artifact(url.substringAfterLast('/')) }
|
||||
metadataSources { artifact() }
|
||||
content { includeModule(group, nameOrId) }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
applyCommonConfiguration()
|
||||
|
||||
plugins {
|
||||
id("java")
|
||||
id("maven-publish")
|
||||
id("signing")
|
||||
}
|
||||
|
||||
project.description = "API"
|
||||
|
||||
dependencies {
|
||||
compileOnly(libs.spigot)
|
||||
compileOnly(libs.xseries)
|
||||
compileOnly(libs.annotations)
|
||||
compileOnly(libs.jspecify)
|
||||
}
|
||||
|
||||
java {
|
||||
withSourcesJar()
|
||||
withJavadocJar()
|
||||
}
|
||||
|
||||
|
||||
|
||||
publishing {
|
||||
publications {
|
||||
create<MavenPublication>("mavenJava") {
|
||||
from(components["java"])
|
||||
|
||||
pom {
|
||||
name.set("BuildSystem API")
|
||||
description.set("API for the BuildSystem Minecraft plugin.")
|
||||
url.set("https://github.com/thomasmny/BuildSystem")
|
||||
|
||||
licenses {
|
||||
license {
|
||||
name.set("GNU General Public License, Version 3")
|
||||
url.set("https://www.gnu.org/licenses/gpl-3.0.txt")
|
||||
distribution.set("repo")
|
||||
}
|
||||
}
|
||||
developers {
|
||||
developer {
|
||||
id.set("thomasmny")
|
||||
name.set("Thomas Meaney")
|
||||
email.set("thomas.meaney@icloud.com")
|
||||
}
|
||||
}
|
||||
scm {
|
||||
connection.set("scm:git:git://github.com/thomasmny/BuildSystem.git")
|
||||
developerConnection.set("scm:git:ssh://github.com:thomasmny/BuildSystem.git")
|
||||
url.set("https://github.com/thomasmny/BuildSystem")
|
||||
tag.set(project.version.toString())
|
||||
}
|
||||
issueManagement {
|
||||
system.set("GitHub")
|
||||
url.set("https://github.com/thomasmny/BuildSystem/issues")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
signing {
|
||||
val signingKeyId: String? by project
|
||||
val signingKey: String? by project
|
||||
val signingPassword: String? by project
|
||||
|
||||
useInMemoryPgpKeys(signingKeyId, signingKey, signingPassword)
|
||||
isRequired = true
|
||||
sign(publishing.publications["mavenJava"])
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
<body>
|
||||
<p>
|
||||
BuildSystem is a utility plugin targeted towards build-teams.
|
||||
It allows worlds to be easily managed and also provides handy tools to assist with building.
|
||||
</p>
|
||||
<h1>Useful Links</h1>
|
||||
<ul>
|
||||
<li><a target="_top" href="https://buildsystem.eintosti.de">Project Website</a></li>
|
||||
<li><a target="_top" href="https://github.com/thomasmny/BuildSystem">Source Code</a></li>
|
||||
</ul>
|
||||
</body>
|
||||
@@ -0,0 +1,47 @@
|
||||
/*
|
||||
* Copyright (c) 2018-2025, Thomas Meaney
|
||||
* Copyright (c) contributors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package de.eintosti.buildsystem.api;
|
||||
|
||||
import de.eintosti.buildsystem.api.player.BuildPlayer;
|
||||
import de.eintosti.buildsystem.api.player.PlayerService;
|
||||
import de.eintosti.buildsystem.api.world.BuildWorld;
|
||||
import de.eintosti.buildsystem.api.world.WorldService;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
|
||||
/**
|
||||
* The BuildSystem API.
|
||||
*
|
||||
* @since 3.0.0
|
||||
*/
|
||||
@NullMarked
|
||||
public interface BuildSystem {
|
||||
|
||||
/**
|
||||
* Gets the {@link WorldService}, responsible for managing {@link BuildWorld} instances.
|
||||
*
|
||||
* @return The world manager
|
||||
*/
|
||||
WorldService getWorldService();
|
||||
|
||||
/**
|
||||
* Gets the {@link PlayerService}, responsible for managing {@link BuildPlayer} instances.
|
||||
*
|
||||
* @return The player manager
|
||||
*/
|
||||
PlayerService getPlayerService();
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
/*
|
||||
* Copyright (c) 2018-2025, Thomas Meaney
|
||||
* Copyright (c) contributors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package de.eintosti.buildsystem.api;
|
||||
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
|
||||
/**
|
||||
* Provides static access to the {@link BuildSystem} API.
|
||||
*
|
||||
* @since 3.0.0
|
||||
*/
|
||||
@NullMarked
|
||||
public class BuildSystemProvider {
|
||||
|
||||
@Nullable
|
||||
private static BuildSystem instance = null;
|
||||
|
||||
/**
|
||||
* Sole private constructor to prevent instantiation.
|
||||
*
|
||||
* @throws AssertionError Always, as this class is not meant to be instantiated
|
||||
*/
|
||||
@ApiStatus.Internal
|
||||
private BuildSystemProvider() {
|
||||
throw new AssertionError("This class is not meant to be instantiated");
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets an instance of the {@link BuildSystem} API.
|
||||
*
|
||||
* @return An instance of the BuildSystem API
|
||||
* @throws IllegalStateException if the API is not loaded yet
|
||||
*/
|
||||
public static BuildSystem get() {
|
||||
BuildSystem instance = BuildSystemProvider.instance;
|
||||
if (instance == null) {
|
||||
throw new IllegalStateException("BuildSystem has not loaded yet!");
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
|
||||
@ApiStatus.Internal
|
||||
static void register(BuildSystem instance) {
|
||||
BuildSystemProvider.instance = instance;
|
||||
}
|
||||
|
||||
@ApiStatus.Internal
|
||||
static void unregister() {
|
||||
BuildSystemProvider.instance = null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
/*
|
||||
* Copyright (c) 2018-2025, Thomas Meaney
|
||||
* Copyright (c) contributors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package de.eintosti.buildsystem.api.data;
|
||||
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
|
||||
/**
|
||||
* A {@link Capability} that marks a {@link Type} as being bypassable with a specific permission.
|
||||
*
|
||||
* @param permission The permission node required to bypass this type
|
||||
* @since 3.0.1
|
||||
*/
|
||||
@NullMarked
|
||||
public record Bypassable(String permission) implements Capability {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
/*
|
||||
* Copyright (c) 2018-2025, Thomas Meaney
|
||||
* Copyright (c) contributors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package de.eintosti.buildsystem.api.data;
|
||||
|
||||
/**
|
||||
* A marker interface for a "capability" or "attachment" that can be added to a {@link Type}.
|
||||
*
|
||||
* @since 3.0.1
|
||||
*/
|
||||
public interface Capability {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
/*
|
||||
* Copyright (c) 2018-2025, Thomas Meaney
|
||||
* Copyright (c) contributors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package de.eintosti.buildsystem.api.data;
|
||||
|
||||
import java.util.function.BooleanSupplier;
|
||||
import java.util.function.Supplier;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
/**
|
||||
* A {@link Capability} that marks a {@link Type} as being overridable by an external source.
|
||||
*
|
||||
* @param <T> The type of the value being overridden
|
||||
* @param isEnabled A supplier that returns {@code true} if the override is active
|
||||
* @param provider A supplier that returns the override value or {@code null} if no override is set
|
||||
* @since 3.0.1
|
||||
*/
|
||||
@NullMarked
|
||||
public record Overridable<T>(
|
||||
BooleanSupplier isEnabled,
|
||||
Supplier<@Nullable T> provider
|
||||
) implements Capability {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,98 @@
|
||||
/*
|
||||
* Copyright (c) 2018-2025, Thomas Meaney
|
||||
* Copyright (c) contributors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package de.eintosti.buildsystem.api.data;
|
||||
|
||||
import org.jetbrains.annotations.Contract;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
|
||||
/**
|
||||
* A generic interface representing a configurable data type.
|
||||
*
|
||||
* @param <T> The type of the value held by this data point
|
||||
*/
|
||||
@NullMarked
|
||||
public interface Type<T> {
|
||||
|
||||
/**
|
||||
* An immutable implementation of the {@link Type} interface using a Java Record. This class holds a final, read-only value.
|
||||
*
|
||||
* @param <T> The type of the value held
|
||||
* @param value The immutable value
|
||||
*/
|
||||
record ImmutableType<T>(T value) implements Type<T> {
|
||||
|
||||
/**
|
||||
* Gets the immutable value.
|
||||
*
|
||||
* @return The value
|
||||
*/
|
||||
@Override
|
||||
public T get() {
|
||||
return value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Throws {@link UnsupportedOperationException} as this type is immutable.
|
||||
*
|
||||
* @param value The value to set (which is ignored)
|
||||
* @throws UnsupportedOperationException Always, as this type cannot be modified
|
||||
*/
|
||||
@Contract("_ -> fail")
|
||||
@Override
|
||||
public void set(T value) {
|
||||
throw new UnsupportedOperationException("This Type is immutable and cannot be modified.");
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the immutable value formatted for storage.
|
||||
*
|
||||
* @return The immutable value
|
||||
*/
|
||||
@Override
|
||||
public Object getConfigFormat() {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* An immutable {@link Type} representing the boolean value {@code true}.
|
||||
*/
|
||||
Type<Boolean> TRUE = new ImmutableType<>(true);
|
||||
|
||||
/**
|
||||
* Gets the current value of this data point.
|
||||
*
|
||||
* @return The current value
|
||||
*/
|
||||
T get();
|
||||
|
||||
/**
|
||||
* Sets the value of this data point.
|
||||
*
|
||||
* @param value The new value to set
|
||||
*/
|
||||
void set(T value);
|
||||
|
||||
/**
|
||||
* Gets the value of this data point formatted for storage in a configuration file.
|
||||
* This might involve converting complex objects into simpler types (e.g., enums to strings).
|
||||
*
|
||||
* @return The value formatted for a config file
|
||||
*/
|
||||
Object getConfigFormat();
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
/*
|
||||
* Copyright (c) 2018-2025, Thomas Meaney
|
||||
* Copyright (c) contributors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Provides interfaces for events related to the BuildSystem API. These events allow external plugins to hook into and react to various actions within the BuildSystem.
|
||||
*/
|
||||
package de.eintosti.buildsystem.api.event;
|
||||
@@ -0,0 +1,70 @@
|
||||
/*
|
||||
* Copyright (c) 2018-2025, Thomas Meaney
|
||||
* Copyright (c) contributors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package de.eintosti.buildsystem.api.event.world;
|
||||
|
||||
import de.eintosti.buildsystem.api.world.BuildWorld;
|
||||
import org.bukkit.event.Event;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.jetbrains.annotations.ApiStatus.Internal;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
|
||||
/**
|
||||
* Represents a {@link BuildWorld} related event.
|
||||
*
|
||||
* @since 3.0.0
|
||||
*/
|
||||
@NullMarked
|
||||
public class BuildWorldEvent extends Event {
|
||||
|
||||
private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
|
||||
private final BuildWorld buildWorld;
|
||||
|
||||
/**
|
||||
* Constructs a new {@link BuildWorldEvent}.
|
||||
*
|
||||
* @param buildWorld The {@link BuildWorld} involved in this event
|
||||
*/
|
||||
@Internal
|
||||
public BuildWorldEvent(BuildWorld buildWorld) {
|
||||
this.buildWorld = buildWorld;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the {@link BuildWorld} involved in this event
|
||||
*
|
||||
* @return The world involved in this event
|
||||
*/
|
||||
public BuildWorld getBuildWorld() {
|
||||
return buildWorld;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return HANDLER_LIST;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the handler list for this event.
|
||||
*
|
||||
* @return The handler list
|
||||
*/
|
||||
public static HandlerList getHandlerList() {
|
||||
return HANDLER_LIST;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
/*
|
||||
* Copyright (c) 2018-2025, Thomas Meaney
|
||||
* Copyright (c) contributors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package de.eintosti.buildsystem.api.event.world;
|
||||
|
||||
import de.eintosti.buildsystem.api.world.BuildWorld;
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.jetbrains.annotations.ApiStatus.Internal;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
|
||||
/**
|
||||
* Called when a {@link BuildWorld} is loaded.
|
||||
*
|
||||
* @since 3.0.0
|
||||
*/
|
||||
@NullMarked
|
||||
public class BuildWorldLoadEvent extends BuildWorldEvent implements Cancellable {
|
||||
|
||||
private boolean cancelled = false;
|
||||
|
||||
/**
|
||||
* Constructs a new {@link BuildWorldLoadEvent}.
|
||||
*
|
||||
* @param buildWorld The {@link BuildWorld} that is about to be loaded
|
||||
*/
|
||||
@Internal
|
||||
public BuildWorldLoadEvent(BuildWorld buildWorld) {
|
||||
super(buildWorld);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCancelled() {
|
||||
return cancelled;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCancelled(boolean cancel) {
|
||||
this.cancelled = cancel;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
/*
|
||||
* Copyright (c) 2018-2025, Thomas Meaney
|
||||
* Copyright (c) contributors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package de.eintosti.buildsystem.api.event.world;
|
||||
|
||||
import de.eintosti.buildsystem.api.world.BuildWorld;
|
||||
import org.jetbrains.annotations.ApiStatus.Internal;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
|
||||
/**
|
||||
* Called after a {@link BuildWorld} has loaded.
|
||||
*
|
||||
* @since 3.0.0
|
||||
*/
|
||||
@NullMarked
|
||||
public class BuildWorldPostLoadEvent extends BuildWorldEvent {
|
||||
|
||||
/**
|
||||
* Constructs a new {@link BuildWorldPostLoadEvent}.
|
||||
*
|
||||
* @param buildWorld The {@link BuildWorld} that has been loaded
|
||||
*/
|
||||
@Internal
|
||||
public BuildWorldPostLoadEvent(BuildWorld buildWorld) {
|
||||
super(buildWorld);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
/*
|
||||
* Copyright (c) 2018-2025, Thomas Meaney
|
||||
* Copyright (c) contributors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package de.eintosti.buildsystem.api.event.world;
|
||||
|
||||
import de.eintosti.buildsystem.api.world.BuildWorld;
|
||||
import org.jetbrains.annotations.ApiStatus.Internal;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
|
||||
/**
|
||||
* Called after a {@link BuildWorld} has unloaded.
|
||||
*
|
||||
* @since 3.0.0
|
||||
*/
|
||||
@NullMarked
|
||||
public class BuildWorldPostUnloadEvent extends BuildWorldEvent {
|
||||
|
||||
/**
|
||||
* Constructs a new {@link BuildWorldPostUnloadEvent}.
|
||||
*
|
||||
* @param buildWorld The {@link BuildWorld} that has been unloaded
|
||||
*/
|
||||
@Internal
|
||||
public BuildWorldPostUnloadEvent(BuildWorld buildWorld) {
|
||||
super(buildWorld);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
/*
|
||||
* Copyright (c) 2018-2025, Thomas Meaney
|
||||
* Copyright (c) contributors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package de.eintosti.buildsystem.api.event.world;
|
||||
|
||||
import de.eintosti.buildsystem.api.world.BuildWorld;
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.jetbrains.annotations.ApiStatus.Internal;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
|
||||
/**
|
||||
* Called when a {@link BuildWorld} is unloaded.
|
||||
*
|
||||
* @since 3.0.0
|
||||
*/
|
||||
@NullMarked
|
||||
public class BuildWorldUnloadEvent extends BuildWorldEvent implements Cancellable {
|
||||
|
||||
private boolean cancelled = false;
|
||||
|
||||
/**
|
||||
* Constructs a new {@link BuildWorldUnloadEvent}.
|
||||
*
|
||||
* @param buildWorld The {@link BuildWorld} that is about to be unloaded
|
||||
*/
|
||||
@Internal
|
||||
public BuildWorldUnloadEvent(BuildWorld buildWorld) {
|
||||
super(buildWorld);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCancelled() {
|
||||
return cancelled;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCancelled(boolean cancel) {
|
||||
this.cancelled = cancel;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,105 @@
|
||||
/*
|
||||
* Copyright (c) 2018-2025, Thomas Meaney
|
||||
* Copyright (c) contributors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package de.eintosti.buildsystem.api.event.world;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.bukkit.event.player.PlayerEvent;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
|
||||
/**
|
||||
* Called when a player's build mode is toggled. This event can be triggered by the player themselves or by another plugin/player.
|
||||
*/
|
||||
@NullMarked
|
||||
public class PlayerBuildModeToggleEvent extends PlayerEvent implements Cancellable {
|
||||
|
||||
private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
|
||||
private final boolean buildMode;
|
||||
private final Player causer;
|
||||
private boolean cancelled;
|
||||
|
||||
/**
|
||||
* Constructs a new {@link PlayerBuildModeToggleEvent}.
|
||||
*
|
||||
* @param who The player whose build mode is being toggled
|
||||
* @param buildMode The new build mode status ({@code true} for enabled, {@code false} for disabled)
|
||||
* @param causer The player who caused the build mode to be toggled
|
||||
*/
|
||||
public PlayerBuildModeToggleEvent(Player who, boolean buildMode, Player causer) {
|
||||
super(who);
|
||||
this.buildMode = buildMode;
|
||||
this.causer = causer;
|
||||
this.cancelled = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the new build mode status.
|
||||
*
|
||||
* @return {@code true} if build mode is being enabled, {@code false} otherwise
|
||||
*/
|
||||
public boolean isBuildMode() {
|
||||
return this.buildMode;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the player who caused the build mode to be toggled.
|
||||
* <p>
|
||||
* This will return the player themselves if they toggled their own build mode.
|
||||
*
|
||||
* @return The player who caused the action, or null.
|
||||
*/
|
||||
public Player getCauser() {
|
||||
return this.causer;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the cancellation state of this event. A cancelled event will not be executed in the server, but will still pass to other plugins
|
||||
*
|
||||
* @return true if this event is cancelled
|
||||
*/
|
||||
@Override
|
||||
public boolean isCancelled() {
|
||||
return this.cancelled;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the cancellation state of this event. A cancelled event will not be executed in the server, but will still pass to other plugins.
|
||||
*
|
||||
* @param cancel true if you wish to cancel this event
|
||||
*/
|
||||
@Override
|
||||
public void setCancelled(boolean cancel) {
|
||||
this.cancelled = cancel;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return HANDLER_LIST;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the handler list for this event.
|
||||
*
|
||||
* @return The handler list
|
||||
*/
|
||||
public static HandlerList getHandlerList() {
|
||||
return HANDLER_LIST;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
/*
|
||||
* Copyright (c) 2018-2025, Thomas Meaney
|
||||
* Copyright (c) contributors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Events relating to a {@link de.eintosti.buildsystem.api.world.BuildWorld}.
|
||||
*/
|
||||
package de.eintosti.buildsystem.api.event.world;
|
||||
@@ -0,0 +1,36 @@
|
||||
/*
|
||||
* Copyright (c) 2018-2025, Thomas Meaney
|
||||
* Copyright (c) contributors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package de.eintosti.buildsystem.api.exception;
|
||||
|
||||
/**
|
||||
* Thrown when an error occurs during the deletion of a world.
|
||||
*
|
||||
* @since 3.0.0
|
||||
*/
|
||||
public class WorldDeletionException extends WorldException {
|
||||
|
||||
/**
|
||||
* Constructs a new {@link WorldDeletionException} with the specified message and cause.
|
||||
*
|
||||
* @param message The detail message
|
||||
* @param cause The cause of the exception
|
||||
*/
|
||||
public WorldDeletionException(String message, Throwable cause) {
|
||||
super(message, cause);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
/*
|
||||
* Copyright (c) 2018-2025, Thomas Meaney
|
||||
* Copyright (c) contributors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package de.eintosti.buildsystem.api.exception;
|
||||
|
||||
/**
|
||||
* Thrown when a world's directory is not found at the expected path.
|
||||
*
|
||||
* @since 3.0.0
|
||||
*/
|
||||
public class WorldDirectoryNotFoundException extends WorldException {
|
||||
|
||||
/**
|
||||
* Constructs a new {@link WorldDirectoryNotFoundException} with the specified world name and path.
|
||||
*
|
||||
* @param worldName The name of the world
|
||||
* @param path The path to the expected world directory
|
||||
*/
|
||||
public WorldDirectoryNotFoundException(String worldName, String path) {
|
||||
super("World directory for '" + worldName + "' not found at: " + path);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
/*
|
||||
* Copyright (c) 2018-2025, Thomas Meaney
|
||||
* Copyright (c) contributors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package de.eintosti.buildsystem.api.exception;
|
||||
|
||||
/**
|
||||
* The base exception for all world-related errors in the BuildSystem API.
|
||||
*
|
||||
* @since 3.0.0
|
||||
*/
|
||||
public class WorldException extends RuntimeException {
|
||||
|
||||
/**
|
||||
* Constructs a new {@link WorldException} with the specified detail message.
|
||||
*
|
||||
* @param message The detail message
|
||||
*/
|
||||
public WorldException(String message) {
|
||||
super(message);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a new {@link WorldException} with the specified detail message and cause.
|
||||
*
|
||||
* @param message The detail message
|
||||
* @param cause The cause of the exception
|
||||
*/
|
||||
public WorldException(String message, Throwable cause) {
|
||||
super(message, cause);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
/*
|
||||
* Copyright (c) 2018-2025, Thomas Meaney
|
||||
* Copyright (c) contributors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package de.eintosti.buildsystem.api.exception;
|
||||
|
||||
/**
|
||||
* Thrown when a requested world cannot be found.
|
||||
*
|
||||
* @since 3.0.0
|
||||
*/
|
||||
public class WorldNotFoundException extends WorldException {
|
||||
|
||||
/**
|
||||
* Constructs a new {@link WorldNotFoundException} with the specified world name.
|
||||
*
|
||||
* @param worldName The name of the world that was not found
|
||||
*/
|
||||
public WorldNotFoundException(String worldName) {
|
||||
super("World '" + worldName + "' does not exist.");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
/*
|
||||
* Copyright (c) 2018-2025, Thomas Meaney
|
||||
* Copyright (c) contributors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Provides interfaces for events related to the BuildSystem API. These events allow external plugins to hook into and react to various actions within the BuildSystem.
|
||||
*/
|
||||
package de.eintosti.buildsystem.api;
|
||||
@@ -0,0 +1,114 @@
|
||||
/*
|
||||
* Copyright (c) 2018-2025, Thomas Meaney
|
||||
* Copyright (c) contributors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package de.eintosti.buildsystem.api.player;
|
||||
|
||||
import de.eintosti.buildsystem.api.player.settings.Settings;
|
||||
import de.eintosti.buildsystem.api.world.display.NavigatorCategory;
|
||||
import java.util.UUID;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.jetbrains.annotations.ApiStatus.Internal;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
/**
|
||||
* Represents a player managed by the BuildSystem. This interface provides access to player-specific data and settings within the BuildSystem.
|
||||
*/
|
||||
@NullMarked
|
||||
public interface BuildPlayer {
|
||||
|
||||
/**
|
||||
* Gets the unique-id of the player.
|
||||
* <p>
|
||||
* Should match the wrapped {@link Player}'s UUID.
|
||||
*
|
||||
* @return The player's UUID
|
||||
* @see Player#getUniqueId()
|
||||
*/
|
||||
UUID getUniqueId();
|
||||
|
||||
/**
|
||||
* Gets the player's custom settings.
|
||||
*
|
||||
* @return The player's settings
|
||||
*/
|
||||
Settings getSettings();
|
||||
|
||||
/**
|
||||
* Gets values that are supposed to be cached for a short amount of time.
|
||||
*
|
||||
* @return The player's cached values
|
||||
*/
|
||||
@Internal
|
||||
CachedValues getCachedValues();
|
||||
|
||||
/**
|
||||
* Gets the location where the player was last before logging off.
|
||||
*
|
||||
* @return The location
|
||||
*/
|
||||
@Internal
|
||||
@Nullable
|
||||
LogoutLocation getLogoutLocation();
|
||||
|
||||
/**
|
||||
* Sets the location where the player was last before logging off.
|
||||
*
|
||||
* @param logoutLocation The logout location
|
||||
*/
|
||||
@Internal
|
||||
void setLogoutLocation(@Nullable LogoutLocation logoutLocation);
|
||||
|
||||
/**
|
||||
* Gets the location the player was last at.
|
||||
* <p>
|
||||
* Usually this is the last location before teleportation.
|
||||
*
|
||||
* @return The player's previous location
|
||||
*/
|
||||
@Internal
|
||||
@Nullable
|
||||
Location getPreviousLocation();
|
||||
|
||||
/**
|
||||
* Sets the location the player was last at.
|
||||
* <p>
|
||||
* Usually this is the last location before teleportation.
|
||||
*
|
||||
* @param location The location
|
||||
*/
|
||||
@Internal
|
||||
void setPreviousLocation(@Nullable Location location);
|
||||
|
||||
/**
|
||||
* Gets the {@link NavigatorCategory} the player last looked at.
|
||||
*
|
||||
* @return The last looked navigator inventory type
|
||||
*/
|
||||
@Internal
|
||||
@Nullable
|
||||
NavigatorCategory getLastLookedAt();
|
||||
|
||||
/**
|
||||
* Sets the {@link NavigatorCategory} the player last looked at.
|
||||
*
|
||||
* @param type The last looked navigator inventory type
|
||||
*/
|
||||
@Internal
|
||||
void setLastLookedAt(@Nullable NavigatorCategory type);
|
||||
}
|
||||
@@ -0,0 +1,97 @@
|
||||
/*
|
||||
* Copyright (c) 2018-2025, Thomas Meaney
|
||||
* Copyright (c) contributors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package de.eintosti.buildsystem.api.player;
|
||||
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.jetbrains.annotations.ApiStatus.Internal;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
|
||||
/**
|
||||
* Interface for managing cached values of a player.
|
||||
*
|
||||
* @since 3.0.0
|
||||
*/
|
||||
@Internal
|
||||
@NullMarked
|
||||
public interface CachedValues {
|
||||
|
||||
/**
|
||||
* Saves the given {@link GameMode} to be restored later.
|
||||
*
|
||||
* @param gameMode The game mode to save
|
||||
*/
|
||||
void saveGameMode(GameMode gameMode);
|
||||
|
||||
/**
|
||||
* Resets the player's game mode to the previously saved one, if present.
|
||||
*
|
||||
* @param player The player whose game mode is to be reset
|
||||
*/
|
||||
void resetGameModeIfPresent(Player player);
|
||||
|
||||
/**
|
||||
* Saves the given inventory contents to be restored later.
|
||||
*
|
||||
* @param inventory The inventory contents to save
|
||||
*/
|
||||
void saveInventory(ItemStack[] inventory);
|
||||
|
||||
/**
|
||||
* Resets the player's inventory to the previously saved one, if present.
|
||||
*
|
||||
* @param player The player whose inventory is to be reset
|
||||
*/
|
||||
void resetInventoryIfPresent(Player player);
|
||||
|
||||
/**
|
||||
* Saves the given walk speed to be restored later.
|
||||
*
|
||||
* @param walkSpeed The walk speed to save
|
||||
*/
|
||||
void saveWalkSpeed(float walkSpeed);
|
||||
|
||||
/**
|
||||
* Resets the player's walk speed to the previously saved one, if present.
|
||||
*
|
||||
* @param player The player whose walk speed is to be reset
|
||||
*/
|
||||
void resetWalkSpeedIfPresent(Player player);
|
||||
|
||||
/**
|
||||
* Saves the given fly speed to be restored later.
|
||||
*
|
||||
* @param flySpeed The fly speed to save
|
||||
*/
|
||||
void saveFlySpeed(float flySpeed);
|
||||
|
||||
/**
|
||||
* Resets the player's fly speed to the previously saved one, if present.
|
||||
*
|
||||
* @param player The player whose fly speed is to be reset
|
||||
*/
|
||||
void resetFlySpeedIfPresent(Player player);
|
||||
|
||||
/**
|
||||
* Resets all cached values for the given player.
|
||||
*
|
||||
* @param player The player whose cached values are to be reset
|
||||
*/
|
||||
void resetCachedValues(Player player);
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
/*
|
||||
* Copyright (c) 2018-2025, Thomas Meaney
|
||||
* Copyright (c) contributors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package de.eintosti.buildsystem.api.player;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.jetbrains.annotations.ApiStatus.Internal;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
/**
|
||||
* Represents a player's logout location, which includes the world name and the location coordinates.
|
||||
*
|
||||
* @since 3.0.0
|
||||
*/
|
||||
@Internal
|
||||
@NullMarked
|
||||
public interface LogoutLocation {
|
||||
|
||||
/**
|
||||
* Gets the name of the world the player logged out from.
|
||||
*
|
||||
* @return The world name
|
||||
*/
|
||||
String worldName();
|
||||
|
||||
/**
|
||||
* Gets the exact {@link Location} the player logged out from.
|
||||
*
|
||||
* @return The logout location
|
||||
*/
|
||||
@Nullable
|
||||
Location location();
|
||||
}
|
||||
@@ -0,0 +1,88 @@
|
||||
/*
|
||||
* Copyright (c) 2018-2025, Thomas Meaney
|
||||
* Copyright (c) contributors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package de.eintosti.buildsystem.api.player;
|
||||
|
||||
import de.eintosti.buildsystem.api.storage.PlayerStorage;
|
||||
import de.eintosti.buildsystem.api.world.BuildWorld;
|
||||
import de.eintosti.buildsystem.api.world.data.Visibility;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
|
||||
/**
|
||||
* Service for managing {@link BuildPlayer}.
|
||||
*
|
||||
* @since 3.0.0
|
||||
*/
|
||||
@NullMarked
|
||||
public interface PlayerService {
|
||||
|
||||
/**
|
||||
* Gets the {@link PlayerStorage} implementation for managing {@link BuildPlayer} persistence.
|
||||
*
|
||||
* @return The {@link PlayerStorage} implementation
|
||||
*/
|
||||
PlayerStorage getPlayerStorage();
|
||||
|
||||
/**
|
||||
* Gets a set of all players currently in "build mode".
|
||||
*
|
||||
* @return A set of all players in "build mode".
|
||||
* @see #isInBuildMode(Player)
|
||||
*/
|
||||
Set<UUID> getBuildModePlayers();
|
||||
|
||||
/**
|
||||
* Gets whether a player is currently in "build mode".
|
||||
*
|
||||
* @param player The player
|
||||
* @return {@code true} if the player is in "build mode", otherwise {@code false}
|
||||
*/
|
||||
boolean isInBuildMode(Player player);
|
||||
|
||||
/**
|
||||
* Gets whether the given player is allowed to create a new {@link BuildWorld}.<br> This depends on the following factors:
|
||||
* <ul>
|
||||
* <li>Is the maximum number of worlds set by the config lower than the number of existing worlds?</li>
|
||||
* <li>Is the maximum number of worlds created by the player less than the number of worlds said player is allowed to create?</li>
|
||||
* </ul>
|
||||
*
|
||||
* @param player The player trying to create a world
|
||||
* @param visibility The visibility of the world trying to be created
|
||||
* @return {@code true} if the player is allowed to create a world, otherwise {@code false}
|
||||
*/
|
||||
boolean canCreateWorld(Player player, Visibility visibility);
|
||||
|
||||
/**
|
||||
* Returns the maximum amount of {@link BuildWorld}s a player can create.
|
||||
* <p>
|
||||
* If the player has the permission {@code buildsystem.admin}, unlimited worlds can be created. Otherwise, there are two different permissions to set said amount:
|
||||
* <p>
|
||||
* To set the maximum of...
|
||||
* <ul>
|
||||
* <li>...public worlds, use {@code buildsystem.create.public.%amount%}.
|
||||
* <li>...private worlds, use {@code buildsystem.create.private.%amount%}.
|
||||
* </ul>
|
||||
*
|
||||
* @param player The player object
|
||||
* @param visibility The visibility of the worlds to check the maximum of. Possible values: {@link Visibility#PUBLIC} or {@link Visibility#PRIVATE}
|
||||
* @return If set, the maximum number of worlds a player can create, otherwise -1
|
||||
*/
|
||||
int getMaxWorlds(Player player, Visibility visibility);
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
/*
|
||||
* Copyright (c) 2018-2025, Thomas Meaney
|
||||
* Copyright (c) contributors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Provides interfaces and classes related to {@link de.eintosti.buildsystem.api.player.BuildPlayer} management within the BuildSystem API. This includes player-specific data,
|
||||
* settings, and cached values.
|
||||
*/
|
||||
package de.eintosti.buildsystem.api.player;
|
||||
@@ -0,0 +1,123 @@
|
||||
/*
|
||||
* Copyright (c) 2018-2025, Thomas Meaney
|
||||
* Copyright (c) contributors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package de.eintosti.buildsystem.api.player.settings;
|
||||
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
|
||||
/**
|
||||
* A {@link DesignColor} is the color which glass panes are tinted to in different menus.
|
||||
*
|
||||
* @since 3.0.0
|
||||
*/
|
||||
@NullMarked
|
||||
public enum DesignColor {
|
||||
|
||||
/**
|
||||
* The color red.
|
||||
*/
|
||||
RED,
|
||||
|
||||
/**
|
||||
* The color orange.
|
||||
*/
|
||||
ORANGE,
|
||||
|
||||
/**
|
||||
* The color yellow.
|
||||
*/
|
||||
YELLOW,
|
||||
|
||||
/**
|
||||
* The color pink.
|
||||
*/
|
||||
PINK,
|
||||
|
||||
/**
|
||||
* The color magenta.
|
||||
*/
|
||||
MAGENTA,
|
||||
|
||||
/**
|
||||
* The color purple.
|
||||
*/
|
||||
PURPLE,
|
||||
|
||||
/**
|
||||
* The color brown.
|
||||
*/
|
||||
BROWN,
|
||||
|
||||
/**
|
||||
* The color lime.
|
||||
*/
|
||||
LIME,
|
||||
|
||||
/**
|
||||
* The color green.
|
||||
*/
|
||||
GREEN,
|
||||
|
||||
/**
|
||||
* The color blue.
|
||||
*/
|
||||
BLUE,
|
||||
|
||||
/**
|
||||
* The color cyan.
|
||||
*/
|
||||
CYAN,
|
||||
|
||||
/**
|
||||
* The color light blue.
|
||||
*/
|
||||
LIGHT_BLUE,
|
||||
|
||||
/**
|
||||
* The color white.
|
||||
*/
|
||||
WHITE,
|
||||
|
||||
/**
|
||||
* The color gray.
|
||||
*/
|
||||
GRAY,
|
||||
|
||||
/**
|
||||
* The color light gray.
|
||||
*/
|
||||
LIGHT_GRAY,
|
||||
|
||||
/**
|
||||
* The color black.
|
||||
*/
|
||||
BLACK;
|
||||
|
||||
/**
|
||||
* Gets the {@link DesignColor} from a string.
|
||||
*
|
||||
* @param colorName The name of the color
|
||||
* @return The {@link DesignColor} or {@link DesignColor#BLACK} if the color does not exist
|
||||
*/
|
||||
public static DesignColor matchColor(String colorName) {
|
||||
try {
|
||||
return valueOf(colorName);
|
||||
} catch (IllegalArgumentException e) {
|
||||
return DesignColor.BLACK;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,259 @@
|
||||
/*
|
||||
* Copyright (c) 2018-2025, Thomas Meaney
|
||||
* Copyright (c) contributors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package de.eintosti.buildsystem.api.player.settings;
|
||||
|
||||
import de.eintosti.buildsystem.api.player.BuildPlayer;
|
||||
import de.eintosti.buildsystem.api.world.navigator.settings.NavigatorType;
|
||||
import de.eintosti.buildsystem.api.world.navigator.settings.WorldDisplay;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
import org.bukkit.scheduler.BukkitTask;
|
||||
import org.jetbrains.annotations.ApiStatus.Internal;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
/**
|
||||
* Different settings a {@link BuildPlayer} can modify for themselves.
|
||||
*
|
||||
* @since 3.0.0
|
||||
*/
|
||||
@NullMarked
|
||||
public interface Settings {
|
||||
|
||||
/**
|
||||
* Gets the mode the navigator is set to.
|
||||
*
|
||||
* @return The navigator type
|
||||
*/
|
||||
NavigatorType getNavigatorType();
|
||||
|
||||
/**
|
||||
* Sets the navigator type.
|
||||
* <p>
|
||||
* The {@link NavigatorType#OLD} is the classic chest menu, whereas {@link NavigatorType#NEW} is a new 3D selector.
|
||||
*
|
||||
* @param navigatorType The navigator type
|
||||
*/
|
||||
void setNavigatorType(NavigatorType navigatorType);
|
||||
|
||||
/**
|
||||
* Gets the design color used in menus.
|
||||
*
|
||||
* @return The design color
|
||||
*/
|
||||
DesignColor getDesignColor();
|
||||
|
||||
/**
|
||||
* Sets the design color used in menus.
|
||||
*
|
||||
* @param designColor The design color
|
||||
*/
|
||||
void setDesignColor(DesignColor designColor);
|
||||
|
||||
/**
|
||||
* Gets the set of rules by which worlds are displayed in the navigator.
|
||||
*
|
||||
* @return The world display rules
|
||||
*/
|
||||
WorldDisplay getWorldDisplay();
|
||||
|
||||
/**
|
||||
* Gets whether the player's inventory is to be cleared when joining the server.
|
||||
*
|
||||
* @return {@code true} if enabled, otherwise {@code false}
|
||||
*/
|
||||
boolean isClearInventory();
|
||||
|
||||
/**
|
||||
* Sets whether the player's inventory is to be cleared when joining the server.
|
||||
*
|
||||
* @param clearInventory If the inventory is to be cleared
|
||||
*/
|
||||
void setClearInventory(boolean clearInventory);
|
||||
|
||||
/**
|
||||
* Gets whether the interaction with blocks is disabled.
|
||||
*
|
||||
* @return {@code true} if disabled, otherwise {@code false}
|
||||
*/
|
||||
boolean isDisableInteract();
|
||||
|
||||
/**
|
||||
* Sets whether the interaction with blocks should be disabled.
|
||||
*
|
||||
* @param disableInteract If the interaction with blocks is to be disabled
|
||||
*/
|
||||
void setDisableInteract(boolean disableInteract);
|
||||
|
||||
/**
|
||||
* Gets whether all online players are to be hidden.
|
||||
*
|
||||
* @return {@code true} if enabled, otherwise {@code false}
|
||||
*/
|
||||
boolean isHidePlayers();
|
||||
|
||||
/**
|
||||
* Sets whether all online players are to be hidden.
|
||||
*
|
||||
* @param hidePlayers If the players are to be hidden
|
||||
*/
|
||||
void setHidePlayers(boolean hidePlayers);
|
||||
|
||||
/**
|
||||
* Gets whether signs should be placed without opening the text input.
|
||||
*
|
||||
* @return {@code true} if enabled, otherwise {@code false}
|
||||
*/
|
||||
boolean isInstantPlaceSigns();
|
||||
|
||||
/**
|
||||
* Sets whether signs should be placed without opening the text input.
|
||||
*
|
||||
* @param instantPlaceSigns If signs are to be placed instantly
|
||||
*/
|
||||
void setInstantPlaceSigns(boolean instantPlaceSigns);
|
||||
|
||||
/**
|
||||
* Gets whether the navigator is kept in the player's inventory after a clear.
|
||||
*
|
||||
* @return {@code true} if enabled, otherwise {@code false}
|
||||
*/
|
||||
boolean isKeepNavigator();
|
||||
|
||||
/**
|
||||
* Sets whether the navigator is kept in the player's inventory after a clear.
|
||||
*
|
||||
* @param keepNavigator If the navigator is to kept
|
||||
*/
|
||||
void setKeepNavigator(boolean keepNavigator);
|
||||
|
||||
/**
|
||||
* Gets whether the player has permanent {@link PotionEffectType#NIGHT_VISION}.
|
||||
*
|
||||
* @return {@code true} if enabled, otherwise {@code false}
|
||||
*/
|
||||
boolean isNightVision();
|
||||
|
||||
/**
|
||||
* Sets whether the player has permanent {@link PotionEffectType#NIGHT_VISION}.
|
||||
*
|
||||
* @param nightVision If the night vision is to be enabled
|
||||
*/
|
||||
void setNightVision(boolean nightVision);
|
||||
|
||||
/**
|
||||
* Gets whether fling against a wall puts the player in {@link GameMode#SPECTATOR}.
|
||||
*
|
||||
* @return {@code true} if enabled, otherwise {@code false}
|
||||
*/
|
||||
boolean isNoClip();
|
||||
|
||||
/**
|
||||
* Sets whether fling against a wall puts the player in {@link GameMode#SPECTATOR}.
|
||||
*
|
||||
* @param noClip If no-clip is to be enabled
|
||||
*/
|
||||
void setNoClip(boolean noClip);
|
||||
|
||||
/**
|
||||
* Gets whether plants can be placed anywhere.
|
||||
*
|
||||
* @return {@code true} if enabled, otherwise {@code false}
|
||||
*/
|
||||
boolean isPlacePlants();
|
||||
|
||||
/**
|
||||
* Sets whether plants can be placed anywhere.
|
||||
*
|
||||
* @param placePlants If plants are to be placed anywhere
|
||||
*/
|
||||
void setPlacePlants(boolean placePlants);
|
||||
|
||||
/**
|
||||
* Gets whether the scoreboard is enabled.
|
||||
*
|
||||
* @return {@code true} if enabled, otherwise {@code false}
|
||||
*/
|
||||
boolean isScoreboard();
|
||||
|
||||
/**
|
||||
* Sets whether the scoreboard is enabled.
|
||||
*
|
||||
* @param scoreboard If the scoreboard is to be enabled
|
||||
*/
|
||||
void setScoreboard(boolean scoreboard);
|
||||
|
||||
/**
|
||||
* Gets whether only one half of a slab will be broken when breaking double slabs.
|
||||
*
|
||||
* @return {@code true} if enabled, otherwise {@code false}
|
||||
*/
|
||||
boolean isSlabBreaking();
|
||||
|
||||
/**
|
||||
* Sets whether only one half of a slab will be broken when breaking double slabs.
|
||||
*
|
||||
* @param slabBreaking If precise slab breaking is to be enabled
|
||||
*/
|
||||
void setSlabBreaking(boolean slabBreaking);
|
||||
|
||||
/**
|
||||
* Gets whether the player will be teleported to the spawn, if set, when joining the server.
|
||||
*
|
||||
* @return {@code true} if enabled, otherwise {@code false}
|
||||
*/
|
||||
boolean isSpawnTeleport();
|
||||
|
||||
/**
|
||||
* Sets whether the player will be teleported to the spawn, if set, when joining the server.
|
||||
*
|
||||
* @param spawnTeleport If the player is to be teleported to the spawn
|
||||
*/
|
||||
void setSpawnTeleport(boolean spawnTeleport);
|
||||
|
||||
/**
|
||||
* Gets whether right-clicking iron (trap-)doors will be open/close them.
|
||||
*
|
||||
* @return {@code true} if enabled, otherwise {@code false}
|
||||
*/
|
||||
boolean isOpenTrapDoors();
|
||||
|
||||
/**
|
||||
* Sets whether right-clicking iron (trap-)doors will be open/close them.
|
||||
*
|
||||
* @param openTrapDoors If the iron (trap-)doors are to be opened/closed via right-click
|
||||
*/
|
||||
void setOpenTrapDoors(boolean openTrapDoors);
|
||||
|
||||
/**
|
||||
* Gets the {@link BukkitTask} responsible for updating the player's scoreboard.
|
||||
*
|
||||
* @return The scoreboard task
|
||||
*/
|
||||
@Nullable
|
||||
@Internal
|
||||
BukkitTask getScoreboardTask();
|
||||
|
||||
/**
|
||||
* Sets the {@link BukkitTask} responsible for updating the player's scoreboard.
|
||||
*
|
||||
* @param scoreboardTask The scoreboard task
|
||||
*/
|
||||
@Internal
|
||||
void setScoreboardTask(@Nullable BukkitTask scoreboardTask);
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
/*
|
||||
* Copyright (c) 2018-2025, Thomas Meaney
|
||||
* Copyright (c) contributors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Provides interfaces and enumerations for player-specific settings within the BuildSystem API. This includes customizable options like design colors and various gameplay
|
||||
* preferences.
|
||||
*/
|
||||
package de.eintosti.buildsystem.api.player.settings;
|
||||
@@ -0,0 +1,110 @@
|
||||
/*
|
||||
* Copyright (c) 2018-2025, Thomas Meaney
|
||||
* Copyright (c) contributors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package de.eintosti.buildsystem.api.storage;
|
||||
|
||||
import de.eintosti.buildsystem.api.world.BuildWorld;
|
||||
import de.eintosti.buildsystem.api.world.builder.Builder;
|
||||
import de.eintosti.buildsystem.api.world.display.Folder;
|
||||
import de.eintosti.buildsystem.api.world.display.NavigatorCategory;
|
||||
import java.util.Collection;
|
||||
import org.jetbrains.annotations.Unmodifiable;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
/**
|
||||
* Interface for managing the storage of {@link Folder} objects.
|
||||
*
|
||||
* @since 3.0.0
|
||||
*/
|
||||
@NullMarked
|
||||
public interface FolderStorage extends Storage<Folder> {
|
||||
|
||||
/**
|
||||
* Gets a list of all {@link Folder}s.
|
||||
*
|
||||
* @return An unmodifiable list of all folders
|
||||
*/
|
||||
@Unmodifiable
|
||||
Collection<Folder> getFolders();
|
||||
|
||||
/**
|
||||
* Gets a {@link Folder} by its name (case-insensitive).
|
||||
*
|
||||
* @param name The name of the folder to retrieve
|
||||
* @return The folder if it exists, or {@code null} if it does not
|
||||
*/
|
||||
@Nullable
|
||||
Folder getFolder(String name);
|
||||
|
||||
/**
|
||||
* Checks if a {@link Folder} with the given name (case-insensitive) exists.
|
||||
*
|
||||
* @param name The name of the folder to check
|
||||
* @return {@code true} if the folder exists, {@code false} otherwise
|
||||
*/
|
||||
boolean folderExists(String name);
|
||||
|
||||
/**
|
||||
* Creates a new {@link Folder} with the given name.
|
||||
*
|
||||
* @param name The name folder to create
|
||||
* @param category The category in which the folder should be displayed
|
||||
* @param creator The builder who created the folder
|
||||
* @return The newly created folder
|
||||
*/
|
||||
Folder createFolder(String name, NavigatorCategory category, Builder creator);
|
||||
|
||||
/**
|
||||
* Creates a new nested {@link Folder} with the given name.
|
||||
*
|
||||
* @param name The name folder to create
|
||||
* @param category The category in which the folder should be displayed
|
||||
* @param parent The parent folder, or {@code null} if this is a top-level folder
|
||||
* @param creator The builder who created the folder
|
||||
* @return The newly created folder
|
||||
*/
|
||||
Folder createFolder(String name, NavigatorCategory category, @Nullable Folder parent, Builder creator);
|
||||
|
||||
/**
|
||||
* Removes the {@link Folder} with the given name.
|
||||
* <p>
|
||||
* This operation cascades:
|
||||
* <ul>
|
||||
* <li>All subfolders within the specified folder will also be removed.</li>
|
||||
* <li>Any {@link BuildWorld} instances associated with this folder will have their folder reference unset.</li>
|
||||
* </ul>
|
||||
*
|
||||
* @param name The name of the folder to remove
|
||||
* @see #removeFolder(Folder)
|
||||
*/
|
||||
void removeFolder(String name);
|
||||
|
||||
/**
|
||||
* Removes the given {@link Folder}.
|
||||
* <p>
|
||||
* This operation cascades:
|
||||
* <ul>
|
||||
* <li>All subfolders within the specified folder will also be removed.</li>
|
||||
* <li>Any {@link BuildWorld} instances associated with this folder will have their folder reference unset.</li>
|
||||
* </ul>
|
||||
*
|
||||
* @param folder The folder to remove
|
||||
* @see #removeFolder(String)
|
||||
*/
|
||||
void removeFolder(Folder folder);
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
/*
|
||||
* Copyright (c) 2018-2025, Thomas Meaney
|
||||
* Copyright (c) contributors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package de.eintosti.buildsystem.api.storage;
|
||||
|
||||
import de.eintosti.buildsystem.api.player.BuildPlayer;
|
||||
import java.util.Collection;
|
||||
import java.util.UUID;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.jetbrains.annotations.Unmodifiable;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
/**
|
||||
* Interface for managing the storage of {@link BuildPlayer} objects.
|
||||
*
|
||||
* @since 3.0.0
|
||||
*/
|
||||
@NullMarked
|
||||
public interface PlayerStorage extends Storage<BuildPlayer> {
|
||||
|
||||
/**
|
||||
* Creates a new {@link BuildPlayer} with the given uuid and settings.
|
||||
*
|
||||
* @param uuid The uuid of the player
|
||||
* @return The created build-player
|
||||
*/
|
||||
BuildPlayer createBuildPlayer(UUID uuid);
|
||||
|
||||
/**
|
||||
* Creates a new {@link BuildPlayer} with the given player.
|
||||
*
|
||||
* @param player The player
|
||||
* @return The created build-player
|
||||
*/
|
||||
BuildPlayer createBuildPlayer(Player player);
|
||||
|
||||
/**
|
||||
* Gets the {@link BuildPlayer} whose unique-id matches the given uuid.
|
||||
*
|
||||
* @param uuid The uuid of the player
|
||||
* @return The player, if found, otherwise {@code null}
|
||||
*/
|
||||
@Nullable
|
||||
BuildPlayer getBuildPlayer(UUID uuid);
|
||||
|
||||
/**
|
||||
* Gets the {@link BuildPlayer} which wraps the given player.
|
||||
* <p>
|
||||
* If the player is not found, a new {@link BuildPlayer} will be created using {@link #createBuildPlayer(Player)}.
|
||||
*
|
||||
* @param player The wrapped player
|
||||
* @return The player
|
||||
* @see #createBuildPlayer(Player)
|
||||
*/
|
||||
BuildPlayer getBuildPlayer(Player player);
|
||||
|
||||
/**
|
||||
* Gets a collection of all {@link BuildPlayer}s.
|
||||
*
|
||||
* @return A collection of all build-players.
|
||||
*/
|
||||
@Unmodifiable
|
||||
Collection<BuildPlayer> getBuildPlayers();
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
/*
|
||||
* Copyright (c) 2018-2025, Thomas Meaney
|
||||
* Copyright (c) contributors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package de.eintosti.buildsystem.api.storage;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
|
||||
/**
|
||||
* A generic interface for storage operations.
|
||||
*
|
||||
* @param <T> The type of objects to be stored
|
||||
* @since 3.0.0
|
||||
*/
|
||||
@NullMarked
|
||||
public interface Storage<T> {
|
||||
|
||||
/**
|
||||
* Saves the given object to the storage.
|
||||
*
|
||||
* @param object The object to save
|
||||
* @return A {@link CompletableFuture} that completes when the save operation is done
|
||||
*/
|
||||
CompletableFuture<Void> save(T object);
|
||||
|
||||
/**
|
||||
* Saves all the given objects to the storage.
|
||||
*
|
||||
* @param objects The objects to save
|
||||
* @return A {@link CompletableFuture} that completes when the save operation is done
|
||||
*/
|
||||
CompletableFuture<Void> save(Collection<T> objects);
|
||||
|
||||
/**
|
||||
* Loads all objects from the storage.
|
||||
*
|
||||
* @return A {@link CompletableFuture} that completes with a collection of loaded objects
|
||||
*/
|
||||
CompletableFuture<Collection<T>> load();
|
||||
|
||||
/**
|
||||
* Deletes the given object from the storage.
|
||||
*
|
||||
* @param object The object to delete
|
||||
* @return A {@link CompletableFuture} that completes when the deletion finishes
|
||||
*/
|
||||
CompletableFuture<Void> delete(T object);
|
||||
|
||||
/**
|
||||
* Deletes the object with the given key from the storage.
|
||||
*
|
||||
* @param key The key of the object to delete
|
||||
* @return A {@link CompletableFuture} that completes when the deletion finishes
|
||||
*/
|
||||
CompletableFuture<Void> delete(String key);
|
||||
}
|
||||
@@ -0,0 +1,108 @@
|
||||
/*
|
||||
* Copyright (c) 2018-2025, Thomas Meaney
|
||||
* Copyright (c) contributors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package de.eintosti.buildsystem.api.storage;
|
||||
|
||||
import de.eintosti.buildsystem.api.world.BuildWorld;
|
||||
import de.eintosti.buildsystem.api.world.data.Visibility;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.jetbrains.annotations.Unmodifiable;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
/**
|
||||
* Interface for managing the storage of {@link BuildWorld} objects.
|
||||
*
|
||||
* @since 3.0.0
|
||||
*/
|
||||
@NullMarked
|
||||
public interface WorldStorage extends Storage<BuildWorld> {
|
||||
|
||||
/**
|
||||
* Gets the {@link BuildWorld} by the given name.
|
||||
*
|
||||
* @param name The name of the world
|
||||
* @return The world object if one was found, {@code null} otherwise
|
||||
*/
|
||||
@Nullable
|
||||
BuildWorld getBuildWorld(String name);
|
||||
|
||||
/**
|
||||
* Gets the {@link BuildWorld} by the given {@link World}.
|
||||
*
|
||||
* @param world The bukkit world object
|
||||
* @return The world object if one was found, {@code null} otherwise
|
||||
*/
|
||||
@Nullable
|
||||
BuildWorld getBuildWorld(World world);
|
||||
|
||||
/**
|
||||
* Gets the {@link BuildWorld} by the given {@link UUID}.
|
||||
*
|
||||
* @param uuid The build world's unique identifier
|
||||
* @return The world object if one was found, {@code null} otherwise
|
||||
*/
|
||||
@Nullable
|
||||
BuildWorld getBuildWorld(UUID uuid);
|
||||
|
||||
/**
|
||||
* Gets a list of all {@link BuildWorld}s.
|
||||
*
|
||||
* @return An unmodifiable list of all worlds
|
||||
*/
|
||||
@Unmodifiable
|
||||
Collection<BuildWorld> getBuildWorlds();
|
||||
|
||||
/**
|
||||
* Gets a list of {@link BuildWorld}s created by the given player.
|
||||
*
|
||||
* @param player The player who created the worlds
|
||||
* @return A list of worlds created by the player
|
||||
*/
|
||||
@Unmodifiable
|
||||
List<BuildWorld> getBuildWorldsCreatedByPlayer(Player player);
|
||||
|
||||
/**
|
||||
* Gets a list of {@link BuildWorld}s created by the given player with the given visibility.
|
||||
*
|
||||
* @param player The player who created the worlds
|
||||
* @param visibility The visibility of the worlds
|
||||
* @return A list of worlds created by the player with the given visibility
|
||||
*/
|
||||
@Unmodifiable
|
||||
List<BuildWorld> getBuildWorldsCreatedByPlayer(Player player, Visibility visibility);
|
||||
|
||||
/**
|
||||
* Checks if a {@link BuildWorld} with the given name (case-insensitive) exists.
|
||||
*
|
||||
* @param worldName The name of the world to check
|
||||
* @return {@code true} if the world exists, {@code false} otherwise
|
||||
*/
|
||||
boolean worldExists(String worldName);
|
||||
|
||||
/**
|
||||
* Checks if a {@link BuildWorld} exists and if the world folder exists on disk.
|
||||
*
|
||||
* @param worldName The name of the world to check
|
||||
* @return {@code true} if the world exists in the map or on disk, {@code false} otherwise
|
||||
*/
|
||||
boolean worldAndFolderExist(String worldName);
|
||||
}
|
||||
@@ -0,0 +1,188 @@
|
||||
/*
|
||||
* Copyright (c) 2018-2025, Thomas Meaney
|
||||
* Copyright (c) contributors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package de.eintosti.buildsystem.api.world;
|
||||
|
||||
import com.cryptomorin.xseries.profiles.objects.Profileable;
|
||||
import de.eintosti.buildsystem.api.world.builder.Builders;
|
||||
import de.eintosti.buildsystem.api.world.creation.generator.CustomGenerator;
|
||||
import de.eintosti.buildsystem.api.world.data.BuildWorldType;
|
||||
import de.eintosti.buildsystem.api.world.data.WorldData;
|
||||
import de.eintosti.buildsystem.api.world.display.Displayable;
|
||||
import de.eintosti.buildsystem.api.world.display.Folder;
|
||||
import de.eintosti.buildsystem.api.world.util.WorldLoader;
|
||||
import de.eintosti.buildsystem.api.world.util.WorldPermissions;
|
||||
import de.eintosti.buildsystem.api.world.util.WorldTeleporter;
|
||||
import de.eintosti.buildsystem.api.world.util.WorldUnloader;
|
||||
import java.util.UUID;
|
||||
import org.bukkit.Difficulty;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.World;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
/**
|
||||
* Represents a world managed by the BuildSystem plugin, extending the {@link Displayable} interface. This interface provides comprehensive access to world-specific properties,
|
||||
* data, and utility methods.
|
||||
*
|
||||
* @since 3.0.0
|
||||
*/
|
||||
@NullMarked
|
||||
public interface BuildWorld extends Displayable {
|
||||
|
||||
/**
|
||||
* Gets the Bukkit {@link World} associated with this {@link BuildWorld}.
|
||||
*
|
||||
* @return The Bukkit world, or {@code null} if not loaded
|
||||
*/
|
||||
@Nullable
|
||||
World getWorld();
|
||||
|
||||
/**
|
||||
* Gets the unique identifier of this world.
|
||||
* <p>
|
||||
* Not equivalent to {@link World#getUID()}.
|
||||
*
|
||||
* @return The uuid of this world
|
||||
*/
|
||||
UUID getUniqueId();
|
||||
|
||||
/**
|
||||
* Sets the name of this world.
|
||||
*
|
||||
* @param name The name of the world
|
||||
*/
|
||||
void setName(String name);
|
||||
|
||||
/**
|
||||
* Gets the {@link Profileable} representation of this build world which is applied when {@link WorldData#material()} is set to {@link Material#PLAYER_HEAD}.
|
||||
*
|
||||
* @return The {@link Profileable} representation of this build world
|
||||
*/
|
||||
Profileable asProfilable();
|
||||
|
||||
/**
|
||||
* Gets this world's {@link BuildWorldType}.
|
||||
*
|
||||
* @return The type of this world
|
||||
*/
|
||||
BuildWorldType getType();
|
||||
|
||||
/**
|
||||
* Gets this world's {@link WorldData}.
|
||||
*
|
||||
* @return The data of the world
|
||||
*/
|
||||
WorldData getData();
|
||||
|
||||
/**
|
||||
* Gets the custom chunk generator used to generate this world.
|
||||
* <p>
|
||||
* Only set when the world type is {@link BuildWorldType#CUSTOM} or {@link BuildWorldType#IMPORTED}.
|
||||
*
|
||||
* @return The custom chunk generator used to generate this world, or {@code null} if not set
|
||||
*/
|
||||
@Nullable
|
||||
CustomGenerator getCustomGenerator();
|
||||
|
||||
/**
|
||||
* Cycles to the next {@link Difficulty} for this world.
|
||||
* <p>
|
||||
* The cycle order is: {@link Difficulty#PEACEFUL} -> {@link Difficulty#EASY} -> {@link Difficulty#NORMAL} -> {@link Difficulty#HARD} -> {@link Difficulty#PEACEFUL}.
|
||||
*
|
||||
* @return The new difficulty after cycling
|
||||
*/
|
||||
Difficulty cycleDifficulty();
|
||||
|
||||
/**
|
||||
* Gets the {@link Builders} object, which manages all players allowed to modify this world.
|
||||
*
|
||||
* @return The {@link Builders} instance for this world
|
||||
*/
|
||||
Builders getBuilders();
|
||||
|
||||
/**
|
||||
* Gets the time of day in the {@link World} linked to this build world as a formatted string.
|
||||
*
|
||||
* @return This world time as a string (e.g., "Day", "Night")
|
||||
*/
|
||||
String getWorldTime();
|
||||
|
||||
/**
|
||||
* Gets whether this world is currently loaded into server memory, allowing players to enter it.
|
||||
*
|
||||
* @return {@code true} if this world is loaded, otherwise {@code false}
|
||||
*/
|
||||
boolean isLoaded();
|
||||
|
||||
/**
|
||||
* Sets whether this world is currently loaded into server memory.
|
||||
*
|
||||
* @param loaded {@code true} if this world is to be loaded, {@code false} if it should be unloaded
|
||||
*/
|
||||
void setLoaded(boolean loaded);
|
||||
|
||||
/**
|
||||
* Gets the {@link WorldLoader} utility used to manage loading operations for this world.
|
||||
*
|
||||
* @return The {@link WorldLoader} instance
|
||||
*/
|
||||
WorldLoader getLoader();
|
||||
|
||||
/**
|
||||
* Gets the {@link WorldUnloader} utility used to manage unloading operations for this world.
|
||||
*
|
||||
* @return The {@link WorldUnloader} instance
|
||||
*/
|
||||
WorldUnloader getUnloader();
|
||||
|
||||
/**
|
||||
* Gets the {@link WorldTeleporter} utility used to manage teleportation of players to this world.
|
||||
*
|
||||
* @return The {@link WorldTeleporter} instance
|
||||
*/
|
||||
WorldTeleporter getTeleporter();
|
||||
|
||||
/**
|
||||
* Gets the {@link WorldPermissions} associated with this world, which define access and modification rules.
|
||||
*
|
||||
* @return The {@link WorldPermissions} instance for this world
|
||||
*/
|
||||
WorldPermissions getPermissions();
|
||||
|
||||
/**
|
||||
* Gets the {@link Folder} this world is assigned to.
|
||||
*
|
||||
* @return The folder this world is assigned to, or {@code null} if not assigned
|
||||
*/
|
||||
@Nullable
|
||||
Folder getFolder();
|
||||
|
||||
/**
|
||||
* Checks whether this world is assigned to a {@link Folder}.
|
||||
*
|
||||
* @return {@code true} if this world is in any folder, {@code false} otherwise
|
||||
*/
|
||||
boolean isAssignedToFolder();
|
||||
|
||||
/**
|
||||
* Sets the {@link Folder} this world is assigned to.
|
||||
*
|
||||
* @param folder The folder to assign this world to, or {@code null} to remove the assignment
|
||||
*/
|
||||
void setFolder(@Nullable Folder folder);
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
/*
|
||||
* Copyright (c) 2018-2025, Thomas Meaney
|
||||
* Copyright (c) contributors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package de.eintosti.buildsystem.api.world;
|
||||
|
||||
import de.eintosti.buildsystem.api.storage.FolderStorage;
|
||||
import de.eintosti.buildsystem.api.storage.WorldStorage;
|
||||
import de.eintosti.buildsystem.api.world.creation.BuildWorldCreator;
|
||||
import de.eintosti.buildsystem.api.world.display.Folder;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
|
||||
/**
|
||||
* Provides a service for managing world-related operations and data. This interface offers methods to access and interact with world storage and folder management.
|
||||
*
|
||||
* @since 3.0.0
|
||||
*/
|
||||
@NullMarked
|
||||
public interface WorldService {
|
||||
|
||||
/**
|
||||
* Gets the {@link FolderStorage} implementation for managing {@link Folder} persistence.
|
||||
*
|
||||
* @return The folder storage instance
|
||||
*/
|
||||
FolderStorage getFolderStorage();
|
||||
|
||||
/**
|
||||
* Gets the {@link WorldStorage} implementation for managing {@link BuildWorld} persistence.
|
||||
*
|
||||
* @return The world storage instance
|
||||
*/
|
||||
WorldStorage getWorldStorage();
|
||||
|
||||
/**
|
||||
* Creates a new {@link BuildWorldCreator} for the given name.
|
||||
*
|
||||
* @param name The name of the world to create
|
||||
* @return A new {@link BuildWorldCreator} instance for the specified world name
|
||||
*/
|
||||
BuildWorldCreator createWorld(String name);
|
||||
|
||||
/**
|
||||
* Unimport an existing {@link BuildWorld}. In comparison to {@link #deleteWorld(BuildWorld)}, unimporting a world does not delete the world's directory.
|
||||
*
|
||||
* @param buildWorld The world to unimport
|
||||
* @param save Whether to save the world before unloading
|
||||
* @return A future that completes when the unimport operation is finished
|
||||
*/
|
||||
CompletableFuture<Void> unimportWorld(BuildWorld buildWorld, boolean save);
|
||||
|
||||
/**
|
||||
* Delete an existing {@link BuildWorld}. In comparison to {@link #unimportWorld(BuildWorld, boolean)}, deleting a world deletes the world's directory.
|
||||
*
|
||||
* @param buildWorld The world to be deleted
|
||||
* @return A future that completes when the delete operation is finished
|
||||
*/
|
||||
CompletableFuture<Void> deleteWorld(BuildWorld buildWorld);
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
/*
|
||||
* Copyright (c) 2018-2025, Thomas Meaney
|
||||
* Copyright (c) contributors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package de.eintosti.buildsystem.api.world.backup;
|
||||
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
|
||||
/**
|
||||
* Represents a single backup of a {@link de.eintosti.buildsystem.api.world.BuildWorld}.
|
||||
*/
|
||||
@NullMarked
|
||||
public interface Backup {
|
||||
|
||||
/**
|
||||
* Returns the {@link BackupProfile} that owns this backup.
|
||||
*
|
||||
* @return The owner of the backup.
|
||||
*/
|
||||
BackupProfile owner();
|
||||
|
||||
/**
|
||||
* Returns the timestamp when this backup was created.
|
||||
*
|
||||
* @return The creation time in milliseconds since the Unix epoch.
|
||||
*/
|
||||
long creationTime();
|
||||
|
||||
/**
|
||||
* Returns a unique key or identifier for this backup.
|
||||
*
|
||||
* @return The key of the backup.
|
||||
*/
|
||||
String key();
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
/*
|
||||
* Copyright (c) 2023-2025, Thomas Meaney
|
||||
* All rights reserved.
|
||||
*
|
||||
* Unauthorized copying of this file, via any medium is strictly prohibited
|
||||
* Proprietary and confidential
|
||||
*/
|
||||
package de.eintosti.buildsystem.api.world.backup;
|
||||
|
||||
import de.eintosti.buildsystem.api.world.BuildWorld;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
|
||||
/**
|
||||
* Represents a profile for managing backups of a specific {@link BuildWorld}. This interface defines operations related to listing, creating, restoring, and destroying backups.
|
||||
*/
|
||||
@NullMarked
|
||||
public interface BackupProfile {
|
||||
|
||||
/**
|
||||
* Asynchronously populates a list of available {@link Backup}s under this profile.
|
||||
*
|
||||
* @return Future that will be completed with available backups
|
||||
*/
|
||||
CompletableFuture<List<Backup>> listBackups();
|
||||
|
||||
/**
|
||||
* Creates a backup of the {@link BuildWorld}. If the profile is at the maximum backup capacity, the oldest backup will be deleted.
|
||||
*
|
||||
* @return Future that completes with the created backup.
|
||||
*/
|
||||
CompletableFuture<Backup> createBackup();
|
||||
|
||||
/**
|
||||
* Restores a {@link Backup}.
|
||||
*
|
||||
* @param backup Backup to restore
|
||||
* @param player The player restoring the backup
|
||||
*/
|
||||
void restoreBackup(Backup backup, Player player);
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
/*
|
||||
* Copyright (c) 2018-2025, Thomas Meaney
|
||||
* Copyright (c) contributors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package de.eintosti.buildsystem.api.world.backup;
|
||||
|
||||
import de.eintosti.buildsystem.api.world.BuildWorld;
|
||||
import java.io.File;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
|
||||
/**
|
||||
* Represents a storage mechanism for managing world backups.
|
||||
*/
|
||||
@NullMarked
|
||||
public interface BackupStorage {
|
||||
|
||||
/**
|
||||
* Generates a unique backup name based on a given timestamp.
|
||||
*
|
||||
* @param timestamp The timestamp to use for the backup name.
|
||||
* @return A string representing the backup name (e.g., "1678886400000.zip").
|
||||
*/
|
||||
default String getBackupName(long timestamp) {
|
||||
return timestamp + ".zip";
|
||||
}
|
||||
|
||||
/**
|
||||
* Lists all available {@link Backup}s for a specific {@link BuildWorld}.
|
||||
*
|
||||
* @param buildWorld The world for which to list backups
|
||||
* @return A future with a list of backup objects associated with the specified world
|
||||
*/
|
||||
CompletableFuture<List<Backup>> listBackups(BuildWorld buildWorld);
|
||||
|
||||
/**
|
||||
* Creates and stores a new {@link Backup} for a given {@link BuildWorld}. The result of the operation is communicated via the provided {@link CompletableFuture}.
|
||||
* <p>
|
||||
* In comparison to {@link BackupProfile#createBackup()}, a backup will always be created and no older backups will be deleted. This method is intended for immediate backup
|
||||
* creation and storage, rather than profile management.
|
||||
*
|
||||
* @param buildWorld The world to be backed up
|
||||
* @return A future that will be completed with the backup object upon successful storage, or exceptionally if an error occurs
|
||||
*/
|
||||
CompletableFuture<Backup> storeBackup(BuildWorld buildWorld);
|
||||
|
||||
/**
|
||||
* Downloads a specific {@link Backup} file asynchronously.
|
||||
*
|
||||
* @param backup The backup object representing the backup to be downloaded
|
||||
* @return A future that will complete with a {@link File} object pointing to the downloaded backup once the download operation is finished
|
||||
*/
|
||||
CompletableFuture<File> downloadBackup(Backup backup);
|
||||
|
||||
/**
|
||||
* Deletes a specific {@link Backup}.
|
||||
*
|
||||
* @param backup The backup object representing the backup to be deleted
|
||||
* @return A future that will complete after the deletion
|
||||
*/
|
||||
CompletableFuture<Void> deleteBackup(Backup backup);
|
||||
|
||||
/**
|
||||
* Closes the backup storage, releasing any resources.
|
||||
*/
|
||||
void close();
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
/*
|
||||
* Copyright (c) 2018-2025, Thomas Meaney
|
||||
* Copyright (c) contributors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Provides interfaces and classes for managing world backups.
|
||||
*/
|
||||
package de.eintosti.buildsystem.api.world.backup;
|
||||
@@ -0,0 +1,103 @@
|
||||
/*
|
||||
* Copyright (c) 2018-2025, Thomas Meaney
|
||||
* Copyright (c) contributors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package de.eintosti.buildsystem.api.world.builder;
|
||||
|
||||
import de.eintosti.buildsystem.api.world.BuildWorld;
|
||||
import java.util.UUID;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.jetbrains.annotations.Contract;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
/**
|
||||
* A {@link Builder} represents a player allowed to build in a {@link BuildWorld}.
|
||||
*
|
||||
* @since 3.0.0
|
||||
*/
|
||||
@NullMarked
|
||||
public sealed interface Builder permits BuilderImpl {
|
||||
|
||||
/**
|
||||
* Creates a new {@link Builder} instance with the given uuid and name.
|
||||
*
|
||||
* @param uuid The uuid
|
||||
* @param name The name
|
||||
* @return The builder
|
||||
*/
|
||||
@Contract("_, _ -> new")
|
||||
static Builder of(UUID uuid, String name) {
|
||||
return new BuilderImpl(uuid, name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new {@link Builder} instance using the given player.
|
||||
*
|
||||
* @param player The player
|
||||
* @return The builder
|
||||
*/
|
||||
@Contract("_ -> new")
|
||||
static Builder of(Player player) {
|
||||
return of(player.getUniqueId(), player.getName());
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new {@link Builder} instance using a serialized string.
|
||||
* <p>
|
||||
* The format of the string must be {@code <uuid>,<name>}.
|
||||
*
|
||||
* @param serialized The serialized builder
|
||||
* @return The builder if all the input is valid, otherwise {@code null}
|
||||
*/
|
||||
@Nullable
|
||||
static Builder deserialize(@Nullable String serialized) {
|
||||
if (serialized == null || serialized.equals("-")) {
|
||||
return null;
|
||||
}
|
||||
|
||||
String[] parts = serialized.split(BuilderImpl.SEPARATOR);
|
||||
if (parts.length != 2) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return of(UUID.fromString(parts[0]), parts[1]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a unique and persistent id for the builder.
|
||||
* <p>
|
||||
* Should be equal to the corresponding {@link Player}'s unique id.
|
||||
*
|
||||
* @return The uuid
|
||||
* @see Player#getUniqueId()
|
||||
*/
|
||||
UUID getUniqueId();
|
||||
|
||||
/**
|
||||
* Gets the name of the builder.
|
||||
*
|
||||
* @return The builder name
|
||||
*/
|
||||
String getName();
|
||||
|
||||
/**
|
||||
* Sets the name of the builder.
|
||||
*
|
||||
* @param name The name to change to
|
||||
*/
|
||||
void setName(String name);
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
/*
|
||||
* Copyright (c) 2018-2025, Thomas Meaney
|
||||
* Copyright (c) contributors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package de.eintosti.buildsystem.api.world.builder;
|
||||
|
||||
import java.util.UUID;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
|
||||
/**
|
||||
* Concrete implementation of the {@link Builder} interface.
|
||||
*
|
||||
* @since 3.0.0
|
||||
*/
|
||||
@NullMarked
|
||||
final class BuilderImpl implements Builder {
|
||||
|
||||
static final String SEPARATOR = ",";
|
||||
|
||||
private final UUID uuid;
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* Constructs a new {@link BuilderImpl} with the given unique ID and name.
|
||||
*
|
||||
* @param uuid The unique ID of the builder
|
||||
* @param name The name of the builder
|
||||
*/
|
||||
BuilderImpl(UUID uuid, String name) {
|
||||
this.uuid = uuid;
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public UUID getUniqueId() {
|
||||
return uuid;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return this.uuid + SEPARATOR + this.name;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,135 @@
|
||||
/*
|
||||
* Copyright (c) 2018-2025, Thomas Meaney
|
||||
* Copyright (c) contributors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package de.eintosti.buildsystem.api.world.builder;
|
||||
|
||||
import de.eintosti.buildsystem.api.world.BuildWorld;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.jetbrains.annotations.Unmodifiable;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
/**
|
||||
* Interface for managing builders in a {@link BuildWorld}.
|
||||
*
|
||||
* @since 3.0.0
|
||||
*/
|
||||
@NullMarked
|
||||
public interface Builders {
|
||||
|
||||
/**
|
||||
* Checks if the world has a creator.
|
||||
*
|
||||
* @return {@code true} if the world has a creator, {@code false} otherwise
|
||||
*/
|
||||
boolean hasCreator();
|
||||
|
||||
/**
|
||||
* Gets the creator of the world.
|
||||
*
|
||||
* @return The creator of the world, or {@code null} if there is none
|
||||
*/
|
||||
@Nullable
|
||||
Builder getCreator();
|
||||
|
||||
/**
|
||||
* Sets the creator of the world.
|
||||
*
|
||||
* @param creator The new creator
|
||||
*/
|
||||
void setCreator(@Nullable Builder creator);
|
||||
|
||||
/**
|
||||
* Checks if the given player is the creator of the world.
|
||||
*
|
||||
* @param player The player to check
|
||||
* @return {@code true} if the player is the creator, {@code false} otherwise
|
||||
*/
|
||||
boolean isCreator(Player player);
|
||||
|
||||
/**
|
||||
* Gets an unmodifiable list of all builders.
|
||||
*
|
||||
* @return List of builders
|
||||
*/
|
||||
Collection<Builder> getAllBuilders();
|
||||
|
||||
/**
|
||||
* Gets a builder by their UUID.
|
||||
*
|
||||
* @param uuid The UUID to search for
|
||||
* @return The builder if found, {@code null} otherwise
|
||||
*/
|
||||
@Nullable
|
||||
Builder getBuilder(UUID uuid);
|
||||
|
||||
/**
|
||||
* Get an unmodifiable list of all {@link Builder} names
|
||||
*
|
||||
* @return A list of all builder names
|
||||
*/
|
||||
@Unmodifiable
|
||||
List<String> getBuilderNames();
|
||||
|
||||
/**
|
||||
* Checks if a player is a builder.
|
||||
*
|
||||
* @param player The player to check
|
||||
* @return {@code true} if the player is a builder, {@code false} otherwise
|
||||
*/
|
||||
boolean isBuilder(Player player);
|
||||
|
||||
/**
|
||||
* Checks if a UUID belongs to a builder.
|
||||
*
|
||||
* @param uuid The UUID to check
|
||||
* @return {@code true} if the given UUID belongs to a builder, {@code false} otherwise
|
||||
*/
|
||||
boolean isBuilder(UUID uuid);
|
||||
|
||||
/**
|
||||
* Adds a builder to the world.
|
||||
*
|
||||
* @param builder The builder to add
|
||||
*/
|
||||
void addBuilder(Builder builder);
|
||||
|
||||
/**
|
||||
* Removes a builder from the world.
|
||||
*
|
||||
* @param builder The builder to remove
|
||||
*/
|
||||
void removeBuilder(Builder builder);
|
||||
|
||||
/**
|
||||
* Removes a builder by their UUID.
|
||||
*
|
||||
* @param uuid The UUID of the builder to remove
|
||||
*/
|
||||
void removeBuilder(UUID uuid);
|
||||
|
||||
/**
|
||||
* Formats the list of builders for the {@code %builder%} placeholder.
|
||||
*
|
||||
* @param player The player to display the placeholders to
|
||||
* @return The list of builders which have been added to the given world as a string
|
||||
*/
|
||||
String asPlaceholder(Player player);
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
/*
|
||||
* Copyright (c) 2018-2025, Thomas Meaney
|
||||
* Copyright (c) contributors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Provides interfaces and classes for managing world builders and their associated permissions.
|
||||
*/
|
||||
package de.eintosti.buildsystem.api.world.builder;
|
||||
@@ -0,0 +1,154 @@
|
||||
/*
|
||||
* Copyright (c) 2018-2025, Thomas Meaney
|
||||
* Copyright (c) contributors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package de.eintosti.buildsystem.api.world.creation;
|
||||
|
||||
import de.eintosti.buildsystem.api.world.BuildWorld;
|
||||
import de.eintosti.buildsystem.api.world.builder.Builder;
|
||||
import de.eintosti.buildsystem.api.world.creation.generator.CustomGenerator;
|
||||
import de.eintosti.buildsystem.api.world.data.BuildWorldType;
|
||||
import de.eintosti.buildsystem.api.world.display.Folder;
|
||||
import org.bukkit.Difficulty;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.generator.ChunkGenerator;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
/**
|
||||
* Represents a creator for a {@link BuildWorld}.
|
||||
*
|
||||
* @since 3.0.0
|
||||
*/
|
||||
@NullMarked
|
||||
public interface BuildWorldCreator {
|
||||
|
||||
/**
|
||||
* Sets the name of the world.
|
||||
*
|
||||
* @param name The world name
|
||||
* @return The world creator object
|
||||
*/
|
||||
BuildWorldCreator setName(String name);
|
||||
|
||||
/**
|
||||
* Sets the creator of the world.
|
||||
*
|
||||
* @param creator The creator, may be {@code null}
|
||||
* @return The world creator object
|
||||
*/
|
||||
BuildWorldCreator setCreator(@Nullable Builder creator);
|
||||
|
||||
/**
|
||||
* Sets the template which the world should be copied from.
|
||||
* <p>
|
||||
* Only used if the world type is {@link BuildWorldType#TEMPLATE}
|
||||
*
|
||||
* @param template The template name, may be {@code null} if no template is used
|
||||
* @return The creator object
|
||||
*/
|
||||
BuildWorldCreator setTemplate(@Nullable String template);
|
||||
|
||||
/**
|
||||
* Sets the type of the world.
|
||||
*
|
||||
* @param type The world type
|
||||
* @return The world creator object
|
||||
*/
|
||||
BuildWorldCreator setType(BuildWorldType type);
|
||||
|
||||
/**
|
||||
* Sets the custom {@link ChunkGenerator} of the world.
|
||||
*
|
||||
* @param customGenerator The custom chunk generator
|
||||
* @return The world creator object
|
||||
*/
|
||||
BuildWorldCreator setCustomGenerator(CustomGenerator customGenerator);
|
||||
|
||||
/**
|
||||
* Sets the folder in which the world should be created.
|
||||
*
|
||||
* @param folder The folder where the world should be created, may be {@code null} if not to be added to a folder
|
||||
* @return The world creator object
|
||||
*/
|
||||
BuildWorldCreator setFolder(@Nullable Folder folder);
|
||||
|
||||
/**
|
||||
* Sets whether the world should be private or not.
|
||||
*
|
||||
* @param privateWorld Whether the world should be private
|
||||
* @return The world creator object
|
||||
*/
|
||||
BuildWorldCreator setPrivate(boolean privateWorld);
|
||||
|
||||
/**
|
||||
* Sets the difficulty of the world.
|
||||
*
|
||||
* @param difficulty The difficulty
|
||||
* @return The world creator object
|
||||
*/
|
||||
BuildWorldCreator setDifficulty(Difficulty difficulty);
|
||||
|
||||
/**
|
||||
* Sets the creation date of the world.
|
||||
*
|
||||
* @param creationDate The creation date in milliseconds since epoch
|
||||
* @return The world creator object
|
||||
*/
|
||||
BuildWorldCreator setCreationDate(long creationDate);
|
||||
|
||||
/**
|
||||
* Creates and generates a new {@link BuildWorld} using the settings configured in this builder.
|
||||
* <p>
|
||||
* This process includes creating the world files, registering the world with the plugin, and notifying the player of the progress.
|
||||
*
|
||||
* @param player The player who is creating the world
|
||||
*/
|
||||
void createWorld(Player player);
|
||||
|
||||
/**
|
||||
* Imports an existing world directory as a new {@link BuildWorld}.
|
||||
*
|
||||
* @param player The player who is importing the world
|
||||
* @param teleport If true, the player will be teleported to the world after the import is finished
|
||||
*/
|
||||
void importWorld(Player player, boolean teleport);
|
||||
|
||||
/**
|
||||
* Generates the underlying Bukkit {@link World} and applies post-generation settings. Only generates the world if the world was not created in a newer Minecraft version that
|
||||
* the server is running.
|
||||
* <p>
|
||||
* Important: This method should only be called after the world has been created and registered with the plugin.
|
||||
*
|
||||
* @return The generated {@link World}, or {@code null} if generation failed
|
||||
*/
|
||||
@Nullable
|
||||
default World generateBukkitWorld() {
|
||||
return generateBukkitWorld(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates the underlying Bukkit {@link World} and applies post-generation settings.
|
||||
* <p>
|
||||
* Important: This method should only be called after the world has been created and registered with the plugin.
|
||||
*
|
||||
* @param checkVersion If true, verify that the world's data version is compatible
|
||||
* @return The generated {@link World}, or {@code null} if generation failed
|
||||
*/
|
||||
@Nullable
|
||||
World generateBukkitWorld(boolean checkVersion);
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
/*
|
||||
* Copyright (c) 2018-2025, Thomas Meaney
|
||||
* Copyright (c) contributors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package de.eintosti.buildsystem.api.world.creation.generator;
|
||||
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.generator.ChunkGenerator;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
/**
|
||||
* Represents a custom chunk generator for a {@link World} which is provided by an external plugin.
|
||||
*
|
||||
* @since 3.0.0
|
||||
*/
|
||||
@NullMarked
|
||||
public interface CustomGenerator {
|
||||
|
||||
/**
|
||||
* Gets the name plugin providing the chunk generator.
|
||||
*
|
||||
* @return The name of the plugin
|
||||
*/
|
||||
String pluginName();
|
||||
|
||||
/**
|
||||
* Gets the name of the chunk generator.
|
||||
*
|
||||
* @return The name of the chunk generator
|
||||
*/
|
||||
String chunkGeneratorName();
|
||||
|
||||
/**
|
||||
* Gets the Bukkit {@link ChunkGenerator} within the providing plugin ({@link #pluginName()}:{@link #chunkGeneratorName()}).
|
||||
*
|
||||
* @return The chunk generator instance, or {@code null} if it could not be loaded or has not been not set
|
||||
*/
|
||||
@Nullable
|
||||
ChunkGenerator chunkGenerator();
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
/*
|
||||
* Copyright (c) 2018-2025, Thomas Meaney
|
||||
* Copyright (c) contributors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package de.eintosti.buildsystem.api.world.creation.generator;
|
||||
|
||||
import de.eintosti.buildsystem.api.world.BuildWorld;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
|
||||
/**
|
||||
* Different kinds of world generators that can be used for a {@link BuildWorld}.
|
||||
*
|
||||
* @since 3.0.0
|
||||
*/
|
||||
@NullMarked
|
||||
public enum Generator {
|
||||
|
||||
/**
|
||||
* A normal world
|
||||
*/
|
||||
NORMAL,
|
||||
|
||||
/**
|
||||
* A flat world
|
||||
*/
|
||||
FLAT,
|
||||
|
||||
/**
|
||||
* A void world
|
||||
*/
|
||||
VOID,
|
||||
|
||||
/**
|
||||
* A custom world
|
||||
*/
|
||||
CUSTOM
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
/*
|
||||
* Copyright (c) 2018-2025, Thomas Meaney
|
||||
* Copyright (c) contributors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Classes relevant to world generation.
|
||||
*/
|
||||
package de.eintosti.buildsystem.api.world.creation.generator;
|
||||
@@ -0,0 +1,22 @@
|
||||
/*
|
||||
* Copyright (c) 2018-2025, Thomas Meaney
|
||||
* Copyright (c) contributors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Classes relevant to world generation.
|
||||
*/
|
||||
package de.eintosti.buildsystem.api.world.creation;
|
||||
@@ -0,0 +1,85 @@
|
||||
/*
|
||||
* Copyright (c) 2018-2025, Thomas Meaney
|
||||
* Copyright (c) contributors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package de.eintosti.buildsystem.api.world.data;
|
||||
|
||||
import de.eintosti.buildsystem.api.world.BuildWorld;
|
||||
import java.util.Locale;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
|
||||
/**
|
||||
* Represents the various building statuses a {@link BuildWorld} can have. These statuses indicate the progression and accessibility of a world.
|
||||
*
|
||||
* @since 3.0.0
|
||||
*/
|
||||
@NullMarked
|
||||
public enum BuildWorldStatus {
|
||||
|
||||
/**
|
||||
* Represents a {@link BuildWorld} that has not yet been started or modified. This is typically the initial state for newly created worlds.
|
||||
*/
|
||||
NOT_STARTED(1),
|
||||
|
||||
/**
|
||||
* Represents a {@link BuildWorld} that is currently under construction. This status is automatically assigned when a block is placed or broken in the world.
|
||||
*/
|
||||
IN_PROGRESS(2),
|
||||
|
||||
/**
|
||||
* Represents a {@link BuildWorld} that is nearing completion.
|
||||
*/
|
||||
ALMOST_FINISHED(3),
|
||||
|
||||
/**
|
||||
* Represents a {@link BuildWorld} whose building phase has been completed.
|
||||
*/
|
||||
FINISHED(4),
|
||||
|
||||
/**
|
||||
* Represents an older {@link BuildWorld} that has been completed and is now archived. Blocks typically cannot be placed or broken in archived worlds.
|
||||
*/
|
||||
ARCHIVE(5),
|
||||
|
||||
/**
|
||||
* Represents a {@link BuildWorld} that is hidden from public view in the navigator.
|
||||
*/
|
||||
HIDDEN(6);
|
||||
|
||||
private final int stage;
|
||||
|
||||
BuildWorldStatus(int stage) {
|
||||
this.stage = stage;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the permission required to change a world to this status.
|
||||
*
|
||||
* @return The permission string (e.g., "buildsystem.setstatus.notstarted")
|
||||
*/
|
||||
public String getPermission() {
|
||||
return "buildsystem.setstatus." + name().toLowerCase(Locale.ROOT).replace("_", "");
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the development stage of the {@link BuildWorld}. A higher numerical value indicates a further developed or completed world.
|
||||
*
|
||||
* @return The integer representing the stage of development
|
||||
*/
|
||||
public int getStage() {
|
||||
return stage;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
/*
|
||||
* Copyright (c) 2018-2025, Thomas Meaney
|
||||
* Copyright (c) contributors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package de.eintosti.buildsystem.api.world.data;
|
||||
|
||||
import de.eintosti.buildsystem.api.world.BuildWorld;
|
||||
import org.bukkit.World.Environment;
|
||||
import org.bukkit.generator.ChunkGenerator;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
|
||||
/**
|
||||
* Represents the different types of {@link BuildWorld}s that can be created or managed by the BuildSystem plugin. Each type specifies unique characteristics for world generation
|
||||
* and behavior.
|
||||
*
|
||||
* @since 3.0.0
|
||||
*/
|
||||
@NullMarked
|
||||
public enum BuildWorldType {
|
||||
|
||||
/**
|
||||
* A standard world type, equivalent to a default Minecraft overworld with {@link Environment#NORMAL}.
|
||||
*/
|
||||
NORMAL,
|
||||
|
||||
/**
|
||||
* A super-flat world, ideal for creative building without terrain obstacles.
|
||||
*/
|
||||
FLAT,
|
||||
|
||||
/**
|
||||
* A world type representing the Nether dimension, with {@link Environment#NETHER}.
|
||||
*/
|
||||
NETHER,
|
||||
|
||||
/**
|
||||
* A world type representing the End dimension, with {@link Environment#THE_END}.
|
||||
*/
|
||||
END,
|
||||
|
||||
/**
|
||||
* An empty world, containing no blocks except for a single platform at spawn.
|
||||
*/
|
||||
VOID,
|
||||
|
||||
/**
|
||||
* A world created as an identical copy of an existing template world.
|
||||
*/
|
||||
TEMPLATE,
|
||||
|
||||
/**
|
||||
* A world that, by default, can only be modified by its creator.
|
||||
*/
|
||||
PRIVATE,
|
||||
|
||||
/**
|
||||
* A world that was not originally created by the BuildSystem plugin but has been imported for management.
|
||||
*/
|
||||
IMPORTED,
|
||||
|
||||
/**
|
||||
* A world generated using a custom {@link ChunkGenerator}.
|
||||
*/
|
||||
CUSTOM,
|
||||
|
||||
/**
|
||||
* A world whose type could not be determined or is not recognized by the BuildSystem.
|
||||
*/
|
||||
UNKNOWN
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
/*
|
||||
* Copyright (c) 2018-2025, Thomas Meaney
|
||||
* Copyright (c) contributors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package de.eintosti.buildsystem.api.world.data;
|
||||
|
||||
import de.eintosti.buildsystem.api.world.BuildWorld;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
|
||||
/**
|
||||
* Defines the visibility settings for a {@link BuildWorld} within the BuildSystem. These settings determine how worlds are displayed and accessed in the world navigator.
|
||||
*
|
||||
* @since 3.0.0
|
||||
*/
|
||||
@NullMarked
|
||||
public enum Visibility {
|
||||
|
||||
/**
|
||||
* Indicates that a world is publicly accessible and displayed in the main world navigator.
|
||||
*/
|
||||
PUBLIC,
|
||||
|
||||
/**
|
||||
* Indicates that a world is private, typically only visible and accessible to its creator and designated builders. Private worlds are usually displayed in a separate,
|
||||
* dedicated menu.
|
||||
*/
|
||||
PRIVATE,
|
||||
|
||||
/**
|
||||
* A special state indicating that the visibility setting of a world should be disregarded. This is useful for internal operations or specific contexts where visibility rules
|
||||
* do not apply.
|
||||
*/
|
||||
IGNORE;
|
||||
|
||||
/**
|
||||
* Returns the appropriate {@link Visibility} enum based on whether a world is private.
|
||||
*
|
||||
* @param isPrivateWorld A boolean indicating if the world is private
|
||||
* @return {@link #PRIVATE} if {@link WorldData#privateWorld()} is true, otherwise {@link #PUBLIC}
|
||||
*/
|
||||
public static Visibility matchVisibility(boolean isPrivateWorld) {
|
||||
return isPrivateWorld ? PRIVATE : PUBLIC;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,180 @@
|
||||
/*
|
||||
* Copyright (c) 2018-2025, Thomas Meaney
|
||||
* Copyright (c) contributors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package de.eintosti.buildsystem.api.world.data;
|
||||
|
||||
import com.cryptomorin.xseries.XMaterial;
|
||||
import de.eintosti.buildsystem.api.data.Type;
|
||||
import de.eintosti.buildsystem.api.world.BuildWorld;
|
||||
import de.eintosti.buildsystem.api.world.backup.Backup;
|
||||
import java.util.Map;
|
||||
import org.bukkit.Difficulty;
|
||||
import org.bukkit.Location;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
/**
|
||||
* Manages and provides access to various data points and settings for a {@link BuildWorld}. This interface allows for reading and modifying world-specific configurations.
|
||||
*
|
||||
* @since 3.0.0
|
||||
*/
|
||||
@NullMarked
|
||||
public interface WorldData {
|
||||
|
||||
/**
|
||||
* Retrieves a {@link Type} object representing the custom spawn location of the {@link BuildWorld}. The value is stored as a string in the format {@code x;y;z;yaw;pitch}.
|
||||
*
|
||||
* @return A {@link Type} containing the custom spawn string
|
||||
* @see #getCustomSpawnLocation()
|
||||
*/
|
||||
Type<String> customSpawn();
|
||||
|
||||
/**
|
||||
* Gets the {@link BuildWorld}'s custom spawn as a {@link Location} object.
|
||||
*
|
||||
* @return The custom spawn as a location, or {@code null} if not set or invalid
|
||||
*/
|
||||
@Nullable
|
||||
Location getCustomSpawnLocation();
|
||||
|
||||
/**
|
||||
* Retrieves a {@link Type} object representing the permission required to enter the {@link BuildWorld}. Returns "-" if no specific permission is required.
|
||||
*
|
||||
* @return A {@link Type} containing the permission string
|
||||
*/
|
||||
Type<String> permission();
|
||||
|
||||
/**
|
||||
* Retrieves a {@link Type} object representing the project description of the {@link BuildWorld}. This typically provides a brief overview or purpose of the world.
|
||||
*
|
||||
* @return A {@link Type} containing the project description string
|
||||
*/
|
||||
Type<String> project();
|
||||
|
||||
/**
|
||||
* Retrieves a {@link Type} object representing the {@link Difficulty} of the {@link BuildWorld}.
|
||||
*
|
||||
* @return A {@link Type} containing the world's difficulty setting
|
||||
*/
|
||||
Type<Difficulty> difficulty();
|
||||
|
||||
/**
|
||||
* Retrieves a {@link Type} object representing the {@link XMaterial} used to display the {@link BuildWorld} in the navigator menus.
|
||||
*
|
||||
* @return A {@link Type} containing the material used for display
|
||||
*/
|
||||
Type<XMaterial> material();
|
||||
|
||||
/**
|
||||
* Retrieves a {@link Type} object representing the current {@link BuildWorldStatus} of the world. This indicates the building progression or state of the world.
|
||||
*
|
||||
* @return A {@link Type} containing the current build status
|
||||
*/
|
||||
Type<BuildWorldStatus> status();
|
||||
|
||||
/**
|
||||
* Retrieves a {@link Type} object indicating whether block breaking is allowed in the {@link BuildWorld}.
|
||||
*
|
||||
* @return A {@link Type} containing a boolean: {@code true} if allowed, otherwise {@code false}
|
||||
*/
|
||||
Type<Boolean> blockBreaking();
|
||||
|
||||
/**
|
||||
* Retrieves a {@link Type} object indicating whether block interactions (e.g., opening doors, chests) are enabled in the {@link BuildWorld}.
|
||||
*
|
||||
* @return A {@link Type} containing a boolean: {@code true} if enabled, otherwise {@code false}
|
||||
*/
|
||||
Type<Boolean> blockInteractions();
|
||||
|
||||
/**
|
||||
* Retrieves a {@link Type} object indicating whether block placement is allowed in the {@link BuildWorld}.
|
||||
*
|
||||
* @return A {@link Type} containing a boolean: {@code true} if allowed, otherwise {@code false}
|
||||
*/
|
||||
Type<Boolean> blockPlacement();
|
||||
|
||||
/**
|
||||
* Retrieves a {@link Type} object indicating whether the "builders feature" is enabled in the {@link BuildWorld}. When enabled, only designated builders can modify the world.
|
||||
*
|
||||
* @return A {@link Type} containing a boolean: {@code true} if enabled, otherwise {@code false}
|
||||
*/
|
||||
Type<Boolean> buildersEnabled();
|
||||
|
||||
/**
|
||||
* Retrieves a {@link Type} object indicating whether explosions are enabled in the {@link BuildWorld}.
|
||||
*
|
||||
* @return A {@link Type} containing a boolean: {@code true} if enabled, otherwise {@code false}
|
||||
*/
|
||||
Type<Boolean> explosions();
|
||||
|
||||
/**
|
||||
* Retrieves a {@link Type} object indicating whether entities in the {@link BuildWorld} have artificial intelligence.
|
||||
*
|
||||
* @return A {@link Type} containing a boolean: {@code true} if enabled, otherwise {@code false}
|
||||
*/
|
||||
Type<Boolean> mobAi();
|
||||
|
||||
/**
|
||||
* Retrieves a {@link Type} object indicating whether physics (e.g., gravity, fluid flow) is applied to blocks in the {@link BuildWorld}.
|
||||
*
|
||||
* @return A {@link Type} containing a boolean: {@code true} if enabled, otherwise {@code false}
|
||||
*/
|
||||
Type<Boolean> physics();
|
||||
|
||||
/**
|
||||
* Retrieves a {@link Type} object indicating whether the {@link BuildWorld} is set to private visibility. A private world is typically only accessible to its creator and
|
||||
* designated builders.
|
||||
*
|
||||
* @return A {@link Type} containing a boolean: {@code true} if private, otherwise {@code false}
|
||||
*/
|
||||
Type<Boolean> privateWorld();
|
||||
|
||||
/**
|
||||
* Gets the number of seconds that have passed since that last {@link Backup} of the {@link BuildWorld} was created.
|
||||
*
|
||||
* @return The number of seconds since the last backup
|
||||
*/
|
||||
Type<Integer> timeSinceBackup();
|
||||
|
||||
/**
|
||||
* Retrieves a {@link Type} object representing the timestamp (in milliseconds since epoch) of the last time the {@link BuildWorld} was edited.
|
||||
*
|
||||
* @return A {@link Type} containing the last edited timestamp
|
||||
*/
|
||||
Type<Long> lastEdited();
|
||||
|
||||
/**
|
||||
* Retrieves a {@link Type} object representing the timestamp (in milliseconds since epoch) of the last time the {@link BuildWorld} was loaded.
|
||||
*
|
||||
* @return A {@link Type} containing the last loaded timestamp
|
||||
*/
|
||||
Type<Long> lastLoaded();
|
||||
|
||||
/**
|
||||
* Retrieves a {@link Type} object representing the timestamp (in milliseconds since epoch) of the last time the {@link BuildWorld} was unloaded.
|
||||
*
|
||||
* @return A {@link Type} containing the last unloaded timestamp
|
||||
*/
|
||||
Type<Long> lastUnloaded();
|
||||
|
||||
/**
|
||||
* Gets a map of all configurable data points for the {@link BuildWorld}.
|
||||
*
|
||||
* @return An unmodifiable map where keys are data point names and values are their corresponding {@link Type} objects
|
||||
*/
|
||||
Map<String, Type<?>> getAllData();
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
/*
|
||||
* Copyright (c) 2018-2025, Thomas Meaney
|
||||
* Copyright (c) contributors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Provides interfaces for data structures and enumerations related to {@link de.eintosti.buildsystem.api.world.BuildWorld} properties. This includes world status, type,
|
||||
* visibility, and other configurable data points.
|
||||
*/
|
||||
package de.eintosti.buildsystem.api.world.data;
|
||||
@@ -0,0 +1,149 @@
|
||||
/*
|
||||
* Copyright (c) 2018-2025, Thomas Meaney
|
||||
* Copyright (c) contributors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package de.eintosti.buildsystem.api.world.display;
|
||||
|
||||
import com.cryptomorin.xseries.XMaterial;
|
||||
import de.eintosti.buildsystem.api.world.BuildWorld;
|
||||
import java.util.List;
|
||||
import org.bukkit.NamespacedKey;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
import org.bukkit.inventory.ItemFlag;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
import org.bukkit.persistence.PersistentDataContainer;
|
||||
import org.bukkit.persistence.PersistentDataType;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
|
||||
/**
|
||||
* Represents an object that can be displayed in an inventory.
|
||||
*
|
||||
* @since 3.0.0
|
||||
*/
|
||||
@NullMarked
|
||||
public interface Displayable {
|
||||
|
||||
/**
|
||||
* Gets the unique name of this displayable item.
|
||||
*
|
||||
* @return The name
|
||||
*/
|
||||
String getName();
|
||||
|
||||
/**
|
||||
* Gets the name used to display this item in an inventory.
|
||||
*
|
||||
* @param player The player viewing the item
|
||||
* @return The display name
|
||||
*/
|
||||
String getDisplayName(Player player);
|
||||
|
||||
/**
|
||||
* Gets the creation timestamp of the displayable.
|
||||
*
|
||||
* @return The number of milliseconds that have passed since {@code January 1, 1970 UTC}, until the displayable was created.
|
||||
*/
|
||||
long getCreation();
|
||||
|
||||
/**
|
||||
* Gets the material to display this item with.
|
||||
*
|
||||
* @return The material
|
||||
*/
|
||||
XMaterial getIcon();
|
||||
|
||||
/**
|
||||
* Sets the icon for this displayable item.
|
||||
*
|
||||
* @param material The material to set as the icon
|
||||
*/
|
||||
void setIcon(XMaterial material);
|
||||
|
||||
/**
|
||||
* Gets the lore of this displayable item.
|
||||
*
|
||||
* @param player The player viewing the item
|
||||
* @return The lore
|
||||
*/
|
||||
List<String> getLore(Player player);
|
||||
|
||||
/**
|
||||
* Converts this displayable to an {@link ItemStack} for display.
|
||||
*
|
||||
* @param player The player viewing the inventory
|
||||
* @return The ItemStack representation
|
||||
*/
|
||||
default ItemStack asItemStack(Player player) {
|
||||
ItemStack itemStack = getIcon().parseItem();
|
||||
if (itemStack == null) {
|
||||
throw new IllegalStateException("Icon material " + getIcon() + " could not be parsed into an ItemStack.");
|
||||
}
|
||||
|
||||
ItemMeta itemMeta = itemStack.getItemMeta();
|
||||
if (itemMeta == null) {
|
||||
throw new IllegalStateException("ItemMeta for " + getIcon() + " is null. This should not happen.");
|
||||
}
|
||||
|
||||
itemMeta.setDisplayName(getDisplayName(player));
|
||||
itemMeta.setLore(getLore(player));
|
||||
itemMeta.addItemFlags(ItemFlag.values());
|
||||
|
||||
DisplayableType type = switch (this) {
|
||||
case BuildWorld ignored -> DisplayableType.BUILD_WORLD;
|
||||
case Folder ignored -> DisplayableType.FOLDER;
|
||||
default -> throw new IllegalStateException("Unknown displayable type: " + this.getClass().getSimpleName());
|
||||
};
|
||||
|
||||
JavaPlugin plugin = JavaPlugin.getProvidingPlugin(getClass());
|
||||
PersistentDataContainer pdc = itemMeta.getPersistentDataContainer();
|
||||
pdc.set(new NamespacedKey(plugin, "displayable_type"), PersistentDataType.STRING, type.name());
|
||||
pdc.set(new NamespacedKey(plugin, "displayable_name"), PersistentDataType.STRING, getName());
|
||||
|
||||
itemStack.setItemMeta(itemMeta);
|
||||
|
||||
return itemStack;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds this displayable to an {@link Inventory} at the given slot.
|
||||
*
|
||||
* @param inventory The inventory to add the item to
|
||||
* @param slot The slot in the inventory to add the item
|
||||
* @param player The player viewing the inventory
|
||||
*/
|
||||
default void addToInventory(Inventory inventory, int slot, Player player) {
|
||||
inventory.setItem(slot, asItemStack(player));
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents the distinct types of items that can be displayed in an inventory within the BuildSystem.
|
||||
*/
|
||||
enum DisplayableType {
|
||||
|
||||
/**
|
||||
* Indicates that the displayable item is a {@link BuildWorld}.
|
||||
*/
|
||||
BUILD_WORLD,
|
||||
|
||||
/**
|
||||
* Indicates that the displayable item is a {@link Folder}.
|
||||
*/
|
||||
FOLDER
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,176 @@
|
||||
/*
|
||||
* Copyright (c) 2018-2025, Thomas Meaney
|
||||
* Copyright (c) contributors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package de.eintosti.buildsystem.api.world.display;
|
||||
|
||||
import de.eintosti.buildsystem.api.world.BuildWorld;
|
||||
import de.eintosti.buildsystem.api.world.builder.Builder;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.jetbrains.annotations.Unmodifiable;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
/**
|
||||
* Represents a folder within the BuildSystem's world navigation structure. Folders can contain {@link BuildWorld}s and other nested folders, organizing them for easier access.
|
||||
*
|
||||
* @since 3.0.0
|
||||
*/
|
||||
@NullMarked
|
||||
public interface Folder extends Displayable {
|
||||
|
||||
/**
|
||||
* Gets the {@link Builder} who originally created this folder.
|
||||
*
|
||||
* @return The {@link Builder} instance representing the folder's creator
|
||||
*/
|
||||
Builder getCreator();
|
||||
|
||||
/**
|
||||
* Gets the {@link NavigatorCategory} in which this folder is displayed.
|
||||
*
|
||||
* @return The {@link NavigatorCategory} of the folder
|
||||
*/
|
||||
NavigatorCategory getCategory();
|
||||
|
||||
/**
|
||||
* Gets the parent {@link Folder} of this folder, if it is nested.
|
||||
*
|
||||
* @return The parent {@link Folder}, or {@code null} if this is a top-level folder
|
||||
*/
|
||||
@Nullable
|
||||
Folder getParent();
|
||||
|
||||
/**
|
||||
* Sets the parent {@link Folder} for this folder. Setting it to {@code null} will make this a top-level folder.
|
||||
* <p>
|
||||
* The parent folder must belong to the same {@link NavigatorCategory} as this folder. If the categories differ, an {@link IllegalArgumentException} is thrown.
|
||||
*
|
||||
* @param parent The new parent {@link Folder}, or {@code null} to remove the current parent
|
||||
* @throws IllegalArgumentException if the parent has a different {@link NavigatorCategory}
|
||||
*/
|
||||
void setParent(@Nullable Folder parent);
|
||||
|
||||
/**
|
||||
* Checks if this folder has a parent {@link Folder}.
|
||||
*
|
||||
* @return {@code true} if this folder is nested under another, {@code false} otherwise
|
||||
*/
|
||||
boolean hasParent();
|
||||
|
||||
/**
|
||||
* Gets an unmodifiable list of UUIDs for all {@link BuildWorld}s contained directly within this folder.
|
||||
*
|
||||
* @return An {@link Unmodifiable} {@link List} of {@link BuildWorld} UUIDs
|
||||
*/
|
||||
@Unmodifiable
|
||||
List<UUID> getWorldUUIDs();
|
||||
|
||||
/**
|
||||
* Checks if this folder contains the specified {@link BuildWorld}.
|
||||
*
|
||||
* @param buildWorld The {@link BuildWorld} to check for
|
||||
* @return {@code true} if the folder contains the world, {@code false} otherwise
|
||||
*/
|
||||
boolean containsWorld(BuildWorld buildWorld);
|
||||
|
||||
/**
|
||||
* Checks if this folder contains the {@link BuildWorld} with the specified UUID.
|
||||
*
|
||||
* @param uuid The unique identifier of the {@link BuildWorld} to check for
|
||||
* @return {@code true} if the folder contains the world, {@code false} otherwise
|
||||
*/
|
||||
boolean containsWorld(UUID uuid);
|
||||
|
||||
/**
|
||||
* Adds a {@link BuildWorld} to this folder.
|
||||
*
|
||||
* @param buildWorld The {@link BuildWorld} to add
|
||||
*/
|
||||
void addWorld(BuildWorld buildWorld);
|
||||
|
||||
/**
|
||||
* Removes a {@link BuildWorld} from this folder.
|
||||
*
|
||||
* @param buildWorld The {@link BuildWorld} to remove
|
||||
*/
|
||||
void removeWorld(BuildWorld buildWorld);
|
||||
|
||||
/**
|
||||
* Removes a {@link BuildWorld} with the specified UUID from this folder.
|
||||
*
|
||||
* @param uuid The unique identifier of the {@link BuildWorld} to remove
|
||||
*/
|
||||
void removeWorld(UUID uuid);
|
||||
|
||||
/**
|
||||
* Returns an unmodifiable list of all immediate subfolders contained within this folder.
|
||||
* <p>
|
||||
* This includes only direct children—folders whose {@link #getParent()} is exactly this folder. Nested subfolders (i.e., deeper levels of the folder hierarchy) are not
|
||||
* included.
|
||||
*
|
||||
* @return A list of immediate subfolders
|
||||
*/
|
||||
@Unmodifiable
|
||||
List<Folder> getSubFolders();
|
||||
|
||||
/**
|
||||
* Gets the total number of {@link BuildWorld}s contained in this folder and all of its subfolders.
|
||||
* <p>
|
||||
* This includes both the worlds directly assigned to this folder and those assigned to any nested subfolders.
|
||||
*
|
||||
* @return The total number of worlds in this folder and its subfolders
|
||||
*/
|
||||
int getWorldCount();
|
||||
|
||||
/**
|
||||
* Gets the permission string required for players to access or view this folder. Returns "-" if no specific permission is required.
|
||||
*
|
||||
* @return The permission string, or "-" if none is set
|
||||
*/
|
||||
String getPermission();
|
||||
|
||||
/**
|
||||
* Sets the permission string required for players to access or view this folder. Setting to "-" will remove any permission requirement.
|
||||
*
|
||||
* @param permission The permission string to set, or "-" to remove
|
||||
*/
|
||||
void setPermission(String permission);
|
||||
|
||||
/**
|
||||
* Gets the project name associated with this {@link Folder}. This can be used for categorization or informational purposes.
|
||||
*
|
||||
* @return The project name as a string
|
||||
*/
|
||||
String getProject();
|
||||
|
||||
/**
|
||||
* Sets the project name for this {@link Folder}.
|
||||
*
|
||||
* @param project The new project name to set
|
||||
*/
|
||||
void setProject(String project);
|
||||
|
||||
/**
|
||||
* Checks if the given {@link Player} has permission to view this folder in the navigator.
|
||||
*
|
||||
* @param player The {@link Player} to check
|
||||
* @return {@code true} if the player can view the folder, {@code false} otherwise
|
||||
*/
|
||||
boolean canView(Player player);
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
/*
|
||||
* Copyright (c) 2018-2025, Thomas Meaney
|
||||
* Copyright (c) contributors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package de.eintosti.buildsystem.api.world.display;
|
||||
|
||||
import de.eintosti.buildsystem.api.world.BuildWorld;
|
||||
import de.eintosti.buildsystem.api.world.builder.Builder;
|
||||
import de.eintosti.buildsystem.api.world.data.BuildWorldStatus;
|
||||
import de.eintosti.buildsystem.api.world.data.WorldData;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
|
||||
/**
|
||||
* Represents the different categories used to organize and display {@link BuildWorld}s in the navigator menus. Each category corresponds to a distinct filter or access level for
|
||||
* worlds.
|
||||
*
|
||||
* @since 3.0.0
|
||||
*/
|
||||
@NullMarked
|
||||
public enum NavigatorCategory {
|
||||
|
||||
/**
|
||||
* Represents the category for public worlds. This navigator inventory contains all {@link BuildWorld}s that are still being built or are generally accessible.
|
||||
*/
|
||||
PUBLIC,
|
||||
|
||||
/**
|
||||
* Represents the category for archived worlds. This navigator inventory contains {@link BuildWorld}s that have been marked with {@link BuildWorldStatus#ARCHIVE}. These worlds
|
||||
* are typically read-only and no longer actively built upon.
|
||||
*
|
||||
* @see BuildWorldStatus#ARCHIVE
|
||||
*/
|
||||
ARCHIVE,
|
||||
|
||||
/**
|
||||
* Represents the category for private worlds. This navigator inventory contains {@link BuildWorld}s that are set as private. These worlds can typically only be modified by
|
||||
* their creator and explicitly added {@link Builder}s.
|
||||
*
|
||||
* @see WorldData#privateWorld()
|
||||
*/
|
||||
PRIVATE;
|
||||
|
||||
/**
|
||||
* Determines the appropriate {@link NavigatorCategory} for a given {@link BuildWorld} based on its properties.
|
||||
* <p>
|
||||
* First checks if the world is private ({@link #PRIVATE}), then if it's archived ({@link #ARCHIVE}), otherwise it defaults to {@link #PUBLIC}.
|
||||
*
|
||||
* @param buildWorld The {@link BuildWorld} for which to determine the category
|
||||
* @return The corresponding category
|
||||
*/
|
||||
public static NavigatorCategory of(BuildWorld buildWorld) {
|
||||
WorldData worldData = buildWorld.getData();
|
||||
if (worldData.privateWorld().get()) {
|
||||
return PRIVATE;
|
||||
} else if (worldData.status().get() == BuildWorldStatus.ARCHIVE) {
|
||||
return ARCHIVE;
|
||||
} else {
|
||||
return PUBLIC;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
/*
|
||||
* Copyright (c) 2018-2025, Thomas Meaney
|
||||
* Copyright (c) contributors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Provides interfaces and classes for managing world display and rendering.
|
||||
*/
|
||||
package de.eintosti.buildsystem.api.world.display;
|
||||
@@ -0,0 +1,39 @@
|
||||
/*
|
||||
* Copyright (c) 2018-2025, Thomas Meaney
|
||||
* Copyright (c) contributors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package de.eintosti.buildsystem.api.world.navigator.settings;
|
||||
|
||||
import org.bukkit.entity.ArmorStand;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
|
||||
/**
|
||||
* Represents the type of the navigator.
|
||||
*
|
||||
* @since 3.0.0
|
||||
*/
|
||||
public enum NavigatorType {
|
||||
|
||||
/**
|
||||
* The old, {@link Inventory}-based navigator.
|
||||
*/
|
||||
OLD,
|
||||
|
||||
/**
|
||||
* The new, {@link ArmorStand}-based navigator.
|
||||
*/
|
||||
NEW
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
/*
|
||||
* Copyright (c) 2018-2025, Thomas Meaney
|
||||
* Copyright (c) contributors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package de.eintosti.buildsystem.api.world.navigator.settings;
|
||||
|
||||
import de.eintosti.buildsystem.api.world.BuildWorld;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
|
||||
/**
|
||||
* Interface for managing the display settings of worlds in the navigator.
|
||||
*
|
||||
* @since 3.0.0
|
||||
*/
|
||||
@NullMarked
|
||||
public interface WorldDisplay {
|
||||
|
||||
/**
|
||||
* Gets the order in which the {@link BuildWorld}s are sorted.
|
||||
*
|
||||
* @return The world sort order
|
||||
*/
|
||||
WorldSort getWorldSort();
|
||||
|
||||
/**
|
||||
* Sets the order in which the {@link BuildWorld}s are sorted.
|
||||
*
|
||||
* @param worldSort The world sort order
|
||||
*/
|
||||
void setWorldSort(WorldSort worldSort);
|
||||
|
||||
/**
|
||||
* Gets the filter which removed non-matching {@link BuildWorld}s from the navigator
|
||||
*
|
||||
* @return The world filter
|
||||
*/
|
||||
WorldFilter getWorldFilter();
|
||||
}
|
||||
@@ -0,0 +1,113 @@
|
||||
/*
|
||||
* Copyright (c) 2018-2025, Thomas Meaney
|
||||
* Copyright (c) contributors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package de.eintosti.buildsystem.api.world.navigator.settings;
|
||||
|
||||
import de.eintosti.buildsystem.api.world.BuildWorld;
|
||||
import java.util.function.Predicate;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
|
||||
/**
|
||||
* Interface for a world filter that restricts which {@link BuildWorld}s are shown to a user in the navigator.
|
||||
*
|
||||
* @since 3.0.0
|
||||
*/
|
||||
@NullMarked
|
||||
public interface WorldFilter {
|
||||
|
||||
/**
|
||||
* Gets the current mode.
|
||||
*
|
||||
* @return The mode
|
||||
*/
|
||||
Mode getMode();
|
||||
|
||||
/**
|
||||
* Sets the current mode.
|
||||
*
|
||||
* @param mode The mode
|
||||
*/
|
||||
void setMode(Mode mode);
|
||||
|
||||
/**
|
||||
* Gets the text which the filter is applied to.
|
||||
*
|
||||
* @return The text the filter is applied to
|
||||
*/
|
||||
String getText();
|
||||
|
||||
/**
|
||||
* Sets the text which the filter is applied to.
|
||||
*
|
||||
* @param text The text
|
||||
*/
|
||||
void setText(String text);
|
||||
|
||||
/**
|
||||
* Applies the current filter to a {@link BuildWorld} to determine if it should be shown.
|
||||
*
|
||||
* @return A {@link Predicate} that tests if a {@link BuildWorld} matches the filter criteria
|
||||
*/
|
||||
Predicate<BuildWorld> apply();
|
||||
|
||||
/**
|
||||
* Represents the different modes of filtering worlds in the navigator.
|
||||
*/
|
||||
@NullMarked
|
||||
enum Mode {
|
||||
|
||||
/**
|
||||
* No filtering is applied.
|
||||
*/
|
||||
NONE,
|
||||
|
||||
/**
|
||||
* Worlds that name starts with the filter text.
|
||||
*
|
||||
* @see #getText()
|
||||
*/
|
||||
STARTS_WITH,
|
||||
|
||||
/**
|
||||
* Worlds that name contains the filter text.
|
||||
*
|
||||
* @see #getText()
|
||||
*/
|
||||
CONTAINS,
|
||||
|
||||
/**
|
||||
* Worlds that name matches the filter text.
|
||||
*
|
||||
* @see #getText()
|
||||
*/
|
||||
MATCHES;
|
||||
|
||||
/**
|
||||
* Gets the next filtering mode in the sequence.
|
||||
*
|
||||
* @return The next {@link Mode} in the enumeration
|
||||
*/
|
||||
public Mode getNext() {
|
||||
return switch (this) {
|
||||
case NONE -> STARTS_WITH;
|
||||
case STARTS_WITH -> CONTAINS;
|
||||
case CONTAINS -> MATCHES;
|
||||
case MATCHES -> NONE;
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,150 @@
|
||||
/*
|
||||
* Copyright (c) 2018-2025, Thomas Meaney
|
||||
* Copyright (c) contributors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package de.eintosti.buildsystem.api.world.navigator.settings;
|
||||
|
||||
import de.eintosti.buildsystem.api.world.BuildWorld;
|
||||
import de.eintosti.buildsystem.api.world.data.BuildWorldStatus;
|
||||
import de.eintosti.buildsystem.api.world.display.Displayable;
|
||||
import de.eintosti.buildsystem.api.world.display.Folder;
|
||||
import java.util.Comparator;
|
||||
import java.util.Locale;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
/**
|
||||
* Represents the sorting options for worlds in the navigator.
|
||||
*
|
||||
* @since 3.0.0
|
||||
*/
|
||||
@NullMarked
|
||||
public enum WorldSort {
|
||||
|
||||
/**
|
||||
* Sort worlds by name in ascending order.
|
||||
*/
|
||||
NAME_A_TO_Z(Comparator.comparing(WorldSort::getNameSortKey)),
|
||||
|
||||
/**
|
||||
* Sort worlds by name in descending order.
|
||||
*/
|
||||
NAME_Z_TO_A(NAME_A_TO_Z.getComparator().reversed()),
|
||||
|
||||
/**
|
||||
* Sort worlds by project in ascending order.
|
||||
*/
|
||||
PROJECT_A_TO_Z(Comparator.comparing(WorldSort::getProjectSortKey)),
|
||||
|
||||
/**
|
||||
* Sort worlds by project in descending order.
|
||||
*/
|
||||
PROJECT_Z_TO_A(PROJECT_A_TO_Z.getComparator().reversed()),
|
||||
|
||||
/**
|
||||
* Sort worlds by status ({@link BuildWorldStatus#NOT_STARTED} -> {@link BuildWorldStatus#FINISHED}).
|
||||
*/
|
||||
STATUS_NOT_STARTED(Comparator.comparingInt(WorldSort::getStatusSortKey)),
|
||||
|
||||
/**
|
||||
* Sort worlds by status ({@link BuildWorldStatus#FINISHED} -> {@link BuildWorldStatus#NOT_STARTED}).
|
||||
*/
|
||||
STATUS_FINISHED(STATUS_NOT_STARTED.getComparator().reversed()),
|
||||
|
||||
/**
|
||||
* Sort worlds by creation date in ascending order (oldest first).
|
||||
*/
|
||||
OLDEST_FIRST(Comparator.comparingLong(Displayable::getCreation)),
|
||||
|
||||
/**
|
||||
* Sort worlds by creation date in descending order (newest first).
|
||||
*/
|
||||
NEWEST_FIRST(OLDEST_FIRST.getComparator().reversed());
|
||||
|
||||
private final Comparator<Displayable> comparator;
|
||||
|
||||
WorldSort(Comparator<Displayable> comparator) {
|
||||
this.comparator = comparator;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the name of a {@link Displayable} in lowercase for sorting purposes.
|
||||
*
|
||||
* @param displayable The {@link Displayable} item (e.g., {@link BuildWorld} or {@link Folder})
|
||||
* @return The lowercase name of the displayable
|
||||
*/
|
||||
private static String getNameSortKey(Displayable displayable) {
|
||||
return displayable.getName().toLowerCase(Locale.ROOT);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the project name of a {@link Displayable} in lowercase for sorting purposes. If the displayable is a {@link BuildWorld}, its project name is returned. If it is a
|
||||
* {@link Folder}, its project is returned.
|
||||
*
|
||||
* @param displayable The {@link Displayable} item (e.g., {@link BuildWorld} or {@link Folder})
|
||||
* @return The lowercase project name, or an empty string if not applicable
|
||||
*/
|
||||
private static String getProjectSortKey(Displayable displayable) {
|
||||
return switch (displayable) {
|
||||
case BuildWorld world -> world.getData().project().get().toLowerCase(Locale.ROOT);
|
||||
case Folder folder -> folder.getProject().toLowerCase(Locale.ROOT);
|
||||
default -> "";
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the status stage of a {@link Displayable} for sorting purposes. If the displayable is a {@link BuildWorld}, its status stage is returned. Otherwise,
|
||||
* {@link BuildWorldStatus#FINISHED} stage is returned.
|
||||
*
|
||||
* @param displayable The {@link Displayable} item (e.g., {@link BuildWorld} or {@link Folder})
|
||||
* @return The status stage integer
|
||||
*/
|
||||
private static int getStatusSortKey(Displayable displayable) {
|
||||
if (displayable instanceof BuildWorld buildWorld) {
|
||||
return buildWorld.getData().status().get().getStage();
|
||||
}
|
||||
return BuildWorldStatus.FINISHED.getStage();
|
||||
}
|
||||
|
||||
/**
|
||||
* Matches a string to a {@link WorldSort} enum constant.
|
||||
*
|
||||
* @param type The string to match
|
||||
* @return The matched {@link WorldSort} constant, or {@link WorldSort#NAME_A_TO_Z} if no match is found
|
||||
*/
|
||||
public static WorldSort matchWorldSort(@Nullable String type) {
|
||||
if (type == null) {
|
||||
return NAME_A_TO_Z;
|
||||
}
|
||||
|
||||
for (WorldSort value : values()) {
|
||||
if (value.toString().equalsIgnoreCase(type)) {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
|
||||
return NAME_A_TO_Z;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the pre-configured comparator for this sort order.
|
||||
*
|
||||
* @return The comparator used to sort {@link Displayable} items
|
||||
*/
|
||||
public Comparator<Displayable> getComparator() {
|
||||
return this.comparator;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
/*
|
||||
* Copyright (c) 2018-2025, Thomas Meaney
|
||||
* Copyright (c) contributors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Provides interfaces and enumerations for navigator-specific settings within the BuildSystem API. This includes options for how worlds are displayed, filtered, and sorted in the
|
||||
* in-game navigator menus.
|
||||
*/
|
||||
package de.eintosti.buildsystem.api.world.navigator.settings;
|
||||
@@ -0,0 +1,22 @@
|
||||
/*
|
||||
* Copyright (c) 2018-2025, Thomas Meaney
|
||||
* Copyright (c) contributors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Provides interfaces and classes for managing world backups.
|
||||
*/
|
||||
package de.eintosti.buildsystem.api.world;
|
||||
@@ -0,0 +1,43 @@
|
||||
/*
|
||||
* Copyright (c) 2018-2025, Thomas Meaney
|
||||
* Copyright (c) contributors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package de.eintosti.buildsystem.api.world.util;
|
||||
|
||||
import de.eintosti.buildsystem.api.world.BuildWorld;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
|
||||
/**
|
||||
* Provides utilities for loading and managing {@link BuildWorld}s. This interface handles the process of making a world accessible on the server.
|
||||
*
|
||||
* @since 3.0.0
|
||||
*/
|
||||
@NullMarked
|
||||
public interface WorldLoader {
|
||||
|
||||
/**
|
||||
* Loads the world associated with this loader for a specific player. This typically involves teleporting the player to the world after it's loaded.
|
||||
*
|
||||
* @param player The {@link Player} for whom the world should be loaded and who will be teleported into it
|
||||
*/
|
||||
void loadForPlayer(Player player);
|
||||
|
||||
/**
|
||||
* Loads the world associated with this loader without teleporting any specific player. This is useful for background world loading or server-side operations.
|
||||
*/
|
||||
void load();
|
||||
}
|
||||
@@ -0,0 +1,118 @@
|
||||
/*
|
||||
* Copyright (c) 2018-2025, Thomas Meaney
|
||||
* Copyright (c) contributors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package de.eintosti.buildsystem.api.world.util;
|
||||
|
||||
import de.eintosti.buildsystem.api.data.Type;
|
||||
import de.eintosti.buildsystem.api.world.BuildWorld;
|
||||
import de.eintosti.buildsystem.api.world.builder.Builder;
|
||||
import de.eintosti.buildsystem.api.world.data.BuildWorldStatus;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
/**
|
||||
* Manages and checks permissions related to {@link BuildWorld}s within the BuildSystem. This interface handles permissions for actions such as entering, modifying, and executing
|
||||
* commands in worlds.
|
||||
*
|
||||
* @since 3.0.0
|
||||
*/
|
||||
@NullMarked
|
||||
public interface WorldPermissions {
|
||||
|
||||
/**
|
||||
* Checks if the given {@link Player} is allowed to enter the world associated with these permissions.
|
||||
* <p>
|
||||
* A player can enter if any of the following conditions are met:
|
||||
* <ul>
|
||||
* <li>They have the administrative permission ({@link #hasAdminPermission(Player)}).</li>
|
||||
* <li>They can bypass the view permission ({@link #canBypassViewPermission(Player)}).</li>
|
||||
* <li>They are either the world's creator or an assigned builder.</li>
|
||||
* <li>The world is public (its permission is set to "{@code -}").</li>
|
||||
* <li>They possess the specific permission defined in the world's data.</li>
|
||||
* </ul>
|
||||
*
|
||||
* @param player The {@link Player} to check
|
||||
* @return {@code true} if the player can enter the world, {@code false} otherwise
|
||||
*/
|
||||
boolean canEnter(Player player);
|
||||
|
||||
/**
|
||||
* Checks if a {@link Player} is allowed to perform a specific modification in the {@link BuildWorld}.
|
||||
* <p>
|
||||
* Modifications might be disallowed due to:
|
||||
* <ul>
|
||||
* <li>The world having its {@link BuildWorldStatus} set to {@link BuildWorldStatus#ARCHIVE}.</li>
|
||||
* <li>A world setting is enabled that specifically prohibits certain events (e.g., block placement/breaking).</li>
|
||||
* <li>The world is configured to only allow designated {@link Builder}s, and the player is neither a builder nor the world's creator.</li>
|
||||
* </ul>
|
||||
* <p>
|
||||
* However, a player can bypass these restrictions if:
|
||||
* <ul>
|
||||
* <li>They have the administrative permission ({@link #hasAdminPermission(Player)}).</li>
|
||||
* <li>They are in a "build mode" that allows them to bypass building restrictions ({@link #canBypassBuildRestriction(Player)}).</li>
|
||||
* <li>They have the bypass permission for the check</li>
|
||||
* </ul>
|
||||
*
|
||||
* @param player The player attempting to modify the world
|
||||
* @param check The specific data type representing the modification to be checked
|
||||
* @return {@code true} if the player is allowed to modify the world, {@code false} otherwise
|
||||
*/
|
||||
boolean canModify(Player player, Type<Boolean> check);
|
||||
|
||||
/**
|
||||
* Checks if the given {@link Player} is permitted to execute a specific command within the context of the current world.
|
||||
* <p>
|
||||
* Permissions are handled as follows:
|
||||
* <ul>
|
||||
* <li>The world's creator can run the command if they have the base permission, optionally ending with {@code .self}.</li>
|
||||
* <li>All other players require the permission {@code <permission>.other} to execute the command.</li>
|
||||
* </ul>
|
||||
*
|
||||
* @param player The {@link Player} attempting to run the command
|
||||
* @param permission The base permission string required for the command (e.g., "buildsystem.command.mycommand")
|
||||
* @return {@code true} if the player is authorized to run the command, {@code false} otherwise
|
||||
*/
|
||||
boolean canPerformCommand(Player player, @Nullable String permission);
|
||||
|
||||
/**
|
||||
* Checks if the given {@link Player} possesses the administrative permission, typically "{@code buildsystem.admin}". Players with this permission can bypass many
|
||||
* world-specific restrictions.
|
||||
*
|
||||
* @param player The {@link Player} to check
|
||||
* @return {@code true} if the player has the administrative permission, {@code false} otherwise
|
||||
*/
|
||||
boolean hasAdminPermission(Player player);
|
||||
|
||||
/**
|
||||
* Checks if the player can bypass the permission required to view a private world in the navigator. This is separate from the `canEnter` permission and relates specifically to
|
||||
* listing the world.
|
||||
*
|
||||
* @param player The {@link Player} to check
|
||||
* @return {@code true} if the player can bypass the view permission, {@code false} otherwise
|
||||
*/
|
||||
boolean canBypassViewPermission(Player player);
|
||||
|
||||
/**
|
||||
* Checks if the given {@link Player} can bypass standard building restrictions due to being in a special "build mode" or having a bypass permission. This allows players to
|
||||
* modify worlds even if general building is disabled.
|
||||
*
|
||||
* @param player The {@link Player} to check
|
||||
* @return {@code true} if the player can bypass build restrictions, {@code false} otherwise
|
||||
*/
|
||||
boolean canBypassBuildRestriction(Player player);
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
/*
|
||||
* Copyright (c) 2018-2025, Thomas Meaney
|
||||
* Copyright (c) contributors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package de.eintosti.buildsystem.api.world.util;
|
||||
|
||||
import de.eintosti.buildsystem.api.world.BuildWorld;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
|
||||
/**
|
||||
* Provides utilities for teleporting {@link Player}s to specific locations within a {@link BuildWorld}. This interface ensures safe and controlled player movement.
|
||||
*
|
||||
* @since 3.0.0
|
||||
*/
|
||||
@NullMarked
|
||||
public interface WorldTeleporter {
|
||||
|
||||
/**
|
||||
* Teleports the given {@link Player} to the designated spawn location of the world associated with this teleporter. If a custom spawn is not set, the player will be teleported
|
||||
* to the world's default spawn.
|
||||
*
|
||||
* @param player The {@link Player} to teleport
|
||||
*/
|
||||
void teleport(Player player);
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
/*
|
||||
* Copyright (c) 2018-2025, Thomas Meaney
|
||||
* Copyright (c) contributors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package de.eintosti.buildsystem.api.world.util;
|
||||
|
||||
import de.eintosti.buildsystem.api.world.BuildWorld;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
|
||||
/**
|
||||
* Provides utilities for managing the unloading process of a {@link BuildWorld}. This interface handles tasks such as initiating and cancelling unload procedures.
|
||||
*
|
||||
* @since 3.0.0
|
||||
*/
|
||||
@NullMarked
|
||||
public interface WorldUnloader {
|
||||
|
||||
/**
|
||||
* Manages the {@link BuildWorld}'s unload state.
|
||||
* <p>
|
||||
* If world unloading is enabled in the config, the unload task is started.
|
||||
*/
|
||||
void manageUnload();
|
||||
|
||||
/**
|
||||
* Starts a delayed task to unload the world, if world unloading is enabled in the config.
|
||||
*/
|
||||
void startUnloadTask();
|
||||
|
||||
/**
|
||||
* Resets the world unload task.
|
||||
*/
|
||||
void resetUnloadTask();
|
||||
|
||||
/**
|
||||
* Attempt to unload the world.
|
||||
* <p>
|
||||
* If the world contains any players, is blacklisted for unloading or is the spawn world, the unload will be canceled.
|
||||
*/
|
||||
void unload();
|
||||
|
||||
/**
|
||||
* Forces the unloading of the world, bypassing any checks or grace periods.
|
||||
*
|
||||
* @param save Whether the world should be saved before unloading
|
||||
*/
|
||||
void forceUnload(boolean save);
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
/*
|
||||
* Copyright (c) 2018-2025, Thomas Meaney
|
||||
* Copyright (c) contributors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Provides utility classes and interfaces for managing world-related operations.
|
||||
*/
|
||||
package de.eintosti.buildsystem.api.world.util;
|
||||
@@ -0,0 +1,233 @@
|
||||
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
|
||||
import net.minecrell.pluginyml.bukkit.BukkitPluginDescription
|
||||
|
||||
applyCoreConfiguration()
|
||||
|
||||
plugins {
|
||||
id("java-library")
|
||||
id("com.gradleup.shadow") version "9.2.2"
|
||||
id("de.eldoria.plugin-yml.bukkit") version "0.8.0"
|
||||
}
|
||||
|
||||
project.description = "Core"
|
||||
|
||||
repositories {
|
||||
maven {
|
||||
name = "AuthLib"
|
||||
url = uri("https://libraries.minecraft.net/")
|
||||
}
|
||||
maven {
|
||||
name = "EngineHub"
|
||||
url = uri("https://maven.enginehub.org/repo/")
|
||||
}
|
||||
maven {
|
||||
name = "PlaceholderAPI"
|
||||
url = uri("https://repo.extendedclip.com/content/repositories/placeholderapi/")
|
||||
}
|
||||
maven {
|
||||
name = "Modrinth"
|
||||
url = uri("https://api.modrinth.com/maven")
|
||||
}
|
||||
modrinthMavenWorkaround(
|
||||
"axiom-paper-plugin",
|
||||
"4.0.1-1.21.1",
|
||||
"AxiomPaper-4.0.1-for-MC1.21.1.jar"
|
||||
)
|
||||
}
|
||||
|
||||
dependencies {
|
||||
api(project(":buildsystem-api"))
|
||||
|
||||
compileOnlyApi(libs.annotations)
|
||||
compileOnlyApi(libs.jspecify)
|
||||
|
||||
compileOnly(libs.spigot)
|
||||
compileOnly(libs.authlib)
|
||||
compileOnly(libs.luckperms)
|
||||
compileOnly(libs.placeholderapi)
|
||||
compileOnly(libs.worldedit)
|
||||
compileOnly(libs.axiompaper)
|
||||
|
||||
implementation(libs.paperlib)
|
||||
implementation(libs.xseries)
|
||||
implementation(libs.fastboard)
|
||||
implementation(libs.nbt) { isTransitive = false }
|
||||
implementation(libs.bstats)
|
||||
implementation(libs.aws.core) // Unable to find the dependency at runtime, so we add it here
|
||||
|
||||
library(libs.bundles.aws)
|
||||
library(libs.bouncycastle)
|
||||
library(libs.sftp)
|
||||
library(libs.zip4j)
|
||||
}
|
||||
|
||||
tasks.named("assemble") {
|
||||
dependsOn(tasks.named("shadowJar"))
|
||||
}
|
||||
|
||||
tasks.named<ShadowJar>("shadowJar") {
|
||||
minimize()
|
||||
archiveFileName.set("${rootProject.name}-${project.version}.jar")
|
||||
|
||||
val shadePath = "de.eintosti.buildsystem.util.external"
|
||||
relocate("io.papermc.lib", "$shadePath.paperlib")
|
||||
relocate("com.cryptomorin.xseries", "$shadePath.xseries")
|
||||
relocate("fr.mrmicky.fastboard", "$shadePath.fastboard")
|
||||
relocate("dev.dewy.nbt", "$shadePath.nbt")
|
||||
relocate("org.bstats", "$shadePath.bstats")
|
||||
}
|
||||
|
||||
tasks.processResources {
|
||||
val props = mapOf("version" to project.version)
|
||||
filesMatching("plugin.yml") {
|
||||
expand(props)
|
||||
}
|
||||
}
|
||||
|
||||
bukkit {
|
||||
name = "BuildSystem"
|
||||
version = "${project.version}"
|
||||
description = "Powerful, easy to use system for builders"
|
||||
author = "einTosti"
|
||||
website = "https://buildsystem.eintosti.de"
|
||||
|
||||
main = "de.eintosti.buildsystem.BuildSystemPlugin"
|
||||
apiVersion = "1.13"
|
||||
softDepend = listOf("LuckPerms", "PlaceholderAPI", "WorldEdit", "AxiomPaper")
|
||||
|
||||
commands {
|
||||
register("back") {
|
||||
description = "Teleports you to your previous location."
|
||||
usage = "/<command>"
|
||||
}
|
||||
register("blocks") {
|
||||
description = "Opens a menu with secret blocks."
|
||||
usage = "/<command>"
|
||||
}
|
||||
register("build") {
|
||||
description = "Bypass build restrictions."
|
||||
usage = "/<command> [player]"
|
||||
}
|
||||
register("buildsystem") {
|
||||
description = "Overview of all plugin commands."
|
||||
usage = "/<command>"
|
||||
}
|
||||
register("config") {
|
||||
description = "Reload the config."
|
||||
usage = "/<command> reload"
|
||||
}
|
||||
register("day") {
|
||||
description = "Set a world's time to daytime."
|
||||
usage = "/<command> [world]"
|
||||
}
|
||||
register("explosions") {
|
||||
description = "Toggle explosions within a world."
|
||||
usage = "/<command> [world]"
|
||||
}
|
||||
register("gamemode") {
|
||||
description = "Change your gamemode."
|
||||
aliases = listOf("gm")
|
||||
usage = "/<command> <mode> [player]"
|
||||
}
|
||||
register("night") {
|
||||
description = "Set a world's time to nighttime."
|
||||
usage = "/<command> [world]"
|
||||
}
|
||||
register("noai") {
|
||||
description = "Disable all the entity AIs in a world."
|
||||
usage = "/<command> [world]"
|
||||
}
|
||||
register("physics") {
|
||||
description = "Toggle block physics."
|
||||
usage = "/<command> [world]"
|
||||
}
|
||||
register("settings") {
|
||||
description = "Manage user settings."
|
||||
usage = "/<command>"
|
||||
}
|
||||
register("setup") {
|
||||
description = "Change the default items in used in the navigator."
|
||||
usage = "/<command>"
|
||||
}
|
||||
register("skull") {
|
||||
description = "Receive a player's skull."
|
||||
usage = "/<command> [name]"
|
||||
}
|
||||
register("spawn") {
|
||||
description = "Teleport to the spawn."
|
||||
usage = "/<command>"
|
||||
}
|
||||
register("speed") {
|
||||
description = "Change your flying/walking speed."
|
||||
aliases = listOf("s")
|
||||
usage = "/<command> [1-5]"
|
||||
}
|
||||
register("top") {
|
||||
description = "Teleports you to the highest location."
|
||||
usage = "/<command>"
|
||||
}
|
||||
register("worlds") {
|
||||
description = "Open the world menu."
|
||||
aliases = listOf("w")
|
||||
usage = "/<command>"
|
||||
}
|
||||
}
|
||||
permissions {
|
||||
register("buildsystem.help") {
|
||||
children = listOf("buildsystem.help.buildsystem", "buildsystem.help.worlds")
|
||||
description = "Permission for help commands."
|
||||
default = BukkitPluginDescription.Permission.Default.TRUE
|
||||
}
|
||||
register("buildsystem.navigator") {
|
||||
description = "Open the worlds navigator."
|
||||
default = BukkitPluginDescription.Permission.Default.TRUE
|
||||
}
|
||||
register("buildsystem.navigator.item") {
|
||||
description = "Receive and use the navigator."
|
||||
default = BukkitPluginDescription.Permission.Default.TRUE
|
||||
}
|
||||
register("buildsystem.create") {
|
||||
children = listOf(
|
||||
"buildsystem.create.private",
|
||||
"buildsystem.create.type.normal",
|
||||
"buildsystem.create.type.flat",
|
||||
"buildsystem.create.type.nether",
|
||||
"buildsystem.create.type.end",
|
||||
"buildsystem.create.type.void"
|
||||
)
|
||||
description = "Permission for creating world types."
|
||||
default = BukkitPluginDescription.Permission.Default.TRUE
|
||||
}
|
||||
register("buildsystem.setstatus") {
|
||||
children = listOf(
|
||||
"buildsystem.setstatus.hidden",
|
||||
"buildsystem.setstatus.archive",
|
||||
"buildsystem.setstatus.finished",
|
||||
"buildsystem.setstatus.almostfinished",
|
||||
"buildsystem.setstatus.inprogress",
|
||||
"buildsystem.setstatus.notstarted"
|
||||
)
|
||||
description = "Permission for setting world status."
|
||||
default = BukkitPluginDescription.Permission.Default.OP
|
||||
}
|
||||
register("buildsystem.gamemode") {
|
||||
children = listOf("buildsystem.gamemode.survival", "buildsystem.gamemode.creative", "buildsystem.gamemode.adventure", "buildsystem.gamemode.spectator")
|
||||
description = "Permission for changing own gamemode."
|
||||
default = BukkitPluginDescription.Permission.Default.OP
|
||||
}
|
||||
register("buildsystem.gamemode.other") {
|
||||
children =
|
||||
listOf("buildsystem.gamemode.survival.other", "buildsystem.gamemode.creative.other", "buildsystem.gamemode.adventure.other", "buildsystem.gamemode.spectator.other")
|
||||
description = "Permission for changing other player's gamemode."
|
||||
default = BukkitPluginDescription.Permission.Default.OP
|
||||
}
|
||||
register("buildsystem.physics.message") {
|
||||
description = "Receive the message that physics are disabled in a world."
|
||||
default = BukkitPluginDescription.Permission.Default.TRUE
|
||||
}
|
||||
register("buildsystem.updates") {
|
||||
description = "Receive update messages."
|
||||
default = BukkitPluginDescription.Permission.Default.OP
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,460 @@
|
||||
/*
|
||||
* Copyright (c) 2018-2025, Thomas Meaney
|
||||
* Copyright (c) contributors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package de.eintosti.buildsystem;
|
||||
|
||||
import de.eintosti.buildsystem.api.BuildSystem;
|
||||
import de.eintosti.buildsystem.api.BuildSystemApi;
|
||||
import de.eintosti.buildsystem.api.player.BuildPlayer;
|
||||
import de.eintosti.buildsystem.api.player.settings.Settings;
|
||||
import de.eintosti.buildsystem.api.world.navigator.settings.NavigatorType;
|
||||
import de.eintosti.buildsystem.command.BackCommand;
|
||||
import de.eintosti.buildsystem.command.BlocksCommand;
|
||||
import de.eintosti.buildsystem.command.BuildCommand;
|
||||
import de.eintosti.buildsystem.command.BuildSystemCommand;
|
||||
import de.eintosti.buildsystem.command.ConfigCommand;
|
||||
import de.eintosti.buildsystem.command.ExplosionsCommand;
|
||||
import de.eintosti.buildsystem.command.GamemodeCommand;
|
||||
import de.eintosti.buildsystem.command.NoAICommand;
|
||||
import de.eintosti.buildsystem.command.PhysicsCommand;
|
||||
import de.eintosti.buildsystem.command.SettingsCommand;
|
||||
import de.eintosti.buildsystem.command.SetupCommand;
|
||||
import de.eintosti.buildsystem.command.SkullCommand;
|
||||
import de.eintosti.buildsystem.command.SpawnCommand;
|
||||
import de.eintosti.buildsystem.command.SpeedCommand;
|
||||
import de.eintosti.buildsystem.command.TimeCommand;
|
||||
import de.eintosti.buildsystem.command.TopCommand;
|
||||
import de.eintosti.buildsystem.command.WorldsCommand;
|
||||
import de.eintosti.buildsystem.command.tabcomplete.BuildTabCompleter;
|
||||
import de.eintosti.buildsystem.command.tabcomplete.ConfigTabCompleter;
|
||||
import de.eintosti.buildsystem.command.tabcomplete.EmptyTabCompleter;
|
||||
import de.eintosti.buildsystem.command.tabcomplete.GamemodeTabCompleter;
|
||||
import de.eintosti.buildsystem.command.tabcomplete.PhysicsTabCompleter;
|
||||
import de.eintosti.buildsystem.command.tabcomplete.SpawnTabCompleter;
|
||||
import de.eintosti.buildsystem.command.tabcomplete.SpeedTabCompleter;
|
||||
import de.eintosti.buildsystem.command.tabcomplete.TimeTabCompleter;
|
||||
import de.eintosti.buildsystem.command.tabcomplete.WorldsTabCompleter;
|
||||
import de.eintosti.buildsystem.config.Config;
|
||||
import de.eintosti.buildsystem.config.Config.Folder;
|
||||
import de.eintosti.buildsystem.config.Config.Settings.Archive;
|
||||
import de.eintosti.buildsystem.config.Config.Settings.Builder;
|
||||
import de.eintosti.buildsystem.config.Config.World;
|
||||
import de.eintosti.buildsystem.config.Config.World.Unload;
|
||||
import de.eintosti.buildsystem.config.migration.ConfigMigrationManager;
|
||||
import de.eintosti.buildsystem.expansion.luckperms.LuckPermsExpansion;
|
||||
import de.eintosti.buildsystem.expansion.placeholderapi.PlaceholderApiExpansion;
|
||||
import de.eintosti.buildsystem.listener.AsyncPlayerChatListener;
|
||||
import de.eintosti.buildsystem.listener.AsyncPlayerPreLoginListener;
|
||||
import de.eintosti.buildsystem.listener.BlockPhysicsListener;
|
||||
import de.eintosti.buildsystem.listener.BuildModePreventationListener;
|
||||
import de.eintosti.buildsystem.listener.BuildWorldResetUnloadListener;
|
||||
import de.eintosti.buildsystem.listener.EditSessionListener;
|
||||
import de.eintosti.buildsystem.listener.EntityDamageListener;
|
||||
import de.eintosti.buildsystem.listener.EntitySpawnListener;
|
||||
import de.eintosti.buildsystem.listener.FoodLevelChangeListener;
|
||||
import de.eintosti.buildsystem.listener.InventoryCreativeListener;
|
||||
import de.eintosti.buildsystem.listener.InventoryListener;
|
||||
import de.eintosti.buildsystem.listener.NavigatorListener;
|
||||
import de.eintosti.buildsystem.listener.PlayerChangedWorldListener;
|
||||
import de.eintosti.buildsystem.listener.PlayerCommandPreprocessListener;
|
||||
import de.eintosti.buildsystem.listener.PlayerInventoryClearListener;
|
||||
import de.eintosti.buildsystem.listener.PlayerJoinListener;
|
||||
import de.eintosti.buildsystem.listener.PlayerMoveListener;
|
||||
import de.eintosti.buildsystem.listener.PlayerQuitListener;
|
||||
import de.eintosti.buildsystem.listener.PlayerRespawnListener;
|
||||
import de.eintosti.buildsystem.listener.PlayerTeleportListener;
|
||||
import de.eintosti.buildsystem.listener.SettingsInteractListener;
|
||||
import de.eintosti.buildsystem.listener.SignChangeListener;
|
||||
import de.eintosti.buildsystem.listener.WeatherChangeListener;
|
||||
import de.eintosti.buildsystem.listener.WorldManipulateByAxiomListener;
|
||||
import de.eintosti.buildsystem.listener.WorldManipulateListener;
|
||||
import de.eintosti.buildsystem.player.LogoutLocationImpl;
|
||||
import de.eintosti.buildsystem.player.PlayerServiceImpl;
|
||||
import de.eintosti.buildsystem.player.customblock.CustomBlockManager;
|
||||
import de.eintosti.buildsystem.player.settings.NoClipManager;
|
||||
import de.eintosti.buildsystem.player.settings.SettingsManager;
|
||||
import de.eintosti.buildsystem.util.UpdateChecker;
|
||||
import de.eintosti.buildsystem.util.inventory.InventoryManager;
|
||||
import de.eintosti.buildsystem.world.SpawnManager;
|
||||
import de.eintosti.buildsystem.world.WorldServiceImpl;
|
||||
import de.eintosti.buildsystem.world.backup.BackupService;
|
||||
import de.eintosti.buildsystem.world.display.CustomizableIcons;
|
||||
import de.eintosti.buildsystem.world.navigator.ArmorStandManager;
|
||||
import java.io.File;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.Callable;
|
||||
import org.bstats.bukkit.Metrics;
|
||||
import org.bstats.charts.AdvancedPie;
|
||||
import org.bstats.charts.SimplePie;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.PluginManager;
|
||||
import org.bukkit.plugin.ServicePriority;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
import org.bukkit.scheduler.BukkitTask;
|
||||
|
||||
public class BuildSystemPlugin extends JavaPlugin {
|
||||
|
||||
public static final int SPIGOT_ID = 60441;
|
||||
public static final int METRICS_ID = 7427;
|
||||
public static final String ADMIN_PERMISSION = "buildsystem.admin";
|
||||
|
||||
private static BuildSystemPlugin instance;
|
||||
|
||||
private ArmorStandManager armorStandManager;
|
||||
private CustomBlockManager customBlockManager;
|
||||
private InventoryManager inventoryManager;
|
||||
private PlayerServiceImpl playerService;
|
||||
private NoClipManager noClipManager;
|
||||
private SettingsManager settingsManager;
|
||||
private SpawnManager spawnManager;
|
||||
private WorldServiceImpl worldService;
|
||||
private BackupService backupService;
|
||||
private CustomizableIcons customizableIcons;
|
||||
|
||||
private LuckPermsExpansion luckPermsExpansion;
|
||||
private PlaceholderApiExpansion placeholderApiExpansion;
|
||||
|
||||
private BuildSystemApi api;
|
||||
|
||||
private BukkitTask configSaveTask;
|
||||
|
||||
@Override
|
||||
public void onLoad() {
|
||||
instance = this;
|
||||
|
||||
new ConfigMigrationManager(this).migrate();
|
||||
this.getConfig().options().copyDefaults(true);
|
||||
this.saveConfig();
|
||||
Config.load();
|
||||
|
||||
Messages.createMessageFile();
|
||||
createTemplateFolder();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEnable() {
|
||||
initClasses();
|
||||
|
||||
registerCommands();
|
||||
registerTabCompleters();
|
||||
registerListeners();
|
||||
registerExpansions();
|
||||
|
||||
performUpdateCheck();
|
||||
|
||||
this.api = new BuildSystemApi(this);
|
||||
this.api.register();
|
||||
getServer().getServicesManager().register(BuildSystem.class, api, this, ServicePriority.Normal);
|
||||
|
||||
Bukkit.getOnlinePlayers().forEach(pl -> {
|
||||
BuildPlayer buildPlayer = playerService.getPlayerStorage().createBuildPlayer(pl);
|
||||
Settings settings = buildPlayer.getSettings();
|
||||
noClipManager.startNoClip(pl, settings);
|
||||
settingsManager.displayScoreboard(pl);
|
||||
});
|
||||
|
||||
registerStats();
|
||||
|
||||
this.configSaveTask = Bukkit.getScheduler().runTaskTimer(this, this::saveBuildConfig, 6000L, 6000L);
|
||||
|
||||
Bukkit.getConsoleSender().sendMessage(
|
||||
"%sBuildSystem » Plugin %senabled%s!".formatted(ChatColor.RESET, ChatColor.GREEN, ChatColor.RESET)
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDisable() {
|
||||
Bukkit.getOnlinePlayers().forEach(pl -> {
|
||||
BuildPlayer buildPlayer = playerService.getPlayerStorage().getBuildPlayer(pl);
|
||||
buildPlayer.getCachedValues().resetCachedValues(pl);
|
||||
buildPlayer.setLogoutLocation(new LogoutLocationImpl(pl.getWorld().getName(), pl.getLocation()));
|
||||
|
||||
settingsManager.hideScoreboard(pl);
|
||||
noClipManager.stopNoClip(pl.getUniqueId());
|
||||
playerService.closeNewNavigator(pl);
|
||||
});
|
||||
|
||||
this.backupService.getStorage().close();
|
||||
|
||||
reloadConfigData(false);
|
||||
saveConfig();
|
||||
saveBuildConfig();
|
||||
|
||||
if (this.configSaveTask != null) {
|
||||
this.configSaveTask.cancel();
|
||||
}
|
||||
|
||||
unregisterExpansions();
|
||||
this.api.unregister();
|
||||
|
||||
Bukkit.getConsoleSender().sendMessage(
|
||||
"%sBuildSystem » Plugin %sdisabled%s!".formatted(ChatColor.RESET, ChatColor.RED, ChatColor.RESET)
|
||||
);
|
||||
|
||||
instance = null;
|
||||
}
|
||||
|
||||
public static BuildSystemPlugin get() {
|
||||
if (instance == null) {
|
||||
throw new IllegalStateException("BuildSystemPlugin instance is not initialized. Make sure the plugin is enabled.");
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
|
||||
private void initClasses() {
|
||||
this.customizableIcons = new CustomizableIcons(this);
|
||||
|
||||
this.inventoryManager = new InventoryManager();
|
||||
this.armorStandManager = new ArmorStandManager();
|
||||
this.customBlockManager = new CustomBlockManager(this);
|
||||
(this.playerService = new PlayerServiceImpl(this)).init();
|
||||
this.noClipManager = new NoClipManager(this);
|
||||
(this.worldService = new WorldServiceImpl(this)).init();
|
||||
this.backupService = new BackupService(this);
|
||||
this.settingsManager = new SettingsManager(this);
|
||||
this.spawnManager = new SpawnManager(this);
|
||||
}
|
||||
|
||||
private void registerCommands() {
|
||||
new BackCommand(this);
|
||||
new BlocksCommand(this);
|
||||
new BuildCommand(this);
|
||||
new BuildSystemCommand(this);
|
||||
new ConfigCommand(this);
|
||||
new ExplosionsCommand(this);
|
||||
new GamemodeCommand(this);
|
||||
new NoAICommand(this);
|
||||
new PhysicsCommand(this);
|
||||
new SettingsCommand(this);
|
||||
new SetupCommand(this);
|
||||
new SkullCommand(this);
|
||||
new SpawnCommand(this);
|
||||
new SpeedCommand(this);
|
||||
new TimeCommand(this);
|
||||
new TopCommand(this);
|
||||
new WorldsCommand(this);
|
||||
}
|
||||
|
||||
private void registerTabCompleters() {
|
||||
new BuildTabCompleter(this);
|
||||
new ConfigTabCompleter(this);
|
||||
new EmptyTabCompleter(this);
|
||||
new GamemodeTabCompleter(this);
|
||||
new PhysicsTabCompleter(this);
|
||||
new SpawnTabCompleter(this);
|
||||
new SpeedTabCompleter(this);
|
||||
new TimeTabCompleter(this);
|
||||
new WorldsTabCompleter(this);
|
||||
}
|
||||
|
||||
private void registerListeners() {
|
||||
new AsyncPlayerChatListener(this);
|
||||
new AsyncPlayerPreLoginListener(this);
|
||||
new BlockPhysicsListener(this);
|
||||
new CustomBlockManager(this);
|
||||
new BuildModePreventationListener(this);
|
||||
new BuildWorldResetUnloadListener(this);
|
||||
new EntitySpawnListener(this);
|
||||
new FoodLevelChangeListener(this);
|
||||
new InventoryCreativeListener(this);
|
||||
new InventoryListener(this);
|
||||
new NavigatorListener(this);
|
||||
new PlayerChangedWorldListener(this);
|
||||
new EntityDamageListener(this);
|
||||
new PlayerCommandPreprocessListener(this);
|
||||
new PlayerInventoryClearListener(this);
|
||||
new PlayerJoinListener(this);
|
||||
new PlayerMoveListener(this);
|
||||
new PlayerQuitListener(this);
|
||||
new PlayerRespawnListener(this);
|
||||
new PlayerTeleportListener(this);
|
||||
new SettingsInteractListener(this);
|
||||
new SignChangeListener(this);
|
||||
new WeatherChangeListener(this);
|
||||
new WorldManipulateListener(this);
|
||||
}
|
||||
|
||||
private void registerStats() {
|
||||
Metrics metrics = new Metrics(this, METRICS_ID);
|
||||
metrics.addCustomChart(new SimplePie("archive_vanish", () -> String.valueOf(Archive.vanish)));
|
||||
metrics.addCustomChart(new SimplePie("block_world_edit", () -> String.valueOf(Builder.blockWorldEditNonBuilder)));
|
||||
metrics.addCustomChart(new SimplePie("join_quit_messages", () -> String.valueOf(Config.Messages.joinQuitMessages)));
|
||||
metrics.addCustomChart(new SimplePie("lock_weather", () -> String.valueOf(World.lockWeather)));
|
||||
metrics.addCustomChart(new SimplePie("scoreboard", () -> String.valueOf(Config.Settings.scoreboard)));
|
||||
metrics.addCustomChart(new SimplePie("update_checker", () -> String.valueOf(Config.Settings.updateChecker)));
|
||||
metrics.addCustomChart(new SimplePie("unload_worlds", () -> String.valueOf(Unload.enabled)));
|
||||
metrics.addCustomChart(new AdvancedPie("navigator_type", new Callable<>() {
|
||||
@Override
|
||||
public Map<String, Integer> call() {
|
||||
Map<String, Integer> valueMap = new HashMap<>();
|
||||
valueMap.put("Old", getPlayersWithNavigator(NavigatorType.OLD));
|
||||
valueMap.put("New", getPlayersWithNavigator(NavigatorType.NEW));
|
||||
return valueMap;
|
||||
}
|
||||
|
||||
private int getPlayersWithNavigator(NavigatorType navigatorType) {
|
||||
return (int) playerService.getPlayerStorage().getBuildPlayers().stream()
|
||||
.filter(buildPlayer -> buildPlayer.getSettings().getNavigatorType() == navigatorType)
|
||||
.count();
|
||||
}
|
||||
}));
|
||||
metrics.addCustomChart(new SimplePie("folder_override_permissions", () -> String.valueOf(Folder.overridePermissions)));
|
||||
metrics.addCustomChart(new SimplePie("folder_override_projects", () -> String.valueOf(Folder.overrideProjects)));
|
||||
}
|
||||
|
||||
private void registerExpansions() {
|
||||
PluginManager pluginManager = Bukkit.getPluginManager();
|
||||
|
||||
if (pluginManager.getPlugin("PlaceholderAPI") != null) {
|
||||
this.placeholderApiExpansion = new PlaceholderApiExpansion(this);
|
||||
this.placeholderApiExpansion.register();
|
||||
}
|
||||
|
||||
if (pluginManager.getPlugin("LuckPerms") != null) {
|
||||
this.luckPermsExpansion = new LuckPermsExpansion(this);
|
||||
this.luckPermsExpansion.registerAll();
|
||||
}
|
||||
|
||||
if (pluginManager.getPlugin("AxiomPaper") != null) {
|
||||
new WorldManipulateByAxiomListener(this);
|
||||
}
|
||||
|
||||
boolean isWorldEdit = pluginManager.getPlugin("WorldEdit") != null
|
||||
|| pluginManager.getPlugin("FastAsyncWorldEdit") != null;
|
||||
if (isWorldEdit && Builder.blockWorldEditNonBuilder) {
|
||||
new EditSessionListener(this);
|
||||
}
|
||||
}
|
||||
|
||||
private void unregisterExpansions() {
|
||||
if (this.placeholderApiExpansion != null) {
|
||||
this.placeholderApiExpansion.unregister();
|
||||
}
|
||||
|
||||
if (this.luckPermsExpansion != null) {
|
||||
this.luckPermsExpansion.unregisterAll();
|
||||
}
|
||||
}
|
||||
|
||||
private void performUpdateCheck() {
|
||||
if (!Config.Settings.updateChecker) {
|
||||
return;
|
||||
}
|
||||
|
||||
UpdateChecker.init(this, SPIGOT_ID).requestUpdateCheck().whenComplete((result, e) -> {
|
||||
if (result.requiresUpdate()) {
|
||||
Bukkit.getConsoleSender().sendMessage(
|
||||
ChatColor.YELLOW + "[BuildSystem] Great! a new update is available: "
|
||||
+ ChatColor.GREEN + "v" + result.getNewestVersion()
|
||||
);
|
||||
Bukkit.getConsoleSender().sendMessage(
|
||||
ChatColor.YELLOW + " ➥ Your current version: " +
|
||||
ChatColor.RED + this.getDescription().getVersion()
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
UpdateChecker.UpdateReason reason = result.getReason();
|
||||
switch (reason) {
|
||||
case COULD_NOT_CONNECT, INVALID_JSON, UNAUTHORIZED_QUERY, UNKNOWN_ERROR, UNSUPPORTED_VERSION_SCHEME -> Bukkit.getConsoleSender().sendMessage(
|
||||
ChatColor.RED + "[BuildSystem] Could not check for a new version of BuildSystem. Reason: " + reason
|
||||
);
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
private void createTemplateFolder() {
|
||||
File templateFolder = new File(getDataFolder() + File.separator + "templates");
|
||||
if (templateFolder.mkdirs()) {
|
||||
getLogger().info("Created \"templates\" folder");
|
||||
}
|
||||
}
|
||||
|
||||
private void saveBuildConfig() {
|
||||
worldService.save();
|
||||
playerService.save();
|
||||
spawnManager.save();
|
||||
}
|
||||
|
||||
/**
|
||||
* Reloads the config and config data.
|
||||
*
|
||||
* @param init Whether the plugin should reinitialize classes
|
||||
*/
|
||||
public void reloadConfigData(boolean init) {
|
||||
for (Player pl : Bukkit.getOnlinePlayers()) {
|
||||
getSettingsManager().hideScoreboard(pl);
|
||||
}
|
||||
|
||||
reloadConfig();
|
||||
Config.load();
|
||||
|
||||
if (init) {
|
||||
worldService.getWorldStorage().getBuildWorlds().forEach(buildWorld -> buildWorld.getUnloader().manageUnload());
|
||||
|
||||
if (Config.Settings.scoreboard) {
|
||||
getSettingsManager().displayScoreboard();
|
||||
} else {
|
||||
getSettingsManager().hideScoreboards();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public ArmorStandManager getArmorStandManager() {
|
||||
return armorStandManager;
|
||||
}
|
||||
|
||||
public CustomBlockManager getCustomBlockManager() {
|
||||
return customBlockManager;
|
||||
}
|
||||
|
||||
public InventoryManager getInventoryManager() {
|
||||
return inventoryManager;
|
||||
}
|
||||
|
||||
public PlayerServiceImpl getPlayerService() {
|
||||
return playerService;
|
||||
}
|
||||
|
||||
public NoClipManager getNoClipManager() {
|
||||
return noClipManager;
|
||||
}
|
||||
|
||||
public SettingsManager getSettingsManager() {
|
||||
return settingsManager;
|
||||
}
|
||||
|
||||
public SpawnManager getSpawnManager() {
|
||||
return spawnManager;
|
||||
}
|
||||
|
||||
public WorldServiceImpl getWorldService() {
|
||||
return worldService;
|
||||
}
|
||||
|
||||
public BackupService getBackupService() {
|
||||
return backupService;
|
||||
}
|
||||
|
||||
public CustomizableIcons getCustomizableIcons() {
|
||||
return customizableIcons;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
/*
|
||||
* Copyright (c) 2018-2025, Thomas Meaney
|
||||
* Copyright (c) contributors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package de.eintosti.buildsystem.api;
|
||||
|
||||
import de.eintosti.buildsystem.BuildSystemPlugin;
|
||||
import de.eintosti.buildsystem.api.player.PlayerService;
|
||||
import de.eintosti.buildsystem.api.world.WorldService;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
|
||||
@NullMarked
|
||||
public class BuildSystemApi implements BuildSystem {
|
||||
|
||||
private final BuildSystemPlugin plugin;
|
||||
|
||||
public BuildSystemApi(BuildSystemPlugin plugin) {
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
@Override
|
||||
public WorldService getWorldService() {
|
||||
return plugin.getWorldService();
|
||||
}
|
||||
|
||||
@Override
|
||||
public PlayerService getPlayerService() {
|
||||
return plugin.getPlayerService();
|
||||
}
|
||||
|
||||
public void register() {
|
||||
BuildSystemProvider.register(this);
|
||||
}
|
||||
|
||||
public void unregister() {
|
||||
BuildSystemProvider.unregister();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,84 @@
|
||||
/*
|
||||
* Copyright (c) 2018-2025, Thomas Meaney
|
||||
* Copyright (c) contributors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package de.eintosti.buildsystem.command;
|
||||
|
||||
import com.cryptomorin.xseries.XSound;
|
||||
import de.eintosti.buildsystem.BuildSystemPlugin;
|
||||
import de.eintosti.buildsystem.Messages;
|
||||
import de.eintosti.buildsystem.api.player.BuildPlayer;
|
||||
import de.eintosti.buildsystem.api.storage.PlayerStorage;
|
||||
import io.papermc.lib.PaperLib;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
|
||||
@NullMarked
|
||||
public class BackCommand implements CommandExecutor {
|
||||
|
||||
private final BuildSystemPlugin plugin;
|
||||
private final PlayerStorage playerStorage;
|
||||
|
||||
public BackCommand(BuildSystemPlugin plugin) {
|
||||
this.plugin = plugin;
|
||||
this.playerStorage = plugin.getPlayerService().getPlayerStorage();
|
||||
plugin.getCommand("back").setExecutor(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
|
||||
if (!(sender instanceof Player player)) {
|
||||
plugin.getLogger().warning(Messages.getString("sender_not_player", sender));
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!player.hasPermission("buildsystem.back")) {
|
||||
Messages.sendPermissionError(player);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (args.length == 0) {
|
||||
teleportBack(player);
|
||||
} else {
|
||||
Messages.sendMessage(player, "back_usage");
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private void teleportBack(Player player) {
|
||||
BuildPlayer buildPlayer = playerStorage.getBuildPlayer(player);
|
||||
Location previousLocation = buildPlayer.getPreviousLocation();
|
||||
if (previousLocation == null) {
|
||||
Messages.sendMessage(player, "back_failed");
|
||||
return;
|
||||
}
|
||||
|
||||
PaperLib.teleportAsync(player, previousLocation)
|
||||
.whenComplete((completed, throwable) -> {
|
||||
if (!completed) {
|
||||
return;
|
||||
}
|
||||
XSound.ENTITY_ZOMBIE_INFECT.play(player);
|
||||
Messages.sendMessage(player, "back_teleported");
|
||||
buildPlayer.setPreviousLocation(null);
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
/*
|
||||
* Copyright (c) 2018-2025, Thomas Meaney
|
||||
* Copyright (c) contributors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package de.eintosti.buildsystem.command;
|
||||
|
||||
import com.cryptomorin.xseries.XSound;
|
||||
import de.eintosti.buildsystem.BuildSystemPlugin;
|
||||
import de.eintosti.buildsystem.Messages;
|
||||
import de.eintosti.buildsystem.player.customblock.CustomBlockInventory;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
|
||||
@NullMarked
|
||||
public class BlocksCommand implements CommandExecutor {
|
||||
|
||||
private final BuildSystemPlugin plugin;
|
||||
|
||||
public BlocksCommand(BuildSystemPlugin plugin) {
|
||||
this.plugin = plugin;
|
||||
plugin.getCommand("blocks").setExecutor(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
|
||||
if (!(sender instanceof Player player)) {
|
||||
plugin.getLogger().warning(Messages.getString("sender_not_player", sender));
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!player.hasPermission("buildsystem.blocks")) {
|
||||
Messages.sendPermissionError(player);
|
||||
return true;
|
||||
}
|
||||
|
||||
XSound.BLOCK_CHEST_OPEN.play(player);
|
||||
new CustomBlockInventory(plugin).openInventory(player);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,140 @@
|
||||
/*
|
||||
* Copyright (c) 2018-2025, Thomas Meaney
|
||||
* Copyright (c) contributors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package de.eintosti.buildsystem.command;
|
||||
|
||||
import com.cryptomorin.xseries.XSound;
|
||||
import de.eintosti.buildsystem.BuildSystemPlugin;
|
||||
import de.eintosti.buildsystem.Messages;
|
||||
import de.eintosti.buildsystem.api.event.world.PlayerBuildModeToggleEvent;
|
||||
import de.eintosti.buildsystem.api.player.BuildPlayer;
|
||||
import de.eintosti.buildsystem.api.player.CachedValues;
|
||||
import de.eintosti.buildsystem.api.player.PlayerService;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
|
||||
@NullMarked
|
||||
public class BuildCommand implements CommandExecutor {
|
||||
|
||||
private final BuildSystemPlugin plugin;
|
||||
private final PlayerService playerService;
|
||||
|
||||
public BuildCommand(BuildSystemPlugin plugin) {
|
||||
this.plugin = plugin;
|
||||
this.playerService = plugin.getPlayerService();
|
||||
plugin.getCommand("build").setExecutor(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
|
||||
if (!(sender instanceof Player player)) {
|
||||
plugin.getLogger().warning(Messages.getString("sender_not_player", sender));
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!player.hasPermission("buildsystem.build")) {
|
||||
Messages.sendPermissionError(player);
|
||||
return true;
|
||||
}
|
||||
|
||||
switch (args.length) {
|
||||
case 0 -> {
|
||||
toggleBuildMode(player, player);
|
||||
}
|
||||
|
||||
case 1 -> {
|
||||
if (!player.hasPermission("buildsystem.build.other")) {
|
||||
Messages.sendPermissionError(player);
|
||||
return true;
|
||||
}
|
||||
|
||||
Player target = Bukkit.getPlayer(args[0]);
|
||||
if (target == null) {
|
||||
Messages.sendMessage(player, "build_player_not_found");
|
||||
return true;
|
||||
}
|
||||
|
||||
toggleBuildMode(target, player);
|
||||
}
|
||||
|
||||
default -> {
|
||||
Messages.sendMessage(player, "build_usage");
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Toggles the build mode for a target player.
|
||||
*
|
||||
* @param target The player whose build mode is being changed
|
||||
* @param sender The player who initiated the action, may be the target player themselves
|
||||
*/
|
||||
private void toggleBuildMode(Player target, Player sender) {
|
||||
UUID targetUuid = target.getUniqueId();
|
||||
boolean isEnteringBuildMode = !playerService.getBuildModePlayers().contains(targetUuid);
|
||||
|
||||
PlayerBuildModeToggleEvent toggleEvent = new PlayerBuildModeToggleEvent(target, isEnteringBuildMode, sender);
|
||||
Bukkit.getServer().getPluginManager().callEvent(toggleEvent);
|
||||
if (toggleEvent.isCancelled()) {
|
||||
return;
|
||||
}
|
||||
|
||||
BuildPlayer buildPlayer = playerService.getPlayerStorage().getBuildPlayer(target);
|
||||
CachedValues cachedValues = buildPlayer.getCachedValues();
|
||||
|
||||
if (isEnteringBuildMode) {
|
||||
playerService.getBuildModePlayers().add(targetUuid);
|
||||
cachedValues.saveGameMode(target.getGameMode());
|
||||
cachedValues.saveInventory(target.getInventory().getContents());
|
||||
target.setGameMode(GameMode.CREATIVE);
|
||||
|
||||
XSound.ENTITY_EXPERIENCE_ORB_PICKUP.play(target);
|
||||
if (sender.equals(target)) {
|
||||
Messages.sendMessage(target, "build_activated_self");
|
||||
} else {
|
||||
XSound.ENTITY_EXPERIENCE_ORB_PICKUP.play(sender);
|
||||
Messages.sendMessage(sender, "build_activated_other_sender", Map.entry("%target%", target.getName()));
|
||||
Messages.sendMessage(target, "build_activated_other_target", Map.entry("%sender%", sender.getName()));
|
||||
}
|
||||
} else {
|
||||
if (!playerService.getBuildModePlayers().remove(targetUuid)) {
|
||||
return;
|
||||
}
|
||||
|
||||
cachedValues.resetGameModeIfPresent(target);
|
||||
cachedValues.resetInventoryIfPresent(target);
|
||||
|
||||
XSound.ENTITY_EXPERIENCE_ORB_PICKUP.play(target);
|
||||
if (sender.equals(target)) {
|
||||
Messages.sendMessage(target, "build_deactivated_self");
|
||||
} else {
|
||||
XSound.ENTITY_EXPERIENCE_ORB_PICKUP.play(sender);
|
||||
Messages.sendMessage(sender, "build_deactivated_other_sender", Map.entry("%target%", target.getName()));
|
||||
Messages.sendMessage(target, "build_deactivated_other_target", Map.entry("%sender%", sender.getName()));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||