Merge pull request '0.5.8 refactor of all files, party, yml based system, damage listener' (#2) from unurled/Raxen:plugin into plugin
Reviewed-on: #2
This commit is contained in:
commit
9cfd556405
178 changed files with 12699 additions and 6199 deletions
4
.gitignore
vendored
4
.gitignore
vendored
|
@ -1,6 +1,6 @@
|
|||
# User-specific stuff
|
||||
server/
|
||||
.idea/
|
||||
# .idea/
|
||||
.vscode/
|
||||
.settings/
|
||||
.factorypath
|
||||
|
@ -131,3 +131,5 @@ run/
|
|||
/gradle/
|
||||
|
||||
resource_pack/raxen/assets/minecraft/
|
||||
|
||||
.idea/codeStyles/codeStyleConfig.xml
|
||||
|
|
92
.idea/.gitignore
vendored
Normal file
92
.idea/.gitignore
vendored
Normal file
|
@ -0,0 +1,92 @@
|
|||
# Default ignored files
|
||||
/shelf/
|
||||
/workspace.xml
|
||||
# Editor-based HTTP Client requests
|
||||
/httpRequests/
|
||||
# Datasource local storage ignored files
|
||||
/dataSources/
|
||||
/dataSources.local.xml
|
||||
compiler.xml
|
||||
discord.xml
|
||||
gradle.xml
|
||||
codeStyles/codeStylesConfig.xml
|
||||
|
||||
|
||||
|
||||
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
|
||||
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
|
||||
|
||||
# User-specific stuff
|
||||
.idea/**/workspace.xml
|
||||
.idea/**/tasks.xml
|
||||
.idea/**/usage.statistics.xml
|
||||
.idea/**/dictionaries
|
||||
.idea/**/shelf
|
||||
|
||||
# AWS User-specific
|
||||
.idea/**/aws.xml
|
||||
|
||||
# Generated files
|
||||
.idea/**/contentModel.xml
|
||||
|
||||
# Sensitive or high-churn files
|
||||
.idea/**/dataSources/
|
||||
.idea/**/dataSources.ids
|
||||
.idea/**/dataSources.local.xml
|
||||
.idea/**/sqlDataSources.xml
|
||||
.idea/**/dynamic.xml
|
||||
.idea/**/uiDesigner.xml
|
||||
.idea/**/dbnavigator.xml
|
||||
|
||||
# Gradle
|
||||
.idea/**/gradle.xml
|
||||
.idea/**/libraries
|
||||
|
||||
# Gradle and Maven with auto-import
|
||||
# When using Gradle or Maven with auto-import, you should exclude module files,
|
||||
# since they will be recreated, and may cause churn. Uncomment if using
|
||||
# auto-import.
|
||||
# .idea/artifacts
|
||||
# .idea/compiler.xml
|
||||
# .idea/jarRepositories.xml
|
||||
# .idea/modules.xml
|
||||
# .idea/*.iml
|
||||
# .idea/modules
|
||||
# *.iml
|
||||
# *.ipr
|
||||
|
||||
# CMake
|
||||
cmake-build-*/
|
||||
|
||||
# Mongo Explorer plugin
|
||||
.idea/**/mongoSettings.xml
|
||||
|
||||
# File-based project format
|
||||
*.iws
|
||||
|
||||
# IntelliJ
|
||||
out/
|
||||
|
||||
# mpeltonen/sbt-idea plugin
|
||||
.idea_modules/
|
||||
|
||||
# JIRA plugin
|
||||
atlassian-ide-plugin.xml
|
||||
|
||||
# Cursive Clojure plugin
|
||||
.idea/replstate.xml
|
||||
|
||||
# SonarLint plugin
|
||||
.idea/sonarlint/
|
||||
|
||||
# Crashlytics plugin (for Android Studio and IntelliJ)
|
||||
com_crashlytics_export_strings.xml
|
||||
crashlytics.properties
|
||||
crashlytics-build.properties
|
||||
fabric.properties
|
||||
|
||||
# Editor-based Rest Client
|
||||
.idea/httpRequests
|
||||
|
||||
# Android studio 3.1+ serialized cache file
|
||||
.idea/caches/build_file_checksums.ser
|
1
.idea/.name
Normal file
1
.idea/.name
Normal file
|
@ -0,0 +1 @@
|
|||
raxen
|
581
.idea/codeStyles/Project.xml
Normal file
581
.idea/codeStyles/Project.xml
Normal file
|
@ -0,0 +1,581 @@
|
|||
<component name="ProjectCodeStyleConfiguration">
|
||||
<code_scheme name="Project" version="173">
|
||||
<option name="OTHER_INDENT_OPTIONS">
|
||||
<value>
|
||||
<option name="INDENT_SIZE" value="2" />
|
||||
<option name="CONTINUATION_INDENT_SIZE" value="4" />
|
||||
<option name="TAB_SIZE" value="2" />
|
||||
</value>
|
||||
</option>
|
||||
<option name="LINE_SEPARATOR" />
|
||||
<option name="RIGHT_MARGIN" value="100" />
|
||||
<option name="KEEP_CONTROL_STATEMENT_IN_ONE_LINE" value="false" />
|
||||
<option name="KEEP_BLANK_LINES_BEFORE_RBRACE" value="0" />
|
||||
<option name="ALIGN_MULTILINE_PARAMETERS" value="false" />
|
||||
<option name="ALIGN_MULTILINE_FOR" value="false" />
|
||||
<option name="SPACE_BEFORE_ARRAY_INITIALIZER_LBRACE" value="true" />
|
||||
<option name="CALL_PARAMETERS_WRAP" value="1" />
|
||||
<option name="METHOD_PARAMETERS_WRAP" value="1" />
|
||||
<option name="EXTENDS_LIST_WRAP" value="1" />
|
||||
<option name="THROWS_KEYWORD_WRAP" value="1" />
|
||||
<option name="METHOD_CALL_CHAIN_WRAP" value="1" />
|
||||
<option name="BINARY_OPERATION_WRAP" value="1" />
|
||||
<option name="BINARY_OPERATION_SIGN_ON_NEXT_LINE" value="true" />
|
||||
<option name="TERNARY_OPERATION_WRAP" value="1" />
|
||||
<option name="TERNARY_OPERATION_SIGNS_ON_NEXT_LINE" value="true" />
|
||||
<option name="FOR_STATEMENT_WRAP" value="1" />
|
||||
<option name="ARRAY_INITIALIZER_WRAP" value="1" />
|
||||
<option name="WRAP_COMMENTS" value="true" />
|
||||
<option name="IF_BRACE_FORCE" value="3" />
|
||||
<option name="DOWHILE_BRACE_FORCE" value="3" />
|
||||
<option name="WHILE_BRACE_FORCE" value="3" />
|
||||
<option name="FOR_BRACE_FORCE" value="3" />
|
||||
<option name="SOFT_MARGINS" value="80,100,120" />
|
||||
<AndroidXmlCodeStyleSettings>
|
||||
<option name="USE_CUSTOM_SETTINGS" value="true" />
|
||||
<option name="LAYOUT_SETTINGS">
|
||||
<value>
|
||||
<option name="INSERT_BLANK_LINE_BEFORE_TAG" value="false" />
|
||||
</value>
|
||||
</option>
|
||||
</AndroidXmlCodeStyleSettings>
|
||||
<JSCodeStyleSettings version="0">
|
||||
<option name="INDENT_CHAINED_CALLS" value="false" />
|
||||
</JSCodeStyleSettings>
|
||||
<JavaCodeStyleSettings>
|
||||
<option name="INSERT_INNER_CLASS_IMPORTS" value="true" />
|
||||
<option name="CLASS_COUNT_TO_USE_IMPORT_ON_DEMAND" value="999" />
|
||||
<option name="NAMES_COUNT_TO_USE_IMPORT_ON_DEMAND" value="999" />
|
||||
<option name="PACKAGES_TO_USE_IMPORT_ON_DEMAND">
|
||||
<value />
|
||||
</option>
|
||||
<option name="IMPORT_LAYOUT_TABLE">
|
||||
<value>
|
||||
<package name="" withSubpackages="true" static="true" />
|
||||
<emptyLine />
|
||||
<package name="" withSubpackages="true" static="false" />
|
||||
</value>
|
||||
</option>
|
||||
</JavaCodeStyleSettings>
|
||||
<Objective-C>
|
||||
<option name="INDENT_NAMESPACE_MEMBERS" value="0" />
|
||||
<option name="INDENT_C_STRUCT_MEMBERS" value="2" />
|
||||
<option name="INDENT_CLASS_MEMBERS" value="2" />
|
||||
<option name="INDENT_VISIBILITY_KEYWORDS" value="1" />
|
||||
<option name="INDENT_INSIDE_CODE_BLOCK" value="2" />
|
||||
<option name="KEEP_STRUCTURES_IN_ONE_LINE" value="true" />
|
||||
<option name="FUNCTION_PARAMETERS_WRAP" value="5" />
|
||||
<option name="FUNCTION_CALL_ARGUMENTS_WRAP" value="5" />
|
||||
<option name="TEMPLATE_CALL_ARGUMENTS_WRAP" value="5" />
|
||||
<option name="TEMPLATE_CALL_ARGUMENTS_ALIGN_MULTILINE" value="true" />
|
||||
<option name="ALIGN_INIT_LIST_IN_COLUMNS" value="false" />
|
||||
<option name="SPACE_BEFORE_SUPERCLASS_COLON" value="false" />
|
||||
</Objective-C>
|
||||
<Objective-C-extensions>
|
||||
<option name="GENERATE_INSTANCE_VARIABLES_FOR_PROPERTIES" value="ASK" />
|
||||
<option name="RELEASE_STYLE" value="IVAR" />
|
||||
<option name="TYPE_QUALIFIERS_PLACEMENT" value="BEFORE" />
|
||||
<file>
|
||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Import" />
|
||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Macro" />
|
||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Typedef" />
|
||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Enum" />
|
||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Constant" />
|
||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Global" />
|
||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Struct" />
|
||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="FunctionPredecl" />
|
||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Function" />
|
||||
</file>
|
||||
<class>
|
||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Property" />
|
||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Synthesize" />
|
||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="InitMethod" />
|
||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="StaticMethod" />
|
||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="InstanceMethod" />
|
||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="DeallocMethod" />
|
||||
</class>
|
||||
<extensions>
|
||||
<pair source="cc" header="h" />
|
||||
<pair source="c" header="h" />
|
||||
</extensions>
|
||||
</Objective-C-extensions>
|
||||
<Python>
|
||||
<option name="USE_CONTINUATION_INDENT_FOR_ARGUMENTS" value="true" />
|
||||
</Python>
|
||||
<TypeScriptCodeStyleSettings version="0">
|
||||
<option name="INDENT_CHAINED_CALLS" value="false" />
|
||||
</TypeScriptCodeStyleSettings>
|
||||
<XML>
|
||||
<option name="XML_ALIGN_ATTRIBUTES" value="false" />
|
||||
</XML>
|
||||
<codeStyleSettings language="CSS">
|
||||
<indentOptions>
|
||||
<option name="INDENT_SIZE" value="2" />
|
||||
<option name="CONTINUATION_INDENT_SIZE" value="4" />
|
||||
<option name="TAB_SIZE" value="2" />
|
||||
</indentOptions>
|
||||
</codeStyleSettings>
|
||||
<codeStyleSettings language="ECMA Script Level 4">
|
||||
<option name="KEEP_BLANK_LINES_IN_CODE" value="1" />
|
||||
<option name="ALIGN_MULTILINE_PARAMETERS" value="false" />
|
||||
<option name="ALIGN_MULTILINE_FOR" value="false" />
|
||||
<option name="CALL_PARAMETERS_WRAP" value="1" />
|
||||
<option name="METHOD_PARAMETERS_WRAP" value="1" />
|
||||
<option name="EXTENDS_LIST_WRAP" value="1" />
|
||||
<option name="BINARY_OPERATION_WRAP" value="1" />
|
||||
<option name="BINARY_OPERATION_SIGN_ON_NEXT_LINE" value="true" />
|
||||
<option name="TERNARY_OPERATION_WRAP" value="1" />
|
||||
<option name="TERNARY_OPERATION_SIGNS_ON_NEXT_LINE" value="true" />
|
||||
<option name="FOR_STATEMENT_WRAP" value="1" />
|
||||
<option name="ARRAY_INITIALIZER_WRAP" value="1" />
|
||||
<option name="IF_BRACE_FORCE" value="3" />
|
||||
<option name="DOWHILE_BRACE_FORCE" value="3" />
|
||||
<option name="WHILE_BRACE_FORCE" value="3" />
|
||||
<option name="FOR_BRACE_FORCE" value="3" />
|
||||
<option name="PARENT_SETTINGS_INSTALLED" value="true" />
|
||||
</codeStyleSettings>
|
||||
<codeStyleSettings language="HTML">
|
||||
<indentOptions>
|
||||
<option name="INDENT_SIZE" value="2" />
|
||||
<option name="CONTINUATION_INDENT_SIZE" value="4" />
|
||||
<option name="TAB_SIZE" value="2" />
|
||||
</indentOptions>
|
||||
</codeStyleSettings>
|
||||
<codeStyleSettings language="JAVA">
|
||||
<option name="KEEP_CONTROL_STATEMENT_IN_ONE_LINE" value="false" />
|
||||
<option name="KEEP_BLANK_LINES_IN_CODE" value="1" />
|
||||
<option name="BLANK_LINES_AFTER_CLASS_HEADER" value="1" />
|
||||
<option name="ALIGN_MULTILINE_PARAMETERS" value="false" />
|
||||
<option name="ALIGN_MULTILINE_RESOURCES" value="false" />
|
||||
<option name="ALIGN_MULTILINE_FOR" value="false" />
|
||||
<option name="CALL_PARAMETERS_WRAP" value="1" />
|
||||
<option name="METHOD_PARAMETERS_WRAP" value="1" />
|
||||
<option name="EXTENDS_LIST_WRAP" value="1" />
|
||||
<option name="THROWS_KEYWORD_WRAP" value="1" />
|
||||
<option name="METHOD_CALL_CHAIN_WRAP" value="1" />
|
||||
<option name="BINARY_OPERATION_WRAP" value="1" />
|
||||
<option name="BINARY_OPERATION_SIGN_ON_NEXT_LINE" value="true" />
|
||||
<option name="TERNARY_OPERATION_WRAP" value="1" />
|
||||
<option name="TERNARY_OPERATION_SIGNS_ON_NEXT_LINE" value="true" />
|
||||
<option name="FOR_STATEMENT_WRAP" value="1" />
|
||||
<option name="ARRAY_INITIALIZER_WRAP" value="1" />
|
||||
<option name="WRAP_COMMENTS" value="true" />
|
||||
<option name="IF_BRACE_FORCE" value="3" />
|
||||
<option name="DOWHILE_BRACE_FORCE" value="3" />
|
||||
<option name="WHILE_BRACE_FORCE" value="3" />
|
||||
<option name="FOR_BRACE_FORCE" value="3" />
|
||||
<indentOptions>
|
||||
<option name="CONTINUATION_INDENT_SIZE" value="4" />
|
||||
</indentOptions>
|
||||
</codeStyleSettings>
|
||||
<codeStyleSettings language="JSON">
|
||||
<indentOptions>
|
||||
<option name="CONTINUATION_INDENT_SIZE" value="4" />
|
||||
<option name="TAB_SIZE" value="2" />
|
||||
</indentOptions>
|
||||
</codeStyleSettings>
|
||||
<codeStyleSettings language="JavaScript">
|
||||
<option name="RIGHT_MARGIN" value="80" />
|
||||
<option name="KEEP_BLANK_LINES_IN_CODE" value="1" />
|
||||
<option name="ALIGN_MULTILINE_PARAMETERS" value="false" />
|
||||
<option name="ALIGN_MULTILINE_FOR" value="false" />
|
||||
<option name="CALL_PARAMETERS_WRAP" value="1" />
|
||||
<option name="METHOD_PARAMETERS_WRAP" value="1" />
|
||||
<option name="BINARY_OPERATION_WRAP" value="1" />
|
||||
<option name="BINARY_OPERATION_SIGN_ON_NEXT_LINE" value="true" />
|
||||
<option name="TERNARY_OPERATION_WRAP" value="1" />
|
||||
<option name="TERNARY_OPERATION_SIGNS_ON_NEXT_LINE" value="true" />
|
||||
<option name="FOR_STATEMENT_WRAP" value="1" />
|
||||
<option name="ARRAY_INITIALIZER_WRAP" value="1" />
|
||||
<option name="IF_BRACE_FORCE" value="3" />
|
||||
<option name="DOWHILE_BRACE_FORCE" value="3" />
|
||||
<option name="WHILE_BRACE_FORCE" value="3" />
|
||||
<option name="FOR_BRACE_FORCE" value="3" />
|
||||
<indentOptions>
|
||||
<option name="INDENT_SIZE" value="2" />
|
||||
<option name="TAB_SIZE" value="2" />
|
||||
</indentOptions>
|
||||
</codeStyleSettings>
|
||||
<codeStyleSettings language="ObjectiveC">
|
||||
<option name="RIGHT_MARGIN" value="80" />
|
||||
<option name="KEEP_BLANK_LINES_BEFORE_RBRACE" value="1" />
|
||||
<option name="BLANK_LINES_BEFORE_IMPORTS" value="0" />
|
||||
<option name="BLANK_LINES_AFTER_IMPORTS" value="0" />
|
||||
<option name="BLANK_LINES_AROUND_CLASS" value="0" />
|
||||
<option name="BLANK_LINES_AROUND_METHOD" value="0" />
|
||||
<option name="BLANK_LINES_AROUND_METHOD_IN_INTERFACE" value="0" />
|
||||
<option name="ALIGN_MULTILINE_BINARY_OPERATION" value="false" />
|
||||
<option name="BINARY_OPERATION_SIGN_ON_NEXT_LINE" value="true" />
|
||||
<option name="FOR_STATEMENT_WRAP" value="1" />
|
||||
<option name="ASSIGNMENT_WRAP" value="1" />
|
||||
<indentOptions>
|
||||
<option name="INDENT_SIZE" value="2" />
|
||||
<option name="CONTINUATION_INDENT_SIZE" value="4" />
|
||||
</indentOptions>
|
||||
</codeStyleSettings>
|
||||
<codeStyleSettings language="PROTO">
|
||||
<option name="RIGHT_MARGIN" value="80" />
|
||||
<indentOptions>
|
||||
<option name="INDENT_SIZE" value="2" />
|
||||
<option name="CONTINUATION_INDENT_SIZE" value="2" />
|
||||
<option name="TAB_SIZE" value="2" />
|
||||
</indentOptions>
|
||||
</codeStyleSettings>
|
||||
<codeStyleSettings language="Python">
|
||||
<option name="RIGHT_MARGIN" value="80" />
|
||||
<option name="ALIGN_MULTILINE_PARAMETERS" value="false" />
|
||||
<indentOptions>
|
||||
<option name="INDENT_SIZE" value="2" />
|
||||
<option name="CONTINUATION_INDENT_SIZE" value="4" />
|
||||
<option name="TAB_SIZE" value="2" />
|
||||
</indentOptions>
|
||||
</codeStyleSettings>
|
||||
<codeStyleSettings language="SASS">
|
||||
<indentOptions>
|
||||
<option name="CONTINUATION_INDENT_SIZE" value="4" />
|
||||
<option name="TAB_SIZE" value="2" />
|
||||
</indentOptions>
|
||||
</codeStyleSettings>
|
||||
<codeStyleSettings language="SCSS">
|
||||
<indentOptions>
|
||||
<option name="CONTINUATION_INDENT_SIZE" value="4" />
|
||||
<option name="TAB_SIZE" value="2" />
|
||||
</indentOptions>
|
||||
</codeStyleSettings>
|
||||
<codeStyleSettings language="TypeScript">
|
||||
<indentOptions>
|
||||
<option name="INDENT_SIZE" value="2" />
|
||||
<option name="TAB_SIZE" value="2" />
|
||||
</indentOptions>
|
||||
</codeStyleSettings>
|
||||
<codeStyleSettings language="XML">
|
||||
<indentOptions>
|
||||
<option name="INDENT_SIZE" value="2" />
|
||||
<option name="CONTINUATION_INDENT_SIZE" value="2" />
|
||||
<option name="TAB_SIZE" value="2" />
|
||||
</indentOptions>
|
||||
<arrangement>
|
||||
<rules>
|
||||
<section>
|
||||
<rule>
|
||||
<match>
|
||||
<AND>
|
||||
<NAME>xmlns:android</NAME>
|
||||
<XML_ATTRIBUTE />
|
||||
<XML_NAMESPACE>^$</XML_NAMESPACE>
|
||||
</AND>
|
||||
</match>
|
||||
</rule>
|
||||
</section>
|
||||
<section>
|
||||
<rule>
|
||||
<match>
|
||||
<AND>
|
||||
<NAME>xmlns:.*</NAME>
|
||||
<XML_ATTRIBUTE />
|
||||
<XML_NAMESPACE>^$</XML_NAMESPACE>
|
||||
</AND>
|
||||
</match>
|
||||
<order>BY_NAME</order>
|
||||
</rule>
|
||||
</section>
|
||||
<section>
|
||||
<rule>
|
||||
<match>
|
||||
<AND>
|
||||
<NAME>.*:id</NAME>
|
||||
<XML_ATTRIBUTE />
|
||||
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
|
||||
</AND>
|
||||
</match>
|
||||
</rule>
|
||||
</section>
|
||||
<section>
|
||||
<rule>
|
||||
<match>
|
||||
<AND>
|
||||
<NAME>style</NAME>
|
||||
<XML_ATTRIBUTE />
|
||||
<XML_NAMESPACE>^$</XML_NAMESPACE>
|
||||
</AND>
|
||||
</match>
|
||||
</rule>
|
||||
</section>
|
||||
<section>
|
||||
<rule>
|
||||
<match>
|
||||
<AND>
|
||||
<NAME>.*</NAME>
|
||||
<XML_ATTRIBUTE />
|
||||
<XML_NAMESPACE>^$</XML_NAMESPACE>
|
||||
</AND>
|
||||
</match>
|
||||
<order>BY_NAME</order>
|
||||
</rule>
|
||||
</section>
|
||||
<section>
|
||||
<rule>
|
||||
<match>
|
||||
<AND>
|
||||
<NAME>.*:.*Style</NAME>
|
||||
<XML_ATTRIBUTE />
|
||||
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
|
||||
</AND>
|
||||
</match>
|
||||
<order>BY_NAME</order>
|
||||
</rule>
|
||||
</section>
|
||||
<section>
|
||||
<rule>
|
||||
<match>
|
||||
<AND>
|
||||
<NAME>.*:layout_width</NAME>
|
||||
<XML_ATTRIBUTE />
|
||||
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
|
||||
</AND>
|
||||
</match>
|
||||
</rule>
|
||||
</section>
|
||||
<section>
|
||||
<rule>
|
||||
<match>
|
||||
<AND>
|
||||
<NAME>.*:layout_height</NAME>
|
||||
<XML_ATTRIBUTE />
|
||||
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
|
||||
</AND>
|
||||
</match>
|
||||
</rule>
|
||||
</section>
|
||||
<section>
|
||||
<rule>
|
||||
<match>
|
||||
<AND>
|
||||
<NAME>.*:layout_weight</NAME>
|
||||
<XML_ATTRIBUTE />
|
||||
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
|
||||
</AND>
|
||||
</match>
|
||||
</rule>
|
||||
</section>
|
||||
<section>
|
||||
<rule>
|
||||
<match>
|
||||
<AND>
|
||||
<NAME>.*:layout_margin</NAME>
|
||||
<XML_ATTRIBUTE />
|
||||
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
|
||||
</AND>
|
||||
</match>
|
||||
</rule>
|
||||
</section>
|
||||
<section>
|
||||
<rule>
|
||||
<match>
|
||||
<AND>
|
||||
<NAME>.*:layout_marginTop</NAME>
|
||||
<XML_ATTRIBUTE />
|
||||
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
|
||||
</AND>
|
||||
</match>
|
||||
</rule>
|
||||
</section>
|
||||
<section>
|
||||
<rule>
|
||||
<match>
|
||||
<AND>
|
||||
<NAME>.*:layout_marginBottom</NAME>
|
||||
<XML_ATTRIBUTE />
|
||||
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
|
||||
</AND>
|
||||
</match>
|
||||
</rule>
|
||||
</section>
|
||||
<section>
|
||||
<rule>
|
||||
<match>
|
||||
<AND>
|
||||
<NAME>.*:layout_marginStart</NAME>
|
||||
<XML_ATTRIBUTE />
|
||||
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
|
||||
</AND>
|
||||
</match>
|
||||
</rule>
|
||||
</section>
|
||||
<section>
|
||||
<rule>
|
||||
<match>
|
||||
<AND>
|
||||
<NAME>.*:layout_marginEnd</NAME>
|
||||
<XML_ATTRIBUTE />
|
||||
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
|
||||
</AND>
|
||||
</match>
|
||||
</rule>
|
||||
</section>
|
||||
<section>
|
||||
<rule>
|
||||
<match>
|
||||
<AND>
|
||||
<NAME>.*:layout_marginLeft</NAME>
|
||||
<XML_ATTRIBUTE />
|
||||
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
|
||||
</AND>
|
||||
</match>
|
||||
</rule>
|
||||
</section>
|
||||
<section>
|
||||
<rule>
|
||||
<match>
|
||||
<AND>
|
||||
<NAME>.*:layout_marginRight</NAME>
|
||||
<XML_ATTRIBUTE />
|
||||
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
|
||||
</AND>
|
||||
</match>
|
||||
</rule>
|
||||
</section>
|
||||
<section>
|
||||
<rule>
|
||||
<match>
|
||||
<AND>
|
||||
<NAME>.*:layout_.*</NAME>
|
||||
<XML_ATTRIBUTE />
|
||||
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
|
||||
</AND>
|
||||
</match>
|
||||
<order>BY_NAME</order>
|
||||
</rule>
|
||||
</section>
|
||||
<section>
|
||||
<rule>
|
||||
<match>
|
||||
<AND>
|
||||
<NAME>.*:padding</NAME>
|
||||
<XML_ATTRIBUTE />
|
||||
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
|
||||
</AND>
|
||||
</match>
|
||||
</rule>
|
||||
</section>
|
||||
<section>
|
||||
<rule>
|
||||
<match>
|
||||
<AND>
|
||||
<NAME>.*:paddingTop</NAME>
|
||||
<XML_ATTRIBUTE />
|
||||
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
|
||||
</AND>
|
||||
</match>
|
||||
</rule>
|
||||
</section>
|
||||
<section>
|
||||
<rule>
|
||||
<match>
|
||||
<AND>
|
||||
<NAME>.*:paddingBottom</NAME>
|
||||
<XML_ATTRIBUTE />
|
||||
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
|
||||
</AND>
|
||||
</match>
|
||||
</rule>
|
||||
</section>
|
||||
<section>
|
||||
<rule>
|
||||
<match>
|
||||
<AND>
|
||||
<NAME>.*:paddingStart</NAME>
|
||||
<XML_ATTRIBUTE />
|
||||
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
|
||||
</AND>
|
||||
</match>
|
||||
</rule>
|
||||
</section>
|
||||
<section>
|
||||
<rule>
|
||||
<match>
|
||||
<AND>
|
||||
<NAME>.*:paddingEnd</NAME>
|
||||
<XML_ATTRIBUTE />
|
||||
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
|
||||
</AND>
|
||||
</match>
|
||||
</rule>
|
||||
</section>
|
||||
<section>
|
||||
<rule>
|
||||
<match>
|
||||
<AND>
|
||||
<NAME>.*:paddingLeft</NAME>
|
||||
<XML_ATTRIBUTE />
|
||||
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
|
||||
</AND>
|
||||
</match>
|
||||
</rule>
|
||||
</section>
|
||||
<section>
|
||||
<rule>
|
||||
<match>
|
||||
<AND>
|
||||
<NAME>.*:paddingRight</NAME>
|
||||
<XML_ATTRIBUTE />
|
||||
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
|
||||
</AND>
|
||||
</match>
|
||||
</rule>
|
||||
</section>
|
||||
<section>
|
||||
<rule>
|
||||
<match>
|
||||
<AND>
|
||||
<NAME>.*</NAME>
|
||||
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
|
||||
</AND>
|
||||
</match>
|
||||
<order>BY_NAME</order>
|
||||
</rule>
|
||||
</section>
|
||||
<section>
|
||||
<rule>
|
||||
<match>
|
||||
<AND>
|
||||
<NAME>.*</NAME>
|
||||
<XML_NAMESPACE>http://schemas.android.com/apk/res-auto</XML_NAMESPACE>
|
||||
</AND>
|
||||
</match>
|
||||
<order>BY_NAME</order>
|
||||
</rule>
|
||||
</section>
|
||||
<section>
|
||||
<rule>
|
||||
<match>
|
||||
<AND>
|
||||
<NAME>.*</NAME>
|
||||
<XML_NAMESPACE>http://schemas.android.com/tools</XML_NAMESPACE>
|
||||
</AND>
|
||||
</match>
|
||||
<order>BY_NAME</order>
|
||||
</rule>
|
||||
</section>
|
||||
<section>
|
||||
<rule>
|
||||
<match>
|
||||
<AND>
|
||||
<NAME>.*</NAME>
|
||||
<XML_NAMESPACE>.*</XML_NAMESPACE>
|
||||
</AND>
|
||||
</match>
|
||||
<order>BY_NAME</order>
|
||||
</rule>
|
||||
</section>
|
||||
</rules>
|
||||
</arrangement>
|
||||
</codeStyleSettings>
|
||||
<codeStyleSettings language="protobuf">
|
||||
<option name="RIGHT_MARGIN" value="80" />
|
||||
<indentOptions>
|
||||
<option name="CONTINUATION_INDENT_SIZE" value="2" />
|
||||
</indentOptions>
|
||||
</codeStyleSettings>
|
||||
</code_scheme>
|
||||
</component>
|
85
.idea/jarRepositories.xml
Normal file
85
.idea/jarRepositories.xml
Normal file
|
@ -0,0 +1,85 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="RemoteRepositoriesConfiguration">
|
||||
<remote-repository>
|
||||
<option name="id" value="central" />
|
||||
<option name="name" value="Maven Central repository" />
|
||||
<option name="url" value="https://repo1.maven.org/maven2" />
|
||||
</remote-repository>
|
||||
<remote-repository>
|
||||
<option name="id" value="jboss.community" />
|
||||
<option name="name" value="JBoss Community repository" />
|
||||
<option name="url" value="https://repository.jboss.org/nexus/content/repositories/public/" />
|
||||
</remote-repository>
|
||||
<remote-repository>
|
||||
<option name="id" value="maven8" />
|
||||
<option name="name" value="maven8" />
|
||||
<option name="url" value="https://repo.maven.apache.org/maven2/" />
|
||||
</remote-repository>
|
||||
<remote-repository>
|
||||
<option name="id" value="maven4" />
|
||||
<option name="name" value="maven4" />
|
||||
<option name="url" value="https://s01.oss.sonatype.org/content/repositories/snapshots/" />
|
||||
</remote-repository>
|
||||
<remote-repository>
|
||||
<option name="id" value="paperweightDecompilerRepository" />
|
||||
<option name="name" value="paperweightDecompilerRepository" />
|
||||
<option name="url" value="https://repo.papermc.io/repository/maven-public/" />
|
||||
</remote-repository>
|
||||
<remote-repository>
|
||||
<option name="id" value="PaperMc" />
|
||||
<option name="name" value="PaperMc" />
|
||||
<option name="url" value="https://papermc.io/repo/repository/maven-public/" />
|
||||
</remote-repository>
|
||||
<remote-repository>
|
||||
<option name="id" value="PlaceHolderApi" />
|
||||
<option name="name" value="PlaceHolderApi" />
|
||||
<option name="url" value="https://repo.extendedclip.com/content/repositories/placeholderapi/" />
|
||||
</remote-repository>
|
||||
<remote-repository>
|
||||
<option name="id" value="maven3" />
|
||||
<option name="name" value="maven3" />
|
||||
<option name="url" value="https://repo.dmulloy2.net/repository/public/" />
|
||||
</remote-repository>
|
||||
<remote-repository>
|
||||
<option name="id" value="MavenLocal" />
|
||||
<option name="name" value="MavenLocal" />
|
||||
<option name="url" value="file:$MAVEN_REPOSITORY$/" />
|
||||
</remote-repository>
|
||||
<remote-repository>
|
||||
<option name="id" value="Citizens" />
|
||||
<option name="name" value="Citizens" />
|
||||
<option name="url" value="https://repo.citizensnpcs.co/" />
|
||||
</remote-repository>
|
||||
<remote-repository>
|
||||
<option name="id" value="maven2" />
|
||||
<option name="name" value="maven2" />
|
||||
<option name="url" value="https://oss.sonatype.org/content/groups/public/" />
|
||||
</remote-repository>
|
||||
<remote-repository>
|
||||
<option name="id" value="maven6" />
|
||||
<option name="name" value="maven6" />
|
||||
<option name="url" value="https://repo.onarandombox.com/content/groups/public/" />
|
||||
</remote-repository>
|
||||
<remote-repository>
|
||||
<option name="id" value="maven" />
|
||||
<option name="name" value="maven" />
|
||||
<option name="url" value="https://jitpack.io" />
|
||||
</remote-repository>
|
||||
<remote-repository>
|
||||
<option name="id" value="EssentialsX" />
|
||||
<option name="name" value="EssentialsX" />
|
||||
<option name="url" value="https://repo.essentialsx.net/releases/" />
|
||||
</remote-repository>
|
||||
<remote-repository>
|
||||
<option name="id" value="CodeMC" />
|
||||
<option name="name" value="CodeMC" />
|
||||
<option name="url" value="https://repo.codemc.org/repository/maven-public/" />
|
||||
</remote-repository>
|
||||
<remote-repository>
|
||||
<option name="id" value="Worldedit" />
|
||||
<option name="name" value="Worldedit" />
|
||||
<option name="url" value="https://maven.enginehub.org/repo/" />
|
||||
</remote-repository>
|
||||
</component>
|
||||
</project>
|
13
.idea/misc.xml
Normal file
13
.idea/misc.xml
Normal file
|
@ -0,0 +1,13 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="EntryPointsManager">
|
||||
<list size="1">
|
||||
<item index="0" class="java.lang.String" itemvalue="org.bukkit.event.EventHandler" />
|
||||
</list>
|
||||
</component>
|
||||
<component name="ExternalStorageConfigurationManager" enabled="true" />
|
||||
<component name="FrameworkDetectionExcludesConfiguration">
|
||||
<file type="web" url="file://$PROJECT_DIR$" />
|
||||
</component>
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_17" default="true" project-jdk-name="17" project-jdk-type="JavaSDK" />
|
||||
</project>
|
9
.idea/modules.xml
Normal file
9
.idea/modules.xml
Normal file
|
@ -0,0 +1,9 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/.idea/modules/raxen.main.iml" filepath="$PROJECT_DIR$/.idea/modules/raxen.main.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/.idea/modules/raxen.test.iml" filepath="$PROJECT_DIR$/.idea/modules/raxen.test.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>
|
6
.idea/vcs.xml
Normal file
6
.idea/vcs.xml
Normal file
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="" vcs="Git" />
|
||||
</component>
|
||||
</project>
|
10
.prettierrc.yml
Normal file
10
.prettierrc.yml
Normal file
|
@ -0,0 +1,10 @@
|
|||
# Prettier configuration
|
||||
overrides:
|
||||
- files:
|
||||
- "*.java"
|
||||
options:
|
||||
printWidth: 80
|
||||
tabWidth: 4
|
||||
useTabs: false
|
||||
trailingComma: "none"
|
||||
endOfLine: "lf"
|
|
@ -28,9 +28,10 @@ pipeline:
|
|||
- api_key
|
||||
commands:
|
||||
- export PRERELEASE=true
|
||||
- cd scripts
|
||||
- chmod +x git_release.py
|
||||
- pip install giteapy
|
||||
- python git_release.py --token "$API_KEY" --message "${DRONE_COMMIT_MESSAGE}" --prerelease $PRERELEASE --tag "${DRONE_TAG}"
|
||||
- python git_release.py --token "$API_KEY" --message "${CI_COMMIT_MESSAGE}" --prerelease $PRERELEASE --tag "${CI_COMMIT_TAG}"
|
||||
when:
|
||||
event: tag
|
||||
|
||||
|
|
14
README.md
14
README.md
|
@ -1,4 +1,5 @@
|
|||
# Raxen [![Build Status](https://drone.unurled.me/api/badges/Elixium/Raxen/status.svg)](https://drone.unurled.me/Elixium/Raxen)
|
||||
# Raxen [![Build Status](https://ci.unurled.me/api/badges/Elixium/Raxen/status.svg)](https://drone.unurled.me/Elixium/Raxen)
|
||||
|
||||
Project made by unurled.
|
||||
|
||||
Minecraft Plugin that do multiple stuff. (cutsom items, custom mobs...)
|
||||
|
@ -13,14 +14,19 @@ Minecraft Plugin that do multiple stuff. (cutsom items, custom mobs...)
|
|||
|
||||
no build and no running info atm.
|
||||
|
||||
to use custom texture for items, modify the custom data model => [Example](https://www.youtube.com/watch?v=XGxn_Mb8VzI)
|
||||
to use custom texture for items, modify the custom data
|
||||
model => [Example](https://www.youtube.com/watch?v=XGxn_Mb8VzI)
|
||||
|
||||
for more info contact me.
|
||||
@unurled#0149\
|
||||
or create an [issue](https://git.unurled.me/Elixium/Raxen/issues/new)
|
||||
|
||||
custom Items uses custom model data to work => need to update in model/item/item.json [Example](https://github.com/elBukkit/MagicPlugin/wiki/ResourcePack#customizing)
|
||||
|
||||
see [Examples](/Elixium/raxen/docs/examples) for some config examples
|
||||
model/item/item.json [Example](https://github.com/elBukkit/MagicPlugin/wiki/ResourcePack#customizing)
|
||||
custom Items uses custom model data to work => need to update in
|
||||
|
||||
## Developing
|
||||
|
||||
you can see [TODO.md](/Elixium/raxen/src/branch/plugin/docs/TODO.md) in which I did a list of what we must do
|
||||
you can see [TODO.md](/Elixium/raxen/src/branch/plugin/docs/TODO.md) in which I did a list of what
|
||||
we must do
|
69
build.gradle
69
build.gradle
|
@ -7,6 +7,7 @@ plugins {
|
|||
|
||||
apply plugin: "java"
|
||||
apply plugin: "io.papermc.paperweight.userdev"
|
||||
apply plugin: "com.github.johnrengelman.shadow"
|
||||
|
||||
repositories {
|
||||
mavenLocal()
|
||||
|
@ -48,41 +49,48 @@ repositories {
|
|||
maven {
|
||||
url = "https://repo.onarandombox.com/content/groups/public/"
|
||||
}
|
||||
maven {
|
||||
name = "Worldedit"
|
||||
url = 'https://maven.enginehub.org/repo/'
|
||||
}
|
||||
mavenCentral()
|
||||
}
|
||||
|
||||
dependencies {
|
||||
// lombok stuff
|
||||
implementation 'org.projectlombok:lombok:1.18.24'
|
||||
annotationProcessor 'org.projectlombok:lombok:1.18.24'
|
||||
testCompileOnly 'org.projectlombok:lombok:1.18.24'
|
||||
implementation 'org.projectlombok:lombok:1.18.26'
|
||||
annotationProcessor 'org.projectlombok:lombok:1.18.26'
|
||||
testCompileOnly 'org.projectlombok:lombok:1.18.26'
|
||||
|
||||
implementation 'org.apache.httpcomponents:httpclient:4.5.13'
|
||||
implementation 'org.apache.httpcomponents:httpmime:4.5.13'
|
||||
|
||||
// mongo stuff
|
||||
implementation 'org.mongodb:mongodb-driver-sync:4.7.2'
|
||||
implementation 'org.mongodb:bson:4.7.2'
|
||||
implementation 'org.mongodb:mongodb-driver-core:4.7.2'
|
||||
implementation 'org.mongodb:mongodb-driver-sync:4.9.1'
|
||||
implementation 'org.mongodb:bson:4.9.1'
|
||||
implementation 'org.mongodb:mongodb-driver-core:4.9.1'
|
||||
|
||||
implementation 'redis.clients:jedis:4.3.1'
|
||||
|
||||
compileOnly 'io.papermc.paper:paper-api:1.19.4-R0.1-SNAPSHOT'
|
||||
implementation 'de.tr7zw:item-nbt-api-plugin:2.11.2'
|
||||
// compileOnly 'de.tr7zw:item-nbt-api:2.11.2'
|
||||
compileOnly 'com.comphenix.protocol:ProtocolLib:4.8.0'
|
||||
compileOnly 'net.luckperms:api:5.4'
|
||||
compileOnly 'com.comphenix.protocol:ProtocolLib:5.0.0'
|
||||
compileOnly 'com.github.MilkBowl:VaultAPI:1.7.1'
|
||||
compileOnly 'net.essentialsx:EssentialsX:2.19.7'
|
||||
//compileOnly 'com.fastasyncworldedit:FastAsyncWorldEdit-Core:2.3.0'
|
||||
//compileOnly 'com.fastasyncworldedit:FastAsyncWorldEdit-Bukkit:2.3.0'
|
||||
compileOnly 'me.clip:placeholderapi:2.11.2'
|
||||
compileOnly 'com.sk89q.worldedit:worldedit-core:7.2.14'
|
||||
compileOnly 'com.sk89q.worldedit:worldedit-bukkit:7.2.14'
|
||||
compileOnly 'me.clip:placeholderapi:2.11.3'
|
||||
compileOnly('net.citizensnpcs:citizens-main:2.0.31-SNAPSHOT') {
|
||||
exclude group: '*', module: '*'
|
||||
}
|
||||
compileOnly 'com.onarandombox.multiversecore:Multiverse-Core:4.3.1'
|
||||
// compileOnly 'me.filoghost.holographicdisplays:holographicdisplays-api:3.0.1'
|
||||
// compileOnly fileTree(dir: 'libs', include: '*.jar')
|
||||
implementation 'com.github.decentsoftware-eu:decentholograms:2.8.1'
|
||||
paperweightDevelopmentBundle("io.papermc.paper:dev-bundle:1.19.4-R0.1-SNAPSHOT")
|
||||
}
|
||||
|
||||
group = 'me.unurled'
|
||||
version = '0.5.7'
|
||||
version = '0.6.0'
|
||||
description = 'Raxen'
|
||||
|
||||
java {
|
||||
|
@ -91,19 +99,10 @@ java {
|
|||
}
|
||||
}
|
||||
|
||||
publishing {
|
||||
publications {
|
||||
maven(MavenPublication) {
|
||||
from(components.java)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
tasks.withType(JavaCompile) {
|
||||
options.encoding = 'UTF-8'
|
||||
options.release = 17
|
||||
options.compilerArgs += ["-Xlint:unchecked", "-Xlint:deprecation"]
|
||||
|
||||
}
|
||||
|
||||
tasks {
|
||||
|
@ -119,16 +118,34 @@ shadowJar {
|
|||
dependencies {
|
||||
include dependency('de.tr7zw:item-nbt-api-plugin:2.11.2')
|
||||
include dependency('de.tr7zw:item-nbt-api:2.11.2')
|
||||
include dependency('org.mongodb:mongodb-driver-sync:4.7.2')
|
||||
include dependency('org.mongodb:bson:4.7.2')
|
||||
include dependency('org.mongodb:mongodb-driver-core:4.7.2')
|
||||
include dependency('org.mongodb:mongodb-driver-sync:4.9.1')
|
||||
include dependency('org.mongodb:bson:4.9.1')
|
||||
include dependency('org.mongodb:mongodb-driver-core:4.9.1')
|
||||
include dependency('com.github.decentsoftware-eu:decentholograms:2.8.1')
|
||||
include dependency('org.apache.httpcomponents:httpclient:4.5.13')
|
||||
include dependency('org.apache.httpcomponents:httpmime:4.5.13')
|
||||
include dependency('redis.clients:jedis:4.3.1')
|
||||
}
|
||||
relocate("de.tr7zw", "me.unurled.libs.de.tr7zw")
|
||||
relocate("com.mongodb", 'me.unurled.libs.com.mongodb')
|
||||
relocate("org.bson", 'me.unurled.libs.org.bson')
|
||||
relocate('eu.decentsoftware', 'me.unurled.libs.eu.decentsoftware')
|
||||
relocate('org.apache', 'me.unurled.libs.org.apache')
|
||||
relocate('redis.clients', 'me.unurled.libs.redis.clients')
|
||||
processResources {
|
||||
expand version: project.version
|
||||
}
|
||||
minimize()
|
||||
}
|
||||
|
||||
sourceSets {
|
||||
main {
|
||||
resources {
|
||||
srcDirs = ['src/main/resources']
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
processResources {
|
||||
exclude '**/*.schem'
|
||||
}
|
|
@ -9,18 +9,25 @@ Some RPG thing :
|
|||
- Raxen must do :
|
||||
- some survival and RPG(Class) thing
|
||||
- need some sort of action => pve, pvp maybe ?
|
||||
- need custom mobs => some are made => not definitive need more => ~~juste made the damage system and persistentdatacontainer on entities outside of Player, might consider to switch to persistentdatacontainer on player instead of having an hashmap (ProfileManager.java)~~ already done
|
||||
- need custom mobs => some are made => not definitive need more => ~~juste made the damage
|
||||
system and persistentdatacontainer on entities outside of Player, might consider to switch to
|
||||
persistentdatacontainer on player instead of having an hashmap (ProfileManager.java)~~ already
|
||||
done
|
||||
- need custom items => partialy made => need custom resource pack support
|
||||
- can use custom texture pack => in making
|
||||
- protection and logging feature => coreprotect
|
||||
- solo leveling inspired thing with player being mc of his onw world, can do side quest with every1, and can make a party to play, max of 4?:
|
||||
- solo leveling inspired thing with player being mc of his onw world, can do side quest with
|
||||
every1, and can make a party to play, max of 4?, more player means more difficulty:
|
||||
- Gates:
|
||||
- power: ranked from F, E, D, C, B, A, S, SS, SSS, world, unbeatable and so on
|
||||
- Dungunes:
|
||||
- differents types => labirynth, graves,abandoned castle, openfiled like jungles, forest, plains => all of them with night variant and many days to complete
|
||||
- differents types => labirynth, graves,abandoned castle, openfiled like jungles,
|
||||
forest, plains => all of them with night variant and many days to complete
|
||||
- Monster:
|
||||
- basic isekai manga sort of monster and also high leveled op monster king of something => bosses
|
||||
- basic isekai manga sort of monster and also high leveled op monster king of
|
||||
something => bosses
|
||||
- outbreak if gate isn't closed in time
|
||||
- loots:
|
||||
- items of different rarities with multiple purpose => medicinal, combat related types, defensive etc...
|
||||
- items of different rarities with multiple purpose => medicinal, combat related
|
||||
types, defensive etc...
|
||||
- leveling system for the player
|
48
docs/TODO.md
48
docs/TODO.md
|
@ -1,8 +1,42 @@
|
|||
- [x] refactor all abilities to make them compatible between entities and also making it easier to add them.
|
||||
- [ ] make custom items (hard coded)
|
||||
- [ ] make custom class (hard coded)
|
||||
- [ ] make custom abilities (hard coded)
|
||||
- [ ] make custom mods (hard coded)
|
||||
- [ ] make gates
|
||||
- [ ] a map
|
||||
- [x] refactor all abilities to make them compatible between entities and also making it easier to
|
||||
add them.
|
||||
- [ ] make custom items (hard coded) / or all in db/json in Raxen plugin folder (like a serialized
|
||||
version of it)
|
||||
- [ ] custom items effects (hard coded) / or all in db/json in Raxen plugin (have some sort of
|
||||
serliazed
|
||||
version of it)
|
||||
- [ ] make custom class (hard coded) / or all in db/json in Raxen plugin (have some sort of
|
||||
serliazed
|
||||
version of it)
|
||||
- [ ] make custom abilities/skills (hard coded) / or all in db/json in Raxen plugin (can't have a
|
||||
separate
|
||||
file, must be in java files)
|
||||
- [ ] make custom mods (hard coded) / or all in db/json in Raxen plugin (can have some of the infos
|
||||
in db/json but not all)
|
||||
- [ ] make gates (appears randomly in the world)
|
||||
- [ ] a map (more wynncrafty than hypixel + dynnmap/bettermap)
|
||||
- [ ] a leveling system
|
||||
- [ ] spells (hard coded)
|
||||
- [-] party
|
||||
- [ ] boss monster
|
||||
- [ ] guilds
|
||||
- [ ] quests (hard coded) and db/json
|
||||
- [ ] filter chat
|
||||
- [ ] resource pack (host, upload, compress)
|
||||
|
||||
## tests
|
||||
|
||||
- [ ] party
|
||||
- [ ] combat
|
||||
- [ ] class
|
||||
- [ ] items
|
||||
- [ ] item effects
|
||||
- [ ] mobs
|
||||
- [ ] skills
|
||||
- [ ] abilities
|
||||
- [ ] gates
|
||||
- [ ] leveling system
|
||||
- [ ] spells
|
||||
- [ ] boss monster
|
||||
- [ ] quests
|
||||
- [ ] filter chat
|
||||
|
|
17
docs/examples/Effects.md
Normal file
17
docs/examples/Effects.md
Normal file
|
@ -0,0 +1,17 @@
|
|||
# Effects
|
||||
|
||||
### Simple Effects
|
||||
|
||||
this is an example of a simple effect, it will spawn an armor stand with an item in its hand, for 1
|
||||
duration then will change to the second item, after 4 delay it will remove the armor stand
|
||||
|
||||
```yaml
|
||||
testEffect:
|
||||
type: armor_stand
|
||||
Pose:
|
||||
RightArm: 0, 0, 0
|
||||
effects:
|
||||
- item=testItem_1:0;delay=0;duration=1
|
||||
- item=testItem_2:0;delay=3;duration=1
|
||||
- remove;delay=4
|
||||
```
|
12
docs/examples/Glyphs.md
Normal file
12
docs/examples/Glyphs.md
Normal file
|
@ -0,0 +1,12 @@
|
|||
# Glyphs
|
||||
|
||||
this is an example of a simple glyph
|
||||
|
||||
```yaml
|
||||
testGlyph:
|
||||
Pack:
|
||||
model: raxen/testGlyph
|
||||
texture: raxen/testGlyph
|
||||
char: "\uE000"
|
||||
placeholder: ":test:"
|
||||
```
|
21
docs/examples/Items.md
Normal file
21
docs/examples/Items.md
Normal file
|
@ -0,0 +1,21 @@
|
|||
# Items
|
||||
|
||||
## Simple Item
|
||||
|
||||
see an example of a simple item
|
||||
|
||||
```yaml
|
||||
testItem:
|
||||
Pack:
|
||||
custom_model_data: 1
|
||||
model: raxen/testItem
|
||||
display_name: '<aqua>Test Item'
|
||||
material: DIAMOND
|
||||
lore:
|
||||
- '<gray>Test Item'
|
||||
- '<gray>Custom Model Data: <aqua>1'
|
||||
enchantments:
|
||||
- 'DURABILITY:1'
|
||||
effect:
|
||||
- 'testEffect'
|
||||
```
|
32
docs/examples/Mobs.md
Normal file
32
docs/examples/Mobs.md
Normal file
|
@ -0,0 +1,32 @@
|
|||
# Mobs
|
||||
|
||||
```yaml
|
||||
testMob:
|
||||
type: ZOMBIE
|
||||
display_name: "<aqua>Test Mob"
|
||||
health: 20
|
||||
speed: 100
|
||||
damage_min: 1
|
||||
damage_max: 2
|
||||
options:
|
||||
show_health: true
|
||||
persistent: true
|
||||
despawn: true
|
||||
prevent_other_drops: true
|
||||
slient: true
|
||||
prevent_sunburn: true
|
||||
AI:
|
||||
target:
|
||||
- "NONE"
|
||||
- "PLAYER"
|
||||
goal:
|
||||
- "NONE"
|
||||
- "MOVE_TO_TARGET"
|
||||
- "ATTACK_TARGET"
|
||||
effect:
|
||||
- model=testModel ~spawn
|
||||
- sound=raxen:raxen.testSound;volume=1.0;pitch=1.0 ~timer:140 0.35
|
||||
- sound=raxen:raxen.testSoundDeath;volume=1.0;pitch=1.0 ~death
|
||||
- skill=testSkillDamage ~damaged
|
||||
- skill=
|
||||
```
|
10
docs/examples/README.md
Normal file
10
docs/examples/README.md
Normal file
|
@ -0,0 +1,10 @@
|
|||
# Exemples
|
||||
|
||||
see all the exemples in this folder :
|
||||
|
||||
to create any of the following, create a new file in the folder type of your choice (e.g. `
|
||||
plugins/Raxen/items/exampleItem.yml`)
|
||||
|
||||
- [Effects.md](/Elixium/raxen/src/branch/plugin/docs/examples/Effects.md)
|
||||
- [Items.md](/Elixium/raxen/src/branch/plugin/docs/examples/Items.md)
|
||||
- [Mobs.md](/Elixium/raxen/src/branch/plugin/docs/examples/Mobs.md)
|
3
scripts/.gitignore
vendored
Normal file
3
scripts/.gitignore
vendored
Normal file
|
@ -0,0 +1,3 @@
|
|||
node_modules/
|
||||
main.js
|
||||
package-lock.json
|
|
@ -23,10 +23,10 @@ owner = "Elixium"
|
|||
repo = "Raxen"
|
||||
body = giteapy.CreateReleaseOption(body=doc['message'], draft=False, name=doc['tag'], prerelease=doc['prerelease'], tag_name=doc['tag'], target_commitish="string")
|
||||
attachments = []
|
||||
for file in os.listdir(os.getcwd() +"/build/libs"):
|
||||
for file in os.listdir(os.getcwd() +"../build/libs"):
|
||||
if file.endswith('.jar'):
|
||||
if file.startswith('raxen'):
|
||||
attachments.append(os.getcwd() + '/build/libs/' + file)
|
||||
attachments.append(os.getcwd() + '../build/libs/' + file)
|
||||
print(attachments)
|
||||
attachment1 = attachments[0]
|
||||
attachment2 = attachments[1]
|
56
scripts/main.ts
Normal file
56
scripts/main.ts
Normal file
|
@ -0,0 +1,56 @@
|
|||
import { giteaApi, CreatePullReviewOptions } from 'gitea-js';
|
||||
import fetch from 'cross-fetch'; // You have to use a fetch compatible polyfill like cross-fetch for Node.JS
|
||||
import fs = require('fs');
|
||||
import path = require('path');
|
||||
|
||||
const api = giteaApi('https://git.unurled.me', {
|
||||
token: process.env.TOKEN,
|
||||
customFetch: fetch,
|
||||
});
|
||||
|
||||
const todo: { [file: string]: string[]} = {};
|
||||
|
||||
function searchTodo(file: string): void {
|
||||
let compteur = 0;
|
||||
const lines: string[] = fs.readFileSync(file, 'utf-8').split('\n');
|
||||
for (const line of lines) {
|
||||
compteur += 1;
|
||||
if (line.match(/[\S\s]*\btodo\b/i)) {
|
||||
if (file in todo) {
|
||||
todo[file].push(line.trim() + " (line " + compteur + ")");
|
||||
} else {
|
||||
todo[file] = [line.trim() + " (line " + compteur + ")"];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function searchTodoInDir(dir: string): void {
|
||||
fs.readdirSync(dir).forEach(file => {
|
||||
const filePath = path.join(dir, file);
|
||||
if (fs.statSync(filePath).isDirectory()) {
|
||||
searchTodoInDir(filePath);
|
||||
}
|
||||
if (file.endsWith(".java")) {
|
||||
searchTodo(filePath);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function searchTodoInProject(): void {
|
||||
const pwd = path.dirname(path.dirname(path.resolve(__filename)));
|
||||
searchTodoInDir(path.join(pwd, "src/main/java/me/unurled/raxen"));
|
||||
}
|
||||
|
||||
searchTodoInProject();
|
||||
|
||||
console.log();
|
||||
const index: number = Number.parseInt(process.env.CI_COMMIT_PULL_REQUEST);
|
||||
const body: CreatePullReviewOptions = {
|
||||
body: "# TODO that needs to be done by next big release :\n```json\n" + JSON.stringify(todo, null, "\t") + "\n```",
|
||||
commit_id: process.env.CI_COMMIT_SHA,
|
||||
};
|
||||
|
||||
const pr_review = api.repos.repoCreatePullReview(process.env.CI_REPO_OWNER, process.env.CI_REPO_NAME, index, body, {});
|
||||
pr_review.then(res => console.log(res)).catch(err => console.log(err));
|
20
scripts/package.json
Normal file
20
scripts/package.json
Normal file
|
@ -0,0 +1,20 @@
|
|||
{
|
||||
"name": "scripts",
|
||||
"version": "1.0.0",
|
||||
"description": "a script for pull request comment",
|
||||
"main": "main.js",
|
||||
"author": "unurled",
|
||||
"license": "MIT",
|
||||
"scripts": {
|
||||
"build": "tsc",
|
||||
"start": "node main.js"
|
||||
},
|
||||
"dependencies": {
|
||||
"cross-fetch": "^3.1.5",
|
||||
"gitea-js": "^1.19.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "^18.16.0",
|
||||
"typescript": "^5.0.4"
|
||||
}
|
||||
}
|
8
scripts/tsconfig.json
Normal file
8
scripts/tsconfig.json
Normal file
|
@ -0,0 +1,8 @@
|
|||
{
|
||||
"compilerOptions": {
|
||||
"module": "CommonJS"
|
||||
},
|
||||
"files": [
|
||||
"main.ts"
|
||||
]
|
||||
}
|
|
@ -20,7 +20,7 @@ public final class Raxen extends JavaPlugin {
|
|||
"<aqua>Rx</aqua><light_purple>></light_purple> ";
|
||||
|
||||
@Getter
|
||||
private static String version = "0.5.7";
|
||||
private static String version = "0.6.0";
|
||||
|
||||
private boolean loading = true;
|
||||
private final PluginManager pm = getServer().getPluginManager();
|
||||
|
@ -66,7 +66,9 @@ public final class Raxen extends JavaPlugin {
|
|||
Bukkit
|
||||
.getConsoleSender()
|
||||
.sendMessage(
|
||||
colorComp(prefix + "<green>Server Started Successfully!</green>")
|
||||
colorComp(
|
||||
prefix + "<green>Server Started Successfully!</green>"
|
||||
)
|
||||
);
|
||||
|
||||
manager.getListenerManager().getServerPingEvent().setLoading(false);
|
||||
|
@ -81,7 +83,9 @@ public final class Raxen extends JavaPlugin {
|
|||
|
||||
Bukkit
|
||||
.getConsoleSender()
|
||||
.sendMessage(colorComp(prefix + "<green>Commands Registered!</green>"));
|
||||
.sendMessage(
|
||||
colorComp(prefix + "<green>Commands Registered!</green>")
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -92,7 +96,9 @@ public final class Raxen extends JavaPlugin {
|
|||
|
||||
Bukkit
|
||||
.getConsoleSender()
|
||||
.sendMessage(colorComp(prefix + "<green>Events Registered!</green>"));
|
||||
.sendMessage(
|
||||
colorComp(prefix + "<green>Events Registered!</green>")
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -107,6 +113,8 @@ public final class Raxen extends JavaPlugin {
|
|||
playerConfig.close();
|
||||
}
|
||||
|
||||
// save tutorial state
|
||||
|
||||
Bukkit
|
||||
.getConsoleSender()
|
||||
.sendMessage(
|
||||
|
@ -116,6 +124,7 @@ public final class Raxen extends JavaPlugin {
|
|||
|
||||
/**
|
||||
* getter for the logger
|
||||
*
|
||||
* @return the plugin logger
|
||||
*/
|
||||
public Logger getPluginLogger() {
|
||||
|
@ -124,6 +133,7 @@ public final class Raxen extends JavaPlugin {
|
|||
|
||||
/**
|
||||
* getter for the bukkit's plugin manager
|
||||
*
|
||||
* @return plugin manager
|
||||
*/
|
||||
public PluginManager getPm() {
|
||||
|
@ -132,6 +142,7 @@ public final class Raxen extends JavaPlugin {
|
|||
|
||||
/**
|
||||
* return the instance which is launched.
|
||||
*
|
||||
* @return main instance
|
||||
*/
|
||||
public Raxen getPlugin() {
|
||||
|
@ -140,6 +151,7 @@ public final class Raxen extends JavaPlugin {
|
|||
|
||||
/**
|
||||
* getter for the raxen prefix
|
||||
*
|
||||
* @return string prefix
|
||||
*/
|
||||
public static String getPrefix() {
|
||||
|
@ -148,6 +160,7 @@ public final class Raxen extends JavaPlugin {
|
|||
|
||||
/**
|
||||
* getter for the yml's player configs.
|
||||
*
|
||||
* @return player config instance
|
||||
*/
|
||||
public PlayerConfig getPlayerConfig() {
|
||||
|
@ -156,6 +169,7 @@ public final class Raxen extends JavaPlugin {
|
|||
|
||||
/**
|
||||
* getter for an instance of the config utility class
|
||||
*
|
||||
* @return raxen's config
|
||||
*/
|
||||
public Config getConf() {
|
||||
|
|
|
@ -1,6 +1,12 @@
|
|||
package me.unurled.raxen.commands;
|
||||
|
||||
import static me.unurled.raxen.utils.Utils.*;
|
||||
import static me.unurled.raxen.utils.Utils.colorComp;
|
||||
import static me.unurled.raxen.utils.Utils.colorTextComp;
|
||||
import static me.unurled.raxen.utils.Utils.coloredString;
|
||||
import static me.unurled.raxen.utils.Utils.debug;
|
||||
import static me.unurled.raxen.utils.Utils.msgPlayer;
|
||||
import static me.unurled.raxen.utils.Utils.msgSender;
|
||||
import static me.unurled.raxen.utils.Utils.stringToComp;
|
||||
|
||||
import java.util.List;
|
||||
import me.unurled.raxen.Raxen;
|
||||
|
@ -61,7 +67,10 @@ public class RaxenCommand implements TabExecutor {
|
|||
"<gold>---------------------------------------------"
|
||||
)
|
||||
);
|
||||
msgPlayer(player, colorTextComp("<red>MONGO DB<white>"));
|
||||
msgPlayer(
|
||||
player,
|
||||
colorTextComp("<red>MONGO DB<white>")
|
||||
);
|
||||
msgPlayer(
|
||||
player,
|
||||
StorageManager
|
||||
|
@ -72,7 +81,10 @@ public class RaxenCommand implements TabExecutor {
|
|||
);
|
||||
msgPlayer(
|
||||
player,
|
||||
StorageManager.getMongodb().getMongoDatabase().getName()
|
||||
StorageManager
|
||||
.getMongodb()
|
||||
.getMongoDatabase()
|
||||
.getName()
|
||||
);
|
||||
msgPlayer(
|
||||
player,
|
||||
|
@ -112,7 +124,9 @@ public class RaxenCommand implements TabExecutor {
|
|||
);
|
||||
sender.sendMessage(txt);
|
||||
sender.sendMessage(
|
||||
colorComp("<gold>---------------------------------------------")
|
||||
colorComp(
|
||||
"<gold>---------------------------------------------"
|
||||
)
|
||||
);
|
||||
return true;
|
||||
}
|
||||
|
@ -138,7 +152,10 @@ public class RaxenCommand implements TabExecutor {
|
|||
);
|
||||
sender.sendMessage(
|
||||
stringToComp(
|
||||
StorageManager.getMongodb().getMongoDatabase().getName()
|
||||
StorageManager
|
||||
.getMongodb()
|
||||
.getMongoDatabase()
|
||||
.getName()
|
||||
)
|
||||
);
|
||||
sender.sendMessage(
|
||||
|
@ -162,7 +179,8 @@ public class RaxenCommand implements TabExecutor {
|
|||
case "v", "version", "ver" -> {
|
||||
msgSender(
|
||||
sender,
|
||||
Raxen.getPrefix() + "<gold>Printing About Raxen...",
|
||||
Raxen.getPrefix() +
|
||||
"<gold>Printing About Raxen...",
|
||||
"<gold>---------------------------------------------",
|
||||
"<dark_aqua> Raxen ",
|
||||
"<dark_aqua> - Version: " + Raxen.getVersion(),
|
||||
|
@ -173,12 +191,13 @@ public class RaxenCommand implements TabExecutor {
|
|||
);
|
||||
sender.sendMessage(txt);
|
||||
sender.sendMessage(
|
||||
colorComp("<gold>---------------------------------------------")
|
||||
colorComp(
|
||||
"<gold>---------------------------------------------"
|
||||
)
|
||||
);
|
||||
return true;
|
||||
}
|
||||
case "hemlp", "?", "h" -> //print help
|
||||
debug(main, "print help");
|
||||
case "hemlp", "?", "h" -> debug(main, "print help"); //print help
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
108
src/main/java/me/unurled/raxen/commands/admin/BuildCommand.java
Normal file
108
src/main/java/me/unurled/raxen/commands/admin/BuildCommand.java
Normal file
|
@ -0,0 +1,108 @@
|
|||
package me.unurled.raxen.commands.admin;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import me.unurled.raxen.Raxen;
|
||||
import me.unurled.raxen.utils.Utils;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.command.TabExecutor;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public class BuildCommand implements TabExecutor {
|
||||
|
||||
private Raxen raxen;
|
||||
|
||||
List<String> complete = new ArrayList<>();
|
||||
|
||||
public BuildCommand(Raxen raxen) {
|
||||
this.raxen = raxen;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command,
|
||||
@NotNull String label, @NotNull String[] args) {
|
||||
if (!(sender instanceof Player)) {
|
||||
Utils.errorConsoleSender(sender);
|
||||
return true;
|
||||
}
|
||||
Player p = (Player) sender;
|
||||
if (args.length == 0) {
|
||||
p.sendMessage(Utils.colorComp(
|
||||
"<reset><yellow>/build [discard|edit|hide|list|on|remove|save|show|tp]"));
|
||||
return true;
|
||||
}
|
||||
if (args.length == 1) {
|
||||
switch (args[0]) {
|
||||
case "discard":
|
||||
p.sendMessage(Utils.colorComp("<reset><yellow>Discarded build!"));
|
||||
return true;
|
||||
case "edit":
|
||||
p.sendMessage(Utils.colorComp("<reset><yellow>Editing build!"));
|
||||
return true;
|
||||
case "hide":
|
||||
p.sendMessage(Utils.colorComp("<reset><yellow>Hiding build!"));
|
||||
return true;
|
||||
case "list":
|
||||
p.sendMessage(Utils.colorComp("<reset><yellow>Listing builds!"));
|
||||
return true;
|
||||
case "on":
|
||||
p.sendMessage(Utils.colorComp("<reset><yellow>Build mode enabled!"));
|
||||
return true;
|
||||
case "remove":
|
||||
p.sendMessage(Utils.colorComp("<reset><yellow>Removed build!"));
|
||||
return true;
|
||||
case "save":
|
||||
p.sendMessage(Utils.colorComp("<reset><yellow>Saved build!"));
|
||||
return true;
|
||||
case "show":
|
||||
p.sendMessage(Utils.colorComp("<reset><yellow>Showing build!"));
|
||||
return true;
|
||||
case "tp":
|
||||
p.sendMessage(Utils.colorComp("<reset><yellow>Teleporting to build!"));
|
||||
return true;
|
||||
default:
|
||||
p.sendMessage(Utils.colorComp(
|
||||
"<reset><yellow>/build [discard|edit|hide|list|on|remove|save|show|tp]"));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public @Nullable List<String> onTabComplete(@NotNull CommandSender sender,
|
||||
@NotNull Command command, @NotNull String label, @NotNull String[] args) {
|
||||
if (complete.isEmpty()) {
|
||||
complete.add("discard");
|
||||
complete.add("edit");
|
||||
complete.add("hide");
|
||||
complete.add("list");
|
||||
complete.add("on");
|
||||
complete.add("remove");
|
||||
complete.add("save");
|
||||
complete.add("show");
|
||||
complete.add("tp");
|
||||
}
|
||||
List<String> result = new ArrayList<>();
|
||||
if (args.length == 1) {
|
||||
for (String s : complete) {
|
||||
if (s.toLowerCase().startsWith(args[0].toLowerCase())) {
|
||||
result.add(s);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
} else if (args.length == 2) {
|
||||
for (Player p : Bukkit.getOnlinePlayers()) {
|
||||
if (p.getName().toLowerCase().startsWith(args[1].toLowerCase())) {
|
||||
result.add(p.getName());
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
|
@ -1,7 +1,10 @@
|
|||
package me.unurled.raxen.commands.admin;
|
||||
|
||||
import static me.unurled.raxen.utils.Items.customModelData;
|
||||
import static me.unurled.raxen.utils.Utils.*;
|
||||
import static me.unurled.raxen.utils.Utils.colorComp;
|
||||
import static me.unurled.raxen.utils.Utils.errorConsoleSender;
|
||||
import static me.unurled.raxen.utils.Utils.isInt;
|
||||
import static me.unurled.raxen.utils.Utils.noPerms;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
|
@ -21,6 +24,7 @@ public class CustomModelDataCommand implements TabExecutor {
|
|||
|
||||
/**
|
||||
* change custom model data of an item
|
||||
*
|
||||
* @param sender Source of the command
|
||||
* @param command Command which was executed
|
||||
* @param label Alias of the command which was used
|
||||
|
@ -56,7 +60,10 @@ public class CustomModelDataCommand implements TabExecutor {
|
|||
Material material = Material.getMaterial(args[1]);
|
||||
if (material != null) {
|
||||
it =
|
||||
customModelData(new ItemStack(material), Integer.parseInt(args[0]));
|
||||
customModelData(
|
||||
new ItemStack(material),
|
||||
Integer.parseInt(args[0])
|
||||
);
|
||||
p.getInventory().setItemInMainHand(it);
|
||||
p.updateInventory();
|
||||
} else {
|
||||
|
@ -74,7 +81,9 @@ public class CustomModelDataCommand implements TabExecutor {
|
|||
p.updateInventory();
|
||||
} else {
|
||||
p.sendMessage(
|
||||
colorComp("<red>Get an item in hand please or specify an item</red>")
|
||||
colorComp(
|
||||
"<red>Get an item in hand please or specify an item</red>"
|
||||
)
|
||||
);
|
||||
p.sendMessage(
|
||||
colorComp(
|
||||
|
@ -87,13 +96,12 @@ public class CustomModelDataCommand implements TabExecutor {
|
|||
}
|
||||
|
||||
/**
|
||||
* @param sender Source of the command. For players tab-completing a
|
||||
* command inside of a command block, this will be the player, not
|
||||
* the command block.
|
||||
* @param sender Source of the command. For players tab-completing a command inside of a
|
||||
* command block, this will be the player, not the command block.
|
||||
* @param command Command which was executed
|
||||
* @param label Alias of the command which was used
|
||||
* @param args The arguments passed to the command, including final
|
||||
* partial argument to be completed
|
||||
* @param args The arguments passed to the command, including final partial argument to be
|
||||
* completed
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
package me.unurled.raxen.commands.admin;
|
||||
|
||||
import static me.unurled.raxen.utils.Utils.*;
|
||||
import static me.unurled.raxen.utils.Utils.colorString;
|
||||
import static me.unurled.raxen.utils.Utils.log;
|
||||
import static me.unurled.raxen.utils.Utils.msgPlayer;
|
||||
|
||||
import java.util.List;
|
||||
import lombok.Getter;
|
||||
|
@ -46,8 +48,15 @@ public class ItemListCommand implements TabExecutor {
|
|||
);
|
||||
return true;
|
||||
}
|
||||
int page = 1;
|
||||
if (args.length > 0) {
|
||||
try {
|
||||
page = Integer.parseInt(args[0]);
|
||||
} catch (NumberFormatException ignored) {
|
||||
}
|
||||
}
|
||||
//openGui logic
|
||||
player.openInventory(itemListGui.getInv());
|
||||
itemListGui.openInventory(player, page);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
package me.unurled.raxen.commands.admin;
|
||||
|
||||
import static me.unurled.raxen.utils.Items.itemTo64;
|
||||
import static me.unurled.raxen.utils.Utils.*;
|
||||
import static me.unurled.raxen.utils.Utils.errorConsoleSender;
|
||||
import static me.unurled.raxen.utils.Utils.msgPlayer;
|
||||
|
||||
import java.util.List;
|
||||
import org.bukkit.command.Command;
|
||||
|
@ -37,13 +38,12 @@ public class ItemTo64Command implements TabExecutor {
|
|||
}
|
||||
|
||||
/**
|
||||
* @param sender Source of the command. For players tab-completing a
|
||||
* command inside of a command block, this will be the player, not
|
||||
* the command block.
|
||||
* @param sender Source of the command. For players tab-completing a command inside of a
|
||||
* command block, this will be the player, not the command block.
|
||||
* @param command Command which was executed
|
||||
* @param label Alias of the command which was used
|
||||
* @param args The arguments passed to the command, including final
|
||||
* partial argument to be completed
|
||||
* @param args The arguments passed to the command, including final partial argument to be
|
||||
* completed
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
|
|
|
@ -1,7 +1,11 @@
|
|||
package me.unurled.raxen.commands.admin;
|
||||
|
||||
import static me.unurled.raxen.components.entity.player.PlayerUtils.updateSkills;
|
||||
import static me.unurled.raxen.utils.Utils.*;
|
||||
import static me.unurled.raxen.utils.Utils.colorString;
|
||||
import static me.unurled.raxen.utils.Utils.colorTextComp;
|
||||
import static me.unurled.raxen.utils.Utils.debug;
|
||||
import static me.unurled.raxen.utils.Utils.error;
|
||||
import static me.unurled.raxen.utils.Utils.msgPlayer;
|
||||
|
||||
import de.tr7zw.nbtapi.NBTItem;
|
||||
import java.util.ArrayList;
|
||||
|
@ -17,7 +21,6 @@ import org.bukkit.command.CommandSender;
|
|||
import org.bukkit.command.TabExecutor;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
|
@ -39,12 +42,19 @@ public class NbtCommand implements TabExecutor {
|
|||
if (!(sender instanceof Player player)) {
|
||||
error(
|
||||
(Raxen) Bukkit.getPluginManager().getPlugin("Raxen"),
|
||||
colorString("<red>You can't execute this command as the Console!")
|
||||
colorString(
|
||||
"<red>You can't execute this command as the Console!"
|
||||
)
|
||||
);
|
||||
return true;
|
||||
}
|
||||
if (player.getInventory().getItemInMainHand().getType() == Material.AIR) {
|
||||
msgPlayer(player, colorTextComp("<red>You must hold an Item in hand."));
|
||||
if (
|
||||
player.getInventory().getItemInMainHand().getType() == Material.AIR
|
||||
) {
|
||||
msgPlayer(
|
||||
player,
|
||||
colorTextComp("<red>You must hold an Item in hand.")
|
||||
);
|
||||
return true;
|
||||
} else {
|
||||
player.getInventory().getItemInMainHand();
|
||||
|
@ -58,9 +68,9 @@ public class NbtCommand implements TabExecutor {
|
|||
debug("'" + args[0] + "'", "'" + args[1] + "'");
|
||||
ItemStack it = player.getInventory().getItemInMainHand();
|
||||
NBTItem nbti = new NBTItem(it);
|
||||
int a = 0;
|
||||
String a = "";
|
||||
if (nbti.hasTag(args[0])) {
|
||||
a = nbti.getInteger(args[0]);
|
||||
a = nbti.getString(args[0]);
|
||||
}
|
||||
List<Component> lore = new ArrayList<>();
|
||||
// ItemMeta itm = it.getItemMeta();
|
||||
|
@ -93,7 +103,14 @@ public class NbtCommand implements TabExecutor {
|
|||
)
|
||||
).getManager()
|
||||
.getPlayerManager();
|
||||
nbti.setInteger(args[0], Integer.parseInt(args[1]) + a);
|
||||
try {
|
||||
nbti.setInteger(
|
||||
args[0],
|
||||
Integer.parseInt(args[1]) + Integer.parseInt(a)
|
||||
);
|
||||
} catch (NumberFormatException ignored) {
|
||||
nbti.setString(args[0], args[1]);
|
||||
}
|
||||
if (nbti.hasTag("SPEED")) {
|
||||
pm.getSpeed().add(player, nbti.getInteger("SPEED"));
|
||||
}
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
package me.unurled.raxen.commands.admin;
|
||||
|
||||
import static me.unurled.raxen.utils.Utils.*;
|
||||
import static me.unurled.raxen.utils.Utils.colorString;
|
||||
import static me.unurled.raxen.utils.Utils.log;
|
||||
import static me.unurled.raxen.utils.Utils.noPerms;
|
||||
|
||||
import java.util.List;
|
||||
import me.unurled.raxen.utils.Reload;
|
||||
|
@ -9,6 +11,7 @@ import org.bukkit.command.Command;
|
|||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.command.TabExecutor;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
|
@ -34,7 +37,12 @@ public class ReloadCommand implements TabExecutor {
|
|||
"<red>Server stopping!\n Using: /rlpl.\n Please wait a little bit."
|
||||
)
|
||||
);
|
||||
new BukkitRunnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
Bukkit.getServer().shutdown();
|
||||
}
|
||||
}.runTaskLater(Bukkit.getPluginManager().getPlugin("Raxen"), 80L);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,13 +1,17 @@
|
|||
package me.unurled.raxen.commands.admin;
|
||||
|
||||
import static me.unurled.raxen.components.entity.other.EntityUtils.setNameSpacedKeys;
|
||||
import static me.unurled.raxen.utils.Items.itemFrom64;
|
||||
import static me.unurled.raxen.utils.Utils.*;
|
||||
import static me.unurled.raxen.utils.Utils.colorTextComp;
|
||||
import static me.unurled.raxen.utils.Utils.error;
|
||||
import static me.unurled.raxen.utils.Utils.getStringFromArg;
|
||||
import static me.unurled.raxen.utils.Utils.log;
|
||||
import static me.unurled.raxen.utils.Utils.noPerms;
|
||||
import static me.unurled.raxen.utils.Utils.setNullInArgs;
|
||||
import static me.unurled.raxen.utils.Utils.validateArgs;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import me.unurled.raxen.Raxen;
|
||||
import me.unurled.raxen.components.entity.other.EntityNamespacedKey;
|
||||
import org.bukkit.Bukkit;
|
||||
|
@ -54,7 +58,8 @@ public class SpawnEntity implements TabExecutor {
|
|||
);
|
||||
log(
|
||||
colorTextComp(
|
||||
"<red>Follow this command: /entityspawn TYPE \"name\" x y z level health defense speed strength " +
|
||||
"<red>Follow this command: /entityspawn TYPE \"name\" x y z level health defense speed strength "
|
||||
+
|
||||
"helmet(itemStackBinary64) chestplate(itemStackBinary64) leggings(itemStackBinary64) boots(itemStackBinary64) main-hand(itemStackBinary64) off-hand(itemStackBinary64)</red>"
|
||||
)
|
||||
);
|
||||
|
@ -69,7 +74,7 @@ public class SpawnEntity implements TabExecutor {
|
|||
Double.parseDouble(args[4])
|
||||
);
|
||||
Entity e = loc.getWorld().spawnEntity(loc, types, false);
|
||||
setNameSpacedKeys(
|
||||
/* setNameSpacedKeys(
|
||||
e,
|
||||
getStringFromArg(args),
|
||||
Integer.parseInt(args[6]),
|
||||
|
@ -81,7 +86,7 @@ public class SpawnEntity implements TabExecutor {
|
|||
0,
|
||||
Integer.parseInt(args[10]),
|
||||
0
|
||||
);
|
||||
); */
|
||||
e.customName(colorTextComp(getStringFromArg(args)));
|
||||
e.setCustomNameVisible(true);
|
||||
if (e instanceof LivingEntity livingEntity) {
|
||||
|
@ -107,7 +112,8 @@ public class SpawnEntity implements TabExecutor {
|
|||
throw new RuntimeException(e);
|
||||
} catch (IOException e) {
|
||||
error(
|
||||
"Could not deserialize item from the command EntitySpawn (command launched by " +
|
||||
"Could not deserialize item from the command EntitySpawn (command launched by "
|
||||
+
|
||||
sender.getName() +
|
||||
")"
|
||||
);
|
||||
|
@ -133,7 +139,8 @@ public class SpawnEntity implements TabExecutor {
|
|||
);
|
||||
log(
|
||||
colorTextComp(
|
||||
"<red>Follow this command: /entityspawn TYPE \"name\" x y z level health defense speed strength " +
|
||||
"<red>Follow this command: /entityspawn TYPE \"name\" x y z level health defense speed strength "
|
||||
+
|
||||
"helmet(itemStackBinary64) chestplate(itemStackBinary64) leggings(itemStackBinary64) boots(itemStackBinary64) main-hand(itemStackBinary64) off-hand(itemStackBinary64)</red>"
|
||||
)
|
||||
);
|
||||
|
@ -148,7 +155,7 @@ public class SpawnEntity implements TabExecutor {
|
|||
Double.parseDouble(args[4])
|
||||
);
|
||||
Entity e = loc.getWorld().spawnEntity(loc, types, false);
|
||||
setNameSpacedKeys(
|
||||
/* setNameSpacedKeys(
|
||||
e,
|
||||
getStringFromArg(args),
|
||||
Integer.parseInt(args[6]),
|
||||
|
@ -160,7 +167,7 @@ public class SpawnEntity implements TabExecutor {
|
|||
0,
|
||||
Integer.parseInt(args[10]),
|
||||
0
|
||||
);
|
||||
); */
|
||||
e.customName(colorTextComp(getStringFromArg(args)));
|
||||
e.setCustomNameVisible(true);
|
||||
if (e instanceof LivingEntity livingEntity) {
|
||||
|
|
|
@ -0,0 +1,149 @@
|
|||
package me.unurled.raxen.commands.admin;
|
||||
|
||||
import static me.unurled.raxen.utils.Utils.colorTextComp;
|
||||
import static me.unurled.raxen.utils.Utils.msgPlayer;
|
||||
import static me.unurled.raxen.utils.Utils.noPerms;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import me.unurled.raxen.Raxen;
|
||||
import me.unurled.raxen.components.tutorial.Tutorial;
|
||||
import me.unurled.raxen.manager.server.TutorialManager;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.command.TabExecutor;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public class TutorialManagerCommand implements TabExecutor {
|
||||
|
||||
Raxen main;
|
||||
List<String> complete = new ArrayList<>();
|
||||
|
||||
public TutorialManagerCommand(Raxen main) {
|
||||
this.main = main;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command,
|
||||
@NotNull String label, @NotNull String[] args) {
|
||||
if (!sender.hasPermission("raxen.tutorial.cmd")) {
|
||||
sender.sendMessage(noPerms());
|
||||
return true;
|
||||
}
|
||||
if (args.length == 0) {
|
||||
// help
|
||||
return true;
|
||||
} else {
|
||||
TutorialManager tutorialManager = main.getManager().getTutorialManager();
|
||||
if (args.length == 1) {
|
||||
if (args[0].equalsIgnoreCase("start")) {
|
||||
// start tutorial for sender (if sender is a player)
|
||||
if (sender instanceof Player player) {
|
||||
Location loc = tutorialManager
|
||||
.generateTutorial(player);
|
||||
tutorialManager.getTutorial(player.getUniqueId())
|
||||
.startTutorial(player, loc);
|
||||
return true;
|
||||
}
|
||||
} else if (sender instanceof Player player) {
|
||||
if (args[0].equalsIgnoreCase("stop")) {
|
||||
// stop tutorial for sender
|
||||
tutorialManager.getTutorial(player.getUniqueId())
|
||||
.stopTutorial();
|
||||
tutorialManager.removeTutorial(player.getUniqueId());
|
||||
return true;
|
||||
} else if (args[0].equalsIgnoreCase("next")) {
|
||||
// next step for sender
|
||||
tutorialManager.getTutorial(player.getUniqueId())
|
||||
.nextStep();
|
||||
return true;
|
||||
} else if (args[0].equalsIgnoreCase("prev")) {
|
||||
// prev step for sender
|
||||
tutorialManager.getTutorial(player.getUniqueId())
|
||||
.previousStep();
|
||||
return true;
|
||||
} else if (args[0].equalsIgnoreCase("status")) {
|
||||
// status of tutorial for sender
|
||||
Tutorial tutorial = tutorialManager.getTutorial(player.getUniqueId());
|
||||
msgPlayer(player, colorTextComp(
|
||||
"<gray>Tutorial status for player " + player.getName() + ": <reset>"
|
||||
+ tutorial.getStep()));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
} else if (args.length == 2) {
|
||||
Player player = Bukkit.getPlayer(args[1]);
|
||||
if (player != null) {
|
||||
if (player.isOnline()) {
|
||||
if (args[0].equalsIgnoreCase("start")) {
|
||||
// start tutorial for player
|
||||
Location loc = tutorialManager
|
||||
.generateTutorial(player);
|
||||
tutorialManager.getTutorial(player.getUniqueId())
|
||||
.startTutorial(player, loc);
|
||||
} else if (args[0].equalsIgnoreCase("stop")) {
|
||||
// stop tutorial for sender
|
||||
tutorialManager.getTutorial(player.getUniqueId())
|
||||
.stopTutorial();
|
||||
tutorialManager.removeTutorial(player.getUniqueId());
|
||||
return true;
|
||||
} else if (args[0].equalsIgnoreCase("next")) {
|
||||
// next step for sender
|
||||
tutorialManager.getTutorial(player.getUniqueId())
|
||||
.nextStep();
|
||||
return true;
|
||||
} else if (args[0].equalsIgnoreCase("prev")) {
|
||||
// prev step for sender
|
||||
tutorialManager.getTutorial(player.getUniqueId())
|
||||
.previousStep();
|
||||
return true;
|
||||
} else if (args[0].equalsIgnoreCase("status")) {
|
||||
// status of tutorial for sender
|
||||
Tutorial tutorial = tutorialManager.getTutorial(player.getUniqueId());
|
||||
msgPlayer(player, colorTextComp(
|
||||
"<gray>Tutorial status for player " + player.getName() + ": <reset>"
|
||||
+ tutorial.getStep()));
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public @Nullable List<String> onTabComplete(@NotNull CommandSender sender,
|
||||
@NotNull Command command, @NotNull String label, @NotNull String[] args) {
|
||||
if (complete.isEmpty()) {
|
||||
complete.add("start");
|
||||
complete.add("stop");
|
||||
complete.add("next");
|
||||
complete.add("prev");
|
||||
complete.add("status");
|
||||
}
|
||||
List<String> result = new ArrayList<>();
|
||||
if (args.length == 1) {
|
||||
for (String s : complete) {
|
||||
if (s.toLowerCase().startsWith(args[0].toLowerCase())) {
|
||||
result.add(s);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
} else if (args.length == 2) {
|
||||
for (Player p : Bukkit.getOnlinePlayers()) {
|
||||
if (p.getName().toLowerCase().startsWith(args[1].toLowerCase())) {
|
||||
result.add(p.getName());
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
224
src/main/java/me/unurled/raxen/commands/player/PartyCommand.java
Normal file
224
src/main/java/me/unurled/raxen/commands/player/PartyCommand.java
Normal file
|
@ -0,0 +1,224 @@
|
|||
package me.unurled.raxen.commands.player;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import me.unurled.raxen.Raxen;
|
||||
import me.unurled.raxen.components.entity.player.RaxenPlayer;
|
||||
import me.unurled.raxen.utils.Utils;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.command.TabExecutor;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public class PartyCommand implements TabExecutor {
|
||||
|
||||
Raxen main;
|
||||
|
||||
List<String> complete = new ArrayList<>();
|
||||
|
||||
public PartyCommand(Raxen main) {
|
||||
this.main = main;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command,
|
||||
@NotNull String label, @NotNull String[] args) {
|
||||
if (!(sender instanceof Player)) {
|
||||
Utils.errorConsoleSender(sender);
|
||||
return true;
|
||||
}
|
||||
Player player = (Player) sender;
|
||||
if (player.getWorld().getName().equalsIgnoreCase("tutorial")) {
|
||||
player.sendMessage(Utils.colorComp(
|
||||
"<grey>> <green>Sorry, you can't use this command in the tutorial!"));
|
||||
player.sendMessage(Utils.colorComp(
|
||||
"<grey>> <green>Please finish the tutorial first. Feel free to ask for help!"));
|
||||
return true;
|
||||
}
|
||||
RaxenPlayer rx = main.getManager().getPlayerManager()
|
||||
.getRaxenPlayer(player);
|
||||
if (args.length == 0) {
|
||||
player.sendMessage(
|
||||
Utils.colorComp("<reset><yellow>/party help to view all infos on party"));
|
||||
return true;
|
||||
}
|
||||
if (args[0].equalsIgnoreCase("help")) {
|
||||
player.sendMessage(
|
||||
Utils.colorComp("<reset><yellow>/party help to view all infos on party"));
|
||||
player.sendMessage(Utils.colorComp("<reset><yellow>/party create to create a party"));
|
||||
player.sendMessage(Utils.colorComp(
|
||||
"<reset><yellow>/party invite <player> to invite a player to your party"));
|
||||
player.sendMessage(Utils.colorComp("<reset><yellow>/party leave to leave your party"));
|
||||
player.sendMessage(Utils.colorComp(
|
||||
"<reset><yellow>/party kick <player> to kick a player from your party"));
|
||||
player.sendMessage(
|
||||
Utils.colorComp("<reset><yellow>/party disband to disband your party"));
|
||||
player.sendMessage(
|
||||
Utils.colorComp("<reset><yellow>/party accept to accept a party invite"));
|
||||
player.sendMessage(
|
||||
Utils.colorComp("<reset><yellow>/party decline to deny a party invite"));
|
||||
player.sendMessage(
|
||||
Utils.colorComp("<reset><yellow>/party list to list all members of your party"));
|
||||
player.sendMessage(
|
||||
Utils.colorComp("<reset><yellow>\\ before every message to send it to your party"));
|
||||
return true;
|
||||
} else if (args[0].equalsIgnoreCase("create")) {
|
||||
main.getManager().getPartyManager().createParty(player, rx);
|
||||
return true;
|
||||
} else if (args[0].equalsIgnoreCase("invite")) {
|
||||
if (rx.getParty() != null) {
|
||||
if (args.length != 2) {
|
||||
player.sendMessage(Utils.colorComp(
|
||||
"<grey>> <green>Usage: /party invite <player>"));
|
||||
return true;
|
||||
} else {
|
||||
String name = args[1];
|
||||
Player target = main.getServer().getPlayer(name);
|
||||
RaxenPlayer rx2 = main.getManager().getPlayerManager()
|
||||
.getRaxenPlayer(target);
|
||||
if (rx2 == null || target == null || !target.isOnline()) {
|
||||
player.sendMessage(Utils.colorComp(
|
||||
"<grey>> <green>Player not found!"));
|
||||
return true;
|
||||
}
|
||||
if (rx.getParty().isFull()) {
|
||||
player.sendMessage(Utils.colorComp(
|
||||
"<grey>> <green>Your party is full!"));
|
||||
return true;
|
||||
} else {
|
||||
rx.getParty().sendInvite(target, rx2, player);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
player.sendMessage(Utils.colorComp(
|
||||
"<grey>> <green>You are not in a party!"));
|
||||
return true;
|
||||
}
|
||||
} else if (args[0].equalsIgnoreCase("accept")) {
|
||||
if (rx.getInvitedParty() == null) {
|
||||
player.sendMessage(Utils.colorComp(
|
||||
"<grey>> <green>You have no pending party invites!"));
|
||||
return true;
|
||||
} else {
|
||||
rx.getInvitedParty().addPlayer(player);
|
||||
rx.setParty(rx.getInvitedParty());
|
||||
rx.setInvitedParty(null);
|
||||
return true;
|
||||
}
|
||||
} else if (args[0].equalsIgnoreCase("decline")) {
|
||||
if (rx.getInvitedParty() != null) {
|
||||
rx.getInvitedParty().sendMessage(Utils.colorComp(
|
||||
"<grey>> <green>" + player.getName() + " has declined the party invite!"));
|
||||
}
|
||||
rx.setInvitedParty(null);
|
||||
player.sendMessage(Utils.colorComp(
|
||||
"<grey>> <green>You have declined the party invite!"));
|
||||
} else if (args[0].equalsIgnoreCase("leave")) {
|
||||
if (rx.getParty() == null) {
|
||||
player.sendMessage(Utils.colorComp(
|
||||
"<grey>> <green>You are not in a party!"));
|
||||
return true;
|
||||
} else {
|
||||
rx.getParty().leavePlayer(player.getUniqueId(), player.getName());
|
||||
rx.setParty(null);
|
||||
return true;
|
||||
}
|
||||
} else if (args[0].equalsIgnoreCase("kick")) {
|
||||
if (rx.getParty() == null) {
|
||||
player.sendMessage(Utils.colorComp(
|
||||
"<grey>> <green>You are not in a party!"));
|
||||
return true;
|
||||
} else {
|
||||
if (!rx.getParty().isLeader(player)) {
|
||||
player.sendMessage(Utils.colorComp(
|
||||
"<grey>> <green>You are not the party leader!"));
|
||||
return true;
|
||||
} else {
|
||||
if (args.length != 2) {
|
||||
player.sendMessage(Utils.colorComp(
|
||||
"<grey>> <green>Usage: /party kick <player>"));
|
||||
return true;
|
||||
} else {
|
||||
String name = args[1];
|
||||
Player target = main.getServer().getPlayer(name);
|
||||
RaxenPlayer rx2 = main.getManager().getPlayerManager()
|
||||
.getRaxenPlayer(target);
|
||||
if (rx2 == null || target == null || !target.isOnline()) {
|
||||
player.sendMessage(Utils.colorComp(
|
||||
"<grey>> <green>Player not found!"));
|
||||
return true;
|
||||
}
|
||||
if (!rx2.getParty().equals(rx.getParty())) {
|
||||
player.sendMessage(Utils.colorComp(
|
||||
"<grey>> <green>This player is not in your party!"));
|
||||
return true;
|
||||
}
|
||||
if (target.equals(player) || rx.equals(rx2)) {
|
||||
player.sendMessage(Utils.colorComp(
|
||||
"<grey>> <green>You can't kick yourself!"));
|
||||
return true;
|
||||
}
|
||||
target.playSound(target.getLocation(), Sound.ENTITY_EXPERIENCE_ORB_PICKUP,
|
||||
1, 1);
|
||||
rx.getParty().leavePlayer(target.getUniqueId(), target.getName());
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (rx.getParty() != null) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (String s : args) {
|
||||
sb.append(s).append(" ");
|
||||
}
|
||||
String message = sb.toString().trim();
|
||||
rx.getParty().sendMessage(player, Utils.colorComp(
|
||||
"<reset>" + message));
|
||||
} else {
|
||||
player.sendMessage(Utils.colorComp(
|
||||
"<grey>> <green>Not valid command!"));
|
||||
player.sendMessage(Utils.colorComp(
|
||||
"<grey>> <green>/party help to view all infos on party"));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public @Nullable List<String> onTabComplete(@NotNull CommandSender sender,
|
||||
@NotNull Command command, @NotNull String label, @NotNull String[] args) {
|
||||
|
||||
if (complete.isEmpty()) {
|
||||
complete.add("create");
|
||||
complete.add("invite");
|
||||
complete.add("accept");
|
||||
complete.add("decline");
|
||||
complete.add("leave");
|
||||
complete.add("kick");
|
||||
complete.add("help");
|
||||
}
|
||||
List<String> result = new ArrayList<>();
|
||||
if (args.length == 1) {
|
||||
for (String s : complete) {
|
||||
if (s.toLowerCase().startsWith(args[0].toLowerCase())) {
|
||||
result.add(s);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
} else if (args.length == 2) {
|
||||
for (Player p : Bukkit.getOnlinePlayers()) {
|
||||
if (p.getName().toLowerCase().startsWith(args[1].toLowerCase())) {
|
||||
result.add(p.getName());
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
|
@ -61,19 +61,30 @@ public class SkillsCommand implements TabExecutor {
|
|||
break;
|
||||
case 3:
|
||||
PlayerManager pm =
|
||||
((Raxen) Bukkit.getPluginManager().getPlugin("Raxen")).getManager()
|
||||
(
|
||||
(Raxen) Bukkit.getPluginManager().getPlugin("Raxen")
|
||||
).getManager()
|
||||
.getPlayerManager();
|
||||
for (String s : pm.getAttribute().keySet()) {
|
||||
if (s.equalsIgnoreCase(args[0])) switch (args[1]) {
|
||||
case "add":
|
||||
pm.getAttribute().get(s).add(player, Integer.parseInt(args[2]));
|
||||
pm
|
||||
.getAttribute()
|
||||
.get(s)
|
||||
.add(player, Integer.parseInt(args[2]));
|
||||
break;
|
||||
case "remove":
|
||||
pm
|
||||
.getAttribute()
|
||||
.get(s)
|
||||
.remove(player, Integer.parseInt(args[2]));
|
||||
break;
|
||||
case "set":
|
||||
pm.getAttribute().get(s).set(player, Integer.parseInt(args[2]));
|
||||
pm
|
||||
.getAttribute()
|
||||
.get(s)
|
||||
.set(player, Integer.parseInt(args[2]));
|
||||
break;
|
||||
}
|
||||
}
|
||||
PlayerUtils.updateSkills(main, player);
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
package me.unurled.raxen.commands.player;
|
||||
|
||||
import static me.unurled.raxen.utils.Utils.*;
|
||||
import static me.unurled.raxen.utils.Utils.colorString;
|
||||
import static me.unurled.raxen.utils.Utils.error;
|
||||
import static me.unurled.raxen.utils.Utils.msgPlayer;
|
||||
|
||||
import java.util.List;
|
||||
import me.unurled.raxen.Raxen;
|
||||
|
@ -48,7 +50,11 @@ public class StorageCommand implements TabExecutor {
|
|||
.getEc();
|
||||
} else {
|
||||
inv =
|
||||
playerManager.getRaxenPlayer(player).getStorage().getEc().getEc();
|
||||
playerManager
|
||||
.getRaxenPlayer(player)
|
||||
.getStorage()
|
||||
.getEc()
|
||||
.getEc();
|
||||
}
|
||||
player.openInventory(inv);
|
||||
break;
|
||||
|
@ -57,11 +63,18 @@ public class StorageCommand implements TabExecutor {
|
|||
if (p == null) {
|
||||
msgPlayer(
|
||||
player,
|
||||
colorString("<red>You can't open the Storage of an unknown Player.")
|
||||
colorString(
|
||||
"<red>You can't open the Storage of an unknown Player."
|
||||
)
|
||||
);
|
||||
return true;
|
||||
}
|
||||
inv = playerManager.getRaxenPlayer(player).getStorage().getEc().getEc();
|
||||
inv =
|
||||
playerManager
|
||||
.getRaxenPlayer(player)
|
||||
.getStorage()
|
||||
.getEc()
|
||||
.getEc();
|
||||
player.openInventory(inv);
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,55 @@
|
|||
package me.unurled.raxen.components.clientbuild;
|
||||
|
||||
import java.time.Instant;
|
||||
import java.util.ArrayList;
|
||||
import java.util.UUID;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.block.Block;
|
||||
|
||||
public class Builds {
|
||||
|
||||
private Instant start;
|
||||
private Instant end;
|
||||
private Location startLocation;
|
||||
private UUID owner;
|
||||
|
||||
private ArrayList<Block> blocks = new ArrayList<>();
|
||||
|
||||
public Builds(Location startLocation, UUID owner) {
|
||||
start = Instant.now();
|
||||
this.startLocation = startLocation;
|
||||
this.owner = owner;
|
||||
}
|
||||
|
||||
public Instant getEnd() {
|
||||
return end;
|
||||
}
|
||||
|
||||
public void setEnd(Instant end) {
|
||||
this.end = end;
|
||||
}
|
||||
|
||||
public Location getStartLocation() {
|
||||
return startLocation;
|
||||
}
|
||||
|
||||
public UUID getOwner() {
|
||||
return owner;
|
||||
}
|
||||
|
||||
public ArrayList<Block> getBlocks() {
|
||||
return blocks;
|
||||
}
|
||||
|
||||
public void setBlocks(ArrayList<Block> blocks) {
|
||||
this.blocks = blocks;
|
||||
}
|
||||
|
||||
public void addBlock(Block block) {
|
||||
blocks.add(block);
|
||||
}
|
||||
|
||||
public void removeBlock(Block block) {
|
||||
blocks.remove(block);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
package me.unurled.raxen.components.clientbuild;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class PlayerList {
|
||||
|
||||
private final ArrayList<Player> players = new ArrayList<>();
|
||||
|
||||
public void addPlayer(Player player) {
|
||||
players.add(player);
|
||||
}
|
||||
|
||||
public void removePlayer(Player player) {
|
||||
players.remove(player);
|
||||
}
|
||||
|
||||
public ArrayList<Player> getPlayers() {
|
||||
return players;
|
||||
}
|
||||
|
||||
}
|
|
@ -12,5 +12,5 @@ public enum Rank {
|
|||
SSS,
|
||||
WORLD,
|
||||
UNBEATABLE,
|
||||
NOT_DEFINED,
|
||||
NOT_DEFINED
|
||||
}
|
||||
|
|
|
@ -16,5 +16,5 @@ public enum Types {
|
|||
CAVES,
|
||||
LABYRINTH,
|
||||
UNDERGROUND_LABYRINTH,
|
||||
FOREST_LABYRINTH,
|
||||
FOREST_LABYRINTH
|
||||
}
|
||||
|
|
|
@ -7,7 +7,12 @@ import me.unurled.raxen.components.dungeons.types.MonsterType;
|
|||
|
||||
public class ForestDungeon extends Dungeon {
|
||||
|
||||
public ForestDungeon(String name, Rank rank, Types types, MonsterType mType) {
|
||||
public ForestDungeon(
|
||||
String name,
|
||||
Rank rank,
|
||||
Types types,
|
||||
MonsterType mType
|
||||
) {
|
||||
super(name, rank, types, mType);
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
package me.unurled.raxen.components.effect;
|
||||
|
||||
public class EffectBuilder {
|
||||
|
||||
}
|
|
@ -1,6 +1,7 @@
|
|||
package me.unurled.raxen.components.entity.Attributes;
|
||||
|
||||
import static me.unurled.raxen.utils.Utils.debug;
|
||||
import static me.unurled.raxen.utils.Utils.log;
|
||||
|
||||
import de.tr7zw.nbtapi.NBTItem;
|
||||
import org.bukkit.Material;
|
||||
|
@ -103,7 +104,8 @@ public class Attribute {
|
|||
attribute = attribute + get(item);
|
||||
}
|
||||
if (
|
||||
equi.getHelmet().getType() != Material.AIR && equi.getHelmet() != null
|
||||
equi.getHelmet().getType() != Material.AIR &&
|
||||
equi.getHelmet() != null
|
||||
) {
|
||||
ItemStack item = equi.getHelmet();
|
||||
attribute = attribute + get(item);
|
||||
|
@ -130,7 +132,8 @@ public class Attribute {
|
|||
attribute = attribute + get(item);
|
||||
}
|
||||
if (
|
||||
equi.getBoots().getType() != Material.AIR && equi.getBoots() != null
|
||||
equi.getBoots().getType() != Material.AIR &&
|
||||
equi.getBoots() != null
|
||||
) {
|
||||
ItemStack item = equi.getBoots();
|
||||
attribute = attribute + get(item);
|
||||
|
@ -157,6 +160,7 @@ public class Attribute {
|
|||
* @param amount the amount you want to set
|
||||
*/
|
||||
public void add(@NotNull Entity entity, @NotNull Integer amount) {
|
||||
log(get(entity) + " " + amount);
|
||||
set(entity, get(entity) + amount);
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
package me.unurled.raxen.components.entity;
|
||||
|
||||
public enum DamageType {
|
||||
NORMAL,
|
||||
NORMAL_SPELL,
|
||||
ENVIRONMENTAL_LAVA,
|
||||
ENVIRONMENTAL_DROWNING,
|
||||
ENVIRONMENTAL_FALL,
|
||||
ENVIRONMENTAL_INSTANT;
|
||||
}
|
|
@ -12,15 +12,15 @@ import org.jetbrains.annotations.NotNull;
|
|||
|
||||
public class EntityUtils {
|
||||
|
||||
private static Raxen main;
|
||||
private static EntityNamespacedKey namespacedKey;
|
||||
private Raxen main;
|
||||
private EntityNamespacedKey namespacedKey;
|
||||
|
||||
public EntityUtils(Raxen main) {
|
||||
this.main = main;
|
||||
namespacedKey = new EntityNamespacedKey(main);
|
||||
}
|
||||
|
||||
public static void setNameSpacedKeys(
|
||||
public void setNameSpacedKeys(
|
||||
org.bukkit.entity.@NotNull Entity e,
|
||||
String name,
|
||||
Integer level,
|
||||
|
@ -35,9 +35,17 @@ public class EntityUtils {
|
|||
) {
|
||||
PersistentDataContainer data = e.getPersistentDataContainer();
|
||||
data.set(namespacedKey.health, PersistentDataType.INTEGER, health);
|
||||
data.set(namespacedKey.itemHealth, PersistentDataType.INTEGER, itemHealth);
|
||||
data.set(
|
||||
namespacedKey.itemHealth,
|
||||
PersistentDataType.INTEGER,
|
||||
itemHealth
|
||||
);
|
||||
data.set(namespacedKey.speed, PersistentDataType.INTEGER, speed);
|
||||
data.set(namespacedKey.itemSpeed, PersistentDataType.INTEGER, itemSpeed);
|
||||
data.set(
|
||||
namespacedKey.itemSpeed,
|
||||
PersistentDataType.INTEGER,
|
||||
itemSpeed
|
||||
);
|
||||
data.set(namespacedKey.defense, PersistentDataType.INTEGER, defense);
|
||||
data.set(
|
||||
namespacedKey.itemDefense,
|
||||
|
@ -45,12 +53,16 @@ public class EntityUtils {
|
|||
itemDefense
|
||||
);
|
||||
data.set(namespacedKey.strength, PersistentDataType.INTEGER, strength);
|
||||
data.set(namespacedKey.itemStrength, PersistentDataType.INTEGER, itemDmg);
|
||||
data.set(
|
||||
namespacedKey.itemStrength,
|
||||
PersistentDataType.INTEGER,
|
||||
itemDmg
|
||||
);
|
||||
data.set(namespacedKey.name, PersistentDataType.STRING, name);
|
||||
data.set(namespacedKey.level, PersistentDataType.INTEGER, level);
|
||||
}
|
||||
|
||||
public static void updateSkills(@NotNull LivingEntity livingEntity) {
|
||||
public void updateSkills(@NotNull LivingEntity livingEntity) {
|
||||
PlayerManager pm =
|
||||
((Raxen) Bukkit.getPluginManager().getPlugin("Raxen")).getManager()
|
||||
.getPlayerManager();
|
||||
|
@ -76,8 +88,12 @@ public class EntityUtils {
|
|||
null
|
||||
) {
|
||||
livingEntity
|
||||
.getAttribute(org.bukkit.attribute.Attribute.GENERIC_FLYING_SPEED)
|
||||
.setBaseValue((float) (0.0 + ((speed + itemSpeed) / 100) * 0.2));
|
||||
.getAttribute(
|
||||
org.bukkit.attribute.Attribute.GENERIC_FLYING_SPEED
|
||||
)
|
||||
.setBaseValue(
|
||||
(float) (0.0 + ((speed + itemSpeed) / 100) * 0.2)
|
||||
);
|
||||
}
|
||||
if (
|
||||
livingEntity.getAttribute(
|
||||
|
@ -86,8 +102,12 @@ public class EntityUtils {
|
|||
null
|
||||
) {
|
||||
livingEntity
|
||||
.getAttribute(org.bukkit.attribute.Attribute.GENERIC_MOVEMENT_SPEED)
|
||||
.setBaseValue((float) (0.0 + ((speed + itemSpeed) / 100) * 0.2));
|
||||
.getAttribute(
|
||||
org.bukkit.attribute.Attribute.GENERIC_MOVEMENT_SPEED
|
||||
)
|
||||
.setBaseValue(
|
||||
(float) (0.0 + ((speed + itemSpeed) / 100) * 0.2)
|
||||
);
|
||||
}
|
||||
livingEntity
|
||||
.getAttribute(org.bukkit.attribute.Attribute.GENERIC_MAX_HEALTH)
|
||||
|
|
|
@ -0,0 +1,352 @@
|
|||
package me.unurled.raxen.components.entity.other;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.UUID;
|
||||
import me.unurled.raxen.Raxen;
|
||||
import me.unurled.raxen.components.entity.Attributes.Attribute;
|
||||
import me.unurled.raxen.components.entity.Attributes.Health;
|
||||
import me.unurled.raxen.components.entity.DamageType;
|
||||
import me.unurled.raxen.components.entity.player.RaxenPlayer;
|
||||
import me.unurled.raxen.manager.entity.EntityManager;
|
||||
import me.unurled.raxen.utils.EntityUtils;
|
||||
import me.unurled.raxen.utils.Tags;
|
||||
import me.unurled.raxen.utils.Utils;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.EntityEffect;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
public class MobData {
|
||||
|
||||
public Raxen main;
|
||||
private static int MOB_ID = 0;
|
||||
public int id = MOB_ID++;
|
||||
public boolean dead = false;
|
||||
public LivingEntity entity;
|
||||
public LivingEntity mount = null;
|
||||
|
||||
String nameWithoutLevel;
|
||||
String fullName;
|
||||
|
||||
public MobType mobType;
|
||||
|
||||
public Attribute attributes;
|
||||
public HashMap<UUID, Long> lastAttackedByTimes;
|
||||
public HashMap<UUID, Long> damageDealt;
|
||||
public long lastDamaged = 0;
|
||||
public long lastKnockback = 0;
|
||||
|
||||
public boolean despawned = false;
|
||||
public long invuln = 0; // cannot attack or damage
|
||||
private Runnable lastScheduledRevertHP = null;
|
||||
|
||||
// TODO: public ArrayList<MobAttributes> attributes;
|
||||
|
||||
// TODO: mob ai
|
||||
|
||||
// TODO: mob spawn
|
||||
|
||||
public MobData() {
|
||||
lastAttackedByTimes = new HashMap<>();
|
||||
damageDealt = new HashMap<>();
|
||||
}
|
||||
|
||||
public void mount(Class<? extends Entity> mountClass) {
|
||||
if (entity == null || dead) {
|
||||
return;
|
||||
}
|
||||
mount = EntityUtils.createLivingEntity(mountClass, entity.getLocation());
|
||||
mount.addPassenger(entity);
|
||||
|
||||
}
|
||||
|
||||
public void die() {
|
||||
die(true);
|
||||
}
|
||||
|
||||
public void die(boolean drop) {
|
||||
if (dead) {
|
||||
return;
|
||||
}
|
||||
dead = true;
|
||||
Location deathLoc = entity.getLocation();
|
||||
entity.customName(Component.text(fullName));
|
||||
Tags.makeFloatingText("<gold>+" + mobType.xp + " XP", deathLoc, 1.3, 1.0, 1.5, 1);
|
||||
if (mount != null) {
|
||||
try {
|
||||
mount.eject();
|
||||
entity.leaveVehicle();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
mount.damage(1000000000);
|
||||
}
|
||||
entity.damage(1000000000);
|
||||
new BukkitRunnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
despawn();
|
||||
}
|
||||
}.runTaskLater(main, 20);
|
||||
int totalLevel = 0;
|
||||
int pdCount = 0;
|
||||
ArrayList<RaxenPlayer> raxenPlayers = new ArrayList<>();
|
||||
double damageSum = 0;
|
||||
RaxenPlayer rx = null;
|
||||
for (Entry<UUID, Long> entry : damageDealt.entrySet()) {
|
||||
if ((rx = main.getManager().getPlayerManager().getRaxenPlayer(entry.getKey()))
|
||||
!= null) {
|
||||
raxenPlayers.add(rx);
|
||||
damageSum += entry.getValue();
|
||||
totalLevel += rx.getLevel();
|
||||
pdCount++;
|
||||
}
|
||||
}
|
||||
if (pdCount < 1) {
|
||||
totalLevel = 1;
|
||||
pdCount = 1;
|
||||
}
|
||||
double avgLv = totalLevel / (double) pdCount;
|
||||
for (RaxenPlayer tx : raxenPlayers) {
|
||||
if (damageDealt.containsKey(tx.getPlayer().getUniqueId())) {
|
||||
tx.incrementMobCounter(mobType.identifier);
|
||||
double precentage =
|
||||
damageDealt.get(tx.getPlayer().getUniqueId()) / (double) damageSum;
|
||||
if (precentage >= 0.1) {
|
||||
tx.addMobKills();
|
||||
}
|
||||
long amt = (long) Math.ceil(mobType.xp * precentage);
|
||||
if (!(mobType.level >= 80 && tx.getLevel() >= 80) && Math.abs(
|
||||
tx.getLevel() - mobType.level) >= 10) {
|
||||
double penalty = 0.7;
|
||||
penalty -= (Math.abs(tx.getLevel() - mobType.level) - 10) * 0.06;
|
||||
if (penalty < 0.1) {
|
||||
penalty = 0.1;
|
||||
}
|
||||
tx.gainXp((long) Math.ceil(amt * penalty), true);
|
||||
} else {
|
||||
tx.gainXp(amt);
|
||||
}
|
||||
}
|
||||
}
|
||||
long mostDealt = 0;
|
||||
UUID priority = null;
|
||||
RaxenPlayer topDamage = null;
|
||||
for (Entry<UUID, Long> entry : damageDealt.entrySet()) {
|
||||
Player p = Bukkit.getPlayer(entry.getKey());
|
||||
if (p == null) {
|
||||
continue;
|
||||
}
|
||||
if (me.unurled.raxen.utils.Math.flatDistance(p.getLocation(), deathLoc) < 50) {
|
||||
if (entry.getValue() >= mostDealt) {
|
||||
if (entry.getValue() == mostDealt && Math.random() > 0.5) {
|
||||
continue;
|
||||
}
|
||||
if (main.getManager().getPlayerManager().getRaxenPlayer(entry.getKey())
|
||||
== null) {
|
||||
continue;
|
||||
}
|
||||
mostDealt = entry.getValue();
|
||||
priority = entry.getKey();
|
||||
topDamage = main.getManager().getPlayerManager().getRaxenPlayer(priority);
|
||||
}
|
||||
}
|
||||
}
|
||||
EntityManager manager = main.getManager().getEntityManager();
|
||||
if (drop || manager.getHealth().get(entity) < manager.getMaxMana().get(entity)) {
|
||||
// TODO: mobdrop
|
||||
}
|
||||
|
||||
// TODO: respawn
|
||||
}
|
||||
|
||||
public void despawn() {
|
||||
if (despawned) {
|
||||
return;
|
||||
}
|
||||
// TODO: respawn
|
||||
despawned = true;
|
||||
dead = true;
|
||||
EntityManager manager = main.getManager().getEntityManager();
|
||||
if (entity == null) {
|
||||
manager.getSpawnedMob().remove(entity.getUniqueId());
|
||||
manager.getSpawnedMobsOnlyMain().remove(entity.getUniqueId());
|
||||
entity.remove();
|
||||
}
|
||||
entity = null;
|
||||
if (mount != null) {
|
||||
manager.getSpawnedMob().remove(mount.getUniqueId());
|
||||
manager.getSpawnedMobsOnlyMain().remove(mount.getUniqueId());
|
||||
mount.remove();
|
||||
}
|
||||
mount = null;
|
||||
// TODO: ai
|
||||
if (damageDealt != null) {
|
||||
damageDealt = null;
|
||||
}
|
||||
attributes = null;
|
||||
lastAttackedByTimes = null;
|
||||
}
|
||||
|
||||
public boolean attack(RaxenPlayer rx) {
|
||||
return attack(rx, 0.5, -1, false);
|
||||
}
|
||||
|
||||
public boolean attack(RaxenPlayer pd, int rpgDamage) {
|
||||
return attack(pd, 0.5, rpgDamage, false);
|
||||
}
|
||||
|
||||
public boolean attack(RaxenPlayer pd, int rpgDamage, boolean projectile) {
|
||||
return attack(pd, 0.5, rpgDamage, projectile);
|
||||
}
|
||||
|
||||
public int getDamage() {
|
||||
return main.getManager().getEntityManager().getStrength()
|
||||
.get(entity); // TODO: get damage properly
|
||||
}
|
||||
|
||||
public boolean attack(RaxenPlayer pd, double knockback, int rpgDamage, boolean projectile) {
|
||||
if (System.currentTimeMillis() < invuln) {
|
||||
return false;
|
||||
}
|
||||
boolean success = false;
|
||||
success = pd.damage(rpgDamage > -1 ? rpgDamage : getDamage(), entity,
|
||||
DamageType.NORMAL);
|
||||
if (success && !projectile) {
|
||||
pd.knockback(entity, knockback);
|
||||
}
|
||||
return success;
|
||||
}
|
||||
|
||||
public void knockback(LivingEntity attacker, double knockBackMultiplier) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
public boolean damage(int damageAmount, org.bukkit.entity.Entity damager,
|
||||
DamageType damageType) {
|
||||
return damage(damageAmount, damager, damageType, false);
|
||||
}
|
||||
|
||||
public boolean damage(int damageAmount, org.bukkit.entity.Entity damager, DamageType damageType,
|
||||
boolean crit) {
|
||||
if (System.currentTimeMillis() < invuln) {
|
||||
return false;
|
||||
}
|
||||
if (dead) {
|
||||
return false;
|
||||
}
|
||||
if (damager != null && damager instanceof Player player) {
|
||||
if (!player.isOnline()
|
||||
|| main.getManager().getPlayerManager().getRaxenPlayer(player) == null) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
Health health = main.getManager().getEntityManager().getHealth();
|
||||
if (damageAmount > health.get(entity)) {
|
||||
damageAmount = health.get(entity);
|
||||
}
|
||||
if (damager != null && damager instanceof Player player) {
|
||||
if (damageDealt.containsKey(damager.getUniqueId())) {
|
||||
damageDealt.put(damager.getUniqueId(),
|
||||
damageDealt.get(damager.getUniqueId()) + damageAmount);
|
||||
} else {
|
||||
damageDealt.put(damager.getUniqueId(), (long) damageAmount);
|
||||
}
|
||||
// TODO: AI stuff
|
||||
}
|
||||
if (damager != null) {
|
||||
lastAttackedByTimes.put(damager.getUniqueId(), System.currentTimeMillis());
|
||||
}
|
||||
if (damageAmount < 1) {
|
||||
damageAmount = 1;
|
||||
}
|
||||
health.set(entity,
|
||||
health.get(entity) - damageAmount);
|
||||
if (health.get(entity) <= 0) {
|
||||
health.set(entity, 0);
|
||||
}
|
||||
if (damager != null && damager instanceof Player player) {
|
||||
RaxenPlayer rx = main.getManager().getPlayerManager().getRaxenPlayer(player);
|
||||
player.playSound(player.getLocation(), Sound.ENTITY_PLAYER_HURT, 0.65f, 0.75f);
|
||||
}
|
||||
if (health.get(entity) < 1) {
|
||||
die();
|
||||
} else {
|
||||
entity.playEffect(EntityEffect.HURT);
|
||||
if (mount != null) {
|
||||
mount.playEffect(EntityEffect.HURT);
|
||||
}
|
||||
displayCurrentHP();
|
||||
}
|
||||
lastDamaged = System.currentTimeMillis();
|
||||
return true;
|
||||
}
|
||||
|
||||
public void displayCurrentHP() {
|
||||
entity.customName(getHPDisplay());
|
||||
Bukkit.getScheduler().scheduleSyncDelayedTask(main, lastScheduledRevertHP = new Runnable() {
|
||||
public void run() {
|
||||
if (!dead && entity != null && entity.isValid() && !entity.isDead()) {
|
||||
if (lastScheduledRevertHP == this) {
|
||||
entity.customName(Utils.colorComp(fullName));
|
||||
}
|
||||
}
|
||||
}
|
||||
}, 60L);
|
||||
}
|
||||
|
||||
public Component getHPDisplay() {
|
||||
EntityManager manager = main.getManager().getEntityManager();
|
||||
int health = manager.getHealth().get(entity);
|
||||
int maxHealth = manager.getMaxHealth().get(entity);
|
||||
double percent = ((double) health) / ((double) maxHealth);
|
||||
int green = (int) Math.floor(percent / 0.05);
|
||||
if (green > 20) {
|
||||
green = 20;
|
||||
} else if (green < 1) {
|
||||
green = 1;
|
||||
}
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("<gray>");
|
||||
sb.append('[');
|
||||
int firstHalf = green - 10;
|
||||
if (firstHalf < 0) {
|
||||
firstHalf = 0;
|
||||
}
|
||||
|
||||
sb.append("<dark_red>");
|
||||
for (int i = 0; i < 10 - firstHalf; i++) {
|
||||
sb.append('|');
|
||||
}
|
||||
sb.append("<green>");
|
||||
for (int i = 0; i < firstHalf; i++) {
|
||||
sb.append('|');
|
||||
}
|
||||
sb.append("<gold>"); // TODO: tier color
|
||||
sb.append(' ');
|
||||
sb.append(health);
|
||||
sb.append(' ');
|
||||
int secondHalf = green - firstHalf;
|
||||
|
||||
sb.append("<dark_red>");
|
||||
for (int i = 0; i < 10 - secondHalf; i++) {
|
||||
sb.append('|');
|
||||
}
|
||||
sb.append("<green>");
|
||||
for (int i = 0; i < secondHalf; i++) {
|
||||
sb.append('|');
|
||||
}
|
||||
|
||||
sb.append("<gray>");
|
||||
sb.append(']');
|
||||
return Utils.colorComp(sb.toString());
|
||||
}
|
||||
}
|
|
@ -0,0 +1,35 @@
|
|||
package me.unurled.raxen.components.entity.other;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
public class MobType {
|
||||
|
||||
public String identifier;
|
||||
public String name;
|
||||
public Class<? extends Entity> entityClass;
|
||||
public int level;
|
||||
public ArrayList<String> prefixes;
|
||||
public ArrayList<String> suffix;
|
||||
public long xp;
|
||||
public ArrayList<ItemStack> equips;
|
||||
// TODO: public ArrayList<MobAttributes> attributes;
|
||||
public boolean hasSkull = false;
|
||||
public ItemStack offHand;
|
||||
|
||||
public int getTier() {
|
||||
if (level >= 80) {
|
||||
return 5;
|
||||
} else if (level >= 60) {
|
||||
return 4;
|
||||
} else if (level >= 40) {
|
||||
return 3;
|
||||
} else if (level >= 20) {
|
||||
return 2;
|
||||
} else {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -1,13 +1,23 @@
|
|||
package me.unurled.raxen.components.entity.other;
|
||||
|
||||
import static me.unurled.raxen.utils.Utils.colorString;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.UUID;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import me.unurled.raxen.Raxen;
|
||||
import me.unurled.raxen.components.entity.DamageType;
|
||||
import me.unurled.raxen.components.entity.player.RaxenPlayer;
|
||||
import me.unurled.raxen.utils.Tags;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.NamespacedKey;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.persistence.PersistentDataContainer;
|
||||
import org.bukkit.persistence.PersistentDataType;
|
||||
|
||||
|
@ -18,6 +28,11 @@ public abstract class RaxenEntity {
|
|||
@Getter
|
||||
private final String name;
|
||||
|
||||
@Getter
|
||||
private final String ID;
|
||||
|
||||
public Component fullName;
|
||||
|
||||
@Getter
|
||||
private Integer level;
|
||||
|
||||
|
@ -33,31 +48,53 @@ public abstract class RaxenEntity {
|
|||
@Setter
|
||||
Boolean isAlive = false;
|
||||
|
||||
boolean despawned = false;
|
||||
|
||||
me.unurled.raxen.components.entity.other.custom.Entity entity;
|
||||
public HashMap<UUID, Long> lastAttackedByTimes;
|
||||
public java.util.HashMap<UUID, Long> damageDealt;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
Boolean isHostile;
|
||||
|
||||
public RaxenEntity(
|
||||
Raxen main,
|
||||
String name,
|
||||
String id,
|
||||
Integer level,
|
||||
Double health,
|
||||
Double strength
|
||||
) {
|
||||
this.main = main;
|
||||
this.name = name;
|
||||
ID = id;
|
||||
this.level = level;
|
||||
this.health = health;
|
||||
this.strength = strength;
|
||||
isHostile = true;
|
||||
}
|
||||
|
||||
public Entity createEntity(EntityType types, String name, Location location) {
|
||||
Entity e = location.getWorld().spawnEntity(location, types);
|
||||
/*public Entity createEntity(
|
||||
me.unurled.raxen.components.entity.other.custom.Entity ent,
|
||||
String name,
|
||||
Location location
|
||||
) {
|
||||
me.unurled.raxen.components.entity.other.custom.Entity e = (me.unurled.raxen.components.entity.other.custom.Entity) location.getWorld()
|
||||
// .spawnEntity(location, ent);
|
||||
e.setCustomNameVisible(true);
|
||||
e.customName(Component.text(name));
|
||||
|
||||
entity = e;
|
||||
return e;
|
||||
}
|
||||
}*/
|
||||
|
||||
public void register(Entity e) {
|
||||
PersistentDataContainer data = e.getPersistentDataContainer();
|
||||
data.set(new NamespacedKey(main, "NAME"), PersistentDataType.STRING, name);
|
||||
data.set(
|
||||
new NamespacedKey(main, "NAME"),
|
||||
PersistentDataType.STRING,
|
||||
name
|
||||
);
|
||||
}
|
||||
|
||||
public Double getMaxHealth(Entity e) {
|
||||
|
@ -67,4 +104,173 @@ public abstract class RaxenEntity {
|
|||
}
|
||||
|
||||
public abstract Entity createEntity(Location location);
|
||||
|
||||
public void die() {
|
||||
die(true);
|
||||
}
|
||||
|
||||
public void die(boolean drop) {
|
||||
if (!isAlive) {
|
||||
return;
|
||||
}
|
||||
isAlive = false;
|
||||
// set mob ai false
|
||||
Location deathLoc = entity.getLocation();
|
||||
entity.customName(fullName);
|
||||
Tags.makeFloatingText("<gold>+ EXP", deathLoc, 1.3, 1.0, 1.5, 1);
|
||||
// TODO: damge entity method damage
|
||||
// TODO: desawn
|
||||
// TODO: xp
|
||||
|
||||
// xp
|
||||
int totalLevel = 0;
|
||||
int pdCount = 0;
|
||||
ArrayList<RaxenPlayer> players = new ArrayList<>();
|
||||
double damageSum = 0;
|
||||
RaxenPlayer player = null;
|
||||
for (Entry<UUID, Long> entry : damageDealt.entrySet()) {
|
||||
if ((player = main.getManager().getPlayerManager().getRaxenPlayer(entry.getKey()))
|
||||
!= null) {
|
||||
damageSum += entry.getValue();
|
||||
totalLevel += player.getLevel();
|
||||
pdCount++;
|
||||
players.add(main.getManager().getPlayerManager().getRaxenPlayer(entry.getKey()));
|
||||
}
|
||||
}
|
||||
if (pdCount < 1) {
|
||||
totalLevel = 1;
|
||||
pdCount = 1;
|
||||
}
|
||||
double avgLv = totalLevel / (double) pdCount;
|
||||
for (RaxenPlayer pd : players) {
|
||||
if (damageDealt.containsKey(pd.getPlayer().getUniqueId())) {
|
||||
pd.incrementMobCounter(ID);
|
||||
double percentage =
|
||||
damageDealt.get(pd.getPlayer().getUniqueId()) / (double) damageSum;
|
||||
if (percentage >= 0.10) {
|
||||
pd.addMobKills();
|
||||
// IDEA: is boss add to counter
|
||||
}
|
||||
long amt = (long) Math.ceil(entity.getXp() * percentage);
|
||||
if (!(level >= 80 && pd.getLevel() >= 80)
|
||||
&& Math.abs(pd.getLevel() - level) >= 10) {
|
||||
double penalty = 0.70;
|
||||
penalty -= (Math.abs(pd.getLevel() - level) - 10) * 0.06;
|
||||
if (penalty < 0.10) {
|
||||
penalty = 0.10;
|
||||
}
|
||||
pd.gainXp((long) Math.ceil(amt * penalty), true);
|
||||
} else {
|
||||
pd.gainXp(amt);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void despawn() {
|
||||
if (despawned) {
|
||||
return;
|
||||
}
|
||||
despawned = true;
|
||||
if (entity != null) {
|
||||
entity.remove();
|
||||
}
|
||||
entity = null;
|
||||
// TODO: bosses, respawn etc
|
||||
}
|
||||
|
||||
|
||||
public boolean attack(RaxenPlayer pd) {
|
||||
return attack(pd, 0.5, -1, false);
|
||||
}
|
||||
|
||||
public boolean attack(RaxenPlayer pd, int rpgDamage) {
|
||||
return attack(pd, 0.5, rpgDamage, false);
|
||||
}
|
||||
|
||||
public boolean attack(RaxenPlayer pd, int rpgDamage, boolean projectile) {
|
||||
return attack(pd, 0.5, rpgDamage, projectile);
|
||||
}
|
||||
|
||||
public boolean attack(RaxenPlayer pd, double knockback, int rDamage, boolean projectile) {
|
||||
boolean sucess = false;
|
||||
sucess = pd.damage(rDamage > -1 ? rDamage : (int) entity.getDamage(), entity,
|
||||
DamageType.NORMAL);
|
||||
if (sucess && !projectile) {
|
||||
// pd.knockback(entity, knockback);
|
||||
// TODO: knockback
|
||||
}
|
||||
return sucess;
|
||||
}
|
||||
|
||||
public boolean damage(int damageAmount, Entity damager, DamageType damageType) {
|
||||
return damage(damageAmount, damager, damageType, false);
|
||||
}
|
||||
|
||||
public boolean damage(int damage, Entity damager, DamageType damageType, boolean crit) {
|
||||
if (!isAlive) {
|
||||
return false;
|
||||
}
|
||||
if (damager != null && damager instanceof Player player) {
|
||||
if (!player.isOnline()
|
||||
|| main.getManager().getPlayerManager().getRaxenPlayer(player) == null) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (damage > entity.getHealth()) {
|
||||
damage = entity.getHealth().intValue();
|
||||
}
|
||||
if (damager != null && damager instanceof Player player) {
|
||||
RaxenPlayer pd = main.getManager().getPlayerManager().getRaxenPlayer(player);
|
||||
if (damageDealt.containsKey(damager.getUniqueId())) {
|
||||
damageDealt.put(damager.getUniqueId(),
|
||||
damageDealt.get(damager.getUniqueId()) + damage);
|
||||
} else {
|
||||
damageDealt.put(damager.getUniqueId(), (long) damage);
|
||||
}
|
||||
}
|
||||
if (damager != null) {
|
||||
lastAttackedByTimes.put(damager.getUniqueId(), System.currentTimeMillis());
|
||||
}
|
||||
if (damage < 1) {
|
||||
damage = 1;
|
||||
}
|
||||
health -= damage;
|
||||
if (health < 0) {
|
||||
health = 0.0;
|
||||
}
|
||||
if (damager != null && damager instanceof Player player) {
|
||||
player.playSound(player.getLocation(), Sound.ENTITY_PLAYER_HURT, 0.65f, 0.75f);
|
||||
}
|
||||
if (health <= 0) {
|
||||
die();
|
||||
} else {
|
||||
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public String getFullName() {
|
||||
if (isHostile) {
|
||||
return colorString(
|
||||
getLevel() +
|
||||
"<white>⚔️" +
|
||||
getName() +
|
||||
"<red>" +
|
||||
health +
|
||||
"<white>/<white/>" +
|
||||
getMaxHealth(entity)
|
||||
);
|
||||
} else {
|
||||
return colorString(
|
||||
getLevel() +
|
||||
"<white>❤️" +
|
||||
getName() +
|
||||
"<red>" +
|
||||
health +
|
||||
"<white>/<white/>" +
|
||||
getMaxHealth(entity)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@ import lombok.Getter;
|
|||
import lombok.Setter;
|
||||
import me.unurled.raxen.Raxen;
|
||||
|
||||
public class Entity {
|
||||
public abstract class Entity implements org.bukkit.entity.Entity {
|
||||
|
||||
private java.util.UUID uuid;
|
||||
|
||||
|
@ -39,6 +39,10 @@ public class Entity {
|
|||
@Setter
|
||||
private boolean isHostile;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
private double xp;
|
||||
|
||||
public Entity(
|
||||
String name,
|
||||
Integer level,
|
||||
|
@ -46,7 +50,8 @@ public class Entity {
|
|||
Double strength,
|
||||
Double defense,
|
||||
Double speed,
|
||||
boolean isHostile
|
||||
boolean isHostile,
|
||||
double xp
|
||||
) {
|
||||
this.name = name;
|
||||
this.level = level;
|
||||
|
@ -57,10 +62,11 @@ public class Entity {
|
|||
this.maxHealth = maxHealth;
|
||||
this.isHostile = isHostile;
|
||||
this.uuid = UUID.randomUUID();
|
||||
this.xp = xp;
|
||||
}
|
||||
|
||||
public void register(Raxen main) {
|
||||
main.getManager().getEntityManager().entities.put(name, this);
|
||||
// main.getManager().getEntityManager().entities.put(name, this);
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
|
@ -100,4 +106,9 @@ public class Entity {
|
|||
|
||||
return health;
|
||||
}
|
||||
|
||||
public double getDamage() {
|
||||
// TODO: calculate properly the damage
|
||||
return strength;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,25 +1,674 @@
|
|||
package me.unurled.raxen.components.entity.other.custom;
|
||||
|
||||
import io.papermc.paper.entity.TeleportFlag;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import org.bukkit.EntityEffect;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Server;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.block.PistonMoveReaction;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.entity.Pose;
|
||||
import org.bukkit.entity.SpawnCategory;
|
||||
import org.bukkit.event.entity.CreatureSpawnEvent;
|
||||
import org.bukkit.event.entity.EntityDamageEvent;
|
||||
import org.bukkit.event.player.PlayerTeleportEvent;
|
||||
import org.bukkit.metadata.MetadataValue;
|
||||
import org.bukkit.permissions.Permission;
|
||||
import org.bukkit.permissions.PermissionAttachment;
|
||||
import org.bukkit.permissions.PermissionAttachmentInfo;
|
||||
import org.bukkit.persistence.PersistentDataContainer;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
import org.bukkit.util.BoundingBox;
|
||||
import org.bukkit.util.Vector;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public class Humanoid extends Entity {
|
||||
|
||||
private String skin; // used to get the path to the skin
|
||||
private UUID skinUuid; // used to get the player skin (if i do it this way...
|
||||
|
||||
public Humanoid(
|
||||
String name,
|
||||
Integer level,
|
||||
Double maxHealth,
|
||||
Double strength,
|
||||
Double defense,
|
||||
Double speed,
|
||||
boolean isHostile,
|
||||
String skin,
|
||||
UUID skinUuid
|
||||
) {
|
||||
super(name, level, maxHealth, strength, defense, speed, isHostile);
|
||||
this.skin = skin;
|
||||
this.skinUuid = skinUuid;
|
||||
public Humanoid(String name, Integer level, Double maxHealth, Double strength, Double defense,
|
||||
Double speed, boolean isHostile, double xp) {
|
||||
super(name, level, maxHealth, strength, defense, speed, isHostile, xp);
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull Location getLocation() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public @Nullable Location getLocation(@Nullable Location loc) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setVelocity(@NotNull Vector velocity) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull Vector getVelocity() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getHeight() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getWidth() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull BoundingBox getBoundingBox() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOnGround() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isInWater() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull World getWorld() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setRotation(float yaw, float pitch) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean teleport(@NotNull Location location,
|
||||
@NotNull PlayerTeleportEvent.TeleportCause cause,
|
||||
@NotNull TeleportFlag @NotNull ... teleportFlags) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean teleport(@NotNull Location location) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean teleport(@NotNull Location location,
|
||||
@NotNull PlayerTeleportEvent.TeleportCause cause) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean teleport(org.bukkit.entity.@NotNull Entity destination) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean teleport(org.bukkit.entity.@NotNull Entity destination,
|
||||
@NotNull PlayerTeleportEvent.TeleportCause cause) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull List<org.bukkit.entity.Entity> getNearbyEntities(double x, double y, double z) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getEntityId() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getFireTicks() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxFireTicks() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setFireTicks(int ticks) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setVisualFire(boolean fire) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isVisualFire() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getFreezeTicks() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxFreezeTicks() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setFreezeTicks(int ticks) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFrozen() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFreezeTickingLocked() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void lockFreezeTicks(boolean locked) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void remove() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDead() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isValid() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendMessage(@NotNull String message) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendMessage(@NotNull String... messages) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendMessage(@Nullable UUID sender, @NotNull String message) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendMessage(@Nullable UUID sender, @NotNull String... messages) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull Server getServer() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isPersistent() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPersistent(boolean persistent) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public org.bukkit.entity.@Nullable Entity getPassenger() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean setPassenger(org.bukkit.entity.@NotNull Entity passenger) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull List<org.bukkit.entity.Entity> getPassengers() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean addPassenger(org.bukkit.entity.@NotNull Entity passenger) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean removePassenger(org.bukkit.entity.@NotNull Entity passenger) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEmpty() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean eject() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getFallDistance() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setFallDistance(float distance) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setLastDamageCause(@Nullable EntityDamageEvent event) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public @Nullable EntityDamageEvent getLastDamageCause() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull UUID getUniqueId() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getTicksLived() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setTicksLived(int value) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void playEffect(@NotNull EntityEffect type) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull EntityType getType() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull Sound getSwimSound() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull Sound getSwimSplashSound() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull Sound getSwimHighSpeedSplashSound() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isInsideVehicle() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean leaveVehicle() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public org.bukkit.entity.@Nullable Entity getVehicle() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCustomNameVisible(boolean flag) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCustomNameVisible() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setVisibleByDefault(boolean visible) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isVisibleByDefault() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setGlowing(boolean flag) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isGlowing() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setInvulnerable(boolean flag) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isInvulnerable() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSilent() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSilent(boolean flag) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasGravity() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setGravity(boolean gravity) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getPortalCooldown() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPortalCooldown(int cooldown) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull Set<String> getScoreboardTags() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean addScoreboardTag(@NotNull String tag) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean removeScoreboardTag(@NotNull String tag) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull PistonMoveReaction getPistonMoveReaction() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull BlockFace getFacing() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull Pose getPose() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSneaking() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSneaking(boolean sneak) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull SpawnCategory getSpawnCategory() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull Spigot spigot() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull Component name() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull Component teamDisplayName() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public @Nullable Location getOrigin() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean fromMobSpawner() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull CreatureSpawnEvent.SpawnReason getEntitySpawnReason() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isUnderWater() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isInRain() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isInBubbleColumn() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isInWaterOrRain() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isInWaterOrBubbleColumn() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isInWaterOrRainOrBubbleColumn() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isInLava() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isTicking() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull Set<Player> getTrackedPlayers() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean spawnAt(@NotNull Location location,
|
||||
@NotNull CreatureSpawnEvent.SpawnReason reason) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isInPowderedSnow() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean collidesAt(@NotNull Location location) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean wouldCollideUsing(@NotNull BoundingBox boundingBox) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public @Nullable Component customName() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void customName(@Nullable Component customName) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public @Nullable String getCustomName() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCustomName(@Nullable String name) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setMetadata(@NotNull String metadataKey, @NotNull MetadataValue newMetadataValue) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull List<MetadataValue> getMetadata(@NotNull String metadataKey) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasMetadata(@NotNull String metadataKey) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeMetadata(@NotNull String metadataKey, @NotNull Plugin owningPlugin) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isPermissionSet(@NotNull String name) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isPermissionSet(@NotNull Permission perm) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasPermission(@NotNull String name) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasPermission(@NotNull Permission perm) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull PermissionAttachment addAttachment(@NotNull Plugin plugin, @NotNull String name,
|
||||
boolean value) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull PermissionAttachment addAttachment(@NotNull Plugin plugin) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public @Nullable PermissionAttachment addAttachment(@NotNull Plugin plugin,
|
||||
@NotNull String name, boolean value, int ticks) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public @Nullable PermissionAttachment addAttachment(@NotNull Plugin plugin, int ticks) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeAttachment(@NotNull PermissionAttachment attachment) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void recalculatePermissions() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull Set<PermissionAttachmentInfo> getEffectivePermissions() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOp() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setOp(boolean value) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull PersistentDataContainer getPersistentDataContainer() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,12 +5,12 @@ import me.unurled.raxen.Raxen;
|
|||
import me.unurled.raxen.components.entity.other.RaxenEntity;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.EntityType;
|
||||
|
||||
public class Elf extends RaxenEntity {
|
||||
|
||||
@Getter
|
||||
private final String name;
|
||||
private final String id = "elf";
|
||||
|
||||
public Elf(
|
||||
Raxen main,
|
||||
|
@ -19,22 +19,23 @@ public class Elf extends RaxenEntity {
|
|||
Double health,
|
||||
Double strength
|
||||
) {
|
||||
super(main, name, level, health, strength);
|
||||
super(main, name, "elf", level, health, strength);
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Elf Default values
|
||||
*
|
||||
* @param main the main instance
|
||||
* @param name
|
||||
*/
|
||||
public Elf(Raxen main, String name) {
|
||||
super(main, "Elf", "elf", 10, 120.0, 25.0);
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Entity createEntity(Location location) {
|
||||
return super.createEntity(EntityType.PLAYER, name, location);
|
||||
}
|
||||
|
||||
/**
|
||||
* Elf Default values
|
||||
* @param main the main instance
|
||||
* @param name
|
||||
*/
|
||||
public Elf(Raxen main, String name) {
|
||||
super(main, "Elf", 10, 120.0, 25.0);
|
||||
this.name = name;
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,7 +5,6 @@ import me.unurled.raxen.Raxen;
|
|||
import me.unurled.raxen.components.entity.other.RaxenEntity;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.EntityType;
|
||||
|
||||
public class Wolf extends RaxenEntity {
|
||||
|
||||
|
@ -19,17 +18,17 @@ public class Wolf extends RaxenEntity {
|
|||
Double health,
|
||||
Double strength
|
||||
) {
|
||||
super(main, name, level, health, strength);
|
||||
super(main, name, "elf", level, health, strength);
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public Wolf(Raxen main) {
|
||||
super(main, "Wolf", 5, 100.0, 20.0);
|
||||
super(main, "Wolf", "elf", 5, 100.0, 20.0);
|
||||
this.name = "Wolf";
|
||||
}
|
||||
|
||||
@Override
|
||||
public Entity createEntity(Location location) {
|
||||
return super.createEntity(EntityType.WOLF, name, location);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,22 +1,56 @@
|
|||
package me.unurled.raxen.components.entity.other.custom.hostile.low;
|
||||
|
||||
import io.papermc.paper.entity.TeleportFlag;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import me.unurled.raxen.Raxen;
|
||||
import me.unurled.raxen.components.entity.other.RaxenEntity;
|
||||
import me.unurled.raxen.components.entity.other.custom.Entity;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import org.bukkit.EntityEffect;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Server;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.block.PistonMoveReaction;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.entity.Pose;
|
||||
import org.bukkit.entity.SpawnCategory;
|
||||
import org.bukkit.event.entity.CreatureSpawnEvent;
|
||||
import org.bukkit.event.entity.EntityDamageEvent;
|
||||
import org.bukkit.event.player.PlayerTeleportEvent;
|
||||
import org.bukkit.metadata.MetadataValue;
|
||||
import org.bukkit.permissions.Permission;
|
||||
import org.bukkit.permissions.PermissionAttachment;
|
||||
import org.bukkit.permissions.PermissionAttachmentInfo;
|
||||
import org.bukkit.persistence.PersistentDataContainer;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
import org.bukkit.util.BoundingBox;
|
||||
import org.bukkit.util.Vector;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public class Goblin extends Entity {
|
||||
|
||||
RaxenEntity goblin;
|
||||
|
||||
public Goblin(Raxen main) {
|
||||
super("Goblin", 1, 100.0, 10.0, 0.0, 50.0, true);
|
||||
super("Goblin", 1, 100.0, 10.0, 0.0, 50.0, true, 100);
|
||||
this.goblin =
|
||||
new RaxenEntity(main, "Goblin", 1, 100.0, 10.0) {
|
||||
new RaxenEntity(main, "Goblin", "goblin", 1, 100.0, 10.0) {
|
||||
@Override
|
||||
public org.bukkit.entity.Entity createEntity(Location location) {
|
||||
return super.createEntity(EntityType.PLAYER, "Goblin", location);
|
||||
public org.bukkit.entity.Entity createEntity(
|
||||
Location location
|
||||
) {
|
||||
return null;
|
||||
/* return super.createEntity(
|
||||
EntityType.PLAYER,
|
||||
"Goblin",
|
||||
location
|
||||
);*/
|
||||
}
|
||||
};
|
||||
register(main);
|
||||
|
@ -36,4 +70,636 @@ public class Goblin extends Entity {
|
|||
getMaxHealth()
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull Location getLocation() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public @Nullable Location getLocation(@Nullable Location loc) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setVelocity(@NotNull Vector velocity) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull Vector getVelocity() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getHeight() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getWidth() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull BoundingBox getBoundingBox() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOnGround() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isInWater() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull World getWorld() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setRotation(float yaw, float pitch) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean teleport(@NotNull Location location,
|
||||
@NotNull PlayerTeleportEvent.TeleportCause cause,
|
||||
@NotNull TeleportFlag @NotNull ... teleportFlags) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean teleport(@NotNull Location location) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean teleport(@NotNull Location location,
|
||||
@NotNull PlayerTeleportEvent.TeleportCause cause) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean teleport(org.bukkit.entity.@NotNull Entity destination) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean teleport(org.bukkit.entity.@NotNull Entity destination,
|
||||
@NotNull PlayerTeleportEvent.TeleportCause cause) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull List<org.bukkit.entity.Entity> getNearbyEntities(double x, double y, double z) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getEntityId() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getFireTicks() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxFireTicks() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setFireTicks(int ticks) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setVisualFire(boolean fire) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isVisualFire() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getFreezeTicks() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxFreezeTicks() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setFreezeTicks(int ticks) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFrozen() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFreezeTickingLocked() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void lockFreezeTicks(boolean locked) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void remove() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDead() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isValid() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendMessage(@NotNull String message) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendMessage(@NotNull String... messages) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendMessage(@Nullable UUID sender, @NotNull String message) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendMessage(@Nullable UUID sender, @NotNull String... messages) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull Server getServer() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isPersistent() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPersistent(boolean persistent) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public org.bukkit.entity.@Nullable Entity getPassenger() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean setPassenger(org.bukkit.entity.@NotNull Entity passenger) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull List<org.bukkit.entity.Entity> getPassengers() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean addPassenger(org.bukkit.entity.@NotNull Entity passenger) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean removePassenger(org.bukkit.entity.@NotNull Entity passenger) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEmpty() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean eject() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getFallDistance() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setFallDistance(float distance) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setLastDamageCause(@Nullable EntityDamageEvent event) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public @Nullable EntityDamageEvent getLastDamageCause() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull UUID getUniqueId() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getTicksLived() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setTicksLived(int value) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void playEffect(@NotNull EntityEffect type) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull EntityType getType() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull Sound getSwimSound() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull Sound getSwimSplashSound() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull Sound getSwimHighSpeedSplashSound() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isInsideVehicle() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean leaveVehicle() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public org.bukkit.entity.@Nullable Entity getVehicle() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCustomNameVisible(boolean flag) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCustomNameVisible() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setVisibleByDefault(boolean visible) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isVisibleByDefault() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setGlowing(boolean flag) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isGlowing() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setInvulnerable(boolean flag) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isInvulnerable() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSilent() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSilent(boolean flag) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasGravity() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setGravity(boolean gravity) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getPortalCooldown() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPortalCooldown(int cooldown) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull Set<String> getScoreboardTags() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean addScoreboardTag(@NotNull String tag) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean removeScoreboardTag(@NotNull String tag) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull PistonMoveReaction getPistonMoveReaction() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull BlockFace getFacing() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull Pose getPose() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSneaking() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSneaking(boolean sneak) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull SpawnCategory getSpawnCategory() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull Spigot spigot() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull Component name() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull Component teamDisplayName() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public @Nullable Location getOrigin() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean fromMobSpawner() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull CreatureSpawnEvent.SpawnReason getEntitySpawnReason() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isUnderWater() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isInRain() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isInBubbleColumn() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isInWaterOrRain() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isInWaterOrBubbleColumn() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isInWaterOrRainOrBubbleColumn() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isInLava() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isTicking() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull Set<Player> getTrackedPlayers() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean spawnAt(@NotNull Location location,
|
||||
@NotNull CreatureSpawnEvent.SpawnReason reason) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isInPowderedSnow() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean collidesAt(@NotNull Location location) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean wouldCollideUsing(@NotNull BoundingBox boundingBox) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public @Nullable Component customName() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void customName(@Nullable Component customName) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public @Nullable String getCustomName() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCustomName(@Nullable String name) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setMetadata(@NotNull String metadataKey, @NotNull MetadataValue newMetadataValue) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull List<MetadataValue> getMetadata(@NotNull String metadataKey) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasMetadata(@NotNull String metadataKey) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeMetadata(@NotNull String metadataKey, @NotNull Plugin owningPlugin) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isPermissionSet(@NotNull String name) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isPermissionSet(@NotNull Permission perm) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasPermission(@NotNull String name) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasPermission(@NotNull Permission perm) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull PermissionAttachment addAttachment(@NotNull Plugin plugin, @NotNull String name,
|
||||
boolean value) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull PermissionAttachment addAttachment(@NotNull Plugin plugin) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public @Nullable PermissionAttachment addAttachment(@NotNull Plugin plugin,
|
||||
@NotNull String name, boolean value, int ticks) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public @Nullable PermissionAttachment addAttachment(@NotNull Plugin plugin, int ticks) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeAttachment(@NotNull PermissionAttachment attachment) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void recalculatePermissions() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull Set<PermissionAttachmentInfo> getEffectivePermissions() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOp() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setOp(boolean value) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull PersistentDataContainer getPersistentDataContainer() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,224 @@
|
|||
package me.unurled.raxen.components.entity.player;
|
||||
|
||||
public class PlayerStatistics {
|
||||
|
||||
public static long getEXPForNextLevel(int level) {
|
||||
if (level < 1) {
|
||||
level = 1;
|
||||
}
|
||||
long ret = 1;
|
||||
if (level <= 200) {
|
||||
ret = PlayerStatistics.EXP_REQUIREMENTS[level - 1][1];
|
||||
} else {
|
||||
ret = (int) (Math.pow(1.0548, level - 200) * EXP_REQUIREMENTS[EXP_REQUIREMENTS.length
|
||||
- 1][1]);
|
||||
}
|
||||
if (ret < 0) {
|
||||
ret = Long.MAX_VALUE;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
private static final int[][] EXP_REQUIREMENTS = {
|
||||
{1, 15},
|
||||
{2, 34},
|
||||
{3, 57},
|
||||
{4, 92},
|
||||
{5, 135},
|
||||
{6, 372},
|
||||
{7, 560},
|
||||
{8, 840},
|
||||
{9, 1242},
|
||||
{10, 1144},
|
||||
{11, 1573},
|
||||
{12, 2144},
|
||||
{13, 2800},
|
||||
{14, 3640},
|
||||
{15, 4700},
|
||||
{16, 5893},
|
||||
{17, 7360},
|
||||
{18, 9144},
|
||||
{19, 11120},
|
||||
{20, 13477},
|
||||
{21, 16268},
|
||||
{22, 19320},
|
||||
{23, 22880},
|
||||
{24, 27008},
|
||||
{25, 31477},
|
||||
{26, 36600},
|
||||
{27, 42444},
|
||||
{28, 48720},
|
||||
{29, 55813},
|
||||
{30, 63800},
|
||||
{31, 86784},
|
||||
{32, 98208},
|
||||
{33, 110932},
|
||||
{34, 124432},
|
||||
{35, 139372},
|
||||
{36, 155865},
|
||||
{37, 173280},
|
||||
{38, 192400},
|
||||
{39, 213345},
|
||||
{40, 235372},
|
||||
{41, 259392},
|
||||
{42, 285532},
|
||||
{43, 312928},
|
||||
{44, 342624},
|
||||
{45, 374760},
|
||||
{46, 408336},
|
||||
{47, 445544},
|
||||
{48, 483532},
|
||||
{49, 524160},
|
||||
{50, 567772},
|
||||
{51, 598886},
|
||||
{52, 631704},
|
||||
{53, 666321},
|
||||
{54, 702836},
|
||||
{55, 741351},
|
||||
{56, 781976},
|
||||
{57, 824828},
|
||||
{58, 870028},
|
||||
{59, 917625},
|
||||
{60, 967995},
|
||||
{61, 1021041},
|
||||
{62, 1076994},
|
||||
{63, 1136013},
|
||||
{64, 1198266},
|
||||
{65, 1263930},
|
||||
{66, 1333194},
|
||||
{67, 1406252},
|
||||
{68, 1483314},
|
||||
{69, 1564600},
|
||||
{70, 1650340},
|
||||
{71, 1740778},
|
||||
{72, 1836173},
|
||||
{73, 1936794},
|
||||
{74, 2042930},
|
||||
{75, 2154882},
|
||||
{76, 2272970},
|
||||
{77, 2397528},
|
||||
{78, 2528912},
|
||||
{79, 2667496},
|
||||
{80, 2813674},
|
||||
{81, 2967863},
|
||||
{82, 3130502},
|
||||
{83, 3302053},
|
||||
{84, 3483005},
|
||||
{85, 3673873},
|
||||
{86, 3875201},
|
||||
{87, 4087562},
|
||||
{88, 4311559},
|
||||
{89, 4547832},
|
||||
{90, 4797053},
|
||||
{91, 5059931},
|
||||
{92, 5337215},
|
||||
{93, 5629694},
|
||||
{94, 5938202},
|
||||
{95, 6263614},
|
||||
{96, 6606860},
|
||||
{97, 6968915},
|
||||
{98, 7350811},
|
||||
{99, 7753635},
|
||||
{100, 8178534},
|
||||
{101, 8626718},
|
||||
{102, 9099462},
|
||||
{103, 9598112},
|
||||
{104, 10124088},
|
||||
{105, 10678888},
|
||||
{106, 11264090},
|
||||
{107, 11881362},
|
||||
{108, 12532461},
|
||||
{109, 13219239},
|
||||
{110, 13943653},
|
||||
{111, 14707765},
|
||||
{112, 15513750},
|
||||
{113, 16363902},
|
||||
{114, 17260644},
|
||||
{115, 18206527},
|
||||
{116, 19204245},
|
||||
{117, 20256637},
|
||||
{118, 21366700},
|
||||
{119, 22537594},
|
||||
{120, 23772654},
|
||||
{121, 25075395},
|
||||
{122, 26449526},
|
||||
{123, 27898960},
|
||||
{124, 29427822},
|
||||
{125, 31040466},
|
||||
{126, 32741483},
|
||||
{127, 34535716},
|
||||
{128, 36428273},
|
||||
{129, 38424542},
|
||||
{130, 40530206},
|
||||
{131, 42751262},
|
||||
{132, 45094030},
|
||||
{133, 47565183},
|
||||
{134, 50171755},
|
||||
{135, 52921167},
|
||||
{136, 55821246},
|
||||
{137, 58880250},
|
||||
{138, 62106888},
|
||||
{139, 65510344},
|
||||
{140, 69100311},
|
||||
{141, 72887008},
|
||||
{142, 76881216},
|
||||
{143, 81094306},
|
||||
{144, 85594273},
|
||||
{145, 90225770},
|
||||
{146, 95170142},
|
||||
{147, 100385466},
|
||||
{148, 105886589},
|
||||
{149, 111689174},
|
||||
{150, 117809740},
|
||||
{151, 124265714},
|
||||
{152, 131075474},
|
||||
{153, 138258410},
|
||||
{154, 145834970},
|
||||
{155, 153826726},
|
||||
{156, 162256430},
|
||||
{157, 171148082},
|
||||
{158, 180526997},
|
||||
{159, 190419876},
|
||||
{160, 200854885},
|
||||
{161, 211861732},
|
||||
{162, 223471711},
|
||||
{163, 223471711},
|
||||
{164, 248635353},
|
||||
{165, 262260570},
|
||||
{166, 276632449},
|
||||
{167, 291791906},
|
||||
{168, 307782102},
|
||||
{169, 324648562},
|
||||
{170, 342439302},
|
||||
{171, 361204976},
|
||||
{172, 380999008},
|
||||
{173, 401877754},
|
||||
{174, 423900654},
|
||||
{175, 447130410},
|
||||
{176, 471633156},
|
||||
{177, 497478653},
|
||||
{178, 524740482},
|
||||
{179, 553496261},
|
||||
{180, 583827855},
|
||||
{181, 615821622},
|
||||
{182, 649568646},
|
||||
{183, 685165008},
|
||||
{184, 722712050},
|
||||
{185, 762316670},
|
||||
{186, 804091623},
|
||||
{187, 848155844},
|
||||
{188, 894634784},
|
||||
{189, 943660770},
|
||||
{190, 995373379},
|
||||
{191, 1049919840},
|
||||
{192, 1107455447},
|
||||
{193, 1168144006},
|
||||
{194, 1232158297},
|
||||
{195, 1299680571},
|
||||
{196, 1370903066},
|
||||
{197, 1446028554},
|
||||
{198, 1525246918},
|
||||
{199, 1608855764},
|
||||
{200, 1697021059},
|
||||
};
|
||||
}
|
|
@ -1,19 +1,20 @@
|
|||
package me.unurled.raxen.components.entity.player;
|
||||
|
||||
import static me.unurled.raxen.utils.Utils.colorComp;
|
||||
import static me.unurled.raxen.utils.Utils.debug;
|
||||
import static me.unurled.raxen.utils.Utils.log;
|
||||
|
||||
import me.unurled.raxen.Raxen;
|
||||
import me.unurled.raxen.manager.entity.PlayerManager;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.attribute.Attribute;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
import org.bukkit.scheduler.BukkitTask;
|
||||
|
||||
public class PlayerUtils {
|
||||
|
||||
public static void updateSkills(Raxen main, Player player) {
|
||||
PlayerManager pm =
|
||||
((Raxen) Bukkit.getPluginManager().getPlugin("Raxen")).getManager()
|
||||
.getPlayerManager();
|
||||
PlayerManager pm = main.getManager().getPlayerManager();
|
||||
int maxHealth, health, itemHealth, defense, itemDefense, speed, itemSpeed, strength, itemStrength, maxMana, mana, itemMana, luck, itemLuck;
|
||||
defense = pm.getDefense().get(player);
|
||||
maxMana = pm.getMaxMana().get(player);
|
||||
|
@ -29,9 +30,33 @@ public class PlayerUtils {
|
|||
itemStrength = pm.getItemStrength().get(player);
|
||||
itemSpeed = pm.getItemSpeed().get(player);
|
||||
itemMana = pm.getItemMana().get(player);
|
||||
double hearts = maxHealth + itemHealth;
|
||||
double heart = 10;
|
||||
if (hearts > 125 && hearts < 165) {
|
||||
heart = 11;
|
||||
} else if (hearts > 165 && hearts <= 230) {
|
||||
heart = 12;
|
||||
} else if (hearts > 230 && hearts <= 300) {
|
||||
heart = 13;
|
||||
} else if (hearts > 300 && hearts <= 400) {
|
||||
heart = 14;
|
||||
} else if (hearts > 400 && hearts <= 500) {
|
||||
heart = 15;
|
||||
} else if (hearts > 500 && hearts <= 650) {
|
||||
heart = 16;
|
||||
} else if (hearts > 650 && hearts <= 800) {
|
||||
heart = 17;
|
||||
} else if (hearts > 800 && hearts <= 1000) {
|
||||
heart = 18;
|
||||
} else if (hearts > 1000 && hearts <= 1250) {
|
||||
heart = 19;
|
||||
} else if (hearts > 1250) {
|
||||
heart = 20;
|
||||
}
|
||||
log(heart + " " + hearts);
|
||||
player
|
||||
.getAttribute(Attribute.GENERIC_MAX_HEALTH)
|
||||
.setBaseValue(20D + (health + itemHealth) / 100);
|
||||
.setBaseValue(heart * 2);
|
||||
player.setWalkSpeed((float) (0.0 + ((speed + itemSpeed) / 100) * 0.2));
|
||||
player.setFlySpeed((float) (0.0 + ((speed + itemSpeed) / 100) * 0.2));
|
||||
debug(
|
||||
|
@ -43,5 +68,32 @@ public class PlayerUtils {
|
|||
"Luck " + (luck + itemLuck),
|
||||
"Mana " + (mana + itemMana) + " Max Mana " + maxMana
|
||||
);
|
||||
pm.updateActionBar(player);
|
||||
}
|
||||
|
||||
public static BukkitTask actionBarPlayer(
|
||||
Raxen main,
|
||||
PlayerManager pm,
|
||||
Player player
|
||||
) {
|
||||
return new BukkitRunnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
player.sendActionBar(
|
||||
colorComp(
|
||||
"<red>" +
|
||||
pm.getHealth().get(player) +
|
||||
"/" +
|
||||
pm.getMaxHealth().get(player) +
|
||||
"❤</red> <aqua>" +
|
||||
pm.getMana().get(player) +
|
||||
"/" +
|
||||
pm.getMaxMana().get(player) +
|
||||
"</aqua>"
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
.runTaskTimerAsynchronously(main, 10, 20);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,19 +2,37 @@ package me.unurled.raxen.components.entity.player;
|
|||
|
||||
import static me.unurled.raxen.utils.Items.setItemsToInventory;
|
||||
import static me.unurled.raxen.utils.Utils.debug;
|
||||
import static me.unurled.raxen.utils.Utils.log;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import me.unurled.raxen.Raxen;
|
||||
import me.unurled.raxen.components.entity.DamageType;
|
||||
import me.unurled.raxen.components.entity.other.EntityNamespacedKey;
|
||||
import me.unurled.raxen.components.entity.other.MobData;
|
||||
import me.unurled.raxen.components.entity.player.attributes.Attribute;
|
||||
import me.unurled.raxen.components.entity.player.storages.EnderChest;
|
||||
import me.unurled.raxen.components.entity.player.storages.Inventory;
|
||||
import me.unurled.raxen.components.party.Party;
|
||||
import me.unurled.raxen.manager.entity.PlayerManager;
|
||||
import me.unurled.raxen.manager.entity.SpellManager.CastState;
|
||||
import me.unurled.raxen.utils.EntityAttributes;
|
||||
import me.unurled.raxen.utils.Items;
|
||||
import me.unurled.raxen.utils.Math;
|
||||
import me.unurled.raxen.utils.Utils;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.EntityEffect;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.boss.BarColor;
|
||||
import org.bukkit.boss.BarStyle;
|
||||
import org.bukkit.boss.BossBar;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.inventory.InventoryType;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
@ -25,9 +43,20 @@ import org.bukkit.persistence.PersistentDataType;
|
|||
public class RaxenPlayer {
|
||||
|
||||
private final Raxen main;
|
||||
@Getter
|
||||
private final Player player;
|
||||
private final EntityNamespacedKey namespacedKey;
|
||||
|
||||
double crit_chance = 0.05;
|
||||
public double critDamage = 1.50;
|
||||
public boolean dead = false;
|
||||
|
||||
private DamageType lastDamageCause = DamageType.NORMAL;
|
||||
|
||||
private long lastEnvironmentalDamaged = 0;
|
||||
private long lastDamagedNonEnvironmental = 0;
|
||||
private long lastDamaged = 0;
|
||||
|
||||
private Boolean isRaxenPlayer;
|
||||
|
||||
private Attribute attribute;
|
||||
|
@ -35,6 +64,25 @@ public class RaxenPlayer {
|
|||
private Storage storages;
|
||||
private Inventories inventory;
|
||||
|
||||
private boolean inTutorial;
|
||||
|
||||
private HashMap<String, HashMap<String, Integer>> mobCounter = new HashMap<String, HashMap<String, Integer>>();
|
||||
|
||||
private int mobKills, playerKills, deaths, bossKills;
|
||||
|
||||
public long xp;
|
||||
@Getter
|
||||
private int level;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
private Party party = null;
|
||||
@Getter
|
||||
@Setter
|
||||
private Party invitedParty = null;
|
||||
|
||||
BossBar bossBar;
|
||||
|
||||
public RaxenPlayer(Raxen main, Player player) {
|
||||
this.main = main;
|
||||
this.player = player;
|
||||
|
@ -89,7 +137,10 @@ public class RaxenPlayer {
|
|||
|
||||
public Storage getStorage() {
|
||||
PersistentDataContainer data = player.getPersistentDataContainer();
|
||||
String store = data.get(namespacedKey.storage, PersistentDataType.STRING);
|
||||
String store = data.get(
|
||||
namespacedKey.storage,
|
||||
PersistentDataType.STRING
|
||||
);
|
||||
org.bukkit.inventory.Inventory ec = Bukkit.createInventory(
|
||||
null,
|
||||
54,
|
||||
|
@ -103,7 +154,10 @@ public class RaxenPlayer {
|
|||
|
||||
public Inventories getInventory() {
|
||||
PersistentDataContainer data = player.getPersistentDataContainer();
|
||||
String inv = data.get(namespacedKey.inventory, PersistentDataType.STRING);
|
||||
String inv = data.get(
|
||||
namespacedKey.inventory,
|
||||
PersistentDataType.STRING
|
||||
);
|
||||
org.bukkit.inventory.Inventory invv = Bukkit.createInventory(
|
||||
player,
|
||||
InventoryType.PLAYER
|
||||
|
@ -121,7 +175,7 @@ public class RaxenPlayer {
|
|||
public void setInventory(org.bukkit.inventory.Inventory inv) {
|
||||
PersistentDataContainer data = player.getPersistentDataContainer();
|
||||
List<String> listInv = new ArrayList<String>();
|
||||
Integer reverse = 0;
|
||||
int reverse = 0;
|
||||
for (ItemStack it : inv) {
|
||||
reverse = reverse + 1;
|
||||
if (it != null && it.getType() != Material.AIR) {
|
||||
|
@ -151,13 +205,16 @@ public class RaxenPlayer {
|
|||
}
|
||||
|
||||
public Storage createStorage() {
|
||||
setStorage(Bukkit.createInventory(null, 54, Component.text("Ender Chest")));
|
||||
setStorage(
|
||||
Bukkit.createInventory(null, 54, Component.text("Ender Chest"))
|
||||
);
|
||||
return getStorage();
|
||||
}
|
||||
|
||||
public Inventories createInventory() {
|
||||
setInventory(Bukkit.createInventory(null, InventoryType.PLAYER));
|
||||
return getInventory();
|
||||
org.bukkit.inventory.Inventory inv = Bukkit.createInventory(null, InventoryType.PLAYER);
|
||||
setInventory(inv);
|
||||
return new Inventories(new Inventory(inv));
|
||||
}
|
||||
|
||||
public Boolean isRaxenPlayer() {
|
||||
|
@ -171,4 +228,376 @@ public class RaxenPlayer {
|
|||
public Attribute getAttribute() {
|
||||
return attribute;
|
||||
}
|
||||
|
||||
public boolean isInTutorial() {
|
||||
return inTutorial;
|
||||
}
|
||||
|
||||
public void setInTutorial(boolean inTutorial) {
|
||||
this.inTutorial = inTutorial;
|
||||
}
|
||||
|
||||
public int getDamage() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public boolean attackPlayer(RaxenPlayer player) {
|
||||
return attackPlayer(player, -1, false, 0.5);
|
||||
}
|
||||
|
||||
public boolean attackPlayer(RaxenPlayer player, int damage) {
|
||||
return attackPlayer(player, damage, false, 0.5);
|
||||
}
|
||||
|
||||
public boolean attackPlayer(RaxenPlayer player, int damage, boolean projectile) {
|
||||
return attackPlayer(player, damage, projectile, 0.5);
|
||||
}
|
||||
|
||||
public boolean attackPlayer(RaxenPlayer player, int damage, boolean projectile,
|
||||
double knockback) {
|
||||
if (player == null) {
|
||||
return false;
|
||||
}
|
||||
if (player == null) {
|
||||
return false;
|
||||
}
|
||||
int eDamage;
|
||||
if (damage > 0) {
|
||||
eDamage = damage;
|
||||
} else {
|
||||
eDamage = getDamage();
|
||||
}
|
||||
boolean crit = false;
|
||||
if (java.lang.Math.random() < crit_chance) {
|
||||
crit = true;
|
||||
eDamage = (int) (eDamage * 1.5);
|
||||
}
|
||||
boolean sucess = false;
|
||||
// TODO: calculate with classes... later
|
||||
sucess = player.damage(eDamage, this.player, DamageType.NORMAL, crit);
|
||||
return sucess;
|
||||
}
|
||||
|
||||
public boolean attackMob(MobData other) {
|
||||
return attackMob(other, 0.5, -1, false);
|
||||
}
|
||||
|
||||
public boolean attackMob(MobData other, int rpgDamage) {
|
||||
return attackMob(other, 0.5, rpgDamage, false);
|
||||
}
|
||||
|
||||
public boolean attackMob(MobData other, int rpgDamage, boolean projectile) {
|
||||
return attackMob(other, 0.5, rpgDamage, projectile);
|
||||
}
|
||||
|
||||
public boolean attackMob(MobData other, double knockback, int rpgDamage,
|
||||
boolean projectil) {
|
||||
Player p = getPlayer();
|
||||
if (p == null || other == null) {
|
||||
return false;
|
||||
}
|
||||
int damage;
|
||||
if (rpgDamage > 0) {
|
||||
damage = rpgDamage;
|
||||
} else {
|
||||
damage = getDamage();
|
||||
}
|
||||
boolean crit = false;
|
||||
double critChanceTemp = crit_chance;
|
||||
if (java.lang.Math.random() < critChanceTemp) {
|
||||
crit = true;
|
||||
damage *= critDamage;
|
||||
}
|
||||
boolean sucess = false;
|
||||
sucess = other.damage(damage, p, DamageType.NORMAL, crit);
|
||||
if (sucess && !projectil) {
|
||||
// TODO: other.knockback(p, knockback);
|
||||
}
|
||||
return sucess;
|
||||
}
|
||||
|
||||
public boolean damage(int damage, Entity damager, DamageType damageType) {
|
||||
return damage(damage, damager, damageType, false);
|
||||
}
|
||||
|
||||
public boolean damage(int damage, Entity damager, DamageType damageType, boolean crit) {
|
||||
if (dead) {
|
||||
return false;
|
||||
}
|
||||
if (System.currentTimeMillis() - lastEnvironmentalDamaged < 600 && (
|
||||
damageType == DamageType.ENVIRONMENTAL_LAVA
|
||||
|| damageType == DamageType.ENVIRONMENTAL_DROWNING
|
||||
|| damageType == DamageType.ENVIRONMENTAL_FALL)) {
|
||||
return false;
|
||||
}
|
||||
if (player == null) {
|
||||
return false;
|
||||
}
|
||||
if (damager != null) {
|
||||
if (damager instanceof Player) {
|
||||
RaxenPlayer damagerRX = main.getManager().getPlayerManager()
|
||||
.getRaxenPlayer((Player) damager);
|
||||
if (!((Player) damager).isOnline() || damagerRX == null) {
|
||||
return false;
|
||||
}
|
||||
// TODO: check if same party later not now
|
||||
|
||||
}
|
||||
}
|
||||
switch (lastDamageCause = damageType) {
|
||||
case NORMAL:
|
||||
case NORMAL_SPELL:
|
||||
damage -= Math.randInt(0, getAttribute().getDefense());
|
||||
lastDamagedNonEnvironmental = System.currentTimeMillis();
|
||||
break;
|
||||
case ENVIRONMENTAL_FALL:
|
||||
if (damage >= getAttribute().getHealth()) {
|
||||
damage = getAttribute().getHealth() - 1;
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (damageType == DamageType.ENVIRONMENTAL_LAVA
|
||||
|| damageType == DamageType.ENVIRONMENTAL_DROWNING
|
||||
|| damageType == DamageType.ENVIRONMENTAL_FALL) {
|
||||
lastEnvironmentalDamaged = System.currentTimeMillis();
|
||||
} else if (damageType == DamageType.NORMAL) {
|
||||
lastDamaged = System.currentTimeMillis();
|
||||
}
|
||||
if (damager != null && damager != player && damager instanceof Player) {
|
||||
damage *= 0.8; // pvp nerf
|
||||
}
|
||||
if (damage < 1) {
|
||||
damage = 1;
|
||||
}
|
||||
if (damageType == DamageType.NORMAL_SPELL || damageType == DamageType.NORMAL) {
|
||||
if (damage > getAttribute().getHealth() * 0.5) {
|
||||
player.leaveVehicle();
|
||||
}
|
||||
}
|
||||
getAttribute().setHealth(getAttribute().getHealth() - damage);
|
||||
if (getAttribute().getHealth() < 0) {
|
||||
getAttribute().setHealth(0);
|
||||
}
|
||||
if (damager != null && damager != player) {
|
||||
if (damager instanceof Player) {
|
||||
RaxenPlayer damagerRX = main.getManager().getPlayerManager()
|
||||
.getRaxenPlayer((Player) damager);
|
||||
if (damagerRX != null) {
|
||||
Player p2 = damagerRX.getPlayer();
|
||||
if (p2 != null && p2.isValid()) {
|
||||
p2.playSound(p2.getLocation(), Sound.ENTITY_PLAYER_HURT, 0.65f, 0.75f);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
player.playSound(player.getLocation(), Sound.ENTITY_PLAYER_HURT, 0.85f, 0.85f);
|
||||
if (System.currentTimeMillis() - lastDamaged < 1000) {
|
||||
player.playEffect(EntityEffect.HURT);
|
||||
}
|
||||
if (getAttribute().getHealth() <= 0) {
|
||||
die();
|
||||
} else {
|
||||
// TODO: update health display on action bar
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public void die() {
|
||||
log("player " + player.displayName() + " died");
|
||||
}
|
||||
|
||||
public void incrementMobCounter(String mob) {
|
||||
if (mobCounter.containsKey(mob)) {
|
||||
mobCounter.get(mob).replaceAll((k, v) -> v + 1);
|
||||
// TODO: mob quest tracker ?
|
||||
}
|
||||
}
|
||||
|
||||
public int getMobKills() {
|
||||
return mobKills;
|
||||
}
|
||||
|
||||
public int getPlayerKills() {
|
||||
return playerKills;
|
||||
}
|
||||
|
||||
public int getDeaths() {
|
||||
return deaths;
|
||||
}
|
||||
|
||||
public int getBossKills() {
|
||||
return bossKills;
|
||||
}
|
||||
|
||||
public void setMobKills(int mobKills) {
|
||||
this.mobKills = mobKills;
|
||||
}
|
||||
|
||||
public void setPlayerKills(int playerKills) {
|
||||
this.playerKills = playerKills;
|
||||
}
|
||||
|
||||
public void setDeaths(int deaths) {
|
||||
this.deaths = deaths;
|
||||
}
|
||||
|
||||
public void setBossKills(int bossKills) {
|
||||
this.bossKills = bossKills;
|
||||
}
|
||||
|
||||
public void addMobKills(int mobKills) {
|
||||
this.mobKills += mobKills;
|
||||
}
|
||||
|
||||
public void addMobKills() {
|
||||
this.mobKills += 1;
|
||||
}
|
||||
|
||||
public void addPlayerKills(int playerKills) {
|
||||
this.playerKills += playerKills;
|
||||
}
|
||||
|
||||
public void addPlayerKills() {
|
||||
this.playerKills += 1;
|
||||
}
|
||||
|
||||
public void addDeaths(int deaths) {
|
||||
this.deaths += deaths;
|
||||
}
|
||||
|
||||
public void addDeaths() {
|
||||
this.deaths += 1;
|
||||
}
|
||||
|
||||
public void addBossKills(int bossKills) {
|
||||
this.bossKills += bossKills;
|
||||
}
|
||||
|
||||
public void addBossKills() {
|
||||
this.bossKills += 1;
|
||||
}
|
||||
|
||||
public void gainXp(long amt) {
|
||||
gainXp(amt, false);
|
||||
}
|
||||
|
||||
public void gainXp(long amt, boolean penalty) {
|
||||
xp += amt;
|
||||
Player p = getPlayer();
|
||||
if (p == null || !p.isValid()) {
|
||||
return;
|
||||
}
|
||||
int bonus = 0;
|
||||
// IDEA: per class xp bonus
|
||||
// IDEA: party xp multiplier
|
||||
long tXp = amt;
|
||||
if (bonus > 0) {
|
||||
tXp += bonus;
|
||||
xp += bonus;
|
||||
}
|
||||
if (xp >= getXpForNextLevel()) {
|
||||
long extra = xp - getXpForNextLevel();
|
||||
xp = 0;
|
||||
level++;
|
||||
xp = extra < getXpForNextLevel() ? extra : getXpForNextLevel() - 1;
|
||||
// TODO: take care of stats level up
|
||||
// TODO: update health and mana display;
|
||||
}
|
||||
}
|
||||
|
||||
private int lastLevel = -1;
|
||||
private long cachedXp = -1;
|
||||
|
||||
public long getXpForNextLevel() {
|
||||
long ret = 1;
|
||||
if (lastLevel == level && cachedXp > 0) {
|
||||
return cachedXp;
|
||||
}
|
||||
ret = PlayerStatistics.getEXPForNextLevel(level);
|
||||
if (ret < 0) {
|
||||
ret = Long.MAX_VALUE;
|
||||
}
|
||||
lastLevel = level;
|
||||
cachedXp = ret;
|
||||
return ret;
|
||||
}
|
||||
|
||||
public void knockback(LivingEntity attacker, double knockBackMultiplier) {
|
||||
return;
|
||||
}
|
||||
|
||||
public void updateHealthManaDisplay() {
|
||||
Player p = getPlayer();
|
||||
PlayerManager manager = main.getManager().getPlayerManager();
|
||||
if (p != null) {
|
||||
int health = manager.getHealth().get(p);
|
||||
int maxHealth = manager.getMaxHealth().get(p);
|
||||
int mana = manager.getMana().get(p);
|
||||
int maxMana = manager.getMaxMana().get(p);
|
||||
if (health > maxHealth) {
|
||||
manager.getHealth().set(p, maxHealth);
|
||||
health = manager.getHealth().get(p);
|
||||
}
|
||||
if (health < 0) {
|
||||
manager.getHealth().set(p, 0);
|
||||
health = manager.getHealth().get(p);
|
||||
}
|
||||
if (mana > maxMana) {
|
||||
manager.getMana().set(p, maxMana);
|
||||
mana = manager.getMana().get(p);
|
||||
}
|
||||
if (dead) {
|
||||
return;
|
||||
}
|
||||
double percent = ((double) health) / ((double) maxHealth);
|
||||
StringBuilder sb = new StringBuilder();
|
||||
BarColor color = BarColor.GREEN;
|
||||
if (percent > 0.5) {
|
||||
sb.append("<green>");
|
||||
sb.append(health);
|
||||
sb.append(" <aqua><bold>HP");
|
||||
} else if (percent > 0.20) {
|
||||
sb.append("<yellow>");
|
||||
sb.append(health);
|
||||
sb.append(" <aqua><bold>HP");
|
||||
color = BarColor.YELLOW;
|
||||
} else {
|
||||
sb.append("<dark_red><bold>DANGER - <reset><red>");
|
||||
sb.append(health);
|
||||
sb.append(" <dark_red><bold> - DANGER");
|
||||
color = BarColor.RED;
|
||||
}
|
||||
sb.append("<reset>");
|
||||
// TODO: status poison, burn, bleed
|
||||
if (percent > 1) {
|
||||
percent = 1;
|
||||
} else if (percent < 0.01) {
|
||||
percent = 0.01;
|
||||
}
|
||||
if (bossBar == null) {
|
||||
bossBar = Bukkit.createBossBar(Utils.coloredString(sb.toString()), BarColor.GREEN,
|
||||
BarStyle.SOLID);
|
||||
bossBar.addPlayer(p);
|
||||
}
|
||||
bossBar.setTitle(Utils.coloredString(sb.toString().trim()));
|
||||
bossBar.setProgress(percent);
|
||||
bossBar.setColor(color);
|
||||
|
||||
if (!p.isGliding() && main.getManager().getSpellManager().casters.containsKey(
|
||||
p.getUniqueId())) {
|
||||
CastState cs = main.getManager().getSpellManager().casters.get(
|
||||
p.getUniqueId()).state;
|
||||
if (cs != CastState.NONE) {
|
||||
StringBuilder sb2 = new StringBuilder();
|
||||
sb2.append("<gold><bold> ");
|
||||
sb2.append(cs.toString());
|
||||
p.sendActionBar(Utils.colorComp(sb2.toString()));
|
||||
}
|
||||
}
|
||||
|
||||
// p.setFoodLevel(mana * 2);
|
||||
p.setLevel(level);
|
||||
p.setExp((float) (((double) xp) / ((double) getXpForNextLevel())));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,12 +1,18 @@
|
|||
package me.unurled.raxen.components.entity.player;
|
||||
|
||||
import static me.unurled.raxen.utils.Utils.*;
|
||||
import static me.unurled.raxen.utils.Utils.colorTextComp;
|
||||
import static me.unurled.raxen.utils.Utils.debug;
|
||||
import static me.unurled.raxen.utils.Utils.textCompToString;
|
||||
|
||||
import me.unurled.raxen.Raxen;
|
||||
import me.unurled.raxen.utils.libs.Vault;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.scoreboard.*;
|
||||
import org.bukkit.scoreboard.Criteria;
|
||||
import org.bukkit.scoreboard.DisplaySlot;
|
||||
import org.bukkit.scoreboard.Objective;
|
||||
import org.bukkit.scoreboard.Score;
|
||||
import org.bukkit.scoreboard.ScoreboardManager;
|
||||
|
||||
public class Scoreboard {
|
||||
|
||||
|
@ -41,7 +47,9 @@ public class Scoreboard {
|
|||
score2.setScore(2);
|
||||
Score score3 = obj.getScore(
|
||||
textCompToString(
|
||||
colorTextComp("<gold>Coins: <gold>" + vault.getBalanceString(player))
|
||||
colorTextComp(
|
||||
"<gold>Coins: <gold>" + vault.getBalanceString(player)
|
||||
)
|
||||
)
|
||||
);
|
||||
score3.setScore(1);
|
||||
|
@ -60,13 +68,16 @@ public class Scoreboard {
|
|||
player.getScoreboard().getObjective(DisplaySlot.SIDEBAR);
|
||||
debug(main, String.valueOf(player.getScoreboard().getEntries()));
|
||||
for (String str : player.getScoreboard().getEntries()) {
|
||||
if (str.contains(player.getName())) {}
|
||||
if (str.contains(player.getName())) {
|
||||
}
|
||||
}
|
||||
player.getScoreboard().resetScores("Coins");
|
||||
assert objective != null;
|
||||
Score score = objective.getScore(
|
||||
textCompToString(
|
||||
colorTextComp("<gold>Coins: <gold>" + vault.getBalanceString(player))
|
||||
colorTextComp(
|
||||
"<gold>Coins: <gold>" + vault.getBalanceString(player)
|
||||
)
|
||||
)
|
||||
);
|
||||
score.setScore(1);
|
||||
|
|
|
@ -100,7 +100,7 @@ public class Attributes {
|
|||
"Luck",
|
||||
"Mana",
|
||||
"Speed",
|
||||
"Strength",
|
||||
"Strength"
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
package me.unurled.raxen.components.glyph;
|
||||
|
||||
public class Glyph {
|
||||
|
||||
}
|
|
@ -0,0 +1,25 @@
|
|||
package me.unurled.raxen.components.glyph;
|
||||
|
||||
public class GlyphBuilder {
|
||||
|
||||
String chars;
|
||||
String model;
|
||||
String texture;
|
||||
String placeholder;
|
||||
|
||||
public GlyphBuilder(String chars) {
|
||||
this.chars = chars;
|
||||
}
|
||||
|
||||
public void model(String s) {
|
||||
model = s;
|
||||
}
|
||||
|
||||
public void texture(String s) {
|
||||
texture = s;
|
||||
}
|
||||
|
||||
public void placeholder(String s) {
|
||||
placeholder = s;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,44 @@
|
|||
package me.unurled.raxen.components.glyph;
|
||||
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
|
||||
public class GlyphParser {
|
||||
|
||||
private final ConfigurationSection section;
|
||||
|
||||
public GlyphParser(ConfigurationSection section) {
|
||||
this.section = section;
|
||||
if (section.isConfigurationSection("Pack")) {
|
||||
ConfigurationSection packSection = section.getConfigurationSection("Pack");
|
||||
applyConfig(buildGlyph());
|
||||
}
|
||||
}
|
||||
|
||||
public GlyphBuilder buildGlyph() {
|
||||
return buildGlyph(section.contains("char") ? section.getString("char") : null);
|
||||
}
|
||||
|
||||
public GlyphBuilder buildGlyph(String car) {
|
||||
GlyphBuilder glyph = null;
|
||||
if (car != null) {
|
||||
glyph = new GlyphBuilder(car);
|
||||
}
|
||||
return glyph;
|
||||
}
|
||||
|
||||
private GlyphBuilder applyConfig(GlyphBuilder glyph) {
|
||||
if (section.contains("Pack")) {
|
||||
ConfigurationSection s = section.getConfigurationSection("Pack");
|
||||
if (s.contains("model")) {
|
||||
glyph.model(s.getString("model"));
|
||||
}
|
||||
if (s.contains("texture")) {
|
||||
glyph.texture(s.getString("texture"));
|
||||
}
|
||||
if (s.contains("placeholder")) {
|
||||
glyph.placeholder(s.getString("placeholder"));
|
||||
}
|
||||
}
|
||||
return glyph;
|
||||
}
|
||||
}
|
|
@ -1,21 +1,15 @@
|
|||
package me.unurled.raxen.components.gui;
|
||||
|
||||
import static me.unurled.raxen.utils.Items.*;
|
||||
import static me.unurled.raxen.utils.Utils.*;
|
||||
import static me.unurled.raxen.utils.Utils.fillGreyPane;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import lombok.Getter;
|
||||
import me.unurled.raxen.Raxen;
|
||||
import me.unurled.raxen.components.entity.player.PlayerUtils;
|
||||
import me.unurled.raxen.utils.Utils;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.kyori.adventure.text.TextComponent;
|
||||
import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
|
@ -34,193 +28,25 @@ public class ItemListGui implements Listener {
|
|||
Component.text("Item List")
|
||||
);
|
||||
|
||||
private Inventory inv2 = Bukkit.createInventory(
|
||||
null,
|
||||
54,
|
||||
Component.text("Item List")
|
||||
);
|
||||
private Inventory inv3 = Bukkit.createInventory(
|
||||
null,
|
||||
54,
|
||||
Component.text("Item List")
|
||||
);
|
||||
private Inventory inv4 = Bukkit.createInventory(
|
||||
null,
|
||||
54,
|
||||
Component.text("Item List")
|
||||
);
|
||||
private Inventory inv5 = Bukkit.createInventory(
|
||||
null,
|
||||
54,
|
||||
Component.text("Item List")
|
||||
);
|
||||
private Inventory inv6 = Bukkit.createInventory(
|
||||
null,
|
||||
54,
|
||||
Component.text("Item List")
|
||||
);
|
||||
private Inventory inv7 = Bukkit.createInventory(
|
||||
null,
|
||||
54,
|
||||
Component.text("Item List")
|
||||
);
|
||||
private Inventory inv8 = Bukkit.createInventory(
|
||||
null,
|
||||
54,
|
||||
Component.text("Item List")
|
||||
);
|
||||
private Inventory inv9 = Bukkit.createInventory(
|
||||
null,
|
||||
54,
|
||||
Component.text("Item List")
|
||||
);
|
||||
|
||||
private HashMap<String, ItemStack> itlist;
|
||||
|
||||
public ItemListGui(Raxen main) {
|
||||
this.main = main;
|
||||
this.itlist = this.main.getManager().getItemManager().getList();
|
||||
this.inv = getInventories();
|
||||
}
|
||||
|
||||
private ItemStack PREVIOUS = createItem(
|
||||
Material.ARROW,
|
||||
1,
|
||||
true,
|
||||
false,
|
||||
"Previous page"
|
||||
);
|
||||
private ItemStack NEXT = createItem(
|
||||
Material.ARROW,
|
||||
1,
|
||||
true,
|
||||
false,
|
||||
"Next page"
|
||||
);
|
||||
private ItemStack PAGE = createItem(Material.PAPER, 1, true, false, "Page");
|
||||
private ItemStack CLOSE = closeItem();
|
||||
private ItemStack GREY_PANE = greyPane();
|
||||
public Inventory getInventories(int page) {
|
||||
int item = -1;
|
||||
int number = 54 * (page - 1);
|
||||
int number_final = number + 54;
|
||||
|
||||
public Inventory getInventories() {
|
||||
Integer page = 1;
|
||||
Integer item = -1;
|
||||
for (Map.Entry<String, ItemStack> entry : itlist.entrySet()) {
|
||||
ItemStack it = entry.getValue();
|
||||
for (ItemStack it : itlist.values()) {
|
||||
item++;
|
||||
if (item > 44 && item < 91) {
|
||||
inv2.addItem(it);
|
||||
inv2.setItem(48, PREVIOUS);
|
||||
inv2.setItem(
|
||||
49,
|
||||
editItem(PAGE, "page" + page, 1, new ArrayList<Component>())
|
||||
);
|
||||
inv2.setItem(53, CLOSE);
|
||||
inv2 = fillGreyPane(inv2);
|
||||
}
|
||||
if (item > 90 && item < 136) {
|
||||
inv3.setItem(48, PREVIOUS);
|
||||
inv3.setItem(
|
||||
49,
|
||||
editItem(PAGE, "page" + page, 1, new ArrayList<Component>())
|
||||
);
|
||||
inv3.setItem(53, CLOSE);
|
||||
inv3 = fillGreyPane(inv3);
|
||||
}
|
||||
if (item > 135 && item < 181) {
|
||||
inv4.addItem(it);
|
||||
inv4.setItem(48, PREVIOUS);
|
||||
inv4.setItem(
|
||||
49,
|
||||
editItem(PAGE, "page" + page, 1, new ArrayList<Component>())
|
||||
);
|
||||
inv4.setItem(53, CLOSE);
|
||||
inv4 = fillGreyPane(inv4);
|
||||
}
|
||||
if (item > 180 && item < 226) {
|
||||
inv5.addItem(it);
|
||||
inv5.setItem(48, PREVIOUS);
|
||||
inv5.setItem(
|
||||
49,
|
||||
editItem(PAGE, "page" + page, 1, new ArrayList<Component>())
|
||||
);
|
||||
inv5.setItem(53, CLOSE);
|
||||
inv5 = fillGreyPane(inv5);
|
||||
}
|
||||
if (item > 225 && item < 271) {
|
||||
inv6.addItem(it);
|
||||
inv6.setItem(48, PREVIOUS);
|
||||
inv6.setItem(
|
||||
49,
|
||||
editItem(PAGE, "page" + page, 1, new ArrayList<Component>())
|
||||
);
|
||||
inv6.setItem(53, CLOSE);
|
||||
inv6 = fillGreyPane(inv6);
|
||||
}
|
||||
if (item > 270 && item < 316) {
|
||||
inv7.addItem(it);
|
||||
inv7.setItem(48, PREVIOUS);
|
||||
inv7.setItem(
|
||||
49,
|
||||
editItem(PAGE, "page" + page, 1, new ArrayList<Component>())
|
||||
);
|
||||
inv7.setItem(53, CLOSE);
|
||||
inv7 = fillGreyPane(inv7);
|
||||
}
|
||||
if (item > 315 && item < 361) {
|
||||
inv8.addItem(it);
|
||||
inv8.setItem(48, PREVIOUS);
|
||||
inv8.setItem(
|
||||
49,
|
||||
editItem(PAGE, "page" + page, 1, new ArrayList<Component>())
|
||||
);
|
||||
inv8.setItem(53, CLOSE);
|
||||
inv8 = fillGreyPane(inv8);
|
||||
}
|
||||
if (item > 360 && item < 406) {
|
||||
inv9.addItem(it);
|
||||
inv9.setItem(48, PREVIOUS);
|
||||
inv9.setItem(
|
||||
49,
|
||||
editItem(PAGE, "page" + page, 1, new ArrayList<Component>())
|
||||
);
|
||||
inv9.setItem(53, CLOSE);
|
||||
inv9 = fillGreyPane(inv9);
|
||||
}
|
||||
if (item > 405) {
|
||||
log("Too many item to render.");
|
||||
} else {
|
||||
inv.addItem(it);
|
||||
inv.setItem(49, PAGE);
|
||||
inv.setItem(50, NEXT);
|
||||
}
|
||||
if (item > 44) {
|
||||
inv.setItem(50, NEXT);
|
||||
if (item > 90) {
|
||||
inv2.setItem(50, NEXT);
|
||||
if (item > 135) {
|
||||
inv3.setItem(50, NEXT);
|
||||
if (item > 180) {
|
||||
inv4.setItem(50, NEXT);
|
||||
if (item > 225) {
|
||||
inv5.setItem(50, NEXT);
|
||||
if (item > 270) {
|
||||
inv6.setItem(50, NEXT);
|
||||
if (item > 315) {
|
||||
inv7.setItem(50, NEXT);
|
||||
if (item > 360) {
|
||||
inv8.setItem(50, NEXT);
|
||||
if (item >= number && item < number_final) {
|
||||
inv.setItem(item - number, it);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
page++;
|
||||
inv.setItem(53, CLOSE);
|
||||
inv = fillGreyPane(inv);
|
||||
}
|
||||
fillGreyPane(inv);
|
||||
return inv;
|
||||
}
|
||||
|
||||
|
@ -228,90 +54,26 @@ public class ItemListGui implements Listener {
|
|||
public void clickInventory(InventoryClickEvent e) {
|
||||
Player player = (Player) e.getWhoClicked();
|
||||
Inventory einv = e.getClickedInventory();
|
||||
if (
|
||||
einv == inv ||
|
||||
einv == inv2 ||
|
||||
einv == inv3 ||
|
||||
einv == inv4 ||
|
||||
einv == inv5 ||
|
||||
einv == inv6 ||
|
||||
einv == inv7 ||
|
||||
einv == inv8 ||
|
||||
einv == inv9
|
||||
) {
|
||||
if (einv == inv) {
|
||||
if (
|
||||
e.getCurrentItem() != null &&
|
||||
e.getCurrentItem().getType() != Material.AIR
|
||||
) {
|
||||
Integer slot = e.getSlot();
|
||||
ItemStack clicked;
|
||||
if (slot == 48) {
|
||||
//previous
|
||||
if (e.getCurrentItem() != GREY_PANE) {
|
||||
ItemStack pagee = einv.getItem(49);
|
||||
String name = textCompToString(pagee.displayName());
|
||||
int page = Integer.parseInt(name.replace("page", ""));
|
||||
switch (page) {
|
||||
case 2:
|
||||
player.openInventory(inv);
|
||||
case 3:
|
||||
player.openInventory(inv2);
|
||||
case 4:
|
||||
player.openInventory(inv3);
|
||||
case 5:
|
||||
player.openInventory(inv4);
|
||||
case 6:
|
||||
player.openInventory(inv5);
|
||||
case 7:
|
||||
player.openInventory(inv6);
|
||||
case 8:
|
||||
player.openInventory(inv7);
|
||||
case 9:
|
||||
player.openInventory(inv8);
|
||||
}
|
||||
}
|
||||
} else if (slot == 49) {
|
||||
//page
|
||||
return;
|
||||
} else if (slot == 50) {
|
||||
//next
|
||||
ItemStack pagee = einv.getItem(49);
|
||||
if (pagee != null) {
|
||||
String name = textCompToString(pagee.displayName());
|
||||
name = name.replace("[", "");
|
||||
name = name.replace("]", "");
|
||||
log(name);
|
||||
int page = Integer.parseInt(name.replace("page", ""));
|
||||
switch (page) {
|
||||
case 1:
|
||||
player.openInventory(inv2);
|
||||
case 2:
|
||||
player.openInventory(inv3);
|
||||
case 3:
|
||||
player.openInventory(inv4);
|
||||
case 4:
|
||||
player.openInventory(inv5);
|
||||
case 5:
|
||||
player.openInventory(inv6);
|
||||
case 6:
|
||||
player.openInventory(inv7);
|
||||
case 7:
|
||||
player.openInventory(inv8);
|
||||
case 8:
|
||||
player.openInventory(inv9);
|
||||
}
|
||||
}
|
||||
} else if (slot == 53) {
|
||||
//close
|
||||
player.closeInventory();
|
||||
} else {
|
||||
//if (player.getInventory().firstEmpty() == -1) {
|
||||
//add to stash
|
||||
//}
|
||||
player.getInventory().addItem(e.getCurrentItem());
|
||||
player.closeInventory();
|
||||
player.playSound(player, Sound.UI_BUTTON_CLICK, 1, 0);
|
||||
PlayerUtils.updateSkills(main, player);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void openInventory(Player player, int page) {
|
||||
inv = getInventories(page);
|
||||
player.openInventory(inv);
|
||||
}
|
||||
}
|
||||
|
|
122
src/main/java/me/unurled/raxen/components/items/ItemBuilder.java
Normal file
122
src/main/java/me/unurled/raxen/components/items/ItemBuilder.java
Normal file
|
@ -0,0 +1,122 @@
|
|||
package me.unurled.raxen.components.items;
|
||||
|
||||
import com.google.common.collect.Multimap;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import me.unurled.raxen.utils.Utils;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import org.bukkit.Color;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.attribute.Attribute;
|
||||
import org.bukkit.attribute.AttributeModifier;
|
||||
import org.bukkit.enchantments.Enchantment;
|
||||
import org.bukkit.inventory.ItemFlag;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.FireworkEffectMeta;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
import org.bukkit.inventory.meta.LeatherArmorMeta;
|
||||
import org.bukkit.inventory.meta.MapMeta;
|
||||
import org.bukkit.inventory.meta.PotionMeta;
|
||||
import org.bukkit.persistence.PersistentDataContainer;
|
||||
import org.bukkit.potion.PotionData;
|
||||
import org.bukkit.potion.PotionEffect;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class ItemBuilder {
|
||||
|
||||
private final PersistentDataContainer persistentDataContainer;
|
||||
private ItemStack it;
|
||||
private Material type;
|
||||
private Component displayName;
|
||||
private int amount;
|
||||
private int customModelData;
|
||||
private String customModelDataPath;
|
||||
private boolean hasCustomModelData;
|
||||
private Color color;
|
||||
private @NotNull PotionData potionData;
|
||||
|
||||
private List<PotionEffect> potionEffects;
|
||||
private Set<ItemFlag> itemFlags;
|
||||
private boolean hasAttributeModifiers;
|
||||
private Multimap<Attribute, AttributeModifier> attributeModifiers;
|
||||
private List<String> lore;
|
||||
private final Map<Enchantment, Integer> enchantments;
|
||||
|
||||
public ItemBuilder(ItemStack it) {
|
||||
this.it = it;
|
||||
type = it.getType();
|
||||
amount = it.getAmount();
|
||||
|
||||
final ItemMeta itm = it.getItemMeta();
|
||||
|
||||
if (itm instanceof LeatherArmorMeta leatherArmorMeta) {
|
||||
color = leatherArmorMeta.getColor();
|
||||
}
|
||||
|
||||
if (itm instanceof PotionMeta potionMeta) {
|
||||
color = potionMeta.getColor();
|
||||
potionData = potionMeta.getBasePotionData();
|
||||
potionEffects = new ArrayList<>(potionMeta.getCustomEffects());
|
||||
}
|
||||
|
||||
if (itm instanceof MapMeta mapMeta) {
|
||||
color = mapMeta.getColor();
|
||||
}
|
||||
|
||||
if (itm instanceof FireworkEffectMeta effectMeta) {
|
||||
color =
|
||||
effectMeta.hasEffect() ? effectMeta.getEffect().getColors().get(0) : Color.WHITE;
|
||||
}
|
||||
|
||||
if (itm.hasDisplayName()) {
|
||||
displayName = itm.displayName();
|
||||
}
|
||||
|
||||
if (!itm.getItemFlags().isEmpty()) {
|
||||
itemFlags = itm.getItemFlags();
|
||||
}
|
||||
|
||||
hasAttributeModifiers = itm.hasAttributeModifiers();
|
||||
if (hasAttributeModifiers) {
|
||||
attributeModifiers = itm.getAttributeModifiers();
|
||||
}
|
||||
|
||||
hasCustomModelData = itm.hasCustomModelData();
|
||||
if (itm.hasCustomModelData()) {
|
||||
customModelData = itm.getCustomModelData();
|
||||
}
|
||||
|
||||
if (itm.hasLore()) {
|
||||
lore = itm.getLore();
|
||||
}
|
||||
|
||||
persistentDataContainer = itm.getPersistentDataContainer();
|
||||
|
||||
enchantments = new HashMap<>();
|
||||
}
|
||||
|
||||
public ItemBuilder(Material material) {
|
||||
this(new ItemStack(material));
|
||||
}
|
||||
|
||||
public ItemBuilder displayName(String name) {
|
||||
this.displayName = Utils.colorComp(name);
|
||||
return this;
|
||||
}
|
||||
|
||||
public void lore(List<String> lore) {
|
||||
this.lore = lore;
|
||||
}
|
||||
|
||||
public void color(Color color) {
|
||||
this.color = color;
|
||||
}
|
||||
|
||||
public void modelData(String path, int data) {
|
||||
this.customModelData = data;
|
||||
this.customModelDataPath = path;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,52 @@
|
|||
package me.unurled.raxen.components.items;
|
||||
|
||||
import java.util.List;
|
||||
import me.unurled.raxen.utils.Utils;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
|
||||
public class ItemParser {
|
||||
|
||||
private final ConfigurationSection section;
|
||||
private Material type;
|
||||
|
||||
public ItemParser(ConfigurationSection section) {
|
||||
this.section = section;
|
||||
type = Material.getMaterial(section.getString("material", "PAPER"));
|
||||
if (section.isConfigurationSection("Pack")) {
|
||||
ConfigurationSection packSection = section.getConfigurationSection("Pack");
|
||||
// TODO: Parse pack section
|
||||
// item.modelData(section.getString("Pack.model", null), section.getInt("Pack.custom_model_data", 0));
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public ItemBuilder buildItem() {
|
||||
return buildItem(section.contains("name") ? section.getString("name") : null);
|
||||
}
|
||||
|
||||
public ItemBuilder buildItem(String name) {
|
||||
ItemBuilder item;
|
||||
item = new ItemBuilder(type);
|
||||
if (name != null) {
|
||||
item.displayName(name);
|
||||
}
|
||||
return item;
|
||||
}
|
||||
|
||||
private ItemBuilder applyConfig(ItemBuilder item) {
|
||||
if (section.contains("lore")) {
|
||||
List<String> lore = section.getStringList("lore");
|
||||
item.lore(lore);
|
||||
}
|
||||
|
||||
if (section.contains("color")) {
|
||||
item.color(Utils.color(section.getString("color", "FFFFFF")));
|
||||
}
|
||||
|
||||
if (section.contains("Pack")) {
|
||||
item.modelData(section.getString("Pack.model", null), section.getInt("Pack.custom_model_data", 0));
|
||||
}
|
||||
return item;
|
||||
}
|
||||
}
|
|
@ -1,14 +0,0 @@
|
|||
package me.unurled.raxen.components.items;
|
||||
|
||||
public class NBT {
|
||||
|
||||
public static String HEALTH = "HEALTH";
|
||||
public static String SPEED = "SPEED";
|
||||
public static String STRENGTH = "STRENGTH";
|
||||
public static String DEFENSE = "DEFENSE";
|
||||
public static String LUCK = "LUCK";
|
||||
public static String MANA = "MANA";
|
||||
public static String ID = "ID";
|
||||
public static String CUSTOM_ABILITY = "CUSTOM_ABILITY";
|
||||
public static String DROP_RATE = "DROP_RATE";
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
package me.unurled.raxen.components.items;
|
||||
|
||||
public class NBTNames {
|
||||
|
||||
public static String HEALTH = "HEALTH";
|
||||
public static String SPEED = "SPEED";
|
||||
public static String STRENGTH = "STRENGTH";
|
||||
public static String DEFENSE = "DEFENSE";
|
||||
public static String LUCK = "LUCK";
|
||||
public static String MANA = "MANA";
|
||||
public static String ID = "ID";
|
||||
public static String CUSTOM_ABILITY = "CUSTOM_ABILITY";
|
||||
public static String DROP_RATE = "DROP_RATE";
|
||||
public static String ITEM_CLASS = "ITEM_CLASS";
|
||||
public static String ITEM_TYPE = "ITEM_TYPE";
|
||||
}
|
|
@ -26,6 +26,7 @@ public abstract class Item {
|
|||
* need item to be set before calling this method.
|
||||
*/
|
||||
public void registerItem(@NotNull Raxen main) {
|
||||
item = buildItem();
|
||||
main.getManager().getItemManager().registerItem(item);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,5 +12,5 @@ public enum ItemClass {
|
|||
SSS,
|
||||
MYTHIC,
|
||||
UNIC,
|
||||
GOD,
|
||||
GOD
|
||||
}
|
||||
|
|
|
@ -7,5 +7,5 @@ public enum ItemTypes {
|
|||
MEDICINE,
|
||||
ARMOR,
|
||||
BLOCKS,
|
||||
MISCELLANEOUS,
|
||||
MISCELLANEOUS
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@ package me.unurled.raxen.components.items.custom;
|
|||
import java.util.ArrayList;
|
||||
import lombok.Getter;
|
||||
import me.unurled.raxen.Raxen;
|
||||
import me.unurled.raxen.components.items.custom.weapon.CombatKnife;
|
||||
import me.unurled.raxen.components.items.custom.weapon.Dagger;
|
||||
|
||||
public class List {
|
||||
|
@ -21,5 +22,6 @@ public class List {
|
|||
public void build() {
|
||||
// weapons
|
||||
items.add(new Dagger());
|
||||
items.add(new CombatKnife());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,56 @@
|
|||
package me.unurled.raxen.components.items.custom.weapon;
|
||||
|
||||
import static me.unurled.raxen.utils.Utils.colorTextComp;
|
||||
|
||||
import de.tr7zw.nbtapi.NBT;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import lombok.Getter;
|
||||
import me.unurled.raxen.components.items.NBTNames;
|
||||
import me.unurled.raxen.components.items.custom.Item;
|
||||
import me.unurled.raxen.components.items.custom.ItemClass;
|
||||
import me.unurled.raxen.components.items.custom.ItemTypes;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.inventory.ItemFlag;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
|
||||
public class CombatKnife extends Item {
|
||||
|
||||
@Getter
|
||||
ItemStack item;
|
||||
|
||||
static final String NAME = "Combat Knife";
|
||||
static final String ID = "COMBAT_KNIFE";
|
||||
|
||||
static final ItemClass ITEM_CLASS = ItemClass.F;
|
||||
static final ItemTypes ITEM_TYPES = ItemTypes.WEAPON;
|
||||
|
||||
public ItemStack buildItem() {
|
||||
item = new ItemStack(Material.IRON_SWORD);
|
||||
ItemMeta itm = item.getItemMeta();
|
||||
itm.displayName(colorTextComp("<aqua>" + NAME));
|
||||
itm.addItemFlags(ItemFlag.HIDE_ATTRIBUTES);
|
||||
itm.setUnbreakable(true);
|
||||
List<Component> lore = new ArrayList<>();
|
||||
lore.add(
|
||||
colorTextComp(
|
||||
"<grey>A simple combat knife with a serrated edge.</grey>"
|
||||
)
|
||||
);
|
||||
itm.setCustomModelData(1);
|
||||
itm.lore(lore);
|
||||
item.setItemMeta(itm);
|
||||
NBT.modify(
|
||||
item,
|
||||
nbt -> {
|
||||
nbt.setString(NBTNames.ID, ID);
|
||||
nbt.setString(NBTNames.ITEM_TYPE, ITEM_TYPES.toString());
|
||||
nbt.setString(NBTNames.ITEM_CLASS, ITEM_CLASS.toString());
|
||||
nbt.setInteger(NBTNames.STRENGTH, 20);
|
||||
}
|
||||
);
|
||||
return item;
|
||||
}
|
||||
}
|
|
@ -6,7 +6,7 @@ import de.tr7zw.nbtapi.NBTItem;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import lombok.Getter;
|
||||
import me.unurled.raxen.components.items.NBT;
|
||||
import me.unurled.raxen.components.items.NBTNames;
|
||||
import me.unurled.raxen.components.items.custom.Item;
|
||||
import me.unurled.raxen.components.items.custom.ItemClass;
|
||||
import me.unurled.raxen.components.items.custom.ItemTypes;
|
||||
|
@ -22,16 +22,16 @@ public class Dagger extends Item {
|
|||
@Getter
|
||||
ItemStack item;
|
||||
|
||||
String NAME = "Dager";
|
||||
String ID = "DAGER";
|
||||
static final String NAME = "Dager";
|
||||
static final String ID = "DAGER";
|
||||
|
||||
ItemClass ITEM_CLASS = ItemClass.F;
|
||||
ItemTypes ITEM_TYPES = ItemTypes.WEAPON;
|
||||
static final ItemClass ITEM_CLASS = ItemClass.F;
|
||||
static final ItemTypes ITEM_TYPES = ItemTypes.WEAPON;
|
||||
|
||||
public ItemStack buildItem() {
|
||||
item = new ItemStack(Material.IRON_SWORD);
|
||||
ItemMeta itm = item.getItemMeta();
|
||||
itm.displayName(colorTextComp("<aqua>" + this.NAME));
|
||||
itm.displayName(colorTextComp("<aqua>" + NAME));
|
||||
itm.addEnchant(Enchantment.PROTECTION_ENVIRONMENTAL, 1, false);
|
||||
itm.addItemFlags(ItemFlag.HIDE_ATTRIBUTES, ItemFlag.HIDE_ENCHANTS);
|
||||
itm.setUnbreakable(true);
|
||||
|
@ -40,11 +40,11 @@ public class Dagger extends Item {
|
|||
itm.lore(lore);
|
||||
item.setItemMeta(itm);
|
||||
NBTItem nbti = new NBTItem(item);
|
||||
nbti.setString(NBT.ID, ID);
|
||||
nbti.setInteger(NBT.SPEED, 100);
|
||||
nbti.setInteger(NBT.STRENGTH, 50);
|
||||
nbti.setString(NBT.CUSTOM_ABILITY, "throwing_dager");
|
||||
nbti.setDouble(NBT.DROP_RATE, 50.0);
|
||||
nbti.setString(NBTNames.ID, ID);
|
||||
nbti.setInteger(NBTNames.SPEED, 100);
|
||||
nbti.setInteger(NBTNames.STRENGTH, 50);
|
||||
nbti.setString(NBTNames.CUSTOM_ABILITY, "throwing_dager");
|
||||
nbti.setDouble(NBTNames.DROP_RATE, 50.0);
|
||||
item = nbti.getItem();
|
||||
return item;
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@ package me.unurled.raxen.components.lootchest.loots;
|
|||
import de.tr7zw.nbtapi.NBTItem;
|
||||
import java.util.HashMap;
|
||||
import me.unurled.raxen.Raxen;
|
||||
import me.unurled.raxen.components.items.NBT;
|
||||
import me.unurled.raxen.components.items.NBTNames;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
|
@ -28,14 +28,17 @@ public class CustomLoot {
|
|||
|
||||
public Double getDrop_rate() {
|
||||
NBTItem nbti = new NBTItem(item);
|
||||
if (nbti.hasTag(NBT.DROP_RATE)) {
|
||||
return nbti.getDouble(NBT.DROP_RATE);
|
||||
if (nbti.hasTag(NBTNames.DROP_RATE)) {
|
||||
return nbti.getDouble(NBTNames.DROP_RATE);
|
||||
}
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
public void tryDropLoot(Location location) {
|
||||
for (LootItem item : main.getManager().getLootManager().getLootTable()) {
|
||||
for (LootItem item : main
|
||||
.getManager()
|
||||
.getLootManager()
|
||||
.getLootTable()) {
|
||||
item.tryDropItem(location);
|
||||
}
|
||||
}
|
||||
|
|
233
src/main/java/me/unurled/raxen/components/party/Party.java
Normal file
233
src/main/java/me/unurled/raxen/components/party/Party.java
Normal file
|
@ -0,0 +1,233 @@
|
|||
package me.unurled.raxen.components.party;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.UUID;
|
||||
import me.unurled.raxen.Raxen;
|
||||
import me.unurled.raxen.components.entity.player.RaxenPlayer;
|
||||
import me.unurled.raxen.manager.entity.PartyManager;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.kyori.adventure.text.event.ClickEvent;
|
||||
import net.kyori.adventure.text.event.ClickEvent.Action;
|
||||
import net.kyori.adventure.text.format.TextColor;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.scoreboard.Scoreboard;
|
||||
|
||||
public class Party {
|
||||
|
||||
Raxen main;
|
||||
|
||||
private static int ID = 1;
|
||||
public int id = ID++;
|
||||
|
||||
private ArrayList<UUID> uuids = new ArrayList<UUID>();
|
||||
private UUID leaderUUID;
|
||||
private String leaderName;
|
||||
|
||||
private ArrayList<Player> cachedPlayer = new ArrayList<Player>();
|
||||
|
||||
private long lastPlayerUpdate = 0L;
|
||||
private Scoreboard board;
|
||||
|
||||
private boolean lootShare = false;
|
||||
private HashMap<String, Long> lastInv = new HashMap<String, Long>();
|
||||
|
||||
|
||||
public Party(Raxen main, Player leader) {
|
||||
this.main = main;
|
||||
this.leaderUUID = leader.getUniqueId();
|
||||
this.leaderName = leader.getName();
|
||||
// IDEA: adds scoreboard
|
||||
addPlayer(leader);
|
||||
}
|
||||
|
||||
public void sendInvite(Player p, RaxenPlayer rx, Player inviter) {
|
||||
if (rx.getParty() == this) {
|
||||
inviter.sendMessage(PartyManager.PREFIX.append(
|
||||
Component.text(p.getName() + " is already in the party!")));
|
||||
return;
|
||||
}
|
||||
if (lastInv.containsKey(p.getName())) {
|
||||
if (System.currentTimeMillis() - lastInv.get(p.getName()) < 15000) {
|
||||
inviter.sendMessage(PartyManager.PREFIX.append(Component.text(p.getName()
|
||||
+ " was invited to the party in the last 15 seconds. Please wait a bit before inviting them again.")
|
||||
.color(
|
||||
TextColor.color(255, 0, 0))));
|
||||
return;
|
||||
}
|
||||
}
|
||||
lastInv.put(p.getName(), System.currentTimeMillis());
|
||||
p.playSound(p.getLocation(), Sound.ENTITY_EXPERIENCE_ORB_PICKUP, 10.0F, 1.0F);
|
||||
p.sendMessage(PartyManager.PREFIX.append(Component.text(
|
||||
"You have been invited to join " + leaderName
|
||||
+ "'s party. Type /party join to join the party.").color(
|
||||
TextColor.color(0, 255, 0))));
|
||||
p.sendMessage(
|
||||
Component.text("Or click Here").color(TextColor.color(255, 255, 0)).clickEvent(
|
||||
ClickEvent.clickEvent(Action.SUGGEST_COMMAND, "/party join")));
|
||||
p.sendMessage(PartyManager.PREFIX.append(
|
||||
Component.text("Type /party decline to decline the party invitation.").color(
|
||||
TextColor.color(0, 255, 0))));
|
||||
p.sendMessage(
|
||||
Component.text("Or click Here").color(TextColor.color(255, 255, 0)).clickEvent(
|
||||
ClickEvent.clickEvent(Action.SUGGEST_COMMAND, "/party decline")));
|
||||
sendMessage(Component.text(
|
||||
p.getName() + " has been invited to the party by " + inviter.getName() + "."));
|
||||
}
|
||||
|
||||
public void addPlayer(Player p) {
|
||||
if (isFull()) {
|
||||
p.sendMessage(PartyManager.PREFIX.append(Component.text("This party is full!")));
|
||||
sendMessage(Component.text(p.getName() + " tried to join the party, but it was full."));
|
||||
return;
|
||||
}
|
||||
lastPlayerUpdate = 0;
|
||||
uuids.add(p.getUniqueId());
|
||||
RaxenPlayer rx = main.getManager().getPlayerManager()
|
||||
.getRaxenPlayer(p);
|
||||
if (rx != null) {
|
||||
rx.setParty(this);
|
||||
}
|
||||
p.sendMessage(Component.text("You have joined " + leaderName + "'s the party."));
|
||||
Component comp = Component.text("The party is composed of ");
|
||||
for (Player p2 : getPlayers()) {
|
||||
comp.append(Component.text(p2.getName() + ", "));
|
||||
}
|
||||
p.sendMessage(comp);
|
||||
sendMessage(Component.text(p.getName() + " has joined the party."));
|
||||
}
|
||||
|
||||
public void leavePlayer(UUID uuid, String name) {
|
||||
if (uuid != null) {
|
||||
return;
|
||||
}
|
||||
Player player = Bukkit.getPlayer(uuid);
|
||||
if (leaderUUID != null && leaderUUID == uuid) {
|
||||
sendMessage(Component.text(name + " has left the party."));
|
||||
if (player != null && player.isOnline()) {
|
||||
main.getManager()
|
||||
.getPlayerManager().getRaxenPlayer(player).setParty(null);
|
||||
}
|
||||
uuids.remove(uuid);
|
||||
lastPlayerUpdate = 0;
|
||||
if (uuids.size() == 0) {
|
||||
destroy();
|
||||
} else {
|
||||
for (int k = 0; k < uuids.size(); k++) {
|
||||
UUID nu = uuids.get(k);
|
||||
Player temp = Bukkit.getPlayer(nu);
|
||||
if (temp != null && temp.isOnline()) {
|
||||
sendMessage(Component.text(temp.getName() + " is now the party leader."));
|
||||
leaderUUID = nu;
|
||||
leaderName = temp.getName();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (player != null && player.isOnline()) {
|
||||
sendMessage(Component.text(name + " has left the party."));
|
||||
main.getManager()
|
||||
.getPlayerManager().getRaxenPlayer(player).setParty(null);
|
||||
}
|
||||
uuids.remove(uuid);
|
||||
lastPlayerUpdate = 0;
|
||||
if (uuids.size() == 0) {
|
||||
destroy();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isFull() {
|
||||
if (this.uuids == null) {
|
||||
return true;
|
||||
}
|
||||
return uuids.size() >= PartyManager.MAX_SIZE;
|
||||
}
|
||||
|
||||
public double getXpMultiplier() {
|
||||
int size = uuids.size();
|
||||
if (size < 0) {
|
||||
size = 0;
|
||||
}
|
||||
return switch (size) {
|
||||
case 0, 1 -> 0.0;
|
||||
case 2 -> 0.1;
|
||||
case 3 -> 0.15;
|
||||
case 4 -> 0.2;
|
||||
default -> 0.25;
|
||||
};
|
||||
}
|
||||
|
||||
public void destroy() {
|
||||
for (UUID uuid : uuids) {
|
||||
if (main.getManager().getPlayerManager().getRaxenPlayer(uuid) != null) {
|
||||
RaxenPlayer rx = main.getManager().getPlayerManager().getRaxenPlayer(uuid);
|
||||
if (rx.getParty() != null && rx.getParty().equals(this)) {
|
||||
rx.setParty(null);
|
||||
}
|
||||
}
|
||||
cachedPlayer.clear();
|
||||
cachedPlayer = null;
|
||||
uuids.clear();
|
||||
uuids = null;
|
||||
leaderUUID = null;
|
||||
leaderName = null;
|
||||
board = null;
|
||||
main.getManager().getPartyManager().getParties().remove(this);
|
||||
}
|
||||
}
|
||||
|
||||
public ArrayList<Player> getPlayers() {
|
||||
if (System.currentTimeMillis() - lastPlayerUpdate > 5000) {
|
||||
lastPlayerUpdate = System.currentTimeMillis();
|
||||
cachedPlayer.clear();
|
||||
ArrayList<UUID> toRemove = new ArrayList<UUID>();
|
||||
for (UUID uuid : uuids) {
|
||||
Player p = Bukkit.getPlayer(uuid);
|
||||
if (p != null && p.isOnline()) {
|
||||
cachedPlayer.add(p);
|
||||
} else {
|
||||
toRemove.add(uuid);
|
||||
}
|
||||
}
|
||||
uuids.removeAll(toRemove);
|
||||
return cachedPlayer;
|
||||
} else {
|
||||
for (int k = 0; k < cachedPlayer.size(); k++) {
|
||||
Player p = cachedPlayer.get(k);
|
||||
if (p == null || !p.isOnline()) {
|
||||
cachedPlayer.remove(k);
|
||||
k--;
|
||||
if (k < 0) {
|
||||
k = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
return cachedPlayer;
|
||||
}
|
||||
}
|
||||
|
||||
public void sendMessage(Player sender, Component comp) {
|
||||
Component msg = PartyManager.PREFIX.append(
|
||||
Component.text(sender.getName() + "<reset><white>: ")).append(comp);
|
||||
// TODO: Filter words
|
||||
for (Player p : getPlayers()) {
|
||||
p.sendMessage(msg);
|
||||
}
|
||||
}
|
||||
|
||||
public void sendMessage(Component comp) {
|
||||
Component msg = PartyManager.PREFIX.append(comp);
|
||||
for (Player p : getPlayers()) {
|
||||
p.sendMessage(msg);
|
||||
p.playSound(p.getLocation(), Sound.ENTITY_EXPERIENCE_ORB_PICKUP, 1, 1);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isLeader(Player p) {
|
||||
return p.getName().equals(leaderName) && p.getUniqueId().equals(leaderUUID);
|
||||
}
|
||||
}
|
|
@ -2,6 +2,7 @@ package me.unurled.raxen.components.resourcepack;
|
|||
|
||||
import me.unurled.raxen.Raxen;
|
||||
import me.unurled.raxen.manager.server.ResourcePackManager;
|
||||
import me.unurled.raxen.utils.Utils;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
@ -24,12 +25,24 @@ public class ResourcePack {
|
|||
public void run() {
|
||||
if (resourcePackManager.isUseRP()) {
|
||||
player.setResourcePack(
|
||||
config.getString("ressource_pack_url"),
|
||||
config.getString("resource_pack_sha1")
|
||||
resourcePackManager.getUrl(),
|
||||
resourcePackManager.getSha1(),
|
||||
true
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
.runTaskLater(main, 2L);
|
||||
}.runTaskLater(main, 10L);
|
||||
new BukkitRunnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (resourcePackManager.isUseRP()) {
|
||||
if (!player.hasResourcePack()) {
|
||||
player.kick(Utils.colorComp(
|
||||
"<red>Raxen<gray>| <red>Please enable your resource pack!"));
|
||||
}
|
||||
}
|
||||
}
|
||||
}.runTaskLater(main, 600L);
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,19 @@
|
|||
package me.unurled.raxen.components.resourcepack.hosting;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.UUID;
|
||||
|
||||
public interface Hosting {
|
||||
|
||||
boolean upload(File resoucepack);
|
||||
|
||||
UUID getUUID();
|
||||
|
||||
String getPackURL();
|
||||
|
||||
String getMinecraftPackURL();
|
||||
|
||||
byte[] getSHA1();
|
||||
|
||||
String getOriginalSHA1();
|
||||
}
|
|
@ -0,0 +1,112 @@
|
|||
package me.unurled.raxen.components.resourcepack.hosting;
|
||||
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.JsonParser;
|
||||
import com.google.gson.JsonSyntaxException;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.UUID;
|
||||
import org.apache.http.HttpEntity;
|
||||
import org.apache.http.HttpResponse;
|
||||
import org.apache.http.client.HttpClient;
|
||||
import org.apache.http.client.methods.HttpPost;
|
||||
import org.apache.http.entity.ContentType;
|
||||
import org.apache.http.entity.mime.MultipartEntityBuilder;
|
||||
import org.apache.http.impl.client.HttpClientBuilder;
|
||||
import org.apache.http.util.EntityUtils;
|
||||
|
||||
public class PackHoster implements Hosting {
|
||||
|
||||
private final String serverAddress;
|
||||
private String packURL;
|
||||
private String minecraftPackURL;
|
||||
private String sha1;
|
||||
private UUID uuid;
|
||||
|
||||
public PackHoster(String serverAddress) {
|
||||
this.serverAddress = "https://" + serverAddress + "/";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean upload(File resoucepack) {
|
||||
try {
|
||||
HttpClient httpClient = HttpClientBuilder.create().build();
|
||||
|
||||
HttpPost httpPost = new HttpPost(serverAddress + "upload/" + uuid.toString());
|
||||
|
||||
HttpEntity entity = MultipartEntityBuilder.create()
|
||||
.addBinaryBody("file", resoucepack, ContentType.DEFAULT_BINARY,
|
||||
resoucepack.getName())
|
||||
.build();
|
||||
httpPost.setEntity(entity);
|
||||
|
||||
// Execute the request
|
||||
HttpResponse response = null;
|
||||
response = httpClient.execute(httpPost);
|
||||
String responseString = EntityUtils.toString(response.getEntity());
|
||||
JsonObject json;
|
||||
try {
|
||||
json = JsonParser.parseString(responseString).getAsJsonObject();
|
||||
} catch (JsonSyntaxException e) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (json.has("url") && json.has("sha1")) {
|
||||
packURL = json.get("url").getAsString();
|
||||
minecraftPackURL = packURL.replace("https://", "http://");
|
||||
sha1 = json.get("sha1").getAsString();
|
||||
return true;
|
||||
}
|
||||
|
||||
// Get the response code
|
||||
int responseCode = response.getStatusLine().getStatusCode();
|
||||
System.out.println("Response Code: " + responseCode);
|
||||
|
||||
// Read the response body
|
||||
String responseBody = null;
|
||||
|
||||
responseBody = EntityUtils.toString(response.getEntity(), StandardCharsets.UTF_8);
|
||||
System.out.println("Response Body: " + responseBody);
|
||||
} catch (IOException e) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public UUID getUUID() {
|
||||
return uuid;
|
||||
}
|
||||
|
||||
public void setUUID(UUID uuid) {
|
||||
this.uuid = uuid;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPackURL() {
|
||||
return packURL;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMinecraftPackURL() {
|
||||
return minecraftPackURL;
|
||||
}
|
||||
|
||||
@Override
|
||||
public byte[] getSHA1() {
|
||||
int len = sha1.length();
|
||||
byte[] data = new byte[len / 2];
|
||||
for (int i = 0; i < len; i += 2) {
|
||||
data[i / 2] = (byte) ((Character.digit(sha1.charAt(i), 16) << 4)
|
||||
+ Character.digit(sha1.charAt(i + 1), 16));
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getOriginalSHA1() {
|
||||
return sha1;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,74 @@
|
|||
package me.unurled.raxen.components.tutorial;
|
||||
|
||||
import static me.unurled.raxen.utils.Utils.colorTextComp;
|
||||
import static me.unurled.raxen.utils.Utils.log;
|
||||
import static me.unurled.raxen.utils.Utils.msgPlayer;
|
||||
|
||||
import lombok.Getter;
|
||||
import me.unurled.raxen.Raxen;
|
||||
import me.unurled.raxen.components.entity.player.RaxenPlayer;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
|
||||
public class Tutorial {
|
||||
|
||||
@Getter
|
||||
private double x;
|
||||
@Getter
|
||||
private double y;
|
||||
@Getter
|
||||
private double z;
|
||||
|
||||
@Getter
|
||||
private int step = 0;
|
||||
|
||||
@Getter
|
||||
private World world;
|
||||
|
||||
public Tutorial() {
|
||||
this.step = 0;
|
||||
}
|
||||
|
||||
public Tutorial(int step) {
|
||||
this.step = step;
|
||||
}
|
||||
|
||||
public Tutorial(int step, double x, double y, double z, World world) {
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.z = z;
|
||||
this.step = step;
|
||||
this.world = world;
|
||||
}
|
||||
|
||||
public void startTutorial(Player player, Location loc) {
|
||||
x = loc.getX();
|
||||
y = loc.getY();
|
||||
z = loc.getZ();
|
||||
world = loc.getWorld();
|
||||
Raxen main = (Raxen) Bukkit.getPluginManager().getPlugin("Raxen");
|
||||
RaxenPlayer rxPlayer = main.getManager().getPlayerManager().getRaxenPlayer(player);
|
||||
rxPlayer.setInTutorial(true);
|
||||
step = 1;
|
||||
player.addPotionEffect(PotionEffectType.BLINDNESS.createEffect(100, 10));
|
||||
player.teleport(
|
||||
new Location(world, 15.82, 74.00, 117.21, 899.21F, 0.90f));
|
||||
msgPlayer(player, colorTextComp("<green>Welcome to the tutorial!"));
|
||||
// Hologram holo = api.createHologram(new Location(world, 15.5, 76.00, 112.5, 179.21f, 0.90f));
|
||||
}
|
||||
|
||||
public void stopTutorial() {
|
||||
log("needs to be implemented");
|
||||
}
|
||||
|
||||
public void nextStep() {
|
||||
log("needs to be implemented");
|
||||
}
|
||||
|
||||
public void previousStep() {
|
||||
log("needs to be implemented");
|
||||
}
|
||||
}
|
74
src/main/java/me/unurled/raxen/config/GlyphConfig.java
Normal file
74
src/main/java/me/unurled/raxen/config/GlyphConfig.java
Normal file
|
@ -0,0 +1,74 @@
|
|||
package me.unurled.raxen.config;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Arrays;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import me.unurled.raxen.Raxen;
|
||||
import me.unurled.raxen.components.glyph.GlyphBuilder;
|
||||
import me.unurled.raxen.components.glyph.GlyphParser;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
|
||||
public class GlyphConfig {
|
||||
|
||||
private Raxen main;
|
||||
private File glyphFolder;
|
||||
|
||||
public GlyphConfig(Raxen main) {
|
||||
this.main = main;
|
||||
validatesConfig();
|
||||
}
|
||||
|
||||
public void validatesConfig() {
|
||||
glyphFolder = new File(main.getDataFolder(), "items");
|
||||
if (!glyphFolder.exists()) {
|
||||
glyphFolder.mkdirs();
|
||||
}
|
||||
}
|
||||
|
||||
public Map<File, Map<String, GlyphBuilder>> parseGlyphConfigs() {
|
||||
Map<File, Map<String, GlyphBuilder>> parseMap = new LinkedHashMap<>();
|
||||
List<File> config = Arrays.stream(getGlyphFiles())
|
||||
.filter(file -> file.getName().endsWith(".yml"))
|
||||
.toList();
|
||||
for (File file : config) {
|
||||
parseMap.put(file, parseGlyphConfig(YamlConfiguration.loadConfiguration(file), file));
|
||||
}
|
||||
return parseMap;
|
||||
}
|
||||
|
||||
public Map<String, GlyphBuilder> parseGlyphConfig(YamlConfiguration config, File file) {
|
||||
Map<String, GlyphParser> parseMap = new LinkedHashMap<>();
|
||||
for (String glyphSelection : config.getKeys(false)) {
|
||||
if (!config.isConfigurationSection(glyphSelection)) {
|
||||
continue;
|
||||
}
|
||||
ConfigurationSection glyphSection = config.getConfigurationSection(glyphSelection);
|
||||
parseMap.put(glyphSelection, new GlyphParser(glyphSection));
|
||||
}
|
||||
boolean configUpdated = false;
|
||||
Map<String, GlyphBuilder> map = new LinkedHashMap<>();
|
||||
for (Map.Entry<String, GlyphParser> entry : parseMap.entrySet()) {
|
||||
GlyphParser parser = entry.getValue();
|
||||
try {
|
||||
map.put(entry.getKey(), parser.buildGlyph());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
private File[] getGlyphFiles() {
|
||||
if (!glyphFolder.exists()) {
|
||||
glyphFolder.mkdirs();
|
||||
return new File[0];
|
||||
}
|
||||
File[] itemConfigs = Arrays.stream(glyphFolder.listFiles()).filter(File::isFile)
|
||||
.toArray(File[]::new);
|
||||
Arrays.sort(itemConfigs);
|
||||
return itemConfigs;
|
||||
}
|
||||
}
|
77
src/main/java/me/unurled/raxen/config/ItemConfig.java
Normal file
77
src/main/java/me/unurled/raxen/config/ItemConfig.java
Normal file
|
@ -0,0 +1,77 @@
|
|||
package me.unurled.raxen.config;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Arrays;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import me.unurled.raxen.Raxen;
|
||||
import me.unurled.raxen.components.items.ItemBuilder;
|
||||
import me.unurled.raxen.components.items.ItemParser;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
|
||||
public class ItemConfig {
|
||||
|
||||
private File itemsFolder;
|
||||
private Raxen main;
|
||||
|
||||
public ItemConfig(Raxen main) {
|
||||
this.main = main;
|
||||
validatesConfig();
|
||||
}
|
||||
|
||||
public void validatesConfig() {
|
||||
itemsFolder = new File(main.getDataFolder(), "items");
|
||||
if (!itemsFolder.exists()) {
|
||||
itemsFolder.mkdirs();
|
||||
}
|
||||
}
|
||||
|
||||
public Map<File, Map<String, ItemBuilder>> parseItemConfigs() {
|
||||
Map<File, Map<String, ItemBuilder>> parseMap = new LinkedHashMap<>();
|
||||
List<File> config = Arrays.stream(getItemsFiles())
|
||||
.filter(file -> file.getName().endsWith(".yml")).toList();
|
||||
for (File file : config) {
|
||||
parseMap.put(file, parseItemConfig(YamlConfiguration.loadConfiguration(file), file));
|
||||
}
|
||||
return parseMap;
|
||||
}
|
||||
|
||||
public Map<String, ItemBuilder> parseItemConfig(YamlConfiguration config, File file) {
|
||||
Map<String, ItemParser> parseMap = new LinkedHashMap<>();
|
||||
for (String itemSelection : config.getKeys(false)) {
|
||||
if (!config.isConfigurationSection(itemSelection)) {
|
||||
continue;
|
||||
}
|
||||
ConfigurationSection itemSection = config.getConfigurationSection(itemSelection);
|
||||
parseMap.put(itemSelection, new ItemParser(itemSection));
|
||||
}
|
||||
boolean configUpdated = false;
|
||||
Map<String, ItemBuilder> map = new LinkedHashMap<>();
|
||||
for (Map.Entry<String, ItemParser> entry : parseMap.entrySet()) {
|
||||
ItemParser parser = entry.getValue();
|
||||
try {
|
||||
map.put(entry.getKey(), parser.buildItem());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
/*public Map<File, Map<String, EffectBuilder>> parseEffectConfig() {
|
||||
// TODO: efffects
|
||||
}*/
|
||||
|
||||
private File[] getItemsFiles() {
|
||||
if (!itemsFolder.exists()) {
|
||||
itemsFolder.mkdirs();
|
||||
return new File[0];
|
||||
}
|
||||
File[] itemConfigs = Arrays.stream(itemsFolder.listFiles()).filter(File::isFile)
|
||||
.toArray(File[]::new);
|
||||
Arrays.sort(itemConfigs);
|
||||
return itemConfigs;
|
||||
}
|
||||
}
|
|
@ -1,6 +1,8 @@
|
|||
package me.unurled.raxen.config;
|
||||
|
||||
import static me.unurled.raxen.utils.Items.*;
|
||||
import static me.unurled.raxen.utils.Items.listItemStackDeserialize;
|
||||
import static me.unurled.raxen.utils.Items.mapItemStackDeserialize;
|
||||
import static me.unurled.raxen.utils.Items.setItemsToInventory;
|
||||
import static me.unurled.raxen.utils.Utils.debug;
|
||||
|
||||
import com.mongodb.client.MongoCollection;
|
||||
|
@ -16,6 +18,7 @@ import me.unurled.raxen.components.entity.player.PlayerUtils;
|
|||
import me.unurled.raxen.components.entity.player.Storage;
|
||||
import me.unurled.raxen.components.entity.player.attributes.Attributes;
|
||||
import me.unurled.raxen.components.entity.player.storages.EnderChest;
|
||||
import me.unurled.raxen.components.tutorial.Tutorial;
|
||||
import me.unurled.raxen.manager.entity.PlayerManager;
|
||||
import me.unurled.raxen.manager.entity.StorageManager;
|
||||
import me.unurled.raxen.utils.Items;
|
||||
|
@ -60,6 +63,7 @@ public class PlayerConfig {
|
|||
|
||||
/**
|
||||
* save players stuff to mongo db
|
||||
*
|
||||
* @param player
|
||||
* @param attributes
|
||||
* @param invstr
|
||||
|
@ -84,7 +88,10 @@ public class PlayerConfig {
|
|||
doc.append(s, attribute.get(s).get(player));
|
||||
}
|
||||
if (playerManager.getRaxenPlayer(player).getStorage() != null) {
|
||||
if (playerManager.getRaxenPlayer(player).getStorage().getEc() != null) {
|
||||
if (
|
||||
playerManager.getRaxenPlayer(player).getStorage().getEc() !=
|
||||
null
|
||||
) {
|
||||
debug(main, "Saving " + player.getName() + "'s storage!");
|
||||
EnderChest ec = playerManager
|
||||
.getRaxenPlayer(player)
|
||||
|
@ -120,6 +127,7 @@ public class PlayerConfig {
|
|||
|
||||
/**
|
||||
* save players stuff to yml
|
||||
*
|
||||
* @param player
|
||||
* @param attributes
|
||||
* @param invstr
|
||||
|
@ -142,7 +150,10 @@ public class PlayerConfig {
|
|||
}
|
||||
config.set("inv", invstr);
|
||||
if (playerManager.getRaxenPlayer(player).getStorage() != null) {
|
||||
if (playerManager.getRaxenPlayer(player).getStorage().getEc() != null) {
|
||||
if (
|
||||
playerManager.getRaxenPlayer(player).getStorage().getEc() !=
|
||||
null
|
||||
) {
|
||||
EnderChest ec = playerManager
|
||||
.getRaxenPlayer(player)
|
||||
.getStorage()
|
||||
|
@ -175,6 +186,7 @@ public class PlayerConfig {
|
|||
|
||||
/**
|
||||
* load player stuff from mongo db
|
||||
*
|
||||
* @param player
|
||||
*/
|
||||
public void loadUsingMongoDB(@NotNull Player player) {
|
||||
|
@ -183,6 +195,8 @@ public class PlayerConfig {
|
|||
.first();
|
||||
if (playerDoc == null) {
|
||||
debug(main, "Intiatilising Data for Player: " + player.getName());
|
||||
Tutorial tutorial = new Tutorial();
|
||||
main.getManager().getTutorialManager().addTutorial(player, tutorial);
|
||||
playerManager.getRaxenPlayer(player).createNewAttribute();
|
||||
playerManager.getRaxenPlayer(player).createStorage();
|
||||
playerManager.getRaxenPlayer(player).createInventory();
|
||||
|
@ -230,7 +244,9 @@ public class PlayerConfig {
|
|||
player.getInventory().setContents(inv.getContents());
|
||||
player.updateInventory();
|
||||
me.unurled.raxen.components.entity.player.storages.Inventory invv =
|
||||
new me.unurled.raxen.components.entity.player.storages.Inventory(inv);
|
||||
new me.unurled.raxen.components.entity.player.storages.Inventory(
|
||||
inv
|
||||
);
|
||||
Inventories invvv = new Inventories(invv);
|
||||
playerManager.getRaxenPlayer(player).setInventory(inv);
|
||||
PlayerUtils.updateSkills(main, player);
|
||||
|
@ -238,6 +254,7 @@ public class PlayerConfig {
|
|||
|
||||
/**
|
||||
* load player stuff from yml
|
||||
*
|
||||
* @param player
|
||||
* @throws IOException
|
||||
*/
|
||||
|
@ -287,13 +304,16 @@ public class PlayerConfig {
|
|||
player.getInventory().setContents(inv.getContents());
|
||||
player.updateInventory();
|
||||
me.unurled.raxen.components.entity.player.storages.Inventory invv =
|
||||
new me.unurled.raxen.components.entity.player.storages.Inventory(inv);
|
||||
new me.unurled.raxen.components.entity.player.storages.Inventory(
|
||||
inv
|
||||
);
|
||||
Inventories invvv = new Inventories(invv);
|
||||
playerManager.getRaxenPlayer(player).setInventory(inv);
|
||||
}
|
||||
|
||||
/**
|
||||
* saves player stuff
|
||||
*
|
||||
* @param player
|
||||
*/
|
||||
public void savePlayerConfig(@NotNull Player player) {
|
||||
|
@ -328,18 +348,27 @@ public class PlayerConfig {
|
|||
new BukkitRunnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
saveUsingYml(player, attributes, finalInvstr1, finalReverse1);
|
||||
saveUsingYml(
|
||||
player,
|
||||
attributes,
|
||||
finalInvstr1,
|
||||
finalReverse1
|
||||
);
|
||||
}
|
||||
}
|
||||
.runTaskAsynchronously(main);
|
||||
debug(main, "using yml");
|
||||
}
|
||||
|
||||
debug(main, "Player: " + player.getName() + " data successfully saved!");
|
||||
debug(
|
||||
main,
|
||||
"Player: " + player.getName() + " data successfully saved!"
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* load player stuff
|
||||
*
|
||||
* @param player
|
||||
*/
|
||||
public void loadPlayerConfig(Player player) {
|
||||
|
@ -370,7 +399,10 @@ public class PlayerConfig {
|
|||
}
|
||||
debug(
|
||||
main,
|
||||
"Player: " + player.getName() + " data successfully loaded using " + value
|
||||
"Player: " +
|
||||
player.getName() +
|
||||
" data successfully loaded using " +
|
||||
value
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
99
src/main/java/me/unurled/raxen/config/TutorialConfig.java
Normal file
99
src/main/java/me/unurled/raxen/config/TutorialConfig.java
Normal file
|
@ -0,0 +1,99 @@
|
|||
package me.unurled.raxen.config;
|
||||
|
||||
import com.mongodb.client.MongoCollection;
|
||||
import com.mongodb.client.model.Filters;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.UUID;
|
||||
import me.unurled.raxen.Raxen;
|
||||
import me.unurled.raxen.components.tutorial.Tutorial;
|
||||
import me.unurled.raxen.manager.server.TutorialManager;
|
||||
import me.unurled.raxen.utils.libs.MongoDB;
|
||||
import org.bson.Document;
|
||||
import org.bukkit.Location;
|
||||
|
||||
public class TutorialConfig {
|
||||
|
||||
private static Raxen main;
|
||||
private MongoDB mongoDB;
|
||||
private MongoCollection<Document> mongoCollection;
|
||||
|
||||
public TutorialConfig(Raxen main) {
|
||||
this.main = main;
|
||||
this.mongoDB = main.getManager().getLibsManager().getMongoDB();
|
||||
this.mongoCollection = mongoDB.getMongoConfigs();
|
||||
}
|
||||
|
||||
public void saveUsingMongoDB() {
|
||||
TutorialManager manager = main.getManager().getTutorialManager();
|
||||
Document doc = new Document();
|
||||
Document loc = new Document();
|
||||
for (Entry<UUID, Location> entry : manager.getLocations().entrySet()) {
|
||||
Document location = new Document();
|
||||
location.append("x", entry.getValue().getX());
|
||||
location.append("y", entry.getValue().getY());
|
||||
location.append("z", entry.getValue().getZ());
|
||||
location.append("world", entry.getValue().getWorld().getName());
|
||||
location.append("uuid", entry.getKey().toString());
|
||||
loc.append("location", location);
|
||||
}
|
||||
doc.append("locations", loc);
|
||||
Document tutorials = new Document();
|
||||
for (Entry<UUID, Tutorial> entry : manager.getTutorials().entrySet()) {
|
||||
Document tutorial = new Document();
|
||||
tutorial.append("uuid", entry.getKey().toString());
|
||||
tutorial.append("tutorial", entry.getValue().getStep());
|
||||
tutorial.append("x", entry.getValue().getX());
|
||||
tutorial.append("y", entry.getValue().getY());
|
||||
tutorial.append("z", entry.getValue().getZ());
|
||||
tutorial.append("world", entry.getValue().getWorld().getName());
|
||||
tutorials.append(entry.getKey().toString(), tutorial);
|
||||
}
|
||||
doc.append("tutorials", tutorials);
|
||||
Document find = mongoCollection.find(Filters.eq("tutorial", "tutorial")).first();
|
||||
if (find == null) {
|
||||
mongoCollection.insertOne(doc);
|
||||
} else {
|
||||
mongoCollection.replaceOne(find, doc);
|
||||
}
|
||||
}
|
||||
|
||||
public void loadUsingMongoDB() {
|
||||
Document doc = mongoCollection.find(Filters.eq("tutorial", "tutorial")).first();
|
||||
if (doc != null) {
|
||||
TutorialManager manager = main.getManager().getTutorialManager();
|
||||
Document loc = (Document) doc.get("locations");
|
||||
for (Entry<String, Object> entry : loc.entrySet()) {
|
||||
Document location = (Document) entry.getValue();
|
||||
double x = location.getDouble("x");
|
||||
double y = location.getDouble("y");
|
||||
double z = location.getDouble("z");
|
||||
String world = location.getString("world");
|
||||
UUID uuid = UUID.fromString(location.getString("uuid"));
|
||||
manager.getLocations()
|
||||
.put(uuid, new Location(main.getServer().getWorld(world), x, y, z));
|
||||
}
|
||||
|
||||
Document tutorials = (Document) doc.get("tutorials");
|
||||
for (Entry<String, Object> entry : tutorials.entrySet()) {
|
||||
Document tutorial = (Document) entry.getValue();
|
||||
UUID uuid1 = UUID.fromString(tutorial.getString("uuid"));
|
||||
double x = tutorial.getDouble("x");
|
||||
double y = tutorial.getDouble("y");
|
||||
double z = tutorial.getDouble("z");
|
||||
String world = tutorial.getString("world");
|
||||
int step = tutorial.getInteger("tutorial");
|
||||
manager.getTutorials()
|
||||
.put(uuid1, new Tutorial(step, x, y, z, main.getServer().getWorld(world)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void saveTutorialConfig() {
|
||||
saveUsingMongoDB();
|
||||
}
|
||||
|
||||
public void loadTutorialConfig() {
|
||||
loadUsingMongoDB();
|
||||
}
|
||||
|
||||
}
|
|
@ -5,18 +5,24 @@ import static me.unurled.raxen.utils.Utils.debug;
|
|||
import java.util.Objects;
|
||||
import me.unurled.raxen.Raxen;
|
||||
import me.unurled.raxen.components.entity.other.EntityNamespacedKey;
|
||||
import me.unurled.raxen.components.entity.other.MobData;
|
||||
import me.unurled.raxen.components.entity.player.RaxenPlayer;
|
||||
import me.unurled.raxen.manager.entity.PlayerManager;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.attribute.Attribute;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.entity.Projectile;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.entity.EntityDamageByBlockEvent;
|
||||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||
import org.bukkit.event.entity.EntityDamageEvent;
|
||||
import org.bukkit.metadata.Metadatable;
|
||||
import org.bukkit.persistence.PersistentDataContainer;
|
||||
import org.bukkit.persistence.PersistentDataType;
|
||||
import org.bukkit.projectiles.ProjectileSource;
|
||||
|
||||
public class DamageEntity implements Listener {
|
||||
|
||||
|
@ -29,18 +35,127 @@ public class DamageEntity implements Listener {
|
|||
}
|
||||
|
||||
/**
|
||||
* fired when an entity is damaged by another entity
|
||||
* calculates the damage and apply it to the entity
|
||||
* @param e
|
||||
* fired when an entity is damaged by something TODO: calculate damage and apply it to the
|
||||
* entity
|
||||
*
|
||||
* @param e event
|
||||
*/
|
||||
@EventHandler
|
||||
public void entityDamage(EntityDamageEvent e) {
|
||||
e.setCancelled(true);
|
||||
e.setDamage(0);
|
||||
e.getEntity().setFireTicks(0);
|
||||
if (e instanceof EntityDamageByEntityEvent) {
|
||||
EntityDamageByEntityEvent ev2 = (EntityDamageByEntityEvent) e;
|
||||
ev2.setCancelled(true);
|
||||
Entity attacker = ev2.getDamager();
|
||||
Entity defender = ev2.getEntity();
|
||||
if (attacker instanceof Player) {
|
||||
PlayerManager pm = main.getManager().getPlayerManager();
|
||||
if (defender instanceof Player) {
|
||||
// attack between players
|
||||
RaxenPlayer rx = pm.getRaxenPlayer((Player) attacker);
|
||||
RaxenPlayer rx2 = pm.getRaxenPlayer((Player) defender);
|
||||
if (rx != null && rx2 != null) {
|
||||
rx.attackPlayer(rx2);
|
||||
}
|
||||
} else {
|
||||
// attack between player and mob
|
||||
RaxenPlayer rx = pm.getRaxenPlayer((Player) attacker);
|
||||
MobData re = main.getManager().getEntityManager().getSpawnedMob().get(
|
||||
defender.getUniqueId());
|
||||
if (rx != null) {
|
||||
rx.attackMob(re);
|
||||
}
|
||||
}
|
||||
} else if (attacker instanceof Projectile) {
|
||||
boolean projectile = true;
|
||||
ProjectileSource source = ((Projectile) attacker).getShooter();
|
||||
double rpgKnockback = -1;
|
||||
int rpgDamage = -1;
|
||||
if (attacker != null) {
|
||||
Metadatable sourceMeta = (Metadatable) attacker;
|
||||
// TODO: check metadata
|
||||
}
|
||||
if (source == defender) {
|
||||
attacker.remove();
|
||||
return;
|
||||
}
|
||||
if (source instanceof Player) {
|
||||
RaxenPlayer rx = main.getManager().getPlayerManager().getRaxenPlayer(
|
||||
(Player) source);
|
||||
if (defender instanceof Player) {
|
||||
RaxenPlayer rx2 = main.getManager().getPlayerManager().getRaxenPlayer(
|
||||
(Player) defender);
|
||||
// range attack between players
|
||||
if (rpgKnockback >= 0) {
|
||||
rx.attackPlayer(rx2, rpgDamage, projectile, rpgKnockback);
|
||||
} else {
|
||||
rx.attackPlayer(rx2, rpgDamage, projectile);
|
||||
}
|
||||
} else {
|
||||
MobData mb = main.getManager().getEntityManager().getSpawnedMob().get(
|
||||
defender.getUniqueId());
|
||||
if (rx != null && mb != null) {
|
||||
if (rpgKnockback >= 0) {
|
||||
rx.attackMob(mb, rpgKnockback, rpgDamage, projectile);
|
||||
} else {
|
||||
rx.attackMob(mb, rpgDamage, projectile);
|
||||
}
|
||||
}
|
||||
// range attack between player and mob
|
||||
}
|
||||
} else {
|
||||
if (defender instanceof Player) {
|
||||
MobData a = main.getManager().getEntityManager().getSpawnedMob().get(
|
||||
attacker.getUniqueId());
|
||||
RaxenPlayer d = main.getManager().getPlayerManager().getRaxenPlayer(
|
||||
(Player) defender);
|
||||
if (a != null && d != null) {
|
||||
a.attack(d, rpgDamage, projectile);
|
||||
}
|
||||
// range attack between mob and player
|
||||
} else {
|
||||
// range attack between mobs
|
||||
}
|
||||
}
|
||||
attacker.remove();
|
||||
} else {
|
||||
if (defender instanceof Player) {
|
||||
MobData a = main.getManager().getEntityManager().getSpawnedMob().get(
|
||||
attacker.getUniqueId());
|
||||
RaxenPlayer d = main.getManager().getPlayerManager().getRaxenPlayer(
|
||||
(Player) defender);
|
||||
if (a != null && d != null) {
|
||||
a.attack(d);
|
||||
}
|
||||
// attack between mob and player
|
||||
} else {
|
||||
// attack between mobs
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* fired when an entity is damaged by another entity calculates the damage and apply it to the
|
||||
* entity
|
||||
*
|
||||
* @param e
|
||||
*/
|
||||
@Deprecated
|
||||
// @EventHandler
|
||||
public void entityDamageByEntity(EntityDamageByEntityEvent e) {
|
||||
if (
|
||||
!(e.getEntity() instanceof LivingEntity) ||
|
||||
!(e.getDamager() instanceof LivingEntity)
|
||||
) {
|
||||
debug("Not Living Entity, Some block falling shit or block entities");
|
||||
debug(
|
||||
"Not Living Entity, Some block falling shit or block entities"
|
||||
);
|
||||
} else {
|
||||
e.setCancelled(true);
|
||||
e.setDamage(0);
|
||||
Integer damage = 1;
|
||||
Integer strength = 0;
|
||||
|
@ -72,10 +187,16 @@ public class DamageEntity implements Listener {
|
|||
PersistentDataContainer data =
|
||||
entityDamager.getPersistentDataContainer();
|
||||
if (
|
||||
data.has(entityNamespacedKey.strength, PersistentDataType.INTEGER)
|
||||
data.has(
|
||||
entityNamespacedKey.strength,
|
||||
PersistentDataType.INTEGER
|
||||
)
|
||||
) {
|
||||
strength =
|
||||
data.get(entityNamespacedKey.strength, PersistentDataType.INTEGER);
|
||||
data.get(
|
||||
entityNamespacedKey.strength,
|
||||
PersistentDataType.INTEGER
|
||||
);
|
||||
}
|
||||
itemStrength =
|
||||
pm.getItemStrength().getItem((LivingEntity) entityDamager);
|
||||
|
@ -93,16 +214,34 @@ public class DamageEntity implements Listener {
|
|||
Entity entityVictim = e.getEntity();
|
||||
PersistentDataContainer data =
|
||||
entityVictim.getPersistentDataContainer();
|
||||
if (data.has(entityNamespacedKey.defense, PersistentDataType.INTEGER)) {
|
||||
if (
|
||||
data.has(
|
||||
entityNamespacedKey.defense,
|
||||
PersistentDataType.INTEGER
|
||||
)
|
||||
) {
|
||||
defense =
|
||||
data.get(entityNamespacedKey.defense, PersistentDataType.INTEGER);
|
||||
data.get(
|
||||
entityNamespacedKey.defense,
|
||||
PersistentDataType.INTEGER
|
||||
);
|
||||
}
|
||||
if (data.has(entityNamespacedKey.health, PersistentDataType.INTEGER)) {
|
||||
if (
|
||||
data.has(
|
||||
entityNamespacedKey.health,
|
||||
PersistentDataType.INTEGER
|
||||
)
|
||||
) {
|
||||
health =
|
||||
data.get(entityNamespacedKey.health, PersistentDataType.INTEGER);
|
||||
data.get(
|
||||
entityNamespacedKey.health,
|
||||
PersistentDataType.INTEGER
|
||||
);
|
||||
}
|
||||
itemDefense = pm.getItemDefense().getItem((LivingEntity) entityVictim);
|
||||
itemHealth = pm.getItemHealth().getItem((LivingEntity) entityVictim);
|
||||
itemDefense =
|
||||
pm.getItemDefense().getItem((LivingEntity) entityVictim);
|
||||
itemHealth =
|
||||
pm.getItemHealth().getItem((LivingEntity) entityVictim);
|
||||
}
|
||||
debug(
|
||||
main,
|
||||
|
@ -159,9 +298,11 @@ public class DamageEntity implements Listener {
|
|||
|
||||
/**
|
||||
* damage made by blocks on entity
|
||||
*
|
||||
* @param e
|
||||
*/
|
||||
@EventHandler
|
||||
@Deprecated
|
||||
// @EventHandler
|
||||
public void entityDamageByBlock(EntityDamageByBlockEvent e) {
|
||||
e.setDamage(0);
|
||||
if (e.getEntity() instanceof Player) {
|
||||
|
|
|
@ -5,6 +5,7 @@ import static me.unurled.raxen.utils.Utils.debug;
|
|||
import me.unurled.raxen.Raxen;
|
||||
import me.unurled.raxen.components.entity.other.EntityNamespacedKey;
|
||||
import me.unurled.raxen.components.entity.other.EntityUtils;
|
||||
import org.bukkit.entity.Display;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
|
@ -26,18 +27,24 @@ public class SpawnEvent implements Listener {
|
|||
}
|
||||
|
||||
/**
|
||||
* when a new entity spawns
|
||||
* adds all persistent data container
|
||||
* when a new entity spawns adds all persistent data container
|
||||
*
|
||||
* @param e
|
||||
*/
|
||||
@EventHandler
|
||||
public void Spawn(EntitySpawnEvent e) {
|
||||
e.getEntity().getWorld().spawn(e.getLocation(), Display.class);
|
||||
if (e.getEntity() instanceof Player) {
|
||||
//player stuff dont want to talk about it; already doing it in player join event
|
||||
debug(main, "Player: " + ((Player) e.getEntity()).getName());
|
||||
} else if (
|
||||
e.getEntity().getType() != EntityType.DROPPED_ITEM &&
|
||||
e.getEntity().getType() != EntityType.FALLING_BLOCK
|
||||
e.getEntity().getType() != EntityType.FALLING_BLOCK &&
|
||||
e.getEntity().getType() != EntityType.ARROW &&
|
||||
e.getEntity().getType() != EntityType.ITEM_DISPLAY &&
|
||||
e.getEntity().getType() != EntityType.BLOCK_DISPLAY &&
|
||||
e.getEntity().getType() != EntityType.TEXT_DISPLAY &&
|
||||
!(e.getEntity() instanceof Display)
|
||||
) {
|
||||
debug(main, e.getEntity().getName());
|
||||
if (
|
||||
|
@ -60,7 +67,10 @@ public class SpawnEvent implements Listener {
|
|||
0
|
||||
);
|
||||
}
|
||||
main.getManager().getEntityManager().registerEntity(e.getEntity());
|
||||
entityUtils.updateSkills((LivingEntity) e.getEntity());
|
||||
|
||||
// add nametag
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -34,7 +34,9 @@ public class ArmorEvent implements Listener {
|
|||
.getPlayerManager();
|
||||
Entity entity = player;
|
||||
Attributes attributes = new Attributes(main);
|
||||
if (e.getOldItem() != null && e.getOldItem().getType() != Material.AIR) {
|
||||
if (
|
||||
e.getOldItem() != null && e.getOldItem().getType() != Material.AIR
|
||||
) {
|
||||
ItemStack oldItem = e.getOldItem();
|
||||
NBTItem nbti = new NBTItem(oldItem);
|
||||
if (nbti.hasTag("SPEED")) {
|
||||
|
@ -50,7 +52,9 @@ public class ArmorEvent implements Listener {
|
|||
pm.getStrength().remove(entity, nbti.getInteger("STRENGTH"));
|
||||
}
|
||||
}
|
||||
if (e.getNewItem() != null && e.getNewItem().getType() != Material.AIR) {
|
||||
if (
|
||||
e.getNewItem() != null && e.getNewItem().getType() != Material.AIR
|
||||
) {
|
||||
ItemStack newItem = e.getNewItem();
|
||||
NBTItem nbti = new NBTItem(newItem);
|
||||
if (nbti.hasTag("SPEED")) {
|
||||
|
|
|
@ -25,7 +25,9 @@ public class CloseInventoryEvent implements Listener {
|
|||
Component title = e.getView().title();
|
||||
if (title.toString().contains("Ender Chest")) {
|
||||
playerManager =
|
||||
((Raxen) Bukkit.getPluginManager().getPlugin("Raxen")).getManager()
|
||||
(
|
||||
(Raxen) Bukkit.getPluginManager().getPlugin("Raxen")
|
||||
).getManager()
|
||||
.getPlayerManager();
|
||||
playerManager.getRaxenPlayer(player).setStorage(e.getInventory());
|
||||
}
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
package me.unurled.raxen.listener.player;
|
||||
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.entity.FoodLevelChangeEvent;
|
||||
|
||||
public class FoodLevelEvent implements Listener {
|
||||
|
||||
@EventHandler
|
||||
public void FoodLevelChange(FoodLevelChangeEvent e) {
|
||||
e.setFoodLevel(20);
|
||||
}
|
||||
}
|
|
@ -1,5 +1,6 @@
|
|||
package me.unurled.raxen.listener.player;
|
||||
|
||||
import de.tr7zw.nbtapi.NBT;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
|
@ -11,9 +12,16 @@ public class InteractEvent implements Listener {
|
|||
|
||||
@EventHandler
|
||||
public void PlayerInteractEvent(PlayerInteractEvent e) {
|
||||
// Player p = e.getPlayer();
|
||||
// if (e.hasItem()) {
|
||||
// ItemStack i = e.getItem();
|
||||
// }
|
||||
Player p = e.getPlayer();
|
||||
if (e.hasItem()) {
|
||||
ItemStack i = e.getItem();
|
||||
if (i != null && i.getType() != Material.AIR) {
|
||||
String id = NBT.get(i, nbt -> nbt.getString("ID"));
|
||||
if (id != null && !id.isEmpty()) {
|
||||
if (id.equals("PHONE")) {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -47,18 +47,29 @@ public class ItemHandEvent implements Listener {
|
|||
java.lang.reflect.Method method = null;
|
||||
try {
|
||||
method = pm.getClass().getMethod("getItem" + s);
|
||||
} catch (SecurityException | NoSuchMethodException exception) {}
|
||||
} catch (
|
||||
SecurityException | NoSuchMethodException exception
|
||||
) {}
|
||||
if (method != null) {
|
||||
me.unurled.raxen.components.entity.Attributes.Attribute attribute =
|
||||
null;
|
||||
try {
|
||||
attribute = (Attribute) method.invoke(pm, (Object) null);
|
||||
attribute = (Attribute) method.invoke(pm);
|
||||
} catch (
|
||||
InvocationTargetException | IllegalAccessException ignored
|
||||
InvocationTargetException
|
||||
| IllegalAccessException ignored
|
||||
) {}
|
||||
if (attribute != null) {
|
||||
attribute.remove(player, nbti.getInteger(s.toUpperCase()));
|
||||
debug("removed " + s + " for player " + player.getName());
|
||||
attribute.remove(
|
||||
player,
|
||||
nbti.getInteger(s.toUpperCase())
|
||||
);
|
||||
debug(
|
||||
"removed " +
|
||||
s +
|
||||
" for player " +
|
||||
player.getName()
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -83,18 +94,26 @@ public class ItemHandEvent implements Listener {
|
|||
java.lang.reflect.Method method = null;
|
||||
try {
|
||||
method = pm.getClass().getMethod("getItem" + s);
|
||||
} catch (SecurityException | NoSuchMethodException exception) {}
|
||||
} catch (
|
||||
SecurityException | NoSuchMethodException exception
|
||||
) {}
|
||||
if (method != null) {
|
||||
me.unurled.raxen.components.entity.Attributes.Attribute attribute =
|
||||
null;
|
||||
try {
|
||||
attribute = (Attribute) method.invoke(pm, (Object) null);
|
||||
attribute = (Attribute) method.invoke(pm);
|
||||
} catch (
|
||||
InvocationTargetException | IllegalAccessException ignored
|
||||
InvocationTargetException
|
||||
| IllegalAccessException ignored
|
||||
) {}
|
||||
if (attribute != null) {
|
||||
attribute.add(player, nbti.getInteger(s.toUpperCase()));
|
||||
debug("add " + s + " for player " + player.getName());
|
||||
attribute.add(
|
||||
player,
|
||||
nbti.getInteger(s.toUpperCase())
|
||||
);
|
||||
debug(
|
||||
"add " + s + " for player " + player.getName()
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,6 +10,7 @@ import org.bukkit.entity.Player;
|
|||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.player.PlayerJoinEvent;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
public class JoinEvent implements Listener {
|
||||
|
||||
|
@ -30,6 +31,7 @@ public class JoinEvent implements Listener {
|
|||
|
||||
/**
|
||||
* when player joins, load from config all stats
|
||||
*
|
||||
* @param e
|
||||
*/
|
||||
@EventHandler
|
||||
|
@ -40,6 +42,13 @@ public class JoinEvent implements Listener {
|
|||
resourcePack.join(player);
|
||||
playerManager.getRaxenPlayer(player).isRaxenPlayer(true);
|
||||
playerManager.registerActionBar(player);
|
||||
new BukkitRunnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
main.getManager().getTutorialManager().startTutorial(player);
|
||||
|
||||
}
|
||||
}.runTaskLater(main, 40L);
|
||||
PlayerUtils.updateSkills(main, player);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,7 +2,6 @@ package me.unurled.raxen.listener.player;
|
|||
|
||||
import java.io.IOException;
|
||||
import me.unurled.raxen.Raxen;
|
||||
import me.unurled.raxen.components.entity.player.PlayerUtils;
|
||||
import me.unurled.raxen.config.PlayerConfig;
|
||||
import me.unurled.raxen.manager.entity.PlayerManager;
|
||||
import org.bukkit.entity.Player;
|
||||
|
@ -22,6 +21,7 @@ public class LeaveEvent implements Listener {
|
|||
|
||||
/**
|
||||
* when player leaves, saves everything
|
||||
*
|
||||
* @param e
|
||||
* @throws IOException
|
||||
*/
|
||||
|
|
|
@ -0,0 +1,53 @@
|
|||
package me.unurled.raxen.listener.player;
|
||||
|
||||
import java.util.Set;
|
||||
import me.unurled.raxen.Raxen;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.block.Action;
|
||||
import org.bukkit.event.player.PlayerAnimationEvent;
|
||||
import org.bukkit.event.player.PlayerAnimationType;
|
||||
import org.bukkit.event.player.PlayerInteractEntityEvent;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
|
||||
public class SpellsEvent implements Listener {
|
||||
|
||||
Raxen main;
|
||||
|
||||
public SpellsEvent(Raxen main) {
|
||||
this.main = main;
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onSpellClickOnEntity(PlayerInteractEntityEvent event) {
|
||||
Player p = event.getPlayer();
|
||||
main.getManager().getSpellManager().click(p, false);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void event(PlayerAnimationEvent event) {
|
||||
Block focused = event.getPlayer().getTargetBlock((Set<Material>) null, 5);
|
||||
if (event.getAnimationType() == PlayerAnimationType.ARM_SWING
|
||||
&& focused.getType() != Material.AIR
|
||||
&& event.getPlayer().getGameMode() == GameMode.ADVENTURE) {
|
||||
main.getManager().getSpellManager().click(event.getPlayer(), true);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onSpellClicks(PlayerInteractEvent event) {
|
||||
Player p = event.getPlayer();
|
||||
if (event.getAction() == Action.LEFT_CLICK_AIR
|
||||
|| event.getAction() == Action.LEFT_CLICK_BLOCK) {
|
||||
main.getManager().getSpellManager().click(p, true);
|
||||
} else if (event.getAction() == Action.RIGHT_CLICK_AIR
|
||||
|| event.getAction() == Action.RIGHT_CLICK_BLOCK) {
|
||||
main.getManager().getSpellManager().click(p, false);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -2,13 +2,27 @@ package me.unurled.raxen.manager;
|
|||
|
||||
import lombok.Getter;
|
||||
import me.unurled.raxen.Raxen;
|
||||
import me.unurled.raxen.manager.entity.*;
|
||||
import me.unurled.raxen.manager.server.*;
|
||||
import me.unurled.raxen.manager.entity.EntityManager;
|
||||
import me.unurled.raxen.manager.entity.ItemManager;
|
||||
import me.unurled.raxen.manager.entity.LootManager;
|
||||
import me.unurled.raxen.manager.entity.PartyManager;
|
||||
import me.unurled.raxen.manager.entity.PlayerManager;
|
||||
import me.unurled.raxen.manager.entity.SpellManager;
|
||||
import me.unurled.raxen.manager.entity.StorageManager;
|
||||
import me.unurled.raxen.manager.server.BuildManager;
|
||||
import me.unurled.raxen.manager.server.CommandManager;
|
||||
import me.unurled.raxen.manager.server.DungeonsManager;
|
||||
import me.unurled.raxen.manager.server.GlyphManager;
|
||||
import me.unurled.raxen.manager.server.LibsManager;
|
||||
import me.unurled.raxen.manager.server.ListenerManager;
|
||||
import me.unurled.raxen.manager.server.ResourcePackManager;
|
||||
import me.unurled.raxen.manager.server.TutorialManager;
|
||||
import me.unurled.raxen.manager.server.WorldManager;
|
||||
import me.unurled.raxen.utils.libs.Multiverse;
|
||||
|
||||
/**
|
||||
* Manager class, it enables all features of the plugin.
|
||||
* From commands, to Item and worlds, it links all of them together.
|
||||
* Manager class, it enables all features of the plugin. From commands, to Item and worlds, it links
|
||||
* all of them together.
|
||||
*/
|
||||
public class Manager {
|
||||
|
||||
|
@ -48,8 +62,24 @@ public class Manager {
|
|||
@Getter
|
||||
private Multiverse multiverse;
|
||||
|
||||
@Getter
|
||||
private TutorialManager tutorialManager;
|
||||
|
||||
@Getter
|
||||
private PartyManager partyManager;
|
||||
|
||||
@Getter
|
||||
private SpellManager spellManager;
|
||||
|
||||
@Getter
|
||||
private GlyphManager glyphManager;
|
||||
|
||||
@Getter
|
||||
private BuildManager buildManager;
|
||||
|
||||
/**
|
||||
* Create an instance of all managers.
|
||||
*
|
||||
* @param main Raxen
|
||||
*/
|
||||
public void set(Raxen main) {
|
||||
|
@ -67,5 +97,10 @@ public class Manager {
|
|||
entityManager = new EntityManager(main);
|
||||
lootManager = new LootManager(main);
|
||||
dungeonsManager = new DungeonsManager(main);
|
||||
tutorialManager = new TutorialManager();
|
||||
partyManager = new PartyManager(main);
|
||||
spellManager = new SpellManager(main);
|
||||
glyphManager = new GlyphManager(main);
|
||||
buildManager = new BuildManager(main);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,18 +2,43 @@ package me.unurled.raxen.manager.entity;
|
|||
|
||||
import static me.unurled.raxen.utils.Utils.debug;
|
||||
|
||||
import eu.decentsoftware.holograms.api.DHAPI;
|
||||
import eu.decentsoftware.holograms.api.holograms.Hologram;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import me.unurled.raxen.Raxen;
|
||||
import me.unurled.raxen.components.entity.Attributes.Defense;
|
||||
import me.unurled.raxen.components.entity.Attributes.Health;
|
||||
import me.unurled.raxen.components.entity.Attributes.ItemDefense;
|
||||
import me.unurled.raxen.components.entity.Attributes.ItemHealth;
|
||||
import me.unurled.raxen.components.entity.Attributes.ItemLuck;
|
||||
import me.unurled.raxen.components.entity.Attributes.ItemMana;
|
||||
import me.unurled.raxen.components.entity.Attributes.ItemSpeed;
|
||||
import me.unurled.raxen.components.entity.Attributes.ItemStrength;
|
||||
import me.unurled.raxen.components.entity.Attributes.Luck;
|
||||
import me.unurled.raxen.components.entity.Attributes.Mana;
|
||||
import me.unurled.raxen.components.entity.Attributes.MaxHealth;
|
||||
import me.unurled.raxen.components.entity.Attributes.MaxMana;
|
||||
import me.unurled.raxen.components.entity.Attributes.MaxManaBuilder;
|
||||
import me.unurled.raxen.components.entity.Attributes.Speed;
|
||||
import me.unurled.raxen.components.entity.Attributes.Strength;
|
||||
import me.unurled.raxen.components.entity.other.EntityNamespacedKey;
|
||||
import me.unurled.raxen.components.entity.other.MobData;
|
||||
import me.unurled.raxen.components.entity.other.MobType;
|
||||
import me.unurled.raxen.components.entity.other.RaxenEntity;
|
||||
import me.unurled.raxen.utils.Tags;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
import org.bukkit.scheduler.BukkitTask;
|
||||
|
||||
public class EntityManager {
|
||||
|
||||
|
@ -21,21 +46,70 @@ public class EntityManager {
|
|||
|
||||
@Getter
|
||||
@Setter
|
||||
public List<EntityType> list = new ArrayList<>();
|
||||
private List<EntityType> list = new ArrayList<>();
|
||||
|
||||
public HashMap<String, me.unurled.raxen.components.entity.other.custom.Entity> entities =
|
||||
new HashMap<>();
|
||||
@Getter
|
||||
private HashMap<String, MobType> mobTypes;
|
||||
@Getter
|
||||
private final HashMap<UUID, MobData> spawnedMob;
|
||||
@Getter
|
||||
private HashMap<UUID, MobData> spawnedMobsOnlyMain;
|
||||
|
||||
public HashMap<UUID, Entity> livingEntities = new HashMap<>();
|
||||
@Getter
|
||||
private final HashMap<String, me.unurled.raxen.components.entity.Attributes.Attribute> attribute;
|
||||
|
||||
private final HashMap<String, me.unurled.raxen.components.entity.other.RaxenEntity> entities;
|
||||
|
||||
|
||||
private final HashMap<UUID, Entity> livingEntities = new HashMap<>();
|
||||
private HashMap<UUID, BukkitTask> nameTags;
|
||||
|
||||
public EntityManager(Raxen main) {
|
||||
this.main = main;
|
||||
entities = new HashMap<>();
|
||||
attribute = new HashMap<>();
|
||||
mobTypes = new HashMap<>();
|
||||
spawnedMob = new HashMap<>();
|
||||
spawnedMobsOnlyMain = new HashMap<>();
|
||||
nameTags = new HashMap<>();
|
||||
reload();
|
||||
registerAttributes();
|
||||
}
|
||||
|
||||
public void registerLivingEntities(World world) {}
|
||||
public void reload() {
|
||||
Collection<MobData> collection = new ArrayList<>();
|
||||
collection.addAll(spawnedMob.values());
|
||||
for (MobData mobData : collection) {
|
||||
// mobData.entity.die(false);
|
||||
}
|
||||
}
|
||||
|
||||
public void registerLivingEntities(World world) {
|
||||
}
|
||||
|
||||
public void registerEntity(Entity entity) {
|
||||
/* RaxenEntity raxenEntity = new RaxenEntity();
|
||||
raxenEntity.register(entity);
|
||||
entities.put(entity.getUniqueId(), raxenEntity); */
|
||||
}
|
||||
|
||||
public void setNameTag(Entity entity) {
|
||||
Hologram holo = Tags.createNameTag(main, entity);
|
||||
if (holo == null) {
|
||||
return;
|
||||
}
|
||||
BukkitTask run = new BukkitRunnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
DHAPI.moveHologram(holo, entity.getLocation());
|
||||
}
|
||||
}.runTaskAsynchronously(main);
|
||||
nameTags.put(entity.getUniqueId(), run);
|
||||
}
|
||||
|
||||
/**
|
||||
* used to register entities using fileconfigs but rapidly abandoned
|
||||
*
|
||||
* @param file
|
||||
*/
|
||||
@Deprecated
|
||||
|
@ -44,4 +118,121 @@ public class EntityManager {
|
|||
World world = Bukkit.getWorld(file.getString("world"));
|
||||
String name = file.getString("name");
|
||||
}
|
||||
|
||||
public RaxenEntity getEntity(UUID uuid) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public RaxenEntity getEntity(Entity entity) {
|
||||
return entities.get(entity.getUniqueId());
|
||||
}
|
||||
|
||||
/**
|
||||
* register all Attributes in me.unurled.raxen.components.entity.Attributes;
|
||||
*/
|
||||
public void registerAttributes() {
|
||||
EntityNamespacedKey key = new EntityNamespacedKey(main);
|
||||
|
||||
// Attributes
|
||||
Defense defense = new Defense(key.defense, "DEFENSE");
|
||||
attribute.put("DEFENSE", defense);
|
||||
|
||||
Health health = new Health(key.health, "HEALTH");
|
||||
attribute.put("HEALTH", health);
|
||||
|
||||
ItemDefense itemDefense = new ItemDefense(key.itemDefense, "ITEM_DEFENSE");
|
||||
attribute.put("ITEM_DEFENSE", itemDefense);
|
||||
|
||||
ItemHealth itemHealth = new ItemHealth(key.itemHealth, "ITEM_HEALTH");
|
||||
attribute.put("ITEM_HEALTH", itemHealth);
|
||||
|
||||
ItemLuck itemLuck = new ItemLuck(key.itemLuck, "ITEM_LUCK");
|
||||
attribute.put("ITEM_LUCK", itemLuck);
|
||||
|
||||
ItemMana itemMana = new ItemMana(key.itemMana, "ITEM_MANA");
|
||||
attribute.put("ITEM_MANA", itemMana);
|
||||
|
||||
ItemSpeed itemSpeed = new ItemSpeed(key.itemSpeed, "ITEM_SPEED");
|
||||
attribute.put("ITEM_SPEED", itemSpeed);
|
||||
|
||||
ItemStrength itemStrength = new ItemStrength(key.itemStrength, "ITEM_STRENGTH");
|
||||
attribute.put("ITEM_STRENGTH", itemStrength);
|
||||
|
||||
Luck luck = new Luck(key.luck, "LUCK");
|
||||
attribute.put("LUCK", luck);
|
||||
|
||||
Mana mana = new Mana(key.mana, "MANA");
|
||||
attribute.put("MANA", mana);
|
||||
|
||||
MaxMana maxMana = new MaxManaBuilder()
|
||||
.setNamespacekey(key.maxMana)
|
||||
.setName("MAX_MANA")
|
||||
.createMaxMana();
|
||||
attribute.put("MAX_MANA", maxMana);
|
||||
|
||||
MaxHealth maxHealth = new MaxHealth(key.maxHealth, "MAX_HEALTH");
|
||||
attribute.put("MAX_HEALTH", maxHealth);
|
||||
|
||||
Speed speed = new Speed(key.speed, "SPEED");
|
||||
attribute.put("SPEED", speed);
|
||||
|
||||
Strength strength = new Strength(key.strength, "STRENGTH");
|
||||
attribute.put("STRENGTH", strength);
|
||||
}
|
||||
|
||||
public Defense getDefense() {
|
||||
return (Defense) attribute.get("DEFENSE");
|
||||
}
|
||||
|
||||
public Health getHealth() {
|
||||
return (Health) attribute.get("HEALTH");
|
||||
}
|
||||
|
||||
public ItemDefense getItemDefense() {
|
||||
return (ItemDefense) attribute.get("ITEM_DEFENSE");
|
||||
}
|
||||
|
||||
public ItemHealth getItemHealth() {
|
||||
return (ItemHealth) attribute.get("ITEM_HEALTH");
|
||||
}
|
||||
|
||||
public ItemLuck getItemLuck() {
|
||||
return (ItemLuck) attribute.get("ITEM_LUCK");
|
||||
}
|
||||
|
||||
public ItemMana getItemMana() {
|
||||
return (ItemMana) attribute.get("ITEM_MANA");
|
||||
}
|
||||
|
||||
public ItemSpeed getItemSpeed() {
|
||||
return (ItemSpeed) attribute.get("ITEM_SPEED");
|
||||
}
|
||||
|
||||
public ItemStrength getItemStrength() {
|
||||
return (ItemStrength) attribute.get("ITEM_STRENGTH");
|
||||
}
|
||||
|
||||
public Luck getLuck() {
|
||||
return (Luck) attribute.get("LUCK");
|
||||
}
|
||||
|
||||
public Mana getMana() {
|
||||
return (Mana) attribute.get("MANA");
|
||||
}
|
||||
|
||||
public MaxMana getMaxMana() {
|
||||
return (MaxMana) attribute.get("MAX_MANA");
|
||||
}
|
||||
|
||||
public MaxHealth getMaxHealth() {
|
||||
return (MaxHealth) attribute.get("MAX_HEALTH");
|
||||
}
|
||||
|
||||
public Speed getSpeed() {
|
||||
return (Speed) attribute.get("SPEED");
|
||||
}
|
||||
|
||||
public Strength getStrength() {
|
||||
return (Strength) attribute.get("STRENGTH");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
package me.unurled.raxen.manager.entity;
|
||||
|
||||
import static me.unurled.raxen.utils.Utils.*;
|
||||
import static me.unurled.raxen.utils.Utils.colorTextComp;
|
||||
import static me.unurled.raxen.utils.Utils.debug;
|
||||
import static me.unurled.raxen.utils.Utils.error;
|
||||
|
||||
import de.tr7zw.nbtapi.NBTItem;
|
||||
import java.io.File;
|
||||
|
@ -8,13 +10,14 @@ import java.io.IOException;
|
|||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
import lombok.Getter;
|
||||
import me.unurled.raxen.Raxen;
|
||||
import me.unurled.raxen.components.items.NBT;
|
||||
import me.unurled.raxen.components.items.ItemBuilder;
|
||||
import me.unurled.raxen.components.items.NBTNames;
|
||||
import me.unurled.raxen.components.items.custom.Item;
|
||||
import me.unurled.raxen.utils.Utils;
|
||||
import me.unurled.raxen.config.ItemConfig;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.kyori.adventure.text.TextComponent;
|
||||
import org.bukkit.Bukkit;
|
||||
|
@ -33,7 +36,10 @@ public class ItemManager {
|
|||
@Getter
|
||||
private HashMap<String, ItemStack> list = new HashMap<>();
|
||||
|
||||
private NBT nbt = new NBT();
|
||||
private NBTNames nbt = new NBTNames();
|
||||
private ItemConfig itemConfig;
|
||||
private String[] items;
|
||||
private Map<File, Map<String, ItemBuilder>> map;
|
||||
|
||||
public ItemManager(Raxen main) {
|
||||
this.main = main;
|
||||
|
@ -45,6 +51,13 @@ public class ItemManager {
|
|||
* register manually all item in Raxen
|
||||
*/
|
||||
private void registerItem() {
|
||||
itemConfig = new ItemConfig(main);
|
||||
map = itemConfig.parseItemConfigs();
|
||||
final List<String> itemsList = new ArrayList<>();
|
||||
for (final Map<String, ItemBuilder> subMap : map.values()) {
|
||||
itemsList.addAll(subMap.keySet());
|
||||
}
|
||||
items = itemsList.toArray(new String[0]);
|
||||
me.unurled.raxen.components.items.custom.List lisst =
|
||||
new me.unurled.raxen.components.items.custom.List(main);
|
||||
for (Item items : lisst.getItems()) {
|
||||
|
@ -75,13 +88,17 @@ public class ItemManager {
|
|||
FileConfiguration customItem = new YamlConfiguration();
|
||||
try {
|
||||
customItem.load(listFile[i].listFiles()[a]);
|
||||
} catch (IOException | InvalidConfigurationException e) {
|
||||
} catch (
|
||||
IOException | InvalidConfigurationException e
|
||||
) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
registerItem(customItem);
|
||||
} else if (listFile[i].listFiles()[a].isDirectory()) {
|
||||
error(
|
||||
(Raxen) Bukkit.getPluginManager().getPlugin("Raxen"),
|
||||
(Raxen) Bukkit
|
||||
.getPluginManager()
|
||||
.getPlugin("Raxen"),
|
||||
"Can't use more than 2 folder to get Items.yml"
|
||||
);
|
||||
}
|
||||
|
@ -92,6 +109,7 @@ public class ItemManager {
|
|||
|
||||
/**
|
||||
* Old system to register for a file config an item inside.
|
||||
*
|
||||
* @param file
|
||||
*/
|
||||
@Deprecated
|
||||
|
@ -99,7 +117,9 @@ public class ItemManager {
|
|||
debug(main, file.getString("id"));
|
||||
ItemStack it = new ItemStack(
|
||||
Objects.requireNonNull(
|
||||
Material.getMaterial((String) Objects.requireNonNull(file.get("id")))
|
||||
Material.getMaterial(
|
||||
(String) Objects.requireNonNull(file.get("id"))
|
||||
)
|
||||
)
|
||||
);
|
||||
ItemMeta itm = it.getItemMeta();
|
||||
|
@ -108,7 +128,9 @@ public class ItemManager {
|
|||
if (lore_obj instanceof List<?> lore) {
|
||||
List<Component> lores = new ArrayList<>();
|
||||
for (Object s : lore) {
|
||||
if (s == null) continue;
|
||||
if (s == null) {
|
||||
continue;
|
||||
}
|
||||
if (s instanceof String) {
|
||||
TextComponent textComponent = colorTextComp((String) s);
|
||||
lores.add(textComponent);
|
||||
|
@ -123,21 +145,24 @@ public class ItemManager {
|
|||
);
|
||||
it.setItemMeta(itm);
|
||||
NBTItem nbti = new NBTItem(it);
|
||||
nbti.setInteger(NBT.SPEED, file.getInt("speed"));
|
||||
nbti.setInteger(NBT.HEALTH, file.getInt("health"));
|
||||
nbti.setInteger(NBT.DEFENSE, file.getInt("defense"));
|
||||
nbti.setInteger(NBT.STRENGTH, file.getInt("strength"));
|
||||
nbti.setString(NBT.ID, file.getString("customId"));
|
||||
nbti.setString(NBT.CUSTOM_ABILITY, file.getString("custom_ability"));
|
||||
nbti.setDouble(NBT.DROP_RATE, file.getDouble("drop_rate"));
|
||||
nbti.setInteger(NBTNames.SPEED, file.getInt("speed"));
|
||||
nbti.setInteger(NBTNames.HEALTH, file.getInt("health"));
|
||||
nbti.setInteger(NBTNames.DEFENSE, file.getInt("defense"));
|
||||
nbti.setInteger(NBTNames.STRENGTH, file.getInt("strength"));
|
||||
nbti.setString(NBTNames.ID, file.getString("customId"));
|
||||
nbti.setString(
|
||||
NBTNames.CUSTOM_ABILITY,
|
||||
file.getString("custom_ability")
|
||||
);
|
||||
nbti.setDouble(NBTNames.DROP_RATE, file.getDouble("drop_rate"));
|
||||
it = nbti.getItem();
|
||||
//it = setLoreFromNBT(it); deprecated
|
||||
list.put(file.getString("customId"), it);
|
||||
}
|
||||
|
||||
/**
|
||||
* register Item into the custom item list
|
||||
* Need that the Itm is already set with custom nbt!
|
||||
* register Item into the custom item list Need that the Itm is already set with custom nbt!
|
||||
*
|
||||
* @param itm an ItemStack with already set custom nbt using NBTapi
|
||||
*/
|
||||
public void registerItem(ItemStack itm) {
|
||||
|
|
|
@ -0,0 +1,65 @@
|
|||
package me.unurled.raxen.manager.entity;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import lombok.Getter;
|
||||
import me.unurled.raxen.Raxen;
|
||||
import me.unurled.raxen.components.entity.player.RaxenPlayer;
|
||||
import me.unurled.raxen.components.party.Party;
|
||||
import me.unurled.raxen.utils.Utils;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
public class PartyManager {
|
||||
|
||||
Raxen main;
|
||||
|
||||
public static final int MAX_SIZE = 10;
|
||||
|
||||
public static final Component PREFIX = Utils.colorComp("<reset><gray>[Party] </gray><yellow>");
|
||||
public static final Component PREFIX_SYSTEM = Utils.colorComp(
|
||||
"<reset><gray>[Party] </gray><dark_aqua>");
|
||||
|
||||
@Getter
|
||||
private ArrayList<Party> parties;
|
||||
|
||||
public PartyManager(Raxen main) {
|
||||
this.main = main;
|
||||
}
|
||||
|
||||
public void initialize() {
|
||||
parties = new ArrayList<Party>();
|
||||
new BukkitRunnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
for (int k = 0; k < parties.size(); k++) {
|
||||
Party p = parties.get(k);
|
||||
if (p.getPlayers().size() == 0) {
|
||||
parties.remove(k);
|
||||
if (p != null) {
|
||||
p.destroy();
|
||||
}
|
||||
k--;
|
||||
if (k < 0) {
|
||||
k = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}.runTaskTimerAsynchronously(main, 0L, 20L * 30L);
|
||||
}
|
||||
|
||||
public void createParty(Player p, RaxenPlayer rx) {
|
||||
if (rx.getParty() != null) {
|
||||
p.sendMessage(PREFIX_SYSTEM.append(Utils.colorComp(
|
||||
"<reset><dark_aqua>You are already in a party!\nLeave your current party to create a new one.")));
|
||||
return;
|
||||
} else {
|
||||
Party party = new Party(main, p);
|
||||
rx.setParty(party);
|
||||
parties.add(party);
|
||||
p.sendMessage(PREFIX_SYSTEM.append(Utils.colorComp(
|
||||
"<reset><dark_aqua>You have created a party!")));
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,18 +1,34 @@
|
|||
package me.unurled.raxen.manager.entity;
|
||||
|
||||
import static me.unurled.raxen.utils.Utils.*;
|
||||
import static me.unurled.raxen.components.entity.player.PlayerUtils.actionBarPlayer;
|
||||
import static me.unurled.raxen.utils.Utils.colorTextComp;
|
||||
import static me.unurled.raxen.utils.Utils.debug;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.UUID;
|
||||
import lombok.Getter;
|
||||
import me.unurled.raxen.Raxen;
|
||||
import me.unurled.raxen.components.entity.Attributes.*;
|
||||
import me.unurled.raxen.components.entity.Attributes.Defense;
|
||||
import me.unurled.raxen.components.entity.Attributes.Health;
|
||||
import me.unurled.raxen.components.entity.Attributes.ItemDefense;
|
||||
import me.unurled.raxen.components.entity.Attributes.ItemHealth;
|
||||
import me.unurled.raxen.components.entity.Attributes.ItemLuck;
|
||||
import me.unurled.raxen.components.entity.Attributes.ItemMana;
|
||||
import me.unurled.raxen.components.entity.Attributes.ItemSpeed;
|
||||
import me.unurled.raxen.components.entity.Attributes.ItemStrength;
|
||||
import me.unurled.raxen.components.entity.Attributes.Luck;
|
||||
import me.unurled.raxen.components.entity.Attributes.Mana;
|
||||
import me.unurled.raxen.components.entity.Attributes.MaxHealth;
|
||||
import me.unurled.raxen.components.entity.Attributes.MaxMana;
|
||||
import me.unurled.raxen.components.entity.Attributes.MaxManaBuilder;
|
||||
import me.unurled.raxen.components.entity.Attributes.Speed;
|
||||
import me.unurled.raxen.components.entity.Attributes.Strength;
|
||||
import me.unurled.raxen.components.entity.other.EntityNamespacedKey;
|
||||
import me.unurled.raxen.components.entity.player.RaxenPlayer;
|
||||
import me.unurled.raxen.components.entity.player.classes.Class;
|
||||
import me.unurled.raxen.components.entity.player.classes.Classes;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
import org.bukkit.scheduler.BukkitTask;
|
||||
|
||||
public class PlayerManager {
|
||||
|
@ -26,6 +42,8 @@ public class PlayerManager {
|
|||
private final HashMap<String, me.unurled.raxen.components.entity.Attributes.Attribute> attribute =
|
||||
new HashMap<>();
|
||||
|
||||
private HashMap<UUID, RaxenPlayer> raxenPlayer = new HashMap<>();
|
||||
|
||||
private Classes classesRegister;
|
||||
|
||||
// Attributes
|
||||
|
@ -50,34 +68,35 @@ public class PlayerManager {
|
|||
}
|
||||
|
||||
public RaxenPlayer getRaxenPlayer(Player player) {
|
||||
return new RaxenPlayer(main, player);
|
||||
RaxenPlayer p = raxenPlayer.get(player.getUniqueId());
|
||||
return p != null ? p : addRaxenPlayer(player);
|
||||
}
|
||||
|
||||
public RaxenPlayer getRaxenPlayer(UUID uuid) {
|
||||
RaxenPlayer p = raxenPlayer.get(uuid);
|
||||
return p != null ? p : addRaxenPlayer(uuid);
|
||||
}
|
||||
|
||||
public RaxenPlayer addRaxenPlayer(Player player) {
|
||||
RaxenPlayer rp = new RaxenPlayer(main, player);
|
||||
raxenPlayer.put(player.getUniqueId(), rp);
|
||||
return rp;
|
||||
}
|
||||
|
||||
public RaxenPlayer addRaxenPlayer(UUID uuid) {
|
||||
RaxenPlayer rp = new RaxenPlayer(main, Bukkit.getPlayer(uuid));
|
||||
raxenPlayer.put(uuid, rp);
|
||||
return rp;
|
||||
}
|
||||
|
||||
/**
|
||||
* add a task to the player action bar.
|
||||
*
|
||||
* @param player
|
||||
*/
|
||||
public void registerActionBar(Player player) {
|
||||
PlayerManager pm = main.getManager().getPlayerManager();
|
||||
BukkitTask task = new BukkitRunnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
player.sendActionBar(
|
||||
colorComp(
|
||||
"<red>" +
|
||||
pm.getHealth().get(player) +
|
||||
"/" +
|
||||
pm.getMaxHealth().get(player) +
|
||||
"❤</red> <aqua>" +
|
||||
pm.getMana().get(player) +
|
||||
"/" +
|
||||
pm.getMaxMana().get(player) +
|
||||
"</aqua>"
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
.runTaskTimerAsynchronously(main, 10, 20);
|
||||
BukkitTask task = actionBarPlayer(main, pm, player);
|
||||
if (actionBar.containsKey(player.getUniqueId())) {
|
||||
actionBar.replace(player.getUniqueId(), task);
|
||||
} else {
|
||||
|
@ -87,6 +106,7 @@ public class PlayerManager {
|
|||
|
||||
/**
|
||||
* removes the task of action bar to player
|
||||
*
|
||||
* @param player
|
||||
*/
|
||||
public void unRegisterActionBar(Player player) {
|
||||
|
@ -107,10 +127,27 @@ public class PlayerManager {
|
|||
}
|
||||
}
|
||||
|
||||
public void unRegisterRaxenPlayer(Player player) {}
|
||||
/**
|
||||
* Basically replace old task with old action bar with a new BukkitTask
|
||||
*
|
||||
* @param player
|
||||
*/
|
||||
public void updateActionBar(Player player) {
|
||||
PlayerManager pm = main.getManager().getPlayerManager();
|
||||
BukkitTask task = actionBarPlayer(main, pm, player);
|
||||
if (actionBar.containsKey(player.getUniqueId())) {
|
||||
actionBar.replace(player.getUniqueId(), task);
|
||||
} else {
|
||||
actionBar.put(player.getUniqueId(), task);
|
||||
}
|
||||
}
|
||||
|
||||
public void unRegisterRaxenPlayer(Player player) {
|
||||
}
|
||||
|
||||
/**
|
||||
* getClasses
|
||||
*
|
||||
* @return the classes HashMap
|
||||
*/
|
||||
public HashMap<String, Class> getClasses() {
|
||||
|
@ -119,6 +156,7 @@ public class PlayerManager {
|
|||
|
||||
/**
|
||||
* add @param to hashmap of classes
|
||||
*
|
||||
* @param clas a class instance
|
||||
* @param id the id of the class
|
||||
*/
|
||||
|
|
152
src/main/java/me/unurled/raxen/manager/entity/SpellManager.java
Normal file
152
src/main/java/me/unurled/raxen/manager/entity/SpellManager.java
Normal file
|
@ -0,0 +1,152 @@
|
|||
package me.unurled.raxen.manager.entity;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.UUID;
|
||||
import me.unurled.raxen.Raxen;
|
||||
import me.unurled.raxen.components.entity.player.RaxenPlayer;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
public class SpellManager {
|
||||
|
||||
static Raxen main;
|
||||
|
||||
public HashMap<UUID, Caster> casters = new HashMap<>();
|
||||
public HashMap<UUID, Long> lastPress = new HashMap<>();
|
||||
|
||||
public boolean isCasting(Player player) {
|
||||
if (!casters.containsKey(player.getUniqueId())) {
|
||||
return false;
|
||||
}
|
||||
Caster caster = casters.get(player.getUniqueId());
|
||||
return caster.state != CastState.NONE;
|
||||
}
|
||||
|
||||
public SpellManager(Raxen main) {
|
||||
SpellManager.main = main;
|
||||
}
|
||||
|
||||
public enum CastState {
|
||||
NONE(""), R("Right"), RL("Right-Left"), RLR("Right-Left-Right"), RLL("Right-Left-Left"), RR(
|
||||
"Right-Right"), RRL("Right-Right-Left"), RRR("Right-Right-Right");
|
||||
public String string;
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return string;
|
||||
}
|
||||
|
||||
CastState(String s) {
|
||||
this.string = s;
|
||||
}
|
||||
}
|
||||
|
||||
public static class Caster {
|
||||
|
||||
public CastState state = CastState.NONE;
|
||||
public int pressCount = 0;
|
||||
|
||||
public void press(boolean left) {
|
||||
pressCount++;
|
||||
final int lastPressCount = pressCount;
|
||||
Bukkit.getScheduler().scheduleSyncDelayedTask(main, new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (lastPressCount != pressCount) {
|
||||
return;
|
||||
}
|
||||
clear();
|
||||
}
|
||||
}, 20L);
|
||||
switch (state) {
|
||||
case NONE:
|
||||
if (!left) {
|
||||
state = CastState.R;
|
||||
}
|
||||
break;
|
||||
case R:
|
||||
if (!left) {
|
||||
state = CastState.RR;
|
||||
} else {
|
||||
state = CastState.RL;
|
||||
}
|
||||
break;
|
||||
case RL:
|
||||
if (left) {
|
||||
state = CastState.RLL;
|
||||
} else {
|
||||
state = CastState.RLR;
|
||||
}
|
||||
break;
|
||||
case RR:
|
||||
if (!left) {
|
||||
state = CastState.RRR;
|
||||
} else {
|
||||
state = CastState.RRL;
|
||||
}
|
||||
break;
|
||||
case RLL:
|
||||
case RLR:
|
||||
case RRL:
|
||||
case RRR:
|
||||
state = CastState.NONE;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void clear() {
|
||||
state = CastState.NONE;
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean isSpellWeapon(ItemStack it) {
|
||||
if (it == null || it.getType() == Material.AIR) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public void click(Player p, boolean left) {
|
||||
if (p.isGliding()) {
|
||||
return;
|
||||
}
|
||||
if (!casters.containsKey(p.getUniqueId())) {
|
||||
casters.put(p.getUniqueId(), new Caster());
|
||||
}
|
||||
RaxenPlayer rx = main.getManager().getPlayerManager().getRaxenPlayer(p);
|
||||
ItemStack it = p.getEquipment().getItemInMainHand();
|
||||
boolean spellWep = false;
|
||||
if (it != null) {
|
||||
spellWep = isSpellWeapon(it);
|
||||
}
|
||||
if (rx != null) {
|
||||
if (lastPress.containsKey(p.getUniqueId())) {
|
||||
if (System.currentTimeMillis() - lastPress.get(p.getUniqueId()) < 50) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
lastPress.put(p.getUniqueId(), System.currentTimeMillis());
|
||||
final Caster c = casters.get(p.getUniqueId());
|
||||
if (spellWep) {
|
||||
c.press(left);
|
||||
} else {
|
||||
c.clear();
|
||||
}
|
||||
// TODO: checkState
|
||||
}
|
||||
}
|
||||
|
||||
public void checkState(Player p, RaxenPlayer rx, Caster c) {
|
||||
rx.updateHealthManaDisplay();
|
||||
ItemStack it = p.getEquipment().getItemInMainHand();
|
||||
if (c.state == CastState.RLL) {
|
||||
if (it != null) {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -3,9 +3,19 @@ package me.unurled.raxen.manager.server;
|
|||
import lombok.Getter;
|
||||
import me.unurled.raxen.Raxen;
|
||||
import me.unurled.raxen.commands.RaxenCommand;
|
||||
import me.unurled.raxen.commands.admin.*;
|
||||
import me.unurled.raxen.commands.admin.BuildCommand;
|
||||
import me.unurled.raxen.commands.admin.CustomModelDataCommand;
|
||||
import me.unurled.raxen.commands.admin.EntitiyCommand;
|
||||
import me.unurled.raxen.commands.admin.ItemListCommand;
|
||||
import me.unurled.raxen.commands.admin.ItemTo64Command;
|
||||
import me.unurled.raxen.commands.admin.NbtCommand;
|
||||
import me.unurled.raxen.commands.admin.ReloadCommand;
|
||||
import me.unurled.raxen.commands.admin.SpawnEntity;
|
||||
import me.unurled.raxen.commands.admin.TestGuiCommand;
|
||||
import me.unurled.raxen.commands.admin.TutorialManagerCommand;
|
||||
import me.unurled.raxen.commands.player.ClassCommand;
|
||||
import me.unurled.raxen.commands.player.MainGuiCommand;
|
||||
import me.unurled.raxen.commands.player.PartyCommand;
|
||||
import me.unurled.raxen.commands.player.SkillsCommand;
|
||||
import me.unurled.raxen.commands.player.StorageCommand;
|
||||
|
||||
|
@ -28,6 +38,9 @@ public class CommandManager {
|
|||
private CustomModelDataCommand customModelDataCommand;
|
||||
private MainGuiCommand mainGuiCommand;
|
||||
private ItemTo64Command itemTo64Command;
|
||||
private TutorialManagerCommand tutorialManagerCommand;
|
||||
private PartyCommand partyCommand;
|
||||
private BuildCommand buildCommand;
|
||||
|
||||
public CommandManager(Raxen main) {
|
||||
this.main = main;
|
||||
|
@ -41,6 +54,9 @@ public class CommandManager {
|
|||
this.customModelDataCommand = new CustomModelDataCommand();
|
||||
this.mainGuiCommand = new MainGuiCommand(this.main);
|
||||
this.itemTo64Command = new ItemTo64Command();
|
||||
this.tutorialManagerCommand = new TutorialManagerCommand(main);
|
||||
this.partyCommand = new PartyCommand(main);
|
||||
this.buildCommand = new BuildCommand(main);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -74,7 +90,9 @@ public class CommandManager {
|
|||
main.getCommand("class").setTabCompleter(classCommand);
|
||||
main.getCommand("class").setExecutor(classCommand);
|
||||
|
||||
main.getCommand("custommodeldata").setTabCompleter(customModelDataCommand);
|
||||
main
|
||||
.getCommand("custommodeldata")
|
||||
.setTabCompleter(customModelDataCommand);
|
||||
main.getCommand("custommodeldata").setExecutor(customModelDataCommand);
|
||||
|
||||
main.getCommand("main_gui").setTabCompleter(mainGuiCommand);
|
||||
|
@ -82,5 +100,14 @@ public class CommandManager {
|
|||
|
||||
main.getCommand("itemto64").setTabCompleter(itemTo64Command);
|
||||
main.getCommand("itemto64").setExecutor(itemTo64Command);
|
||||
|
||||
main.getCommand("tutorial").setExecutor(tutorialManagerCommand);
|
||||
main.getCommand("tutorial").setTabCompleter(tutorialManagerCommand);
|
||||
|
||||
main.getCommand("party").setExecutor(partyCommand);
|
||||
main.getCommand("party").setTabCompleter(partyCommand);
|
||||
|
||||
main.getCommand("build").setExecutor(buildCommand);
|
||||
main.getCommand("build").setTabCompleter(buildCommand);
|
||||
}
|
||||
}
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue