Fixed stuff that I edited remotely.
This commit is contained in:
parent
06811735e9
commit
72798b8b7c
5 changed files with 801 additions and 500 deletions
|
@ -1,11 +1,295 @@
|
|||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
|
||||
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
|
||||
org.eclipse.jdt.core.compiler.compliance=1.7
|
||||
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
|
||||
org.eclipse.jdt.core.compiler.debug.localVariable=generate
|
||||
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
|
||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.source=1.7
|
||||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
|
||||
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
|
||||
org.eclipse.jdt.core.compiler.compliance=1.7
|
||||
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
|
||||
org.eclipse.jdt.core.compiler.debug.localVariable=generate
|
||||
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
|
||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.source=1.7
|
||||
org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
|
||||
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16
|
||||
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0
|
||||
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16
|
||||
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16
|
||||
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16
|
||||
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16
|
||||
org.eclipse.jdt.core.formatter.alignment_for_assignment=0
|
||||
org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16
|
||||
org.eclipse.jdt.core.formatter.alignment_for_compact_if=16
|
||||
org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80
|
||||
org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0
|
||||
org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16
|
||||
org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0
|
||||
org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16
|
||||
org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16
|
||||
org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16
|
||||
org.eclipse.jdt.core.formatter.alignment_for_resources_in_try=80
|
||||
org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16
|
||||
org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16
|
||||
org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16
|
||||
org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16
|
||||
org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16
|
||||
org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16
|
||||
org.eclipse.jdt.core.formatter.alignment_for_union_type_in_multicatch=16
|
||||
org.eclipse.jdt.core.formatter.blank_lines_after_imports=1
|
||||
org.eclipse.jdt.core.formatter.blank_lines_after_package=1
|
||||
org.eclipse.jdt.core.formatter.blank_lines_before_field=0
|
||||
org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0
|
||||
org.eclipse.jdt.core.formatter.blank_lines_before_imports=1
|
||||
org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1
|
||||
org.eclipse.jdt.core.formatter.blank_lines_before_method=1
|
||||
org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1
|
||||
org.eclipse.jdt.core.formatter.blank_lines_before_package=0
|
||||
org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1
|
||||
org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1
|
||||
org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=next_line
|
||||
org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=next_line
|
||||
org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line
|
||||
org.eclipse.jdt.core.formatter.brace_position_for_block=next_line
|
||||
org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=next_line
|
||||
org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=next_line
|
||||
org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=next_line
|
||||
org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=next_line
|
||||
org.eclipse.jdt.core.formatter.brace_position_for_lambda_body=end_of_line
|
||||
org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=next_line
|
||||
org.eclipse.jdt.core.formatter.brace_position_for_switch=next_line
|
||||
org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=next_line
|
||||
org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false
|
||||
org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false
|
||||
org.eclipse.jdt.core.formatter.comment.format_block_comments=true
|
||||
org.eclipse.jdt.core.formatter.comment.format_header=false
|
||||
org.eclipse.jdt.core.formatter.comment.format_html=true
|
||||
org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true
|
||||
org.eclipse.jdt.core.formatter.comment.format_line_comments=true
|
||||
org.eclipse.jdt.core.formatter.comment.format_source_code=true
|
||||
org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true
|
||||
org.eclipse.jdt.core.formatter.comment.indent_root_tags=true
|
||||
org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert
|
||||
org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=insert
|
||||
org.eclipse.jdt.core.formatter.comment.line_length=80
|
||||
org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries=true
|
||||
org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true
|
||||
org.eclipse.jdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments=false
|
||||
org.eclipse.jdt.core.formatter.compact_else_if=true
|
||||
org.eclipse.jdt.core.formatter.continuation_indentation=2
|
||||
org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2
|
||||
org.eclipse.jdt.core.formatter.disabling_tag=@formatter\:off
|
||||
org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on
|
||||
org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false
|
||||
org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=true
|
||||
org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true
|
||||
org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true
|
||||
org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true
|
||||
org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true
|
||||
org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true
|
||||
org.eclipse.jdt.core.formatter.indent_empty_lines=false
|
||||
org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true
|
||||
org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true
|
||||
org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true
|
||||
org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=false
|
||||
org.eclipse.jdt.core.formatter.indentation.size=4
|
||||
org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field=insert
|
||||
org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert
|
||||
org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method=insert
|
||||
org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package=insert
|
||||
org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type=insert
|
||||
org.eclipse.jdt.core.formatter.insert_new_line_after_label=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_new_line_after_type_annotation=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert
|
||||
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=insert
|
||||
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert
|
||||
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert
|
||||
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert
|
||||
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert
|
||||
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_after_lambda_arrow=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_try=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_try_resources=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_try=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_lambda_arrow=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_try=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_try_resources=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert
|
||||
org.eclipse.jdt.core.formatter.join_lines_in_comments=true
|
||||
org.eclipse.jdt.core.formatter.join_wrapped_lines=true
|
||||
org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false
|
||||
org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false
|
||||
org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false
|
||||
org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false
|
||||
org.eclipse.jdt.core.formatter.lineSplit=80
|
||||
org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false
|
||||
org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=false
|
||||
org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0
|
||||
org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1
|
||||
org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=true
|
||||
org.eclipse.jdt.core.formatter.tabulation.char=tab
|
||||
org.eclipse.jdt.core.formatter.tabulation.size=4
|
||||
org.eclipse.jdt.core.formatter.use_on_off_tags=false
|
||||
org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false
|
||||
org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true
|
||||
org.eclipse.jdt.core.formatter.wrap_before_or_operator_multicatch=true
|
||||
org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
name: VirtualComputer
|
||||
main: sznp.virtualcomputer.PluginMain
|
||||
version: 1.0
|
||||
commands:
|
||||
computer:
|
||||
usage: Use /computer start|stop
|
||||
alias: c
|
||||
softdepend: [Movecraft]
|
||||
name: VirtualComputer
|
||||
main: sznp.virtualcomputer.PluginMain
|
||||
version: 1.1
|
||||
commands:
|
||||
computer:
|
||||
usage: Use /computer start|stop
|
||||
alias: c
|
||||
softdepend: [Movecraft]
|
||||
|
|
|
@ -1,193 +1,201 @@
|
|||
package sznp.virtualcomputer;
|
||||
|
||||
import net.countercraft.movecraft.craft.Craft;
|
||||
import net.countercraft.movecraft.craft.CraftManager;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class Commands implements CommandExecutor
|
||||
{
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command cmd, String label,
|
||||
String[] args)
|
||||
{
|
||||
switch (cmd.getName().toLowerCase())
|
||||
{
|
||||
case "computer":
|
||||
{
|
||||
if (args.length == 0)
|
||||
return false;
|
||||
switch (args[0].toLowerCase())
|
||||
{
|
||||
case "start":
|
||||
PluginMain.getPlugin(PluginMain.class).Start(sender);
|
||||
break;
|
||||
case "stop":
|
||||
PluginMain.getPlugin(PluginMain.class).Stop(sender);
|
||||
break;
|
||||
case "debug":
|
||||
World w = Bukkit.getWorlds().get(0);
|
||||
Craft[] crafts = CraftManager.getInstance().getCraftsInWorld(w);
|
||||
sender.sendMessage("World: " + w);
|
||||
sender.sendMessage("Crafts: " + crafts);
|
||||
sender.sendMessage("Craft type: "
|
||||
+ crafts[0].getType().getCraftName());
|
||||
sender.sendMessage("DX: " + crafts[0].getLastDX());
|
||||
sender.sendMessage("DY: " + crafts[0].getLastDY());
|
||||
sender.sendMessage("DZ: " + crafts[0].getLastDZ());
|
||||
sender.sendMessage("MouseSpeed: " + PluginMain.MouseSpeed);
|
||||
sender.sendMessage("Block: "
|
||||
+ Bukkit.getWorlds()
|
||||
.get(0)
|
||||
.getBlockAt(crafts[0].getMinX(),
|
||||
crafts[0].getMinY() - 1,
|
||||
crafts[0].getMinZ()).getType()); //Block: AIR
|
||||
break;
|
||||
case "powerbutton":
|
||||
PluginMain.getPlugin(PluginMain.class).PowerButton(sender);
|
||||
break;
|
||||
case "reset":
|
||||
PluginMain.getPlugin(PluginMain.class).Reset(sender);
|
||||
break;
|
||||
case "fix":
|
||||
PluginMain.getPlugin(PluginMain.class).FixScreen(sender);
|
||||
break;
|
||||
case "key":
|
||||
if (args.length < 2)
|
||||
{
|
||||
sender.sendMessage("§cUsage: /computer key <key> [down/up|interval]");
|
||||
return true;
|
||||
}
|
||||
if (args.length < 3)
|
||||
PluginMain.getPlugin(PluginMain.class).PressKey(sender,
|
||||
args[1], "");
|
||||
else
|
||||
PluginMain.getPlugin(PluginMain.class).PressKey(sender,
|
||||
args[1], args[2]);
|
||||
break;
|
||||
case "mouse":
|
||||
boolean showusage = true;
|
||||
if (args.length < 6)
|
||||
{
|
||||
//Command overloading, because I can :P
|
||||
if (args.length > 4) // 4<x<6
|
||||
{
|
||||
PluginMain.getPlugin(PluginMain.class).UpdateMouse(
|
||||
sender, Integer.parseInt(args[1]),
|
||||
Integer.parseInt(args[2]),
|
||||
Integer.parseInt(args[3]),
|
||||
Integer.parseInt(args[4]), "", false);
|
||||
showusage = false;
|
||||
} else
|
||||
{
|
||||
if (args.length == 3)
|
||||
{
|
||||
PluginMain.getPlugin(PluginMain.class).UpdateMouse(
|
||||
sender, 0, 0, 0, 0,
|
||||
args[1], (args[2].equals("down")));
|
||||
showusage = false;
|
||||
} else if (args.length == 2)
|
||||
{
|
||||
PluginMain.getPlugin(PluginMain.class).UpdateMouse(
|
||||
sender, 0, 0, 0, 0,
|
||||
args[1]);
|
||||
showusage = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (showusage)
|
||||
{
|
||||
sender.sendMessage("§cUsage: /computer mouse <relx> <rely> <relz> <relw>");
|
||||
sender.sendMessage("§cOr: /computer mouse <button> [up/down]");
|
||||
}
|
||||
break;
|
||||
case "mspeed":
|
||||
if (args.length < 2)
|
||||
{
|
||||
sender.sendMessage("§cUsage: /computer mspeed <speed>");
|
||||
return true;
|
||||
}
|
||||
PluginMain.MouseSpeed = Integer.parseInt(args[1]);
|
||||
sender.sendMessage("Mouse speed set to " + args[1]);
|
||||
break;
|
||||
case "input":
|
||||
{
|
||||
if (!(sender instanceof Player))
|
||||
{
|
||||
sender.sendMessage("§cError: Only players can use this command.");
|
||||
return true;
|
||||
}
|
||||
if (args.length < 2)
|
||||
{
|
||||
sender.sendMessage("§cUsage: /computer input <key|mouse>");
|
||||
return true;
|
||||
}
|
||||
if (args[1].equalsIgnoreCase("key"))
|
||||
{
|
||||
Bukkit.getServer()
|
||||
.dispatchCommand(
|
||||
Bukkit.getConsoleSender(),
|
||||
"tellraw "
|
||||
+ sender.getName()
|
||||
+ " [\"\",{\"text\":\" [0]\",\"color\":\"green\",\"clickEvent\":{\"action\":\"run_command\",\"value\":\"/computer key D0\"}},{\"text\":\" [1]\",\"color\":\"green\",\"clickEvent\":{\"action\":\"run_command\",\"value\":\"/computer key D1\"}},{\"text\":\" [2]\",\"color\":\"green\",\"clickEvent\":{\"action\":\"run_command\",\"value\":\"/computer key D2\"}},{\"text\":\" [3]\",\"color\":\"green\",\"clickEvent\":{\"action\":\"run_command\",\"value\":\"/computer key D3\"}},{\"text\":\" [4]\",\"color\":\"green\",\"clickEvent\":{\"action\":\"run_command\",\"value\":\"/computer key D4\"}},{\"text\":\" [5]\",\"color\":\"green\",\"clickEvent\":{\"action\":\"run_command\",\"value\":\"/computer key D5\"}},{\"text\":\" [6]\",\"color\":\"green\",\"clickEvent\":{\"action\":\"run_command\",\"value\":\"/computer key D6\"}},{\"text\":\" [7]\",\"color\":\"green\",\"clickEvent\":{\"action\":\"run_command\",\"value\":\"/computer key D7\"}},{\"text\":\" [8]\",\"color\":\"green\",\"clickEvent\":{\"action\":\"run_command\",\"value\":\"/computer key D8\"}},{\"text\":\" [9]\",\"color\":\"green\",\"clickEvent\":{\"action\":\"run_command\",\"value\":\"/computer key D9\"}}]");
|
||||
Bukkit.getServer()
|
||||
.dispatchCommand(
|
||||
Bukkit.getConsoleSender(),
|
||||
"tellraw "
|
||||
+ sender.getName()
|
||||
+ " [\"\",{\"text\":\" [Tab]\",\"color\":\"green\",\"clickEvent\":{\"action\":\"run_command\",\"value\":\"/computer key Tab\"}},{\"text\":\" [Q]\",\"color\":\"green\",\"clickEvent\":{\"action\":\"run_command\",\"value\":\"/computer key Q\"}},{\"text\":\" [W]\",\"color\":\"green\",\"clickEvent\":{\"action\":\"run_command\",\"value\":\"/computer key W\"}},{\"text\":\" [E]\",\"color\":\"green\",\"clickEvent\":{\"action\":\"run_command\",\"value\":\"/computer key E\"}},{\"text\":\" [R]\",\"color\":\"green\",\"clickEvent\":{\"action\":\"run_command\",\"value\":\"/computer key R\"}},{\"text\":\" [T]\",\"color\":\"green\",\"clickEvent\":{\"action\":\"run_command\",\"value\":\"/computer key T\"}},{\"text\":\" [Y]\",\"color\":\"green\",\"clickEvent\":{\"action\":\"run_command\",\"value\":\"/computer key Y\"}},{\"text\":\" [U]\",\"color\":\"green\",\"clickEvent\":{\"action\":\"run_command\",\"value\":\"/computer key U\"}},{\"text\":\" [I]\",\"color\":\"green\",\"clickEvent\":{\"action\":\"run_command\",\"value\":\"/computer key I\"}},{\"text\":\" [O]\",\"color\":\"green\",\"clickEvent\":{\"action\":\"run_command\",\"value\":\"/computer key O\"}},{\"text\":\" [P]\",\"color\":\"green\",\"clickEvent\":{\"action\":\"run_command\",\"value\":\"/computer key P\"}}]");
|
||||
Bukkit.getServer()
|
||||
.dispatchCommand(
|
||||
Bukkit.getConsoleSender(),
|
||||
"tellraw "
|
||||
+ sender.getName()
|
||||
+ " [\"\",{\"text\":\" [CapsLock]\",\"color\":\"green\",\"clickEvent\":{\"action\":\"run_command\",\"value\":\"/computer key CapsLock\"}},{\"text\":\" [A]\",\"color\":\"green\",\"clickEvent\":{\"action\":\"run_command\",\"value\":\"/computer key A\"}},{\"text\":\" [S]\",\"color\":\"green\",\"clickEvent\":{\"action\":\"run_command\",\"value\":\"/computer key S\"}},{\"text\":\" [D]\",\"color\":\"green\",\"clickEvent\":{\"action\":\"run_command\",\"value\":\"/computer key D\"}},{\"text\":\" [F]\",\"color\":\"green\",\"clickEvent\":{\"action\":\"run_command\",\"value\":\"/computer key F\"}},{\"text\":\" [G]\",\"color\":\"green\",\"clickEvent\":{\"action\":\"run_command\",\"value\":\"/computer key G\"}},{\"text\":\" [H]\",\"color\":\"green\",\"clickEvent\":{\"action\":\"run_command\",\"value\":\"/computer key H\"}},{\"text\":\" [J]\",\"color\":\"green\",\"clickEvent\":{\"action\":\"run_command\",\"value\":\"/computer key J\"}},{\"text\":\" [K]\",\"color\":\"green\",\"clickEvent\":{\"action\":\"run_command\",\"value\":\"/computer key K\"}},{\"text\":\" [L]\",\"color\":\"green\",\"clickEvent\":{\"action\":\"run_command\",\"value\":\"/computer key L\"}},{\"text\":\" [Return]\",\"color\":\"green\",\"clickEvent\":{\"action\":\"run_command\",\"value\":\"/computer key Return\"}}]");
|
||||
Bukkit.getServer()
|
||||
.dispatchCommand(
|
||||
Bukkit.getConsoleSender(),
|
||||
"tellraw "
|
||||
+ sender.getName()
|
||||
+ " [\"\",{\"text\":\" [Z]\",\"color\":\"green\",\"clickEvent\":{\"action\":\"run_command\",\"value\":\"/computer key Z\"}},{\"text\":\" [X]\",\"color\":\"green\",\"clickEvent\":{\"action\":\"run_command\",\"value\":\"/computer key X\"}},{\"text\":\" [C]\",\"color\":\"green\",\"clickEvent\":{\"action\":\"run_command\",\"value\":\"/computer key C\"}},{\"text\":\" [V]\",\"color\":\"green\",\"clickEvent\":{\"action\":\"run_command\",\"value\":\"/computer key V\"}},{\"text\":\" [B]\",\"color\":\"green\",\"clickEvent\":{\"action\":\"run_command\",\"value\":\"/computer key B\"}},{\"text\":\" [N]\",\"color\":\"green\",\"clickEvent\":{\"action\":\"run_command\",\"value\":\"/computer key N\"}},{\"text\":\" [M]\",\"color\":\"green\",\"clickEvent\":{\"action\":\"run_command\",\"value\":\"/computer key M\"}}]");
|
||||
Bukkit.getServer()
|
||||
.dispatchCommand(
|
||||
Bukkit.getConsoleSender(),
|
||||
"tellraw "
|
||||
+ sender.getName()
|
||||
+ " [\"\",{\"text\":\" [Ctrl]\",\"color\":\"green\",\"clickEvent\":{\"action\":\"run_command\",\"value\":\"/computer key ControlLeft\"}},{\"text\":\" [Alt]\",\"color\":\"green\",\"clickEvent\":{\"action\":\"run_command\",\"value\":\"/computer key AltLeft\"}},{\"text\":\" [Space]\",\"color\":\"green\",\"clickEvent\":{\"action\":\"run_command\",\"value\":\"/computer key Space\"}},{\"text\":\" [AltGr]\",\"color\":\"green\",\"clickEvent\":{\"action\":\"run_command\",\"value\":\"/computer key AltRight\"}},{\"text\":\" [Ctrl]\",\"color\":\"green\",\"clickEvent\":{\"action\":\"run_command\",\"value\":\"/computer key ControlRight\"}}]");
|
||||
} else if (args[1].equalsIgnoreCase("mouse"))
|
||||
{
|
||||
if (!MouseLockerPlayerListener.LockedPlayers.contains(e.getPlayer()))
|
||||
{
|
||||
MouseLockerPlayerListener.LockedPlayers.add(e.getPlayer());
|
||||
sender.sendMessage("§aMouse locked.");
|
||||
}
|
||||
else
|
||||
{
|
||||
MouseLockedPlayerListener.LockedPlayers.remove(e.getPlayer());
|
||||
sender.sendMessage("§bMouse unlocked.");
|
||||
}
|
||||
} else if (args[1].equalsIgnoreCase("mspeed"))
|
||||
{
|
||||
if(args.length<3)
|
||||
{
|
||||
sender.sendMessage("§cUsage: /computer input mspeed <integer>");
|
||||
return;
|
||||
}
|
||||
MouseLockerPlayerListener.LockedSpeed=Integer.parseInt(args[2]);
|
||||
sender.sendMessage("§aMouse speed set to "+MouseLockerPlayerListener.LockedSpeed);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
package sznp.virtualcomputer;
|
||||
|
||||
import net.countercraft.movecraft.craft.Craft;
|
||||
import net.countercraft.movecraft.craft.CraftManager;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class Commands implements CommandExecutor
|
||||
{
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command cmd, String label,
|
||||
String[] args)
|
||||
{
|
||||
switch (cmd.getName().toLowerCase())
|
||||
{
|
||||
case "computer":
|
||||
{
|
||||
if (args.length == 0)
|
||||
return false;
|
||||
switch (args[0].toLowerCase())
|
||||
{
|
||||
case "start":
|
||||
PluginMain.getPlugin(PluginMain.class).Start(sender);
|
||||
break;
|
||||
case "stop":
|
||||
PluginMain.getPlugin(PluginMain.class).Stop(sender);
|
||||
break;
|
||||
case "debug":
|
||||
World w = Bukkit.getWorlds().get(0);
|
||||
Craft[] crafts = CraftManager.getInstance().getCraftsInWorld(w);
|
||||
sender.sendMessage("World: " + w);
|
||||
sender.sendMessage("Crafts: " + crafts);
|
||||
sender.sendMessage("Craft type: "
|
||||
+ crafts[0].getType().getCraftName());
|
||||
sender.sendMessage("DX: " + crafts[0].getLastDX());
|
||||
sender.sendMessage("DY: " + crafts[0].getLastDY());
|
||||
sender.sendMessage("DZ: " + crafts[0].getLastDZ());
|
||||
sender.sendMessage("MouseSpeed: " + PluginMain.MouseSpeed);
|
||||
sender.sendMessage("Block: "
|
||||
+ Bukkit.getWorlds()
|
||||
.get(0)
|
||||
.getBlockAt(crafts[0].getMinX(),
|
||||
crafts[0].getMinY() - 1,
|
||||
crafts[0].getMinZ()).getType()); // Block:
|
||||
// AIR
|
||||
break;
|
||||
case "powerbutton":
|
||||
PluginMain.getPlugin(PluginMain.class).PowerButton(sender);
|
||||
break;
|
||||
case "reset":
|
||||
PluginMain.getPlugin(PluginMain.class).Reset(sender);
|
||||
break;
|
||||
case "fix":
|
||||
PluginMain.getPlugin(PluginMain.class).FixScreen(sender);
|
||||
break;
|
||||
case "key":
|
||||
if (args.length < 2)
|
||||
{
|
||||
sender.sendMessage("§cUsage: /computer key <key> [down/up|interval]");
|
||||
return true;
|
||||
}
|
||||
if (args.length < 3)
|
||||
PluginMain.getPlugin(PluginMain.class).PressKey(sender,
|
||||
args[1], "");
|
||||
else
|
||||
PluginMain.getPlugin(PluginMain.class).PressKey(sender,
|
||||
args[1], args[2]);
|
||||
break;
|
||||
case "mouse":
|
||||
boolean showusage = true;
|
||||
if (args.length < 6)
|
||||
{
|
||||
// Command overloading, because I can :P
|
||||
if (args.length > 4) // 4<x<6
|
||||
{
|
||||
PluginMain.getPlugin(PluginMain.class).UpdateMouse(
|
||||
sender, Integer.parseInt(args[1]),
|
||||
Integer.parseInt(args[2]),
|
||||
Integer.parseInt(args[3]),
|
||||
Integer.parseInt(args[4]), "", false);
|
||||
showusage = false;
|
||||
} else
|
||||
{
|
||||
if (args.length == 3)
|
||||
{
|
||||
PluginMain.getPlugin(PluginMain.class).UpdateMouse(
|
||||
sender, 0, 0, 0, 0, args[1],
|
||||
(args[2].equals("down")));
|
||||
showusage = false;
|
||||
} else if (args.length == 2)
|
||||
{
|
||||
PluginMain.getPlugin(PluginMain.class).UpdateMouse(
|
||||
sender, 0, 0, 0, 0, args[1]);
|
||||
showusage = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (showusage)
|
||||
{
|
||||
sender.sendMessage("§cUsage: /computer mouse <relx> <rely> <relz> <relw>");
|
||||
sender.sendMessage("§cOr: /computer mouse <button> [up/down]");
|
||||
}
|
||||
break;
|
||||
case "mspeed":
|
||||
if (args.length < 2)
|
||||
{
|
||||
sender.sendMessage("§cUsage: /computer mspeed <speed>");
|
||||
return true;
|
||||
}
|
||||
PluginMain.MouseSpeed = Integer.parseInt(args[1]);
|
||||
sender.sendMessage("Mouse speed set to " + args[1]);
|
||||
break;
|
||||
case "input":
|
||||
{
|
||||
if (!(sender instanceof Player))
|
||||
{
|
||||
sender.sendMessage("§cError: Only players can use this command.");
|
||||
return true;
|
||||
}
|
||||
if (args.length < 2)
|
||||
{
|
||||
sender.sendMessage("§cUsage: /computer input <key|mouse>");
|
||||
return true;
|
||||
}
|
||||
if (args[1].equalsIgnoreCase("key"))
|
||||
{
|
||||
Bukkit.getServer()
|
||||
.dispatchCommand(
|
||||
Bukkit.getConsoleSender(),
|
||||
"tellraw "
|
||||
+ sender.getName()
|
||||
+ " [\"\",{\"text\":\" [0]\",\"color\":\"green\",\"clickEvent\":{\"action\":\"run_command\",\"value\":\"/computer key D0\"}},{\"text\":\" [1]\",\"color\":\"green\",\"clickEvent\":{\"action\":\"run_command\",\"value\":\"/computer key D1\"}},{\"text\":\" [2]\",\"color\":\"green\",\"clickEvent\":{\"action\":\"run_command\",\"value\":\"/computer key D2\"}},{\"text\":\" [3]\",\"color\":\"green\",\"clickEvent\":{\"action\":\"run_command\",\"value\":\"/computer key D3\"}},{\"text\":\" [4]\",\"color\":\"green\",\"clickEvent\":{\"action\":\"run_command\",\"value\":\"/computer key D4\"}},{\"text\":\" [5]\",\"color\":\"green\",\"clickEvent\":{\"action\":\"run_command\",\"value\":\"/computer key D5\"}},{\"text\":\" [6]\",\"color\":\"green\",\"clickEvent\":{\"action\":\"run_command\",\"value\":\"/computer key D6\"}},{\"text\":\" [7]\",\"color\":\"green\",\"clickEvent\":{\"action\":\"run_command\",\"value\":\"/computer key D7\"}},{\"text\":\" [8]\",\"color\":\"green\",\"clickEvent\":{\"action\":\"run_command\",\"value\":\"/computer key D8\"}},{\"text\":\" [9]\",\"color\":\"green\",\"clickEvent\":{\"action\":\"run_command\",\"value\":\"/computer key D9\"}}]");
|
||||
Bukkit.getServer()
|
||||
.dispatchCommand(
|
||||
Bukkit.getConsoleSender(),
|
||||
"tellraw "
|
||||
+ sender.getName()
|
||||
+ " [\"\",{\"text\":\" [Tab]\",\"color\":\"green\",\"clickEvent\":{\"action\":\"run_command\",\"value\":\"/computer key Tab\"}},{\"text\":\" [Q]\",\"color\":\"green\",\"clickEvent\":{\"action\":\"run_command\",\"value\":\"/computer key Q\"}},{\"text\":\" [W]\",\"color\":\"green\",\"clickEvent\":{\"action\":\"run_command\",\"value\":\"/computer key W\"}},{\"text\":\" [E]\",\"color\":\"green\",\"clickEvent\":{\"action\":\"run_command\",\"value\":\"/computer key E\"}},{\"text\":\" [R]\",\"color\":\"green\",\"clickEvent\":{\"action\":\"run_command\",\"value\":\"/computer key R\"}},{\"text\":\" [T]\",\"color\":\"green\",\"clickEvent\":{\"action\":\"run_command\",\"value\":\"/computer key T\"}},{\"text\":\" [Y]\",\"color\":\"green\",\"clickEvent\":{\"action\":\"run_command\",\"value\":\"/computer key Y\"}},{\"text\":\" [U]\",\"color\":\"green\",\"clickEvent\":{\"action\":\"run_command\",\"value\":\"/computer key U\"}},{\"text\":\" [I]\",\"color\":\"green\",\"clickEvent\":{\"action\":\"run_command\",\"value\":\"/computer key I\"}},{\"text\":\" [O]\",\"color\":\"green\",\"clickEvent\":{\"action\":\"run_command\",\"value\":\"/computer key O\"}},{\"text\":\" [P]\",\"color\":\"green\",\"clickEvent\":{\"action\":\"run_command\",\"value\":\"/computer key P\"}}]");
|
||||
Bukkit.getServer()
|
||||
.dispatchCommand(
|
||||
Bukkit.getConsoleSender(),
|
||||
"tellraw "
|
||||
+ sender.getName()
|
||||
+ " [\"\",{\"text\":\" [CapsLock]\",\"color\":\"green\",\"clickEvent\":{\"action\":\"run_command\",\"value\":\"/computer key CapsLock\"}},{\"text\":\" [A]\",\"color\":\"green\",\"clickEvent\":{\"action\":\"run_command\",\"value\":\"/computer key A\"}},{\"text\":\" [S]\",\"color\":\"green\",\"clickEvent\":{\"action\":\"run_command\",\"value\":\"/computer key S\"}},{\"text\":\" [D]\",\"color\":\"green\",\"clickEvent\":{\"action\":\"run_command\",\"value\":\"/computer key D\"}},{\"text\":\" [F]\",\"color\":\"green\",\"clickEvent\":{\"action\":\"run_command\",\"value\":\"/computer key F\"}},{\"text\":\" [G]\",\"color\":\"green\",\"clickEvent\":{\"action\":\"run_command\",\"value\":\"/computer key G\"}},{\"text\":\" [H]\",\"color\":\"green\",\"clickEvent\":{\"action\":\"run_command\",\"value\":\"/computer key H\"}},{\"text\":\" [J]\",\"color\":\"green\",\"clickEvent\":{\"action\":\"run_command\",\"value\":\"/computer key J\"}},{\"text\":\" [K]\",\"color\":\"green\",\"clickEvent\":{\"action\":\"run_command\",\"value\":\"/computer key K\"}},{\"text\":\" [L]\",\"color\":\"green\",\"clickEvent\":{\"action\":\"run_command\",\"value\":\"/computer key L\"}},{\"text\":\" [Return]\",\"color\":\"green\",\"clickEvent\":{\"action\":\"run_command\",\"value\":\"/computer key Return\"}}]");
|
||||
Bukkit.getServer()
|
||||
.dispatchCommand(
|
||||
Bukkit.getConsoleSender(),
|
||||
"tellraw "
|
||||
+ sender.getName()
|
||||
+ " [\"\",{\"text\":\" [Z]\",\"color\":\"green\",\"clickEvent\":{\"action\":\"run_command\",\"value\":\"/computer key Z\"}},{\"text\":\" [X]\",\"color\":\"green\",\"clickEvent\":{\"action\":\"run_command\",\"value\":\"/computer key X\"}},{\"text\":\" [C]\",\"color\":\"green\",\"clickEvent\":{\"action\":\"run_command\",\"value\":\"/computer key C\"}},{\"text\":\" [V]\",\"color\":\"green\",\"clickEvent\":{\"action\":\"run_command\",\"value\":\"/computer key V\"}},{\"text\":\" [B]\",\"color\":\"green\",\"clickEvent\":{\"action\":\"run_command\",\"value\":\"/computer key B\"}},{\"text\":\" [N]\",\"color\":\"green\",\"clickEvent\":{\"action\":\"run_command\",\"value\":\"/computer key N\"}},{\"text\":\" [M]\",\"color\":\"green\",\"clickEvent\":{\"action\":\"run_command\",\"value\":\"/computer key M\"}}]");
|
||||
Bukkit.getServer()
|
||||
.dispatchCommand(
|
||||
Bukkit.getConsoleSender(),
|
||||
"tellraw "
|
||||
+ sender.getName()
|
||||
+ " [\"\",{\"text\":\" [Ctrl]\",\"color\":\"green\",\"clickEvent\":{\"action\":\"run_command\",\"value\":\"/computer key ControlLeft\"}},{\"text\":\" [Alt]\",\"color\":\"green\",\"clickEvent\":{\"action\":\"run_command\",\"value\":\"/computer key AltLeft\"}},{\"text\":\" [Space]\",\"color\":\"green\",\"clickEvent\":{\"action\":\"run_command\",\"value\":\"/computer key Space\"}},{\"text\":\" [AltGr]\",\"color\":\"green\",\"clickEvent\":{\"action\":\"run_command\",\"value\":\"/computer key AltRight\"}},{\"text\":\" [Ctrl]\",\"color\":\"green\",\"clickEvent\":{\"action\":\"run_command\",\"value\":\"/computer key ControlRight\"}}]");
|
||||
} else if (args[1].equalsIgnoreCase("mouse"))
|
||||
{
|
||||
if (!(sender instanceof Player))
|
||||
{
|
||||
sender.sendMessage("§cOnly ingame players can use this command.");
|
||||
return true;
|
||||
}
|
||||
if (!MouseLockerPlayerListener.LockedPlayers
|
||||
.contains(sender))
|
||||
{
|
||||
MouseLockerPlayerListener.LockedPlayers
|
||||
.add((Player) sender);
|
||||
sender.sendMessage("§aMouse locked.");
|
||||
} else
|
||||
{
|
||||
MouseLockerPlayerListener.LockedPlayers.remove(sender);
|
||||
sender.sendMessage("§bMouse unlocked.");
|
||||
}
|
||||
} else if (args[1].equalsIgnoreCase("mspeed"))
|
||||
{
|
||||
if (args.length < 3)
|
||||
{
|
||||
sender.sendMessage("§cUsage: /computer input mspeed <integer>");
|
||||
return true;
|
||||
}
|
||||
MouseLockerPlayerListener.LockedSpeed = Float
|
||||
.parseFloat(args[2]);
|
||||
sender.sendMessage("§aMouse speed set to "
|
||||
+ MouseLockerPlayerListener.LockedSpeed);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,27 +1,34 @@
|
|||
package sznp.virtualcomputer;
|
||||
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.player.PlayerMoveEvent;
|
||||
|
||||
public class MouseLockerPlayerListener implements Listener
|
||||
{
|
||||
public static List<Player> LockedPlayers = new List<Player>();
|
||||
public static int LockedSpeed=1;
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerMoveMouse(PlayerMoveEvent e)
|
||||
{
|
||||
if (!LockedPlayers.contains(e.getPlayer())
|
||||
return;
|
||||
float yaw1 = e.getFrom().getYaw();
|
||||
float pitch1 = e.getFrom().getPitch();
|
||||
float yaw2 = e.getTo().getYaw();
|
||||
float pitch2 = e.getTo().getPitch();
|
||||
|
||||
PluginMain.Instance.UpdateMouse(null, (int) ((yaw2 - yaw1)*LockedSpeed),
|
||||
(int) ((pitch2 - pitch1)*LockedSpeed), 0, 0, "");
|
||||
|
||||
e.setTo(e.getFrom());
|
||||
}
|
||||
}
|
||||
package sznp.virtualcomputer;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.player.PlayerMoveEvent;
|
||||
|
||||
public class MouseLockerPlayerListener implements Listener
|
||||
{
|
||||
public static List<Player> LockedPlayers = new ArrayList<Player>();
|
||||
public static float LockedSpeed = 1;
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerMoveMouse(PlayerMoveEvent e)
|
||||
{
|
||||
if (!LockedPlayers.contains(e.getPlayer()))
|
||||
return;
|
||||
float yaw1 = e.getFrom().getYaw();
|
||||
float pitch1 = e.getFrom().getPitch();
|
||||
float yaw2 = e.getTo().getYaw();
|
||||
float pitch2 = e.getTo().getPitch();
|
||||
if (yaw2 - yaw1 == 0 || pitch2 - pitch1 == 0)
|
||||
return;
|
||||
|
||||
PluginMain.Instance.UpdateMouse(null,
|
||||
(int) ((yaw2 - yaw1) * LockedSpeed),
|
||||
(int) ((pitch2 - pitch1) * LockedSpeed), 0, 0, "");
|
||||
|
||||
e.setTo(e.getFrom());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,261 +1,263 @@
|
|||
package sznp.virtualcomputer;
|
||||
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.awt.image.DataBufferInt;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.lang.reflect.Method;
|
||||
import java.net.URL;
|
||||
import java.net.URLClassLoader;
|
||||
import java.util.HashMap;
|
||||
|
||||
import net.countercraft.movecraft.craft.Craft;
|
||||
import net.countercraft.movecraft.craft.CraftManager;
|
||||
import net.sf.jni4net.Bridge;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.command.ConsoleCommandSender;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import virtualcomputersender.Computer;
|
||||
|
||||
import com.mcplugindev.slipswhitley.sketchmap.map.RelativeLocation;
|
||||
import com.mcplugindev.slipswhitley.sketchmap.map.SketchMap;
|
||||
|
||||
public class PluginMain extends JavaPlugin
|
||||
{
|
||||
private Computer computer;
|
||||
private SketchMap smap;
|
||||
|
||||
public static PluginMain Instance;
|
||||
|
||||
// Fired when plugin is first enabled
|
||||
@Override
|
||||
public void onEnable()
|
||||
{
|
||||
Instance = this;
|
||||
try
|
||||
{
|
||||
ConsoleCommandSender ccs = getServer().getConsoleSender();
|
||||
this.getCommand("computer").setExecutor(new Commands());
|
||||
ccs.sendMessage("§bExtracting necessary libraries...");
|
||||
final File[] libs = new File[] { // added to class path
|
||||
new File(getDataFolder(), "jni4net.j-0.8.8.0.jar"),
|
||||
new File(getDataFolder(), "VirtualComputerSender.j4n.jar") };
|
||||
- final File[] libs2 = new File[] {
|
||||
new File(getDataFolder(), "jni4net.j-0.8.8.0.jar"),
|
||||
- new File(getDataFolder(), "jni4net.n-0.8.8.0.dll"),
|
||||
- new File(getDataFolder(), "jni4net.n.w64.v40-0.8.8.0.dll") };
|
||||
|
||||
- for (final File lib : libs2)
|
||||
- {
|
||||
- if (!lib.exists())
|
||||
- {
|
||||
- JarUtils.extractFromJar(lib.getName(),
|
||||
- lib.getAbsolutePath());
|
||||
- }
|
||||
- }
|
||||
for (final File lib : libs)
|
||||
{
|
||||
if (!lib.exists())
|
||||
{
|
||||
getLogger().warning(
|
||||
"Failed to load plugin! Could not find lib: "
|
||||
+ lib.getName());
|
||||
Bukkit.getServer().getPluginManager().disablePlugin(this);
|
||||
return;
|
||||
}
|
||||
addClassPath(JarUtils.getJarUrl(lib));
|
||||
}
|
||||
ccs.sendMessage("§bInitializing bridge...");
|
||||
// Bridge.setVerbose(true);
|
||||
// Bridge.setDebug(true);
|
||||
Bridge.init(new File(getDataFolder(),
|
||||
"jni4net.n.w64.v40-0.8.8.0.dll").getAbsoluteFile());
|
||||
Bridge.LoadAndRegisterAssemblyFrom(new File(getDataFolder(),
|
||||
"VirtualComputerSender.j4n.dll"));
|
||||
ccs.sendMessage("§bInititalizing VirtualBox interface...");
|
||||
computer = new Computer();
|
||||
ccs.sendMessage("§bLoading SketchMap...");
|
||||
img = new BufferedImage(640, 480, BufferedImage.TYPE_INT_ARGB);
|
||||
HashMap<Short, RelativeLocation> map = new HashMap<>();
|
||||
for (int i = 0; i < 5; i++)
|
||||
for (int j = 0; j < 4; j++)
|
||||
map.put((short) (i * 4 + j), new RelativeLocation(i, j));
|
||||
smap = new SketchMap(img, "Screen", 5, 4, false, map);
|
||||
ccs.sendMessage("§bLoaded!");
|
||||
DoStart();
|
||||
} catch (final Exception e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
// Fired when plugin is disabled
|
||||
@Override
|
||||
public void onDisable()
|
||||
{
|
||||
ConsoleCommandSender ccs = getServer().getConsoleSender();
|
||||
ccs.sendMessage("§aHuh.");
|
||||
saveConfig();
|
||||
}
|
||||
|
||||
private volatile BufferedImage img;
|
||||
private volatile int taskid = -1;
|
||||
|
||||
public void Start(CommandSender sender)
|
||||
{
|
||||
sender.sendMessage("§eStarting computer...");
|
||||
computer.Start();
|
||||
sender.sendMessage("§eComputer started.");
|
||||
DoStart();
|
||||
}
|
||||
|
||||
public static int MouseSpeed = 1;
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
private void DoStart()
|
||||
{
|
||||
if (taskid == -1)
|
||||
taskid = this.getServer().getScheduler()
|
||||
.scheduleAsyncRepeatingTask(this, new Runnable()
|
||||
{
|
||||
public void run()
|
||||
{
|
||||
final int[] a = ((DataBufferInt) smap.image
|
||||
.getRaster().getDataBuffer()).getData();
|
||||
final int[] data = computer.GetScreenPixelColors();
|
||||
System.arraycopy(data, 0, a, 0, data.length);
|
||||
}
|
||||
}, 1, 10);
|
||||
if (getServer().getPluginManager().isPluginEnabled("Movecraft")) {
|
||||
this.getServer().getScheduler()
|
||||
.scheduleSyncRepeatingTask(this, new Runnable()
|
||||
{
|
||||
public void run()
|
||||
{
|
||||
Craft[] crafts = CraftManager.getInstance()
|
||||
.getCraftsInWorld(Bukkit.getWorlds().get(0));
|
||||
if (crafts == null)
|
||||
return;
|
||||
for (Craft c : crafts)
|
||||
{
|
||||
if (c.getType().getCraftName()
|
||||
.equalsIgnoreCase("mouse"))
|
||||
{
|
||||
int dx = c.getLastDX();
|
||||
//int dy = c.getLastDY();
|
||||
int dz = c.getLastDZ();
|
||||
if (Bukkit
|
||||
.getWorlds()
|
||||
.get(0)
|
||||
.getBlockAt(c.getMinX(),
|
||||
c.getMinY() - 1, c.getMinZ())
|
||||
.getType() != Material.AIR
|
||||
&& (dx != 0 || dz != 0))
|
||||
UpdateMouse(null, dx * MouseSpeed, dz
|
||||
* MouseSpeed, 0, 0, "");
|
||||
c.setLastDX(0);
|
||||
c.setLastDZ(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}, 1, 1);
|
||||
}
|
||||
|
||||
getServer().getPluginManager().registerEvents(
|
||||
new MouseLockerPlayerListener(), this);
|
||||
}
|
||||
|
||||
public void Stop(CommandSender sender)
|
||||
{
|
||||
sender.sendMessage("§eStopping computer...");
|
||||
computer.PowerOff();
|
||||
sender.sendMessage("§eComputer stopped.");
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public void PowerButton(CommandSender sender)
|
||||
{
|
||||
sender.sendMessage("§eStarting/stoppping computer...");
|
||||
final CommandSender s = sender;
|
||||
getServer().getScheduler().scheduleAsyncDelayedTask(this,
|
||||
new Runnable()
|
||||
{
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
if (computer.PowerButton())
|
||||
{
|
||||
DoStart();
|
||||
s.sendMessage("§eComputer started.");
|
||||
} else
|
||||
s.sendMessage("§ePowerbutton pressed.");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void Reset(CommandSender sender)
|
||||
{
|
||||
sender.sendMessage("§eResetting computer...");
|
||||
computer.Reset();
|
||||
sender.sendMessage("§eComputer reset.");
|
||||
}
|
||||
|
||||
public void FixScreen(CommandSender sender)
|
||||
{
|
||||
sender.sendMessage("§eFixing screen...");
|
||||
computer.FixScreen();
|
||||
sender.sendMessage("§eScreen fixed.");
|
||||
}
|
||||
|
||||
public void PressKey(CommandSender sender, String key,
|
||||
String stateorduration)
|
||||
{
|
||||
if (stateorduration.length() == 0)
|
||||
computer.PressKey(key, (short) 0);
|
||||
else if (stateorduration.equalsIgnoreCase("down"))
|
||||
computer.PressKey(key, (short) -1);
|
||||
else if (stateorduration.equalsIgnoreCase("up"))
|
||||
computer.PressKey(key, (short) -2);
|
||||
else
|
||||
computer.PressKey(key, Short.parseShort(stateorduration));
|
||||
}
|
||||
|
||||
public void UpdateMouse(CommandSender sender, int x, int y, int z, int w,
|
||||
String mbs, boolean down)
|
||||
{
|
||||
if (down)
|
||||
computer.UpdateMouse(x, y, z, w, mbs);
|
||||
else
|
||||
computer.UpdateMouse(x, y, z, w, "");
|
||||
}
|
||||
|
||||
public void UpdateMouse(CommandSender sender, int x, int y, int z, int w,
|
||||
String mbs)
|
||||
{
|
||||
UpdateMouse(sender, x, y, z, w, mbs, true);
|
||||
UpdateMouse(sender, x, y, z, w, mbs, false);
|
||||
}
|
||||
|
||||
private void addClassPath(final URL url) throws IOException
|
||||
{
|
||||
final URLClassLoader sysloader = (URLClassLoader) ClassLoader
|
||||
.getSystemClassLoader();
|
||||
final Class<URLClassLoader> sysclass = URLClassLoader.class;
|
||||
try
|
||||
{
|
||||
final Method method = sysclass.getDeclaredMethod("addURL",
|
||||
new Class[] { URL.class });
|
||||
method.setAccessible(true);
|
||||
method.invoke(sysloader, new Object[] { url });
|
||||
} catch (final Throwable t)
|
||||
{
|
||||
t.printStackTrace();
|
||||
throw new IOException("Error adding " + url
|
||||
+ " to system classloader");
|
||||
}
|
||||
}
|
||||
}
|
||||
package sznp.virtualcomputer;
|
||||
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.awt.image.DataBufferInt;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.lang.reflect.Method;
|
||||
import java.net.URL;
|
||||
import java.net.URLClassLoader;
|
||||
import java.util.HashMap;
|
||||
|
||||
import net.countercraft.movecraft.craft.Craft;
|
||||
import net.countercraft.movecraft.craft.CraftManager;
|
||||
import net.sf.jni4net.Bridge;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.command.ConsoleCommandSender;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import virtualcomputersender.Computer;
|
||||
|
||||
import com.mcplugindev.slipswhitley.sketchmap.map.RelativeLocation;
|
||||
import com.mcplugindev.slipswhitley.sketchmap.map.SketchMap;
|
||||
|
||||
public class PluginMain extends JavaPlugin
|
||||
{
|
||||
private Computer computer;
|
||||
private SketchMap smap;
|
||||
|
||||
public static PluginMain Instance;
|
||||
|
||||
// Fired when plugin is first enabled
|
||||
@Override
|
||||
public void onEnable()
|
||||
{
|
||||
Instance = this;
|
||||
try
|
||||
{
|
||||
ConsoleCommandSender ccs = getServer().getConsoleSender();
|
||||
this.getCommand("computer").setExecutor(new Commands());
|
||||
ccs.sendMessage("§bExtracting necessary libraries...");
|
||||
final File[] libs = new File[] { // added to class path
|
||||
new File(getDataFolder(), "jni4net.j-0.8.8.0.jar"),
|
||||
new File(getDataFolder(), "VirtualComputerSender.j4n.jar") };
|
||||
final File[] libs2 = new File[] {
|
||||
new File(getDataFolder(), "jni4net.j-0.8.8.0.jar"),
|
||||
new File(getDataFolder(), "jni4net.n-0.8.8.0.dll"),
|
||||
new File(getDataFolder(), "jni4net.n.w64.v40-0.8.8.0.dll") };
|
||||
|
||||
for (final File lib : libs2)
|
||||
{
|
||||
if (!lib.exists())
|
||||
{
|
||||
JarUtils.extractFromJar(lib.getName(),
|
||||
lib.getAbsolutePath());
|
||||
}
|
||||
}
|
||||
for (final File lib : libs)
|
||||
{
|
||||
if (!lib.exists())
|
||||
{
|
||||
getLogger().warning(
|
||||
"Failed to load plugin! Could not find lib: "
|
||||
+ lib.getName());
|
||||
Bukkit.getServer().getPluginManager().disablePlugin(this);
|
||||
return;
|
||||
}
|
||||
addClassPath(JarUtils.getJarUrl(lib));
|
||||
}
|
||||
ccs.sendMessage("§bInitializing bridge...");
|
||||
// Bridge.setVerbose(true);
|
||||
// Bridge.setDebug(true);
|
||||
Bridge.init(new File(getDataFolder(),
|
||||
"jni4net.n.w64.v40-0.8.8.0.dll").getAbsoluteFile());
|
||||
Bridge.LoadAndRegisterAssemblyFrom(new File(getDataFolder(),
|
||||
"VirtualComputerSender.j4n.dll"));
|
||||
ccs.sendMessage("§bInititalizing VirtualBox interface...");
|
||||
computer = new Computer();
|
||||
ccs.sendMessage("§bLoading SketchMap...");
|
||||
img = new BufferedImage(640, 480, BufferedImage.TYPE_INT_ARGB);
|
||||
HashMap<Short, RelativeLocation> map = new HashMap<>();
|
||||
for (int i = 0; i < 5; i++)
|
||||
for (int j = 0; j < 4; j++)
|
||||
map.put((short) (i * 4 + j), new RelativeLocation(i, j));
|
||||
smap = new SketchMap(img, "Screen", 5, 4, false, map);
|
||||
ccs.sendMessage("§bLoaded!");
|
||||
DoStart();
|
||||
} catch (final Exception e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
// Fired when plugin is disabled
|
||||
@Override
|
||||
public void onDisable()
|
||||
{
|
||||
ConsoleCommandSender ccs = getServer().getConsoleSender();
|
||||
ccs.sendMessage("§aHuh.");
|
||||
saveConfig();
|
||||
}
|
||||
|
||||
private volatile BufferedImage img;
|
||||
private volatile int taskid = -1;
|
||||
|
||||
public void Start(CommandSender sender)
|
||||
{
|
||||
sender.sendMessage("§eStarting computer...");
|
||||
computer.Start();
|
||||
sender.sendMessage("§eComputer started.");
|
||||
DoStart();
|
||||
}
|
||||
|
||||
public static int MouseSpeed = 1;
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
private void DoStart()
|
||||
{
|
||||
if (taskid == -1)
|
||||
taskid = this.getServer().getScheduler()
|
||||
.scheduleAsyncRepeatingTask(this, new Runnable()
|
||||
{
|
||||
public void run()
|
||||
{
|
||||
final int[] a = ((DataBufferInt) smap.image
|
||||
.getRaster().getDataBuffer()).getData();
|
||||
final int[] data = computer.GetScreenPixelColors();
|
||||
System.arraycopy(data, 0, a, 0, data.length);
|
||||
}
|
||||
}, 1, 10);
|
||||
if (getServer().getPluginManager().isPluginEnabled("Movecraft"))
|
||||
{
|
||||
this.getServer().getScheduler()
|
||||
.scheduleSyncRepeatingTask(this, new Runnable()
|
||||
{
|
||||
public void run()
|
||||
{
|
||||
Craft[] crafts = CraftManager
|
||||
.getInstance()
|
||||
.getCraftsInWorld(Bukkit.getWorlds().get(0));
|
||||
if (crafts == null)
|
||||
return;
|
||||
for (Craft c : crafts)
|
||||
{
|
||||
if (c.getType().getCraftName()
|
||||
.equalsIgnoreCase("mouse"))
|
||||
{
|
||||
int dx = c.getLastDX();
|
||||
// int dy = c.getLastDY();
|
||||
int dz = c.getLastDZ();
|
||||
if (Bukkit
|
||||
.getWorlds()
|
||||
.get(0)
|
||||
.getBlockAt(c.getMinX(),
|
||||
c.getMinY() - 1,
|
||||
c.getMinZ()).getType() != Material.AIR
|
||||
&& (dx != 0 || dz != 0))
|
||||
UpdateMouse(null, dx * MouseSpeed, dz
|
||||
* MouseSpeed, 0, 0, "");
|
||||
c.setLastDX(0);
|
||||
c.setLastDZ(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}, 1, 1);
|
||||
}
|
||||
|
||||
getServer().getPluginManager().registerEvents(
|
||||
new MouseLockerPlayerListener(), this);
|
||||
}
|
||||
|
||||
public void Stop(CommandSender sender)
|
||||
{
|
||||
sender.sendMessage("§eStopping computer...");
|
||||
computer.PowerOff();
|
||||
sender.sendMessage("§eComputer stopped.");
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public void PowerButton(CommandSender sender)
|
||||
{
|
||||
sender.sendMessage("§eStarting/stoppping computer...");
|
||||
final CommandSender s = sender;
|
||||
getServer().getScheduler().scheduleAsyncDelayedTask(this,
|
||||
new Runnable()
|
||||
{
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
if (computer.PowerButton())
|
||||
{
|
||||
DoStart();
|
||||
s.sendMessage("§eComputer started.");
|
||||
} else
|
||||
s.sendMessage("§ePowerbutton pressed.");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void Reset(CommandSender sender)
|
||||
{
|
||||
sender.sendMessage("§eResetting computer...");
|
||||
computer.Reset();
|
||||
sender.sendMessage("§eComputer reset.");
|
||||
}
|
||||
|
||||
public void FixScreen(CommandSender sender)
|
||||
{
|
||||
sender.sendMessage("§eFixing screen...");
|
||||
computer.FixScreen();
|
||||
sender.sendMessage("§eScreen fixed.");
|
||||
}
|
||||
|
||||
public void PressKey(CommandSender sender, String key,
|
||||
String stateorduration)
|
||||
{
|
||||
if (stateorduration.length() == 0)
|
||||
computer.PressKey(key, (short) 0);
|
||||
else if (stateorduration.equalsIgnoreCase("down"))
|
||||
computer.PressKey(key, (short) -1);
|
||||
else if (stateorduration.equalsIgnoreCase("up"))
|
||||
computer.PressKey(key, (short) -2);
|
||||
else
|
||||
computer.PressKey(key, Short.parseShort(stateorduration));
|
||||
}
|
||||
|
||||
public void UpdateMouse(CommandSender sender, int x, int y, int z, int w,
|
||||
String mbs, boolean down)
|
||||
{
|
||||
if (down)
|
||||
computer.UpdateMouse(x, y, z, w, mbs);
|
||||
else
|
||||
computer.UpdateMouse(x, y, z, w, "");
|
||||
}
|
||||
|
||||
public void UpdateMouse(CommandSender sender, int x, int y, int z, int w,
|
||||
String mbs)
|
||||
{
|
||||
UpdateMouse(sender, x, y, z, w, mbs, true);
|
||||
UpdateMouse(sender, x, y, z, w, mbs, false);
|
||||
}
|
||||
|
||||
private void addClassPath(final URL url) throws IOException
|
||||
{
|
||||
final URLClassLoader sysloader = (URLClassLoader) ClassLoader
|
||||
.getSystemClassLoader();
|
||||
final Class<URLClassLoader> sysclass = URLClassLoader.class;
|
||||
try
|
||||
{
|
||||
final Method method = sysclass.getDeclaredMethod("addURL",
|
||||
new Class[] { URL.class });
|
||||
method.setAccessible(true);
|
||||
method.invoke(sysloader, new Object[] { url });
|
||||
} catch (final Throwable t)
|
||||
{
|
||||
t.printStackTrace();
|
||||
throw new IOException("Error adding " + url
|
||||
+ " to system classloader");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue