Converted to Maven project, fixes

- Put all the needed libraries inside the JAR
- Shaded all the dependencies
- Updated VirtualBox interop
- Spent hours fixing bugs for all of the above
This commit is contained in:
Norbi Peti 2016-12-28 21:45:47 +01:00
parent ba257f3cf1
commit 06b785ff4a
18 changed files with 371 additions and 722 deletions

224
.gitignore vendored
View file

@ -243,3 +243,227 @@ paket-files/
# JetBrains Rider
.idea/
*.sln.imlasd
#################
## Eclipse
#################
*.pydevproject
.metadata/
bin/
tmp/
*.tmp
*.bak
*.swp
*~.nib
local.properties
.classpath
.settings/
.loadpath
target/
.project
# External tool builders
.externalToolBuilders/
# Locally stored "Eclipse launch configurations"
*.launch
# CDT-specific
.cproject
# PDT-specific
.buildpath
#################
## Visual Studio
#################
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
# User-specific files
*.suo
*.user
*.sln.docstates
# Build results
[Dd]ebug/
[Rr]elease/
x64/
build/
[Bb]in/
[Oo]bj/
# MSTest test Results
[Tt]est[Rr]esult*/
[Bb]uild[Ll]og.*
*_i.c
*_p.c
*.ilk
*.meta
*.obj
*.pch
*.pdb
*.pgc
*.pgd
*.rsp
*.sbr
*.tlb
*.tli
*.tlh
*.tmp
*.tmp_proj
*.log
*.vspscc
*.vssscc
.builds
*.pidb
*.log
*.scc
# Visual C++ cache files
ipch/
*.aps
*.ncb
*.opensdf
*.sdf
*.cachefile
# Visual Studio profiler
*.psess
*.vsp
*.vspx
# Guidance Automation Toolkit
*.gpState
# ReSharper is a .NET coding add-in
_ReSharper*/
*.[Rr]e[Ss]harper
# TeamCity is a build add-in
_TeamCity*
# DotCover is a Code Coverage Tool
*.dotCover
# NCrunch
*.ncrunch*
.*crunch*.local.xml
# Installshield output folder
[Ee]xpress/
# DocProject is a documentation generator add-in
DocProject/buildhelp/
DocProject/Help/*.HxT
DocProject/Help/*.HxC
DocProject/Help/*.hhc
DocProject/Help/*.hhk
DocProject/Help/*.hhp
DocProject/Help/Html2
DocProject/Help/html
# Click-Once directory
publish/
# Publish Web Output
*.Publish.xml
*.pubxml
*.publishproj
# NuGet Packages Directory
## TODO: If you have NuGet Package Restore enabled, uncomment the next line
#packages/
# Windows Azure Build Output
csx
*.build.csdef
# Windows Store app package directory
AppPackages/
# Others
sql/
*.Cache
ClientBin/
[Ss]tyle[Cc]op.*
~$*
*~
*.dbmdl
*.[Pp]ublish.xml
*.pfx
*.publishsettings
# RIA/Silverlight projects
Generated_Code/
# Backup & report files from converting an old project file to a newer
# Visual Studio version. Backup files are not needed, because we have git ;-)
_UpgradeReport_Files/
Backup*/
UpgradeLog*.XML
UpgradeLog*.htm
# SQL Server files
App_Data/*.mdf
App_Data/*.ldf
#############
## Windows detritus
#############
# Windows image file caches
Thumbs.db
ehthumbs.db
# Folder config file
Desktop.ini
# Recycle Bin used on file shares
$RECYCLE.BIN/
# Mac crap
.DS_Store
#############
## Python
#############
*.py[cod]
# Packages
*.egg
*.egg-info
dist/
build/
eggs/
parts/
var/
sdist/
develop-eggs/
.installed.cfg
# Installer logs
pip-log.txt
# Unit test / coverage reports
.coverage
.tox
#Translations
*.mo
#Mr Developer
.mr.developer.cfg
.metadata/*
TheButtonAutoFlair/out/artifacts/Autoflair/Autoflair.jar
*.iml
*.name
.idea/compiler.xml
*.xml

View file

@ -12,7 +12,7 @@ I plan on making a series where I show the whole process of creating this projec
*Note: only the server host has to meet these requirements.*
### Currently compiled for (and tested on):
*If you don't meet these requirements, you will need to compile the files for yourself. Please help the community by sending the compiled version to me so more people can download it.*
*If you don't meet these requirements, you will need to compile the files for yourself. Please help by sending the compiled version to me so more people can download it.*
* Windows 7 64-bit
* VirtualBox 5
@ -41,7 +41,7 @@ I plan on making a series where I show the whole process of creating this projec
* Start your server
## Usage
*Please give appropriate credit and link to this page if you use this machine in one of your videos/creations/etc. You can also send me your video and I may put it here if I like it.*
*Please give appropriate credit and link to this page if you use this machine in one of your videos/creations/etc. You can also send me your video so I can put it here.*
### Display
*Note:* You can create as many displays as you want, but all of them will show the same.

View file

@ -1,10 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
<classpathentry kind="lib" path="D:/Z - Norbi cucca/0 Projektek/TheButtonMCAutoFlairProto/Spigot server (build)/spigot-1.8.7.jar"/>
<classpathentry kind="lib" path="D:/Downloads/jni4net-0.8.8.0-bin/lib/jni4net.j-0.8.8.0.jar"/>
<classpathentry kind="lib" path="D:/Z - Norbi cucca/0 Projektek/TheButtonMCAutoFlairProto/Spigot server/plugins/VirtualComputer/VirtualComputerSender.j4n.jar"/>
<classpathentry kind="lib" path="D:/Z - Norbi cucca/0 Projektek/TheButtonMCAutoFlairProto/Spigot server/plugins/_/Movecraft.jar"/>
<classpathentry kind="output" path="bin"/>
<classpathentry kind="src" output="target/classes" path="src">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="lib" path="VirtualComputerSender.j4n.jar"/>
<classpathentry kind="output" path="target/classes"/>
</classpath>

View file

@ -1,223 +0,0 @@
#################
## Eclipse
#################
*.pydevproject
.metadata/
bin/
tmp/
*.tmp
*.bak
*.swp
*~.nib
local.properties
.classpath
.settings/
.loadpath
target/
.project
# External tool builders
.externalToolBuilders/
# Locally stored "Eclipse launch configurations"
*.launch
# CDT-specific
.cproject
# PDT-specific
.buildpath
#################
## Visual Studio
#################
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
# User-specific files
*.suo
*.user
*.sln.docstates
# Build results
[Dd]ebug/
[Rr]elease/
x64/
build/
[Bb]in/
[Oo]bj/
# MSTest test Results
[Tt]est[Rr]esult*/
[Bb]uild[Ll]og.*
*_i.c
*_p.c
*.ilk
*.meta
*.obj
*.pch
*.pdb
*.pgc
*.pgd
*.rsp
*.sbr
*.tlb
*.tli
*.tlh
*.tmp
*.tmp_proj
*.log
*.vspscc
*.vssscc
.builds
*.pidb
*.log
*.scc
# Visual C++ cache files
ipch/
*.aps
*.ncb
*.opensdf
*.sdf
*.cachefile
# Visual Studio profiler
*.psess
*.vsp
*.vspx
# Guidance Automation Toolkit
*.gpState
# ReSharper is a .NET coding add-in
_ReSharper*/
*.[Rr]e[Ss]harper
# TeamCity is a build add-in
_TeamCity*
# DotCover is a Code Coverage Tool
*.dotCover
# NCrunch
*.ncrunch*
.*crunch*.local.xml
# Installshield output folder
[Ee]xpress/
# DocProject is a documentation generator add-in
DocProject/buildhelp/
DocProject/Help/*.HxT
DocProject/Help/*.HxC
DocProject/Help/*.hhc
DocProject/Help/*.hhk
DocProject/Help/*.hhp
DocProject/Help/Html2
DocProject/Help/html
# Click-Once directory
publish/
# Publish Web Output
*.Publish.xml
*.pubxml
*.publishproj
# NuGet Packages Directory
## TODO: If you have NuGet Package Restore enabled, uncomment the next line
#packages/
# Windows Azure Build Output
csx
*.build.csdef
# Windows Store app package directory
AppPackages/
# Others
sql/
*.Cache
ClientBin/
[Ss]tyle[Cc]op.*
~$*
*~
*.dbmdl
*.[Pp]ublish.xml
*.pfx
*.publishsettings
# RIA/Silverlight projects
Generated_Code/
# Backup & report files from converting an old project file to a newer
# Visual Studio version. Backup files are not needed, because we have git ;-)
_UpgradeReport_Files/
Backup*/
UpgradeLog*.XML
UpgradeLog*.htm
# SQL Server files
App_Data/*.mdf
App_Data/*.ldf
#############
## Windows detritus
#############
# Windows image file caches
Thumbs.db
ehthumbs.db
# Folder config file
Desktop.ini
# Recycle Bin used on file shares
$RECYCLE.BIN/
# Mac crap
.DS_Store
#############
## Python
#############
*.py[cod]
# Packages
*.egg
*.egg-info
dist/
build/
eggs/
parts/
var/
sdist/
develop-eggs/
.installed.cfg
# Installer logs
pip-log.txt
# Unit test / coverage reports
.coverage
.tox
#Translations
*.mo
#Mr Developer
.mr.developer.cfg
.metadata/*
TheButtonAutoFlair/out/artifacts/Autoflair/Autoflair.jar
*.iml
*.name
.idea/compiler.xml
*.xml

View file

@ -10,8 +10,14 @@
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.m2e.core.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.m2e.core.maven2Nature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>

View file

@ -1,295 +1,13 @@
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.targetPlatform=1.8
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.7
org.eclipse.jdt.core.compiler.compliance=1.8
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
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
org.eclipse.jdt.core.compiler.source=1.8
org.eclipse.jdt.core.javaFormatter=org.eclipse.jdt.core.defaultJavaFormatter

View file

@ -0,0 +1,5 @@
Compile the Visual Studio project (VirtualComputerSender), put the DLL into the Java project folder (VirtualComputer). Install Movecraft in Maven using
install:install-file -Dfile="<path-to-Movecraft.jar>" -DgroupId=net.countercraft -DartifactId=Movecraft -Dversion=3.0.0 -Dpackaging=jar -DgeneratePom=true
Compile the project using Maven. The compiled JAR should have everything included.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View file

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<groupId>io.github.NorbiPeti</groupId>
<artifactId>SenderBridge</artifactId>
<version>1.0</version>
<description>POM was created from install:install-file</description>
</project>

View file

@ -62,7 +62,7 @@ public class Commands implements CommandExecutor
case "key":
if (args.length < 2)
{
sender.sendMessage("§cUsage: /computer key <key> [down/up|interval]");
sender.sendMessage("§cUsage: /computer key <key> [down/up|interval]");
return true;
}
if (args.length < 3)
@ -103,14 +103,14 @@ public class Commands implements CommandExecutor
}
if (showusage)
{
sender.sendMessage("§cUsage: /computer mouse <relx> <rely> <relz> <relw>");
sender.sendMessage("§cOr: /computer mouse <button> [up/down]");
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>");
sender.sendMessage("§cUsage: /computer mspeed <speed>");
return true;
}
PluginMain.MouseSpeed = Integer.parseInt(args[1]);
@ -120,12 +120,12 @@ public class Commands implements CommandExecutor
{
if (!(sender instanceof Player))
{
sender.sendMessage("§cError: Only players can use this command.");
sender.sendMessage("§cError: Only players can use this command.");
return true;
}
if (args.length < 2)
{
sender.sendMessage("§cUsage: /computer input <key|mouse>");
sender.sendMessage("§cUsage: /computer input <key|mouse>");
return true;
}
if (args[1].equalsIgnoreCase("key"))
@ -164,7 +164,7 @@ public class Commands implements CommandExecutor
{
if (!(sender instanceof Player))
{
sender.sendMessage("§cOnly ingame players can use this command.");
sender.sendMessage("§cOnly ingame players can use this command.");
return true;
}
if (!MouseLockerPlayerListener.LockedPlayers
@ -172,22 +172,22 @@ public class Commands implements CommandExecutor
{
MouseLockerPlayerListener.LockedPlayers
.add((Player) sender);
sender.sendMessage("§aMouse locked.");
sender.sendMessage("§aMouse locked.");
} else
{
MouseLockerPlayerListener.LockedPlayers.remove(sender);
sender.sendMessage("§bMouse unlocked.");
sender.sendMessage("§bMouse unlocked.");
}
} else if (args[1].equalsIgnoreCase("mspeed"))
{
if (args.length < 3)
{
sender.sendMessage("§cUsage: /computer input mspeed <integer>");
sender.sendMessage("§cUsage: /computer input mspeed <integer>");
return true;
}
MouseLockerPlayerListener.LockedSpeed = Float
.parseFloat(args[2]);
sender.sendMessage("§aMouse speed set to "
sender.sendMessage("§aMouse speed set to "
+ MouseLockerPlayerListener.LockedSpeed);
}
break;

View file

@ -3,10 +3,6 @@ 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;
@ -18,14 +14,14 @@ import org.bukkit.Material;
import org.bukkit.command.CommandSender;
import org.bukkit.command.ConsoleCommandSender;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.scheduler.BukkitTask;
import virtualcomputersender.Computer;
import com.mcplugindev.slipswhitley.sketchmap.map.RelativeLocation;
import com.mcplugindev.slipswhitley.sketchmap.map.SketchMap;
public class PluginMain extends JavaPlugin
{
public class PluginMain extends JavaPlugin {
private Computer computer;
private SketchMap smap;
@ -33,189 +29,132 @@ public class PluginMain extends JavaPlugin
// Fired when plugin is first enabled
@Override
public void onEnable()
{
public void onEnable() {
Instance = this;
try
{
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"),
ccs.sendMessage("§bExtracting necessary libraries...");
final File[] libs = 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") };
new File(getDataFolder(), "jni4net.n.w64.v40-0.8.8.0.dll"),
// new File(getDataFolder(), "VirtualComputerSender.j4n.jar"),
new File(getDataFolder(), "VirtualComputerSender.j4n.dll"),
new File(getDataFolder(), "VirtualComputerSender.dll"),
new File(getDataFolder(), "Interop.VirtualBox.dll") };
for (final File lib : libs2)
{
if (!lib.exists())
{
JarUtils.extractFromJar(lib.getName(),
lib.getAbsolutePath());
for (final File lib : libs) {
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...");
ccs.sendMessage("§bInitializing bridge...");
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...");
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!");
ccs.sendMessage("§bLoaded!");
getServer().getPluginManager().registerEvents(new MouseLockerPlayerListener(), this);
DoStart();
} catch (final Exception e)
{
} catch (final Exception e) {
e.printStackTrace();
}
}
// Fired when plugin is disabled
@Override
public void onDisable()
{
public void onDisable() {
ConsoleCommandSender ccs = getServer().getConsoleSender();
ccs.sendMessage("§aHuh.");
ccs.sendMessage("§aHuh.");
saveConfig();
}
private volatile BufferedImage img;
private volatile int taskid = -1;
private volatile BukkitTask task = null;
public void Start(CommandSender sender)
{
sender.sendMessage("§eStarting computer...");
public void Start(CommandSender sender) {
sender.sendMessage("§eStarting computer...");
computer.Start();
sender.sendMessage("§eComputer started.");
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);
private void DoStart() {
if (task == null)
task = this.getServer().getScheduler().runTaskTimerAsynchronously(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, 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.");
}
});
}
}, 1, 1);
}
}
public void Reset(CommandSender sender)
{
sender.sendMessage("§eResetting computer...");
public void Stop(CommandSender sender) {
sender.sendMessage("§eStopping computer...");
computer.PowerOff();
sender.sendMessage("§eComputer stopped.");
}
public void PowerButton(CommandSender sender) {
sender.sendMessage("§eStarting/stoppping computer...");
final CommandSender s = sender;
getServer().getScheduler().runTaskAsynchronously(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.");
sender.sendMessage("§eComputer reset.");
}
public void FixScreen(CommandSender sender)
{
sender.sendMessage("§eFixing screen...");
public void FixScreen(CommandSender sender) {
sender.sendMessage("§eFixing screen...");
computer.FixScreen();
sender.sendMessage("§eScreen fixed.");
sender.sendMessage("§eScreen fixed.");
}
public void PressKey(CommandSender sender, String key,
String stateorduration)
{
public void PressKey(CommandSender sender, String key, String stateorduration) {
if (stateorduration.length() == 0)
computer.PressKey(key, (short) 0);
else if (stateorduration.equalsIgnoreCase("down"))
@ -226,38 +165,15 @@ public class PluginMain extends JavaPlugin
computer.PressKey(key, Short.parseShort(stateorduration));
}
public void UpdateMouse(CommandSender sender, int x, int y, int z, int w,
String mbs, boolean down)
{
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)
{
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");
}
}
}

View file

@ -157,7 +157,7 @@ namespace VirtualComputerSender //Copyright © NorbiPeti 2015-2016
{
if (x + 4 > aImage.Length)
return;
Screen[640 * j + i] = Color.FromArgb(img[x + 2], img[x + 1], img[x]).ToArgb();
Screen[640 * j + i] = Color.FromArgb(img[x + 2], img[x + 1], img[x]).ToArgb(); //TODO: Touchscreen and/or left click right click forwarding
x += 4;
}
x += (int)aX * 4;

View file

@ -148,21 +148,16 @@ namespace VirtualComputerSender //Copyright © NorbiPeti 2015-2016
{
var img = aImage.Cast<byte>().ToArray();
int x = 0;
//if (aImage.Length > 1152000)
//Form1.Screen.Clear(Color.Black);
//else
//{
//Display.SetSeamlessMode(1);
/*if (aWidth == 800 && aHeight == 600)
Display.SetVideoModeHint(0, 1, 0, 0, 0, NetFrameBuffer.ScreenWidth, NetFrameBuffer.ScreenHeight, NetFrameBuffer.CBitsPerPixel);*/
for (int j = (int)aY; j < aHeight && j < ScreenHeight; j++)
{
//for (int i = (int)aX; (j % 20 == 0 ? (i < aWidth - 1 && i < ScreenWidth - 1) : (i < aWidth && i < ScreenWidth)); i++)
for (int i = (int)aX; i < aWidth && i < ScreenWidth; i++)
{
if (x + 4 > aImage.Length)
return;
//Form1.Screen.FillRectangle(new SolidBrush(Color.FromArgb(255, img[x + 2], img[x + 1], img[x])), i, j, 1, 1);
Screen[i, j] = Color.FromArgb(img[x + 2], img[x + 1], img[x]);
//Form1.Screen.FillRectangle(new SolidBrush(Color.FromArgb(255, img[x], img[x + 1], img[x + 2])), i, j, 1, 1);
x += 4;
}
x += (int)aX * 4;
@ -170,18 +165,6 @@ namespace VirtualComputerSender //Copyright © NorbiPeti 2015-2016
if (add > 0)
x += add * 4;
}
/*var ms = new MemoryStream();
var bw = new BinaryWriter(ms);
bw.Write(Convert.ToInt32(aX));
bw.Write(Convert.ToInt32(aY));
bw.Write(Convert.ToInt32(aWidth));
bw.Write(Convert.ToInt32(aHeight));
bw.Write(img);
bw.Flush();
Client.Send(BitConverter.GetBytes(Convert.ToInt32(ms.Length)), 4);
Client.Send(ms.ToArray(), Convert.ToInt32(ms.Length));
bw.Close();*/
//}
}
public void NotifyChange(uint aScreenId, uint aXOrigin, uint aYOrigin, uint aWidth, uint aHeight)

View file

@ -5,7 +5,7 @@
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{5EF12535-ACDF-4D60-8E32-087F5A277946}</ProjectGuid>
<OutputType>Library</OutputType>
<OutputType>WinExe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>VirtualComputerSender</RootNamespace>
<AssemblyName>VirtualComputerSender</AssemblyName>