Skip to content

Commit

Permalink
Small update
Browse files Browse the repository at this point in the history
- Added new poopies to .editorconfig
- Updated StatusAPI
- Updated ResourceAPI
- Updated TranslationAPI
- Some other bug improvements
  • Loading branch information
p0loskun committed Feb 17, 2024
1 parent 0d72132 commit a70c934
Show file tree
Hide file tree
Showing 193 changed files with 6,004 additions and 3,898 deletions.
255 changes: 255 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,265 @@ root = true
charset = utf-8
indent_size = 4
indent_style = space
tab_width = 4
insert_final_newline = true
max_line_length = 120
ij_visual_guides = 80
ij_continuation_indent_size = 8

[*.java]
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 = true
ij_java_align_multiline_array_initializer_expression = true
ij_java_align_multiline_assignment = false
ij_java_align_multiline_binary_operation = false
ij_java_align_multiline_chained_methods = true
ij_java_align_multiline_deconstruction_list_components = true
ij_java_align_multiline_extends_list = false
ij_java_align_multiline_for = false
ij_java_align_multiline_method_parentheses = false
ij_java_align_multiline_parameters = 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 = true
ij_java_align_multiline_text_blocks = true
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 = on_every_item
ij_java_array_initializer_new_line_after_left_brace = true
ij_java_array_initializer_right_brace_on_new_line = true
ij_java_array_initializer_wrap = normal
ij_java_assert_statement_colon_on_next_line = false
ij_java_assert_statement_wrap = off
ij_java_assignment_wrap = off
ij_java_binary_operation_sign_on_next_line = 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_call_parameters_new_line_after_left_paren = true
ij_java_call_parameters_right_paren_on_new_line = true
ij_java_call_parameters_wrap = normal
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 = on_every_item
ij_java_do_not_indent_top_level_class_members = false
ij_java_do_not_wrap_after_single_annotation = false
ij_java_do_not_wrap_after_single_annotation_in_parameter = false
ij_java_do_while_brace_force = always
ij_java_doc_add_blank_line_after_description = true
ij_java_doc_add_blank_line_after_param_comments = false
ij_java_doc_add_blank_line_after_return = false
ij_java_doc_add_p_tag_on_empty_lines = true
ij_java_doc_align_exception_comments = true
ij_java_doc_align_param_comments = true
ij_java_doc_do_not_wrap_if_one_line = true
ij_java_doc_enable_formatting = true
ij_java_doc_enable_leading_asterisks = true
ij_java_doc_indent_on_continuation = true
ij_java_doc_keep_empty_lines = true
ij_java_doc_keep_empty_parameter_tag = true
ij_java_doc_keep_empty_return_tag = true
ij_java_doc_keep_empty_throws_tag = true
ij_java_doc_keep_invalid_tags = true
ij_java_doc_param_description_on_new_line = false
ij_java_doc_preserve_line_breaks = true
ij_java_doc_use_throws_not_exception_tag = true
ij_java_else_on_new_line = false
ij_java_enum_constants_wrap = on_every_item
ij_java_extends_keyword_wrap = off
ij_java_extends_list_wrap = off
ij_java_field_annotation_wrap = split_into_lines
ij_java_finally_on_new_line = false
ij_java_for_brace_force = always
ij_java_for_statement_new_line_after_left_paren = false
ij_java_for_statement_right_paren_on_new_line = false
ij_java_for_statement_wrap = off
ij_java_generate_final_locals = true
ij_java_generate_final_parameters = true
ij_java_if_brace_force = always
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 = false
ij_java_keep_first_column_comment = false
ij_java_keep_indents_on_empty_lines = false
ij_java_keep_multiple_expressions_in_one_line = false
ij_java_keep_simple_blocks_in_one_line = false
ij_java_keep_simple_classes_in_one_line = true
ij_java_keep_simple_lambdas_in_one_line = true
ij_java_keep_simple_methods_in_one_line = true
ij_java_label_indent_absolute = false
ij_java_label_indent_size = 0
ij_java_lambda_brace_style = end_of_line
ij_java_layout_static_imports_separately = true
ij_java_line_comment_add_space = false
ij_java_line_comment_add_space_on_reformat = false
ij_java_line_comment_at_first_column = true
ij_java_method_annotation_wrap = split_into_lines
ij_java_method_brace_style = end_of_line
ij_java_method_call_chain_wrap = on_every_item
ij_java_method_parameters_new_line_after_left_paren = true
ij_java_method_parameters_right_paren_on_new_line = true
ij_java_method_parameters_wrap = split_into_lines
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 = true
ij_java_new_line_after_lparen_in_deconstruction_pattern = true
ij_java_new_line_after_lparen_in_record_header = true
ij_java_parameter_annotation_wrap = off
ij_java_parentheses_expression_new_line_after_left_paren = false
ij_java_parentheses_expression_right_paren_on_new_line = false
ij_java_place_assignment_sign_on_next_line = false
ij_java_prefer_longer_names = true
ij_java_prefer_parameters_wrap = true
ij_java_record_components_wrap = on_every_item
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 = true
ij_java_resource_list_right_paren_on_new_line = true
ij_java_resource_list_wrap = split_into_lines
ij_java_rparen_on_new_line_in_annotation = true
ij_java_rparen_on_new_line_in_deconstruction_pattern = true
ij_java_rparen_on_new_line_in_record_header = true
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_ternary_operation_signs_on_next_line = true
ij_java_ternary_operation_wrap = split_into_lines
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_while_brace_force = always
ij_java_while_on_new_line = false
ij_java_wrap_comments = true
ij_java_wrap_first_method_in_call_chain = false
ij_java_wrap_long_lines = false

