diff --git a/.editorconfig b/.editorconfig
new file mode 100644
index 0000000..b430227
--- /dev/null
+++ b/.editorconfig
@@ -0,0 +1,435 @@
+root = true
+
+[*]
+charset = utf-8
+end_of_line = crlf
+indent_size = 4
+indent_style = space
+insert_final_newline = false
+max_line_length = 120
+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 = 4
+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 = true
+ij_java_align_multiline_method_parentheses = false
+ij_java_align_multiline_parameters = true
+ij_java_align_multiline_parameters_in_calls = false
+ij_java_align_multiline_parenthesized_expression = false
+ij_java_align_multiline_records = true
+ij_java_align_multiline_resources = true
+ij_java_align_multiline_ternary_operation = false
+ij_java_align_multiline_text_blocks = false
+ij_java_align_multiline_throws_list = false
+ij_java_align_subsequent_simple_methods = false
+ij_java_align_throws_keyword = false
+ij_java_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 = off
+ij_java_assert_statement_colon_on_next_line = false
+ij_java_assert_statement_wrap = off
+ij_java_assignment_wrap = off
+ij_java_binary_operation_sign_on_next_line = false
+ij_java_binary_operation_wrap = off
+ij_java_blank_lines_after_anonymous_class_header = 0
+ij_java_blank_lines_after_class_header = 0
+ij_java_blank_lines_after_imports = 1
+ij_java_blank_lines_after_package = 1
+ij_java_blank_lines_around_class = 1
+ij_java_blank_lines_around_field = 0
+ij_java_blank_lines_around_field_in_interface = 0
+ij_java_blank_lines_around_initializer = 1
+ij_java_blank_lines_around_method = 1
+ij_java_blank_lines_around_method_in_interface = 1
+ij_java_blank_lines_before_class_end = 0
+ij_java_blank_lines_before_imports = 1
+ij_java_blank_lines_before_method_body = 0
+ij_java_blank_lines_before_package = 0
+ij_java_block_brace_style = end_of_line
+ij_java_block_comment_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 = 5
+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 = never
+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_enum_constants_wrap = off
+ij_java_extends_keyword_wrap = off
+ij_java_extends_list_wrap = off
+ij_java_field_annotation_wrap = split_into_lines
+ij_java_field_name_prefix =
+ij_java_field_name_suffix =
+ij_java_finally_on_new_line = false
+ij_java_for_brace_force = never
+ij_java_for_statement_new_line_after_left_paren = false
+ij_java_for_statement_right_paren_on_new_line = false
+ij_java_for_statement_wrap = off
+ij_java_generate_final_locals = false
+ij_java_generate_final_parameters = false
+ij_java_if_brace_force = never
+ij_java_imports_layout = *, |, javax.**, java.**, |, $*
+ij_java_indent_case_from_switch = true
+ij_java_insert_inner_class_imports = false
+ij_java_insert_override_annotation = true
+ij_java_keep_blank_lines_before_right_brace = 2
+ij_java_keep_blank_lines_between_package_declaration_and_header = 2
+ij_java_keep_blank_lines_in_code = 2
+ij_java_keep_blank_lines_in_declarations = 2
+ij_java_keep_builder_methods_indents = false
+ij_java_keep_control_statement_in_one_line = true
+ij_java_keep_first_column_comment = true
+ij_java_keep_indents_on_empty_lines = false
+ij_java_keep_line_breaks = true
+ij_java_keep_multiple_expressions_in_one_line = false
+ij_java_keep_simple_blocks_in_one_line = false
+ij_java_keep_simple_classes_in_one_line = 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_local_variable_name_prefix =
+ij_java_local_variable_name_suffix =
+ij_java_method_annotation_wrap = split_into_lines
+ij_java_method_brace_style = end_of_line
+ij_java_method_call_chain_wrap = off
+ij_java_method_parameters_new_line_after_left_paren = false
+ij_java_method_parameters_right_paren_on_new_line = false
+ij_java_method_parameters_wrap = off
+ij_java_modifier_list_wrap = false
+ij_java_multi_catch_types_wrap = normal
+ij_java_names_count_to_use_import_on_demand = 3
+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_packages_to_use_import_on_demand = java.awt.*, javax.swing.*
+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_annotations =
+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_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_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_ternary_operation_signs_on_next_line = false
+ij_java_ternary_operation_wrap = off
+ij_java_test_name_prefix =
+ij_java_test_name_suffix = Test
+ij_java_throws_keyword_wrap = off
+ij_java_throws_list_wrap = off
+ij_java_use_external_annotations = false
+ij_java_use_fq_class_names = false
+ij_java_use_relative_indents = false
+ij_java_use_single_class_imports = true
+ij_java_variable_annotation_wrap = off
+ij_java_visibility = public
+ij_java_while_brace_force = never
+ij_java_while_on_new_line = false
+ij_java_wrap_comments = false
+ij_java_wrap_first_method_in_call_chain = false
+ij_java_wrap_long_lines = false
+
+[{*.ant,*.fxml,*.jhm,*.jnlp,*.jrxml,*.jspx,*.pom,*.rng,*.tagx,*.tld,*.wsdl,*.xml,*.xsd,*.xsl,*.xslt,*.xul}]
+ij_continuation_indent_size = 4
+ij_xml_align_attributes = true
+ij_xml_align_text = false
+ij_xml_attribute_wrap = normal
+ij_xml_block_comment_add_space = false
+ij_xml_block_comment_at_first_column = true
+ij_xml_keep_blank_lines = 2
+ij_xml_keep_indents_on_empty_lines = false
+ij_xml_keep_line_breaks = true
+ij_xml_keep_line_breaks_in_text = true
+ij_xml_keep_whitespaces = false
+ij_xml_keep_whitespaces_around_cdata = preserve
+ij_xml_keep_whitespaces_inside_cdata = false
+ij_xml_line_comment_at_first_column = true
+ij_xml_space_after_tag_name = false
+ij_xml_space_around_equals_in_attribute = false
+ij_xml_space_inside_empty_tag = false
+ij_xml_text_wrap = normal
+
+[{*.gradle.kts,*.kt,*.kts,*.main.kts,*.space.kts}]
+ij_continuation_indent_size = 4
+ij_kotlin_align_in_columns_case_branch = false
+ij_kotlin_align_multiline_binary_operation = false
+ij_kotlin_align_multiline_extends_list = false
+ij_kotlin_align_multiline_method_parentheses = false
+ij_kotlin_align_multiline_parameters = true
+ij_kotlin_align_multiline_parameters_in_calls = false
+ij_kotlin_allow_trailing_comma = false
+ij_kotlin_allow_trailing_comma_on_call_site = false
+ij_kotlin_assignment_wrap = off
+ij_kotlin_blank_lines_after_class_header = 0
+ij_kotlin_blank_lines_around_block_when_branches = 0
+ij_kotlin_blank_lines_before_declaration_with_comment_or_annotation_on_separate_line = 1
+ij_kotlin_block_comment_add_space = false
+ij_kotlin_block_comment_at_first_column = true
+ij_kotlin_call_parameters_new_line_after_left_paren = false
+ij_kotlin_call_parameters_right_paren_on_new_line = false
+ij_kotlin_call_parameters_wrap = off
+ij_kotlin_catch_on_new_line = false
+ij_kotlin_class_annotation_wrap = split_into_lines
+ij_kotlin_continuation_indent_for_chained_calls = true
+ij_kotlin_continuation_indent_for_expression_bodies = true
+ij_kotlin_continuation_indent_in_argument_lists = true
+ij_kotlin_continuation_indent_in_elvis = true
+ij_kotlin_continuation_indent_in_if_conditions = true
+ij_kotlin_continuation_indent_in_parameter_lists = true
+ij_kotlin_continuation_indent_in_supertype_lists = true
+ij_kotlin_else_on_new_line = false
+ij_kotlin_enum_constants_wrap = off
+ij_kotlin_extends_list_wrap = off
+ij_kotlin_field_annotation_wrap = split_into_lines
+ij_kotlin_finally_on_new_line = false
+ij_kotlin_if_rparen_on_new_line = false
+ij_kotlin_import_nested_classes = false
+ij_kotlin_imports_layout = *, java.**, javax.**, kotlin.**, ^
+ij_kotlin_insert_whitespaces_in_simple_one_line_method = true
+ij_kotlin_keep_blank_lines_before_right_brace = 2
+ij_kotlin_keep_blank_lines_in_code = 2
+ij_kotlin_keep_blank_lines_in_declarations = 2
+ij_kotlin_keep_first_column_comment = true
+ij_kotlin_keep_indents_on_empty_lines = false
+ij_kotlin_keep_line_breaks = true
+ij_kotlin_lbrace_on_next_line = false
+ij_kotlin_line_break_after_multiline_when_entry = true
+ij_kotlin_line_comment_add_space = false
+ij_kotlin_line_comment_add_space_on_reformat = false
+ij_kotlin_line_comment_at_first_column = true
+ij_kotlin_method_annotation_wrap = split_into_lines
+ij_kotlin_method_call_chain_wrap = off
+ij_kotlin_method_parameters_new_line_after_left_paren = false
+ij_kotlin_method_parameters_right_paren_on_new_line = false
+ij_kotlin_method_parameters_wrap = off
+ij_kotlin_name_count_to_use_star_import = 5
+ij_kotlin_name_count_to_use_star_import_for_members = 3
+ij_kotlin_packages_to_use_import_on_demand = java.util.*, kotlinx.android.synthetic.**, io.ktor.**
+ij_kotlin_parameter_annotation_wrap = off
+ij_kotlin_space_after_comma = true
+ij_kotlin_space_after_extend_colon = true
+ij_kotlin_space_after_type_colon = true
+ij_kotlin_space_before_catch_parentheses = true
+ij_kotlin_space_before_comma = false
+ij_kotlin_space_before_extend_colon = true
+ij_kotlin_space_before_for_parentheses = true
+ij_kotlin_space_before_if_parentheses = true
+ij_kotlin_space_before_lambda_arrow = true
+ij_kotlin_space_before_type_colon = false
+ij_kotlin_space_before_when_parentheses = true
+ij_kotlin_space_before_while_parentheses = true
+ij_kotlin_spaces_around_additive_operators = true
+ij_kotlin_spaces_around_assignment_operators = true
+ij_kotlin_spaces_around_equality_operators = true
+ij_kotlin_spaces_around_function_type_arrow = true
+ij_kotlin_spaces_around_logical_operators = true
+ij_kotlin_spaces_around_multiplicative_operators = true
+ij_kotlin_spaces_around_range = false
+ij_kotlin_spaces_around_relational_operators = true
+ij_kotlin_spaces_around_unary_operator = false
+ij_kotlin_spaces_around_when_arrow = true
+ij_kotlin_variable_annotation_wrap = off
+ij_kotlin_while_on_new_line = false
+ij_kotlin_wrap_elvis_expressions = 1
+ij_kotlin_wrap_expression_body_functions = 0
+ij_kotlin_wrap_first_method_in_call_chain = false
+
+[{*.har,*.json,*.png.mcmeta,mcmod.info,pack.mcmeta}]
+indent_size = 2
+ij_continuation_indent_size = 4
+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
+
+[{*.markdown,*.md,*.md }]
+ij_markdown_force_one_space_after_blockquote_symbol = true
+ij_markdown_force_one_space_after_header_symbol = true
+ij_markdown_force_one_space_after_list_bullet = true
+ij_markdown_force_one_space_between_words = true
+ij_markdown_format_tables = true
+ij_markdown_insert_quote_arrows_on_wrap = true
+ij_markdown_keep_indents_on_empty_lines = false
+ij_markdown_keep_line_breaks_inside_text_blocks = true
+ij_markdown_max_lines_around_block_elements = 1
+ij_markdown_max_lines_around_header = 1
+ij_markdown_max_lines_between_paragraphs = 1
+ij_markdown_min_lines_around_block_elements = 1
+ij_markdown_min_lines_around_header = 1
+ij_markdown_min_lines_between_paragraphs = 1
+ij_markdown_wrap_text_if_long = true
+ij_markdown_wrap_text_inside_blockquotes = true
+
+[{*.toml,Cargo.lock,Cargo.toml.orig,Gopkg.lock,Pipfile,poetry.lock}]
+ij_continuation_indent_size = 4
+ij_toml_keep_indents_on_empty_lines = 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_sequence_on_new_line = false
+ij_yaml_space_before_colon = false
+ij_yaml_spaces_within_braces = true
+ij_yaml_spaces_within_brackets = true
diff --git a/.gitattributes b/.gitattributes
new file mode 100644
index 0000000..09bc62c
--- /dev/null
+++ b/.gitattributes
@@ -0,0 +1,2 @@
+# Set the default behavior, in case people don't have core.autocrlf set.
+* text=auto
\ No newline at end of file
diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS
new file mode 100644
index 0000000..2a8838e
--- /dev/null
+++ b/.github/CODEOWNERS
@@ -0,0 +1 @@
+* @darksaid98
diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml
new file mode 100644
index 0000000..f8cf5d0
--- /dev/null
+++ b/.github/FUNDING.yml
@@ -0,0 +1 @@
+github: darksaid98
diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md
new file mode 100644
index 0000000..66a0311
--- /dev/null
+++ b/.github/ISSUE_TEMPLATE/bug_report.md
@@ -0,0 +1,34 @@
+---
+name: Bug report
+about: Create a report to help us improve
+title: ''
+labels: bug
+assignees: ''
+
+---
+
+**Describe the bug**
+A clear and concise description of what the bug is.
+
+**To Reproduce**
+Steps to reproduce the behavior:
+1. Go to '...'
+2. Click on '....'
+3. Scroll down to '....'
+4. See error
+
+**Expected behavior**
+A clear and concise description of what you expected to happen.
+
+**Screenshots**
+If applicable, add screenshots to help explain your problem.
+
+**Version information:**
+- Vanilla version: [e.g. 1.20.2]
+- Server version: [e.g. paper-123]
+- Plugin version [e.g. 0.1.0]
+
+**Additional context**
+```
+Add any other context about the problem here including console errors.
+```
\ No newline at end of file
diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md
new file mode 100644
index 0000000..6532412
--- /dev/null
+++ b/.github/ISSUE_TEMPLATE/feature_request.md
@@ -0,0 +1,20 @@
+---
+name: Feature request
+about: Suggest an idea for this project
+title: ''
+labels: enhancement
+assignees: ''
+
+---
+
+**Is your feature request related to a problem? Please describe.**
+A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
+
+**Describe the solution you'd like**
+A clear and concise description of what you want to happen.
+
+**Describe alternatives you've considered**
+A clear and concise description of any alternative solutions or features you've considered.
+
+**Additional context**
+Add any other context or screenshots about the feature request here.
\ No newline at end of file
diff --git a/.github/actions/gradle/action.yml b/.github/actions/gradle/action.yml
new file mode 100644
index 0000000..d76a069
--- /dev/null
+++ b/.github/actions/gradle/action.yml
@@ -0,0 +1,15 @@
+name: 'Setup Gradle'
+description: 'Grant execute permissions and validate Gradle wrapper'
+
+runs:
+ using: 'composite'
+ steps:
+ - name: Grant execute permissions for Gradle wrapper
+ run: chmod +x gradlew
+ shell: bash
+
+ - name: Validate Gradle Wrapper Authenticity
+ uses: gradle/wrapper-validation-action@v1
+
+ - name: Setup Gradle and Caching
+ uses: gradle/gradle-build-action@v2
diff --git a/.github/actions/jdk/action.yml b/.github/actions/jdk/action.yml
new file mode 100644
index 0000000..83f2450
--- /dev/null
+++ b/.github/actions/jdk/action.yml
@@ -0,0 +1,17 @@
+name: 'Setup JDK'
+description: 'Set up JDK'
+
+inputs:
+ java-version:
+ description: 'Java version'
+ required: true
+ default: '17'
+
+runs:
+ using: 'composite'
+ steps:
+ - name: Setup JDK
+ uses: actions/setup-java@v3
+ with:
+ java-version: ${{ inputs.java-version }}
+ distribution: 'temurin'
diff --git a/.github/dependabot.yml b/.github/dependabot.yml
new file mode 100644
index 0000000..4b0fa56
--- /dev/null
+++ b/.github/dependabot.yml
@@ -0,0 +1,16 @@
+version: 2
+updates:
+ - package-ecosystem: "github-actions"
+ directory: "/"
+ schedule:
+ interval: "weekly"
+ commit-message:
+ prefix: "ci:"
+ target-branch: "main"
+ - package-ecosystem: "gradle"
+ directory: "/"
+ schedule:
+ interval: "weekly"
+ commit-message:
+ prefix: "build:"
+ target-branch: "main"
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
new file mode 100644
index 0000000..0cbdd8b
--- /dev/null
+++ b/.github/workflows/release.yml
@@ -0,0 +1,93 @@
+name: Build & Upload Release jar with Gradle
+
+on:
+ push:
+ branches:
+ - 'main'
+ - 'master'
+ tags:
+ - '*'
+ pull_request:
+ branches:
+ - 'main'
+ - 'master'
+ schedule:
+ - cron: '0 0 * * 6'
+ workflow_dispatch:
+
+concurrency:
+ group: ${{ format('{0}-{1}', github.job, github.ref) }}
+ cancel-in-progress: true
+
+jobs:
+ build:
+ runs-on: ${{ matrix.os }}
+ strategy:
+ matrix:
+ os: [ ubuntu-latest ]
+ java: [ 17 ]
+ steps:
+ - name: Checkout Repository
+ uses: actions/checkout@v4
+
+ - name: Setup Gradle
+ uses: ./.github/actions/gradle
+
+ - name: Setup JDK
+ uses: ./.github/actions/jdk
+ with:
+ java-version: ${{ matrix.java }}
+
+ - name: Build with Gradle
+ run: ./gradlew clean build --info
+
+ - name: Upload build results
+ uses: actions/upload-artifact@v3
+ with:
+ name: ${{ matrix.os }} Java ${{ matrix.java }} Snapshot
+ path: ${{ github.workspace }}/build/libs/
+
+ release:
+ needs:
+ - build
+ runs-on: ubuntu-latest
+ strategy:
+ matrix:
+ java: [ 17 ]
+ if: github.ref_type == 'tag' || ((github.ref_name == 'main' || github.ref_name == 'master') && github.event_name != 'schedule')
+ steps:
+ - name: Checkout Repository
+ uses: actions/checkout@v4
+
+ - name: Setup Gradle
+ uses: ./.github/actions/gradle
+
+ - name: Setup JDK
+ uses: ./.github/actions/jdk
+ with:
+ java-version: ${{ matrix.java }}
+
+ - name: Set Release Environment Variable
+ if: github.ref_type == 'tag'
+ run: |
+ echo "CUSTOM_VERSION=${{ github.ref_name }}" >> $GITHUB_ENV
+
+ - name: Build with Gradle
+ if: github.ref_type != 'tag'
+ run: ./gradlew clean build
+
+ - name: Build with Gradle
+ if: github.ref_type == 'tag'
+ run: ./gradlew clean build -PcustomVersion=${{ env.CUSTOM_VERSION }}
+
+ - name: Create Release
+ uses: softprops/action-gh-release@v1
+ id: release
+ if: github.ref_type == 'tag'
+ with:
+ name: ${{ format('Release {0}', github.ref_name) }}
+ files: ${{ github.workspace }}/build/libs/*
+ prerelease: ${{ contains(github.ref_name, '-RC-') }}
+ generate_release_notes: true
+ fail_on_unmatched_files: true
+ draft: false
\ No newline at end of file
diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml
new file mode 100644
index 0000000..581de34
--- /dev/null
+++ b/.github/workflows/stale.yml
@@ -0,0 +1,26 @@
+name: 'Close Stale Issues & PRs'
+on:
+ schedule:
+ - cron: '30 1 * * *'
+
+permissions:
+ contents: read
+ issues: write
+ pull-requests: write
+
+jobs:
+ stale:
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/stale@v8
+ with:
+ stale-issue-message: ' This issue has been automatically marked as stale because it has been open for 60 days with no activity.'
+ stale-pr-message: 'This PR has been automatically marked as stale because it has been open for 60 days with no activity.'
+ close-issue-message: 'This issue was closed because it has been stalled for -1 days with no activity.'
+ close-pr-message: 'This PR was closed because it has been stalled for -1 days with no activity.'
+ days-before-issue-stale: 60
+ days-before-pr-stale: 60
+ days-before-issue-close: -1
+ days-before-pr-close: -1
+ stale-issue-label: 'stale'
+ stale-pr-label: 'stale'
\ No newline at end of file
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..24f40a2
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,86 @@
+##############################
+## Java
+##############################
+.mtj.tmp/
+*.class
+*.jar
+*.war
+*.ear
+*.nar
+hs_err_pid*
+replay_pid*
+
+##############################
+## Maven
+##############################
+target/
+pom.xml.tag
+pom.xml.releaseBackup
+pom.xml.versionsBackup
+pom.xml.next
+pom.xml.bak
+release.properties
+dependency-reduced-pom.xml
+buildNumber.properties
+.mvn/timing.properties
+.mvn/wrapper/maven-wrapper.jar
+
+##############################
+## Gradle
+##############################
+bin/
+build/
+.gradle
+.gradletasknamecache
+gradle-app.setting
+!gradle-wrapper.jar
+
+##############################
+## IntelliJ
+##############################
+out/
+.idea/
+.idea_modules/
+*.iml
+*.ipr
+*.iws
+
+##############################
+## Eclipse
+##############################
+.settings/
+bin/
+tmp/
+.metadata
+.classpath
+.project
+*.tmp
+*.bak
+*.swp
+*~.nib
+local.properties
+.loadpath
+.factorypath
+
+##############################
+## NetBeans
+##############################
+nbproject/private/
+build/
+nbbuild/
+dist/
+nbdist/
+nbactions.xml
+nb-configuration.xml
+
+##############################
+## Visual Studio Code
+##############################
+.vscode/
+.code-workspace
+
+##############################
+## OS X
+##############################
+.DS_Store
+/run/
\ No newline at end of file
diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md
new file mode 100644
index 0000000..8d1e96e
--- /dev/null
+++ b/CODE_OF_CONDUCT.md
@@ -0,0 +1,132 @@
+# Contributor Covenant Code of Conduct
+
+## Our Pledge
+
+We as members, contributors, and leaders pledge to make participation in our
+community a harassment-free experience for everyone, regardless of age, body
+size, visible or invisible disability, ethnicity, sex characteristics, gender
+identity and expression, level of experience, education, socio-economic status,
+nationality, personal appearance, race, caste, color, religion, or sexual
+identity and orientation.
+
+We pledge to act and interact in ways that contribute to an open, welcoming,
+diverse, inclusive, and healthy community.
+
+## Our Standards
+
+Examples of behavior that contributes to a positive environment for our
+community include:
+
+* Demonstrating empathy and kindness toward other people
+* Being respectful of differing opinions, viewpoints, and experiences
+* Giving and gracefully accepting constructive feedback
+* Accepting responsibility and apologizing to those affected by our mistakes,
+ and learning from the experience
+* Focusing on what is best not just for us as individuals, but for the overall
+ community
+
+Examples of unacceptable behavior include:
+
+* The use of sexualized language or imagery, and sexual attention or advances of
+ any kind
+* Trolling, insulting or derogatory comments, and personal or political attacks
+* Public or private harassment
+* Publishing others' private information, such as a physical or email address,
+ without their explicit permission
+* Other conduct which could reasonably be considered inappropriate in a
+ professional setting
+
+## Enforcement Responsibilities
+
+Community leaders are responsible for clarifying and enforcing our standards of
+acceptable behavior and will take appropriate and fair corrective action in
+response to any behavior that they deem inappropriate, threatening, offensive,
+or harmful.
+
+Community leaders have the right and responsibility to remove, edit, or reject
+comments, commits, code, wiki edits, issues, and other contributions that are
+not aligned to this Code of Conduct, and will communicate reasons for moderation
+decisions when appropriate.
+
+## Scope
+
+This Code of Conduct applies within all community spaces, and also applies when
+an individual is officially representing the community in public spaces.
+Examples of representing our community include using an official e-mail address,
+posting via an official social media account, or acting as an appointed
+representative at an online or offline event.
+
+## Enforcement
+
+Instances of abusive, harassing, or otherwise unacceptable behavior may be
+reported to the community leaders responsible for enforcement at
+alathraserver@gmail.com.
+All complaints will be reviewed and investigated promptly and fairly.
+
+All community leaders are obligated to respect the privacy and security of the
+reporter of any incident.
+
+## Enforcement Guidelines
+
+Community leaders will follow these Community Impact Guidelines in determining
+the consequences for any action they deem in violation of this Code of Conduct:
+
+### 1. Correction
+
+**Community Impact**: Use of inappropriate language or other behavior deemed
+unprofessional or unwelcome in the community.
+
+**Consequence**: A private, written warning from community leaders, providing
+clarity around the nature of the violation and an explanation of why the
+behavior was inappropriate. A public apology may be requested.
+
+### 2. Warning
+
+**Community Impact**: A violation through a single incident or series of
+actions.
+
+**Consequence**: A warning with consequences for continued behavior. No
+interaction with the people involved, including unsolicited interaction with
+those enforcing the Code of Conduct, for a specified period of time. This
+includes avoiding interactions in community spaces as well as external channels
+like social media. Violating these terms may lead to a temporary or permanent
+ban.
+
+### 3. Temporary Ban
+
+**Community Impact**: A serious violation of community standards, including
+sustained inappropriate behavior.
+
+**Consequence**: A temporary ban from any sort of interaction or public
+communication with the community for a specified period of time. No public or
+private interaction with the people involved, including unsolicited interaction
+with those enforcing the Code of Conduct, is allowed during this period.
+Violating these terms may lead to a permanent ban.
+
+### 4. Permanent Ban
+
+**Community Impact**: Demonstrating a pattern of violation of community
+standards, including sustained inappropriate behavior, harassment of an
+individual, or aggression toward or disparagement of classes of individuals.
+
+**Consequence**: A permanent ban from any sort of public interaction within the
+community.
+
+## Attribution
+
+This Code of Conduct is adapted from the [Contributor Covenant][homepage],
+version 2.1, available at
+[https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1].
+
+Community Impact Guidelines were inspired by
+[Mozilla's code of conduct enforcement ladder][Mozilla CoC].
+
+For answers to common questions about this code of conduct, see the FAQ at
+[https://www.contributor-covenant.org/faq][FAQ]. Translations are available at
+[https://www.contributor-covenant.org/translations][translations].
+
+[homepage]: https://www.contributor-covenant.org
+[v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html
+[Mozilla CoC]: https://github.com/mozilla/diversity
+[FAQ]: https://www.contributor-covenant.org/faq
+[translations]: https://www.contributor-covenant.org/translations
\ No newline at end of file
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
new file mode 100644
index 0000000..b3dc4ec
--- /dev/null
+++ b/CONTRIBUTING.md
@@ -0,0 +1,44 @@
+## Pull Requests
+
+We use the [GitHub flow](https://guides.github.com/introduction/flow/) for contributions.
+
+1. Fork the repository.
+2. Create a new branch for each feature, fix or improvement.
+3. Send a pull request from each feature branch to the **main** branch.
+
+It is very important to separate new features or improvements into separate feature branches, and to send a pull request for each branch. This allow us to review and pull in new features or improvements individually.
+
+## Specifications
+
+### Commit Messages
+
+All commit messages should adhere to the [Conventional Commits specification](https://conventionalcommits.org/).
+
+#### Commit Types
+
+- API relevant changes
+ * `feat` Commits, that adds a new feature
+ * `fix` Commits, that fixes a bug/issue
+- `refactor` Commits, that rewrite/restructure your code, however does not change any API behaviour
+ * `perf` Commits are special `refactor` commits, that improve performance
+- `style` Commits, that do not affect the meaning (white-space, formatting, missing semi-colons, etc)
+- `test` Commits, that add or correct existing tests
+- `docs` Commits, that affect documentation only
+- Tooling relevant changes
+ * `build` Commits, that affect build components like build tool, dependencies, project version, ...
+ * `ci` Commits, that affect CI configuration files and scripts
+- `revert` Commits, that revert previous commits
+- `chore` Miscellaneous commits without production code change, e.g. modifying `.gitignore`
+
+### Versioning
+
+Our project adheres to the [Semantic Versioning 2.0.0 specification](https://semver.org/) for versioning.
+
+### Style Guide
+
+Large refactors breaking the style defined in the `.editorconfig` file are frowned upon.
+When contributing ensure your code follows existing conventions and styling. (*Any issues that arise will be noted in your pull request.*)
+
+## Licensing
+
+You must agree that your patch will be licensed under the main license found in this repository, and if we change the license, we will assume that you agreed with the change unless you object to the changes in time.
\ No newline at end of file
diff --git a/ClickTpa/.classpath b/ClickTpa/.classpath
deleted file mode 100644
index 5869b87..0000000
--- a/ClickTpa/.classpath
+++ /dev/null
@@ -1,39 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/ClickTpa/.gitignore b/ClickTpa/.gitignore
deleted file mode 100644
index b83d222..0000000
--- a/ClickTpa/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-/target/
diff --git a/ClickTpa/.project b/ClickTpa/.project
deleted file mode 100644
index 91569b6..0000000
--- a/ClickTpa/.project
+++ /dev/null
@@ -1,23 +0,0 @@
-
-
- ClickTpa
-
-
-
-
-
- org.eclipse.jdt.core.javabuilder
-
-
-
-
- org.eclipse.m2e.core.maven2Builder
-
-
-
-
-
- org.eclipse.jdt.core.javanature
- org.eclipse.m2e.core.maven2Nature
-
-
diff --git a/ClickTpa/.settings/org.eclipse.jdt.core.prefs b/ClickTpa/.settings/org.eclipse.jdt.core.prefs
deleted file mode 100644
index cac0df4..0000000
--- a/ClickTpa/.settings/org.eclipse.jdt.core.prefs
+++ /dev/null
@@ -1,11 +0,0 @@
-eclipse.preferences.version=1
-org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
-org.eclipse.jdt.core.compiler.compliance=1.8
-org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
-org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
-org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
-org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
-org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=ignore
-org.eclipse.jdt.core.compiler.release=disabled
-org.eclipse.jdt.core.compiler.source=1.8
diff --git a/ClickTpa/.settings/org.eclipse.m2e.core.prefs b/ClickTpa/.settings/org.eclipse.m2e.core.prefs
deleted file mode 100644
index f897a7f..0000000
--- a/ClickTpa/.settings/org.eclipse.m2e.core.prefs
+++ /dev/null
@@ -1,4 +0,0 @@
-activeProfiles=
-eclipse.preferences.version=1
-resolveWorkspaceProjects=true
-version=1
diff --git a/ClickTpa/pom.xml b/ClickTpa/pom.xml
deleted file mode 100644
index 85b37af..0000000
--- a/ClickTpa/pom.xml
+++ /dev/null
@@ -1,39 +0,0 @@
-
-
- 4.0.0
-
- com.jklmao.plugin
- ClickTpa
- 1.7.1v
- jar
-
- ClickTpa
-
- Simple TPA plugin for Spigot/Paper Software
-
-
- 1.8
- 1.8
- 1.8
- UTF-8
-
-
-
-
- spigot-repo
- https://hub.spigotmc.org/nexus/content/repositories/snapshots/
-
-
-
-
-
-
- org.spigotmc
- spigot-api
- 1.19.3-R0.1-SNAPSHOT
- provided
-
-
-
diff --git a/ClickTpa/src/main/java/com/jklmao/plugin/ClickTpa.java b/ClickTpa/src/main/java/com/jklmao/plugin/ClickTpa.java
deleted file mode 100644
index f6dac7c..0000000
--- a/ClickTpa/src/main/java/com/jklmao/plugin/ClickTpa.java
+++ /dev/null
@@ -1,73 +0,0 @@
-package com.jklmao.plugin;
-
-import java.util.HashMap;
-import java.util.HashSet;
-
-import org.bukkit.Bukkit;
-import org.bukkit.entity.Player;
-import org.bukkit.plugin.java.JavaPlugin;
-
-import com.jklmao.plugin.commands.CommandReload;
-import com.jklmao.plugin.commands.CommandTpCancel;
-import com.jklmao.plugin.commands.CommandTpToggle;
-import com.jklmao.plugin.commands.CommandTpa;
-import com.jklmao.plugin.commands.CommandTpaDeny;
-import com.jklmao.plugin.commands.CommandTpaHere;
-import com.jklmao.plugin.commands.CommandTpaccept;
-import com.jklmao.plugin.commands.CommandTpo;
-import com.jklmao.plugin.commands.CommandTpoHere;
-import com.jklmao.plugin.events.PlayerEvents;
-import com.jklmao.plugin.utils.CustomList;
-
-public final class ClickTpa extends JavaPlugin {
-
- private HashSet graceList = new HashSet<>();
- private HashMap tpaCancel = new HashMap<>();
- private HashMap playerTpaList = new HashMap<>();
-
- @Override
- public void onEnable() {
- commandHandler();
- addAllPlayers();
-
- saveDefaultConfig();
- getServer().getPluginManager().registerEvents(new PlayerEvents(this), this);
- getLogger().info("ClickTPA has been loaded Successfully!");
-
- }
-
- public HashSet getGraceList() {
- return this.graceList;
- }
-
- public HashMap getTpaCancel() {
- return tpaCancel;
- }
-
- public HashMap getTpaPlayers() {
- return this.playerTpaList;
- }
-
- private void commandHandler() {
- getCommand("tpa").setExecutor(new CommandTpa(this));
- getCommand("tpahere").setExecutor(new CommandTpaHere(this));
- getCommand("tpacancel").setExecutor(new CommandTpCancel(this));
- getCommand("tpaccept").setExecutor(new CommandTpaccept(this));
- getCommand("tpdeny").setExecutor(new CommandTpaDeny(this));
- getCommand("tpo").setExecutor(new CommandTpo(this));
- getCommand("tpohere").setExecutor(new CommandTpoHere(this));
- getCommand("tptoggle").setExecutor(new CommandTpToggle(this));
- getCommand("clicktparl").setExecutor(new CommandReload(this));
- }
-
- private void addAllPlayers() {
-
- CustomList list = new CustomList();
-
- for (Player p : Bukkit.getOnlinePlayers()) {
- playerTpaList.put(p, list);
- }
-
- }
-
-}
diff --git a/ClickTpa/src/main/java/com/jklmao/plugin/commands/CommandReload.java b/ClickTpa/src/main/java/com/jklmao/plugin/commands/CommandReload.java
deleted file mode 100644
index 960923a..0000000
--- a/ClickTpa/src/main/java/com/jklmao/plugin/commands/CommandReload.java
+++ /dev/null
@@ -1,44 +0,0 @@
-package com.jklmao.plugin.commands;
-
-import org.bukkit.command.Command;
-import org.bukkit.command.CommandExecutor;
-import org.bukkit.command.CommandSender;
-import org.bukkit.entity.Player;
-
-import com.jklmao.plugin.ClickTpa;
-import com.jklmao.plugin.utils.ConfigUtil;
-
-public class CommandReload implements CommandExecutor, ConfigUtil {
-
- private ClickTpa clicktpa;
- final private String prefix = "&4&l[Click&b&lTpa]";
-
- public CommandReload(ClickTpa pl) {
- clicktpa = pl;
- clicktpa.saveDefaultConfig();
- }
-
- @Override
- public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
- if (sender instanceof Player) {
-
- Player p = (Player) sender;
- if (!p.hasPermission("clicktpa.reload")) {
- p.sendMessage(getMsg("Insufficient-permission"));
- return true;
- }
- }
-
- clicktpa.saveDefaultConfig();
- clicktpa.reloadConfig();
- sender.sendMessage(colorize(prefix + " &aThe plugin's config has been reloaded!"));
-
- return true;
- }
-
- @Override
- public String getMsg(String path) {
- return colorize(clicktpa.getConfig().getString(path));
- }
-
-}
diff --git a/ClickTpa/src/main/java/com/jklmao/plugin/commands/CommandTpCancel.java b/ClickTpa/src/main/java/com/jklmao/plugin/commands/CommandTpCancel.java
deleted file mode 100644
index 91f0a6e..0000000
--- a/ClickTpa/src/main/java/com/jklmao/plugin/commands/CommandTpCancel.java
+++ /dev/null
@@ -1,79 +0,0 @@
-package com.jklmao.plugin.commands;
-
-import org.bukkit.Bukkit;
-import org.bukkit.command.Command;
-import org.bukkit.command.CommandExecutor;
-import org.bukkit.command.CommandSender;
-import org.bukkit.entity.Player;
-
-import com.jklmao.plugin.ClickTpa;
-import com.jklmao.plugin.utils.ConfigUtil;
-import com.jklmao.plugin.utils.TpaInfoList;
-
-public class CommandTpCancel implements CommandExecutor, ConfigUtil {
- private ClickTpa clicktpa;
-
- public CommandTpCancel(ClickTpa pl) {
- clicktpa = pl;
- }
-
- @Override
- public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
- if (sender instanceof Player) {
- Player p = (Player) sender;
-
- if (!p.hasPermission("clicktpa.tpacancel")) {
- p.sendMessage(getMsg("Insufficient-permission"));
- return true;
- }
-
- if (clicktpa.getTpaCancel().containsKey(p)) {
-
- Player poorRejectedGuy = Bukkit.getServer().getPlayer(clicktpa.getTpaCancel().get(p).getName());
-
- if (poorRejectedGuy == null) {
- p.sendMessage(getMsg("Tpacancel-message"));
- clicktpa.getTpaCancel().remove(p);
- return true;
- }
-
- if (poorRejectedGuy.isOnline()) {
-
- p.sendMessage(getMsg("Tpacancel-message"));
- poorRejectedGuy.sendMessage(getMsg("Tpacancel-message"));
- removeTpaInfo(p, poorRejectedGuy);
-
- return true;
- }
-
- p.sendMessage(getMsg("Tpacancel-message"));
- removeTpaInfo(p, poorRejectedGuy);
- return true;
-
- } else {
- p.sendMessage(getMsg("Player-no-pendingtpa-message"));
- return true;
- }
- }
- sender.sendMessage(getMsg("Player-only-command"));
- return true;
- }
-
- private void removeTpaInfo(Player p, Player target) {
-
- for (TpaInfoList list : clicktpa.getTpaPlayers().get(target).getTpaList()) {
- if (list.getRequester() == p) {
- clicktpa.getTpaPlayers().get(target).getTpaList().remove(list);
- clicktpa.getTpaCancel().remove(p);
- return;
- }
- }
-
- }
-
- @Override
- public String getMsg(String path) {
- return colorize(clicktpa.getConfig().getString(path));
- }
-
-}
diff --git a/ClickTpa/src/main/java/com/jklmao/plugin/commands/CommandTpToggle.java b/ClickTpa/src/main/java/com/jklmao/plugin/commands/CommandTpToggle.java
deleted file mode 100644
index 63fe49c..0000000
--- a/ClickTpa/src/main/java/com/jklmao/plugin/commands/CommandTpToggle.java
+++ /dev/null
@@ -1,59 +0,0 @@
-package com.jklmao.plugin.commands;
-
-import org.bukkit.command.Command;
-import org.bukkit.command.CommandExecutor;
-import org.bukkit.command.CommandSender;
-import org.bukkit.entity.Player;
-
-import com.jklmao.plugin.ClickTpa;
-import com.jklmao.plugin.enums.TeleportMode;
-import com.jklmao.plugin.utils.ConfigUtil;
-
-public class CommandTpToggle implements CommandExecutor, ConfigUtil {
-
- private ClickTpa clicktpa;
-
- public CommandTpToggle(ClickTpa pl) {
- clicktpa = pl;
- }
-
- @Override
- public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
- if (sender instanceof Player) {
- Player p = (Player) sender;
- if (!p.hasPermission("clicktpa.tptoggle")) {
- p.sendMessage(getMsg("Insufficient-permission"));
- return true;
- }
- if (p.hasPermission("clicktpa.tptoggle")) {
-
- TeleportMode mode = clicktpa.getTpaPlayers().get(p).getMode();
-
- switch (mode) {
-
- case DEFAULT:
- // turn on tptoggle
- clicktpa.getTpaPlayers().get(p).setMode(TeleportMode.TPTOGGLE_ON);
- p.sendMessage(getMsg("Player-TpToggle-On"));
- break;
- case TPTOGGLE_ON:
- clicktpa.getTpaPlayers().get(p).setMode(TeleportMode.DEFAULT);
- p.sendMessage(getMsg("Player-TpToggle-Off"));
- break;
- case TELEPORTING:
- p.sendMessage(getMsg("TpToggle-While-Teleporting"));
- break;
- }
- return true;
- }
- }
- sender.sendMessage(getMsg("Player-only-command"));
- return true;
- }
-
- @Override
- public String getMsg(String path) {
- return colorize(clicktpa.getConfig().getString(path));
- }
-
-}
diff --git a/ClickTpa/src/main/java/com/jklmao/plugin/commands/CommandTpa.java b/ClickTpa/src/main/java/com/jklmao/plugin/commands/CommandTpa.java
deleted file mode 100644
index 726beac..0000000
--- a/ClickTpa/src/main/java/com/jklmao/plugin/commands/CommandTpa.java
+++ /dev/null
@@ -1,92 +0,0 @@
-package com.jklmao.plugin.commands;
-
-import org.bukkit.Bukkit;
-import org.bukkit.command.Command;
-import org.bukkit.command.CommandExecutor;
-import org.bukkit.command.CommandSender;
-import org.bukkit.entity.Player;
-
-import com.jklmao.plugin.ClickTpa;
-import com.jklmao.plugin.enums.TeleportMode;
-import com.jklmao.plugin.enums.TeleportType;
-import com.jklmao.plugin.events.RequestExpireListener;
-import com.jklmao.plugin.utils.ConfigUtil;
-import com.jklmao.plugin.utils.TeleportMsgs;
-import com.jklmao.plugin.utils.TpaInfoList;
-
-public class CommandTpa implements CommandExecutor, ConfigUtil {
-
- private ClickTpa clicktpa;
- private TeleportMsgs msgs;
-
- public CommandTpa(ClickTpa pl) {
- clicktpa = pl;
- msgs = new TeleportMsgs(clicktpa);
- }
-
- @Override
- public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
-
- if (!(sender instanceof Player)) {
- sender.sendMessage(getMsg("Player-only-command"));
- return true;
- }
-
- final Player p = (Player) sender;
- if (!p.hasPermission("clicktpa.tpa")) {
- p.sendMessage(getMsg("Insufficient-permission"));
- return true;
- }
- if (args.length == 0) {
- p.sendMessage(getMsg("Tpa-usage"));
- return true;
- }
- final Player target = Bukkit.getPlayer(args[0]);
- if (target == null) {
- p.sendMessage(getMsg("No-player-found"));
- return true;
- }
- if (target == p) {
- p.sendMessage(getMsg("Player-teleporting-self"));
- return true;
- }
- if (clicktpa.getTpaPlayers().get(p).getMode() == TeleportMode.TPTOGGLE_ON) {
- p.sendMessage(getMsg("Player-Is-TpToggled"));
- return true;
- }
- if (clicktpa.getTpaPlayers().get(target).getMode() == TeleportMode.TPTOGGLE_ON) {
- p.sendMessage(getMsg("Target-Is-TpToggled").replaceAll("%target%", target.getName()));
- return true;
- }
-
- if (clicktpa.getTpaPlayers().get(p).getMode() == TeleportMode.DEFAULT) {
-
- for (TpaInfoList list : clicktpa.getTpaPlayers().get(target).getTpaList()) {
-
- if (list.getRequester() == p) {
- p.sendMessage(getMsg("Player-already-requested"));
- return true;
- }
- }
-
- // create a new tpa info
- TpaInfoList info = new TpaInfoList(TeleportType.TPA, p);
-
- clicktpa.getTpaPlayers().get(target).getTpaList().add(info);
- clicktpa.getTpaCancel().put(p, target);
- msgs.sendRequestMsg(TeleportType.TPA, p, target);
- //
- RequestExpireListener expireTimer = new RequestExpireListener(clicktpa, info);
- expireTimer.startTimer(p, target);
- //
- return true;
- }
- return true;
- }
-
- @Override
- public String getMsg(String path) {
- return colorize(clicktpa.getConfig().getString(path));
- }
-
-}
diff --git a/ClickTpa/src/main/java/com/jklmao/plugin/commands/CommandTpaDeny.java b/ClickTpa/src/main/java/com/jklmao/plugin/commands/CommandTpaDeny.java
deleted file mode 100644
index 4f65693..0000000
--- a/ClickTpa/src/main/java/com/jklmao/plugin/commands/CommandTpaDeny.java
+++ /dev/null
@@ -1,76 +0,0 @@
-package com.jklmao.plugin.commands;
-
-import org.bukkit.Bukkit;
-import org.bukkit.command.Command;
-import org.bukkit.command.CommandExecutor;
-import org.bukkit.command.CommandSender;
-import org.bukkit.entity.Player;
-
-import com.jklmao.plugin.ClickTpa;
-import com.jklmao.plugin.utils.ConfigUtil;
-import com.jklmao.plugin.utils.TpaInfoList;
-
-public class CommandTpaDeny implements CommandExecutor, ConfigUtil {
-
- private ClickTpa clicktpa;
-
- public CommandTpaDeny(ClickTpa pl) {
- clicktpa = pl;
- }
-
- @Override
- public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
- if (sender instanceof Player) {
- Player p = (Player) sender;
- if (!p.hasPermission("clicktpa.tpadeny")) {
- p.sendMessage(getMsg("Insufficient-permission"));
- return true;
- }
- if (args.length == 0) {
- p.sendMessage(getMsg("Tpdeny-usage"));
- return true;
- }
- final Player target = Bukkit.getPlayer(args[0]);
-
- if (target == null) {
- p.sendMessage(getMsg("No-player-found"));
- return true;
- }
-
- if (target.isOnline()) {
-
- boolean hasRequester = false;
-
- for (TpaInfoList list : clicktpa.getTpaPlayers().get(p).getTpaList()) {
- if (list.getRequester() == target) {
- clicktpa.getTpaPlayers().get(p).getTpaList().remove(list);
- clicktpa.getTpaCancel().remove(target);
- hasRequester = true;
- break;
- }
- }
-
- if (hasRequester) {
- p.sendMessage(getMsg("Player-deny-tpa-message"));
- target.sendMessage(getMsg("Target-deny-tpa-message"));
- clicktpa.getTpaCancel().remove(target);
- return true;
- } else {
- p.sendMessage(getMsg("Player-no-pendingtpa-message"));
- return true;
- }
-
- } else {
- p.sendMessage(getMsg("Target-is-offline"));
- return true;
- }
- }
- sender.sendMessage(getMsg("Player-only-command"));
- return true;
- }
-
- @Override
- public String getMsg(String path) {
- return colorize(clicktpa.getConfig().getString(path));
- }
-}
diff --git a/ClickTpa/src/main/java/com/jklmao/plugin/commands/CommandTpaHere.java b/ClickTpa/src/main/java/com/jklmao/plugin/commands/CommandTpaHere.java
deleted file mode 100644
index 64f99c7..0000000
--- a/ClickTpa/src/main/java/com/jklmao/plugin/commands/CommandTpaHere.java
+++ /dev/null
@@ -1,91 +0,0 @@
-package com.jklmao.plugin.commands;
-
-import org.bukkit.Bukkit;
-import org.bukkit.command.Command;
-import org.bukkit.command.CommandExecutor;
-import org.bukkit.command.CommandSender;
-import org.bukkit.entity.Player;
-
-import com.jklmao.plugin.ClickTpa;
-import com.jklmao.plugin.enums.TeleportMode;
-import com.jklmao.plugin.enums.TeleportType;
-import com.jklmao.plugin.events.RequestExpireListener;
-import com.jklmao.plugin.utils.ConfigUtil;
-import com.jklmao.plugin.utils.TeleportMsgs;
-import com.jklmao.plugin.utils.TpaInfoList;
-
-public class CommandTpaHere implements CommandExecutor, ConfigUtil {
-
- private ClickTpa clicktpa;
- private TeleportMsgs msgs;
-
- public CommandTpaHere(ClickTpa pl) {
- clicktpa = pl;
- msgs = new TeleportMsgs(clicktpa);
- }
-
- @Override
- public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
-
- if (!(sender instanceof Player)) {
- sender.sendMessage(getMsg("Player-only-command"));
- return true;
- }
-
- final Player p = (Player) sender;
- if (!p.hasPermission("clicktpa.tpahere")) {
- p.sendMessage(getMsg("Insufficient-permission"));
- return true;
- }
- if (args.length == 0) {
- p.sendMessage(getMsg("Tpahere-usage"));
- return true;
- }
- final Player target = Bukkit.getPlayer(args[0]);
- if (target == null) {
- p.sendMessage(getMsg("No-player-found"));
- return true;
- }
- if (target == p) {
- p.sendMessage(getMsg("Player-teleporting-self"));
- return true;
- }
- if (clicktpa.getTpaPlayers().get(p).getMode() == TeleportMode.TPTOGGLE_ON) {
- p.sendMessage(getMsg("Player-Is-TpToggled"));
- return true;
- }
- if (clicktpa.getTpaPlayers().get(target).getMode() == TeleportMode.TPTOGGLE_ON) {
- p.sendMessage(getMsg("Target-Is-TpToggled").replaceAll("%target%", target.getName()));
- return true;
- }
- if (clicktpa.getTpaPlayers().get(p).getMode() == TeleportMode.DEFAULT) {
-
- for (TpaInfoList list : clicktpa.getTpaPlayers().get(target).getTpaList()) {
-
- if (list.getRequester() == p) {
- p.sendMessage(getMsg("Player-already-requested"));
- return true;
- }
- }
-
- // create a new tpa info
- TpaInfoList info = new TpaInfoList(TeleportType.TPAHERE, p);
-
- clicktpa.getTpaPlayers().get(target).getTpaList().add(info);
- clicktpa.getTpaCancel().put(p, target);
- msgs.sendRequestMsg(TeleportType.TPAHERE, p, target);
- //
- RequestExpireListener expireTimer = new RequestExpireListener(clicktpa, info);
- expireTimer.startTimer(p, target);
- //
- return true;
- }
- return true;
- }
-
- @Override
- public String getMsg(String path) {
- return colorize(clicktpa.getConfig().getString(path));
- }
-
-}
diff --git a/ClickTpa/src/main/java/com/jklmao/plugin/commands/CommandTpaccept.java b/ClickTpa/src/main/java/com/jklmao/plugin/commands/CommandTpaccept.java
deleted file mode 100644
index 7bd3730..0000000
--- a/ClickTpa/src/main/java/com/jklmao/plugin/commands/CommandTpaccept.java
+++ /dev/null
@@ -1,122 +0,0 @@
-package com.jklmao.plugin.commands;
-
-import org.bukkit.Bukkit;
-import org.bukkit.command.Command;
-import org.bukkit.command.CommandExecutor;
-import org.bukkit.command.CommandSender;
-import org.bukkit.entity.Player;
-
-import com.jklmao.plugin.ClickTpa;
-import com.jklmao.plugin.enums.TeleportMode;
-import com.jklmao.plugin.enums.TeleportType;
-import com.jklmao.plugin.events.TpaCountdownListener;
-import com.jklmao.plugin.utils.ConfigUtil;
-import com.jklmao.plugin.utils.TpaInfoList;
-
-public class CommandTpaccept implements CommandExecutor, ConfigUtil {
-
- private ClickTpa clicktpa;
-
- public CommandTpaccept(ClickTpa pl) {
- clicktpa = pl;
- }
-
- @Override
- public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
-
- int seconds = clicktpa.getConfig().getInt("Seconds-until-tpa");
-
- if (!(sender instanceof Player)) {
- sender.sendMessage(getMsg("Player-only-command"));
- return true;
- }
-
- Player p = (Player) sender;
-
- if (!p.hasPermission("clicktpa.tpaccept")) {
- p.sendMessage(getMsg("Insufficient-permission"));
- return true;
- }
-
- if (args.length == 0) {
- p.sendMessage(getMsg("Tpaccept-usage"));
- return true;
- }
-
- Player target = Bukkit.getPlayer(args[0]);
-
- if (target == null) {
- p.sendMessage(getMsg("No-player-found"));
- return true;
- }
-
- if (!target.isOnline()) {
- p.sendMessage(getMsg("Target-is-offline"));
-
- for (TpaInfoList list : clicktpa.getTpaPlayers().get(p).getTpaList()) {
- if (list.getRequester() == target) {
- clicktpa.getTpaPlayers().get(p).getTpaList().remove(list);
- clicktpa.getTpaCancel().remove(target);
- return true;
- }
- }
- }
-
- if (clicktpa.getTpaPlayers().get(p).getTpaList().isEmpty()) {
- p.sendMessage(getMsg("Player-no-pendingtpa-message"));
- return true;
- }
-
- TpaInfoList tpaInfo = null;
-
- if (clicktpa.getTpaPlayers().get(p).getTpaList().size() > 0) {
-
- boolean hasRequester = false;
- for (TpaInfoList list : clicktpa.getTpaPlayers().get(p).getTpaList()) {
-
- if (list.getRequester() == target) {
- hasRequester = true;
- tpaInfo = list;
- break;
- }
- }
-
- if (!hasRequester) {
- p.sendMessage(getMsg("Player-no-pendingtpa-message"));
- return true;
- }
-
- }
-
- p.sendMessage(getMsg("Player-got-accepted-tpa"));
- target.sendMessage(getMsg("Target-accepted-tpa-request"));
-
- TpaCountdownListener cdListener = new TpaCountdownListener(clicktpa);
-
- switch (tpaInfo.getType()) {
-
- case TPA:
- target.sendMessage(getMsg("Countdown-until-tpa"));
- clicktpa.getTpaPlayers().get(target).setMode(TeleportMode.TELEPORTING);
- clicktpa.getGraceList().add(target);
- cdListener.tpaCountdown(seconds, TeleportType.TPA, p, target);
- break;
- case TPAHERE:
- p.sendMessage(getMsg("Countdown-until-tpa"));
- clicktpa.getTpaPlayers().get(p).setMode(TeleportMode.TELEPORTING);
- clicktpa.getGraceList().add(p);
- cdListener.tpaCountdown(seconds, TeleportType.TPAHERE, p, target);
- break;
- }
-
- clicktpa.getTpaCancel().remove(target);
-
- return true;
- }
-
- @Override
- public String getMsg(String path) {
- return colorize(clicktpa.getConfig().getString(path));
- }
-
-}
\ No newline at end of file
diff --git a/ClickTpa/src/main/java/com/jklmao/plugin/commands/CommandTpo.java b/ClickTpa/src/main/java/com/jklmao/plugin/commands/CommandTpo.java
deleted file mode 100644
index 0a47930..0000000
--- a/ClickTpa/src/main/java/com/jklmao/plugin/commands/CommandTpo.java
+++ /dev/null
@@ -1,55 +0,0 @@
-package com.jklmao.plugin.commands;
-
-import org.bukkit.Bukkit;
-import org.bukkit.command.Command;
-import org.bukkit.command.CommandExecutor;
-import org.bukkit.command.CommandSender;
-import org.bukkit.entity.Player;
-
-import com.jklmao.plugin.ClickTpa;
-import com.jklmao.plugin.utils.ConfigUtil;
-
-public class CommandTpo implements CommandExecutor, ConfigUtil {
-
- private ClickTpa clicktpa;
-
- public CommandTpo(ClickTpa pl) {
- clicktpa = pl;
- }
-
- @Override
- public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
- if (sender instanceof Player) {
- Player p = (Player) sender;
- if (!p.hasPermission("clicktpa.tpo")) {
- p.sendMessage(getMsg("Insufficient-permission"));
- return true;
- }
- if (args.length == 0) {
- p.sendMessage(getMsg("Tpo-usage"));
- return true;
- }
- Player target = Bukkit.getPlayer(args[0]);
- if (target == null) {
- p.sendMessage(getMsg("No-player-found"));
- return true;
- }
- if (target.equals(p)) {
- p.sendMessage(getMsg("Player-teleporting-self"));
- return true;
- }
- p.sendMessage(getMsg("Player-currently-teleporting"));
- target.sendMessage(getMsg("Target-currently-teleporting"));
- p.teleport(target);
- return true;
- }
- sender.sendMessage(getMsg("Player-only-command"));
- return true;
- }
-
- @Override
- public String getMsg(String path) {
- return colorize(clicktpa.getConfig().getString(path));
- }
-
-}
diff --git a/ClickTpa/src/main/java/com/jklmao/plugin/commands/CommandTpoHere.java b/ClickTpa/src/main/java/com/jklmao/plugin/commands/CommandTpoHere.java
deleted file mode 100644
index 589382f..0000000
--- a/ClickTpa/src/main/java/com/jklmao/plugin/commands/CommandTpoHere.java
+++ /dev/null
@@ -1,55 +0,0 @@
-package com.jklmao.plugin.commands;
-
-import org.bukkit.Bukkit;
-import org.bukkit.command.Command;
-import org.bukkit.command.CommandExecutor;
-import org.bukkit.command.CommandSender;
-import org.bukkit.entity.Player;
-
-import com.jklmao.plugin.ClickTpa;
-import com.jklmao.plugin.utils.ConfigUtil;
-
-public class CommandTpoHere implements CommandExecutor, ConfigUtil {
-
- private ClickTpa clicktpa;
-
- public CommandTpoHere(ClickTpa pl) {
- clicktpa = pl;
- }
-
- @Override
- public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
- if (sender instanceof Player) {
- Player p = (Player) sender;
- if (!p.hasPermission("clicktpa.tpohere")) {
- p.sendMessage(getMsg("Insufficient-permission"));
- return true;
- }
- if (args.length == 0) {
- p.sendMessage(getMsg("Tpohere-usage"));
- return true;
- }
- Player target = Bukkit.getPlayer(args[0]);
- if (target == null) {
- p.sendMessage(getMsg("No-player-found"));
- return true;
- }
- if (target.equals(p)) {
- p.sendMessage(getMsg("Player-teleporting-self"));
- return true;
- }
- p.sendMessage(getMsg("Player-currently-teleporting"));
- target.teleport(p);
- target.sendMessage(getMsg("Target-currently-teleporting"));
- return true;
- }
- sender.sendMessage(getMsg("Player-only-command"));
- return true;
- }
-
- @Override
- public String getMsg(String path) {
- return colorize(clicktpa.getConfig().getString(path));
- }
-
-}
diff --git a/ClickTpa/src/main/java/com/jklmao/plugin/enums/TeleportMode.java b/ClickTpa/src/main/java/com/jklmao/plugin/enums/TeleportMode.java
deleted file mode 100644
index 884c3fe..0000000
--- a/ClickTpa/src/main/java/com/jklmao/plugin/enums/TeleportMode.java
+++ /dev/null
@@ -1,7 +0,0 @@
-package com.jklmao.plugin.enums;
-
-public enum TeleportMode {
-
- DEFAULT, TELEPORTING, TPTOGGLE_ON
-
-}
diff --git a/ClickTpa/src/main/java/com/jklmao/plugin/enums/TeleportType.java b/ClickTpa/src/main/java/com/jklmao/plugin/enums/TeleportType.java
deleted file mode 100644
index ceca825..0000000
--- a/ClickTpa/src/main/java/com/jklmao/plugin/enums/TeleportType.java
+++ /dev/null
@@ -1,7 +0,0 @@
-package com.jklmao.plugin.enums;
-
-public enum TeleportType {
-
- TPA, TPAHERE
-
-}
diff --git a/ClickTpa/src/main/java/com/jklmao/plugin/events/PlayerEvents.java b/ClickTpa/src/main/java/com/jklmao/plugin/events/PlayerEvents.java
deleted file mode 100644
index e039a1b..0000000
--- a/ClickTpa/src/main/java/com/jklmao/plugin/events/PlayerEvents.java
+++ /dev/null
@@ -1,49 +0,0 @@
-package com.jklmao.plugin.events;
-
-import org.bukkit.entity.Player;
-import org.bukkit.event.EventHandler;
-import org.bukkit.event.Listener;
-import org.bukkit.event.player.PlayerJoinEvent;
-import org.bukkit.event.player.PlayerMoveEvent;
-import org.bukkit.event.player.PlayerQuitEvent;
-
-import com.jklmao.plugin.ClickTpa;
-import com.jklmao.plugin.enums.TeleportMode;
-import com.jklmao.plugin.utils.CustomList;
-
-public class PlayerEvents implements Listener {
- private ClickTpa clicktpa;
-
- public PlayerEvents(ClickTpa pl) {
- clicktpa = pl;
- }
-
- @EventHandler
- public void onJoin(PlayerJoinEvent e) {
-
- CustomList list = new CustomList();
- clicktpa.getTpaPlayers().put(e.getPlayer(), list);
-
- }
-
- @EventHandler
- public void onLeave(PlayerQuitEvent e) {
- clicktpa.getTpaPlayers().remove(e.getPlayer());
- }
-
- @EventHandler
- public void onMove(PlayerMoveEvent e) {
- if (clicktpa.getConfig().getBoolean("Allow-player-to-move"))
- return;
- Player p = e.getPlayer();
- if (!clicktpa.getGraceList().contains(p))
- return;
-
- if (clicktpa.getGraceList().contains(p)) {
- if (e.getFrom().getBlockX() != e.getTo().getBlockX() || e.getFrom().getBlockZ() != e.getTo().getBlockZ()) {
- clicktpa.getGraceList().remove(p);
- clicktpa.getTpaPlayers().get(p).setMode(TeleportMode.DEFAULT);
- }
- }
- }
-}
diff --git a/ClickTpa/src/main/java/com/jklmao/plugin/events/RequestExpireListener.java b/ClickTpa/src/main/java/com/jklmao/plugin/events/RequestExpireListener.java
deleted file mode 100644
index 6ea68f4..0000000
--- a/ClickTpa/src/main/java/com/jklmao/plugin/events/RequestExpireListener.java
+++ /dev/null
@@ -1,82 +0,0 @@
-package com.jklmao.plugin.events;
-
-import org.bukkit.Bukkit;
-import org.bukkit.entity.Player;
-import org.bukkit.scheduler.BukkitTask;
-
-import com.jklmao.plugin.ClickTpa;
-import com.jklmao.plugin.enums.TeleportMode;
-import com.jklmao.plugin.utils.ConfigUtil;
-import com.jklmao.plugin.utils.TpaInfoList;
-
-public class RequestExpireListener implements ConfigUtil {
-
- private ClickTpa clicktpa;
- private TpaInfoList info;
- //
- private BukkitTask task;
-
- public RequestExpireListener(ClickTpa plugin, TpaInfoList tpaInfo) {
- clicktpa = plugin;
- info = tpaInfo;
- }
-
- public void startTimer(Player p, Player target) {
-
- task = Bukkit.getScheduler().runTaskTimer(clicktpa, new Runnable() {
-
- int time = clicktpa.getConfig().getInt("Request-expire-time") * 4;
-
- @Override
- public void run() {
-
- if (!p.isOnline()) {
- task.cancel();
- task = null;
- return;
- }
-
- if (time == 0) {
- task.cancel();
- p.sendMessage(getMsg("Player-teleportation-request-expire"));
- target.sendMessage(getMsg("Target-teleportation-request-expire"));
-
- // expired request
- clicktpa.getTpaPlayers().get(target).getTpaList().remove(info);
- clicktpa.getTpaPlayers().get(p).setMode(TeleportMode.DEFAULT);
- task = null;
- return;
- }
-
- if (!target.isOnline()) {
- task.cancel();
- task = null;
- return;
- } else {
-
- if (!clicktpa.getTpaPlayers().get(target).getTpaList().contains(info)) {
- task.cancel();
- task = null;
- return;
- }
-
- if (clicktpa.getTpaPlayers().get(p).getMode() == TeleportMode.TELEPORTING) {
- task.cancel();
- task = null;
- return;
- }
- }
-
- time = time - 1;
- }
-
- }, 0, 5);
-
- }
-
- @Override
- public String getMsg(String path) {
- return colorize(clicktpa.getConfig().getString(path));
- }
-
-}
diff --git a/ClickTpa/src/main/java/com/jklmao/plugin/events/TpaCountdownListener.java b/ClickTpa/src/main/java/com/jklmao/plugin/events/TpaCountdownListener.java
deleted file mode 100644
index c307cd3..0000000
--- a/ClickTpa/src/main/java/com/jklmao/plugin/events/TpaCountdownListener.java
+++ /dev/null
@@ -1,147 +0,0 @@
-package com.jklmao.plugin.events;
-
-import org.bukkit.Bukkit;
-import org.bukkit.entity.Player;
-import org.bukkit.scheduler.BukkitTask;
-
-import com.jklmao.plugin.ClickTpa;
-import com.jklmao.plugin.enums.TeleportMode;
-import com.jklmao.plugin.enums.TeleportType;
-import com.jklmao.plugin.utils.TeleportMsgs;
-import com.jklmao.plugin.utils.TpaInfoList;
-
-public class TpaCountdownListener {
-
- private ClickTpa clicktpa;
- private TeleportMsgs tpMsgs;
- private BukkitTask cdTask;
-
- public TpaCountdownListener(ClickTpa plugin) {
- clicktpa = plugin;
- tpMsgs = new TeleportMsgs(clicktpa);
- }
-
- public void tpaCountdown(int secs, TeleportType type, Player sender, Player target) {
-
- switch (type) {
- case TPA:
- tpMsgs.currentlyTeleportingTitle(secs, target);
- break;
- case TPAHERE:
- tpMsgs.currentlyTeleportingTitle(secs, sender);
- break;
- }
-
- cdTask = Bukkit.getScheduler().runTaskTimer(clicktpa, new Runnable() {
- int time = secs * 2;
-
- @Override
- public void run() {
-
- if (disconnectListener(sender, target)) {
- return;
- }
-
- moveListener(type, sender, target);
-
- if (time == 0) {
-
- if (disconnectListener(sender, target)) {
- return;
- }
-
- teleport(type, sender, target);
- cdTask.cancel();
- }
-
- time = time - 1;
-
- }
-
- }, 0, 10);
-
- }
-
- private void teleport(TeleportType type, Player sender, Player target) {
- switch (type) {
- case TPA:
- target.teleport(sender);
- tpMsgs.successfulTPATitle(target, sender);
- clicktpa.getTpaPlayers().get(target).setMode(TeleportMode.DEFAULT);
- break;
- case TPAHERE:
- sender.teleport(target);
- tpMsgs.successfulTPATitle(sender, target);
- clicktpa.getTpaPlayers().get(sender).setMode(TeleportMode.DEFAULT);
- break;
- }
-
- removeTpaInfo(sender, target);
-
- }
-
- private void moveListener(TeleportType type, Player sender, Player target) {
-
- switch (type) {
- case TPA:
-
- if (!clicktpa.getGraceList().contains(target)) {
- cdTask.cancel();
- tpMsgs.sendMoveBeforeTPATitle(sender, target);
- removeTpaInfo(sender, target);
- }
-
- return;
- case TPAHERE:
-
- if (!clicktpa.getGraceList().contains(sender)) {
- cdTask.cancel();
- tpMsgs.sendMoveBeforeTPAHERETitle(sender, target);
- removeTpaInfo(sender, target);
-
- }
-
- return;
- }
- }
-
- private boolean disconnectListener(Player sender, Player target) {
-
- if (!sender.isOnline()) {
- cdTask.cancel();
- cdTask = null;
- target.sendMessage(tpMsgs.getMsg("Target-teleportion-canceled"));
- clicktpa.getGraceList().remove(target);
- clicktpa.getTpaPlayers().get(target).setMode(TeleportMode.DEFAULT);
-
- return true;
- }
-
- if (!target.isOnline()) {
- cdTask.cancel();
- cdTask = null;
- sender.sendMessage(tpMsgs.getMsg("Target-teleportion-canceled"));
- clicktpa.getGraceList().remove(sender);
- clicktpa.getTpaPlayers().get(sender).setMode(TeleportMode.DEFAULT);
-
- return true;
- }
- return false;
-
- }
-
- private void removeTpaInfo(Player sender, Player target) {
-
- for (TpaInfoList tpaInfo : clicktpa.getTpaPlayers().get(sender).getTpaList()) {
-
- if (tpaInfo.getRequester() != target) {
- continue;
- } else {
- clicktpa.getTpaPlayers().get(sender).getTpaList().remove(tpaInfo);
- return;
- }
- }
-
- }
-
-}
diff --git a/ClickTpa/src/main/java/com/jklmao/plugin/utils/ConfigUtil.java b/ClickTpa/src/main/java/com/jklmao/plugin/utils/ConfigUtil.java
deleted file mode 100644
index b6be152..0000000
--- a/ClickTpa/src/main/java/com/jklmao/plugin/utils/ConfigUtil.java
+++ /dev/null
@@ -1,15 +0,0 @@
-package com.jklmao.plugin.utils;
-
-import net.md_5.bungee.api.ChatColor;
-
-public interface ConfigUtil {
-
- default String getMsg(String path) {
- return null;
- }
-
- default String colorize(String message) {
- return ChatColor.translateAlternateColorCodes('&', message);
- }
-
-}
diff --git a/ClickTpa/src/main/java/com/jklmao/plugin/utils/CustomList.java b/ClickTpa/src/main/java/com/jklmao/plugin/utils/CustomList.java
deleted file mode 100644
index 43ef7fb..0000000
--- a/ClickTpa/src/main/java/com/jklmao/plugin/utils/CustomList.java
+++ /dev/null
@@ -1,25 +0,0 @@
-package com.jklmao.plugin.utils;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import com.jklmao.plugin.enums.TeleportMode;
-
-public class CustomList {
-
- private List tpaList = new ArrayList<>();
- private TeleportMode mode = TeleportMode.DEFAULT;
-
- public TeleportMode getMode() {
- return mode;
- }
-
- public void setMode(TeleportMode mode) {
- this.mode = mode;
- }
-
- public List getTpaList() {
- return tpaList;
- }
-
-}
diff --git a/ClickTpa/src/main/java/com/jklmao/plugin/utils/TeleportMsgs.java b/ClickTpa/src/main/java/com/jklmao/plugin/utils/TeleportMsgs.java
deleted file mode 100644
index 31a1d2e..0000000
--- a/ClickTpa/src/main/java/com/jklmao/plugin/utils/TeleportMsgs.java
+++ /dev/null
@@ -1,124 +0,0 @@
-package com.jklmao.plugin.utils;
-
-import java.util.List;
-
-import org.bukkit.entity.Player;
-
-import com.jklmao.plugin.ClickTpa;
-import com.jklmao.plugin.enums.TeleportType;
-
-import net.md_5.bungee.api.chat.BaseComponent;
-import net.md_5.bungee.api.chat.ClickEvent;
-import net.md_5.bungee.api.chat.HoverEvent;
-import net.md_5.bungee.api.chat.TextComponent;
-import net.md_5.bungee.api.chat.hover.content.Content;
-import net.md_5.bungee.api.chat.hover.content.Text;
-
-public class TeleportMsgs implements ConfigUtil {
-
- private ClickTpa clicktpa;
-
- public TeleportMsgs(ClickTpa plugin) {
- clicktpa = plugin;
- }
-
- public void sendRequestMsg(TeleportType type, Player player, Player target) {
-
- TextComponent accept = new TextComponent(getMsg("Click-to-accept"));
- Text acceptHoverText = new Text(getMsg("Hover-message-on-accept"));
- accept.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new Content[] { acceptHoverText }));
- accept.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tpaccept " + player.getName()));
-
- TextComponent deny = new TextComponent(getMsg("Click-to-deny"));
- Text denyHoverText = new Text(getMsg("Hover-message-on-deny"));
- deny.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new Content[] { denyHoverText }));
- deny.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tpadeny " + player.getName()));
-
- String requestsent = getMsg("Player-sent-request").replaceAll("%target%", target.getName());
-
- List tpa = null;
-
- switch (type) {
- case TPA:
- tpa = clicktpa.getConfig().getStringList("Tpa-message");
- break;
- case TPAHERE:
- tpa = clicktpa.getConfig().getStringList("Tpahere-message");
- break;
- }
-
- for (String m : tpa) {
- target.sendMessage(
- colorize(m).replaceAll("%player%", player.getName()).replaceAll("%accept%", accept.getText()).replaceAll("%deny%", deny.getText()));
- }
-
- if (clicktpa.getConfig().getBoolean("Center-accept-deny-msg")) {
-
- TextComponent eemptyspace = new TextComponent(" ");
- TextComponent bemptyspace = new TextComponent(" ");
- target.spigot().sendMessage(new BaseComponent[] { bemptyspace, accept, eemptyspace, deny });
- player.sendMessage(requestsent);
- } else {
- TextComponent emptyspace = new TextComponent(" ");
- target.spigot().sendMessage(new BaseComponent[] { accept, emptyspace, deny });
- player.sendMessage(requestsent);
- }
-
- }
-
- public void successfulTPATitle(Player teleporter, Player waiter) {
-
- if (doSendTitle()) {
- String successMsg = getMsg("On-screen-teleported");
- teleporter.sendTitle(successMsg, "", 1, 20, 1);
- }
-
- teleporter.sendMessage(getMsg("Target-currently-teleporting"));
- waiter.sendMessage(getMsg("Player-currently-teleporting"));
-
- }
-
- public void currentlyTeleportingTitle(int secs, Player teleporter) {
-
- if (doSendTitle()) {
- String mainTitle = clicktpa.getConfig().getStringList("On-screen-teleporting").get(0);
- String subTitle = clicktpa.getConfig().getStringList("On-screen-teleporting").get(1);
- teleporter.sendTitle(colorize(mainTitle), colorize(subTitle), 1, secs * 20, 1);
-
- }
- }
-
- public void sendMoveBeforeTPAHERETitle(Player player, Player target) {
-
- if (doSendTitle()) {
- String cancelMsg = getMsg("On-screen-canceled-tp");
- player.sendTitle(cancelMsg, "", 1, 30, 1);
- }
-
- target.sendMessage(getMsg("Player-moved-before-tp").replaceAll("%player%", player.getName()));
- player.sendMessage(getMsg("Player-moved-before-tp").replaceAll("%player%", player.getName()));
-
- }
-
- public void sendMoveBeforeTPATitle(Player player, Player target) {
-
- if (doSendTitle()) {
- String cancelMsg = getMsg("On-screen-canceled-tp");
- target.sendTitle(cancelMsg, "", 1, 30, 1);
- }
-
- target.sendMessage(getMsg("Player-moved-before-tp").replaceAll("%player%", target.getName()));
- player.sendMessage(getMsg("Player-moved-before-tp").replaceAll("%player%", target.getName()));
-
- }
-
- private boolean doSendTitle() {
- return clicktpa.getConfig().getBoolean("Send-on-screen-message");
- }
-
- @Override
- public String getMsg(String path) {
- return colorize(clicktpa.getConfig().getString(path));
- }
-
-}
diff --git a/ClickTpa/src/main/java/com/jklmao/plugin/utils/TpaInfoList.java b/ClickTpa/src/main/java/com/jklmao/plugin/utils/TpaInfoList.java
deleted file mode 100644
index 72255bd..0000000
--- a/ClickTpa/src/main/java/com/jklmao/plugin/utils/TpaInfoList.java
+++ /dev/null
@@ -1,24 +0,0 @@
-package com.jklmao.plugin.utils;
-
-import org.bukkit.entity.Player;
-
-import com.jklmao.plugin.enums.TeleportType;
-
-public class TpaInfoList {
-
- private TeleportType type;
- private Player target;
-
- public TpaInfoList(TeleportType t, Player p) {
- type = t;
- target = p;
- }
-
- public Player getRequester() {
- return target;
- }
-
- public TeleportType getType() {
- return type;
- }
-}
diff --git a/ClickTpa/src/main/java/config.yml b/ClickTpa/src/main/java/config.yml
deleted file mode 100644
index 2c32066..0000000
--- a/ClickTpa/src/main/java/config.yml
+++ /dev/null
@@ -1,162 +0,0 @@
-# Config for ClickTpa
-# Version v1.7.1
-# Author: jklmao
-
-# # # # # # # # # # # # # # # # # # # # # # # # #
-# #
-# ClickTpa Config #
-# #
-# # # # # # # # # # # # # # # # # # # # # # # # #
-
-# Be aware of all warnings! #
-
-# # # # # # # # # # # # # # # # # # # # # # # # #
-# #
-# Place Holders #
-# #
-# # # # # # # # # # # # # # # # # # # # # # # # #
-
-# Use '%player%' for the player who sent the request.
-# Use '%accept%' for the 'Click-to-accept' message.
-# Use '%deny%' for the 'Click-to-deny' message.
-# Use '%target%' for the player who they wanted to teleport to, and for the 'Player-sent-request' message.
-# Example: /tpa , where is '%target%'.
-
-Player-only-command: '&cOnly players can use this command!'
-
-Insufficient-permission: '&cYou do not have sufficient permission!'
-
-Player-deny-tpa-message: '&cTeleportation request has been denied.'
-
-Target-deny-tpa-message: '&cTeleportation request has been denied.'
-
-Target-teleportion-canceled: '&cTeleportation canceled...'
-
-Player-got-accepted-tpa: '&bTeleportation request has been accepted.'
-
-Countdown-until-tpa: '&eTeleporting in 3 seconds...'
-
-Player-no-pendingtpa-message: '&cYou do not have a pending request!'
-
-Target-accepted-tpa-request: '&eRequest for teleportation is accepted.'
-
-Target-is-offline: '&cThis player is offline!'
-
-No-player-found: '&cThis player does not exist!'
-
-Player-teleporting-self: '&cYou can not teleport yourself!'
-
-Player-already-requested: '&cYou already requested, please wait..'
-
-Player-teleportation-request-expire: '&cTeleportation request has expired.'
-
-Target-teleportation-request-expire: '&cTeleportation request has expired.'
-
-Player-currently-teleporting: '&bTeleporting...'
-
-Target-currently-teleporting: '&eTeleporting...'
-
-Player-TpToggle-Off: '&eTeleportation &6OFF'
-
-Player-TpToggle-On: '&eTeleportation &6ON'
-
-Target-Is-TpToggled: '&6%target% &ehas teleportation off'
-
-Player-Is-TpToggled: '&cYou are tptoggled!'
-
-TpToggle-While-Teleporting: '&cCannot TpToggle while teleporting!'
-
-Tpacancel-message: '&6Tpa request has been canceled.'
-
-# TPA request expires in seconds
-Request-expire-time: 120
-
-
-# Seconds until tpa
-# Please use whole numbers
-
-Seconds-until-tpa: 3
-
-# Becareful in this part!
-# This is when a player uses not enough args
-# For example, when a player does '/tpa', it will say 'Usage: /tpa '
-# So please fit the correct command under the correct message!
-# P.S '/tpohere' is also '/s' (essentials-type command).
-
-Tpa-usage: '&cUse: /tpa '
-
-Tpahere-usage: '&cUse: /tpahere '
-
-Tpaccept-usage: '&cUse: /tpaccept '
-
-Tpdeny-usage: '&cUse: /tpadeny '
-
-Tpo-usage: '&cUse: /tpo '
-
-Tpohere-usage: '&cUse: /tpohere or /s '
-
-
-# # # # # # # # # # # # # # # # # # # # # # # # #
-# #
-# Please Read! #
-# #
-# # # # # # # # # # # # # # # # # # # # # # # # #
-
-# This section is when a player gets a tpa request
-# Since the code used is broken into many parts, there will be many messages.
-# Whatever you do to the "Click-to-x" messages, will be the same in the 'Tpa-message'
-# Be careful!
-
-
-# Lets you choose if you want players to be able
-# to move before being teleported
-Allow-player-to-move: false
-
-Player-moved-before-tp: '&6The request was canceled because %player% moved!'
-
-Player-sent-request: '&eYou have sent a request to &6%target%'
-
-Tpa-message:
- - ''
- - '&e%player% &6has requested to teleport to you.'
- - '&6Click %accept% &6to accept or click %deny% &6to deny.'
- - '&6The request expires in 120 seconds.'
- - ''
-
-Tpahere-message:
- - ''
- - '&e%player% &6has requested to teleport you to them.'
- - '&6Click %accept% &6to accept or click %deny% &6to deny.'
- - '&6The request expires in 120 seconds.'
- - ''
-
-# This will put additional spaces for the accept/deny messages
-Center-accept-deny-msg: true
-
-Click-to-accept: '&a&l&n[Accept]&r'
-Click-to-deny: '&c&l&n[Deny]&r'
-
-Hover-message-on-accept: '&aClick to accept'
-Hover-message-on-deny: '&cClick to deny'
-
-#
-# On-Screen Messages
-# It pops up in the middle of the player's screen
-#
-
-Send-on-screen-message: true
-
-# When a player accepts a tp
-On-screen-teleporting:
- - '&6Teleporting...'
- - '&eDo not move!'
-
-# When a player has successfully tp'd.
-On-screen-teleported: '&aTeleported!'
-
-# If a player moves while they are being tp'd
-On-screen-canceled-tp: '&cCanceled TP!'
-
-#~~~~~~~~~~~~~~~~~~#
-# More Coming Soon!#
-#~~~~~~~~~~~~~~~~~~#
diff --git a/ClickTpa/src/main/java/plugin.yml b/ClickTpa/src/main/java/plugin.yml
deleted file mode 100644
index 103de24..0000000
--- a/ClickTpa/src/main/java/plugin.yml
+++ /dev/null
@@ -1,32 +0,0 @@
-name: ClickTpa
-version: 1.7.1
-main: com.jklmao.plugin.ClickTpa
-authors: [ jklmao ]
-description: Simple TPA plugin for Spigot/Paper Software
-
-commands:
- tpa:
- usage: /
- aliases: [teleport]
- tpahere:
- usage: /
- tpaccept:
- usage: /
- aliases: [tpyes]
- tpadeny:
- usage: /
- aliases: [tpdeny, tpno]
- tpo:
- usage: /
- alises: [tp]
- tpohere:
- usage: /
- aliases: [s, tphere]
- tptoggle:
- usage: /
- tpacancel:
- usage: /
- aliases: [tpcancel]
- clicktparl:
- usage: /
- aliases: [ctparl]
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 0000000..a8770c0
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,18 @@
+MIT No Attribution
+
+Copyright (c) 2023 darksaid98
+
+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.
+
+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.
\ No newline at end of file
diff --git a/README.md b/README.md
index 12c7710..e69de29 100644
--- a/README.md
+++ b/README.md
@@ -1,3 +0,0 @@
-ClickTpa
-Author: humonga (aliases: jklmao, Chris)
-Simple TP plugin that allows players to click chat to accepts TPs.
diff --git a/build.gradle.kts b/build.gradle.kts
new file mode 100644
index 0000000..3a7e0a8
--- /dev/null
+++ b/build.gradle.kts
@@ -0,0 +1,159 @@
+import java.time.Instant
+
+plugins {
+ `java-library`
+
+ id("com.github.johnrengelman.shadow") version "8.1.1" // Shades and relocates dependencies, See https://imperceptiblethoughts.com/shadow/introduction/
+ id("xyz.jpenilla.run-paper") version "2.2.2" // Adds runServer and runMojangMappedServer tasks for testing
+ id("net.minecrell.plugin-yml.bukkit") version "0.6.0" // Automatic plugin.yml generation
+
+ eclipse
+ idea
+}
+
+group = "io.github.Alathra"
+version = "1.0.0"
+description = "Simple collection of commands for the Alathra server."
+val mainPackage = "${project.group}.${rootProject.name}"
+
+java {
+ toolchain.languageVersion.set(JavaLanguageVersion.of(JavaVersion.VERSION_17.majorVersion)) // Configure the java toolchain. This allows gradle to auto-provision JDK 17 on systems that only have JDK 8 installed for example.
+}
+
+repositories {
+ mavenCentral()
+
+ maven("https://papermc.io/repo/repository/maven-public/")
+ maven("https://mvn-repo.arim.space/lesser-gpl3/")
+
+ maven("https://jitpack.io") {
+ content {
+ includeGroup("com.github.MilkBowl")
+ includeGroup("com.github.milkdrinkers")
+ }
+ }
+
+ maven("https://repo.codemc.org/repository/maven-public/") {
+ content { includeGroup("dev.jorel") }
+ }
+
+ maven("https://repo.extendedclip.com/content/repositories/placeholderapi/") {
+ content { includeGroup("me.clip") }
+ }
+
+ /* EssentialsX */
+// maven("https://repo.essentialsx.net/releases/")
+// maven("https://repo.essentialsx.net/snapshots/")
+
+// mavenCentral {
+// content { includeGroup("net.kyori") }
+// }
+}
+
+dependencies {
+ compileOnly("org.jetbrains:annotations:24.1.0")
+ annotationProcessor("org.jetbrains:annotations:24.1.0")
+
+ compileOnly("io.papermc.paper:paper-api:1.20.2-R0.1-SNAPSHOT")
+ implementation("space.arim.morepaperlib:morepaperlib:latest.release")
+
+ implementation("com.github.milkdrinkers:crate:1.1.0")
+ implementation("com.github.milkdrinkers:colorparser:2.0.0") {
+ exclude("net.kyori")
+ }
+
+ implementation("dev.jorel:commandapi-bukkit-shade:9.2.0")
+
+ compileOnly("com.github.MilkBowl:VaultAPI:1.7")
+
+ compileOnly("me.clip:placeholderapi:2.11.5")
+}
+
+tasks {
+ build {
+ dependsOn(shadowJar)
+ }
+
+ compileJava {
+ options.encoding = Charsets.UTF_8.name() // We want UTF-8 for everything
+
+ // Set the release flag. This configures what version bytecode the compiler will emit, as well as what JDK APIs are usable.
+ // See https://openjdk.java.net/jeps/247 for more information.
+ options.release.set(17)
+ options.compilerArgs.addAll(arrayListOf("-Xlint:all", "-Xlint:-processing", "-Xdiags:verbose"))
+ }
+
+ javadoc {
+ options.encoding = Charsets.UTF_8.name() // We want UTF-8 for everything
+ }
+
+ processResources {
+ filteringCharset = Charsets.UTF_8.name() // We want UTF-8 for everything
+ }
+
+ shadowJar {
+ archiveBaseName.set(project.name)
+ archiveClassifier.set("")
+
+ // Shadow classes
+ fun reloc(originPkg: String, targetPkg: String) = relocate(originPkg, "${mainPackage}.lib.${targetPkg}")
+
+ reloc("space.arim.morepaperlib", "morepaperlib")
+ reloc("com.github.milkdrinkers.Crate", "crate")
+ reloc("com.github.milkdrinkers.colorparser", "colorparser")
+ reloc("dev.jorel.commandapi", "commandapi")
+
+ minimize()
+ }
+
+ runServer {
+ // Configure the Minecraft version for our task.
+ minecraftVersion("1.20.2")
+
+ // IntelliJ IDEA debugger setup: https://docs.papermc.io/paper/dev/debugging#using-a-remote-debugger
+ jvmArgs("-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:5005", "-DPaper.IgnoreJavaVersion=true", "-Dcom.mojang.eula.agree=true", "-DIReallyKnowWhatIAmDoingISwear")
+ systemProperty("terminal.jline", false)
+ systemProperty("terminal.ansi", true)
+
+ // Automatically install dependencies
+ downloadPlugins {
+// modrinth("carbon", "2.1.0-beta.21")
+// github("jpenilla", "MiniMOTD", "v2.0.13", "minimotd-bukkit-2.0.13.jar")
+// hangar("squaremap", "1.2.0")
+// url("https://download.luckperms.net/1515/bukkit/loader/LuckPerms-Bukkit-5.4.102.jar")
+ github("MilkBowl", "Vault", "1.7.3", "Vault.jar")
+ }
+ }
+}
+
+bukkit {
+ // Plugin main class (required)
+ main = "${mainPackage}.${rootProject.name}"
+
+ // Plugin Information
+ name = project.name
+ prefix = project.name
+ version = "${project.version}"
+ description = "${project.description}"
+ authors = listOf("jklmao", "darksaid98")
+ contributors = listOf()
+ apiVersion = "1.19"
+ website = "https://github.com/darksaid98/ClickTpa/"
+
+ // Misc properties
+ load = net.minecrell.pluginyml.bukkit.BukkitPluginDescription.PluginLoadOrder.POSTWORLD // STARTUP or POSTWORLD
+ depend = listOf()
+ softDepend = listOf("PlaceholderAPI", "Vault", "Essentials")
+}
+
+// Apply custom version arg
+val versionArg = if (hasProperty("customVersion"))
+ (properties["customVersion"] as String).uppercase() // Uppercase version string
+else
+ "${project.version}-SNAPSHOT-${Instant.now().epochSecond}" // Append snapshot to version
+
+// Strip prefixed "v" from version tag
+project.version = if (versionArg.first().equals('v', true))
+ versionArg.substring(1)
+else
+ versionArg.uppercase()
\ No newline at end of file
diff --git a/gradle.properties b/gradle.properties
new file mode 100644
index 0000000..4e75374
--- /dev/null
+++ b/gradle.properties
@@ -0,0 +1,4 @@
+org.gradle.caching=true
+org.gradle.parallel=true
+org.gradle.daemon=true
+org.gradle.jvmargs=-Xmx2048M
diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar
new file mode 100644
index 0000000..7f93135
Binary files /dev/null and b/gradle/wrapper/gradle-wrapper.jar differ
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
new file mode 100644
index 0000000..3fa8f86
--- /dev/null
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -0,0 +1,7 @@
+distributionBase=GRADLE_USER_HOME
+distributionPath=wrapper/dists
+distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip
+networkTimeout=10000
+validateDistributionUrl=true
+zipStoreBase=GRADLE_USER_HOME
+zipStorePath=wrapper/dists
diff --git a/gradlew b/gradlew
new file mode 100644
index 0000000..1aa94a4
--- /dev/null
+++ b/gradlew
@@ -0,0 +1,249 @@
+#!/bin/sh
+
+#
+# Copyright © 2015-2021 the original authors.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+##############################################################################
+#
+# Gradle start up script for POSIX generated by Gradle.
+#
+# Important for running:
+#
+# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
+# noncompliant, but you have some other compliant shell such as ksh or
+# bash, then to run this script, type that shell name before the whole
+# command line, like:
+#
+# ksh Gradle
+#
+# Busybox and similar reduced shells will NOT work, because this script
+# requires all of these POSIX shell features:
+# * functions;
+# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
+# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
+# * compound commands having a testable exit status, especially «case»;
+# * various built-in commands including «command», «set», and «ulimit».
+#
+# Important for patching:
+#
+# (2) This script targets any POSIX shell, so it avoids extensions provided
+# by Bash, Ksh, etc; in particular arrays are avoided.
+#
+# The "traditional" practice of packing multiple parameters into a
+# space-separated string is a well documented source of bugs and security
+# problems, so this is (mostly) avoided, by progressively accumulating
+# options in "$@", and eventually passing that to Java.
+#
+# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
+# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
+# see the in-line comments for details.
+#
+# There are tweaks for specific operating systems such as AIX, CygWin,
+# Darwin, MinGW, and NonStop.
+#
+# (3) This script is generated from the Groovy template
+# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
+# within the Gradle project.
+#
+# You can find Gradle at https://github.com/gradle/gradle/.
+#
+##############################################################################
+
+# Attempt to set APP_HOME
+
+# Resolve links: $0 may be a link
+app_path=$0
+
+# Need this for daisy-chained symlinks.
+while
+ APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
+ [ -h "$app_path" ]
+do
+ ls=$( ls -ld "$app_path" )
+ link=${ls#*' -> '}
+ case $link in #(
+ /*) app_path=$link ;; #(
+ *) app_path=$APP_HOME$link ;;
+ esac
+done
+
+# This is normally unused
+# shellcheck disable=SC2034
+APP_BASE_NAME=${0##*/}
+# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
+APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit
+
+# Use the maximum available, or set MAX_FD != -1 to use that value.
+MAX_FD=maximum
+
+warn () {
+ echo "$*"
+} >&2
+
+die () {
+ echo
+ echo "$*"
+ echo
+ exit 1
+} >&2
+
+# OS specific support (must be 'true' or 'false').
+cygwin=false
+msys=false
+darwin=false
+nonstop=false
+case "$( uname )" in #(
+ CYGWIN* ) cygwin=true ;; #(
+ Darwin* ) darwin=true ;; #(
+ MSYS* | MINGW* ) msys=true ;; #(
+ NONSTOP* ) nonstop=true ;;
+esac
+
+CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
+
+
+# Determine the Java command to use to start the JVM.
+if [ -n "$JAVA_HOME" ] ; then
+ if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
+ # IBM's JDK on AIX uses strange locations for the executables
+ JAVACMD=$JAVA_HOME/jre/sh/java
+ else
+ JAVACMD=$JAVA_HOME/bin/java
+ fi
+ if [ ! -x "$JAVACMD" ] ; then
+ die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+ fi
+else
+ JAVACMD=java
+ if ! command -v java >/dev/null 2>&1
+ then
+ die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+ fi
+fi
+
+# Increase the maximum file descriptors if we can.
+if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
+ case $MAX_FD in #(
+ max*)
+ # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
+ # shellcheck disable=SC2039,SC3045
+ MAX_FD=$( ulimit -H -n ) ||
+ warn "Could not query maximum file descriptor limit"
+ esac
+ case $MAX_FD in #(
+ '' | soft) :;; #(
+ *)
+ # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
+ # shellcheck disable=SC2039,SC3045
+ ulimit -n "$MAX_FD" ||
+ warn "Could not set maximum file descriptor limit to $MAX_FD"
+ esac
+fi
+
+# Collect all arguments for the java command, stacking in reverse order:
+# * args from the command line
+# * the main class name
+# * -classpath
+# * -D...appname settings
+# * --module-path (only if needed)
+# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
+
+# For Cygwin or MSYS, switch paths to Windows format before running java
+if "$cygwin" || "$msys" ; then
+ APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
+ CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
+
+ JAVACMD=$( cygpath --unix "$JAVACMD" )
+
+ # Now convert the arguments - kludge to limit ourselves to /bin/sh
+ for arg do
+ if
+ case $arg in #(
+ -*) false ;; # don't mess with options #(
+ /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
+ [ -e "$t" ] ;; #(
+ *) false ;;
+ esac
+ then
+ arg=$( cygpath --path --ignore --mixed "$arg" )
+ fi
+ # Roll the args list around exactly as many times as the number of
+ # args, so each arg winds up back in the position where it started, but
+ # possibly modified.
+ #
+ # NB: a `for` loop captures its iteration list before it begins, so
+ # changing the positional parameters here affects neither the number of
+ # iterations, nor the values presented in `arg`.
+ shift # remove old arg
+ set -- "$@" "$arg" # push replacement arg
+ done
+fi
+
+
+# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
+
+# Collect all arguments for the java command:
+# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
+# and any embedded shellness will be escaped.
+# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
+# treated as '${Hostname}' itself on the command line.
+
+set -- \
+ "-Dorg.gradle.appname=$APP_BASE_NAME" \
+ -classpath "$CLASSPATH" \
+ org.gradle.wrapper.GradleWrapperMain \
+ "$@"
+
+# Stop when "xargs" is not available.
+if ! command -v xargs >/dev/null 2>&1
+then
+ die "xargs is not available"
+fi
+
+# Use "xargs" to parse quoted args.
+#
+# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
+#
+# In Bash we could simply go:
+#
+# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
+# set -- "${ARGS[@]}" "$@"
+#
+# but POSIX shell has neither arrays nor command substitution, so instead we
+# post-process each arg (as a line of input to sed) to backslash-escape any
+# character that might be a shell metacharacter, then use eval to reverse
+# that process (while maintaining the separation between arguments), and wrap
+# the whole thing up as a single "set" statement.
+#
+# This will of course break if any of these variables contains a newline or
+# an unmatched quote.
+#
+
+eval "set -- $(
+ printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
+ xargs -n1 |
+ sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
+ tr '\n' ' '
+ )" '"$@"'
+
+exec "$JAVACMD" "$@"
diff --git a/gradlew.bat b/gradlew.bat
new file mode 100644
index 0000000..93e3f59
--- /dev/null
+++ b/gradlew.bat
@@ -0,0 +1,92 @@
+@rem
+@rem Copyright 2015 the original author or authors.
+@rem
+@rem Licensed under the Apache License, Version 2.0 (the "License");
+@rem you may not use this file except in compliance with the License.
+@rem You may obtain a copy of the License at
+@rem
+@rem https://www.apache.org/licenses/LICENSE-2.0
+@rem
+@rem Unless required by applicable law or agreed to in writing, software
+@rem distributed under the License is distributed on an "AS IS" BASIS,
+@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+@rem See the License for the specific language governing permissions and
+@rem limitations under the License.
+@rem
+
+@if "%DEBUG%"=="" @echo off
+@rem ##########################################################################
+@rem
+@rem Gradle startup script for Windows
+@rem
+@rem ##########################################################################
+
+@rem Set local scope for the variables with windows NT shell
+if "%OS%"=="Windows_NT" setlocal
+
+set DIRNAME=%~dp0
+if "%DIRNAME%"=="" set DIRNAME=.
+@rem This is normally unused
+set APP_BASE_NAME=%~n0
+set APP_HOME=%DIRNAME%
+
+@rem Resolve any "." and ".." in APP_HOME to make it shorter.
+for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
+
+@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
+
+@rem Find java.exe
+if defined JAVA_HOME goto findJavaFromJavaHome
+
+set JAVA_EXE=java.exe
+%JAVA_EXE% -version >NUL 2>&1
+if %ERRORLEVEL% equ 0 goto execute
+
+echo.
+echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:findJavaFromJavaHome
+set JAVA_HOME=%JAVA_HOME:"=%
+set JAVA_EXE=%JAVA_HOME%/bin/java.exe
+
+if exist "%JAVA_EXE%" goto execute
+
+echo.
+echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:execute
+@rem Setup the command line
+
+set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
+
+
+@rem Execute Gradle
+"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
+
+:end
+@rem End local scope for the variables with windows NT shell
+if %ERRORLEVEL% equ 0 goto mainEnd
+
+:fail
+rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
+rem the _cmd.exe /c_ return code!
+set EXIT_CODE=%ERRORLEVEL%
+if %EXIT_CODE% equ 0 set EXIT_CODE=1
+if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
+exit /b %EXIT_CODE%
+
+:mainEnd
+if "%OS%"=="Windows_NT" endlocal
+
+:omega
diff --git a/settings.gradle.kts b/settings.gradle.kts
new file mode 100644
index 0000000..841c755
--- /dev/null
+++ b/settings.gradle.kts
@@ -0,0 +1,12 @@
+pluginManagement {
+ repositories {
+ gradlePluginPortal()
+ mavenCentral()
+ }
+}
+
+plugins {
+ id("org.gradle.toolchains.foojay-resolver-convention") version("0.7.0")
+}
+
+rootProject.name = "AlathranCommands"
\ No newline at end of file
diff --git a/src/main/java/io/github/Alathra/AlathranCommands/AlathranCommands.java b/src/main/java/io/github/Alathra/AlathranCommands/AlathranCommands.java
new file mode 100644
index 0000000..23db229
--- /dev/null
+++ b/src/main/java/io/github/Alathra/AlathranCommands/AlathranCommands.java
@@ -0,0 +1,71 @@
+package io.github.Alathra.AlathranCommands;
+
+import com.github.milkdrinkers.colorparser.ColorParser;
+import io.github.Alathra.AlathranCommands.commands.CommandHandler;
+import io.github.Alathra.AlathranCommands.hooks.VaultHook;
+import io.github.Alathra.AlathranCommands.listener.ListenerHandler;
+import io.github.Alathra.AlathranCommands.utils.Logger;
+import io.github.Alathra.AlathranCommands.config.TeleportConfigHandler;
+import org.bukkit.plugin.java.JavaPlugin;
+import org.jetbrains.annotations.NotNull;
+
+public final class AlathranCommands extends JavaPlugin {
+ private static AlathranCommands instance;
+ private TeleportConfigHandler teleportConfigHandler;
+ private CommandHandler commandHandler;
+ private ListenerHandler listenerHandler;
+ private static VaultHook vaultHook;
+
+ public static AlathranCommands getInstance() {
+ return instance;
+ }
+
+ @Override
+ public void onLoad() {
+ instance = this;
+ teleportConfigHandler = new TeleportConfigHandler(instance);
+ commandHandler = new CommandHandler(instance);
+ listenerHandler = new ListenerHandler(instance);
+ vaultHook = new VaultHook(instance);
+
+ teleportConfigHandler.onLoad();
+ commandHandler.onLoad();
+ listenerHandler.onLoad();
+ vaultHook.onLoad();
+ }
+
+ @Override
+ public void onEnable() {
+ saveDefaultConfig();
+ teleportConfigHandler.onEnable();
+ commandHandler.onEnable();
+ listenerHandler.onEnable();
+ vaultHook.onEnable();
+
+ // Economy Notification
+ if (vaultHook.isVaultLoaded()) {
+ Logger.get().info(ColorParser.of("Vault has been found on this server. Economy support enabled.").build());
+ } else {
+ Logger.get().warn(ColorParser.of("Vault is not installed on this server. Economy support has been disabled.").build());
+ }
+
+ Logger.get().info(ColorParser.of("AlathranCommands successfully loaded.").build());
+ }
+
+ @Override
+ public void onDisable() {
+ commandHandler.onDisable();
+ listenerHandler.onDisable();
+ vaultHook.onDisable();
+ teleportConfigHandler.onDisable();
+ }
+
+ @NotNull
+ public TeleportConfigHandler getTeleportConfigHandler() {
+ return teleportConfigHandler;
+ }
+
+ public static VaultHook getVaultHook() {
+ return vaultHook;
+ }
+}
diff --git a/src/main/java/io/github/Alathra/AlathranCommands/Reloadable.java b/src/main/java/io/github/Alathra/AlathranCommands/Reloadable.java
new file mode 100644
index 0000000..aa8fdac
--- /dev/null
+++ b/src/main/java/io/github/Alathra/AlathranCommands/Reloadable.java
@@ -0,0 +1,21 @@
+package io.github.Alathra.AlathranCommands;
+
+/**
+ * Implemented in classes that should support being reloaded IE executing the methods during runtime after startup.
+ */
+public interface Reloadable {
+ /**
+ * On getInstance load.
+ */
+ void onLoad();
+
+ /**
+ * On getInstance enable.
+ */
+ void onEnable();
+
+ /**
+ * On getInstance disable.
+ */
+ void onDisable();
+}
diff --git a/src/main/java/io/github/Alathra/AlathranCommands/commands/CommandAlathra.java b/src/main/java/io/github/Alathra/AlathranCommands/commands/CommandAlathra.java
new file mode 100644
index 0000000..f7a18d5
--- /dev/null
+++ b/src/main/java/io/github/Alathra/AlathranCommands/commands/CommandAlathra.java
@@ -0,0 +1,42 @@
+package io.github.Alathra.AlathranCommands.commands;
+
+import io.github.Alathra.AlathranCommands.AlathranCommands;
+import dev.jorel.commandapi.CommandAPICommand;
+import dev.jorel.commandapi.CommandPermission;
+import com.github.milkdrinkers.colorparser.ColorParser;
+import io.github.Alathra.AlathranCommands.utils.ConfigUtil;
+import org.jetbrains.annotations.Nullable;
+
+public class CommandAlathra implements ConfigUtil {
+ final private String prefix = "[ACMDS]";
+ private final AlathranCommands alathraCommands;
+
+ CommandAlathra(AlathranCommands pl) {
+ alathraCommands = pl;
+ alathraCommands.saveDefaultConfig();
+
+ new CommandAPICommand("alathracommands")
+ .withSubcommands(
+ new CommandAPICommand("reload")
+ .withPermission(CommandPermission.fromString("alathrancommands.reload"))
+ .executes((sender, args) -> {
+ alathraCommands.saveDefaultConfig();
+ alathraCommands.reloadConfig();
+ sender.sendMessage(ColorParser.of(prefix + " config has been reloaded!").build());
+ })/*, // TODO Re-enable when implementation is finished
+ new CommandAPICommand("schedule")
+ .withPermission(CommandPermission.fromString("alathrancommands.schedule"))
+ .withSubcommands(
+ CommandStop.registerStopCommand(),
+ CommandStop.registerRestartCommand(),
+ CommandStop.registerCancelCommand()
+ )*/
+
+ )
+ .register();
+ }
+
+ public @Nullable String getMsg(String path) {
+ return alathraCommands.getConfig().getString(path);
+ }
+}
diff --git a/src/main/java/io/github/Alathra/AlathranCommands/commands/CommandHandler.java b/src/main/java/io/github/Alathra/AlathranCommands/commands/CommandHandler.java
new file mode 100644
index 0000000..e5e2cf6
--- /dev/null
+++ b/src/main/java/io/github/Alathra/AlathranCommands/commands/CommandHandler.java
@@ -0,0 +1,43 @@
+package io.github.Alathra.AlathranCommands.commands;
+
+import dev.jorel.commandapi.CommandAPI;
+import dev.jorel.commandapi.CommandAPIBukkitConfig;
+import io.github.Alathra.AlathranCommands.AlathranCommands;
+import io.github.Alathra.AlathranCommands.Reloadable;
+
+/**
+ * A class to handle registration of commands.
+ */
+public class CommandHandler implements Reloadable {
+ private final AlathranCommands instance;
+
+ public CommandHandler(AlathranCommands instance) {
+ this.instance = instance;
+ }
+
+ @Override
+ public void onLoad() {
+ CommandAPI.onLoad(new CommandAPIBukkitConfig(instance).shouldHookPaperReload(true).silentLogs(true));
+ }
+
+ @Override
+ public void onEnable() {
+ CommandAPI.onEnable();
+
+ // Register commands here
+ new CommandAlathra(instance);
+ new CommandTpa(instance);
+ new CommandTpaHere(instance);
+ new CommandTpCancel(instance);
+ new CommandTpaccept(instance);
+ new CommandTpaDeny(instance);
+ new CommandTpo(instance);
+ new CommandTpoHere(instance);
+ new CommandTpToggle(instance);
+ }
+
+ @Override
+ public void onDisable() {
+ CommandAPI.onDisable();
+ }
+}
diff --git a/src/main/java/io/github/Alathra/AlathranCommands/commands/CommandStop.java b/src/main/java/io/github/Alathra/AlathranCommands/commands/CommandStop.java
new file mode 100644
index 0000000..9d68d77
--- /dev/null
+++ b/src/main/java/io/github/Alathra/AlathranCommands/commands/CommandStop.java
@@ -0,0 +1,152 @@
+package io.github.Alathra.AlathranCommands.commands;
+
+import com.github.milkdrinkers.colorparser.ColorParser;
+import dev.jorel.commandapi.CommandAPIBukkit;
+import dev.jorel.commandapi.CommandAPICommand;
+import dev.jorel.commandapi.CommandPermission;
+import dev.jorel.commandapi.arguments.ArgumentSuggestions;
+import dev.jorel.commandapi.arguments.IntegerArgument;
+import io.github.Alathra.AlathranCommands.AlathranCommands;
+import org.bukkit.Bukkit;
+
+import java.time.Duration;
+import java.time.Instant;
+import java.util.List;
+
+public class CommandStop {
+ private enum ActionType {
+ STOP,
+ RESTART
+ }
+
+ public static CommandAPICommand registerStopCommand() {
+ return new CommandAPICommand("stop")
+ .withPermission(CommandPermission.fromString("alathrancommands.stop"))
+ .withArguments(
+ List.of(
+ new IntegerArgument("time")
+ .replaceSuggestions(
+ ArgumentSuggestions.strings(
+ List.of(
+ "0",
+ "5",
+ "10",
+ "15",
+ "60"
+ )
+ )
+ )
+ )
+ )
+ .executes((s, args) -> {
+ if (isActionScheduled)
+ throw CommandAPIBukkit.failWithAdventureComponent(ColorParser.of("").build());
+
+ final int minutes = (int) args.getOrDefault("time", 5);
+
+ actionType = ActionType.STOP;
+ acitonDuration = Duration.ofMinutes(minutes);
+ actionBeginTime = Instant.now();
+ actionEndTime = Instant.now().plus(acitonDuration);
+ scheduleStart();
+ });
+ }
+
+ public static CommandAPICommand registerRestartCommand() {
+ return new CommandAPICommand("restart")
+ .withPermission(CommandPermission.fromString("alathrancommands.restart"))
+ .withArguments(
+ List.of(
+ new IntegerArgument("time")
+ .replaceSuggestions(
+ ArgumentSuggestions.strings(
+ List.of(
+ "0",
+ "5",
+ "10",
+ "15",
+ "60"
+ )
+ )
+ )
+ )
+ )
+ .executes((s, args) -> {
+ if (isActionScheduled)
+ throw CommandAPIBukkit.failWithAdventureComponent(ColorParser.of("").build());
+
+ final int minutes = (int) args.getOrDefault("time", 5);
+
+ actionType = ActionType.RESTART;
+ acitonDuration = Duration.ofMinutes(minutes);
+ actionBeginTime = Instant.now();
+ actionEndTime = Instant.now().plus(acitonDuration);
+ scheduleStart();
+ });
+ }
+
+ public static CommandAPICommand registerCancelCommand() {
+ return new CommandAPICommand("cancel")
+ .withPermission(CommandPermission.fromString("alathrancommands.cancel"))
+ .executes((s, args) -> {
+ if (!isActionScheduled)
+ throw CommandAPIBukkit.failWithAdventureComponent(ColorParser.of("").build());
+
+ s.sendMessage(ColorParser.of("Cancelled").build());
+ scheduleStop();
+ });
+ }
+
+ private static boolean isActionScheduled = false;
+ private static ActionType actionType;
+ private static int actionTaskId = 0;
+ private static Duration acitonDuration = Duration.ZERO;
+ private static Instant actionBeginTime = Instant.EPOCH;
+ private static Instant actionEndTime = Instant.EPOCH;
+
+ private static void scheduleStop() {
+ Bukkit.getScheduler().cancelTask(actionTaskId);
+ actionType = ActionType.RESTART;
+ actionTaskId = 0;
+ acitonDuration = Duration.ZERO;
+ actionBeginTime = Instant.EPOCH;
+ actionEndTime = Instant.EPOCH;
+ isActionScheduled = false;
+ }
+
+ private static void scheduleStart() {
+ isActionScheduled = true;
+ actionTaskId = Bukkit.getScheduler().scheduleSyncRepeatingTask(AlathranCommands.getInstance(), () -> {
+ final Instant currentTime = Instant.now();
+ final Duration remainingTime = Duration.between(currentTime, actionBeginTime);
+ final boolean shouldStop = currentTime.isAfter(actionEndTime) && !Bukkit.isStopping();
+
+ if (shouldStop) {
+ Bukkit.broadcast(ColorParser.of("&a[&cScheduler&a] Stopping the server...").build());
+ Bukkit.shutdown();
+ return;
+ }
+
+ // Announce minutes remaining
+ if (remainingTime.toSecondsPart() == 0) {
+ switch (Math.toIntExact(remainingTime.toMinutes())) {
+ case 30, 10, 5, 4, 3, 2, 1 -> {
+ Bukkit.broadcast(ColorParser.of("&a[&cScheduler&a] Stopping the server in