Attempt to mimic clang-format

Signed-off-by: TheKodeToad <TheKodeToad@proton.me>
This commit is contained in:
TheKodeToad 2022-11-03 17:30:13 +00:00
parent 779bc2c63d
commit 5b9bfe8891
11 changed files with 529 additions and 157 deletions

View File

@ -0,0 +1,399 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<profiles version="22">
<profile kind="CodeFormatterProfile" name="Prism Launcher" version="22">
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_ellipsis" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_for_statment" value="common_lines"/>
<setting id="org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.comment.format_javadoc_comments" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.indentation.size" value="4"/>
<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_enum_constant_declaration" value="common_lines"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.align_with_spaces" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.continuation_indentation" value="2"/>
<setting id="org.eclipse.jdt.core.formatter.number_of_blank_lines_before_code_block" value="0"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_switch_case_expressions" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.blank_lines_after_package" value="1"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.comment.indent_root_tags" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.wrap_before_or_operator_multicatch" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.enabling_tag" value="@formatter:on"/>
<setting id="org.eclipse.jdt.core.formatter.comment.count_line_length_from_starting_position" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_record_components" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.wrap_before_multiplicative_operator" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_parameterized_type_references" value="0"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_logical_operator" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.keep_annotation_declaration_on_one_line" value="one_line_never"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_record_declaration" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_enum_constant" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_multiplicative_operator" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_abstract_method" value="1"/>
<setting id="org.eclipse.jdt.core.formatter.keep_enum_constant_declaration_on_one_line" value="one_line_never"/>
<setting id="org.eclipse.jdt.core.formatter.align_variable_declarations_on_columns" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_union_type_in_multicatch" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body" value="0"/>
<setting id="org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_catch_clause" value="common_lines"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_multiplicative_operator" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.keep_anonymous_type_declaration_on_one_line" value="one_line_never"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_switch_case_expressions" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.wrap_before_shift_operator" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_block" value="end_of_line"/>
<setting id="org.eclipse.jdt.core.formatter.number_of_blank_lines_at_end_of_code_block" value="0"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_bitwise_operator" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_type_parameters" value="0"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_compact_loops" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.keep_simple_for_body_on_same_line" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.wrap_before_switch_case_arrow_operator" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_unary_operator" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_annotation" value="common_lines"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_ellipsis" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_try_resources" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_annotations_on_enum_constant" value="49"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.text_block_indentation" value="0"/>
<setting id="org.eclipse.jdt.core.formatter.align_type_members_on_columns" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_assignment" value="0"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_module_statements" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.comment.align_tags_names_descriptions" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.keep_if_then_body_block_on_one_line" value="one_line_never"/>
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration" value="0"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.align_assignment_statements_on_columns" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_permitted_types" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_block_in_case" value="end_of_line"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_conditional_expression_chain" value="0"/>
<setting id="org.eclipse.jdt.core.formatter.comment.format_header" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_type_annotations" value="0"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.wrap_before_assertion_message_operator" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_method_declaration" value="0"/>
<setting id="org.eclipse.jdt.core.formatter.align_fields_grouping_blank_lines" value="2147483647"/>
<setting id="org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_bitwise_operator" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration" value="end_of_line"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_resources_in_try" value="80"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.comment.format_source_code" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_field" value="0"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_method" value="1"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_not_operator" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_type_annotation" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.comment.format_html" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_method_delcaration" value="common_lines"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_compact_if" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.indent_empty_lines" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_type_arguments" value="0"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_unary_operator" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation" value="0"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_annotations_on_package" value="49"/>
<setting id="org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_label" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_arrow_in_switch_case" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_record_header" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.wrap_before_bitwise_operator" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_try" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_lambda_arrow" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.comment.indent_tag_description" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_record_constructor" value="end_of_line"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_string_concatenation" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_multiple_fields" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_array_initializer" value="end_of_line"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_shift_operator" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_shift_operator" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.keep_simple_do_while_body_on_same_line" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_record_components" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_expressions_in_for_loop_header" value="0"/>
<setting id="org.eclipse.jdt.core.formatter.wrap_before_additive_operator" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.keep_simple_getter_setter_on_one_line" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_string_concatenation" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_lambda_arrow" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.join_lines_in_comments" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_record_declaration" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_relational_operator" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.blank_lines_between_import_groups" value="1"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_logical_operator" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_method_invocation" value="common_lines"/>
<setting id="org.eclipse.jdt.core.formatter.blank_lines_after_imports" value="1"/>
<setting id="org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_record_declaration" value="common_lines"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_switch_statement" value="common_lines"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_arrow_in_switch_default" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.disabling_tag" value="@formatter:off"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_enum_constants" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_imports" value="1"/>
<setting id="org.eclipse.jdt.core.formatter.number_of_blank_lines_at_end_of_method_body" value="0"/>
<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_if_while_statement" value="common_lines"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_arrow_in_switch_case" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations" value="1"/>
<setting id="org.eclipse.jdt.core.formatter.keep_switch_body_block_on_one_line" value="one_line_never"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.indent_statements_compare_to_block" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration" value="end_of_line"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_expressions_in_switch_case_with_arrow" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.comment.align_tags_descriptions_grouped" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.comment.line_length" value="80"/>
<setting id="org.eclipse.jdt.core.formatter.use_on_off_tags" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.keep_method_body_on_one_line" value="one_line_if_single_item"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.keep_loop_body_block_on_one_line" value="one_line_never"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_method_declaration" value="next_line"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.keep_type_declaration_on_one_line" value="one_line_never"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_additive_operator" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_record_constructor" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_relational_operator" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.keep_record_declaration_on_one_line" value="one_line_never"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration" value="next_line"/>
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_lambda_body" value="end_of_line"/>
<setting id="org.eclipse.jdt.core.formatter.compact_else_if" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_try" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_annotations_on_parameter" value="0"/>
<setting id="org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_relational_operator" value="0"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve" value="1"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_additive_operator" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_string_concatenation" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.comment.format_line_comments" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.align_selector_in_method_invocation_on_expression_first_line" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_record_declaration" value="end_of_line"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.keep_switch_case_with_arrow_on_one_line" value="one_line_never"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_expressions_in_switch_case_with_colon" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.number_of_blank_lines_after_code_block" value="0"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_conditional_expression" value="80"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_annotations_on_type" value="49"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_annotations_on_local_variable" value="49"/>
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration" value="end_of_line"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_arrow_in_switch_default" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.comment.insert_new_line_between_different_tags" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_additive_operator" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.join_wrapped_lines" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_annotations_on_field" value="49"/>
<setting id="org.eclipse.jdt.core.formatter.wrap_before_conditional_operator" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_shift_operator" value="0"/>
<setting id="org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_try_clause" value="common_lines"/>
<setting id="org.eclipse.jdt.core.formatter.keep_code_block_on_one_line" value="one_line_never"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_record_components" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.tabulation.size" value="4"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_bitwise_operator" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_try" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_try_resources" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer" value="2"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_record_declaration" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.wrap_before_assignment_operator" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_switch" value="end_of_line"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_switch_case_with_arrow" value="20"/>
<setting id="org.eclipse.jdt.core.formatter.keep_lambda_body_block_on_one_line" value="one_line_never"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_annotations_on_method" value="49"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.keep_record_constructor_on_one_line" value="one_line_never"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_record_declaration" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_assertion_message" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk" value="1"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_member_type" value="1"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_logical_operator" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_record_declaration" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_semicolon" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.wrap_before_relational_operator" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.comment.format_block_comments" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.blank_lines_after_last_class_body_declaration" value="0"/>
<setting id="org.eclipse.jdt.core.formatter.indent_statements_compare_to_body" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.keep_simple_while_body_on_same_line" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.wrap_before_logical_operator" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.blank_lines_between_statement_group_in_switch" value="0"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_lambda_declaration" value="common_lines"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_permitted_types" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.keep_enum_declaration_on_one_line" value="one_line_never"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_enum_constant" value="end_of_line"/>
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_type_declaration" value="end_of_line"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_multiplicative_operator" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_package" value="0"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.comment.indent_parameter_description" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_code_block" value="0"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.tabulation.char" value="space"/>
<setting id="org.eclipse.jdt.core.formatter.wrap_before_string_concatenation" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.lineSplit" value="120"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch" value="insert"/>
</profile>
</profiles>

View File

@ -68,7 +68,8 @@ import java.util.TreeMap;
/** /**
* WARNING: This class is reflectively accessed by legacy Forge versions. * WARNING: This class is reflectively accessed by legacy Forge versions.
* <p> * <p>
* Changing field and method declarations without further testing is not recommended. * Changing field and method declarations without further testing is not
* recommended.
*/ */
public final class Launcher extends Applet implements AppletStub { public final class Launcher extends Applet implements AppletStub {
@ -80,11 +81,10 @@ public final class Launcher extends Applet implements AppletStub {
private final URL documentBase; private final URL documentBase;
private boolean active = false; private boolean active = false;
public Launcher(Applet applet) { public Launcher(Applet applet) { this(applet, null); }
this(applet, null);
}
public Launcher(Applet applet, URL documentBase) { public Launcher(Applet applet, URL documentBase)
{
setLayout(new BorderLayout()); setLayout(new BorderLayout());
this.add(applet, "Center"); this.add(applet, "Center");
@ -108,7 +108,8 @@ public final class Launcher extends Applet implements AppletStub {
} }
} }
public void replace(Applet applet) { public void replace(Applet applet)
{
wrappedApplet = applet; wrappedApplet = applet;
applet.setStub(this); applet.setStub(this);
@ -127,17 +128,14 @@ public final class Launcher extends Applet implements AppletStub {
} }
@Override @Override
public boolean isActive() { public boolean isActive() { return active; }
return active;
}
@Override @Override
public URL getDocumentBase() { public URL getDocumentBase() { return documentBase; }
return documentBase;
}
@Override @Override
public URL getCodeBase() { public URL getCodeBase()
{
try { try {
// TODO: 2022-10-27 Can this be changed to https? // TODO: 2022-10-27 Can this be changed to https?
return new URL("http://www.minecraft.net/game/"); return new URL("http://www.minecraft.net/game/");
@ -147,7 +145,8 @@ public final class Launcher extends Applet implements AppletStub {
} }
@Override @Override
public String getParameter(String name) { public String getParameter(String name)
{
String param = params.get(name); String param = params.get(name);
if (param != null) if (param != null)
@ -162,62 +161,54 @@ public final class Launcher extends Applet implements AppletStub {
} }
@Override @Override
public void resize(int width, int height) { public void resize(int width, int height) { wrappedApplet.resize(width, height); }
wrappedApplet.resize(width, height);
}
@Override @Override
public void resize(Dimension size) { public void resize(Dimension size) { wrappedApplet.resize(size); }
wrappedApplet.resize(size);
}
@Override @Override
public void init() { public void init()
{
if (wrappedApplet != null) if (wrappedApplet != null)
wrappedApplet.init(); wrappedApplet.init();
} }
@Override @Override
public void start() { public void start()
{
wrappedApplet.start(); wrappedApplet.start();
active = true; active = true;
} }
@Override @Override
public void stop() { public void stop()
{
wrappedApplet.stop(); wrappedApplet.stop();
active = false; active = false;
} }
@Override @Override
public void destroy() { public void destroy() { wrappedApplet.destroy(); }
wrappedApplet.destroy();
}
@Override @Override
public void appletResize(int width, int height) { public void appletResize(int width, int height) { wrappedApplet.resize(width, height); }
wrappedApplet.resize(width, height);
}
@Override @Override
public void setVisible(boolean visible) { public void setVisible(boolean visible)
{
super.setVisible(visible); super.setVisible(visible);
wrappedApplet.setVisible(visible); wrappedApplet.setVisible(visible);
} }
@Override @Override
public void paint(Graphics graphics) { public void paint(Graphics graphics) {}
}
@Override @Override
public void update(Graphics graphics) { public void update(Graphics graphics) {}
}
public void setParameter(String name, String value) { public void setParameter(String name, String value) { params.put(name, value); }
params.put(name, value);
}
} }

View File

@ -71,10 +71,10 @@ import java.util.logging.Logger;
public final class EntryPoint { public final class EntryPoint {
private static final Logger LOGGER = Logger.getLogger("EntryPoint"); private static final Logger LOGGER = Logger.getLogger("EntryPoint");
private EntryPoint() { private EntryPoint() {}
}
public static void main(String[] args) { public static void main(String[] args)
{
ExitCode exitCode = listen(); ExitCode exitCode = listen();
if (exitCode != ExitCode.NORMAL) { if (exitCode != ExitCode.NORMAL) {
@ -85,11 +85,11 @@ public final class EntryPoint {
} }
} }
private static PreLaunchAction parseLine(String input, Parameters params) throws ParseException { private static PreLaunchAction parseLine(String input, Parameters params) throws ParseException
{
if (input.isEmpty()) // TODO: 2022-11-01 Should we just ignore this? if (input.isEmpty()) // TODO: 2022-11-01 Should we just ignore this?
throw new ParseException("Unexpected empty string! You should not pass empty newlines to stdin."); throw new ParseException("Unexpected empty string! You should not pass empty newlines to stdin.");
if ("launch".equalsIgnoreCase(input)) if ("launch".equalsIgnoreCase(input))
return PreLaunchAction.LAUNCH; return PreLaunchAction.LAUNCH;
else if ("abort".equalsIgnoreCase(input)) else if ("abort".equalsIgnoreCase(input))
@ -98,8 +98,8 @@ public final class EntryPoint {
String[] pair = StringUtils.splitStringPair(' ', input); String[] pair = StringUtils.splitStringPair(' ', input);
if (pair == null) if (pair == null)
throw new ParseException(String.format( throw new ParseException(String.format(
"Could not split input string '%s' by space. All input provided from stdin must be either 'launch', 'abort', or " + "Could not split input string '%s' by space. All input provided from stdin must be either 'launch', 'abort', or "
"in the format '[param name] [param]'.", + "in the format '[param name] [param]'.",
input)); input));
params.add(pair[0], pair[1]); params.add(pair[0], pair[1]);
@ -108,7 +108,8 @@ public final class EntryPoint {
} }
} }
private static ExitCode listen() { private static ExitCode listen()
{
Parameters parameters = new Parameters(); Parameters parameters = new Parameters();
PreLaunchAction preLaunchAction = PreLaunchAction.PROCEED; PreLaunchAction preLaunchAction = PreLaunchAction.PROCEED;
@ -157,23 +158,15 @@ public final class EntryPoint {
} }
private enum PreLaunchAction { private enum PreLaunchAction {
PROCEED, PROCEED, LAUNCH, ABORT
LAUNCH,
ABORT
} }
private enum ExitCode { private enum ExitCode {
NORMAL(0), NORMAL(0), ABORT(1), ERROR(2), ILLEGAL_ARGUMENT(3), REFLECTION_EXCEPTION(4);
ABORT(1),
ERROR(2),
ILLEGAL_ARGUMENT(3),
REFLECTION_EXCEPTION(4);
private final int numericalCode; private final int numericalCode;
ExitCode(int numericalCode) { ExitCode(int numericalCode) { this.numericalCode = numericalCode; }
this.numericalCode = numericalCode;
}
} }
} }

View File

@ -46,36 +46,31 @@ import org.prismlauncher.utils.Parameters;
public final class LauncherFactory { public final class LauncherFactory {
private LauncherFactory() { private LauncherFactory()
} {}
public static Launcher createLauncher(String launcherType, Parameters parameters) { public static Launcher createLauncher(String launcherType, Parameters parameters)
return createLauncher(LauncherType.valueOf(launcherType.toUpperCase()), parameters); { return createLauncher(LauncherType.valueOf(launcherType.toUpperCase()), parameters); }
}
public static Launcher createLauncher(LauncherType launcherType, Parameters parameters) { public static Launcher createLauncher(LauncherType launcherType, Parameters parameters)
{
LauncherProvider launcherProvider = launcherType.getLauncherProvider(); LauncherProvider launcherProvider = launcherType.getLauncherProvider();
return launcherProvider.provide(parameters); return launcherProvider.provide(parameters);
} }
public static Launcher createLauncher(Parameters parameters) { public static Launcher createLauncher(Parameters parameters)
return createLauncher(parameters.getString("launcher"), parameters); { return createLauncher(parameters.getString("launcher"), parameters); }
}
public enum LauncherType { public enum LauncherType {
STANDARD(StandardLauncher.getProvider()), STANDARD(StandardLauncher.getProvider()), LEGACY(LegacyLauncher.getProvider());
LEGACY(LegacyLauncher.getProvider());
private final LauncherProvider launcherProvider; private final LauncherProvider launcherProvider;
LauncherType(LauncherProvider launcherProvider) { LauncherType(LauncherProvider launcherProvider) { this.launcherProvider = launcherProvider; }
this.launcherProvider = launcherProvider;
} public LauncherProvider getLauncherProvider() { return launcherProvider; }
public LauncherProvider getLauncherProvider() {
return launcherProvider;
}
} }
} }

View File

@ -80,7 +80,8 @@ public abstract class AbstractLauncher implements Launcher {
protected final String mainClassName; protected final String mainClassName;
protected AbstractLauncher(Parameters params) { protected AbstractLauncher(Parameters params)
{
this.mcParams = Collections.unmodifiableList(params.getList("param", new ArrayList<String>())); this.mcParams = Collections.unmodifiableList(params.getList("param", new ArrayList<String>()));
this.mainClassName = params.getString("mainClass", "net.minecraft.client.Minecraft"); this.mainClassName = params.getString("mainClass", "net.minecraft.client.Minecraft");
@ -99,10 +100,12 @@ public abstract class AbstractLauncher implements Launcher {
this.width = Integer.parseInt(sizePair[0]); this.width = Integer.parseInt(sizePair[0]);
this.height = Integer.parseInt(sizePair[1]); this.height = Integer.parseInt(sizePair[1]);
} catch (NumberFormatException e) { } catch (NumberFormatException e) {
throw new ParseException(String.format("Could not parse window parameters from '%s'", windowParams), e); throw new ParseException(String.format("Could not parse window parameters from '%s'", windowParams),
e);
} }
} else { } else {
throw new ParseException(String.format("Invalid window size parameters '%s'. Format: [height]x[width]", windowParams)); throw new ParseException(
String.format("Invalid window size parameters '%s'. Format: [height]x[width]", windowParams));
} }
} else { } else {
this.width = DEFAULT_WINDOW_WIDTH; this.width = DEFAULT_WINDOW_WIDTH;

View File

@ -66,16 +66,13 @@ import java.util.List;
public final class StandardLauncher extends AbstractLauncher { public final class StandardLauncher extends AbstractLauncher {
public StandardLauncher(Parameters params) { public StandardLauncher(Parameters params) { super(params); }
super(params);
}
public static LauncherProvider getProvider() { public static LauncherProvider getProvider() { return new StandardLauncherProvider(); }
return new StandardLauncherProvider();
}
@Override @Override
public void launch() throws Throwable { public void launch() throws Throwable
{
// window size, title and state // window size, title and state
// FIXME: there is no good way to maximize the minecraft window from here. // FIXME: there is no good way to maximize the minecraft window from here.
@ -104,9 +101,7 @@ public final class StandardLauncher extends AbstractLauncher {
private static class StandardLauncherProvider implements LauncherProvider { private static class StandardLauncherProvider implements LauncherProvider {
@Override @Override
public Launcher provide(Parameters parameters) { public Launcher provide(Parameters parameters) { return new StandardLauncher(parameters); }
return new StandardLauncher(parameters);
}
} }
} }

View File

@ -82,7 +82,8 @@ public final class LegacyFrame extends Frame /* TODO consider JFrame */ {
private final Launcher launcher; private final Launcher launcher;
public LegacyFrame(String title, Applet applet) { public LegacyFrame(String title, Applet applet)
{
super(title); super(title);
launcher = new Launcher(applet); launcher = new Launcher(applet);
@ -98,35 +99,24 @@ public final class LegacyFrame extends Frame /* TODO consider JFrame */ {
addWindowListener(new ForceExitHandler()); addWindowListener(new ForceExitHandler());
} }
public void start ( public void start(String user, String session, int width, int height, boolean maximize, String serverAddress,
String user, String serverPort, boolean isDemo)
String session, {
int width, // Implements support for launching in to multiplayer on classic servers using a
int height, // mpticket
boolean maximize, // file generated by an external program and stored in the instance's root
String serverAddress, // folder.
String serverPort,
boolean isDemo
) {
// Implements support for launching in to multiplayer on classic servers using a mpticket
// file generated by an external program and stored in the instance's root folder.
Path mpticketFile = Path mpticketFile = Paths.get(System.getProperty("user.dir"), "..", "mpticket");
Paths.get(System.getProperty("user.dir"), "..", "mpticket");
Path mpticketFileCorrupt = Path mpticketFileCorrupt = Paths.get(System.getProperty("user.dir"), "..", "mpticket.corrupt");
Paths.get(System.getProperty("user.dir"), "..", "mpticket.corrupt");
if (Files.exists(mpticketFile)) { if (Files.exists(mpticketFile)) {
try { try {
List<String> lines = Files.readAllLines(mpticketFile, StandardCharsets.UTF_8); List<String> lines = Files.readAllLines(mpticketFile, StandardCharsets.UTF_8);
if (lines.size() < 3) { if (lines.size() < 3) {
Files.move( Files.move(mpticketFile, mpticketFileCorrupt, StandardCopyOption.REPLACE_EXISTING);
mpticketFile,
mpticketFileCorrupt,
StandardCopyOption.REPLACE_EXISTING
);
LOGGER.warning("Mpticket file is corrupted!"); LOGGER.warning("Mpticket file is corrupted!");
} else { } else {
@ -175,10 +165,12 @@ public final class LegacyFrame extends Frame /* TODO consider JFrame */ {
private final class ForceExitHandler extends WindowAdapter { private final class ForceExitHandler extends WindowAdapter {
@Override @Override
public void windowClosing(WindowEvent event) { public void windowClosing(WindowEvent event)
{
new Thread(new Runnable() { new Thread(new Runnable() {
@Override @Override
public void run() { public void run()
{
try { try {
Thread.sleep(30000L); Thread.sleep(30000L);
} catch (InterruptedException e) { } catch (InterruptedException e) {

View File

@ -83,7 +83,8 @@ public final class LegacyLauncher extends AbstractLauncher {
private final boolean usesApplet; private final boolean usesApplet;
private final String cwd; private final String cwd;
public LegacyLauncher(Parameters params) { public LegacyLauncher(Parameters params)
{
super(params); super(params);
user = params.getString("userName"); user = params.getString("userName");
@ -97,12 +98,11 @@ public final class LegacyLauncher extends AbstractLauncher {
cwd = System.getProperty("user.dir"); cwd = System.getProperty("user.dir");
} }
public static LauncherProvider getProvider() { public static LauncherProvider getProvider() { return new LegacyLauncherProvider(); }
return new LegacyLauncherProvider();
}
@Override @Override
public void launch() throws Throwable { public void launch() throws Throwable
{
Class<?> main = ClassLoader.getSystemClassLoader().loadClass(this.mainClassName); Class<?> main = ClassLoader.getSystemClassLoader().loadClass(this.mainClassName);
Field gameDirField = ReflectionUtils.getMinecraftGameDirField(main); Field gameDirField = ReflectionUtils.getMinecraftGameDirField(main);
@ -119,13 +119,8 @@ public final class LegacyLauncher extends AbstractLauncher {
try { try {
LegacyFrame window = new LegacyFrame(title, ReflectionUtils.createAppletClass(this.appletClass)); LegacyFrame window = new LegacyFrame(title, ReflectionUtils.createAppletClass(this.appletClass));
window.start( window.start(this.user, this.session, this.width, this.height, this.maximize, this.serverAddress,
this.user, this.serverPort, this.mcParams.contains("--demo"));
this.session,
this.width, this.height, this.maximize,
this.serverAddress, this.serverPort,
this.mcParams.contains("--demo")
);
} catch (Throwable e) { } catch (Throwable e) {
LOGGER.log(Level.SEVERE, "Running applet wrapper failed with exception; falling back to main class", e); LOGGER.log(Level.SEVERE, "Running applet wrapper failed with exception; falling back to main class", e);
} }
@ -137,9 +132,7 @@ public final class LegacyLauncher extends AbstractLauncher {
private static class LegacyLauncherProvider implements LauncherProvider { private static class LegacyLauncherProvider implements LauncherProvider {
@Override @Override
public Launcher provide(Parameters parameters) { public Launcher provide(Parameters parameters) { return new LegacyLauncher(parameters); }
return new LegacyLauncher(parameters);
}
} }
} }

View File

@ -68,7 +68,8 @@ public final class Parameters {
private final Map<String, List<String>> map = new HashMap<>(); private final Map<String, List<String>> map = new HashMap<>();
public void add(String key, String value) { public void add(String key, String value)
{
List<String> params = map.get(key); List<String> params = map.get(key);
if (params == null) { if (params == null) {
@ -80,7 +81,8 @@ public final class Parameters {
params.add(value); params.add(value);
} }
public List<String> getList(String key) throws ParameterNotFoundException { public List<String> getList(String key) throws ParameterNotFoundException
{
List<String> params = map.get(key); List<String> params = map.get(key);
if (params == null) if (params == null)
@ -89,7 +91,8 @@ public final class Parameters {
return params; return params;
} }
public List<String> getList(String key, List<String> def) { public List<String> getList(String key, List<String> def)
{
List<String> params = map.get(key); List<String> params = map.get(key);
if (params == null || params.isEmpty()) if (params == null || params.isEmpty())
@ -98,7 +101,8 @@ public final class Parameters {
return params; return params;
} }
public String getString(String key) throws ParameterNotFoundException { public String getString(String key) throws ParameterNotFoundException
{
List<String> list = getList(key); List<String> list = getList(key);
if (list.isEmpty()) if (list.isEmpty())
@ -107,7 +111,8 @@ public final class Parameters {
return list.get(0); return list.get(0);
} }
public String getString(String key, String def) { public String getString(String key, String def)
{
List<String> params = map.get(key); List<String> params = map.get(key);
if (params == null || params.isEmpty()) if (params == null || params.isEmpty())

View File

@ -38,7 +38,6 @@
package org.prismlauncher.utils; package org.prismlauncher.utils;
import java.applet.Applet; import java.applet.Applet;
import java.io.File; import java.io.File;
import java.lang.invoke.MethodHandle; import java.lang.invoke.MethodHandle;
@ -53,8 +52,7 @@ public final class ReflectionUtils {
private static final Logger LOGGER = Logger.getLogger("ReflectionUtils"); private static final Logger LOGGER = Logger.getLogger("ReflectionUtils");
private ReflectionUtils() { private ReflectionUtils() {}
}
/** /**
* Instantiate an applet class by name * Instantiate an applet class by name
@ -65,13 +63,16 @@ public final class ReflectionUtils {
* *
* @throws ClassNotFoundException if the provided class name cannot be found * @throws ClassNotFoundException if the provided class name cannot be found
* @throws NoSuchMethodException if the no-args constructor cannot be found * @throws NoSuchMethodException if the no-args constructor cannot be found
* @throws IllegalAccessException if the constructor cannot be accessed via method handles * @throws IllegalAccessException if the constructor cannot be accessed via
* method handles
* @throws Throwable any exceptions from the class's constructor * @throws Throwable any exceptions from the class's constructor
*/ */
public static Applet createAppletClass(String appletClassName) throws Throwable { public static Applet createAppletClass(String appletClassName) throws Throwable
{
Class<?> appletClass = ClassLoader.getSystemClassLoader().loadClass(appletClassName); Class<?> appletClass = ClassLoader.getSystemClassLoader().loadClass(appletClassName);
MethodHandle appletConstructor = MethodHandles.lookup().findConstructor(appletClass, MethodType.methodType(void.class)); MethodHandle appletConstructor = MethodHandles.lookup().findConstructor(appletClass,
MethodType.methodType(void.class));
return (Applet) appletConstructor.invoke(); return (Applet) appletConstructor.invoke();
} }
@ -82,7 +83,8 @@ public final class ReflectionUtils {
* *
* @return The found field. * @return The found field.
*/ */
public static Field getMinecraftGameDirField(Class<?> minecraftMainClass) { public static Field getMinecraftGameDirField(Class<?> minecraftMainClass)
{
LOGGER.fine("Resolving minecraft game directory field"); LOGGER.fine("Resolving minecraft game directory field");
// Field we're looking for is always // Field we're looking for is always
// private static File obfuscatedName = null; // private static File obfuscatedName = null;
@ -94,7 +96,6 @@ public final class ReflectionUtils {
int fieldModifiers = field.getModifiers(); int fieldModifiers = field.getModifiers();
// Must be static // Must be static
if (!Modifier.isStatic(fieldModifiers)) { if (!Modifier.isStatic(fieldModifiers)) {
LOGGER.log(Level.FINE, "Rejecting field {0} because it is not static", field.getName()); LOGGER.log(Level.FINE, "Rejecting field {0} because it is not static", field.getName());
@ -113,7 +114,8 @@ public final class ReflectionUtils {
continue; continue;
} }
LOGGER.log(Level.FINE, "Identified field {0} to match conditions for minecraft game directory field", field.getName()); LOGGER.log(Level.FINE, "Identified field {0} to match conditions for minecraft game directory field",
field.getName());
return field; return field;
} }
@ -124,8 +126,7 @@ public final class ReflectionUtils {
/** /**
* Resolve main entrypoint and returns method handle for it. * Resolve main entrypoint and returns method handle for it.
* <p> * <p>
* Resolves a method that matches the following signature * Resolves a method that matches the following signature <code>
* <code>
* public static void main(String[] args) { * public static void main(String[] args) {
* <p> * <p>
* } * }
@ -135,34 +136,39 @@ public final class ReflectionUtils {
* *
* @return The method handle for the resolved entrypoint * @return The method handle for the resolved entrypoint
* *
* @throws NoSuchMethodException If no method matching the correct signature can be found * @throws NoSuchMethodException If no method matching the correct signature
* can be found
* @throws IllegalAccessException If method handles cannot access the entrypoint * @throws IllegalAccessException If method handles cannot access the entrypoint
*/ */
public static MethodHandle findMainEntrypoint(Class<?> entrypointClass) throws NoSuchMethodException, IllegalAccessException { public static MethodHandle findMainEntrypoint(Class<?> entrypointClass)
return MethodHandles.lookup().findStatic(entrypointClass, "main", MethodType.methodType(void.class, String[].class)); throws NoSuchMethodException, IllegalAccessException
{
return MethodHandles.lookup().findStatic(entrypointClass, "main",
MethodType.methodType(void.class, String[].class));
} }
/** /**
* Resolve main entrypoint and returns method handle for it. * Resolve main entrypoint and returns method handle for it.
* <p> * <p>
* Resolves a method that matches the following signature * Resolves a method that matches the following signature <code>
* <code>
* public static void main(String[] args) { * public static void main(String[] args) {
* <p> * <p>
* } * }
* </code> * </code>
* *
* @param entrypointClassName The name of the entrypoint class to resolve the method from * @param entrypointClassName The name of the entrypoint class to resolve the
* method from
* *
* @return The method handle for the resolved entrypoint * @return The method handle for the resolved entrypoint
* *
* @throws ClassNotFoundException If a class cannot be found with the provided name * @throws ClassNotFoundException If a class cannot be found with the provided
* @throws NoSuchMethodException If no method matching the correct signature can be found * name
* @throws NoSuchMethodException If no method matching the correct signature
* can be found
* @throws IllegalAccessException If method handles cannot access the entrypoint * @throws IllegalAccessException If method handles cannot access the entrypoint
*/ */
public static MethodHandle findMainMethod(String entrypointClassName) public static MethodHandle findMainMethod(String entrypointClassName)
throws ClassNotFoundException, NoSuchMethodException, IllegalAccessException { throws ClassNotFoundException, NoSuchMethodException, IllegalAccessException
return findMainEntrypoint(ClassLoader.getSystemClassLoader().loadClass(entrypointClassName)); { return findMainEntrypoint(ClassLoader.getSystemClassLoader().loadClass(entrypointClassName)); }
}
} }

View File

@ -38,10 +38,10 @@ package org.prismlauncher.utils;
public final class StringUtils { public final class StringUtils {
private StringUtils() { private StringUtils() {}
}
public static String[] splitStringPair(char splitChar, String input) { public static String[] splitStringPair(char splitChar, String input)
{
int splitPoint = input.indexOf(splitChar); int splitPoint = input.indexOf(splitChar);
if (splitPoint == -1) if (splitPoint == -1)
return null; return null;