[*.yml]
indent_size = 2

[*.json]
ij_json_property_alignment = align_on_value
ij_json_array_wrapping = off
ij_json_object_wrapping = off
ij_json_keep_line_breaks = true
ij_json_spaces_within_braces = true
ij_json_spaces_within_brackets = true
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_wrap_long_lines = false
57 changes: 20 additions & 37 deletions src/main/java/com/minersstudios/mscore/MSCore.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package com.minersstudios.mscore;

import com.minersstudios.mscore.language.LanguageFile;
import com.minersstudios.mscore.language.LanguageRegistry;
import com.minersstudios.mscore.plugin.MSLogger;
import com.minersstudios.mscore.plugin.MSPlugin;
import com.minersstudios.mscore.utility.CoreProtectUtils;
Expand All @@ -13,7 +11,7 @@

import java.util.logging.Logger;

import static com.minersstudios.mscore.language.LanguageRegistry.Keys.ERROR_NO_PERMISSION;
import static com.minersstudios.mscore.locale.Translations.*;
import static com.minersstudios.mscore.utility.Font.Chars.RED_EXCLAMATION_MARK;

/**
Expand All @@ -27,30 +25,30 @@ public final class MSCore extends MSPlugin<MSCore> {
public static final String NAMESPACE = "mscore";

//<editor-fold desc="Config keys" defaultstate="collapsed">
private static final String CONNECTION_THROTTLE = "messages.kick.connection-throttle";
private static final String FLYING_PLAYER = "messages.kick.flying-player";
private static final String FLYING_VEHICLE = "messages.kick.flying-vehicle";
private static final String NO_PERMISSION = "messages.no-permission";
private static final String TOO_MANY_PACKETS = "packet-limiter.kick-message";
private static final String KEY_CONNECTION_THROTTLE = "messages.kick.connection-throttle";
private static final String KEY_FLYING_PLAYER = "messages.kick.flying-player";
private static final String KEY_FLYING_VEHICLE = "messages.kick.flying-vehicle";
private static final String KEY_NO_PERMISSION = "messages.no-permission";
private static final String KEY_TOO_MANY_PACKETS = "packet-limiter.kick-message";
//</editor-fold>

//<editor-fold desc="Config messages" defaultstate="collapsed">
private static final String MESSAGE_CONNECTION_THROTTLE = "<red><lang:" + LanguageRegistry.Keys.ERROR_CONNECTION_THROTTLE + '>';
private static final String MESSAGE_FLYING_PLAYER = "<red><lang:" + LanguageRegistry.Keys.ERROR_FLYING_PLAYER + '>';
private static final String MESSAGE_FLYING_VEHICLE = "<red><lang:" + LanguageRegistry.Keys.ERROR_FLYING_VEHICLE + '>';
private static final String MESSAGE_NO_PERMISSION = ' ' + RED_EXCLAMATION_MARK + " <red><lang:" + ERROR_NO_PERMISSION + '>';
private static final String MESSAGE_TOO_MANY_PACKETS = "<red><lang:" + LanguageRegistry.Keys.ERROR_TOO_MANY_PACKETS + '>';
//<editor-fold desc="Config values" defaultstate="collapsed">
private static final String VALUE_CONNECTION_THROTTLE = "<red><lang:" + ERROR_CONNECTION_THROTTLE.getKey() + '>';
private static final String VALUE_FLYING_PLAYER = "<red><lang:" + ERROR_FLYING_PLAYER.getKey() + '>';
private static final String VALUE_FLYING_VEHICLE = "<red><lang:" + ERROR_FLYING_VEHICLE.getKey() + '>';
private static final String VALUE_NO_PERMISSION = ' ' + RED_EXCLAMATION_MARK + " <red><lang:" + ERROR_NO_PERMISSION.getKey() + '>';
private static final String VALUE_TOO_MANY_PACKETS = "<red><lang:" + ERROR_TOO_MANY_PACKETS.getKey() + '>';
//</editor-fold>

@Override
public void load() {
PaperUtils
.editConfig(PaperUtils.ConfigType.GLOBAL, this.getServer())
.set(CONNECTION_THROTTLE, MESSAGE_CONNECTION_THROTTLE)
.set(FLYING_PLAYER, MESSAGE_FLYING_PLAYER)
.set(FLYING_VEHICLE, MESSAGE_FLYING_VEHICLE)
.set(NO_PERMISSION, MESSAGE_NO_PERMISSION)
.set(TOO_MANY_PACKETS, MESSAGE_TOO_MANY_PACKETS)
.set(KEY_CONNECTION_THROTTLE, VALUE_CONNECTION_THROTTLE)
.set(KEY_FLYING_PLAYER, VALUE_FLYING_PLAYER)
.set(KEY_FLYING_VEHICLE, VALUE_FLYING_VEHICLE)
.set(KEY_NO_PERMISSION, VALUE_NO_PERMISSION)
.set(KEY_TOO_MANY_PACKETS, VALUE_TOO_MANY_PACKETS)
.save();
}

Expand All @@ -59,20 +57,11 @@ public void enable() {
singleton = this;

this.setupCoreProtect();

if (!LanguageFile.isLoaded()) {
LanguageFile.loadLanguage(
globalConfig().getLanguageFolderLink(),
globalConfig().getLanguageCode()
);
}
}

@Override
public void disable() {
singleton = null;

LanguageFile.unloadLanguage();
}

/**
Expand All @@ -87,18 +76,12 @@ public void setupCoreProtect() {

if (coreProtect == null) {
MSLogger.warning("CoreProtectAPI is not running yet");

return;
}

if (coreProtect.isEnabled()) {
} else if (coreProtect.isEnabled()) {
CoreProtectUtils.set(coreProtect.getAPI());
MSLogger.fine("CoreProtect connected");

return;
} else {
MSLogger.warning("CoreProtect is not Enabled, actions logging will not be available");
}

MSLogger.warning("CoreProtect is not Enabled, actions logging will not be available");
} catch (final IllegalStateException e) {
MSLogger.warning("CoreProtect is already connected");
} catch (final NoClassDefFoundError e) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.minersstudios.mscore.command.impl;

import com.minersstudios.mscore.language.LanguageRegistry;
import com.minersstudios.mscore.locale.Translations;
import com.minersstudios.mscore.plugin.MSLogger;
import com.minersstudios.mscore.plugin.MSPlugin;
import org.bukkit.command.CommandSender;
Expand All @@ -16,7 +16,7 @@ public static boolean runCommand(final @NotNull CommandSender sender) {
MSPlugin.globalConfig().reload();
MSLogger.fine(
sender,
LanguageRegistry.Components.COMMAND_MSCORE_RELOAD_CONFIG_SUCCESS
Translations.COMMAND_MSCORE_RELOAD_CONFIG_SUCCESS.asTranslatable()
.arguments(text(System.currentTimeMillis() - time))
);

Expand Down
Loading

0 comments on commit a70c934

Please sign in to comment.