From 83bd9dfced97cdc0b4330eb855e26b7205a80600 Mon Sep 17 00:00:00 2001 From: Paldiu Date: Sun, 30 Jan 2022 10:12:31 -0600 Subject: [PATCH] Initial commit --- .gitattributes | 2 + .gitignore | 23 ++++ .idea/.gitignore | 3 + .idea/compiler.xml | 16 +++ .idea/encodings.xml | 7 + .idea/inspectionProfiles/Project_Default.xml | 54 ++++++++ .idea/jarRepositories.xml | 30 +++++ ..._com_google_code_findbugs_jsr305_3_0_2.xml | 13 ++ ...Maven__com_google_code_gson_gson_2_8_8.xml | 13 ++ ...rorprone_error_prone_annotations_2_7_1.xml | 13 ++ ...__com_google_guava_failureaccess_1_0_1.xml | 13 ++ ...ven__com_google_guava_guava_31_0_1_jre.xml | 13 ++ ...9_0_empty_to_avoid_conflict_with_guava.xml | 13 ++ ...m_google_j2objc_j2objc_annotations_1_3.xml | 13 ++ ...oglecode_json_simple_json_simple_1_1_1.xml | 13 ++ .../Maven__commons_lang_commons_lang_2_6.xml | 13 ++ ...c_paper_paper_api_1_18_1_R0_1_SNAPSHOT.xml | 13 ++ .../Maven__it_unimi_dsi_fastutil_8_5_6.xml | 13 ++ .../Maven__net_kyori_adventure_api_4_9_3.xml | 13 ++ .../Maven__net_kyori_adventure_key_4_9_3.xml | 13 ++ ...i_adventure_text_serializer_gson_4_9_3.xml | 13 ++ ...adventure_text_serializer_legacy_4_9_3.xml | 13 ++ ..._adventure_text_serializer_plain_4_9_3.xml | 13 ++ ...Maven__net_kyori_examination_api_1_3_0.xml | 13 ++ ...en__net_kyori_examination_string_1_3_0.xml | 13 ++ ...en__net_md_5_bungeecord_chat_1_16_R0_4.xml | 13 ++ ..._apache_logging_log4j_log4j_api_2_17_1.xml | 13 ++ ...g_checkerframework_checker_qual_3_21_0.xml | 13 ++ ...ven__org_javassist_javassist_3_26_0_GA.xml | 13 ++ ...aven__org_jetbrains_annotations_22_0_0.xml | 13 ++ .../libraries/Maven__org_ow2_asm_asm_9_2.xml | 13 ++ .../Maven__org_ow2_asm_asm_analysis_9_2.xml | 13 ++ .../Maven__org_ow2_asm_asm_commons_9_2.xml | 13 ++ .../Maven__org_ow2_asm_asm_tree_9_2.xml | 13 ++ ...en__org_reflections_reflections_0_9_12.xml | 13 ++ ...Maven__org_slf4j_slf4j_api_1_8_0_beta4.xml | 13 ++ .../Maven__org_yaml_snakeyaml_1_30.xml | 13 ++ .idea/misc.xml | 18 +++ .idea/modules.xml | 8 ++ .idea/uiDesigner.xml | 124 ++++++++++++++++++ README.md | 2 + SimplexCL.iml | 56 ++++++++ pom.xml | 81 ++++++++++++ .../java/io/github/simplex/CommandBase.java | 38 ++++++ .../java/io/github/simplex/CommandLoader.java | 74 +++++++++++ .../java/io/github/simplex/DummyCommand.java | 27 ++++ .../java/io/github/simplex/Permissible.java | 29 ++++ .../java/io/github/simplex/api/ICommand.java | 8 ++ .../simplex/api/annotations/Aliases.java | 12 ++ .../simplex/api/annotations/Description.java | 12 ++ .../github/simplex/api/annotations/Info.java | 17 +++ .../github/simplex/api/annotations/Name.java | 12 ++ .../simplex/api/annotations/Permission.java | 13 ++ .../simplex/api/annotations/SubCommand.java | 11 ++ .../github/simplex/api/annotations/Usage.java | 12 ++ src/main/resources/plugin.yml | 8 ++ 56 files changed, 1087 insertions(+) create mode 100644 .gitattributes create mode 100644 .gitignore create mode 100644 .idea/.gitignore create mode 100644 .idea/compiler.xml create mode 100644 .idea/encodings.xml create mode 100644 .idea/inspectionProfiles/Project_Default.xml create mode 100644 .idea/jarRepositories.xml create mode 100644 .idea/libraries/Maven__com_google_code_findbugs_jsr305_3_0_2.xml create mode 100644 .idea/libraries/Maven__com_google_code_gson_gson_2_8_8.xml create mode 100644 .idea/libraries/Maven__com_google_errorprone_error_prone_annotations_2_7_1.xml create mode 100644 .idea/libraries/Maven__com_google_guava_failureaccess_1_0_1.xml create mode 100644 .idea/libraries/Maven__com_google_guava_guava_31_0_1_jre.xml create mode 100644 .idea/libraries/Maven__com_google_guava_listenablefuture_9999_0_empty_to_avoid_conflict_with_guava.xml create mode 100644 .idea/libraries/Maven__com_google_j2objc_j2objc_annotations_1_3.xml create mode 100644 .idea/libraries/Maven__com_googlecode_json_simple_json_simple_1_1_1.xml create mode 100644 .idea/libraries/Maven__commons_lang_commons_lang_2_6.xml create mode 100644 .idea/libraries/Maven__io_papermc_paper_paper_api_1_18_1_R0_1_SNAPSHOT.xml create mode 100644 .idea/libraries/Maven__it_unimi_dsi_fastutil_8_5_6.xml create mode 100644 .idea/libraries/Maven__net_kyori_adventure_api_4_9_3.xml create mode 100644 .idea/libraries/Maven__net_kyori_adventure_key_4_9_3.xml create mode 100644 .idea/libraries/Maven__net_kyori_adventure_text_serializer_gson_4_9_3.xml create mode 100644 .idea/libraries/Maven__net_kyori_adventure_text_serializer_legacy_4_9_3.xml create mode 100644 .idea/libraries/Maven__net_kyori_adventure_text_serializer_plain_4_9_3.xml create mode 100644 .idea/libraries/Maven__net_kyori_examination_api_1_3_0.xml create mode 100644 .idea/libraries/Maven__net_kyori_examination_string_1_3_0.xml create mode 100644 .idea/libraries/Maven__net_md_5_bungeecord_chat_1_16_R0_4.xml create mode 100644 .idea/libraries/Maven__org_apache_logging_log4j_log4j_api_2_17_1.xml create mode 100644 .idea/libraries/Maven__org_checkerframework_checker_qual_3_21_0.xml create mode 100644 .idea/libraries/Maven__org_javassist_javassist_3_26_0_GA.xml create mode 100644 .idea/libraries/Maven__org_jetbrains_annotations_22_0_0.xml create mode 100644 .idea/libraries/Maven__org_ow2_asm_asm_9_2.xml create mode 100644 .idea/libraries/Maven__org_ow2_asm_asm_analysis_9_2.xml create mode 100644 .idea/libraries/Maven__org_ow2_asm_asm_commons_9_2.xml create mode 100644 .idea/libraries/Maven__org_ow2_asm_asm_tree_9_2.xml create mode 100644 .idea/libraries/Maven__org_reflections_reflections_0_9_12.xml create mode 100644 .idea/libraries/Maven__org_slf4j_slf4j_api_1_8_0_beta4.xml create mode 100644 .idea/libraries/Maven__org_yaml_snakeyaml_1_30.xml create mode 100644 .idea/misc.xml create mode 100644 .idea/modules.xml create mode 100644 .idea/uiDesigner.xml create mode 100644 README.md create mode 100644 SimplexCL.iml create mode 100644 pom.xml create mode 100644 src/main/java/io/github/simplex/CommandBase.java create mode 100644 src/main/java/io/github/simplex/CommandLoader.java create mode 100644 src/main/java/io/github/simplex/DummyCommand.java create mode 100644 src/main/java/io/github/simplex/Permissible.java create mode 100644 src/main/java/io/github/simplex/api/ICommand.java create mode 100644 src/main/java/io/github/simplex/api/annotations/Aliases.java create mode 100644 src/main/java/io/github/simplex/api/annotations/Description.java create mode 100644 src/main/java/io/github/simplex/api/annotations/Info.java create mode 100644 src/main/java/io/github/simplex/api/annotations/Name.java create mode 100644 src/main/java/io/github/simplex/api/annotations/Permission.java create mode 100644 src/main/java/io/github/simplex/api/annotations/SubCommand.java create mode 100644 src/main/java/io/github/simplex/api/annotations/Usage.java create mode 100644 src/main/resources/plugin.yml diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..dfe0770 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,2 @@ +# Auto detect text files and perform LF normalization +* text=auto diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..a1c2a23 --- /dev/null +++ b/.gitignore @@ -0,0 +1,23 @@ +# Compiled class file +*.class + +# Log file +*.log + +# BlueJ files +*.ctxt + +# Mobile Tools for Java (J2ME) +.mtj.tmp/ + +# Package Files # +*.jar +*.war +*.nar +*.ear +*.zip +*.tar.gz +*.rar + +# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml +hs_err_pid* diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..26d3352 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,3 @@ +# Default ignored files +/shelf/ +/workspace.xml diff --git a/.idea/compiler.xml b/.idea/compiler.xml new file mode 100644 index 0000000..9aef4a2 --- /dev/null +++ b/.idea/compiler.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/encodings.xml b/.idea/encodings.xml new file mode 100644 index 0000000..aa00ffa --- /dev/null +++ b/.idea/encodings.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml new file mode 100644 index 0000000..7ae5ed7 --- /dev/null +++ b/.idea/inspectionProfiles/Project_Default.xml @@ -0,0 +1,54 @@ + + + + \ No newline at end of file diff --git a/.idea/jarRepositories.xml b/.idea/jarRepositories.xml new file mode 100644 index 0000000..4f3d965 --- /dev/null +++ b/.idea/jarRepositories.xml @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__com_google_code_findbugs_jsr305_3_0_2.xml b/.idea/libraries/Maven__com_google_code_findbugs_jsr305_3_0_2.xml new file mode 100644 index 0000000..1c380d0 --- /dev/null +++ b/.idea/libraries/Maven__com_google_code_findbugs_jsr305_3_0_2.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__com_google_code_gson_gson_2_8_8.xml b/.idea/libraries/Maven__com_google_code_gson_gson_2_8_8.xml new file mode 100644 index 0000000..1da2fef --- /dev/null +++ b/.idea/libraries/Maven__com_google_code_gson_gson_2_8_8.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__com_google_errorprone_error_prone_annotations_2_7_1.xml b/.idea/libraries/Maven__com_google_errorprone_error_prone_annotations_2_7_1.xml new file mode 100644 index 0000000..3df0929 --- /dev/null +++ b/.idea/libraries/Maven__com_google_errorprone_error_prone_annotations_2_7_1.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__com_google_guava_failureaccess_1_0_1.xml b/.idea/libraries/Maven__com_google_guava_failureaccess_1_0_1.xml new file mode 100644 index 0000000..36e948e --- /dev/null +++ b/.idea/libraries/Maven__com_google_guava_failureaccess_1_0_1.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__com_google_guava_guava_31_0_1_jre.xml b/.idea/libraries/Maven__com_google_guava_guava_31_0_1_jre.xml new file mode 100644 index 0000000..08b28cc --- /dev/null +++ b/.idea/libraries/Maven__com_google_guava_guava_31_0_1_jre.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__com_google_guava_listenablefuture_9999_0_empty_to_avoid_conflict_with_guava.xml b/.idea/libraries/Maven__com_google_guava_listenablefuture_9999_0_empty_to_avoid_conflict_with_guava.xml new file mode 100644 index 0000000..4e15702 --- /dev/null +++ b/.idea/libraries/Maven__com_google_guava_listenablefuture_9999_0_empty_to_avoid_conflict_with_guava.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__com_google_j2objc_j2objc_annotations_1_3.xml b/.idea/libraries/Maven__com_google_j2objc_j2objc_annotations_1_3.xml new file mode 100644 index 0000000..bacaa45 --- /dev/null +++ b/.idea/libraries/Maven__com_google_j2objc_j2objc_annotations_1_3.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__com_googlecode_json_simple_json_simple_1_1_1.xml b/.idea/libraries/Maven__com_googlecode_json_simple_json_simple_1_1_1.xml new file mode 100644 index 0000000..f3f3738 --- /dev/null +++ b/.idea/libraries/Maven__com_googlecode_json_simple_json_simple_1_1_1.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__commons_lang_commons_lang_2_6.xml b/.idea/libraries/Maven__commons_lang_commons_lang_2_6.xml new file mode 100644 index 0000000..2ec8376 --- /dev/null +++ b/.idea/libraries/Maven__commons_lang_commons_lang_2_6.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__io_papermc_paper_paper_api_1_18_1_R0_1_SNAPSHOT.xml b/.idea/libraries/Maven__io_papermc_paper_paper_api_1_18_1_R0_1_SNAPSHOT.xml new file mode 100644 index 0000000..d54b0f8 --- /dev/null +++ b/.idea/libraries/Maven__io_papermc_paper_paper_api_1_18_1_R0_1_SNAPSHOT.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__it_unimi_dsi_fastutil_8_5_6.xml b/.idea/libraries/Maven__it_unimi_dsi_fastutil_8_5_6.xml new file mode 100644 index 0000000..b617b2d --- /dev/null +++ b/.idea/libraries/Maven__it_unimi_dsi_fastutil_8_5_6.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__net_kyori_adventure_api_4_9_3.xml b/.idea/libraries/Maven__net_kyori_adventure_api_4_9_3.xml new file mode 100644 index 0000000..9ae42b2 --- /dev/null +++ b/.idea/libraries/Maven__net_kyori_adventure_api_4_9_3.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__net_kyori_adventure_key_4_9_3.xml b/.idea/libraries/Maven__net_kyori_adventure_key_4_9_3.xml new file mode 100644 index 0000000..4624751 --- /dev/null +++ b/.idea/libraries/Maven__net_kyori_adventure_key_4_9_3.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__net_kyori_adventure_text_serializer_gson_4_9_3.xml b/.idea/libraries/Maven__net_kyori_adventure_text_serializer_gson_4_9_3.xml new file mode 100644 index 0000000..6c700b9 --- /dev/null +++ b/.idea/libraries/Maven__net_kyori_adventure_text_serializer_gson_4_9_3.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__net_kyori_adventure_text_serializer_legacy_4_9_3.xml b/.idea/libraries/Maven__net_kyori_adventure_text_serializer_legacy_4_9_3.xml new file mode 100644 index 0000000..9cf863b --- /dev/null +++ b/.idea/libraries/Maven__net_kyori_adventure_text_serializer_legacy_4_9_3.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__net_kyori_adventure_text_serializer_plain_4_9_3.xml b/.idea/libraries/Maven__net_kyori_adventure_text_serializer_plain_4_9_3.xml new file mode 100644 index 0000000..a32993e --- /dev/null +++ b/.idea/libraries/Maven__net_kyori_adventure_text_serializer_plain_4_9_3.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__net_kyori_examination_api_1_3_0.xml b/.idea/libraries/Maven__net_kyori_examination_api_1_3_0.xml new file mode 100644 index 0000000..5b4190e --- /dev/null +++ b/.idea/libraries/Maven__net_kyori_examination_api_1_3_0.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__net_kyori_examination_string_1_3_0.xml b/.idea/libraries/Maven__net_kyori_examination_string_1_3_0.xml new file mode 100644 index 0000000..7b7a7c3 --- /dev/null +++ b/.idea/libraries/Maven__net_kyori_examination_string_1_3_0.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__net_md_5_bungeecord_chat_1_16_R0_4.xml b/.idea/libraries/Maven__net_md_5_bungeecord_chat_1_16_R0_4.xml new file mode 100644 index 0000000..9a850ea --- /dev/null +++ b/.idea/libraries/Maven__net_md_5_bungeecord_chat_1_16_R0_4.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__org_apache_logging_log4j_log4j_api_2_17_1.xml b/.idea/libraries/Maven__org_apache_logging_log4j_log4j_api_2_17_1.xml new file mode 100644 index 0000000..a54efd2 --- /dev/null +++ b/.idea/libraries/Maven__org_apache_logging_log4j_log4j_api_2_17_1.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__org_checkerframework_checker_qual_3_21_0.xml b/.idea/libraries/Maven__org_checkerframework_checker_qual_3_21_0.xml new file mode 100644 index 0000000..0924f27 --- /dev/null +++ b/.idea/libraries/Maven__org_checkerframework_checker_qual_3_21_0.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__org_javassist_javassist_3_26_0_GA.xml b/.idea/libraries/Maven__org_javassist_javassist_3_26_0_GA.xml new file mode 100644 index 0000000..e150186 --- /dev/null +++ b/.idea/libraries/Maven__org_javassist_javassist_3_26_0_GA.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__org_jetbrains_annotations_22_0_0.xml b/.idea/libraries/Maven__org_jetbrains_annotations_22_0_0.xml new file mode 100644 index 0000000..f350de5 --- /dev/null +++ b/.idea/libraries/Maven__org_jetbrains_annotations_22_0_0.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__org_ow2_asm_asm_9_2.xml b/.idea/libraries/Maven__org_ow2_asm_asm_9_2.xml new file mode 100644 index 0000000..3f9b2da --- /dev/null +++ b/.idea/libraries/Maven__org_ow2_asm_asm_9_2.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__org_ow2_asm_asm_analysis_9_2.xml b/.idea/libraries/Maven__org_ow2_asm_asm_analysis_9_2.xml new file mode 100644 index 0000000..76fdcad --- /dev/null +++ b/.idea/libraries/Maven__org_ow2_asm_asm_analysis_9_2.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__org_ow2_asm_asm_commons_9_2.xml b/.idea/libraries/Maven__org_ow2_asm_asm_commons_9_2.xml new file mode 100644 index 0000000..aeb8863 --- /dev/null +++ b/.idea/libraries/Maven__org_ow2_asm_asm_commons_9_2.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__org_ow2_asm_asm_tree_9_2.xml b/.idea/libraries/Maven__org_ow2_asm_asm_tree_9_2.xml new file mode 100644 index 0000000..b63cc16 --- /dev/null +++ b/.idea/libraries/Maven__org_ow2_asm_asm_tree_9_2.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__org_reflections_reflections_0_9_12.xml b/.idea/libraries/Maven__org_reflections_reflections_0_9_12.xml new file mode 100644 index 0000000..bedc96e --- /dev/null +++ b/.idea/libraries/Maven__org_reflections_reflections_0_9_12.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__org_slf4j_slf4j_api_1_8_0_beta4.xml b/.idea/libraries/Maven__org_slf4j_slf4j_api_1_8_0_beta4.xml new file mode 100644 index 0000000..ed4f3f6 --- /dev/null +++ b/.idea/libraries/Maven__org_slf4j_slf4j_api_1_8_0_beta4.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__org_yaml_snakeyaml_1_30.xml b/.idea/libraries/Maven__org_yaml_snakeyaml_1_30.xml new file mode 100644 index 0000000..7eda891 --- /dev/null +++ b/.idea/libraries/Maven__org_yaml_snakeyaml_1_30.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..f8e9e22 --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..0496a72 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/uiDesigner.xml b/.idea/uiDesigner.xml new file mode 100644 index 0000000..e96534f --- /dev/null +++ b/.idea/uiDesigner.xml @@ -0,0 +1,124 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..61e2256 --- /dev/null +++ b/README.md @@ -0,0 +1,2 @@ +# SimplexCL + diff --git a/SimplexCL.iml b/SimplexCL.iml new file mode 100644 index 0000000..c993f78 --- /dev/null +++ b/SimplexCL.iml @@ -0,0 +1,56 @@ + + + + + + + PAPER + ADVENTURE + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..d44802e --- /dev/null +++ b/pom.xml @@ -0,0 +1,81 @@ + + + 4.0.0 + + io.github.simplex + SimplexCL + 1.0-SNAPSHOT + jar + + SimplexCL + + A Command Loader for Paper + + 1.17 + UTF-8 + + https://simplexdev.app + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.8.1 + + ${java.version} + ${java.version} + + + + org.apache.maven.plugins + maven-shade-plugin + 3.2.4 + + + package + + shade + + + false + + + + + + + + src/main/resources + true + + + + + + + papermc-repo + https://papermc.io/repo/repository/maven-public/ + + + sonatype + https://oss.sonatype.org/content/groups/public/ + + + + + + io.papermc.paper + paper-api + 1.18.1-R0.1-SNAPSHOT + provided + + + org.reflections + reflections + 0.9.12 + + + diff --git a/src/main/java/io/github/simplex/CommandBase.java b/src/main/java/io/github/simplex/CommandBase.java new file mode 100644 index 0000000..8db7615 --- /dev/null +++ b/src/main/java/io/github/simplex/CommandBase.java @@ -0,0 +1,38 @@ +package io.github.simplex; + +import io.github.simplex.api.ICommand; +import io.github.simplex.api.annotations.Permission; +import net.kyori.adventure.text.Component; +import net.kyori.adventure.text.format.TextColor; +import net.kyori.adventure.util.RGBLike; +import org.bukkit.command.Command; +import org.bukkit.command.CommandSender; +import org.bukkit.command.defaults.BukkitCommand; +import org.bukkit.plugin.Plugin; +import org.jetbrains.annotations.NotNull; + +public abstract class CommandBase extends Permissible implements ICommand { + private final Plugin plugin; + + public CommandBase(Plugin plugin, String permission, String permissionMessage) { + super(permission, permissionMessage); + this.plugin = plugin; + } + + public CommandBase(Plugin plugin, String permission) { + this(plugin, permission, "You do not have permission to use this command."); + } + + @Override + public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String lbl, String[] args) { + if (!hasPermission(sender)) { + sender.sendMessage(Component + .empty() + .content(getPermissionMessage()) + .color(TextColor.color(255, 3, 62))); + return true; + } + execute(); + return true; + } +} diff --git a/src/main/java/io/github/simplex/CommandLoader.java b/src/main/java/io/github/simplex/CommandLoader.java new file mode 100644 index 0000000..866ff60 --- /dev/null +++ b/src/main/java/io/github/simplex/CommandLoader.java @@ -0,0 +1,74 @@ +package io.github.simplex; + +import io.github.simplex.api.annotations.*; +import org.bukkit.Bukkit; +import org.bukkit.command.CommandMap; +import org.bukkit.plugin.Plugin; +import org.reflections.Reflections; + +import java.lang.annotation.AnnotationTypeMismatchException; +import java.lang.reflect.Field; +import java.lang.reflect.InvocationTargetException; +import java.util.Arrays; +import java.util.Set; + +public class CommandLoader { + private final Plugin plugin; + + public CommandLoader(Plugin plugin) { + this.plugin = plugin; + } + + public Plugin getPlugin() { + return plugin; + } + + public void registerCommands(Class target) { + Reflections reflections = new Reflections(target); + if (target.getDeclaredAnnotation(Info.class) != null) { + Set> classSet = reflections.getTypesAnnotatedWith(Info.class); + classSet.forEach(cmd -> { + Info info = cmd.getDeclaredAnnotation(Info.class); + try { + CommandBase base = (CommandBase) cmd.getConstructor(Plugin.class, String.class, String.class).newInstance(plugin, info.permission(), info.permissionMessage()); + DummyCommand dummy = new DummyCommand(base, info.name(), info.description(), info.usage(), Arrays.asList(info.aliases().split(","))); + Field f = Bukkit.getServer().getClass().getDeclaredField("commandMap"); + f.setAccessible(true); + CommandMap commandMap = (CommandMap) f.get(Bukkit.getServer()); + commandMap.register(info.name(), dummy); + } catch (NoSuchMethodException + | InvocationTargetException + | IllegalAccessException + | InstantiationException + | NoSuchFieldException e) { + plugin.getLogger().severe(e.getMessage() + "\n\n\n" + e.getCause()); + } + }); + } else if (target.getDeclaredAnnotation(Name.class) != null) { + Set> classSet = reflections.getTypesAnnotatedWith(Name.class); + classSet.forEach(cmd -> { + Name name = cmd.getDeclaredAnnotation(Name.class); + Description description = cmd.getDeclaredAnnotation(Description.class); + Usage usage = cmd.getDeclaredAnnotation(Usage.class); + Aliases aliases = cmd.getDeclaredAnnotation(Aliases.class); + Permission permission = cmd.getDeclaredAnnotation(Permission.class); + try { + CommandBase base = (CommandBase) cmd.getConstructor(Plugin.class, String.class, String.class).newInstance(plugin, permission.permission(), permission.permissionMessage()); + DummyCommand dummy = new DummyCommand(base, name.name(), description.description(), usage.usage(), Arrays.asList(aliases.aliases().split(","))); + Field f = Bukkit.getServer().getClass().getDeclaredField("commandMap"); + f.setAccessible(true); + CommandMap commandMap = (CommandMap) f.get(Bukkit.getServer()); + commandMap.register(name.name(), dummy); + } catch (NoSuchMethodException + | InvocationTargetException + | IllegalAccessException + | InstantiationException + | NoSuchFieldException e) { + plugin.getLogger().severe(e.getMessage() + "\n\n\n" + e.getCause()); + } + }); + } else { + throw new RuntimeException("Missing a required annotation! Unable to load the command."); + } + } +} diff --git a/src/main/java/io/github/simplex/DummyCommand.java b/src/main/java/io/github/simplex/DummyCommand.java new file mode 100644 index 0000000..a754043 --- /dev/null +++ b/src/main/java/io/github/simplex/DummyCommand.java @@ -0,0 +1,27 @@ +package io.github.simplex; + +import org.bukkit.command.CommandSender; +import org.bukkit.command.defaults.BukkitCommand; +import org.jetbrains.annotations.NotNull; + +import java.util.List; + +public class DummyCommand extends BukkitCommand { + private final CommandBase base; + + protected DummyCommand(@NotNull CommandBase base, @NotNull String name, @NotNull String description, @NotNull String usageMessage, @NotNull List aliases) { + super(name, description, usageMessage, aliases); + this.setName(name); + this.setDescription(description); + this.setUsage(usageMessage); + this.setAliases(aliases); + this.setPermission(base.getPermission()); + this.base = base; + } + + @Override + public boolean execute(@NotNull CommandSender sender, @NotNull String commandLabel, @NotNull String[] args) { + base.onCommand(sender, this, commandLabel, args); + return true; + } +} diff --git a/src/main/java/io/github/simplex/Permissible.java b/src/main/java/io/github/simplex/Permissible.java new file mode 100644 index 0000000..4a1e41f --- /dev/null +++ b/src/main/java/io/github/simplex/Permissible.java @@ -0,0 +1,29 @@ +package io.github.simplex; + +import org.bukkit.command.CommandSender; + +public abstract class Permissible { + private final String permission; + private final String permissionMessage; + + public Permissible(String permission, String permissionMessage) { + this.permission = permission; + this.permissionMessage = permissionMessage; + } + + public Permissible(String permission) { + this(permission, "You do not have permission to use this command."); + } + + public String getPermission() { + return permission; + } + + public String getPermissionMessage() { + return permissionMessage; + } + + public boolean hasPermission(CommandSender sender) { + return sender.hasPermission(getPermission()); + } +} diff --git a/src/main/java/io/github/simplex/api/ICommand.java b/src/main/java/io/github/simplex/api/ICommand.java new file mode 100644 index 0000000..fe54d09 --- /dev/null +++ b/src/main/java/io/github/simplex/api/ICommand.java @@ -0,0 +1,8 @@ +package io.github.simplex.api; + +import org.bukkit.command.CommandExecutor; +import org.bukkit.command.TabCompleter; + +public interface ICommand extends CommandExecutor, TabCompleter { + boolean execute(); +} diff --git a/src/main/java/io/github/simplex/api/annotations/Aliases.java b/src/main/java/io/github/simplex/api/annotations/Aliases.java new file mode 100644 index 0000000..12a9edd --- /dev/null +++ b/src/main/java/io/github/simplex/api/annotations/Aliases.java @@ -0,0 +1,12 @@ +package io.github.simplex.api.annotations; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +@Target(ElementType.TYPE) +@Retention(RetentionPolicy.RUNTIME) +public @interface Aliases { + String aliases(); +} diff --git a/src/main/java/io/github/simplex/api/annotations/Description.java b/src/main/java/io/github/simplex/api/annotations/Description.java new file mode 100644 index 0000000..3d59d28 --- /dev/null +++ b/src/main/java/io/github/simplex/api/annotations/Description.java @@ -0,0 +1,12 @@ +package io.github.simplex.api.annotations; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +@Target(ElementType.TYPE) +@Retention(RetentionPolicy.RUNTIME) +public @interface Description { + String description(); +} diff --git a/src/main/java/io/github/simplex/api/annotations/Info.java b/src/main/java/io/github/simplex/api/annotations/Info.java new file mode 100644 index 0000000..8d413d2 --- /dev/null +++ b/src/main/java/io/github/simplex/api/annotations/Info.java @@ -0,0 +1,17 @@ +package io.github.simplex.api.annotations; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +@Target(ElementType.TYPE) +@Retention(RetentionPolicy.RUNTIME) +public @interface Info { + String name(); + String description(); + String usage(); + String permission(); + String aliases() default ""; + String permissionMessage() default "You do not have permission to use this command."; +} diff --git a/src/main/java/io/github/simplex/api/annotations/Name.java b/src/main/java/io/github/simplex/api/annotations/Name.java new file mode 100644 index 0000000..99bbcbf --- /dev/null +++ b/src/main/java/io/github/simplex/api/annotations/Name.java @@ -0,0 +1,12 @@ +package io.github.simplex.api.annotations; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +@Target(ElementType.TYPE) +@Retention(RetentionPolicy.RUNTIME) +public @interface Name { + String name(); +} diff --git a/src/main/java/io/github/simplex/api/annotations/Permission.java b/src/main/java/io/github/simplex/api/annotations/Permission.java new file mode 100644 index 0000000..ff88016 --- /dev/null +++ b/src/main/java/io/github/simplex/api/annotations/Permission.java @@ -0,0 +1,13 @@ +package io.github.simplex.api.annotations; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +@Target({ElementType.METHOD, ElementType.TYPE}) +@Retention(RetentionPolicy.RUNTIME) +public @interface Permission { + String permission(); + String permissionMessage() default "You do not have permission to use this command!"; +} diff --git a/src/main/java/io/github/simplex/api/annotations/SubCommand.java b/src/main/java/io/github/simplex/api/annotations/SubCommand.java new file mode 100644 index 0000000..0b9367c --- /dev/null +++ b/src/main/java/io/github/simplex/api/annotations/SubCommand.java @@ -0,0 +1,11 @@ +package io.github.simplex.api.annotations; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +@Target(ElementType.METHOD) +@Retention(RetentionPolicy.RUNTIME) +public @interface SubCommand { +} diff --git a/src/main/java/io/github/simplex/api/annotations/Usage.java b/src/main/java/io/github/simplex/api/annotations/Usage.java new file mode 100644 index 0000000..68d0dce --- /dev/null +++ b/src/main/java/io/github/simplex/api/annotations/Usage.java @@ -0,0 +1,12 @@ +package io.github.simplex.api.annotations; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +@Target(ElementType.TYPE) +@Retention(RetentionPolicy.RUNTIME) +public @interface Usage { + String usage(); +} diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml new file mode 100644 index 0000000..f09dcc2 --- /dev/null +++ b/src/main/resources/plugin.yml @@ -0,0 +1,8 @@ +name: SimplexCL +version: '${project.version}' +main: io.github.simplex.SimplexCL +api-version: 1.18 +prefix: CommandLoader +authors: [ SimplexDevelopment ] +description: A Command Loader for Paper +website: https://simplexdev.app