From 5bb57c865e01828d963045c3bbabd5e281cffd9f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjam=C3=ADn=20Isasmendi=20C=2E?= Date: Mon, 29 Dec 2025 08:52:48 -0300 Subject: [PATCH 01/14] init refactor --- .gitignore | 180 +------------ README.md | 2 - adapt/api/pom.xml | 23 -- .../easyjoin/adapt/ActionbarSender.java | 10 - .../me/espryth/easyjoin/adapt/BookSender.java | 10 - .../espryth/easyjoin/adapt/TitleSender.java | 9 - adapt/legacy/pom.xml | 32 --- adapt/legacy/v1_10_R1/pom.xml | 22 -- .../v1_10_R1/ActionbarSender1_10_R1.java | 14 - .../legacy/v1_10_R1/AdapterModule1_10_R1.java | 17 -- .../legacy/v1_10_R1/BookSender1_10_R1.java | 22 -- .../adapt/legacy/v1_10_R1/Packets.java | 15 -- .../legacy/v1_10_R1/TitleSender1_10_R1.java | 26 -- adapt/legacy/v1_11_R1/pom.xml | 22 -- .../v1_11_R1/ActionbarSender1_11_R1.java | 14 - .../legacy/v1_11_R1/AdapterModule1_11_R1.java | 18 -- .../legacy/v1_11_R1/BookSender1_11_R1.java | 23 -- .../legacy/v1_11_R1/TitleSender1_11_R1.java | 12 - adapt/legacy/v1_12_R1/pom.xml | 22 -- .../v1_12_R1/ActionbarSender1_12_R1.java | 14 - .../legacy/v1_12_R1/AdapterModule1_12_R1.java | 18 -- .../legacy/v1_12_R1/BookSender1_12_R1.java | 23 -- .../legacy/v1_12_R1/TitleSender1_12_R1.java | 12 - adapt/legacy/v1_8_R3/pom.xml | 22 -- .../legacy/v1_8_R3/ActionbarSender1_8_R3.java | 16 -- .../legacy/v1_8_R3/AdapterModule1_8_R3.java | 17 -- .../legacy/v1_8_R3/BookSender1_8_R3.java | 23 -- .../adapt/legacy/v1_8_R3/Packets.java | 17 -- .../legacy/v1_8_R3/TitleSender1_8_R3.java | 27 -- adapt/legacy/v1_9_R2/pom.xml | 22 -- .../legacy/v1_9_R2/ActionbarSender1_9_R2.java | 14 - .../legacy/v1_9_R2/AdapterModule1_9_R2.java | 17 -- .../legacy/v1_9_R2/BookSender1_9_R2.java | 22 -- .../adapt/legacy/v1_9_R2/Packets.java | 15 -- .../legacy/v1_9_R2/TitleSender1_9_R2.java | 26 -- adapt/newer/pom.xml | 28 -- .../adapt/newer/NewerActionbarSender.java | 15 -- .../adapt/newer/NewerAdapterModule.java | 18 -- .../easyjoin/adapt/newer/NewerBookSender.java | 14 - .../adapt/newer/NewerTitleSender.java | 13 - adapt/pom.xml | 21 -- build.gradle.kts | 70 +++++ gradle/wrapper/gradle-wrapper.jar | Bin 0 -> 45457 bytes gradle/wrapper/gradle-wrapper.properties | 7 + gradlew | 251 ++++++++++++++++++ gradlew.bat | 94 +++++++ plugin/dependency-reduced-pom.xml | 50 ---- plugin/pom.xml | 98 ------- .../me/espryth/easyjoin/plugin/EasyJoin.java | 65 ----- .../plugin/action/AbstractAction.java | 17 -- .../easyjoin/plugin/action/Action.java | 23 -- .../action/ActionExecutionException.java | 9 - .../easyjoin/plugin/action/ActionQueue.java | 57 ---- .../easyjoin/plugin/action/ActionType.java | 7 - .../plugin/action/impl/ActionbarAction.java | 32 --- .../plugin/action/impl/BookAction.java | 54 ---- .../plugin/action/impl/BroadcastAction.java | 23 -- .../action/impl/BroadcastActionbarAction.java | 35 --- .../plugin/action/impl/BroadcastSound.java | 17 -- .../plugin/action/impl/BroadcastTitle.java | 34 --- .../plugin/action/impl/ClearChatAction.java | 14 - .../action/impl/ConsoleCommandAction.java | 15 -- .../plugin/action/impl/DelayAction.java | 35 --- .../plugin/action/impl/FireworkAction.java | 88 ------ .../action/impl/JsonBroadcastAction.java | 28 -- .../plugin/action/impl/JsonMessageAction.java | 28 -- .../plugin/action/impl/MessageAction.java | 22 -- .../action/impl/PlayerCommandAction.java | 14 - .../plugin/action/impl/SoundAction.java | 16 -- .../plugin/action/impl/TitleAction.java | 33 --- .../easyjoin/plugin/command/MainCommand.java | 55 ---- .../easyjoin/plugin/database/SQLSource.java | 34 --- .../plugin/event/PlayerFirstJoinEvent.java | 25 -- .../plugin/event/PlayerLoginEvent.java | 26 -- .../plugin/event/PlayerRegisterEvent.java | 26 -- .../easyjoin/plugin/format/Format.java | 65 ----- .../plugin/format/FormatExecutor.java | 36 --- .../format/firstjoin/FirstJoinChecker.java | 9 - .../format/firstjoin/SQLFirstJoinChecker.java | 67 ----- .../firstjoin/VanillaFirstJoinChecker.java | 12 - .../easyjoin/plugin/hook/AuthMeHook.java | 23 -- .../plugin/hook/PlaceholderAPIHook.java | 93 ------- .../easyjoin/plugin/hook/nLoginHook.java | 24 -- .../listeners/PlayerFirstJoinListener.java | 51 ---- .../plugin/listeners/PlayerJoinListener.java | 55 ---- .../plugin/listeners/PlayerQuitListener.java | 44 --- .../listeners/authme/PlayerLoginListener.java | 41 --- .../authme/PlayerRegisterListener.java | 41 --- .../easyjoin/plugin/loader/FormatLoader.java | 84 ------ .../plugin/loader/ListenerLoader.java | 52 ---- .../easyjoin/plugin/loader/Loader.java | 5 - .../easyjoin/plugin/module/ActionModule.java | 30 --- .../plugin/module/AdapterModuleFactory.java | 41 --- .../plugin/module/FirstJoinCheckerModule.java | 34 --- .../easyjoin/plugin/module/MainModule.java | 36 --- .../easyjoin/plugin/utils/Actionbar.java | 40 --- .../plugin/utils/RepeatingAction.java | 52 ---- .../plugin/utils/ServerVersionProvider.java | 17 -- .../espryth/easyjoin/plugin/utils/Sound.java | 49 ---- .../espryth/easyjoin/plugin/utils/Title.java | 67 ----- .../easyjoin/plugin/utils/YamlFile.java | 72 ----- plugin/src/main/resources/book.yml | 0 plugin/src/main/resources/config.yml | 56 ---- plugin/src/main/resources/credentials.yml | 5 - plugin/src/main/resources/plugin.yml | 12 - pom.xml | 70 ----- settings.gradle.kts | 1 + .../me/espryth/easyjoin/EasyJoinPlugin.java | 28 ++ .../me/espryth/easyjoin/action/Action.java | 7 + .../espryth/easyjoin/action/ActionQueue.java | 40 +++ .../espryth/easyjoin/command/MainCommand.java | 42 +++ .../me/espryth/easyjoin/config/AppConfig.java | 28 ++ .../easyjoin/config/CredentialsConfig.java | 16 ++ .../me/espryth/easyjoin/format/Format.java | 14 + .../easyjoin/listener/AuthMeListener.java | 38 +++ .../easyjoin/listener/NLoginListener.java | 47 ++++ .../easyjoin/listener/PlayerListener.java | 59 ++++ .../easyjoin/service/ActionService.java | 226 ++++++++++++++++ .../easyjoin/service/FirstJoinService.java | 91 +++++++ .../easyjoin/service/FormatService.java | 69 +++++ .../me/espryth/easyjoin/util/AvatarUtils.java | 40 +++ .../easyjoin/util}/DefaultFontInfo.java | 6 +- .../espryth/easyjoin/util}/MessageUtils.java | 75 +++--- src/main/resources/config.yml | 25 ++ src/main/resources/credentials.yml | 6 + src/main/resources/paper-plugin.yml | 6 + src/main/resources/plugin.yml | 6 + 127 files changed, 1250 insertions(+), 3212 deletions(-) delete mode 100644 README.md delete mode 100644 adapt/api/pom.xml delete mode 100644 adapt/api/src/main/java/me/espryth/easyjoin/adapt/ActionbarSender.java delete mode 100644 adapt/api/src/main/java/me/espryth/easyjoin/adapt/BookSender.java delete mode 100644 adapt/api/src/main/java/me/espryth/easyjoin/adapt/TitleSender.java delete mode 100644 adapt/legacy/pom.xml delete mode 100644 adapt/legacy/v1_10_R1/pom.xml delete mode 100644 adapt/legacy/v1_10_R1/src/main/java/me/espryth/easyjoin/adapt/legacy/v1_10_R1/ActionbarSender1_10_R1.java delete mode 100644 adapt/legacy/v1_10_R1/src/main/java/me/espryth/easyjoin/adapt/legacy/v1_10_R1/AdapterModule1_10_R1.java delete mode 100644 adapt/legacy/v1_10_R1/src/main/java/me/espryth/easyjoin/adapt/legacy/v1_10_R1/BookSender1_10_R1.java delete mode 100644 adapt/legacy/v1_10_R1/src/main/java/me/espryth/easyjoin/adapt/legacy/v1_10_R1/Packets.java delete mode 100644 adapt/legacy/v1_10_R1/src/main/java/me/espryth/easyjoin/adapt/legacy/v1_10_R1/TitleSender1_10_R1.java delete mode 100644 adapt/legacy/v1_11_R1/pom.xml delete mode 100644 adapt/legacy/v1_11_R1/src/main/java/me/espryth/easyjoin/adapt/legacy/v1_11_R1/ActionbarSender1_11_R1.java delete mode 100644 adapt/legacy/v1_11_R1/src/main/java/me/espryth/easyjoin/adapt/legacy/v1_11_R1/AdapterModule1_11_R1.java delete mode 100644 adapt/legacy/v1_11_R1/src/main/java/me/espryth/easyjoin/adapt/legacy/v1_11_R1/BookSender1_11_R1.java delete mode 100644 adapt/legacy/v1_11_R1/src/main/java/me/espryth/easyjoin/adapt/legacy/v1_11_R1/TitleSender1_11_R1.java delete mode 100644 adapt/legacy/v1_12_R1/pom.xml delete mode 100644 adapt/legacy/v1_12_R1/src/main/java/me/espryth/easyjoin/adapt/legacy/v1_12_R1/ActionbarSender1_12_R1.java delete mode 100644 adapt/legacy/v1_12_R1/src/main/java/me/espryth/easyjoin/adapt/legacy/v1_12_R1/AdapterModule1_12_R1.java delete mode 100644 adapt/legacy/v1_12_R1/src/main/java/me/espryth/easyjoin/adapt/legacy/v1_12_R1/BookSender1_12_R1.java delete mode 100644 adapt/legacy/v1_12_R1/src/main/java/me/espryth/easyjoin/adapt/legacy/v1_12_R1/TitleSender1_12_R1.java delete mode 100644 adapt/legacy/v1_8_R3/pom.xml delete mode 100644 adapt/legacy/v1_8_R3/src/main/java/me/espryth/easyjoin/adapt/legacy/v1_8_R3/ActionbarSender1_8_R3.java delete mode 100644 adapt/legacy/v1_8_R3/src/main/java/me/espryth/easyjoin/adapt/legacy/v1_8_R3/AdapterModule1_8_R3.java delete mode 100644 adapt/legacy/v1_8_R3/src/main/java/me/espryth/easyjoin/adapt/legacy/v1_8_R3/BookSender1_8_R3.java delete mode 100644 adapt/legacy/v1_8_R3/src/main/java/me/espryth/easyjoin/adapt/legacy/v1_8_R3/Packets.java delete mode 100644 adapt/legacy/v1_8_R3/src/main/java/me/espryth/easyjoin/adapt/legacy/v1_8_R3/TitleSender1_8_R3.java delete mode 100644 adapt/legacy/v1_9_R2/pom.xml delete mode 100644 adapt/legacy/v1_9_R2/src/main/java/me/espryth/easyjoin/adapt/legacy/v1_9_R2/ActionbarSender1_9_R2.java delete mode 100644 adapt/legacy/v1_9_R2/src/main/java/me/espryth/easyjoin/adapt/legacy/v1_9_R2/AdapterModule1_9_R2.java delete mode 100644 adapt/legacy/v1_9_R2/src/main/java/me/espryth/easyjoin/adapt/legacy/v1_9_R2/BookSender1_9_R2.java delete mode 100644 adapt/legacy/v1_9_R2/src/main/java/me/espryth/easyjoin/adapt/legacy/v1_9_R2/Packets.java delete mode 100644 adapt/legacy/v1_9_R2/src/main/java/me/espryth/easyjoin/adapt/legacy/v1_9_R2/TitleSender1_9_R2.java delete mode 100644 adapt/newer/pom.xml delete mode 100644 adapt/newer/src/main/java/me/espryth/easyjoin/adapt/newer/NewerActionbarSender.java delete mode 100644 adapt/newer/src/main/java/me/espryth/easyjoin/adapt/newer/NewerAdapterModule.java delete mode 100644 adapt/newer/src/main/java/me/espryth/easyjoin/adapt/newer/NewerBookSender.java delete mode 100644 adapt/newer/src/main/java/me/espryth/easyjoin/adapt/newer/NewerTitleSender.java delete mode 100644 adapt/pom.xml create mode 100644 build.gradle.kts create mode 100644 gradle/wrapper/gradle-wrapper.jar create mode 100644 gradle/wrapper/gradle-wrapper.properties create mode 100644 gradlew create mode 100644 gradlew.bat delete mode 100644 plugin/dependency-reduced-pom.xml delete mode 100644 plugin/pom.xml delete mode 100644 plugin/src/main/java/me/espryth/easyjoin/plugin/EasyJoin.java delete mode 100644 plugin/src/main/java/me/espryth/easyjoin/plugin/action/AbstractAction.java delete mode 100644 plugin/src/main/java/me/espryth/easyjoin/plugin/action/Action.java delete mode 100644 plugin/src/main/java/me/espryth/easyjoin/plugin/action/ActionExecutionException.java delete mode 100644 plugin/src/main/java/me/espryth/easyjoin/plugin/action/ActionQueue.java delete mode 100644 plugin/src/main/java/me/espryth/easyjoin/plugin/action/ActionType.java delete mode 100644 plugin/src/main/java/me/espryth/easyjoin/plugin/action/impl/ActionbarAction.java delete mode 100644 plugin/src/main/java/me/espryth/easyjoin/plugin/action/impl/BookAction.java delete mode 100644 plugin/src/main/java/me/espryth/easyjoin/plugin/action/impl/BroadcastAction.java delete mode 100644 plugin/src/main/java/me/espryth/easyjoin/plugin/action/impl/BroadcastActionbarAction.java delete mode 100644 plugin/src/main/java/me/espryth/easyjoin/plugin/action/impl/BroadcastSound.java delete mode 100644 plugin/src/main/java/me/espryth/easyjoin/plugin/action/impl/BroadcastTitle.java delete mode 100644 plugin/src/main/java/me/espryth/easyjoin/plugin/action/impl/ClearChatAction.java delete mode 100644 plugin/src/main/java/me/espryth/easyjoin/plugin/action/impl/ConsoleCommandAction.java delete mode 100644 plugin/src/main/java/me/espryth/easyjoin/plugin/action/impl/DelayAction.java delete mode 100644 plugin/src/main/java/me/espryth/easyjoin/plugin/action/impl/FireworkAction.java delete mode 100644 plugin/src/main/java/me/espryth/easyjoin/plugin/action/impl/JsonBroadcastAction.java delete mode 100644 plugin/src/main/java/me/espryth/easyjoin/plugin/action/impl/JsonMessageAction.java delete mode 100644 plugin/src/main/java/me/espryth/easyjoin/plugin/action/impl/MessageAction.java delete mode 100644 plugin/src/main/java/me/espryth/easyjoin/plugin/action/impl/PlayerCommandAction.java delete mode 100644 plugin/src/main/java/me/espryth/easyjoin/plugin/action/impl/SoundAction.java delete mode 100644 plugin/src/main/java/me/espryth/easyjoin/plugin/action/impl/TitleAction.java delete mode 100644 plugin/src/main/java/me/espryth/easyjoin/plugin/command/MainCommand.java delete mode 100644 plugin/src/main/java/me/espryth/easyjoin/plugin/database/SQLSource.java delete mode 100644 plugin/src/main/java/me/espryth/easyjoin/plugin/event/PlayerFirstJoinEvent.java delete mode 100644 plugin/src/main/java/me/espryth/easyjoin/plugin/event/PlayerLoginEvent.java delete mode 100644 plugin/src/main/java/me/espryth/easyjoin/plugin/event/PlayerRegisterEvent.java delete mode 100644 plugin/src/main/java/me/espryth/easyjoin/plugin/format/Format.java delete mode 100644 plugin/src/main/java/me/espryth/easyjoin/plugin/format/FormatExecutor.java delete mode 100644 plugin/src/main/java/me/espryth/easyjoin/plugin/format/firstjoin/FirstJoinChecker.java delete mode 100644 plugin/src/main/java/me/espryth/easyjoin/plugin/format/firstjoin/SQLFirstJoinChecker.java delete mode 100644 plugin/src/main/java/me/espryth/easyjoin/plugin/format/firstjoin/VanillaFirstJoinChecker.java delete mode 100644 plugin/src/main/java/me/espryth/easyjoin/plugin/hook/AuthMeHook.java delete mode 100644 plugin/src/main/java/me/espryth/easyjoin/plugin/hook/PlaceholderAPIHook.java delete mode 100644 plugin/src/main/java/me/espryth/easyjoin/plugin/hook/nLoginHook.java delete mode 100644 plugin/src/main/java/me/espryth/easyjoin/plugin/listeners/PlayerFirstJoinListener.java delete mode 100644 plugin/src/main/java/me/espryth/easyjoin/plugin/listeners/PlayerJoinListener.java delete mode 100644 plugin/src/main/java/me/espryth/easyjoin/plugin/listeners/PlayerQuitListener.java delete mode 100644 plugin/src/main/java/me/espryth/easyjoin/plugin/listeners/authme/PlayerLoginListener.java delete mode 100644 plugin/src/main/java/me/espryth/easyjoin/plugin/listeners/authme/PlayerRegisterListener.java delete mode 100644 plugin/src/main/java/me/espryth/easyjoin/plugin/loader/FormatLoader.java delete mode 100644 plugin/src/main/java/me/espryth/easyjoin/plugin/loader/ListenerLoader.java delete mode 100644 plugin/src/main/java/me/espryth/easyjoin/plugin/loader/Loader.java delete mode 100644 plugin/src/main/java/me/espryth/easyjoin/plugin/module/ActionModule.java delete mode 100644 plugin/src/main/java/me/espryth/easyjoin/plugin/module/AdapterModuleFactory.java delete mode 100644 plugin/src/main/java/me/espryth/easyjoin/plugin/module/FirstJoinCheckerModule.java delete mode 100644 plugin/src/main/java/me/espryth/easyjoin/plugin/module/MainModule.java delete mode 100644 plugin/src/main/java/me/espryth/easyjoin/plugin/utils/Actionbar.java delete mode 100644 plugin/src/main/java/me/espryth/easyjoin/plugin/utils/RepeatingAction.java delete mode 100644 plugin/src/main/java/me/espryth/easyjoin/plugin/utils/ServerVersionProvider.java delete mode 100644 plugin/src/main/java/me/espryth/easyjoin/plugin/utils/Sound.java delete mode 100644 plugin/src/main/java/me/espryth/easyjoin/plugin/utils/Title.java delete mode 100644 plugin/src/main/java/me/espryth/easyjoin/plugin/utils/YamlFile.java delete mode 100644 plugin/src/main/resources/book.yml delete mode 100644 plugin/src/main/resources/config.yml delete mode 100644 plugin/src/main/resources/credentials.yml delete mode 100644 plugin/src/main/resources/plugin.yml delete mode 100644 pom.xml create mode 100644 settings.gradle.kts create mode 100644 src/main/java/me/espryth/easyjoin/EasyJoinPlugin.java create mode 100644 src/main/java/me/espryth/easyjoin/action/Action.java create mode 100644 src/main/java/me/espryth/easyjoin/action/ActionQueue.java create mode 100644 src/main/java/me/espryth/easyjoin/command/MainCommand.java create mode 100644 src/main/java/me/espryth/easyjoin/config/AppConfig.java create mode 100644 src/main/java/me/espryth/easyjoin/config/CredentialsConfig.java create mode 100644 src/main/java/me/espryth/easyjoin/format/Format.java create mode 100644 src/main/java/me/espryth/easyjoin/listener/AuthMeListener.java create mode 100644 src/main/java/me/espryth/easyjoin/listener/NLoginListener.java create mode 100644 src/main/java/me/espryth/easyjoin/listener/PlayerListener.java create mode 100644 src/main/java/me/espryth/easyjoin/service/ActionService.java create mode 100644 src/main/java/me/espryth/easyjoin/service/FirstJoinService.java create mode 100644 src/main/java/me/espryth/easyjoin/service/FormatService.java create mode 100644 src/main/java/me/espryth/easyjoin/util/AvatarUtils.java rename {plugin/src/main/java/me/espryth/easyjoin/plugin/utils => src/main/java/me/espryth/easyjoin/util}/DefaultFontInfo.java (96%) rename {plugin/src/main/java/me/espryth/easyjoin/plugin/utils => src/main/java/me/espryth/easyjoin/util}/MessageUtils.java (50%) create mode 100644 src/main/resources/config.yml create mode 100644 src/main/resources/credentials.yml create mode 100644 src/main/resources/paper-plugin.yml create mode 100644 src/main/resources/plugin.yml diff --git a/.gitignore b/.gitignore index a19fef3..dcbbbee 100644 --- a/.gitignore +++ b/.gitignore @@ -1,177 +1,3 @@ - -.idea/aws.xml -.idea/codeStyles/codeStyleConfig.xml -.idea/codeStyles/Project.xml -.idea/compiler.xml -.idea/encodings.xml -.idea/jarRepositories.xml -.idea/misc.xml -.idea/uiDesigner.xml -EasyJoin.iml -.idea/workspace.xml -.idea/modules.xml -.idea/libraries/Maven__org_yaml_snakeyaml_1_28.xml -.idea/libraries/Maven__org_xerial_sqlite_jdbc_3_36_0_3.xml -.idea/libraries/Maven__org_spigotmc_spigot_api_1_18_R0_1_SNAPSHOT.xml -.idea/libraries/Maven__org_spigotmc_spigot_1_9_4_R0_1_SNAPSHOT.xml -.idea/libraries/Maven__org_spigotmc_spigot_1_8_8_R0_1_SNAPSHOT.xml -.idea/libraries/Maven__org_spigotmc_spigot_1_18_R0_1_SNAPSHOT.xml -.idea/libraries/Maven__org_spigotmc_spigot_1_16_5_R0_1_SNAPSHOT.xml -.idea/libraries/Maven__org_spigotmc_spigot_1_12_2_R0_1_SNAPSHOT.xml -.idea/libraries/Maven__org_spigotmc_spigot_1_11_R0_1_SNAPSHOT.xml -.idea/libraries/Maven__org_spigotmc_spigot_1_10_2_R0_1_SNAPSHOT.xml -.idea/libraries/Maven__org_slf4j_slf4j_api_1_8_0_beta4.xml -.idea/libraries/Maven__org_slf4j_jcl_over_slf4j_1_7_30.xml -.idea/libraries/Maven__org_ow2_asm_asm_9_2.xml -.idea/libraries/Maven__org_jetbrains_annotations_19_0_0.xml -.idea/libraries/Maven__org_hamcrest_hamcrest_core_1_1.xml -.idea/libraries/Maven__org_eclipse_sisu_org_eclipse_sisu_inject_0_3_4.xml -.idea/libraries/Maven__org_codehaus_plexus_plexus_utils_3_2_1.xml -.idea/libraries/Maven__org_codehaus_plexus_plexus_interpolation_1_25.xml -.idea/libraries/Maven__org_checkerframework_checker_qual_3_12_0.xml -.idea/libraries/Maven__org_apache_maven_resolver_maven_resolver_util_1_6_2.xml -.idea/libraries/Maven__org_apache_maven_resolver_maven_resolver_transport_http_1_7_0.xml -.idea/libraries/Maven__org_apache_maven_resolver_maven_resolver_spi_1_6_2.xml -.idea/libraries/Maven__org_apache_maven_resolver_maven_resolver_impl_1_6_2.xml -.idea/libraries/Maven__org_apache_maven_resolver_maven_resolver_connector_basic_1_7_0.xml -.idea/libraries/Maven__org_apache_maven_resolver_maven_resolver_api_1_6_2.xml -.idea/libraries/Maven__org_apache_maven_maven_resolver_provider_3_8_1.xml -.idea/libraries/Maven__org_apache_maven_maven_repository_metadata_3_8_1.xml -.idea/libraries/Maven__org_apache_maven_maven_model_builder_3_8_1.xml -.idea/libraries/Maven__org_apache_maven_maven_model_3_8_1.xml -.idea/libraries/Maven__org_apache_maven_maven_builder_support_3_8_1.xml -.idea/libraries/Maven__org_apache_maven_maven_artifact_3_8_1.xml -.idea/libraries/Maven__org_apache_logging_log4j_log4j_slf4j18_impl_2_14_1.xml -.idea/libraries/Maven__org_apache_logging_log4j_log4j_iostreams_2_14_1.xml -.idea/libraries/Maven__org_apache_logging_log4j_log4j_core_2_14_1.xml -.idea/libraries/Maven__org_apache_logging_log4j_log4j_api_2_14_1.xml -.idea/libraries/Maven__org_apache_httpcomponents_httpcore_4_4_14.xml -.idea/libraries/Maven__org_apache_httpcomponents_httpclient_4_5_13.xml -.idea/libraries/Maven__org_apache_commons_commons_lang3_3_12_0.xml -.idea/libraries/Maven__net_sf_jopt_simple_jopt_simple_5_0_4.xml -.idea/libraries/Maven__net_md_5_bungeecord_chat_1_16_R0_4.xml -.idea/libraries/Maven__net_java_dev_jna_jna_platform_5_9_0.xml -.idea/libraries/Maven__net_java_dev_jna_jna_5_9_0.xml -.idea/libraries/Maven__mysql_mysql_connector_java_8_0_27.xml -.idea/libraries/Maven__me_clip_placeholderapi_2_10_9.xml -.idea/libraries/Maven__junit_junit_4_10.xml -.idea/libraries/Maven__jline_jline_2_12_1.xml -.idea/libraries/Maven__javax_inject_javax_inject_1.xml -.idea/libraries/Maven__it_unimi_dsi_fastutil_8_5_6.xml -.idea/libraries/Maven__io_netty_netty_all_4_1_68_Final.xml -.idea/libraries/Maven__fr_xephi_authme_5_6_0_SNAPSHOT.xml -.idea/libraries/Maven__dev_henko_storance_0_1_1_SNAPSHOT.xml -.idea/libraries/Maven__commons_lang_commons_lang_2_6.xml -.idea/libraries/Maven__commons_io_commons_io_2_11_0.xml -.idea/libraries/Maven__commons_codec_commons_codec_1_11.xml -.idea/libraries/Maven__com_mojang_javabridge_1_2_24.xml -.idea/libraries/Maven__com_mojang_datafixerupper_4_0_26.xml -.idea/libraries/Maven__com_mojang_brigadier_1_0_18.xml -.idea/libraries/Maven__com_mojang_authlib_3_2_38.xml -.idea/libraries/Maven__com_googlecode_json_simple_json_simple_1_1_1.xml -.idea/libraries/Maven__com_google_protobuf_protobuf_java_3_11_4.xml -.idea/libraries/Maven__com_google_j2objc_j2objc_annotations_1_3.xml -.idea/libraries/Maven__com_google_guava_listenablefuture_9999_0_empty_to_avoid_conflict_with_guava.xml -.idea/libraries/Maven__com_google_guava_guava_31_0_1_jre.xml -.idea/libraries/Maven__com_google_guava_failureaccess_1_0_1.xml -.idea/libraries/Maven__com_google_errorprone_error_prone_annotations_2_7_1.xml -.idea/libraries/Maven__com_google_code_gson_gson_2_8_8.xml -.idea/libraries/Maven__com_google_code_findbugs_jsr305_3_0_2.xml -.idea/libraries/Maven__com_github_oshi_oshi_core_5_8_2.xml -.idea/discord.xml -.idea/libraries/Maven__com_zaxxer_HikariCP_4_0_3.xml -.idea/libraries/Maven__org_slf4j_slf4j_api_2_0_0_alpha1.xml -plugin/easyjoin-plugin.iml -easyjoin-parent.iml -adapt/newer/easyjoin-adapt-newer.iml -adapt/legacy/v1_9_R2/easyjoin-adapt-legacy-v1_9_R2.iml -adapt/legacy/v1_8_R3/easyjoin-adapt-legacy-v1_8_R3.iml -adapt/legacy/v1_12_R1/easyjoin-adapt-legacy-v1_12_R1.iml -adapt/legacy/v1_11_R1/easyjoin-adapt-legacy-v1_11_R1.iml -adapt/legacy/v1_10_R1/easyjoin-adapt-legacy-v1_10_R1.iml -adapt/legacy/easyjoin-adapt-legacy.iml -adapt/easyjoin-adapt.iml -adapt/api/easyjoin-adapt-api.iml -.idea/vcs.xml -adapt/target/easyjoin-adapt-2.2.2-shaded.pom -adapt/newer/target/original-easyjoin-adapt-newer-2.2.2.jar -adapt/newer/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst -adapt/newer/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst -adapt/newer/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst -adapt/newer/target/maven-archiver/pom.properties -adapt/newer/target/easyjoin-adapt-newer-2.2.2.jar -adapt/newer/target/classes/me/espryth/easyjoin/adapt/newer/NewerTitleSender.class -adapt/newer/target/classes/me/espryth/easyjoin/adapt/newer/NewerBookSender.class -adapt/newer/target/classes/me/espryth/easyjoin/adapt/newer/NewerAdapterModule.class -adapt/newer/target/classes/me/espryth/easyjoin/adapt/newer/NewerActionbarSender.class -adapt/newer/dependency-reduced-pom.xml -adapt/legacy/v1_9_R2/target/original-easyjoin-adapt-legacy-v1_9_R2-2.2.2.jar -adapt/legacy/v1_9_R2/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst -adapt/legacy/v1_9_R2/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst -adapt/legacy/v1_9_R2/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst -adapt/legacy/v1_9_R2/target/maven-archiver/pom.properties -adapt/legacy/v1_9_R2/target/easyjoin-adapt-legacy-v1_9_R2-2.2.2.jar -adapt/legacy/v1_9_R2/target/classes/me/espryth/easyjoin/adapt/legacy/v1_9_R2/TitleSender1_9_R2.class -adapt/legacy/v1_9_R2/target/classes/me/espryth/easyjoin/adapt/legacy/v1_9_R2/Packets.class -adapt/legacy/v1_9_R2/target/classes/me/espryth/easyjoin/adapt/legacy/v1_9_R2/BookSender1_9_R2.class -adapt/legacy/v1_9_R2/target/classes/me/espryth/easyjoin/adapt/legacy/v1_9_R2/AdapterModule1_9_R2.class -adapt/legacy/v1_9_R2/target/classes/me/espryth/easyjoin/adapt/legacy/v1_9_R2/ActionbarSender1_9_R2.class -adapt/legacy/v1_9_R2/dependency-reduced-pom.xml -adapt/legacy/v1_8_R3/target/original-easyjoin-adapt-legacy-v1_8_R3-2.2.2.jar -adapt/legacy/v1_8_R3/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst -adapt/legacy/v1_8_R3/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst -adapt/legacy/v1_8_R3/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst -adapt/legacy/v1_8_R3/target/maven-archiver/pom.properties -adapt/legacy/v1_8_R3/target/easyjoin-adapt-legacy-v1_8_R3-2.2.2.jar -adapt/legacy/v1_8_R3/target/classes/me/espryth/easyjoin/adapt/legacy/v1_8_R3/TitleSender1_8_R3.class -adapt/legacy/v1_8_R3/target/classes/me/espryth/easyjoin/adapt/legacy/v1_8_R3/Packets.class -adapt/legacy/v1_8_R3/target/classes/me/espryth/easyjoin/adapt/legacy/v1_8_R3/BookSender1_8_R3.class -adapt/legacy/v1_8_R3/target/classes/me/espryth/easyjoin/adapt/legacy/v1_8_R3/AdapterModule1_8_R3.class -adapt/legacy/v1_8_R3/target/classes/me/espryth/easyjoin/adapt/legacy/v1_8_R3/ActionbarSender1_8_R3.class -adapt/legacy/v1_8_R3/dependency-reduced-pom.xml -adapt/legacy/v1_12_R1/target/original-easyjoin-adapt-legacy-v1_12_R1-2.2.2.jar -adapt/legacy/v1_12_R1/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst -adapt/legacy/v1_12_R1/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst -adapt/legacy/v1_12_R1/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst -adapt/legacy/v1_12_R1/target/maven-archiver/pom.properties -adapt/legacy/v1_12_R1/target/easyjoin-adapt-legacy-v1_12_R1-2.2.2.jar -adapt/legacy/v1_12_R1/target/classes/me/espryth/easyjoin/adapt/legacy/v1_12_R1/TitleSender1_12_R1.class -adapt/legacy/v1_12_R1/target/classes/me/espryth/easyjoin/adapt/legacy/v1_12_R1/BookSender1_12_R1.class -adapt/legacy/v1_12_R1/target/classes/me/espryth/easyjoin/adapt/legacy/v1_12_R1/AdapterModule1_12_R1.class -adapt/legacy/v1_12_R1/target/classes/me/espryth/easyjoin/adapt/legacy/v1_12_R1/ActionbarSender1_12_R1.class -adapt/legacy/v1_12_R1/dependency-reduced-pom.xml -adapt/legacy/v1_11_R1/target/original-easyjoin-adapt-legacy-v1_11_R1-2.2.2.jar -adapt/legacy/v1_11_R1/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst -adapt/legacy/v1_11_R1/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst -adapt/legacy/v1_11_R1/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst -adapt/legacy/v1_11_R1/target/maven-archiver/pom.properties -adapt/legacy/v1_11_R1/target/easyjoin-adapt-legacy-v1_11_R1-2.2.2.jar -adapt/legacy/v1_11_R1/target/classes/me/espryth/easyjoin/adapt/legacy/v1_11_R1/TitleSender1_11_R1.class -adapt/legacy/v1_11_R1/target/classes/me/espryth/easyjoin/adapt/legacy/v1_11_R1/BookSender1_11_R1.class -adapt/legacy/v1_11_R1/target/classes/me/espryth/easyjoin/adapt/legacy/v1_11_R1/AdapterModule1_11_R1.class -adapt/legacy/v1_11_R1/target/classes/me/espryth/easyjoin/adapt/legacy/v1_11_R1/ActionbarSender1_11_R1.class -adapt/legacy/v1_11_R1/dependency-reduced-pom.xml -adapt/legacy/v1_10_R1/target/original-easyjoin-adapt-legacy-v1_10_R1-2.2.2.jar -adapt/legacy/v1_10_R1/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst -adapt/legacy/v1_10_R1/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst -adapt/legacy/v1_10_R1/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst -adapt/legacy/v1_10_R1/target/maven-archiver/pom.properties -adapt/legacy/v1_10_R1/target/easyjoin-adapt-legacy-v1_10_R1-2.2.2.jar -adapt/legacy/v1_10_R1/target/classes/me/espryth/easyjoin/adapt/legacy/v1_10_R1/TitleSender1_10_R1.class -adapt/legacy/v1_10_R1/target/classes/me/espryth/easyjoin/adapt/legacy/v1_10_R1/Packets.class -adapt/legacy/v1_10_R1/target/classes/me/espryth/easyjoin/adapt/legacy/v1_10_R1/BookSender1_10_R1.class -adapt/legacy/v1_10_R1/target/classes/me/espryth/easyjoin/adapt/legacy/v1_10_R1/AdapterModule1_10_R1.class -adapt/legacy/v1_10_R1/target/classes/me/espryth/easyjoin/adapt/legacy/v1_10_R1/ActionbarSender1_10_R1.class -adapt/legacy/v1_10_R1/dependency-reduced-pom.xml -adapt/legacy/target/easyjoin-adapt-legacy-2.2.2-shaded.pom -adapt/api/target/original-easyjoin-adapt-api-2.2.2.jar -adapt/api/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst -adapt/api/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst -adapt/api/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst -adapt/api/target/maven-archiver/pom.properties -adapt/api/target/easyjoin-adapt-api-2.2.2.jar -adapt/api/target/classes/me/espryth/easyjoin/adapt/TitleSender.class -adapt/api/target/classes/me/espryth/easyjoin/adapt/BookSender.class -adapt/api/target/classes/me/espryth/easyjoin/adapt/ActionbarSender.class -adapt/api/dependency-reduced-pom.xml -.idea/libraries/Maven__com_nickuc_login_nlogin_api_10_0.xml +build/ +.gradle/ +.idea/ diff --git a/README.md b/README.md deleted file mode 100644 index 0e18f41..0000000 --- a/README.md +++ /dev/null @@ -1,2 +0,0 @@ -# EasyJoin - diff --git a/adapt/api/pom.xml b/adapt/api/pom.xml deleted file mode 100644 index 1a194cf..0000000 --- a/adapt/api/pom.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - me.espryth.easyjoin - easyjoin-adapt - 2.2.2 - - 4.0.0 - - easyjoin-adapt-api - - - - org.spigotmc - spigot - 1.16.5-R0.1-SNAPSHOT - provided - - - - \ No newline at end of file diff --git a/adapt/api/src/main/java/me/espryth/easyjoin/adapt/ActionbarSender.java b/adapt/api/src/main/java/me/espryth/easyjoin/adapt/ActionbarSender.java deleted file mode 100644 index aabcfde..0000000 --- a/adapt/api/src/main/java/me/espryth/easyjoin/adapt/ActionbarSender.java +++ /dev/null @@ -1,10 +0,0 @@ - -package me.espryth.easyjoin.adapt; - -import org.bukkit.entity.Player; - -public interface ActionbarSender { - - void send(Player player, String message); - -} diff --git a/adapt/api/src/main/java/me/espryth/easyjoin/adapt/BookSender.java b/adapt/api/src/main/java/me/espryth/easyjoin/adapt/BookSender.java deleted file mode 100644 index ddee85f..0000000 --- a/adapt/api/src/main/java/me/espryth/easyjoin/adapt/BookSender.java +++ /dev/null @@ -1,10 +0,0 @@ -package me.espryth.easyjoin.adapt; - -import org.bukkit.entity.Player; -import org.bukkit.inventory.ItemStack; - -public interface BookSender { - - void send(Player player, ItemStack book); - -} diff --git a/adapt/api/src/main/java/me/espryth/easyjoin/adapt/TitleSender.java b/adapt/api/src/main/java/me/espryth/easyjoin/adapt/TitleSender.java deleted file mode 100644 index 802bd99..0000000 --- a/adapt/api/src/main/java/me/espryth/easyjoin/adapt/TitleSender.java +++ /dev/null @@ -1,9 +0,0 @@ -package me.espryth.easyjoin.adapt; - -import org.bukkit.entity.Player; - -public interface TitleSender { - - void send(Player player, String title, String subTitle, int fadeIn, int fadeShow, int fadeOut); - -} diff --git a/adapt/legacy/pom.xml b/adapt/legacy/pom.xml deleted file mode 100644 index 0c93235..0000000 --- a/adapt/legacy/pom.xml +++ /dev/null @@ -1,32 +0,0 @@ - - - - me.espryth.easyjoin - easyjoin-adapt - 2.2.2 - - 4.0.0 - - easyjoin-adapt-legacy - pom - - - v1_8_R3 - v1_9_R2 - v1_10_R1 - v1_11_R1 - v1_12_R1 - - - - - me.espryth.easyjoin - easyjoin-adapt-api - ${project.version} - provided - - - - \ No newline at end of file diff --git a/adapt/legacy/v1_10_R1/pom.xml b/adapt/legacy/v1_10_R1/pom.xml deleted file mode 100644 index 98975be..0000000 --- a/adapt/legacy/v1_10_R1/pom.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - - me.espryth.easyjoin - easyjoin-adapt-legacy - 2.2.2 - - 4.0.0 - - easyjoin-adapt-legacy-v1_10_R1 - - - - org.spigotmc - spigot - 1.10.2-R0.1-SNAPSHOT - provided - - - \ No newline at end of file diff --git a/adapt/legacy/v1_10_R1/src/main/java/me/espryth/easyjoin/adapt/legacy/v1_10_R1/ActionbarSender1_10_R1.java b/adapt/legacy/v1_10_R1/src/main/java/me/espryth/easyjoin/adapt/legacy/v1_10_R1/ActionbarSender1_10_R1.java deleted file mode 100644 index 2e32bd5..0000000 --- a/adapt/legacy/v1_10_R1/src/main/java/me/espryth/easyjoin/adapt/legacy/v1_10_R1/ActionbarSender1_10_R1.java +++ /dev/null @@ -1,14 +0,0 @@ -package me.espryth.easyjoin.adapt.legacy.v1_10_R1; - -import me.espryth.easyjoin.adapt.ActionbarSender; -import net.md_5.bungee.api.ChatMessageType; -import net.md_5.bungee.api.chat.TextComponent; -import org.bukkit.entity.Player; - -public class ActionbarSender1_10_R1 - implements ActionbarSender { - @Override - public void send(Player player, String message) { - player.spigot().sendMessage(ChatMessageType.ACTION_BAR, TextComponent.fromLegacyText(message)); - } -} diff --git a/adapt/legacy/v1_10_R1/src/main/java/me/espryth/easyjoin/adapt/legacy/v1_10_R1/AdapterModule1_10_R1.java b/adapt/legacy/v1_10_R1/src/main/java/me/espryth/easyjoin/adapt/legacy/v1_10_R1/AdapterModule1_10_R1.java deleted file mode 100644 index b52c38a..0000000 --- a/adapt/legacy/v1_10_R1/src/main/java/me/espryth/easyjoin/adapt/legacy/v1_10_R1/AdapterModule1_10_R1.java +++ /dev/null @@ -1,17 +0,0 @@ -package me.espryth.easyjoin.adapt.legacy.v1_10_R1; - -import dev.henko.storance.Binder; -import dev.henko.storance.StoranceModule; -import me.espryth.easyjoin.adapt.ActionbarSender; -import me.espryth.easyjoin.adapt.BookSender; -import me.espryth.easyjoin.adapt.TitleSender; - -public class AdapterModule1_10_R1 - implements StoranceModule { - @Override - public void configure(Binder binder) { - binder.bind(ActionbarSender.class).toInstance(new ActionbarSender1_10_R1()); - binder.bind(BookSender.class).toInstance(new BookSender1_10_R1()); - binder.bind(TitleSender.class).toInstance(new TitleSender1_10_R1()); - } -} diff --git a/adapt/legacy/v1_10_R1/src/main/java/me/espryth/easyjoin/adapt/legacy/v1_10_R1/BookSender1_10_R1.java b/adapt/legacy/v1_10_R1/src/main/java/me/espryth/easyjoin/adapt/legacy/v1_10_R1/BookSender1_10_R1.java deleted file mode 100644 index bbdd9ad..0000000 --- a/adapt/legacy/v1_10_R1/src/main/java/me/espryth/easyjoin/adapt/legacy/v1_10_R1/BookSender1_10_R1.java +++ /dev/null @@ -1,22 +0,0 @@ -package me.espryth.easyjoin.adapt.legacy.v1_10_R1; - -import io.netty.buffer.Unpooled; -import me.espryth.easyjoin.adapt.BookSender; -import net.minecraft.server.v1_10_R1.PacketDataSerializer; -import net.minecraft.server.v1_10_R1.PacketPlayOutCustomPayload; -import org.bukkit.entity.Player; -import org.bukkit.inventory.ItemStack; - -public class BookSender1_10_R1 - implements BookSender { - @Override - public void send(Player player, ItemStack book) { - ItemStack itemInHand = player.getInventory().getItemInMainHand(); - player.getInventory().setItemInMainHand(book); - Packets.send(player, - new PacketPlayOutCustomPayload("MC|BOpen", - new PacketDataSerializer(Unpooled.buffer())) - ); - player.getInventory().setItemInMainHand(itemInHand); - } -} diff --git a/adapt/legacy/v1_10_R1/src/main/java/me/espryth/easyjoin/adapt/legacy/v1_10_R1/Packets.java b/adapt/legacy/v1_10_R1/src/main/java/me/espryth/easyjoin/adapt/legacy/v1_10_R1/Packets.java deleted file mode 100644 index d2d44b4..0000000 --- a/adapt/legacy/v1_10_R1/src/main/java/me/espryth/easyjoin/adapt/legacy/v1_10_R1/Packets.java +++ /dev/null @@ -1,15 +0,0 @@ -package me.espryth.easyjoin.adapt.legacy.v1_10_R1; - -import net.minecraft.server.v1_10_R1.Packet; -import net.minecraft.server.v1_10_R1.PlayerConnection; -import org.bukkit.craftbukkit.v1_10_R1.entity.CraftPlayer; -import org.bukkit.entity.Player; - -public class Packets { - public static void send(Player player, Packet... packets) { - PlayerConnection connection = ((CraftPlayer) player).getHandle().playerConnection; - for (Packet packet : packets) { - connection.sendPacket(packet); - } - } -} diff --git a/adapt/legacy/v1_10_R1/src/main/java/me/espryth/easyjoin/adapt/legacy/v1_10_R1/TitleSender1_10_R1.java b/adapt/legacy/v1_10_R1/src/main/java/me/espryth/easyjoin/adapt/legacy/v1_10_R1/TitleSender1_10_R1.java deleted file mode 100644 index bcf6397..0000000 --- a/adapt/legacy/v1_10_R1/src/main/java/me/espryth/easyjoin/adapt/legacy/v1_10_R1/TitleSender1_10_R1.java +++ /dev/null @@ -1,26 +0,0 @@ -package me.espryth.easyjoin.adapt.legacy.v1_10_R1; - -import me.espryth.easyjoin.adapt.TitleSender; -import net.minecraft.server.v1_10_R1.IChatBaseComponent; -import net.minecraft.server.v1_10_R1.PacketPlayOutTitle; -import org.bukkit.entity.Player; - -public class TitleSender1_10_R1 - implements TitleSender { - @Override - public void send(Player player, String title, String subTitle, int fadeIn, int fadeShow, int fadeOut) { - Packets.send( - player, - new PacketPlayOutTitle( - PacketPlayOutTitle.EnumTitleAction.TITLE, - IChatBaseComponent.ChatSerializer.a("{\"text\": \"" + title + "\"}"), - fadeIn, fadeShow, fadeOut - ), - new PacketPlayOutTitle( - PacketPlayOutTitle.EnumTitleAction.SUBTITLE, - IChatBaseComponent.ChatSerializer.a("{\"text\": \"" + subTitle + "\"}"), - fadeIn, fadeShow, fadeOut - ) - ); - } -} diff --git a/adapt/legacy/v1_11_R1/pom.xml b/adapt/legacy/v1_11_R1/pom.xml deleted file mode 100644 index dffd967..0000000 --- a/adapt/legacy/v1_11_R1/pom.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - - me.espryth.easyjoin - easyjoin-adapt-legacy - 2.2.2 - - 4.0.0 - - easyjoin-adapt-legacy-v1_11_R1 - - - - org.spigotmc - spigot - 1.11-R0.1-SNAPSHOT - provided - - - \ No newline at end of file diff --git a/adapt/legacy/v1_11_R1/src/main/java/me/espryth/easyjoin/adapt/legacy/v1_11_R1/ActionbarSender1_11_R1.java b/adapt/legacy/v1_11_R1/src/main/java/me/espryth/easyjoin/adapt/legacy/v1_11_R1/ActionbarSender1_11_R1.java deleted file mode 100644 index 9d7be67..0000000 --- a/adapt/legacy/v1_11_R1/src/main/java/me/espryth/easyjoin/adapt/legacy/v1_11_R1/ActionbarSender1_11_R1.java +++ /dev/null @@ -1,14 +0,0 @@ -package me.espryth.easyjoin.adapt.legacy.v1_11_R1; - -import me.espryth.easyjoin.adapt.ActionbarSender; -import net.md_5.bungee.api.ChatMessageType; -import net.md_5.bungee.api.chat.TextComponent; -import org.bukkit.entity.Player; - -public class ActionbarSender1_11_R1 - implements ActionbarSender { - @Override - public void send(Player player, String message) { - player.spigot().sendMessage(ChatMessageType.ACTION_BAR, TextComponent.fromLegacyText(message)); - } -} diff --git a/adapt/legacy/v1_11_R1/src/main/java/me/espryth/easyjoin/adapt/legacy/v1_11_R1/AdapterModule1_11_R1.java b/adapt/legacy/v1_11_R1/src/main/java/me/espryth/easyjoin/adapt/legacy/v1_11_R1/AdapterModule1_11_R1.java deleted file mode 100644 index 9685db9..0000000 --- a/adapt/legacy/v1_11_R1/src/main/java/me/espryth/easyjoin/adapt/legacy/v1_11_R1/AdapterModule1_11_R1.java +++ /dev/null @@ -1,18 +0,0 @@ -package me.espryth.easyjoin.adapt.legacy.v1_11_R1; - -import dev.henko.storance.Binder; -import dev.henko.storance.StoranceModule; -import me.espryth.easyjoin.adapt.ActionbarSender; -import me.espryth.easyjoin.adapt.BookSender; -import me.espryth.easyjoin.adapt.TitleSender; - -public class AdapterModule1_11_R1 - implements StoranceModule { - - @Override - public void configure(Binder binder) { - binder.bind(ActionbarSender.class).toInstance(new ActionbarSender1_11_R1()); - binder.bind(BookSender.class).toInstance(new BookSender1_11_R1()); - binder.bind(TitleSender.class).toInstance(new TitleSender1_11_R1()); - } -} diff --git a/adapt/legacy/v1_11_R1/src/main/java/me/espryth/easyjoin/adapt/legacy/v1_11_R1/BookSender1_11_R1.java b/adapt/legacy/v1_11_R1/src/main/java/me/espryth/easyjoin/adapt/legacy/v1_11_R1/BookSender1_11_R1.java deleted file mode 100644 index b1f91f9..0000000 --- a/adapt/legacy/v1_11_R1/src/main/java/me/espryth/easyjoin/adapt/legacy/v1_11_R1/BookSender1_11_R1.java +++ /dev/null @@ -1,23 +0,0 @@ -package me.espryth.easyjoin.adapt.legacy.v1_11_R1; - -import io.netty.buffer.Unpooled; -import me.espryth.easyjoin.adapt.BookSender; -import net.minecraft.server.v1_11_R1.PacketDataSerializer; -import net.minecraft.server.v1_11_R1.PacketPlayOutCustomPayload; -import org.bukkit.craftbukkit.v1_11_R1.entity.CraftPlayer; -import org.bukkit.entity.Player; -import org.bukkit.inventory.ItemStack; - -public class BookSender1_11_R1 - implements BookSender { - @Override - public void send(Player player, ItemStack book) { - ItemStack itemInHand = player.getInventory().getItemInMainHand(); - player.getInventory().setItemInMainHand(book); - ((CraftPlayer)player).getHandle().playerConnection.sendPacket( - new PacketPlayOutCustomPayload("MC|BOpen", - new PacketDataSerializer(Unpooled.buffer())) - ); - player.getInventory().setItemInMainHand(itemInHand); - } -} diff --git a/adapt/legacy/v1_11_R1/src/main/java/me/espryth/easyjoin/adapt/legacy/v1_11_R1/TitleSender1_11_R1.java b/adapt/legacy/v1_11_R1/src/main/java/me/espryth/easyjoin/adapt/legacy/v1_11_R1/TitleSender1_11_R1.java deleted file mode 100644 index 6b17b63..0000000 --- a/adapt/legacy/v1_11_R1/src/main/java/me/espryth/easyjoin/adapt/legacy/v1_11_R1/TitleSender1_11_R1.java +++ /dev/null @@ -1,12 +0,0 @@ -package me.espryth.easyjoin.adapt.legacy.v1_11_R1; - -import me.espryth.easyjoin.adapt.TitleSender; -import org.bukkit.entity.Player; - -public class TitleSender1_11_R1 - implements TitleSender { - @Override - public void send(Player player, String title, String subTitle, int fadeIn, int fadeShow, int fadeOut) { - player.sendTitle(title, subTitle, fadeIn, fadeShow, fadeOut); - } -} diff --git a/adapt/legacy/v1_12_R1/pom.xml b/adapt/legacy/v1_12_R1/pom.xml deleted file mode 100644 index 43abe81..0000000 --- a/adapt/legacy/v1_12_R1/pom.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - - me.espryth.easyjoin - easyjoin-adapt-legacy - 2.2.2 - - 4.0.0 - - easyjoin-adapt-legacy-v1_12_R1 - - - - org.spigotmc - spigot - 1.12.2-R0.1-SNAPSHOT - provided - - - \ No newline at end of file diff --git a/adapt/legacy/v1_12_R1/src/main/java/me/espryth/easyjoin/adapt/legacy/v1_12_R1/ActionbarSender1_12_R1.java b/adapt/legacy/v1_12_R1/src/main/java/me/espryth/easyjoin/adapt/legacy/v1_12_R1/ActionbarSender1_12_R1.java deleted file mode 100644 index 877f7c4..0000000 --- a/adapt/legacy/v1_12_R1/src/main/java/me/espryth/easyjoin/adapt/legacy/v1_12_R1/ActionbarSender1_12_R1.java +++ /dev/null @@ -1,14 +0,0 @@ -package me.espryth.easyjoin.adapt.legacy.v1_12_R1; - -import me.espryth.easyjoin.adapt.ActionbarSender; -import net.md_5.bungee.api.ChatMessageType; -import net.md_5.bungee.api.chat.TextComponent; -import org.bukkit.entity.Player; - -public class ActionbarSender1_12_R1 - implements ActionbarSender { - @Override - public void send(Player player, String message) { - player.spigot().sendMessage(ChatMessageType.ACTION_BAR, TextComponent.fromLegacyText(message)); - } -} diff --git a/adapt/legacy/v1_12_R1/src/main/java/me/espryth/easyjoin/adapt/legacy/v1_12_R1/AdapterModule1_12_R1.java b/adapt/legacy/v1_12_R1/src/main/java/me/espryth/easyjoin/adapt/legacy/v1_12_R1/AdapterModule1_12_R1.java deleted file mode 100644 index 89ece71..0000000 --- a/adapt/legacy/v1_12_R1/src/main/java/me/espryth/easyjoin/adapt/legacy/v1_12_R1/AdapterModule1_12_R1.java +++ /dev/null @@ -1,18 +0,0 @@ -package me.espryth.easyjoin.adapt.legacy.v1_12_R1; - -import dev.henko.storance.Binder; -import dev.henko.storance.StoranceModule; -import me.espryth.easyjoin.adapt.ActionbarSender; -import me.espryth.easyjoin.adapt.BookSender; -import me.espryth.easyjoin.adapt.TitleSender; - -public class AdapterModule1_12_R1 - implements StoranceModule { - - @Override - public void configure(Binder binder) { - binder.bind(ActionbarSender.class).toInstance(new ActionbarSender1_12_R1()); - binder.bind(BookSender.class).toInstance(new BookSender1_12_R1()); - binder.bind(TitleSender.class).toInstance(new TitleSender1_12_R1()); - } -} diff --git a/adapt/legacy/v1_12_R1/src/main/java/me/espryth/easyjoin/adapt/legacy/v1_12_R1/BookSender1_12_R1.java b/adapt/legacy/v1_12_R1/src/main/java/me/espryth/easyjoin/adapt/legacy/v1_12_R1/BookSender1_12_R1.java deleted file mode 100644 index b61365a..0000000 --- a/adapt/legacy/v1_12_R1/src/main/java/me/espryth/easyjoin/adapt/legacy/v1_12_R1/BookSender1_12_R1.java +++ /dev/null @@ -1,23 +0,0 @@ -package me.espryth.easyjoin.adapt.legacy.v1_12_R1; - -import io.netty.buffer.Unpooled; -import me.espryth.easyjoin.adapt.BookSender; -import net.minecraft.server.v1_12_R1.PacketDataSerializer; -import net.minecraft.server.v1_12_R1.PacketPlayOutCustomPayload; -import org.bukkit.craftbukkit.v1_12_R1.entity.CraftPlayer; -import org.bukkit.entity.Player; -import org.bukkit.inventory.ItemStack; - -public class BookSender1_12_R1 - implements BookSender { - @Override - public void send(Player player, ItemStack book) { - ItemStack itemInHand = player.getInventory().getItemInMainHand(); - player.getInventory().setItemInMainHand(book); - ((CraftPlayer)player).getHandle().playerConnection.sendPacket( - new PacketPlayOutCustomPayload("MC|BOpen", - new PacketDataSerializer(Unpooled.buffer())) - ); - player.getInventory().setItemInMainHand(itemInHand); - } -} diff --git a/adapt/legacy/v1_12_R1/src/main/java/me/espryth/easyjoin/adapt/legacy/v1_12_R1/TitleSender1_12_R1.java b/adapt/legacy/v1_12_R1/src/main/java/me/espryth/easyjoin/adapt/legacy/v1_12_R1/TitleSender1_12_R1.java deleted file mode 100644 index 42b674f..0000000 --- a/adapt/legacy/v1_12_R1/src/main/java/me/espryth/easyjoin/adapt/legacy/v1_12_R1/TitleSender1_12_R1.java +++ /dev/null @@ -1,12 +0,0 @@ -package me.espryth.easyjoin.adapt.legacy.v1_12_R1; - -import me.espryth.easyjoin.adapt.TitleSender; -import org.bukkit.entity.Player; - -public class TitleSender1_12_R1 - implements TitleSender { - @Override - public void send(Player player, String title, String subTitle, int fadeIn, int fadeShow, int fadeOut) { - player.sendTitle(title, subTitle, fadeIn, fadeShow, fadeOut); - } -} diff --git a/adapt/legacy/v1_8_R3/pom.xml b/adapt/legacy/v1_8_R3/pom.xml deleted file mode 100644 index a966cee..0000000 --- a/adapt/legacy/v1_8_R3/pom.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - - me.espryth.easyjoin - easyjoin-adapt-legacy - 2.2.2 - - 4.0.0 - - easyjoin-adapt-legacy-v1_8_R3 - - - - org.spigotmc - spigot - 1.8.8-R0.1-SNAPSHOT - provided - - - \ No newline at end of file diff --git a/adapt/legacy/v1_8_R3/src/main/java/me/espryth/easyjoin/adapt/legacy/v1_8_R3/ActionbarSender1_8_R3.java b/adapt/legacy/v1_8_R3/src/main/java/me/espryth/easyjoin/adapt/legacy/v1_8_R3/ActionbarSender1_8_R3.java deleted file mode 100644 index fdb04d5..0000000 --- a/adapt/legacy/v1_8_R3/src/main/java/me/espryth/easyjoin/adapt/legacy/v1_8_R3/ActionbarSender1_8_R3.java +++ /dev/null @@ -1,16 +0,0 @@ -package me.espryth.easyjoin.adapt.legacy.v1_8_R3; - -import me.espryth.easyjoin.adapt.ActionbarSender; -import net.minecraft.server.v1_8_R3.IChatBaseComponent; -import net.minecraft.server.v1_8_R3.PacketPlayOutChat; -import org.bukkit.entity.Player; - -public class ActionbarSender1_8_R3 - implements ActionbarSender { - - @Override - public void send(Player player, String message) { - IChatBaseComponent actionbarText = IChatBaseComponent.ChatSerializer.a("{\"text\": \"" + message + "\"}"); - Packets.send(player, new PacketPlayOutChat(actionbarText, (byte) 2)); - } -} diff --git a/adapt/legacy/v1_8_R3/src/main/java/me/espryth/easyjoin/adapt/legacy/v1_8_R3/AdapterModule1_8_R3.java b/adapt/legacy/v1_8_R3/src/main/java/me/espryth/easyjoin/adapt/legacy/v1_8_R3/AdapterModule1_8_R3.java deleted file mode 100644 index 61f079e..0000000 --- a/adapt/legacy/v1_8_R3/src/main/java/me/espryth/easyjoin/adapt/legacy/v1_8_R3/AdapterModule1_8_R3.java +++ /dev/null @@ -1,17 +0,0 @@ -package me.espryth.easyjoin.adapt.legacy.v1_8_R3; - -import dev.henko.storance.Binder; -import dev.henko.storance.StoranceModule; -import me.espryth.easyjoin.adapt.ActionbarSender; -import me.espryth.easyjoin.adapt.BookSender; -import me.espryth.easyjoin.adapt.TitleSender; - -public class AdapterModule1_8_R3 - implements StoranceModule { - @Override - public void configure(Binder binder) { - binder.bind(ActionbarSender.class).toInstance(new ActionbarSender1_8_R3()); - binder.bind(BookSender.class).toInstance(new BookSender1_8_R3()); - binder.bind(TitleSender.class).toInstance(new TitleSender1_8_R3()); - } -} diff --git a/adapt/legacy/v1_8_R3/src/main/java/me/espryth/easyjoin/adapt/legacy/v1_8_R3/BookSender1_8_R3.java b/adapt/legacy/v1_8_R3/src/main/java/me/espryth/easyjoin/adapt/legacy/v1_8_R3/BookSender1_8_R3.java deleted file mode 100644 index 2bc4ce6..0000000 --- a/adapt/legacy/v1_8_R3/src/main/java/me/espryth/easyjoin/adapt/legacy/v1_8_R3/BookSender1_8_R3.java +++ /dev/null @@ -1,23 +0,0 @@ -package me.espryth.easyjoin.adapt.legacy.v1_8_R3; - -import io.netty.buffer.Unpooled; -import me.espryth.easyjoin.adapt.BookSender; -import net.minecraft.server.v1_8_R3.PacketDataSerializer; -import net.minecraft.server.v1_8_R3.PacketPlayOutCustomPayload; -import org.bukkit.entity.Player; -import org.bukkit.inventory.ItemStack; - -public class BookSender1_8_R3 - implements BookSender { - - @Override - public void send(Player player, ItemStack book) { - ItemStack itemInHand = player.getItemInHand(); - player.setItemInHand(book); - Packets.send(player, - new PacketPlayOutCustomPayload("MC|BOpen", - new PacketDataSerializer(Unpooled.buffer())) - ); - player.setItemInHand(itemInHand); - } -} diff --git a/adapt/legacy/v1_8_R3/src/main/java/me/espryth/easyjoin/adapt/legacy/v1_8_R3/Packets.java b/adapt/legacy/v1_8_R3/src/main/java/me/espryth/easyjoin/adapt/legacy/v1_8_R3/Packets.java deleted file mode 100644 index 5ea2b83..0000000 --- a/adapt/legacy/v1_8_R3/src/main/java/me/espryth/easyjoin/adapt/legacy/v1_8_R3/Packets.java +++ /dev/null @@ -1,17 +0,0 @@ -package me.espryth.easyjoin.adapt.legacy.v1_8_R3; - -import net.minecraft.server.v1_8_R3.Packet; -import net.minecraft.server.v1_8_R3.PlayerConnection; -import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer; -import org.bukkit.entity.Player; - -public class Packets { - - public static void send(Player player, Packet... packets) { - PlayerConnection connection = ((CraftPlayer) player).getHandle().playerConnection; - for (Packet packet : packets) { - connection.sendPacket(packet); - } - } - -} diff --git a/adapt/legacy/v1_8_R3/src/main/java/me/espryth/easyjoin/adapt/legacy/v1_8_R3/TitleSender1_8_R3.java b/adapt/legacy/v1_8_R3/src/main/java/me/espryth/easyjoin/adapt/legacy/v1_8_R3/TitleSender1_8_R3.java deleted file mode 100644 index 716f71a..0000000 --- a/adapt/legacy/v1_8_R3/src/main/java/me/espryth/easyjoin/adapt/legacy/v1_8_R3/TitleSender1_8_R3.java +++ /dev/null @@ -1,27 +0,0 @@ -package me.espryth.easyjoin.adapt.legacy.v1_8_R3; - -import me.espryth.easyjoin.adapt.TitleSender; -import net.minecraft.server.v1_8_R3.IChatBaseComponent; -import net.minecraft.server.v1_8_R3.PacketPlayOutTitle; -import org.bukkit.entity.Player; - -public class TitleSender1_8_R3 - implements TitleSender { - - @Override - public void send(Player player, String title, String subTitle, int fadeIn, int fadeShow, int fadeOut) { - Packets.send( - player, - new PacketPlayOutTitle( - PacketPlayOutTitle.EnumTitleAction.TITLE, - IChatBaseComponent.ChatSerializer.a("{\"text\": \"" + title + "\"}"), - fadeIn, fadeShow, fadeOut - ), - new PacketPlayOutTitle( - PacketPlayOutTitle.EnumTitleAction.SUBTITLE, - IChatBaseComponent.ChatSerializer.a("{\"text\": \"" + subTitle + "\"}"), - fadeIn, fadeShow, fadeOut - ) - ); - } -} diff --git a/adapt/legacy/v1_9_R2/pom.xml b/adapt/legacy/v1_9_R2/pom.xml deleted file mode 100644 index 8641ccc..0000000 --- a/adapt/legacy/v1_9_R2/pom.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - - me.espryth.easyjoin - easyjoin-adapt-legacy - 2.2.2 - - 4.0.0 - - easyjoin-adapt-legacy-v1_9_R2 - - - - org.spigotmc - spigot - 1.9.4-R0.1-SNAPSHOT - provided - - - \ No newline at end of file diff --git a/adapt/legacy/v1_9_R2/src/main/java/me/espryth/easyjoin/adapt/legacy/v1_9_R2/ActionbarSender1_9_R2.java b/adapt/legacy/v1_9_R2/src/main/java/me/espryth/easyjoin/adapt/legacy/v1_9_R2/ActionbarSender1_9_R2.java deleted file mode 100644 index 8db55fc..0000000 --- a/adapt/legacy/v1_9_R2/src/main/java/me/espryth/easyjoin/adapt/legacy/v1_9_R2/ActionbarSender1_9_R2.java +++ /dev/null @@ -1,14 +0,0 @@ -package me.espryth.easyjoin.adapt.legacy.v1_9_R2; - -import me.espryth.easyjoin.adapt.ActionbarSender; -import net.md_5.bungee.api.ChatMessageType; -import net.md_5.bungee.api.chat.TextComponent; -import org.bukkit.entity.Player; - -public class ActionbarSender1_9_R2 - implements ActionbarSender { - @Override - public void send(Player player, String message) { - player.spigot().sendMessage(ChatMessageType.ACTION_BAR, TextComponent.fromLegacyText(message)); - } -} diff --git a/adapt/legacy/v1_9_R2/src/main/java/me/espryth/easyjoin/adapt/legacy/v1_9_R2/AdapterModule1_9_R2.java b/adapt/legacy/v1_9_R2/src/main/java/me/espryth/easyjoin/adapt/legacy/v1_9_R2/AdapterModule1_9_R2.java deleted file mode 100644 index 9acc690..0000000 --- a/adapt/legacy/v1_9_R2/src/main/java/me/espryth/easyjoin/adapt/legacy/v1_9_R2/AdapterModule1_9_R2.java +++ /dev/null @@ -1,17 +0,0 @@ -package me.espryth.easyjoin.adapt.legacy.v1_9_R2; - -import dev.henko.storance.Binder; -import dev.henko.storance.StoranceModule; -import me.espryth.easyjoin.adapt.ActionbarSender; -import me.espryth.easyjoin.adapt.BookSender; -import me.espryth.easyjoin.adapt.TitleSender; - -public class AdapterModule1_9_R2 - implements StoranceModule { - @Override - public void configure(Binder binder) { - binder.bind(ActionbarSender.class).toInstance(new ActionbarSender1_9_R2()); - binder.bind(BookSender.class).toInstance(new BookSender1_9_R2()); - binder.bind(TitleSender.class).toInstance(new TitleSender1_9_R2()); - } -} diff --git a/adapt/legacy/v1_9_R2/src/main/java/me/espryth/easyjoin/adapt/legacy/v1_9_R2/BookSender1_9_R2.java b/adapt/legacy/v1_9_R2/src/main/java/me/espryth/easyjoin/adapt/legacy/v1_9_R2/BookSender1_9_R2.java deleted file mode 100644 index 4222aef..0000000 --- a/adapt/legacy/v1_9_R2/src/main/java/me/espryth/easyjoin/adapt/legacy/v1_9_R2/BookSender1_9_R2.java +++ /dev/null @@ -1,22 +0,0 @@ -package me.espryth.easyjoin.adapt.legacy.v1_9_R2; - -import io.netty.buffer.Unpooled; -import me.espryth.easyjoin.adapt.BookSender; -import net.minecraft.server.v1_9_R2.PacketDataSerializer; -import net.minecraft.server.v1_9_R2.PacketPlayOutCustomPayload; -import org.bukkit.entity.Player; -import org.bukkit.inventory.ItemStack; - -public class BookSender1_9_R2 - implements BookSender { - @Override - public void send(Player player, ItemStack book) { - ItemStack itemInHand = player.getInventory().getItemInMainHand(); - player.getInventory().setItemInMainHand(book); - Packets.send(player, - new PacketPlayOutCustomPayload("MC|BOpen", - new PacketDataSerializer(Unpooled.buffer())) - ); - player.getInventory().setItemInMainHand(itemInHand); - } -} diff --git a/adapt/legacy/v1_9_R2/src/main/java/me/espryth/easyjoin/adapt/legacy/v1_9_R2/Packets.java b/adapt/legacy/v1_9_R2/src/main/java/me/espryth/easyjoin/adapt/legacy/v1_9_R2/Packets.java deleted file mode 100644 index 9dabb9e..0000000 --- a/adapt/legacy/v1_9_R2/src/main/java/me/espryth/easyjoin/adapt/legacy/v1_9_R2/Packets.java +++ /dev/null @@ -1,15 +0,0 @@ -package me.espryth.easyjoin.adapt.legacy.v1_9_R2; - -import net.minecraft.server.v1_9_R2.Packet; -import net.minecraft.server.v1_9_R2.PlayerConnection; -import org.bukkit.craftbukkit.v1_9_R2.entity.CraftPlayer; -import org.bukkit.entity.Player; - -public class Packets { - public static void send(Player player, Packet... packets) { - PlayerConnection connection = ((CraftPlayer) player).getHandle().playerConnection; - for (Packet packet : packets) { - connection.sendPacket(packet); - } - } -} diff --git a/adapt/legacy/v1_9_R2/src/main/java/me/espryth/easyjoin/adapt/legacy/v1_9_R2/TitleSender1_9_R2.java b/adapt/legacy/v1_9_R2/src/main/java/me/espryth/easyjoin/adapt/legacy/v1_9_R2/TitleSender1_9_R2.java deleted file mode 100644 index 22781b3..0000000 --- a/adapt/legacy/v1_9_R2/src/main/java/me/espryth/easyjoin/adapt/legacy/v1_9_R2/TitleSender1_9_R2.java +++ /dev/null @@ -1,26 +0,0 @@ -package me.espryth.easyjoin.adapt.legacy.v1_9_R2; - -import me.espryth.easyjoin.adapt.TitleSender; -import net.minecraft.server.v1_9_R2.IChatBaseComponent; -import net.minecraft.server.v1_9_R2.PacketPlayOutTitle; -import org.bukkit.entity.Player; - -public class TitleSender1_9_R2 - implements TitleSender { - @Override - public void send(Player player, String title, String subTitle, int fadeIn, int fadeShow, int fadeOut) { - Packets.send( - player, - new PacketPlayOutTitle( - PacketPlayOutTitle.EnumTitleAction.TITLE, - IChatBaseComponent.ChatSerializer.a("{\"text\": \"" + title + "\"}"), - fadeIn, fadeShow, fadeOut - ), - new PacketPlayOutTitle( - PacketPlayOutTitle.EnumTitleAction.SUBTITLE, - IChatBaseComponent.ChatSerializer.a("{\"text\": \"" + subTitle + "\"}"), - fadeIn, fadeShow, fadeOut - ) - ); - } -} diff --git a/adapt/newer/pom.xml b/adapt/newer/pom.xml deleted file mode 100644 index 42f38a0..0000000 --- a/adapt/newer/pom.xml +++ /dev/null @@ -1,28 +0,0 @@ - - - - me.espryth.easyjoin - easyjoin-adapt - 2.2.2 - - 4.0.0 - - easyjoin-adapt-newer - - - - org.spigotmc - spigot - 1.18-R0.1-SNAPSHOT - provided - - - me.espryth.easyjoin - easyjoin-adapt-api - ${project.version} - provided - - - \ No newline at end of file diff --git a/adapt/newer/src/main/java/me/espryth/easyjoin/adapt/newer/NewerActionbarSender.java b/adapt/newer/src/main/java/me/espryth/easyjoin/adapt/newer/NewerActionbarSender.java deleted file mode 100644 index e6b5891..0000000 --- a/adapt/newer/src/main/java/me/espryth/easyjoin/adapt/newer/NewerActionbarSender.java +++ /dev/null @@ -1,15 +0,0 @@ -package me.espryth.easyjoin.adapt.newer; - -import me.espryth.easyjoin.adapt.ActionbarSender; -import net.md_5.bungee.api.ChatMessageType; -import net.md_5.bungee.api.chat.TextComponent; -import org.bukkit.entity.Player; - -public class NewerActionbarSender - implements ActionbarSender { - - @Override - public void send(Player player, String message) { - player.spigot().sendMessage(ChatMessageType.ACTION_BAR, TextComponent.fromLegacyText(message)); - } -} diff --git a/adapt/newer/src/main/java/me/espryth/easyjoin/adapt/newer/NewerAdapterModule.java b/adapt/newer/src/main/java/me/espryth/easyjoin/adapt/newer/NewerAdapterModule.java deleted file mode 100644 index 8a4eddf..0000000 --- a/adapt/newer/src/main/java/me/espryth/easyjoin/adapt/newer/NewerAdapterModule.java +++ /dev/null @@ -1,18 +0,0 @@ -package me.espryth.easyjoin.adapt.newer; - -import dev.henko.storance.Binder; -import dev.henko.storance.StoranceModule; -import me.espryth.easyjoin.adapt.ActionbarSender; -import me.espryth.easyjoin.adapt.BookSender; -import me.espryth.easyjoin.adapt.TitleSender; - -public class NewerAdapterModule - implements StoranceModule { - - @Override - public void configure(Binder binder) { - binder.bind(ActionbarSender.class).toInstance(new NewerActionbarSender()); - binder.bind(BookSender.class).toInstance(new NewerBookSender()); - binder.bind(TitleSender.class).toInstance(new NewerTitleSender()); - } -} diff --git a/adapt/newer/src/main/java/me/espryth/easyjoin/adapt/newer/NewerBookSender.java b/adapt/newer/src/main/java/me/espryth/easyjoin/adapt/newer/NewerBookSender.java deleted file mode 100644 index 781ca40..0000000 --- a/adapt/newer/src/main/java/me/espryth/easyjoin/adapt/newer/NewerBookSender.java +++ /dev/null @@ -1,14 +0,0 @@ -package me.espryth.easyjoin.adapt.newer; - -import me.espryth.easyjoin.adapt.BookSender; -import org.bukkit.entity.Player; -import org.bukkit.inventory.ItemStack; - -public class NewerBookSender - implements BookSender { - - @Override - public void send(Player player, ItemStack book) { - player.openBook(book); - } -} diff --git a/adapt/newer/src/main/java/me/espryth/easyjoin/adapt/newer/NewerTitleSender.java b/adapt/newer/src/main/java/me/espryth/easyjoin/adapt/newer/NewerTitleSender.java deleted file mode 100644 index dd4bd38..0000000 --- a/adapt/newer/src/main/java/me/espryth/easyjoin/adapt/newer/NewerTitleSender.java +++ /dev/null @@ -1,13 +0,0 @@ -package me.espryth.easyjoin.adapt.newer; - -import me.espryth.easyjoin.adapt.TitleSender; -import org.bukkit.entity.Player; - -public class NewerTitleSender - implements TitleSender { - - @Override - public void send(Player player, String title, String subTitle, int fadeIn, int fadeShow, int fadeOut) { - player.sendTitle(title, subTitle, fadeIn, fadeShow, fadeOut); - } -} diff --git a/adapt/pom.xml b/adapt/pom.xml deleted file mode 100644 index f329fe6..0000000 --- a/adapt/pom.xml +++ /dev/null @@ -1,21 +0,0 @@ - - - - me.espryth.easyjoin - easyjoin-parent - 2.2.2 - - 4.0.0 - - easyjoin-adapt - pom - - - legacy - newer - api - - - \ No newline at end of file diff --git a/build.gradle.kts b/build.gradle.kts new file mode 100644 index 0000000..5e7b895 --- /dev/null +++ b/build.gradle.kts @@ -0,0 +1,70 @@ +plugins { + id("java") + id("java-library") + id("com.gradleup.shadow") version "9.3.0" +} + +group = "me.espryth.easyjoin" +version = "3.0.0" + +java { + toolchain { + languageVersion.set(JavaLanguageVersion.of(21)) + } + sourceCompatibility = JavaVersion.VERSION_21 + targetCompatibility = JavaVersion.VERSION_21 +} + +repositories { + mavenLocal() + mavenCentral() + maven("https://repo.papermc.io/repository/maven-public/") + maven("https://oss.sonatype.org/content/repositories/snapshots/") + maven("https://repo.extendedclip.com/releases/") + maven("https://maven.enginehub.org/repo/") + maven("https://repo.codemc.io/repository/maven-public/") +} + +dependencies { + compileOnly("io.papermc.paper:paper-api:1.21.1-R0.1-SNAPSHOT") + + api("com.thewinterframework:paper:1.0.4") { + exclude(group = "io.papermc.paper", module = "paper-api") + } + annotationProcessor("com.thewinterframework:paper:1.0.4") + + api("com.thewinterframework:configuration:1.0.2") { + exclude(group = "io.papermc.paper", module = "paper-api") + } + annotationProcessor("com.thewinterframework:configuration:1.0.2") + + api("com.thewinterframework:command:1.0.1") { + exclude(group = "io.papermc.paper", module = "paper-api") + exclude(group = "org.incendo", module = "cloud-paper") + exclude(group = "org.incendo", module = "cloud-annotations") + exclude(group = "org.incendo", module = "cloud-bukkit") + exclude(group = "org.incendo", module = "cloud-core") + } + annotationProcessor("com.thewinterframework:command:1.0.1") + + api("org.incendo:cloud-paper:2.0.0-beta.10") + api("org.incendo:cloud-annotations:2.0.0") + + compileOnly("me.clip:placeholderapi:2.11.6") + compileOnly("fr.xephi:authme:5.6.0-SNAPSHOT") + compileOnly("com.nickuc.login:nlogin-api:10.0") + + implementation("net.kyori:adventure-text-serializer-legacy:4.26.1") + implementation("net.kyori:adventure-text-minimessage:4.26.1") + implementation("com.zaxxer:HikariCP:7.0.2") +} + + +tasks.shadowJar { + relocate("com.zaxxer.hikari", "me.espryth.easyjoin.libs.hikari") + archiveClassifier.set("") +} + +tasks.build { + dependsOn(tasks.shadowJar) +} diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000000000000000000000000000000000000..8bdaf60c75ab801e22807dde59e12a8735a34077 GIT binary patch literal 45457 zcma&NW0YlEwk;ePwr$(aux;D69T}N{9ky*d!_2U4+qUuIRNZ#Jck8}7U+vcB{`IjNZqX3eq5;s6ddAkU&5{L|^Ow`ym2B0m+K02+~Q)i807X3X94qi>j)C0e$=H zm31v`=T&y}ACuKx7G~yWSYncG=NFB>O2);i9EmJ(9jSamq?Crj$g~1l3m-4M7;BWn zau2S&sSA0b0Rhg>6YlVLQa;D#)1yw+eGs~36Q$}5?avIRne3TQZXb<^e}?T69w<9~ zUmx1cG0uZ?Kd;Brd$$>r>&MrY*3$t^PWF1+J+G_xmpHW=>mly$<>~wHH+Bt3mzN7W zhR)g{_veH6>*KxLJ~~s{9HZm!UeC86d_>42NRqd$ev8zSMq4kt)q*>8kJ8p|^wuKx zq2Is_HJPoQ_apSoT?zJj7vXBp!xejBc^7F|zU0rhy%Ub*Dy#jJs!>1?CmJ-gulPVX zKit>RVmjL=G?>jytf^U@mfnC*1-7EVag@%ROu*#kA+)Rxq?MGK0v-dp^kM?nyMngb z_poL>GLThB7xAO*I7&?4^Nj`<@O@>&0M-QxIi zD@n}s%CYI4Be19C$lAb9Bbm6!R{&A;=yh=#fnFyb`s7S5W3?arZf?$khCwkGN!+GY~GT8-`!6pFr zbFBVEF`kAgtecfjJ`flN2Z!$$8}6hV>Tu;+rN%$X^t8fI>tXQnRn^$UhXO8Gu zt$~QON8`doV&{h}=2!}+xJKrNPcIQid?WuHUC-i%P^F(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sSo}$f>nh0QNZXH1N)-Q7kbk=2uL9OrF)nXrE@F1y%_8Yn c82=K%QXLKFx%@O{wJjEi6Y56o#$)Bpeg literal 0 HcmV?d00001 diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000..2a84e18 --- /dev/null +++ b/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,7 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-9.0.0-bin.zip +networkTimeout=10000 +validateDistributionUrl=true +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew new file mode 100644 index 0000000..ef07e01 --- /dev/null +++ b/gradlew @@ -0,0 +1,251 @@ +#!/bin/sh + +# +# Copyright © 2015 the original authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 +# + +############################################################################## +# +# Gradle start up script for POSIX generated by Gradle. +# +# Important for running: +# +# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is +# noncompliant, but you have some other compliant shell such as ksh or +# bash, then to run this script, type that shell name before the whole +# command line, like: +# +# ksh Gradle +# +# Busybox and similar reduced shells will NOT work, because this script +# requires all of these POSIX shell features: +# * functions; +# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», +# «${var#prefix}», «${var%suffix}», and «$( cmd )»; +# * compound commands having a testable exit status, especially «case»; +# * various built-in commands including «command», «set», and «ulimit». +# +# Important for patching: +# +# (2) This script targets any POSIX shell, so it avoids extensions provided +# by Bash, Ksh, etc; in particular arrays are avoided. +# +# The "traditional" practice of packing multiple parameters into a +# space-separated string is a well documented source of bugs and security +# problems, so this is (mostly) avoided, by progressively accumulating +# options in "$@", and eventually passing that to Java. +# +# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, +# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; +# see the in-line comments for details. +# +# There are tweaks for specific operating systems such as AIX, CygWin, +# Darwin, MinGW, and NonStop. +# +# (3) This script is generated from the Groovy template +# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# within the Gradle project. +# +# You can find Gradle at https://github.com/gradle/gradle/. +# +############################################################################## + +# Attempt to set APP_HOME + +# Resolve links: $0 may be a link +app_path=$0 + +# Need this for daisy-chained symlinks. +while + APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path + [ -h "$app_path" ] +do + ls=$( ls -ld "$app_path" ) + link=${ls#*' -> '} + case $link in #( + /*) app_path=$link ;; #( + *) app_path=$APP_HOME$link ;; + esac +done + +# This is normally unused +# shellcheck disable=SC2034 +APP_BASE_NAME=${0##*/} +# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) +APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD=maximum + +warn () { + echo "$*" +} >&2 + +die () { + echo + echo "$*" + echo + exit 1 +} >&2 + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "$( uname )" in #( + CYGWIN* ) cygwin=true ;; #( + Darwin* ) darwin=true ;; #( + MSYS* | MINGW* ) msys=true ;; #( + NONSTOP* ) nonstop=true ;; +esac + +CLASSPATH="\\\"\\\"" + + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD=$JAVA_HOME/jre/sh/java + else + JAVACMD=$JAVA_HOME/bin/java + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD=java + if ! command -v java >/dev/null 2>&1 + then + die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +fi + +# Increase the maximum file descriptors if we can. +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then + case $MAX_FD in #( + max*) + # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC2039,SC3045 + MAX_FD=$( ulimit -H -n ) || + warn "Could not query maximum file descriptor limit" + esac + case $MAX_FD in #( + '' | soft) :;; #( + *) + # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC2039,SC3045 + ulimit -n "$MAX_FD" || + warn "Could not set maximum file descriptor limit to $MAX_FD" + esac +fi + +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. + +# For Cygwin or MSYS, switch paths to Windows format before running java +if "$cygwin" || "$msys" ; then + APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) + CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) + + JAVACMD=$( cygpath --unix "$JAVACMD" ) + + # Now convert the arguments - kludge to limit ourselves to /bin/sh + for arg do + if + case $arg in #( + -*) false ;; # don't mess with options #( + /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath + [ -e "$t" ] ;; #( + *) false ;; + esac + then + arg=$( cygpath --path --ignore --mixed "$arg" ) + fi + # Roll the args list around exactly as many times as the number of + # args, so each arg winds up back in the position where it started, but + # possibly modified. + # + # NB: a `for` loop captures its iteration list before it begins, so + # changing the positional parameters here affects neither the number of + # iterations, nor the values presented in `arg`. + shift # remove old arg + set -- "$@" "$arg" # push replacement arg + done +fi + + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# Collect all arguments for the java command: +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, +# and any embedded shellness will be escaped. +# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be +# treated as '${Hostname}' itself on the command line. + +set -- \ + "-Dorg.gradle.appname=$APP_BASE_NAME" \ + -classpath "$CLASSPATH" \ + -jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \ + "$@" + +# Stop when "xargs" is not available. +if ! command -v xargs >/dev/null 2>&1 +then + die "xargs is not available" +fi + +# Use "xargs" to parse quoted args. +# +# With -n1 it outputs one arg per line, with the quotes and backslashes removed. +# +# In Bash we could simply go: +# +# readarray ARGS < <( xargs -n1 <<<"$var" ) && +# set -- "${ARGS[@]}" "$@" +# +# but POSIX shell has neither arrays nor command substitution, so instead we +# post-process each arg (as a line of input to sed) to backslash-escape any +# character that might be a shell metacharacter, then use eval to reverse +# that process (while maintaining the separation between arguments), and wrap +# the whole thing up as a single "set" statement. +# +# This will of course break if any of these variables contains a newline or +# an unmatched quote. +# + +eval "set -- $( + printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | + xargs -n1 | + sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | + tr '\n' ' ' + )" '"$@"' + +exec "$JAVACMD" "$@" diff --git a/gradlew.bat b/gradlew.bat new file mode 100644 index 0000000..db3a6ac --- /dev/null +++ b/gradlew.bat @@ -0,0 +1,94 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem +@rem SPDX-License-Identifier: Apache-2.0 +@rem + +@if "%DEBUG%"=="" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%"=="" set DIRNAME=. +@rem This is normally unused +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if %ERRORLEVEL% equ 0 goto execute + +echo. 1>&2 +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto execute + +echo. 1>&2 +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 + +goto fail + +:execute +@rem Setup the command line + +set CLASSPATH= + + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %* + +:end +@rem End local scope for the variables with windows NT shell +if %ERRORLEVEL% equ 0 goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +set EXIT_CODE=%ERRORLEVEL% +if %EXIT_CODE% equ 0 set EXIT_CODE=1 +if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% +exit /b %EXIT_CODE% + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/plugin/dependency-reduced-pom.xml b/plugin/dependency-reduced-pom.xml deleted file mode 100644 index 07616e3..0000000 --- a/plugin/dependency-reduced-pom.xml +++ /dev/null @@ -1,50 +0,0 @@ - - - - easyjoin-parent - me.espryth.easyjoin - 2.2.2 - - 4.0.0 - easyjoin-plugin - - - codemc-repo - https://repo.codemc.org/repository/maven-public/ - - - placeholderapi - https://repo.extendedclip.com/content/repositories/placeholderapi/ - - - nicku-repo - https://repo.nickuc.com/maven2/ - - - - - org.spigotmc - spigot - 1.16.5-R0.1-SNAPSHOT - provided - - - me.clip - placeholderapi - 2.10.9 - provided - - - fr.xephi - authme - 5.6.0-SNAPSHOT - provided - - - com.nickuc.login - nlogin-api - 10.0 - provided - - - diff --git a/plugin/pom.xml b/plugin/pom.xml deleted file mode 100644 index 2932bcb..0000000 --- a/plugin/pom.xml +++ /dev/null @@ -1,98 +0,0 @@ - - - - me.espryth.easyjoin - easyjoin-parent - 2.2.2 - - 4.0.0 - - easyjoin-plugin - - - - me.espryth.easyjoin - easyjoin-adapt-api - ${project.version} - - - me.espryth.easyjoin - easyjoin-adapt-legacy-v1_8_R3 - ${project.version} - - - me.espryth.easyjoin - easyjoin-adapt-legacy-v1_9_R2 - ${project.version} - - - me.espryth.easyjoin - easyjoin-adapt-legacy-v1_10_R1 - ${project.version} - - - me.espryth.easyjoin - easyjoin-adapt-legacy-v1_11_R1 - ${project.version} - - - me.espryth.easyjoin - easyjoin-adapt-legacy-v1_12_R1 - ${project.version} - - - me.espryth.easyjoin - easyjoin-adapt-newer - ${project.version} - - - org.spigotmc - spigot - 1.16.5-R0.1-SNAPSHOT - provided - - - me.clip - placeholderapi - 2.10.9 - provided - - - fr.xephi - authme - 5.6.0-SNAPSHOT - provided - - - com.nickuc.login - nlogin-api - 10.0 - provided - - - - com.zaxxer - HikariCP - 4.0.3 - - - - - - - codemc-repo - https://repo.codemc.org/repository/maven-public/ - - - placeholderapi - https://repo.extendedclip.com/content/repositories/placeholderapi/ - - - nicku-repo - https://repo.nickuc.com/maven2/ - - - - \ No newline at end of file diff --git a/plugin/src/main/java/me/espryth/easyjoin/plugin/EasyJoin.java b/plugin/src/main/java/me/espryth/easyjoin/plugin/EasyJoin.java deleted file mode 100644 index 3e82b11..0000000 --- a/plugin/src/main/java/me/espryth/easyjoin/plugin/EasyJoin.java +++ /dev/null @@ -1,65 +0,0 @@ -package me.espryth.easyjoin.plugin; - -import dev.henko.storance.Container; -import dev.henko.storance.ModuleInjector; -import dev.henko.storance.impl.ModuleInjectorImpl; -import me.espryth.easyjoin.plugin.command.MainCommand; -import me.espryth.easyjoin.plugin.format.Format; -import me.espryth.easyjoin.plugin.hook.PlaceholderAPIHook; -import me.espryth.easyjoin.plugin.loader.FormatLoader; -import me.espryth.easyjoin.plugin.loader.ListenerLoader; -import me.espryth.easyjoin.plugin.loader.Loader; -import me.espryth.easyjoin.plugin.module.MainModule; -import me.espryth.easyjoin.plugin.utils.MessageUtils; -import me.espryth.easyjoin.plugin.utils.YamlFile; -import org.bukkit.Bukkit; -import org.bukkit.plugin.java.JavaPlugin; - -import java.util.HashMap; -import java.util.Map; - -public class EasyJoin extends JavaPlugin { - - private static final ModuleInjector INJECTOR = new ModuleInjectorImpl(); - public static final Container CONTAINER = INJECTOR.getContainer(); - - private final Map formatMap = new HashMap<>(); - - private Loader listenerLoader; - private Loader formatLoader; - - @Override - public void onLoad() { - INJECTOR.install(new MainModule(this)); - listenerLoader = new ListenerLoader(); - formatLoader = new FormatLoader(); - - new PlaceholderAPIHook().register(); - - } - - @Override - public void onEnable() { - listenerLoader.load(); - formatLoader.load(); - sendInitMessage(); - getCommand("easyjoin").setExecutor(new MainCommand()); - } - - public void reload() { - CONTAINER.get(YamlFile.class, "config").reload(); - CONTAINER.get(YamlFile.class, "book").reload(); - formatMap.clear(); - formatLoader.load(); - } - - public void sendInitMessage() { - Bukkit.getConsoleSender().sendMessage(MessageUtils.colorize("&6| &6|")); - Bukkit.getConsoleSender().sendMessage(MessageUtils.colorize("&6| &e| &eEasyJoin &f"+ getDescription().getVersion()+" by Espryth")); - Bukkit.getConsoleSender().sendMessage(MessageUtils.colorize("&6| &6|")); - } - - public Map getFormatMap() { - return formatMap; - } -} diff --git a/plugin/src/main/java/me/espryth/easyjoin/plugin/action/AbstractAction.java b/plugin/src/main/java/me/espryth/easyjoin/plugin/action/AbstractAction.java deleted file mode 100644 index 0be922c..0000000 --- a/plugin/src/main/java/me/espryth/easyjoin/plugin/action/AbstractAction.java +++ /dev/null @@ -1,17 +0,0 @@ -package me.espryth.easyjoin.plugin.action; - -public abstract class AbstractAction implements Action { - - private String line; - - @Override - public String getLine() { - return line; - } - - @Override - public void setLine(String line) { - this.line = line; - } - -} diff --git a/plugin/src/main/java/me/espryth/easyjoin/plugin/action/Action.java b/plugin/src/main/java/me/espryth/easyjoin/plugin/action/Action.java deleted file mode 100644 index 429cb87..0000000 --- a/plugin/src/main/java/me/espryth/easyjoin/plugin/action/Action.java +++ /dev/null @@ -1,23 +0,0 @@ -package me.espryth.easyjoin.plugin.action; - -import org.bukkit.entity.Player; - -import java.lang.reflect.InvocationTargetException; - -public interface Action { - - void execute(Player player, ActionQueue queue) throws ActionExecutionException; - - String getLine(); - - void setLine(String line); - - default Action duplicate() { - try { - return getClass().getConstructor().newInstance(); - } catch (InstantiationException | InvocationTargetException | NoSuchMethodException | IllegalAccessException e) { - throw new RuntimeException("An error has occurred when duplicate the action " + getClass().getName(), e); - } - } - -} diff --git a/plugin/src/main/java/me/espryth/easyjoin/plugin/action/ActionExecutionException.java b/plugin/src/main/java/me/espryth/easyjoin/plugin/action/ActionExecutionException.java deleted file mode 100644 index 27c1d69..0000000 --- a/plugin/src/main/java/me/espryth/easyjoin/plugin/action/ActionExecutionException.java +++ /dev/null @@ -1,9 +0,0 @@ -package me.espryth.easyjoin.plugin.action; - -public class ActionExecutionException extends Exception { - - public ActionExecutionException(String message) { - super("An error has occurred while executing an action ( " + message + " )"); - } - -} diff --git a/plugin/src/main/java/me/espryth/easyjoin/plugin/action/ActionQueue.java b/plugin/src/main/java/me/espryth/easyjoin/plugin/action/ActionQueue.java deleted file mode 100644 index 8c6a955..0000000 --- a/plugin/src/main/java/me/espryth/easyjoin/plugin/action/ActionQueue.java +++ /dev/null @@ -1,57 +0,0 @@ -package me.espryth.easyjoin.plugin.action; - -import org.bukkit.entity.Player; -import org.bukkit.plugin.Plugin; - -import java.util.Iterator; -import java.util.List; -import java.util.logging.Level; - -import static me.espryth.easyjoin.plugin.EasyJoin.CONTAINER; - -public class ActionQueue - implements Iterator { - - private final List actions; - private int cursor = 0; - private boolean paused = false; - - public ActionQueue(List actions) { - this.actions = actions; - } - - public void executeAll(Player player) { - while(hasNext()) { - if(isPaused()) { - break; - } - Action action = next(); - try { - action.execute(player, this); - } catch (ActionExecutionException e) { - CONTAINER.get(Plugin.class).getLogger().log(Level.SEVERE, e.getMessage()); - } - } - } - - @Override - public boolean hasNext() { - return cursor >= 0 && cursor < actions.size(); - } - - @Override - public Action next() { - Action action = actions.get(cursor); - cursor++; - return action; - } - - public boolean isPaused() { - return paused; - } - - public void setPaused(boolean paused) { - this.paused = paused; - } - -} diff --git a/plugin/src/main/java/me/espryth/easyjoin/plugin/action/ActionType.java b/plugin/src/main/java/me/espryth/easyjoin/plugin/action/ActionType.java deleted file mode 100644 index 5809c81..0000000 --- a/plugin/src/main/java/me/espryth/easyjoin/plugin/action/ActionType.java +++ /dev/null @@ -1,7 +0,0 @@ -package me.espryth.easyjoin.plugin.action; - -public enum ActionType { - AUTH, - JOIN, - QUIT -} diff --git a/plugin/src/main/java/me/espryth/easyjoin/plugin/action/impl/ActionbarAction.java b/plugin/src/main/java/me/espryth/easyjoin/plugin/action/impl/ActionbarAction.java deleted file mode 100644 index 303c7dd..0000000 --- a/plugin/src/main/java/me/espryth/easyjoin/plugin/action/impl/ActionbarAction.java +++ /dev/null @@ -1,32 +0,0 @@ -package me.espryth.easyjoin.plugin.action.impl; - -import me.espryth.easyjoin.adapt.ActionbarSender; -import me.espryth.easyjoin.plugin.action.AbstractAction; -import me.espryth.easyjoin.plugin.action.ActionExecutionException; -import me.espryth.easyjoin.plugin.action.ActionQueue; -import me.espryth.easyjoin.plugin.utils.Actionbar; -import me.espryth.easyjoin.plugin.utils.MessageUtils; -import me.espryth.easyjoin.plugin.utils.RepeatingAction; -import org.bukkit.entity.Player; -import org.bukkit.plugin.Plugin; - -import static me.espryth.easyjoin.plugin.EasyJoin.CONTAINER; - -public class ActionbarAction extends AbstractAction { - - private final Plugin plugin; - private final ActionbarSender actionbarSender; - - public ActionbarAction() { - this.plugin = CONTAINER.get(Plugin.class); - this.actionbarSender = CONTAINER.get(ActionbarSender.class); - } - - @Override - public void execute(Player player, ActionQueue queue) throws ActionExecutionException { - String[] values = MessageUtils.formatString(player, getLine()).split(";"); - Actionbar actionbar = Actionbar.parse(values); - RepeatingAction.execute(plugin, actionbar.getFadeShow(), () -> - actionbarSender.send(player, actionbar.getText())); - } -} diff --git a/plugin/src/main/java/me/espryth/easyjoin/plugin/action/impl/BookAction.java b/plugin/src/main/java/me/espryth/easyjoin/plugin/action/impl/BookAction.java deleted file mode 100644 index 565c4c4..0000000 --- a/plugin/src/main/java/me/espryth/easyjoin/plugin/action/impl/BookAction.java +++ /dev/null @@ -1,54 +0,0 @@ -package me.espryth.easyjoin.plugin.action.impl; - -import me.espryth.easyjoin.adapt.BookSender; -import me.espryth.easyjoin.plugin.action.AbstractAction; -import me.espryth.easyjoin.plugin.action.ActionExecutionException; -import me.espryth.easyjoin.plugin.action.ActionQueue; -import me.espryth.easyjoin.plugin.utils.YamlFile; -import org.bukkit.Bukkit; -import org.bukkit.entity.Player; -import org.bukkit.plugin.Plugin; - -import static me.espryth.easyjoin.plugin.EasyJoin.CONTAINER; - -public class BookAction extends AbstractAction { - - private final Plugin plugin; - private final YamlFile bookFile; - private final BookSender bookSender; - - public BookAction() { - plugin = CONTAINER.get(Plugin.class); - bookFile = CONTAINER.get(YamlFile.class, "book"); - bookSender = CONTAINER.get(BookSender.class); - } - - @Override - public void execute(Player player, ActionQueue queue) throws ActionExecutionException { - - String[] args = getLine().split(":"); - - if(args.length < 2) { - throw new ActionExecutionException("Incorrect size of arguments for book action"); - } - - YamlFile - - if(!bookFile.contains("book")) { - throw new ActionExecutionException("Book isn't defined! use /ej setbook"); - } - - int delay; - - try { - delay = Integer.parseInt(args[1]); - } catch (NumberFormatException e) { - throw new ActionExecutionException(getLine() + " isn't a number!"); - } - - Bukkit.getScheduler().runTaskLater(plugin, () -> - bookSender.send(player, bookFile.getItemStack("book")), - delay - ); - } -} diff --git a/plugin/src/main/java/me/espryth/easyjoin/plugin/action/impl/BroadcastAction.java b/plugin/src/main/java/me/espryth/easyjoin/plugin/action/impl/BroadcastAction.java deleted file mode 100644 index b81ec6c..0000000 --- a/plugin/src/main/java/me/espryth/easyjoin/plugin/action/impl/BroadcastAction.java +++ /dev/null @@ -1,23 +0,0 @@ -package me.espryth.easyjoin.plugin.action.impl; - -import me.clip.placeholderapi.PlaceholderAPI; -import me.espryth.easyjoin.plugin.action.AbstractAction; -import me.espryth.easyjoin.plugin.action.ActionQueue; -import me.espryth.easyjoin.plugin.utils.MessageUtils; -import org.bukkit.Bukkit; -import org.bukkit.entity.Player; - -public class BroadcastAction extends AbstractAction { - - @Override - public void execute(Player player, ActionQueue queue) { - - String newLine = MessageUtils.formatString(player, getLine()); - - if(getLine().startsWith("")) { - newLine = MessageUtils.getCenteredMessage(newLine.replace("", "")); - } - - Bukkit.broadcastMessage(newLine); - } -} diff --git a/plugin/src/main/java/me/espryth/easyjoin/plugin/action/impl/BroadcastActionbarAction.java b/plugin/src/main/java/me/espryth/easyjoin/plugin/action/impl/BroadcastActionbarAction.java deleted file mode 100644 index a08af38..0000000 --- a/plugin/src/main/java/me/espryth/easyjoin/plugin/action/impl/BroadcastActionbarAction.java +++ /dev/null @@ -1,35 +0,0 @@ -package me.espryth.easyjoin.plugin.action.impl; - -import me.espryth.easyjoin.adapt.ActionbarSender; -import me.espryth.easyjoin.plugin.action.AbstractAction; -import me.espryth.easyjoin.plugin.action.ActionExecutionException; -import me.espryth.easyjoin.plugin.action.ActionQueue; -import me.espryth.easyjoin.plugin.utils.Actionbar; -import me.espryth.easyjoin.plugin.utils.MessageUtils; -import me.espryth.easyjoin.plugin.utils.RepeatingAction; -import org.bukkit.Bukkit; -import org.bukkit.entity.Player; -import org.bukkit.plugin.Plugin; - -import static me.espryth.easyjoin.plugin.EasyJoin.CONTAINER; - -public class BroadcastActionbarAction extends AbstractAction { - - private final Plugin plugin; - private final ActionbarSender actionbarSender; - - public BroadcastActionbarAction() { - this.plugin = CONTAINER.get(Plugin.class); - this.actionbarSender = CONTAINER.get(ActionbarSender.class); - } - - @Override - public void execute(Player player, ActionQueue queue) throws ActionExecutionException { - String[] values = MessageUtils.formatString(player, getLine()).split(";"); - Actionbar actionbar = Actionbar.parse(values); - RepeatingAction.execute(plugin, actionbar.getFadeShow(), () -> { - Bukkit.getOnlinePlayers().forEach(p -> - actionbarSender.send(player, actionbar.getText())); - }); - } -} diff --git a/plugin/src/main/java/me/espryth/easyjoin/plugin/action/impl/BroadcastSound.java b/plugin/src/main/java/me/espryth/easyjoin/plugin/action/impl/BroadcastSound.java deleted file mode 100644 index b0ba5d5..0000000 --- a/plugin/src/main/java/me/espryth/easyjoin/plugin/action/impl/BroadcastSound.java +++ /dev/null @@ -1,17 +0,0 @@ -package me.espryth.easyjoin.plugin.action.impl; - -import me.espryth.easyjoin.plugin.action.AbstractAction; -import me.espryth.easyjoin.plugin.action.ActionExecutionException; -import me.espryth.easyjoin.plugin.action.ActionQueue; -import me.espryth.easyjoin.plugin.utils.Sound; -import org.bukkit.Bukkit; -import org.bukkit.entity.Player; - -public class BroadcastSound extends AbstractAction { - @Override - public void execute(Player player, ActionQueue queue) throws ActionExecutionException { - String[] values = getLine().split(";"); - Sound sound = Sound.parse(values); - Bukkit.getOnlinePlayers().forEach(p -> sound.play(p, player.getLocation())); - } -} diff --git a/plugin/src/main/java/me/espryth/easyjoin/plugin/action/impl/BroadcastTitle.java b/plugin/src/main/java/me/espryth/easyjoin/plugin/action/impl/BroadcastTitle.java deleted file mode 100644 index d535e60..0000000 --- a/plugin/src/main/java/me/espryth/easyjoin/plugin/action/impl/BroadcastTitle.java +++ /dev/null @@ -1,34 +0,0 @@ -package me.espryth.easyjoin.plugin.action.impl; - -import me.espryth.easyjoin.adapt.TitleSender; -import me.espryth.easyjoin.plugin.action.AbstractAction; -import me.espryth.easyjoin.plugin.action.ActionExecutionException; -import me.espryth.easyjoin.plugin.action.ActionQueue; -import me.espryth.easyjoin.plugin.utils.MessageUtils; -import me.espryth.easyjoin.plugin.utils.Title; -import org.bukkit.Bukkit; -import org.bukkit.entity.Player; - -import static me.espryth.easyjoin.plugin.EasyJoin.CONTAINER; - -public class BroadcastTitle extends AbstractAction { - - private final TitleSender titleSender; - - public BroadcastTitle() { - titleSender = CONTAINER.get(TitleSender.class); - } - - @Override - public void execute(Player player, ActionQueue queue) throws ActionExecutionException{ - - String[] values = MessageUtils.formatString(player, getLine()).split(";"); - - Title title = Title.parse(values); - - Bukkit.getOnlinePlayers().forEach(p -> titleSender.send( - p, title.getTitle(), title.getSubtitle(), - title.getFadeIn(), title.getFadeShow(), title.getFadeOut()) - ); - } -} diff --git a/plugin/src/main/java/me/espryth/easyjoin/plugin/action/impl/ClearChatAction.java b/plugin/src/main/java/me/espryth/easyjoin/plugin/action/impl/ClearChatAction.java deleted file mode 100644 index 54adc22..0000000 --- a/plugin/src/main/java/me/espryth/easyjoin/plugin/action/impl/ClearChatAction.java +++ /dev/null @@ -1,14 +0,0 @@ -package me.espryth.easyjoin.plugin.action.impl; - -import me.espryth.easyjoin.plugin.action.AbstractAction; -import me.espryth.easyjoin.plugin.action.ActionQueue; -import org.bukkit.entity.Player; - -public class ClearChatAction extends AbstractAction { - @Override - public void execute(Player player, ActionQueue queue) { - for (int i = 0; i < Integer.parseInt(getLine()); i++) { - player.sendMessage(" "); - } - } -} diff --git a/plugin/src/main/java/me/espryth/easyjoin/plugin/action/impl/ConsoleCommandAction.java b/plugin/src/main/java/me/espryth/easyjoin/plugin/action/impl/ConsoleCommandAction.java deleted file mode 100644 index 86c61ed..0000000 --- a/plugin/src/main/java/me/espryth/easyjoin/plugin/action/impl/ConsoleCommandAction.java +++ /dev/null @@ -1,15 +0,0 @@ -package me.espryth.easyjoin.plugin.action.impl; - -import me.clip.placeholderapi.PlaceholderAPI; -import me.espryth.easyjoin.plugin.action.AbstractAction; -import me.espryth.easyjoin.plugin.action.ActionQueue; -import org.bukkit.Bukkit; -import org.bukkit.entity.Player; - -public class ConsoleCommandAction extends AbstractAction { - @Override - public void execute(Player player, ActionQueue queue) { - Bukkit.getServer().dispatchCommand(Bukkit.getConsoleSender(), - PlaceholderAPI.setPlaceholders(player, getLine())); - } -} diff --git a/plugin/src/main/java/me/espryth/easyjoin/plugin/action/impl/DelayAction.java b/plugin/src/main/java/me/espryth/easyjoin/plugin/action/impl/DelayAction.java deleted file mode 100644 index f095cb4..0000000 --- a/plugin/src/main/java/me/espryth/easyjoin/plugin/action/impl/DelayAction.java +++ /dev/null @@ -1,35 +0,0 @@ -package me.espryth.easyjoin.plugin.action.impl; - -import me.espryth.easyjoin.plugin.action.AbstractAction; -import me.espryth.easyjoin.plugin.action.ActionExecutionException; -import me.espryth.easyjoin.plugin.action.ActionQueue; -import org.bukkit.Bukkit; -import org.bukkit.entity.Player; -import org.bukkit.plugin.Plugin; - -import static me.espryth.easyjoin.plugin.EasyJoin.CONTAINER; - -public class DelayAction extends AbstractAction { - - private final Plugin plugin; - - public DelayAction() { - plugin = CONTAINER.get(Plugin.class); - } - - @Override - public void execute(Player player, ActionQueue queue) throws ActionExecutionException { - int delay; - try { - delay = Integer.parseInt(getLine()); - } catch (NumberFormatException e) { - throw new ActionExecutionException("Delay isn't a number"); - } - queue.setPaused(true); - Bukkit.getScheduler().runTaskLater(plugin, () -> { - queue.setPaused(false); - queue.executeAll(player); - }, delay * 20L); - - } -} diff --git a/plugin/src/main/java/me/espryth/easyjoin/plugin/action/impl/FireworkAction.java b/plugin/src/main/java/me/espryth/easyjoin/plugin/action/impl/FireworkAction.java deleted file mode 100644 index 33115c0..0000000 --- a/plugin/src/main/java/me/espryth/easyjoin/plugin/action/impl/FireworkAction.java +++ /dev/null @@ -1,88 +0,0 @@ -package me.espryth.easyjoin.plugin.action.impl; - -import me.espryth.easyjoin.plugin.action.AbstractAction; -import me.espryth.easyjoin.plugin.action.ActionExecutionException; -import me.espryth.easyjoin.plugin.action.ActionQueue; -import org.bukkit.entity.Player; -import org.bukkit.Color; -import org.bukkit.FireworkEffect; -import org.bukkit.entity.EntityType; -import org.bukkit.entity.Firework; -import org.bukkit.inventory.meta.FireworkMeta; - -import java.util.ArrayList; -import java.util.List; - -public class FireworkAction extends AbstractAction { - - @Override - public void execute(Player player, ActionQueue queue) throws ActionExecutionException{ - String[] fireworkValues = getLine().split(";"); - - if(fireworkValues.length < 3) { - throw new ActionExecutionException("Incorrect size of arguments for firework"); - } - - FireworkEffect.Type fireworkEffect; - - try { - fireworkEffect = FireworkEffect.Type.valueOf(fireworkValues[0]); - } catch (Exception e) { - throw new ActionExecutionException("Invalid firework type"); - } - - Firework firework = (Firework) player.getLocation().getWorld().spawnEntity(player.getLocation(), EntityType.FIREWORK); - FireworkMeta fireworkMeta = firework.getFireworkMeta(); - - int amount = Integer.parseInt(fireworkValues[1])-1; - int power = Integer.parseInt(fireworkValues[2]); - - List colors = new ArrayList<>(); - List fades = new ArrayList<>(); - - for(int i = 3; i < fireworkValues.length; i++) { - String[] colorValues = fireworkValues[i].split(","); - - if(colorValues.length != 3) { - throw new ActionExecutionException("Invalid size of arguments for color"); - } - - int blue; - int green; - int red; - - try { - blue = Integer.parseInt(colorValues[0]); - green = Integer.parseInt(colorValues[1]); - red = Integer.parseInt(colorValues[2]); - } catch (NumberFormatException e) { - throw new ActionExecutionException("Color RGB value isn't a number"); - } - - Color color = Color.fromRGB(blue, green, red); - - if(i % 2 == 0) { - fades.add(color); - } else { - colors.add(color); - } - - } - - fireworkMeta.setPower(power); - fireworkMeta.addEffect( - FireworkEffect.builder() - .with(fireworkEffect) - .withColor(colors) - .withFade(fades) - .trail(true) - .build()); - - firework.setFireworkMeta(fireworkMeta); - - for(int i = 0; i < amount; i++) { - Firework otherFirework = (Firework) player.getLocation().getWorld().spawnEntity(player.getLocation(), EntityType.FIREWORK); - otherFirework.setFireworkMeta(fireworkMeta); - } - } -} diff --git a/plugin/src/main/java/me/espryth/easyjoin/plugin/action/impl/JsonBroadcastAction.java b/plugin/src/main/java/me/espryth/easyjoin/plugin/action/impl/JsonBroadcastAction.java deleted file mode 100644 index 0760aa0..0000000 --- a/plugin/src/main/java/me/espryth/easyjoin/plugin/action/impl/JsonBroadcastAction.java +++ /dev/null @@ -1,28 +0,0 @@ -package me.espryth.easyjoin.plugin.action.impl; - -import me.espryth.easyjoin.plugin.action.AbstractAction; -import me.espryth.easyjoin.plugin.action.ActionQueue; -import me.espryth.easyjoin.plugin.utils.MessageUtils; -import net.md_5.bungee.api.chat.BaseComponent; -import net.md_5.bungee.chat.ComponentSerializer; -import org.bukkit.Bukkit; -import org.bukkit.entity.Player; - -public class JsonBroadcastAction extends AbstractAction { - @Override - public void execute(Player player, ActionQueue queue) { - - String newLine = MessageUtils.formatString(player, getLine()); - - BaseComponent[] components; - - if(getLine().startsWith("")) { - components = MessageUtils.getCenteredComponents( - ComponentSerializer.parse(newLine.replace("", ""))); - } else { - components = ComponentSerializer.parse(newLine); - } - - Bukkit.getOnlinePlayers().forEach(p -> p.spigot().sendMessage(components)); - } -} diff --git a/plugin/src/main/java/me/espryth/easyjoin/plugin/action/impl/JsonMessageAction.java b/plugin/src/main/java/me/espryth/easyjoin/plugin/action/impl/JsonMessageAction.java deleted file mode 100644 index c97d35d..0000000 --- a/plugin/src/main/java/me/espryth/easyjoin/plugin/action/impl/JsonMessageAction.java +++ /dev/null @@ -1,28 +0,0 @@ -package me.espryth.easyjoin.plugin.action.impl; - -import me.clip.placeholderapi.PlaceholderAPI; -import me.espryth.easyjoin.plugin.action.AbstractAction; -import me.espryth.easyjoin.plugin.action.ActionQueue; -import me.espryth.easyjoin.plugin.utils.MessageUtils; -import net.md_5.bungee.api.chat.BaseComponent; -import net.md_5.bungee.chat.ComponentSerializer; -import org.bukkit.entity.Player; - -public class JsonMessageAction extends AbstractAction { - @Override - public void execute(Player player, ActionQueue queue) { - - String newLine = MessageUtils.formatString(player, getLine()); - - BaseComponent[] components; - - if(getLine().startsWith("")) { - components = MessageUtils.getCenteredComponents( - ComponentSerializer.parse(newLine.replace("", ""))); - } else { - components = ComponentSerializer.parse(newLine); - } - - player.spigot().sendMessage(components); - } -} diff --git a/plugin/src/main/java/me/espryth/easyjoin/plugin/action/impl/MessageAction.java b/plugin/src/main/java/me/espryth/easyjoin/plugin/action/impl/MessageAction.java deleted file mode 100644 index 147d6ab..0000000 --- a/plugin/src/main/java/me/espryth/easyjoin/plugin/action/impl/MessageAction.java +++ /dev/null @@ -1,22 +0,0 @@ -package me.espryth.easyjoin.plugin.action.impl; - -import me.clip.placeholderapi.PlaceholderAPI; -import me.espryth.easyjoin.plugin.action.AbstractAction; -import me.espryth.easyjoin.plugin.action.ActionQueue; -import me.espryth.easyjoin.plugin.utils.MessageUtils; -import org.bukkit.entity.Player; - -public class MessageAction extends AbstractAction { - - @Override - public void execute(Player player, ActionQueue queue) { - - String newLine = PlaceholderAPI.setPlaceholders(player, MessageUtils.colorize(getLine())); - - if(getLine().startsWith("")) { - newLine = MessageUtils.getCenteredMessage(newLine.replace("", "")); - } - - player.sendMessage(newLine); - } -} diff --git a/plugin/src/main/java/me/espryth/easyjoin/plugin/action/impl/PlayerCommandAction.java b/plugin/src/main/java/me/espryth/easyjoin/plugin/action/impl/PlayerCommandAction.java deleted file mode 100644 index 233b492..0000000 --- a/plugin/src/main/java/me/espryth/easyjoin/plugin/action/impl/PlayerCommandAction.java +++ /dev/null @@ -1,14 +0,0 @@ -package me.espryth.easyjoin.plugin.action.impl; - -import me.clip.placeholderapi.PlaceholderAPI; -import me.espryth.easyjoin.plugin.action.AbstractAction; -import me.espryth.easyjoin.plugin.action.ActionQueue; -import org.bukkit.Bukkit; -import org.bukkit.entity.Player; - -public class PlayerCommandAction extends AbstractAction { - @Override - public void execute(Player player, ActionQueue queue) { - Bukkit.getServer().dispatchCommand(player, PlaceholderAPI.setPlaceholders(player, getLine())); - } -} diff --git a/plugin/src/main/java/me/espryth/easyjoin/plugin/action/impl/SoundAction.java b/plugin/src/main/java/me/espryth/easyjoin/plugin/action/impl/SoundAction.java deleted file mode 100644 index 35ce885..0000000 --- a/plugin/src/main/java/me/espryth/easyjoin/plugin/action/impl/SoundAction.java +++ /dev/null @@ -1,16 +0,0 @@ -package me.espryth.easyjoin.plugin.action.impl; - -import me.espryth.easyjoin.plugin.action.AbstractAction; -import me.espryth.easyjoin.plugin.action.ActionExecutionException; -import me.espryth.easyjoin.plugin.action.ActionQueue; -import me.espryth.easyjoin.plugin.utils.Sound; -import org.bukkit.entity.Player; - -public class SoundAction extends AbstractAction { - @Override - public void execute(Player player, ActionQueue queue) throws ActionExecutionException { - String[] values = getLine().split(";"); - Sound sound = Sound.parse(values); - sound.play(player); - } -} diff --git a/plugin/src/main/java/me/espryth/easyjoin/plugin/action/impl/TitleAction.java b/plugin/src/main/java/me/espryth/easyjoin/plugin/action/impl/TitleAction.java deleted file mode 100644 index 39e153f..0000000 --- a/plugin/src/main/java/me/espryth/easyjoin/plugin/action/impl/TitleAction.java +++ /dev/null @@ -1,33 +0,0 @@ -package me.espryth.easyjoin.plugin.action.impl; - -import me.espryth.easyjoin.adapt.TitleSender; -import me.espryth.easyjoin.plugin.action.AbstractAction; -import me.espryth.easyjoin.plugin.action.ActionExecutionException; -import me.espryth.easyjoin.plugin.action.ActionQueue; -import me.espryth.easyjoin.plugin.utils.MessageUtils; -import me.espryth.easyjoin.plugin.utils.Title; -import org.bukkit.entity.Player; - -import static me.espryth.easyjoin.plugin.EasyJoin.CONTAINER; - -public class TitleAction extends AbstractAction { - - private final TitleSender titleSender; - - public TitleAction() { - titleSender = CONTAINER.get(TitleSender.class); - } - - @Override - public void execute(Player player, ActionQueue queue) throws ActionExecutionException { - - String[] values = MessageUtils.formatString(player, getLine()).split(";"); - - Title title = Title.parse(values); - - titleSender.send( - player, title.getTitle(), title.getSubtitle(), - title.getFadeIn(), title.getFadeShow(), title.getFadeOut() - ); - } -} diff --git a/plugin/src/main/java/me/espryth/easyjoin/plugin/command/MainCommand.java b/plugin/src/main/java/me/espryth/easyjoin/plugin/command/MainCommand.java deleted file mode 100644 index 6be2e0e..0000000 --- a/plugin/src/main/java/me/espryth/easyjoin/plugin/command/MainCommand.java +++ /dev/null @@ -1,55 +0,0 @@ -package me.espryth.easyjoin.plugin.command; - -import me.espryth.easyjoin.plugin.EasyJoin; -import me.espryth.easyjoin.plugin.utils.MessageUtils; -import me.espryth.easyjoin.plugin.utils.RepeatingAction; -import me.espryth.easyjoin.plugin.utils.YamlFile; -import org.bukkit.command.Command; -import org.bukkit.command.CommandExecutor; -import org.bukkit.command.CommandSender; -import org.bukkit.entity.Player; -import org.bukkit.inventory.ItemStack; - -import static me.espryth.easyjoin.plugin.EasyJoin.CONTAINER; - -public class MainCommand implements CommandExecutor { - - private final EasyJoin plugin; - private final YamlFile bookFile; - - public MainCommand() { - plugin = CONTAINER.get(EasyJoin.class); - bookFile = CONTAINER.get(YamlFile.class, "book"); - } - - @Override - public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) { - if(sender.hasPermission("easyjoin.admin")) { - if(args.length == 1) { - if(args[0].equalsIgnoreCase("reload")) { - plugin.reload(); - RepeatingAction.cancelAll(); - sender.sendMessage(MessageUtils.colorize("&aConfiguration reloaded!")); - return true; - } else if(args[0].equalsIgnoreCase("setbook")) { - if(sender instanceof Player) { - Player player = (Player) sender; - ItemStack item = player.getItemInHand(); - bookFile.set("book", item); - bookFile.save(); - sender.sendMessage(MessageUtils.colorize("&aBook register!")); - return true; - } - sender.sendMessage("This command only can be executed by player"); - return true; - } - } - sender.sendMessage(MessageUtils.colorize("&e&lEasy&6&lJoin &f" + plugin.getDescription().getVersion() + " by Espryth")); - sender.sendMessage(MessageUtils.colorize("&f- /ej reload")); - sender.sendMessage(MessageUtils.colorize("&f- /ej setbook")); - return true; - } - sender.sendMessage(MessageUtils.colorize("&e&lEasy&6&lJoin &f" + plugin.getDescription().getVersion() + " by Espryth")); - return true; - } -} \ No newline at end of file diff --git a/plugin/src/main/java/me/espryth/easyjoin/plugin/database/SQLSource.java b/plugin/src/main/java/me/espryth/easyjoin/plugin/database/SQLSource.java deleted file mode 100644 index b88a560..0000000 --- a/plugin/src/main/java/me/espryth/easyjoin/plugin/database/SQLSource.java +++ /dev/null @@ -1,34 +0,0 @@ -package me.espryth.easyjoin.plugin.database; - -import com.zaxxer.hikari.HikariConfig; -import com.zaxxer.hikari.HikariDataSource; -import org.bukkit.configuration.ConfigurationSection; - -import java.sql.Connection; -import java.sql.SQLException; - -public class SQLSource { - - private final HikariDataSource source; - - public SQLSource(ConfigurationSection section) { - HikariConfig hikariConfig = new HikariConfig(); - hikariConfig.setUsername(section.getString("user")); - hikariConfig.setPassword(section.getString("password")); - hikariConfig.setJdbcUrl(getUri(section)); - this.source = new HikariDataSource(hikariConfig); - } - - public Connection getConnection() throws SQLException { - return this.source.getConnection(); - } - - public HikariDataSource getSource() { - return this.source; - } - - private String getUri(ConfigurationSection section) { - return "jdbc:mysql://" + section.getString("address") + "/" + section.getString("database"); - } - -} diff --git a/plugin/src/main/java/me/espryth/easyjoin/plugin/event/PlayerFirstJoinEvent.java b/plugin/src/main/java/me/espryth/easyjoin/plugin/event/PlayerFirstJoinEvent.java deleted file mode 100644 index 6caf1f0..0000000 --- a/plugin/src/main/java/me/espryth/easyjoin/plugin/event/PlayerFirstJoinEvent.java +++ /dev/null @@ -1,25 +0,0 @@ -package me.espryth.easyjoin.plugin.event; - -import org.bukkit.entity.Player; -import org.bukkit.event.HandlerList; -import org.bukkit.event.player.PlayerEvent; -import org.jetbrains.annotations.NotNull; - -public class PlayerFirstJoinEvent extends PlayerEvent { - - private static final HandlerList HANDLER_LIST = new HandlerList(); - - public PlayerFirstJoinEvent(@NotNull Player who) { - super(who); - } - - @NotNull - @Override - public HandlerList getHandlers() { - return HANDLER_LIST; - } - - public static HandlerList getHandlerList() { - return HANDLER_LIST; - } -} diff --git a/plugin/src/main/java/me/espryth/easyjoin/plugin/event/PlayerLoginEvent.java b/plugin/src/main/java/me/espryth/easyjoin/plugin/event/PlayerLoginEvent.java deleted file mode 100644 index d5ecd2e..0000000 --- a/plugin/src/main/java/me/espryth/easyjoin/plugin/event/PlayerLoginEvent.java +++ /dev/null @@ -1,26 +0,0 @@ -package me.espryth.easyjoin.plugin.event; - -import org.bukkit.entity.Player; -import org.bukkit.event.HandlerList; -import org.bukkit.event.player.PlayerEvent; -import org.jetbrains.annotations.NotNull; - -public class PlayerLoginEvent - extends PlayerEvent { - - private static final HandlerList HANDLER_LIST = new HandlerList(); - - public PlayerLoginEvent(@NotNull Player who) { - super(who); - } - - @NotNull - @Override - public HandlerList getHandlers() { - return HANDLER_LIST; - } - - public static HandlerList getHandlerList() { - return HANDLER_LIST; - } -} diff --git a/plugin/src/main/java/me/espryth/easyjoin/plugin/event/PlayerRegisterEvent.java b/plugin/src/main/java/me/espryth/easyjoin/plugin/event/PlayerRegisterEvent.java deleted file mode 100644 index c348f95..0000000 --- a/plugin/src/main/java/me/espryth/easyjoin/plugin/event/PlayerRegisterEvent.java +++ /dev/null @@ -1,26 +0,0 @@ -package me.espryth.easyjoin.plugin.event; - -import org.bukkit.entity.Player; -import org.bukkit.event.HandlerList; -import org.bukkit.event.player.PlayerEvent; -import org.jetbrains.annotations.NotNull; - -public class PlayerRegisterEvent - extends PlayerEvent { - - private static final HandlerList HANDLER_LIST = new HandlerList(); - - public PlayerRegisterEvent(@NotNull Player who) { - super(who); - } - - @NotNull - @Override - public HandlerList getHandlers() { - return HANDLER_LIST; - } - - public static HandlerList getHandlerList() { - return HANDLER_LIST; - } -} diff --git a/plugin/src/main/java/me/espryth/easyjoin/plugin/format/Format.java b/plugin/src/main/java/me/espryth/easyjoin/plugin/format/Format.java deleted file mode 100644 index e18c970..0000000 --- a/plugin/src/main/java/me/espryth/easyjoin/plugin/format/Format.java +++ /dev/null @@ -1,65 +0,0 @@ -package me.espryth.easyjoin.plugin.format; - -import me.espryth.easyjoin.plugin.action.Action; -import me.espryth.easyjoin.plugin.action.ActionType; - -import java.util.ArrayList; -import java.util.List; - -public class Format { - - private final String identifier; - private final int priority; - private final List joinActions; - private final List quitActions; - private final List authActions; - private final boolean firstJoinFormat; - - public Format(String identifier, - int priority, - boolean firstJoinFormat) { - this.identifier = identifier; - this.priority = priority; - this.joinActions = new ArrayList<>(); - this.quitActions = new ArrayList<>(); - this.authActions = new ArrayList<>(); - this.firstJoinFormat = firstJoinFormat; - } - - public String getIdentifier() { - return identifier; - } - - public int getPriority() { - return priority; - } - - - public List getActions(ActionType actionType) { - switch (actionType) { - case AUTH: - return authActions; - case JOIN: - return joinActions; - case QUIT: - return quitActions; - } - return null; - } - - public List getJoinActions() { - return joinActions; - } - - public List getQuitActions() { - return quitActions; - } - - public List getAuthActions() { - return authActions; - } - - public boolean isFirstJoinFormat() { - return firstJoinFormat; - } -} diff --git a/plugin/src/main/java/me/espryth/easyjoin/plugin/format/FormatExecutor.java b/plugin/src/main/java/me/espryth/easyjoin/plugin/format/FormatExecutor.java deleted file mode 100644 index 7cf183d..0000000 --- a/plugin/src/main/java/me/espryth/easyjoin/plugin/format/FormatExecutor.java +++ /dev/null @@ -1,36 +0,0 @@ -package me.espryth.easyjoin.plugin.format; - -import me.espryth.easyjoin.plugin.action.Action; -import me.espryth.easyjoin.plugin.action.ActionQueue; -import me.espryth.easyjoin.plugin.action.ActionType; -import org.bukkit.entity.Player; - -import java.util.Collection; -import java.util.Collections; -import java.util.List; -import java.util.stream.Collectors; - -public class FormatExecutor { - - public void executeFormat(Player player, Collection formats, ActionType type) { - - List priorityList = formats - .stream() - .filter(format -> player.hasPermission("easyjoin." + format.getIdentifier())) - .map(Format::getPriority) - .collect(Collectors.toList()); - - if(priorityList.isEmpty()) return; - - int highPriority = Collections.max(priorityList); - - for(Format format : formats) { - if (format.getPriority() == highPriority) { - List actions = format.getActions(type); - ActionQueue queue = new ActionQueue(actions); - queue.executeAll(player); - return; - } - } - } -} diff --git a/plugin/src/main/java/me/espryth/easyjoin/plugin/format/firstjoin/FirstJoinChecker.java b/plugin/src/main/java/me/espryth/easyjoin/plugin/format/firstjoin/FirstJoinChecker.java deleted file mode 100644 index 19f53a7..0000000 --- a/plugin/src/main/java/me/espryth/easyjoin/plugin/format/firstjoin/FirstJoinChecker.java +++ /dev/null @@ -1,9 +0,0 @@ -package me.espryth.easyjoin.plugin.format.firstjoin; - -import org.bukkit.entity.Player; - -public interface FirstJoinChecker { - - boolean isFirstJoin(Player player); - -} diff --git a/plugin/src/main/java/me/espryth/easyjoin/plugin/format/firstjoin/SQLFirstJoinChecker.java b/plugin/src/main/java/me/espryth/easyjoin/plugin/format/firstjoin/SQLFirstJoinChecker.java deleted file mode 100644 index a4744b7..0000000 --- a/plugin/src/main/java/me/espryth/easyjoin/plugin/format/firstjoin/SQLFirstJoinChecker.java +++ /dev/null @@ -1,67 +0,0 @@ -package me.espryth.easyjoin.plugin.format.firstjoin; - -import me.espryth.easyjoin.plugin.database.SQLSource; -import org.bukkit.entity.Player; - -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.util.concurrent.CompletableFuture; - -public class SQLFirstJoinChecker - implements FirstJoinChecker { - - private static final String QUERY = "uuid VARCHAR(36)"; - public static final String TABLE_NAME = "EJFirstJoin"; - - private final SQLSource source; - - public SQLFirstJoinChecker(SQLSource source) { - this.source = source; - try ( - Connection connection = source.getConnection(); - PreparedStatement createTable = connection.prepareStatement("CREATE TABLE IF NOT EXISTS " + TABLE_NAME + "(" + QUERY + ")"); - ) { - createTable.executeUpdate(); - } catch (SQLException e) { - e.printStackTrace(); - }; - - } - - @Override - public boolean isFirstJoin(Player player) { - return asyncSearch(player).join(); - } - - public void updateFirstJoin(Player player) { - CompletableFuture.runAsync(() -> { - try (Connection connection = source.getConnection(); - PreparedStatement statement = connection.prepareStatement("INSERT INTO "+TABLE_NAME+" VALUE (?)"); - ){ - statement.setString(1, player.getUniqueId().toString()); - statement.executeUpdate(); - } catch (SQLException e) { - e.printStackTrace(); - } - }); - } - - private CompletableFuture asyncSearch(Player player) { - return CompletableFuture.supplyAsync(() -> { - try (Connection connection = source.getConnection(); - PreparedStatement statement = connection.prepareStatement("SELECT * FROM "+TABLE_NAME+" WHERE (uuid=?)"); - ){ - statement.setString(1, player.getUniqueId().toString()); - ResultSet result = statement.executeQuery(); - if(result.next()) { - return false; - } - } catch (SQLException e) { - e.printStackTrace(); - } - return true; - }); - } -} diff --git a/plugin/src/main/java/me/espryth/easyjoin/plugin/format/firstjoin/VanillaFirstJoinChecker.java b/plugin/src/main/java/me/espryth/easyjoin/plugin/format/firstjoin/VanillaFirstJoinChecker.java deleted file mode 100644 index df513b9..0000000 --- a/plugin/src/main/java/me/espryth/easyjoin/plugin/format/firstjoin/VanillaFirstJoinChecker.java +++ /dev/null @@ -1,12 +0,0 @@ -package me.espryth.easyjoin.plugin.format.firstjoin; - -import org.bukkit.entity.Player; - -public class VanillaFirstJoinChecker - implements FirstJoinChecker{ - - @Override - public boolean isFirstJoin(Player player) { - return !player.hasPlayedBefore(); - } -} diff --git a/plugin/src/main/java/me/espryth/easyjoin/plugin/hook/AuthMeHook.java b/plugin/src/main/java/me/espryth/easyjoin/plugin/hook/AuthMeHook.java deleted file mode 100644 index 8662270..0000000 --- a/plugin/src/main/java/me/espryth/easyjoin/plugin/hook/AuthMeHook.java +++ /dev/null @@ -1,23 +0,0 @@ -package me.espryth.easyjoin.plugin.hook; - -import fr.xephi.authme.events.LoginEvent; -import fr.xephi.authme.events.RegisterEvent; -import me.espryth.easyjoin.plugin.event.PlayerLoginEvent; -import me.espryth.easyjoin.plugin.event.PlayerRegisterEvent; -import org.bukkit.Bukkit; -import org.bukkit.event.EventHandler; -import org.bukkit.event.Listener; - -public class AuthMeHook - implements Listener { - - @EventHandler - public void handleLogin(LoginEvent event) { - Bukkit.getPluginManager().callEvent(new PlayerLoginEvent(event.getPlayer())); - } - - @EventHandler - public void handleRegister(RegisterEvent event) { - Bukkit.getPluginManager().callEvent(new PlayerRegisterEvent(event.getPlayer())); - } -} diff --git a/plugin/src/main/java/me/espryth/easyjoin/plugin/hook/PlaceholderAPIHook.java b/plugin/src/main/java/me/espryth/easyjoin/plugin/hook/PlaceholderAPIHook.java deleted file mode 100644 index 4b4a087..0000000 --- a/plugin/src/main/java/me/espryth/easyjoin/plugin/hook/PlaceholderAPIHook.java +++ /dev/null @@ -1,93 +0,0 @@ -package me.espryth.easyjoin.plugin.hook; - -import me.clip.placeholderapi.expansion.PlaceholderExpansion; -import me.espryth.easyjoin.plugin.database.SQLSource; -import org.bukkit.Bukkit; -import org.bukkit.entity.Player; -import org.bukkit.plugin.Plugin; -import org.jetbrains.annotations.NotNull; - -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.util.Optional; -import java.util.concurrent.CompletableFuture; - -import static me.espryth.easyjoin.plugin.EasyJoin.CONTAINER; -import static me.espryth.easyjoin.plugin.format.firstjoin.SQLFirstJoinChecker.TABLE_NAME; - -public class PlaceholderAPIHook - extends PlaceholderExpansion { - - private final Optional source; - private final Plugin plugin; - - public PlaceholderAPIHook() { - this.source = CONTAINER.getOptional(SQLSource.class); - this.plugin = CONTAINER.get(Plugin.class); - } - - @Override - public String onPlaceholderRequest(Player player, @NotNull String params) { - - if (player == null) { - return ""; - } - - if (params.equals("count")) { - - int count; - - if(source.isPresent()) { - count = asyncCount().join(); - } else { - count = Bukkit.getOfflinePlayers().length; - } - - return String.valueOf(count); - } - - - return null; - } - - private CompletableFuture asyncCount() { - return CompletableFuture.supplyAsync(() -> { - try (Connection connection = source.get().getConnection(); - PreparedStatement statement = connection.prepareStatement("SELECT * FROM "+TABLE_NAME); - ){ - ResultSet result = statement.executeQuery(); - int count = 0; - while(result.next()) { - count++; - } - return count; - } catch (SQLException e) { - e.printStackTrace(); - } - return 0; - }); - } - - public boolean persist() { - return true; - } - - public boolean canRegister() { - return true; - } - - public String getAuthor() { - return plugin.getDescription().getAuthors().get(0); - } - - public String getIdentifier() { - return "easyjoin"; - } - - public String getVersion() { - return plugin.getDescription().getVersion(); - } - -} diff --git a/plugin/src/main/java/me/espryth/easyjoin/plugin/hook/nLoginHook.java b/plugin/src/main/java/me/espryth/easyjoin/plugin/hook/nLoginHook.java deleted file mode 100644 index a0ed8c0..0000000 --- a/plugin/src/main/java/me/espryth/easyjoin/plugin/hook/nLoginHook.java +++ /dev/null @@ -1,24 +0,0 @@ -package me.espryth.easyjoin.plugin.hook; - -import com.nickuc.login.api.event.bukkit.auth.LoginEvent; -import com.nickuc.login.api.event.bukkit.auth.RegisterEvent; -import me.espryth.easyjoin.plugin.event.PlayerLoginEvent; -import me.espryth.easyjoin.plugin.event.PlayerRegisterEvent; -import org.bukkit.Bukkit; -import org.bukkit.event.EventHandler; -import org.bukkit.event.Listener; - -public class nLoginHook - implements Listener { - - @EventHandler - public void handleLogin(LoginEvent event) { - Bukkit.getPluginManager().callEvent(new PlayerLoginEvent(event.getPlayer())); - } - - @EventHandler - public void handleRegister(RegisterEvent event) { - Bukkit.getPluginManager().callEvent(new PlayerRegisterEvent(event.getPlayer())); - } - -} diff --git a/plugin/src/main/java/me/espryth/easyjoin/plugin/listeners/PlayerFirstJoinListener.java b/plugin/src/main/java/me/espryth/easyjoin/plugin/listeners/PlayerFirstJoinListener.java deleted file mode 100644 index 4559b90..0000000 --- a/plugin/src/main/java/me/espryth/easyjoin/plugin/listeners/PlayerFirstJoinListener.java +++ /dev/null @@ -1,51 +0,0 @@ -package me.espryth.easyjoin.plugin.listeners; - -import me.espryth.easyjoin.plugin.EasyJoin; -import me.espryth.easyjoin.plugin.action.ActionType; -import me.espryth.easyjoin.plugin.event.PlayerFirstJoinEvent; -import me.espryth.easyjoin.plugin.format.Format; -import me.espryth.easyjoin.plugin.format.FormatExecutor; -import me.espryth.easyjoin.plugin.format.firstjoin.FirstJoinChecker; -import me.espryth.easyjoin.plugin.format.firstjoin.SQLFirstJoinChecker; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.Listener; - -import java.util.Collection; -import java.util.Map; -import java.util.stream.Collectors; - -import static me.espryth.easyjoin.plugin.EasyJoin.CONTAINER; - -public class PlayerFirstJoinListener implements Listener { - - private final FirstJoinChecker firstJoinChecker; - private final FormatExecutor formatExecutor; - private final Map formatMap; - - public PlayerFirstJoinListener() { - firstJoinChecker = CONTAINER.get(FirstJoinChecker.class); - formatExecutor = CONTAINER.get(FormatExecutor.class); - formatMap = CONTAINER.get(EasyJoin.class).getFormatMap(); - } - - @EventHandler - public void onPlayerFirstJoin(PlayerFirstJoinEvent event) { - - Player player = event.getPlayer(); - - if(firstJoinChecker instanceof SQLFirstJoinChecker) { - ((SQLFirstJoinChecker) firstJoinChecker).updateFirstJoin(player); - } - - Collection firstJoinFormats = formatMap.values() - .stream() - .filter(Format::isFirstJoinFormat) - .collect(Collectors.toList()); - - if(firstJoinFormats.isEmpty()) return; - - formatExecutor.executeFormat(player, firstJoinFormats, ActionType.JOIN); - - } -} diff --git a/plugin/src/main/java/me/espryth/easyjoin/plugin/listeners/PlayerJoinListener.java b/plugin/src/main/java/me/espryth/easyjoin/plugin/listeners/PlayerJoinListener.java deleted file mode 100644 index 31f3adc..0000000 --- a/plugin/src/main/java/me/espryth/easyjoin/plugin/listeners/PlayerJoinListener.java +++ /dev/null @@ -1,55 +0,0 @@ -package me.espryth.easyjoin.plugin.listeners; - -import me.espryth.easyjoin.plugin.EasyJoin; -import me.espryth.easyjoin.plugin.action.ActionType; -import me.espryth.easyjoin.plugin.event.PlayerFirstJoinEvent; -import me.espryth.easyjoin.plugin.format.Format; -import me.espryth.easyjoin.plugin.format.FormatExecutor; -import me.espryth.easyjoin.plugin.format.firstjoin.FirstJoinChecker; -import org.bukkit.Bukkit; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.Listener; -import org.bukkit.event.player.PlayerJoinEvent; - -import java.util.Collection; -import java.util.Map; -import java.util.stream.Collectors; - -import static me.espryth.easyjoin.plugin.EasyJoin.CONTAINER; - -public class PlayerJoinListener implements Listener { - - private final FirstJoinChecker firstJoinChecker; - private final FormatExecutor formatExecutor; - private final Map formatMap; - - public PlayerJoinListener() { - firstJoinChecker = CONTAINER.get(FirstJoinChecker.class); - formatExecutor = CONTAINER.get(FormatExecutor.class); - formatMap = CONTAINER.get(EasyJoin.class).getFormatMap(); - } - - @EventHandler - public void onPlayerJoin(PlayerJoinEvent event) { - - Player player = event.getPlayer(); - - event.setJoinMessage(null); - - if(firstJoinChecker.isFirstJoin(player)) { - Bukkit.getPluginManager().callEvent(new PlayerFirstJoinEvent(player)); - return; - } - - Collection joinFormats = formatMap.values() - .stream() - .filter(format -> !format.isFirstJoinFormat()) - .collect(Collectors.toList()); - - if(joinFormats.isEmpty()) return; - - formatExecutor.executeFormat(player, joinFormats, ActionType.JOIN); - } - -} diff --git a/plugin/src/main/java/me/espryth/easyjoin/plugin/listeners/PlayerQuitListener.java b/plugin/src/main/java/me/espryth/easyjoin/plugin/listeners/PlayerQuitListener.java deleted file mode 100644 index 5c2433c..0000000 --- a/plugin/src/main/java/me/espryth/easyjoin/plugin/listeners/PlayerQuitListener.java +++ /dev/null @@ -1,44 +0,0 @@ -package me.espryth.easyjoin.plugin.listeners; - -import me.espryth.easyjoin.plugin.EasyJoin; -import me.espryth.easyjoin.plugin.action.ActionType; -import me.espryth.easyjoin.plugin.format.Format; -import me.espryth.easyjoin.plugin.format.FormatExecutor; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.Listener; -import org.bukkit.event.player.PlayerQuitEvent; - -import java.util.*; -import java.util.stream.Collectors; - -import static me.espryth.easyjoin.plugin.EasyJoin.CONTAINER; - -public class PlayerQuitListener implements Listener { - - private final FormatExecutor formatExecutor; - private final Map formatMap; - - public PlayerQuitListener() { - formatExecutor = CONTAINER.get(FormatExecutor.class); - formatMap = CONTAINER.get(EasyJoin.class).getFormatMap(); - } - - @EventHandler - public void onPlayerQuit(PlayerQuitEvent event) { - - Player player = event.getPlayer(); - - event.setQuitMessage(null); - - Collection quitFormats = formatMap.values() - .stream() - .filter(format -> !format.isFirstJoinFormat()) - .collect(Collectors.toList()); - - if(quitFormats.isEmpty()) return; - - formatExecutor.executeFormat(player, quitFormats, ActionType.QUIT); - } - -} diff --git a/plugin/src/main/java/me/espryth/easyjoin/plugin/listeners/authme/PlayerLoginListener.java b/plugin/src/main/java/me/espryth/easyjoin/plugin/listeners/authme/PlayerLoginListener.java deleted file mode 100644 index 702f211..0000000 --- a/plugin/src/main/java/me/espryth/easyjoin/plugin/listeners/authme/PlayerLoginListener.java +++ /dev/null @@ -1,41 +0,0 @@ -package me.espryth.easyjoin.plugin.listeners.authme; - -import me.espryth.easyjoin.plugin.EasyJoin; -import me.espryth.easyjoin.plugin.action.ActionType; -import me.espryth.easyjoin.plugin.event.PlayerLoginEvent; -import me.espryth.easyjoin.plugin.format.Format; -import me.espryth.easyjoin.plugin.format.FormatExecutor; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.Listener; - -import java.util.Collection; -import java.util.Map; -import java.util.stream.Collectors; - -import static me.espryth.easyjoin.plugin.EasyJoin.CONTAINER; - -public class PlayerLoginListener implements Listener { - - private final FormatExecutor formatExecutor; - private final Map formatMap; - - public PlayerLoginListener() { - formatExecutor = CONTAINER.get(FormatExecutor.class); - formatMap = CONTAINER.get(EasyJoin.class).getFormatMap(); - } - - @EventHandler - public void onLogin(PlayerLoginEvent event) { - Player player = event.getPlayer(); - - Collection loginFormats = formatMap.values() - .stream() - .filter(format -> !format.isFirstJoinFormat()) - .collect(Collectors.toList()); - - if(loginFormats.isEmpty()) return; - - formatExecutor.executeFormat(player, loginFormats, ActionType.AUTH); - } -} diff --git a/plugin/src/main/java/me/espryth/easyjoin/plugin/listeners/authme/PlayerRegisterListener.java b/plugin/src/main/java/me/espryth/easyjoin/plugin/listeners/authme/PlayerRegisterListener.java deleted file mode 100644 index 4295b90..0000000 --- a/plugin/src/main/java/me/espryth/easyjoin/plugin/listeners/authme/PlayerRegisterListener.java +++ /dev/null @@ -1,41 +0,0 @@ -package me.espryth.easyjoin.plugin.listeners.authme; - -import me.espryth.easyjoin.plugin.EasyJoin; -import me.espryth.easyjoin.plugin.action.ActionType; -import me.espryth.easyjoin.plugin.event.PlayerRegisterEvent; -import me.espryth.easyjoin.plugin.format.Format; -import me.espryth.easyjoin.plugin.format.FormatExecutor; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.Listener; - -import java.util.Collection; -import java.util.Map; -import java.util.stream.Collectors; - -import static me.espryth.easyjoin.plugin.EasyJoin.CONTAINER; - -public class PlayerRegisterListener implements Listener { - - private final FormatExecutor formatExecutor; - private final Map formatMap; - - public PlayerRegisterListener() { - formatExecutor = CONTAINER.get(FormatExecutor.class); - formatMap = CONTAINER.get(EasyJoin.class).getFormatMap(); - } - - @EventHandler - public void onRegister(PlayerRegisterEvent event) { - Player player = event.getPlayer(); - - Collection registerFormats = formatMap.values() - .stream() - .filter(Format::isFirstJoinFormat) - .collect(Collectors.toList()); - - if(registerFormats.isEmpty()) return; - - formatExecutor.executeFormat(player, registerFormats, ActionType.AUTH); - } -} diff --git a/plugin/src/main/java/me/espryth/easyjoin/plugin/loader/FormatLoader.java b/plugin/src/main/java/me/espryth/easyjoin/plugin/loader/FormatLoader.java deleted file mode 100644 index 767fe9f..0000000 --- a/plugin/src/main/java/me/espryth/easyjoin/plugin/loader/FormatLoader.java +++ /dev/null @@ -1,84 +0,0 @@ -package me.espryth.easyjoin.plugin.loader; - -import me.espryth.easyjoin.plugin.EasyJoin; -import me.espryth.easyjoin.plugin.action.Action; -import me.espryth.easyjoin.plugin.action.ActionType; -import me.espryth.easyjoin.plugin.format.Format; -import me.espryth.easyjoin.plugin.utils.YamlFile; - -import java.util.Map; -import java.util.Optional; -import java.util.logging.Level; - -import static me.espryth.easyjoin.plugin.EasyJoin.CONTAINER; - -public class FormatLoader implements Loader { - - private final EasyJoin plugin; - private final YamlFile configFile; - private final Map formatMap; - - public FormatLoader() { - plugin = CONTAINER.get(EasyJoin.class); - configFile = CONTAINER.get(YamlFile.class, "config"); - formatMap = plugin.getFormatMap(); - } - - @Override - public void load() { - - for(String key : configFile.getConfigurationSection("Formats").getKeys(false)) { - - int priority = configFile.getInt("Formats." + key + ".priority"); - boolean isFirstJoinFormat = false; - if (configFile.contains("Formats." + key + ".isFirstJoinFormat")) { - isFirstJoinFormat = configFile.getBoolean("Formats." + key + ".isFirstJoinFormat"); - } - - Format format = new Format(key, priority, isFirstJoinFormat); - - loadActions(format, key, ActionType.AUTH); - loadActions(format, key, ActionType.JOIN); - loadActions(format, key, ActionType.QUIT); - - formatMap.put(key, format); - } - } - - private void loadActions(Format format, String key, ActionType type) { - - String path = "Formats." + key + "." + type.name().toLowerCase() + ".actions"; - - if (!configFile.contains(path)) { - return; - } - - for(String s : configFile.getStringList(path)) { - - String[] strings = s.split("\\s+"); - Optional optionalAction = CONTAINER.getOptional(Action.class, strings[0]); - - if(!optionalAction.isPresent()) { - plugin.getLogger().log(Level.WARNING, "A action with identifier " + strings[0] + " don't exists!"); - continue; - } - - Action action = optionalAction.get().duplicate(); - - String line = s.replace(strings[0] + " ", ""); - action.setLine(line); - - switch (type) { - case AUTH: - format.getAuthActions().add(action); - break; - case JOIN: - format.getJoinActions().add(action); - break; - case QUIT: - format.getQuitActions().add(action); - break; - } - } - } -} diff --git a/plugin/src/main/java/me/espryth/easyjoin/plugin/loader/ListenerLoader.java b/plugin/src/main/java/me/espryth/easyjoin/plugin/loader/ListenerLoader.java deleted file mode 100644 index 45e018c..0000000 --- a/plugin/src/main/java/me/espryth/easyjoin/plugin/loader/ListenerLoader.java +++ /dev/null @@ -1,52 +0,0 @@ -package me.espryth.easyjoin.plugin.loader; - -import me.espryth.easyjoin.plugin.hook.AuthMeHook; -import me.espryth.easyjoin.plugin.hook.nLoginHook; -import me.espryth.easyjoin.plugin.listeners.PlayerFirstJoinListener; -import me.espryth.easyjoin.plugin.listeners.PlayerJoinListener; -import me.espryth.easyjoin.plugin.listeners.PlayerQuitListener; -import me.espryth.easyjoin.plugin.listeners.authme.PlayerLoginListener; -import me.espryth.easyjoin.plugin.listeners.authme.PlayerRegisterListener; -import me.espryth.easyjoin.plugin.utils.YamlFile; -import org.bukkit.Bukkit; -import org.bukkit.plugin.Plugin; -import org.bukkit.plugin.PluginManager; - -import java.util.logging.Level; - -import static me.espryth.easyjoin.plugin.EasyJoin.CONTAINER; - -public class ListenerLoader implements Loader { - - private final Plugin plugin; - private final YamlFile configFile; - - public ListenerLoader() { - plugin = CONTAINER.get(Plugin.class); - configFile = CONTAINER.get(YamlFile.class, "config"); - } - - @Override - public void load() { - - PluginManager pm = Bukkit.getPluginManager(); - pm.registerEvents(new PlayerJoinListener(), plugin); - pm.registerEvents(new PlayerFirstJoinListener(), plugin); - pm.registerEvents(new PlayerQuitListener(), plugin); - - String hook = configFile.getString("Hook", ""); - - if (Bukkit.getPluginManager().getPlugin("AuthMe") != null) { - pm.registerEvents(new AuthMeHook(), plugin); - plugin.getLogger().log(Level.INFO, "Successfully hooked with AuthMe"); - } else if(Bukkit.getPluginManager().getPlugin("nLogin") != null) { - pm.registerEvents(new nLoginHook(), plugin); - plugin.getLogger().log(Level.INFO, "Successfully hooked with nLogin"); - } - - pm.registerEvents(new PlayerLoginListener(), plugin); - pm.registerEvents(new PlayerRegisterListener(), plugin); - - } - -} diff --git a/plugin/src/main/java/me/espryth/easyjoin/plugin/loader/Loader.java b/plugin/src/main/java/me/espryth/easyjoin/plugin/loader/Loader.java deleted file mode 100644 index b94520e..0000000 --- a/plugin/src/main/java/me/espryth/easyjoin/plugin/loader/Loader.java +++ /dev/null @@ -1,5 +0,0 @@ -package me.espryth.easyjoin.plugin.loader; - -public interface Loader { - void load(); -} diff --git a/plugin/src/main/java/me/espryth/easyjoin/plugin/module/ActionModule.java b/plugin/src/main/java/me/espryth/easyjoin/plugin/module/ActionModule.java deleted file mode 100644 index 4775abb..0000000 --- a/plugin/src/main/java/me/espryth/easyjoin/plugin/module/ActionModule.java +++ /dev/null @@ -1,30 +0,0 @@ -package me.espryth.easyjoin.plugin.module; - -import dev.henko.storance.Binder; -import dev.henko.storance.StoranceModule; -import me.espryth.easyjoin.plugin.action.Action; -import me.espryth.easyjoin.plugin.action.impl.*; - -public class ActionModule implements StoranceModule { - - @Override - public void configure(Binder binder) { - binder.bind(Action.class).named("[ACTIONBAR]").toInstance(new ActionbarAction()); - binder.bind(Action.class).named("[BROADCAST_ACTIONBAR]").toInstance(new BroadcastActionbarAction()); - binder.bind(Action.class).named("[BROADCAST]").toInstance(new BroadcastAction()); - binder.bind(Action.class).named("[JSON_BROADCAST]").toInstance(new JsonBroadcastAction()); - binder.bind(Action.class).named("[MESSAGE]").toInstance(new MessageAction()); - binder.bind(Action.class).named("[JSON_MESSAGE]").toInstance(new JsonMessageAction()); - binder.bind(Action.class).named("[TITLE]").toInstance(new TitleAction()); - binder.bind(Action.class).named("[BROADCAST_TITLE]").toInstance(new BroadcastTitle()); - binder.bind(Action.class).named("[SOUND]").toInstance(new SoundAction()); - binder.bind(Action.class).named("[BROADCAST_SOUND]").toInstance(new BroadcastSound()); - binder.bind(Action.class).named("[CLEARCHAT]").toInstance(new ClearChatAction()); - binder.bind(Action.class).named("[BOOK]").toInstance(new BookAction()); - binder.bind(Action.class).named("[PLAYER]").toInstance( new PlayerCommandAction()); - binder.bind(Action.class).named("[CONSOLE]").toInstance(new ConsoleCommandAction()); - binder.bind(Action.class).named("[FIREWORK]").toInstance(new FireworkAction()); - binder.bind(Action.class).named("[DELAY]").toInstance(new DelayAction()); - } - -} diff --git a/plugin/src/main/java/me/espryth/easyjoin/plugin/module/AdapterModuleFactory.java b/plugin/src/main/java/me/espryth/easyjoin/plugin/module/AdapterModuleFactory.java deleted file mode 100644 index bc1147e..0000000 --- a/plugin/src/main/java/me/espryth/easyjoin/plugin/module/AdapterModuleFactory.java +++ /dev/null @@ -1,41 +0,0 @@ -package me.espryth.easyjoin.plugin.module; - -import dev.henko.storance.StoranceModule; - -import java.lang.reflect.Constructor; -import java.lang.reflect.InvocationTargetException; - -import static me.espryth.easyjoin.plugin.utils.ServerVersionProvider.*; - -public class AdapterModuleFactory { - - private static final Constructor CONSTRUCTOR; - - static { - - String constructorPackage = "me.espryth.easyjoin.adapt."; - if(SERVER_VERSION_INT > 13) { - constructorPackage += "newer.NewerAdapterModule"; - } else { - constructorPackage += "legacy.v" + SERVER_VERSION + ".AdapterModule" + SERVER_VERSION; - } - - try { - CONSTRUCTOR = Class - .forName(constructorPackage) - .getConstructor(); - } catch (NoSuchMethodException | ClassNotFoundException e) { - throw new IllegalArgumentException("EasyJoin cannot be executed on this server version!"); - } - } - - - public static StoranceModule create() { - try { - return (StoranceModule) CONSTRUCTOR.newInstance(); - } catch (InstantiationException | IllegalAccessException | InvocationTargetException e) { - throw new RuntimeException("An error has occurred while getting the AdapterModule", e); - } - } - -} diff --git a/plugin/src/main/java/me/espryth/easyjoin/plugin/module/FirstJoinCheckerModule.java b/plugin/src/main/java/me/espryth/easyjoin/plugin/module/FirstJoinCheckerModule.java deleted file mode 100644 index f02f2c6..0000000 --- a/plugin/src/main/java/me/espryth/easyjoin/plugin/module/FirstJoinCheckerModule.java +++ /dev/null @@ -1,34 +0,0 @@ -package me.espryth.easyjoin.plugin.module; - -import dev.henko.storance.Binder; -import dev.henko.storance.StoranceModule; -import me.espryth.easyjoin.plugin.database.SQLSource; -import me.espryth.easyjoin.plugin.format.firstjoin.FirstJoinChecker; -import me.espryth.easyjoin.plugin.format.firstjoin.SQLFirstJoinChecker; -import me.espryth.easyjoin.plugin.format.firstjoin.VanillaFirstJoinChecker; -import me.espryth.easyjoin.plugin.utils.YamlFile; - -public class FirstJoinCheckerModule implements StoranceModule { - - private final YamlFile config; - private final YamlFile credentials; - - public FirstJoinCheckerModule(YamlFile config, YamlFile credentials) { - this.config = config; - this.credentials = credentials; - } - - @Override - public void configure(Binder binder) { - String mode = config.getString("FirstJoinMode", "VANILLA"); - FirstJoinChecker checker; - if(mode.equalsIgnoreCase("MYSQL")) { - SQLSource source = new SQLSource(credentials.getConfigurationSection("credentials")); - binder.bind(SQLSource.class).toInstance(source); - checker = new SQLFirstJoinChecker(source); - } else { - checker = new VanillaFirstJoinChecker(); - } - binder.bind(FirstJoinChecker.class).toInstance(checker); - } -} diff --git a/plugin/src/main/java/me/espryth/easyjoin/plugin/module/MainModule.java b/plugin/src/main/java/me/espryth/easyjoin/plugin/module/MainModule.java deleted file mode 100644 index cf63f80..0000000 --- a/plugin/src/main/java/me/espryth/easyjoin/plugin/module/MainModule.java +++ /dev/null @@ -1,36 +0,0 @@ -package me.espryth.easyjoin.plugin.module; - -import dev.henko.storance.Binder; -import dev.henko.storance.StoranceModule; -import me.espryth.easyjoin.plugin.EasyJoin; -import me.espryth.easyjoin.plugin.format.FormatExecutor; -import me.espryth.easyjoin.plugin.utils.YamlFile; -import org.bukkit.plugin.Plugin; - -public class MainModule implements StoranceModule { - - private final EasyJoin plugin; - - public MainModule(EasyJoin plugin) { - this.plugin = plugin; - } - - @Override - public void configure(Binder binder) { - - binder.bind(Plugin.class).toInstance(plugin); - binder.bind(EasyJoin.class).toInstance(plugin); - - binder.install(AdapterModuleFactory.create()); - - YamlFile config = new YamlFile(plugin, "config"); - YamlFile credentials = new YamlFile(plugin, "credentials"); - binder.bind(YamlFile.class).named("config").toInstance(config); - binder.bind(YamlFile.class).named("book").toInstance(new YamlFile(plugin, "book")); - - binder.bind(FormatExecutor.class).toInstance(new FormatExecutor()); - - binder.install(new ActionModule()); - binder.install(new FirstJoinCheckerModule(config, credentials)); - } -} diff --git a/plugin/src/main/java/me/espryth/easyjoin/plugin/utils/Actionbar.java b/plugin/src/main/java/me/espryth/easyjoin/plugin/utils/Actionbar.java deleted file mode 100644 index 8dc728c..0000000 --- a/plugin/src/main/java/me/espryth/easyjoin/plugin/utils/Actionbar.java +++ /dev/null @@ -1,40 +0,0 @@ -package me.espryth.easyjoin.plugin.utils; - -import me.espryth.easyjoin.plugin.action.ActionExecutionException; - -public class Actionbar { - - private final String text; - private final int fadeShow; - - public Actionbar( - String text, - int fadeShow - ) { - this.text = text; - this.fadeShow = fadeShow; - } - - public static Actionbar parse(String[] args) throws ActionExecutionException { - - if(args.length < 2) { - throw new ActionExecutionException("Incorrect size of arguments for actionbar"); - } - - try { - String text = args[0]; - int fadeShow = Integer.parseInt(args[1]); - return new Actionbar(text, fadeShow); - } catch (NumberFormatException e) { - throw new ActionExecutionException("Fade show isn't a number!"); - } - } - - public String getText() { - return text; - } - - public int getFadeShow() { - return fadeShow; - } -} diff --git a/plugin/src/main/java/me/espryth/easyjoin/plugin/utils/RepeatingAction.java b/plugin/src/main/java/me/espryth/easyjoin/plugin/utils/RepeatingAction.java deleted file mode 100644 index 926a3ff..0000000 --- a/plugin/src/main/java/me/espryth/easyjoin/plugin/utils/RepeatingAction.java +++ /dev/null @@ -1,52 +0,0 @@ -package me.espryth.easyjoin.plugin.utils; - -import org.bukkit.Bukkit; -import org.bukkit.plugin.Plugin; -import org.bukkit.scheduler.BukkitTask; - -import java.util.Queue; -import java.util.concurrent.ConcurrentLinkedDeque; - -public class RepeatingAction { - - private static final Queue CURRENT = new ConcurrentLinkedDeque<>(); - - private final Plugin plugin; - private int seconds; - - private BukkitTask task; - - public RepeatingAction(Plugin plugin, int seconds) { - this.plugin = plugin; - this.seconds = seconds; - } - - public static void execute(Plugin plugin, int seconds, Runnable runnable) { - RepeatingAction repeatingAction= new RepeatingAction(plugin, seconds); - repeatingAction.execute(runnable); - CURRENT.add(repeatingAction); - } - - public static void cancelAll() { - CURRENT.forEach(RepeatingAction::cancel); - } - - public void execute(Runnable runnable) { - task = Bukkit.getScheduler().runTaskTimer(plugin, () -> { - if(seconds > 0) { - seconds--; - runnable.run(); - } else { - task.cancel(); - } - },1, 20); - } - - public void cancel() { - if(CURRENT.remove(this)) { - task.cancel(); - } - } - - -} diff --git a/plugin/src/main/java/me/espryth/easyjoin/plugin/utils/ServerVersionProvider.java b/plugin/src/main/java/me/espryth/easyjoin/plugin/utils/ServerVersionProvider.java deleted file mode 100644 index 4675b78..0000000 --- a/plugin/src/main/java/me/espryth/easyjoin/plugin/utils/ServerVersionProvider.java +++ /dev/null @@ -1,17 +0,0 @@ -package me.espryth.easyjoin.plugin.utils; - -import org.bukkit.Bukkit; - -public class ServerVersionProvider { - public static final String SERVER_VERSION = - Bukkit.getServer() - .getClass().getPackage() - .getName().split("\\.")[3] - .substring(1); - - public static final int SERVER_VERSION_INT = Integer.parseInt( - SERVER_VERSION - .replace("1_", "") - .replaceAll("_R\\d", "") - ); -} diff --git a/plugin/src/main/java/me/espryth/easyjoin/plugin/utils/Sound.java b/plugin/src/main/java/me/espryth/easyjoin/plugin/utils/Sound.java deleted file mode 100644 index 0d4f0b9..0000000 --- a/plugin/src/main/java/me/espryth/easyjoin/plugin/utils/Sound.java +++ /dev/null @@ -1,49 +0,0 @@ -package me.espryth.easyjoin.plugin.utils; - -import me.espryth.easyjoin.plugin.action.ActionExecutionException; -import org.bukkit.Location; -import org.bukkit.entity.Player; - -public class Sound { - - private final org.bukkit.Sound sound; - private final float pitch; - private final float yaw; - - public Sound(org.bukkit.Sound sound, float pitch, float yaw) { - this.sound = sound; - this.pitch = pitch; - this.yaw = yaw; - } - - public static Sound parse(String[] args) throws ActionExecutionException{ - - if(args.length < 3) { - throw new ActionExecutionException("Incorrect size of arguments for sound"); - } - - try { - org.bukkit.Sound sound = org.bukkit.Sound.valueOf(args[0]); - float pitch = Float.parseFloat(args[1]); - float volume = Float.parseFloat(args[2]); - return new Sound(sound, pitch, volume); - } catch (Exception e) { - String exceptionMessage; - if(e instanceof NumberFormatException) { - exceptionMessage = "Pitch or volume isn't a number!"; - } else { - exceptionMessage = "Invalid sound"; - } - throw new ActionExecutionException(exceptionMessage); - } - } - - public void play(Player player) { - play(player, player.getLocation()); - } - - public void play(Player player, Location location) { - player.playSound(location, sound, pitch, yaw); - } - -} diff --git a/plugin/src/main/java/me/espryth/easyjoin/plugin/utils/Title.java b/plugin/src/main/java/me/espryth/easyjoin/plugin/utils/Title.java deleted file mode 100644 index 8c5e1be..0000000 --- a/plugin/src/main/java/me/espryth/easyjoin/plugin/utils/Title.java +++ /dev/null @@ -1,67 +0,0 @@ -package me.espryth.easyjoin.plugin.utils; - -import me.espryth.easyjoin.plugin.action.ActionExecutionException; - -public class Title { - - private final String title; - private final String subtitle; - private final int fadeIn; - private final int fadeShow; - private final int fadeOut; - - public Title( - String title, - String subtitle, - int fadeIn, - int fadeShow, - int fadeOut - ) { - this.title = title; - this.subtitle = subtitle; - this.fadeIn = fadeIn; - this.fadeShow = fadeShow; - this.fadeOut = fadeOut; - } - - public static Title parse(String[] args) throws ActionExecutionException{ - - if(args.length < 5) { - throw new ActionExecutionException("Incorrect size of arguments for title"); - } - - try { - String title = args[0]; - String subtitle = args[1]; - int fadeIn = Integer.parseInt(args[2]); - int fadeShow = Integer.parseInt(args[3]); - int fadeOut = Integer.parseInt(args[4]); - return new Title( - title, subtitle, fadeIn, - fadeShow, fadeOut - ); - } catch (NumberFormatException e) { - throw new ActionExecutionException("Fade isn't a number!"); - } - } - - public String getTitle() { - return title; - } - - public String getSubtitle() { - return subtitle; - } - - public int getFadeIn() { - return fadeIn; - } - - public int getFadeShow() { - return fadeShow; - } - - public int getFadeOut() { - return fadeOut; - } -} diff --git a/plugin/src/main/java/me/espryth/easyjoin/plugin/utils/YamlFile.java b/plugin/src/main/java/me/espryth/easyjoin/plugin/utils/YamlFile.java deleted file mode 100644 index 6c13df3..0000000 --- a/plugin/src/main/java/me/espryth/easyjoin/plugin/utils/YamlFile.java +++ /dev/null @@ -1,72 +0,0 @@ -package me.espryth.easyjoin.plugin.utils; - -import org.bukkit.configuration.InvalidConfigurationException; -import org.bukkit.configuration.file.YamlConfiguration; -import org.bukkit.plugin.Plugin; - -import java.io.File; -import java.io.IOException; -import java.util.logging.Level; - -public class YamlFile extends YamlConfiguration { - private final String fileName; - - private final Plugin plugin; - - private final File folder; - - public YamlFile(Plugin plugin, String fileName, String fileExtension, File folder) { - this.folder = folder; - this.plugin = plugin; - this.fileName = fileName + (fileName.endsWith(fileExtension) ? "" : fileExtension); - createFile(); - } - - public YamlFile(Plugin plugin, String fileName) { - this(plugin, fileName, ".yml"); - } - - public YamlFile(Plugin plugin, String fileName, String fileExtension) { - this(plugin, fileName, fileExtension, plugin.getDataFolder()); - } - - private void createFile() { - try { - File file = new File(this.folder, this.fileName); - if (file.exists()) { - load(file); - save(file); - return; - } - if (this.plugin.getResource(this.fileName) != null) { - this.plugin.saveResource(this.fileName, false); - } else { - save(file); - } - load(file); - } catch (InvalidConfigurationException | IOException e) { - this.plugin.getLogger().log(Level.SEVERE, "Creation of Configuration '" + this.fileName + "' failed.", e); - } - } - - public void save() { - File folder = this.plugin.getDataFolder(); - File file = new File(folder, this.fileName); - try { - save(file); - } catch (IOException e) { - this.plugin.getLogger().log(Level.SEVERE, "Save of the file '" + this.fileName + "' failed.", e); - } - } - - public void reload() { - File folder = this.plugin.getDataFolder(); - File file = new File(folder, this.fileName); - try { - - load(file); - } catch (IOException | InvalidConfigurationException e) { - this.plugin.getLogger().log(Level.SEVERE, "Reload of the file '" + this.fileName + "' failed.", e); - } - } -} diff --git a/plugin/src/main/resources/book.yml b/plugin/src/main/resources/book.yml deleted file mode 100644 index e69de29..0000000 diff --git a/plugin/src/main/resources/config.yml b/plugin/src/main/resources/config.yml deleted file mode 100644 index 697c053..0000000 --- a/plugin/src/main/resources/config.yml +++ /dev/null @@ -1,56 +0,0 @@ -# -# - '[BROADCAST] This send a message to all online players.' -# - '[JSON_BROADCAST] {"text":"Send broadcast json!!"}' # You can create json formats here: https://minecraftjson.com/ -# - '[MESSAGE] This send a message to the join player' -# - '[JSON_MESSAGE] {"text":"Click to go to our discord","clickEvent":{"action":"open_url","value":"https://discord.gg/hPNYUMUauD"}}}' -# - '[TITLE] Title;Subtitle;FadeIn;FadeShow;FadeOut' -# - '[BROADCAST_TITLE] Title;Subtitle;FadeIn;FadeShow;FadeOut' -# - '[ACTIONBAR] Message;FadeShow' -# - '[BROADCAST_ACTIONBAR] Message;FadeShow' -# - '[SOUND] Sound;pitch;volume' -# - '[BROADCAST_SOUND] Sound;pitch;volume' # https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/Sound.html -# - '[PLAYER] me Hello!' # This execute a player command -# - '[CONSOLE] give %player_name% diamond 1' -# - '[CLEARCHAT] 10' #Clear the player chat on join with custom lines. -# - '[BOOK] delay' #It opens the book on book.yml to add it you need write a book and use /ej setbook! -# - '[FIREWORK] Type;amount;power;255,0,255;255,0,255;255,0,255;255,0,255' #You can customize the firework with RGB values (R,G,B), the first RGB color is a firework color and the second is a fade! -# - '[DELAY] 10' #Add delay between actions (the delay is in seconds) -# -# First join modes (VANILLA, MYSQL) -# If first join mode is MySQL you need to configure your credentials in credentials.yml -FirstJoinMode: VANILLA - -Formats: -# permission: easyjoin.admin - admin: - priority: 10 - join: - actions: -# Add centered messages adding at the start of the message. -# [BROADCAST] Centered message! -# [JSON_BROADCAST] {"text":"A centered json message!"} - - '[BROADCAST] &8(&a+&8) &c&lADMIN &f%player_name%' - - '[SOUND] LEVEL_UP;10;5' - - '[ACTIONBAR] &ashop.example.com;5' - - '[JSON_MESSAGE] {"text":"&9Click to go to our discord","clickEvent":{"action":"open_url","value":"https://discord.gg/hPNYUMUauD"}}' -# If you are using auth plugin you can add auth actions. (only with AuthMe and nLogin) -# auth: -# actions: -# - '[BROADCAST] This is a auth action!' - quit: - actions: - - '[BROADCAST] &8(&c-&8) &f%player_name%' -# permission: easyjoin.default - default: -# You can transform any format to first join format -# isFirstJoinFormat: true - priority: 5 - join: - actions: - - '[BROADCAST] &8(&a+&8) &f%player_name%' - - '[SOUND] LEVEL_UP;10;5' - - '[ACTIONBAR] &ashop.example.com' - - '[FIREWORK] STAR;10;2;255,120,200;100,50,30;10,20,30;40;10;20' - quit: - actions: - - '[BROADCAST] &8(&c-&8) &f%player_name%' \ No newline at end of file diff --git a/plugin/src/main/resources/credentials.yml b/plugin/src/main/resources/credentials.yml deleted file mode 100644 index 3ca5179..0000000 --- a/plugin/src/main/resources/credentials.yml +++ /dev/null @@ -1,5 +0,0 @@ -credentials: - database: easyjoin - user: root - password: password - address: localhost:3306 \ No newline at end of file diff --git a/plugin/src/main/resources/plugin.yml b/plugin/src/main/resources/plugin.yml deleted file mode 100644 index 2c7577b..0000000 --- a/plugin/src/main/resources/plugin.yml +++ /dev/null @@ -1,12 +0,0 @@ -name: EasyJoin -main: me.espryth.easyjoin.plugin.EasyJoin -version: 2.2.2 -api-version: 1.13 -author: Espryth -depend: [PlaceholderAPI] -softdepend: [AuthMe, nLogin] -commands: - easyjoin: - usage: / - aliases: - - ej \ No newline at end of file diff --git a/pom.xml b/pom.xml deleted file mode 100644 index a794cd4..0000000 --- a/pom.xml +++ /dev/null @@ -1,70 +0,0 @@ - - - 4.0.0 - - me.espryth.easyjoin - easyjoin-parent - 2.2.2 - pom - - - - - org.apache.maven.plugins - maven-shade-plugin - 3.2.4 - - - shade - package - - shade - - - - - - - org.apache.maven.plugins - maven-compiler-plugin - - 8 - 8 - -proc:none - - - - - - - plugin - adapt - - - - - codemc-repo - https://repo.codemc.io/repository/nms/ - - - - - - dev.henko - storance - 0.1.1-SNAPSHOT - - - - - UTF-8 - UTF-8 - 1.8 - 1.8 - 1.8 - 1.8 - - - \ No newline at end of file diff --git a/settings.gradle.kts b/settings.gradle.kts new file mode 100644 index 0000000..f7f868d --- /dev/null +++ b/settings.gradle.kts @@ -0,0 +1 @@ +rootProject.name = "EasyJoin" diff --git a/src/main/java/me/espryth/easyjoin/EasyJoinPlugin.java b/src/main/java/me/espryth/easyjoin/EasyJoinPlugin.java new file mode 100644 index 0000000..3576b2a --- /dev/null +++ b/src/main/java/me/espryth/easyjoin/EasyJoinPlugin.java @@ -0,0 +1,28 @@ +package me.espryth.easyjoin; + +import com.google.inject.Binder; +import com.google.inject.Scopes; +import com.thewinterframework.paper.PaperWinterPlugin; +import com.thewinterframework.plugin.WinterBootPlugin; +import com.thewinterframework.service.annotation.Service; + +@WinterBootPlugin +public final class EasyJoinPlugin extends PaperWinterPlugin { + + private static EasyJoinPlugin instance; + + public static T getService(Class type) { + return instance.getInjector().getInstance(type); + } + + @Override + public void onPluginLoad() { + super.onPluginLoad(); + instance = this; + } + + @Override + public void configure(Binder binder) { + binder.bindScope(Service.class, Scopes.SINGLETON); + } +} diff --git a/src/main/java/me/espryth/easyjoin/action/Action.java b/src/main/java/me/espryth/easyjoin/action/Action.java new file mode 100644 index 0000000..17ef4d3 --- /dev/null +++ b/src/main/java/me/espryth/easyjoin/action/Action.java @@ -0,0 +1,7 @@ +package me.espryth.easyjoin.action; + +import org.bukkit.entity.Player; + +public interface Action { + void execute(Player player, ActionQueue queue); +} diff --git a/src/main/java/me/espryth/easyjoin/action/ActionQueue.java b/src/main/java/me/espryth/easyjoin/action/ActionQueue.java new file mode 100644 index 0000000..11e9604 --- /dev/null +++ b/src/main/java/me/espryth/easyjoin/action/ActionQueue.java @@ -0,0 +1,40 @@ +package me.espryth.easyjoin.action; + +import org.bukkit.Bukkit; +import org.bukkit.entity.Player; +import org.bukkit.plugin.Plugin; + +import java.util.List; + +public class ActionQueue { + + private final List actions; + private final Plugin plugin; + private int cursor = 0; + private boolean paused = false; + + public ActionQueue(List actions, Plugin plugin) { + this.actions = actions; + this.plugin = plugin; + } + + public void executeAll(Player player) { + if (!Bukkit.isPrimaryThread()) { + Bukkit.getScheduler().runTask(plugin, () -> executeAll(player)); + return; + } + while (cursor < actions.size()) { + if (paused) break; + Action action = actions.get(cursor++); + action.execute(player, this); + } + } + + public void setPaused(boolean paused) { + this.paused = paused; + } + + public Plugin getPlugin() { + return plugin; + } +} diff --git a/src/main/java/me/espryth/easyjoin/command/MainCommand.java b/src/main/java/me/espryth/easyjoin/command/MainCommand.java new file mode 100644 index 0000000..ff40f02 --- /dev/null +++ b/src/main/java/me/espryth/easyjoin/command/MainCommand.java @@ -0,0 +1,42 @@ +package me.espryth.easyjoin.command; + +import com.google.inject.Inject; +import com.thewinterframework.command.CommandComponent; +import com.thewinterframework.service.ReloadServiceManager; +import me.espryth.easyjoin.service.FormatService; +import me.espryth.easyjoin.util.MessageUtils; +import org.bukkit.command.CommandSender; +import org.incendo.cloud.annotations.Command; +import org.incendo.cloud.annotations.Permission; +import org.incendo.cloud.paper.util.sender.Source; + +@CommandComponent +public class MainCommand { + + private final ReloadServiceManager reloadServiceManager; + private final FormatService formatService; + + @Inject + public MainCommand(ReloadServiceManager reloadServiceManager, FormatService formatService) { + this.reloadServiceManager = reloadServiceManager; + this.formatService = formatService; + } + + @Command("easyjoin") + public void mainHelp(Source source) { + CommandSender sender = (CommandSender) source.source(); + sender.sendMessage(MessageUtils.colorize("&e&lEasy&6&lJoin &fV3")); + if (sender.hasPermission("easyjoin.admin")) { + sender.sendMessage(MessageUtils.colorize("&f- /ej reload")); + } + } + + @Command("easyjoin reload") + @Permission("easyjoin.admin") + public void reload(Source source) { + CommandSender sender = (CommandSender) source.source(); + reloadServiceManager.reload(); + formatService.loadFormats(); + sender.sendMessage(MessageUtils.colorize("&aConfiguration reloaded!")); + } +} diff --git a/src/main/java/me/espryth/easyjoin/config/AppConfig.java b/src/main/java/me/espryth/easyjoin/config/AppConfig.java new file mode 100644 index 0000000..d69ba92 --- /dev/null +++ b/src/main/java/me/espryth/easyjoin/config/AppConfig.java @@ -0,0 +1,28 @@ +package me.espryth.easyjoin.config; + +import com.thewinterframework.configurate.config.Configurate; +import org.spongepowered.configurate.objectmapping.ConfigSerializable; +import org.spongepowered.configurate.objectmapping.meta.Setting; + +import java.util.Map; + +@ConfigSerializable +@Configurate("config") +public record AppConfig( + @Setting("FirstJoinMode") String firstJoinMode, + @Setting("Formats") Map formats +) { + @ConfigSerializable + public record FormatSection( + int priority, + @Setting("isFirstJoinFormat") boolean isFirstJoinFormat, + @Setting("join") ActionSection join, + @Setting("quit") ActionSection quit, + @Setting("auth") ActionSection auth + ) {} + + @ConfigSerializable + public record ActionSection( + java.util.List actions + ) {} +} diff --git a/src/main/java/me/espryth/easyjoin/config/CredentialsConfig.java b/src/main/java/me/espryth/easyjoin/config/CredentialsConfig.java new file mode 100644 index 0000000..83ff1b9 --- /dev/null +++ b/src/main/java/me/espryth/easyjoin/config/CredentialsConfig.java @@ -0,0 +1,16 @@ +package me.espryth.easyjoin.config; + +import com.thewinterframework.configurate.config.Configurate; +import org.spongepowered.configurate.objectmapping.ConfigSerializable; +import org.spongepowered.configurate.objectmapping.meta.Setting; + +@ConfigSerializable +@Configurate("credentials") +public record CredentialsConfig( + String host, + int port, + String database, + String username, + String password, + @Setting("use-ssl") boolean useSsl +) {} diff --git a/src/main/java/me/espryth/easyjoin/format/Format.java b/src/main/java/me/espryth/easyjoin/format/Format.java new file mode 100644 index 0000000..f9f0dfe --- /dev/null +++ b/src/main/java/me/espryth/easyjoin/format/Format.java @@ -0,0 +1,14 @@ +package me.espryth.easyjoin.format; + +import me.espryth.easyjoin.action.Action; + +import java.util.List; + +public record Format( + String id, + int priority, + boolean isFirstJoinFormat, + List joinActions, + List quitActions, + List authActions +) {} diff --git a/src/main/java/me/espryth/easyjoin/listener/AuthMeListener.java b/src/main/java/me/espryth/easyjoin/listener/AuthMeListener.java new file mode 100644 index 0000000..be247f1 --- /dev/null +++ b/src/main/java/me/espryth/easyjoin/listener/AuthMeListener.java @@ -0,0 +1,38 @@ +package me.espryth.easyjoin.listener; + +import com.thewinterframework.service.annotation.Service; +import fr.xephi.authme.events.LoginEvent; +import me.espryth.easyjoin.action.ActionQueue; +import me.espryth.easyjoin.format.Format; +import me.espryth.easyjoin.service.FormatService; +import org.bukkit.Bukkit; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.Listener; +import org.bukkit.plugin.Plugin; + +import java.util.Optional; + +@Service +public class AuthMeListener implements Listener { + + private final Plugin plugin; + private final FormatService formatService; + + public AuthMeListener(Plugin plugin, FormatService formatService) { + this.plugin = plugin; + this.formatService = formatService; + } + + @EventHandler + public void onLogin(LoginEvent event) { + if (Bukkit.getPluginManager().getPlugin("AuthMe") == null) return; + Player player = event.getPlayer(); + Optional formatOpt = formatService.getFormatForPlayer(player, false); + if (formatOpt.isEmpty()) formatOpt = formatService.getDefaultFormat(false); + + formatOpt.ifPresent(format -> { + new ActionQueue(format.authActions(), plugin).executeAll(player); + }); + } +} diff --git a/src/main/java/me/espryth/easyjoin/listener/NLoginListener.java b/src/main/java/me/espryth/easyjoin/listener/NLoginListener.java new file mode 100644 index 0000000..c196453 --- /dev/null +++ b/src/main/java/me/espryth/easyjoin/listener/NLoginListener.java @@ -0,0 +1,47 @@ +package me.espryth.easyjoin.listener; + +import com.nickuc.login.api.event.bukkit.auth.LoginEvent; +import com.nickuc.login.api.event.bukkit.auth.RegisterEvent; +import com.thewinterframework.service.annotation.Service; +import me.espryth.easyjoin.action.ActionQueue; +import me.espryth.easyjoin.format.Format; +import me.espryth.easyjoin.service.FormatService; +import org.bukkit.Bukkit; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.Listener; +import org.bukkit.plugin.Plugin; + +import java.util.Optional; + +@Service +public class NLoginListener implements Listener { + + private final Plugin plugin; + private final FormatService formatService; + + public NLoginListener(Plugin plugin, FormatService formatService) { + this.plugin = plugin; + this.formatService = formatService; + } + + @EventHandler + public void onLogin(LoginEvent event) { + executeActions(event.getPlayer()); + } + + @EventHandler + public void onRegister(RegisterEvent event) { + executeActions(event.getPlayer()); + } + + private void executeActions(Player player) { + if (Bukkit.getPluginManager().getPlugin("nLogin") == null) return; + Optional formatOpt = formatService.getFormatForPlayer(player, false); + if (formatOpt.isEmpty()) formatOpt = formatService.getDefaultFormat(false); + + formatOpt.ifPresent(format -> { + new ActionQueue(format.authActions(), plugin).executeAll(player); + }); + } +} diff --git a/src/main/java/me/espryth/easyjoin/listener/PlayerListener.java b/src/main/java/me/espryth/easyjoin/listener/PlayerListener.java new file mode 100644 index 0000000..bf1300b --- /dev/null +++ b/src/main/java/me/espryth/easyjoin/listener/PlayerListener.java @@ -0,0 +1,59 @@ +package me.espryth.easyjoin.listener; + +import com.thewinterframework.service.annotation.Service; +import me.espryth.easyjoin.action.ActionQueue; +import me.espryth.easyjoin.format.Format; +import me.espryth.easyjoin.service.FirstJoinService; +import me.espryth.easyjoin.service.FormatService; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.Listener; +import org.bukkit.event.player.PlayerJoinEvent; +import org.bukkit.event.player.PlayerQuitEvent; +import org.bukkit.plugin.Plugin; + +import java.util.Optional; + +@Service +public class PlayerListener implements Listener { + + private final Plugin plugin; + private final FormatService formatService; + private final FirstJoinService firstJoinService; + + public PlayerListener(Plugin plugin, FormatService formatService, FirstJoinService firstJoinService) { + this.plugin = plugin; + this.formatService = formatService; + this.firstJoinService = firstJoinService; + } + + @EventHandler + public void onJoin(PlayerJoinEvent event) { + Player player = event.getPlayer(); + event.setJoinMessage(null); + + firstJoinService.isFirstJoin(player).thenAccept(isFirst -> { + Optional formatOpt = formatService.getFormatForPlayer(player, isFirst); + if (formatOpt.isEmpty()) formatOpt = formatService.getDefaultFormat(isFirst); + + formatOpt.ifPresent(format -> { + new ActionQueue(format.joinActions(), plugin).executeAll(player); + }); + + if (isFirst) firstJoinService.markAsJoined(player); + }); + } + + @EventHandler + public void onQuit(PlayerQuitEvent event) { + Player player = event.getPlayer(); + event.setQuitMessage(null); + + Optional formatOpt = formatService.getFormatForPlayer(player, false); + if (formatOpt.isEmpty()) formatOpt = formatService.getDefaultFormat(false); + + formatOpt.ifPresent(format -> { + new ActionQueue(format.quitActions(), plugin).executeAll(player); + }); + } +} diff --git a/src/main/java/me/espryth/easyjoin/service/ActionService.java b/src/main/java/me/espryth/easyjoin/service/ActionService.java new file mode 100644 index 0000000..f56e2b3 --- /dev/null +++ b/src/main/java/me/espryth/easyjoin/service/ActionService.java @@ -0,0 +1,226 @@ +package me.espryth.easyjoin.service; + +import com.thewinterframework.service.annotation.Service; +import me.espryth.easyjoin.action.Action; +import me.espryth.easyjoin.util.AvatarUtils; +import me.espryth.easyjoin.util.MessageUtils; +import net.kyori.adventure.text.Component; +import net.kyori.adventure.text.serializer.gson.GsonComponentSerializer; +import net.md_5.bungee.api.ChatMessageType; +import net.md_5.bungee.api.chat.TextComponent; +import org.bukkit.Bukkit; +import org.bukkit.Color; +import org.bukkit.FireworkEffect; +import org.bukkit.Sound; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Firework; +import org.bukkit.entity.Player; +import org.bukkit.inventory.meta.FireworkMeta; + +import java.util.*; + +@Service +public class ActionService { + + private final Map actionFactories = new HashMap<>(); + + public ActionService() { + registerDefaultActions(); + } + + public void registerAction(String identifier, ActionFactory factory) { + actionFactories.put(identifier.toUpperCase(), factory); + } + + public Optional parseAction(String line) { + String[] parts = line.split(" ", 2); + String identifier = parts[0].toUpperCase(); + String data = parts.length > 1 ? parts[1] : ""; + + ActionFactory factory = actionFactories.get(identifier); + if (factory != null) { + return Optional.of(factory.create(data)); + } + return Optional.empty(); + } + + private void registerDefaultActions() { + registerAction("[MESSAGE]", data -> (player, queue) -> { + Component msg = MessageUtils.colorizeToComponent(me.clip.placeholderapi.PlaceholderAPI.setPlaceholders(player, data)); + if (data.startsWith("")) { + // Centering with Components is harder, let's keep it legacy for centering or try to adapt + String legacy = MessageUtils.formatString(player, data); + player.sendMessage(MessageUtils.getCenteredMessage(legacy.replace("", ""))); + } else { + player.sendMessage(msg); + } + }); + + registerAction("[BROADCAST]", data -> (player, queue) -> { + Component msg = MessageUtils.colorizeToComponent(me.clip.placeholderapi.PlaceholderAPI.setPlaceholders(player, data)); + if (data.startsWith("")) { + String legacy = MessageUtils.formatString(player, data); + Bukkit.broadcastMessage(MessageUtils.getCenteredMessage(legacy.replace("", ""))); + } else { + Bukkit.broadcast(msg); + } + }); + + registerAction("[JSON_MESSAGE]", data -> (player, queue) -> { + String json = MessageUtils.formatString(player, data); + player.sendMessage(GsonComponentSerializer.gson().deserialize(json)); + }); + + registerAction("[JSON_BROADCAST]", data -> (player, queue) -> { + String json = MessageUtils.formatString(player, data); + Bukkit.broadcast(GsonComponentSerializer.gson().deserialize(json)); + }); + + registerAction("[ACTIONBAR]", data -> (player, queue) -> { + String[] parts = data.split(";"); + Component msg = MessageUtils.colorizeToComponent(me.clip.placeholderapi.PlaceholderAPI.setPlaceholders(player, parts[0])); + player.sendActionBar(msg); + }); + + registerAction("[BROADCAST_ACTIONBAR]", data -> (player, queue) -> { + String[] parts = data.split(";"); + Component msg = MessageUtils.colorizeToComponent(me.clip.placeholderapi.PlaceholderAPI.setPlaceholders(player, parts[0])); + Bukkit.broadcast(msg); + }); + + registerAction("[TITLE]", data -> (player, queue) -> { + String[] parts = data.split(";"); + String titleStr = parts.length > 0 ? parts[0] : ""; + String subtitleStr = parts.length > 1 ? parts[1] : ""; + int fadeIn = parts.length > 2 ? Integer.parseInt(parts[2]) : 10; + int stay = parts.length > 3 ? Integer.parseInt(parts[3]) : 70; + int fadeOut = parts.length > 4 ? Integer.parseInt(parts[4]) : 20; + + Component title = MessageUtils.colorizeToComponent(me.clip.placeholderapi.PlaceholderAPI.setPlaceholders(player, titleStr)); + Component subtitle = MessageUtils.colorizeToComponent(me.clip.placeholderapi.PlaceholderAPI.setPlaceholders(player, subtitleStr)); + + player.showTitle(net.kyori.adventure.title.Title.title(title, subtitle, net.kyori.adventure.title.Title.Times.times( + java.time.Duration.ofMillis(fadeIn * 50L), + java.time.Duration.ofMillis(stay * 50L), + java.time.Duration.ofMillis(fadeOut * 50L) + ))); + }); + + registerAction("[BROADCAST_TITLE]", data -> (player, queue) -> { + String[] parts = data.split(";"); + String titleStr = parts.length > 0 ? parts[0] : ""; + String subtitleStr = parts.length > 1 ? parts[1] : ""; + int fadeIn = parts.length > 2 ? Integer.parseInt(parts[2]) : 10; + int stay = parts.length > 3 ? Integer.parseInt(parts[3]) : 70; + int fadeOut = parts.length > 4 ? Integer.parseInt(parts[4]) : 20; + + Component title = MessageUtils.colorizeToComponent(me.clip.placeholderapi.PlaceholderAPI.setPlaceholders(player, titleStr)); + Component subtitle = MessageUtils.colorizeToComponent(me.clip.placeholderapi.PlaceholderAPI.setPlaceholders(player, subtitleStr)); + + Bukkit.getOnlinePlayers().forEach(p -> p.showTitle(net.kyori.adventure.title.Title.title(title, subtitle, net.kyori.adventure.title.Title.Times.times( + java.time.Duration.ofMillis(fadeIn * 50L), + java.time.Duration.ofMillis(stay * 50L), + java.time.Duration.ofMillis(fadeOut * 50L) + )))); + }); + + registerAction("[AVATAR_MESSAGE]", data -> (player, queue) -> { + List avatar = AvatarUtils.getAvatar(player); + String[] lines = data.split(""); + for (int i = 0; i < 8; i++) { + Component avatarLine = avatar.size() > i ? avatar.get(i) : Component.text(" "); + String messageLine = lines.length > i ? lines[i] : ""; + Component formattedMessageLine = MessageUtils.colorizeToComponent(me.clip.placeholderapi.PlaceholderAPI.setPlaceholders(player, messageLine)); + player.sendMessage(avatarLine.append(Component.text(" ")).append(formattedMessageLine)); + } + }); + + registerAction("[AVATAR_BROADCAST]", data -> (player, queue) -> { + List avatar = AvatarUtils.getAvatar(player); + String[] lines = data.split(""); + for (int i = 0; i < 8; i++) { + Component avatarLine = avatar.size() > i ? avatar.get(i) : Component.text(" "); + String messageLine = lines.length > i ? lines[i] : ""; + Component formattedMessageLine = MessageUtils.colorizeToComponent(me.clip.placeholderapi.PlaceholderAPI.setPlaceholders(player, messageLine)); + Bukkit.broadcast(avatarLine.append(Component.text(" ")).append(formattedMessageLine)); + } + }); + + registerAction("[CLEARCHAT]", data -> (player, queue) -> { + int lines = Integer.parseInt(data); + for (int i = 0; i < lines; i++) player.sendMessage(" "); + }); + + registerAction("[FIREWORK]", data -> (player, queue) -> { + String[] parts = data.split(";"); + if (parts.length < 3) return; + try { + FireworkEffect.Type type = FireworkEffect.Type.valueOf(parts[0].toUpperCase()); + int amount = Integer.parseInt(parts[1]); + int power = Integer.parseInt(parts[2]); + List colors = new ArrayList<>(); + List fades = new ArrayList<>(); + for (int i = 3; i < parts.length; i++) { + String[] rgb = parts[i].split(","); + Color color = Color.fromRGB(Integer.parseInt(rgb[0]), Integer.parseInt(rgb[1]), Integer.parseInt(rgb[2])); + if (i % 2 == 0) fades.add(color); else colors.add(color); + } + Firework firework = (Firework) player.getLocation().getWorld().spawnEntity(player.getLocation(), EntityType.FIREWORK_ROCKET); + FireworkMeta meta = firework.getFireworkMeta(); + meta.setPower(power); + meta.addEffect(FireworkEffect.builder().with(type).withColor(colors).withFade(fades).trail(true).build()); + firework.setFireworkMeta(meta); + for (int i = 1; i < amount; i++) { + Firework f = (Firework) player.getLocation().getWorld().spawnEntity(player.getLocation(), EntityType.FIREWORK_ROCKET); + f.setFireworkMeta(meta); + } + } catch (Exception ignored) {} + }); + + registerAction("[CONSOLE]", data -> (player, queue) -> { + String cmd = MessageUtils.formatString(player, data); + Bukkit.dispatchCommand(Bukkit.getConsoleSender(), cmd); + }); + + registerAction("[PLAYER]", data -> (player, queue) -> { + String cmd = MessageUtils.formatString(player, data); + player.performCommand(cmd); + }); + + registerAction("[SOUND]", data -> (player, queue) -> { + String[] parts = data.split(";"); + try { + Sound sound = Sound.valueOf(parts[0].toUpperCase()); + float volume = parts.length > 1 ? Float.parseFloat(parts[1]) : 1.0f; + float pitch = parts.length > 2 ? Float.parseFloat(parts[2]) : 1.0f; + player.playSound(player.getLocation(), sound, volume, pitch); + } catch (Exception ignored) {} + }); + + registerAction("[BROADCAST_SOUND]", data -> (player, queue) -> { + String[] parts = data.split(";"); + try { + Sound sound = Sound.valueOf(parts[0].toUpperCase()); + float volume = parts.length > 1 ? Float.parseFloat(parts[1]) : 1.0f; + float pitch = parts.length > 2 ? Float.parseFloat(parts[2]) : 1.0f; + Bukkit.getOnlinePlayers().forEach(p -> p.playSound(p.getLocation(), sound, volume, pitch)); + } catch (Exception ignored) {} + }); + + registerAction("[DELAY]", data -> (player, queue) -> { + try { + int delay = Integer.parseInt(data); + queue.setPaused(true); + Bukkit.getScheduler().runTaskLater(queue.getPlugin(), () -> { + queue.setPaused(false); + queue.executeAll(player); + }, delay * 20L); + } catch (NumberFormatException ignored) {} + }); + } + + @FunctionalInterface + public interface ActionFactory { + Action create(String data); + } +} diff --git a/src/main/java/me/espryth/easyjoin/service/FirstJoinService.java b/src/main/java/me/espryth/easyjoin/service/FirstJoinService.java new file mode 100644 index 0000000..4ad0456 --- /dev/null +++ b/src/main/java/me/espryth/easyjoin/service/FirstJoinService.java @@ -0,0 +1,91 @@ +package me.espryth.easyjoin.service; + +import com.thewinterframework.configurate.Container; +import com.thewinterframework.service.annotation.Service; +import com.zaxxer.hikari.HikariConfig; +import com.zaxxer.hikari.HikariDataSource; +import me.espryth.easyjoin.config.AppConfig; +import me.espryth.easyjoin.config.CredentialsConfig; +import org.bukkit.entity.Player; + +import java.sql.Connection; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.HashSet; +import java.util.Set; +import java.util.UUID; +import java.util.concurrent.CompletableFuture; + +@Service +public class FirstJoinService { + + private final Container appConfig; + private final Container credentialsConfig; + private HikariDataSource dataSource; + private final Set cache = new HashSet<>(); + + public FirstJoinService(Container appConfig, Container credentialsConfig) { + this.appConfig = appConfig; + this.credentialsConfig = credentialsConfig; + setupDatabase(); + } + + private void setupDatabase() { + if (!appConfig.get().firstJoinMode().equalsIgnoreCase("MYSQL")) return; + + CredentialsConfig creds = credentialsConfig.get(); + HikariConfig config = new HikariConfig(); + config.setJdbcUrl("jdbc:mysql://" + creds.host() + ":" + creds.port() + "/" + creds.database() + "?useSSL=" + creds.useSsl()); + config.setUsername(creds.username()); + config.setPassword(creds.password()); + config.setMaximumPoolSize(10); + + this.dataSource = new HikariDataSource(config); + + try (Connection conn = dataSource.getConnection(); + PreparedStatement stmt = conn.prepareStatement("CREATE TABLE IF NOT EXISTS EJFirstJoin(uuid VARCHAR(36) PRIMARY KEY)")) { + stmt.executeUpdate(); + } catch (SQLException e) { + e.printStackTrace(); + } + } + + public CompletableFuture isFirstJoin(Player player) { + if (!appConfig.get().firstJoinMode().equalsIgnoreCase("MYSQL")) { + return CompletableFuture.completedFuture(!player.hasPlayedBefore()); + } + + if (cache.contains(player.getUniqueId())) return CompletableFuture.completedFuture(false); + + return CompletableFuture.supplyAsync(() -> { + try (Connection conn = dataSource.getConnection(); + PreparedStatement stmt = conn.prepareStatement("SELECT 1 FROM EJFirstJoin WHERE uuid = ?")) { + stmt.setString(1, player.getUniqueId().toString()); + try (ResultSet rs = stmt.executeQuery()) { + boolean exists = rs.next(); + if (exists) cache.add(player.getUniqueId()); + return !exists; + } + } catch (SQLException e) { + e.printStackTrace(); + return !player.hasPlayedBefore(); + } + }); + } + + public void markAsJoined(Player player) { + if (!appConfig.get().firstJoinMode().equalsIgnoreCase("MYSQL")) return; + + cache.add(player.getUniqueId()); + CompletableFuture.runAsync(() -> { + try (Connection conn = dataSource.getConnection(); + PreparedStatement stmt = conn.prepareStatement("INSERT IGNORE INTO EJFirstJoin(uuid) VALUES(?)")) { + stmt.setString(1, player.getUniqueId().toString()); + stmt.executeUpdate(); + } catch (SQLException e) { + e.printStackTrace(); + } + }); + } +} diff --git a/src/main/java/me/espryth/easyjoin/service/FormatService.java b/src/main/java/me/espryth/easyjoin/service/FormatService.java new file mode 100644 index 0000000..6bb3ac9 --- /dev/null +++ b/src/main/java/me/espryth/easyjoin/service/FormatService.java @@ -0,0 +1,69 @@ +package me.espryth.easyjoin.service; + +import com.thewinterframework.configurate.Container; +import com.thewinterframework.service.annotation.Service; +import me.espryth.easyjoin.action.Action; +import me.espryth.easyjoin.config.AppConfig; +import me.espryth.easyjoin.format.Format; +import org.bukkit.entity.Player; + +import java.util.*; +import java.util.stream.Collectors; + +@Service +public class FormatService { + + private final Container config; + private final ActionService actionService; + private final Map formats = new HashMap<>(); + + public FormatService(Container config, ActionService actionService) { + this.config = config; + this.actionService = actionService; + loadFormats(); + } + + public void loadFormats() { + formats.clear(); + AppConfig appConfig = config.get(); + if (appConfig.formats() == null) return; + + appConfig.formats().forEach((id, section) -> { + List join = parseActions(section.join()); + List quit = parseActions(section.quit()); + List auth = parseActions(section.auth()); + + formats.put(id, new Format( + id, + section.priority(), + section.isFirstJoinFormat(), + join, + quit, + auth + )); + }); + } + + private List parseActions(AppConfig.ActionSection section) { + if (section == null || section.actions() == null) return Collections.emptyList(); + return section.actions().stream() + .map(actionService::parseAction) + .filter(Optional::isPresent) + .map(Optional::get) + .collect(Collectors.toList()); + } + + public Optional getFormatForPlayer(Player player, boolean isFirstJoin) { + return formats.values().stream() + .filter(f -> isFirstJoin == f.isFirstJoinFormat()) + .filter(f -> player.hasPermission("easyjoin." + f.id())) + .max(Comparator.comparingInt(Format::priority)); + } + + public Optional getDefaultFormat(boolean isFirstJoin) { + return formats.values().stream() + .filter(f -> isFirstJoin == f.isFirstJoinFormat()) + .filter(f -> f.id().equalsIgnoreCase("default")) + .findFirst(); + } +} diff --git a/src/main/java/me/espryth/easyjoin/util/AvatarUtils.java b/src/main/java/me/espryth/easyjoin/util/AvatarUtils.java new file mode 100644 index 0000000..763238f --- /dev/null +++ b/src/main/java/me/espryth/easyjoin/util/AvatarUtils.java @@ -0,0 +1,40 @@ +package me.espryth.easyjoin.util; + +import net.kyori.adventure.text.Component; +import net.kyori.adventure.text.format.TextColor; +import org.bukkit.entity.Player; + +import javax.imageio.ImageIO; +import java.awt.image.BufferedImage; +import java.io.IOException; +import java.net.URL; +import java.util.ArrayList; +import java.util.List; + +public class AvatarUtils { + + public static List getAvatar(Player player) { + return getAvatar(player.getName()); + } + + public static List getAvatar(String playerName) { + try { + URL url = new URL("https://mc-heads.net/avatar/" + playerName + "/8"); + BufferedImage image = ImageIO.read(url); + List lines = new ArrayList<>(); + + for (int y = 0; y < image.getHeight(); y++) { + Component line = Component.empty(); + for (int x = 0; x < image.getWidth(); x++) { + int rgb = image.getRGB(x, y); + TextColor color = TextColor.color(rgb); + line = line.append(Component.text("█").color(color)); + } + lines.add(line); + } + return lines; + } catch (IOException e) { + return new ArrayList<>(); + } + } +} diff --git a/plugin/src/main/java/me/espryth/easyjoin/plugin/utils/DefaultFontInfo.java b/src/main/java/me/espryth/easyjoin/util/DefaultFontInfo.java similarity index 96% rename from plugin/src/main/java/me/espryth/easyjoin/plugin/utils/DefaultFontInfo.java rename to src/main/java/me/espryth/easyjoin/util/DefaultFontInfo.java index f65e88a..5eb55d3 100644 --- a/plugin/src/main/java/me/espryth/easyjoin/plugin/utils/DefaultFontInfo.java +++ b/src/main/java/me/espryth/easyjoin/util/DefaultFontInfo.java @@ -1,4 +1,4 @@ -package me.espryth.easyjoin.plugin.utils; +package me.espryth.easyjoin.util; public enum DefaultFontInfo { @@ -99,8 +99,8 @@ public enum DefaultFontInfo { SPACE(' ', 3), DEFAULT('a', 4); - private char character; - private int length; + private final char character; + private final int length; DefaultFontInfo(char character, int length) { this.character = character; diff --git a/plugin/src/main/java/me/espryth/easyjoin/plugin/utils/MessageUtils.java b/src/main/java/me/espryth/easyjoin/util/MessageUtils.java similarity index 50% rename from plugin/src/main/java/me/espryth/easyjoin/plugin/utils/MessageUtils.java rename to src/main/java/me/espryth/easyjoin/util/MessageUtils.java index f5bfaba..0c494d5 100644 --- a/plugin/src/main/java/me/espryth/easyjoin/plugin/utils/MessageUtils.java +++ b/src/main/java/me/espryth/easyjoin/util/MessageUtils.java @@ -1,32 +1,45 @@ -package me.espryth.easyjoin.plugin.utils; +package me.espryth.easyjoin.util; import me.clip.placeholderapi.PlaceholderAPI; -import net.md_5.bungee.api.ChatColor; -import net.md_5.bungee.api.chat.BaseComponent; -import net.md_5.bungee.api.chat.TextComponent; +import net.kyori.adventure.text.Component; +import net.kyori.adventure.text.minimessage.MiniMessage; +import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer; import org.bukkit.entity.Player; import java.util.regex.Pattern; public class MessageUtils { - private final static int CENTER_PX = 154; + private final static MiniMessage MINI_MESSAGE = MiniMessage.miniMessage(); private final static Pattern HEX_COLOR_PATTERN = Pattern.compile("&\\[([\\dA-Fa-f])([\\dA-Fa-f])," + "([\\dA-Fa-f])([\\dA-Fa-f])," + "([\\dA-Fa-f])([\\dA-Fa-f])]"); - private final static String BUKKIT_HEX_COLOR = ChatColor.COLOR_CHAR + "x" + - ChatColor.COLOR_CHAR + "$1" + - ChatColor.COLOR_CHAR + "$2" + - ChatColor.COLOR_CHAR + "$3" + - ChatColor.COLOR_CHAR + "$4" + - ChatColor.COLOR_CHAR + "$5" + - ChatColor.COLOR_CHAR + "$6"; + private final static String BUKKIT_HEX_COLOR = "§x§$1§$2§$3§$4§$5§$6"; + + private final static int CENTER_PX = 154; public static String colorize(String text) { + if (text == null) return ""; String newText = HEX_COLOR_PATTERN.matcher(text).replaceAll(BUKKIT_HEX_COLOR); - return ChatColor.translateAlternateColorCodes('&', newText); + Component component = MINI_MESSAGE.deserialize(newText); + if (component.equals(Component.text(newText))) { + // If MiniMessage didn't find any tags, fallback to legacy + component = LegacyComponentSerializer.legacyAmpersand().deserialize(newText); + } + return LegacyComponentSerializer.legacySection().serialize(component); + } + + public static Component colorizeToComponent(String text) { + if (text == null) return Component.empty(); + String newText = HEX_COLOR_PATTERN.matcher(text).replaceAll(BUKKIT_HEX_COLOR); + Component component = MINI_MESSAGE.deserialize(newText); + if (component.equals(Component.text(newText))) { + // If MiniMessage didn't find any tags, fallback to legacy + return LegacyComponentSerializer.legacyAmpersand().deserialize(newText); + } + return component; } public static String formatString(Player player, String s) { @@ -38,25 +51,19 @@ public static String getCenteredMessage(String message) { } public static String getCenteredSpace(String message) { - - if(message == null || message.equals("")) return ""; + if (message == null || message.isEmpty()) return ""; int messagePxSize = 0; boolean previousCode = false; boolean isBold = false; - for(char c : message.toCharArray()){ - - if(c == '§'){ + for (char c : message.toCharArray()) { + if (c == '§') { previousCode = true; - continue; - }else if(previousCode){ + } else if (previousCode) { previousCode = false; - if(c == 'l' || c == 'L'){ - isBold = true; - continue; - }else isBold = false; - }else{ + isBold = (c == 'l' || c == 'L'); + } else { DefaultFontInfo dFI = DefaultFontInfo.getDefaultFontInfo(c); messagePxSize += isBold ? dFI.getBoldLength() : dFI.getLength(); messagePxSize++; @@ -68,26 +75,10 @@ public static String getCenteredSpace(String message) { int spaceLength = DefaultFontInfo.SPACE.getLength() + 1; int compensated = 0; StringBuilder sb = new StringBuilder(); - while(compensated < toCompensate){ + while (compensated < toCompensate) { sb.append(" "); compensated += spaceLength; } return sb.toString(); } - - public static BaseComponent[] getCenteredComponents(BaseComponent[] components) { - StringBuilder legacy = new StringBuilder(); - - for (BaseComponent component : components) { - legacy.append(component.toLegacyText()); - } - - String space = getCenteredSpace(legacy.toString()); - - BaseComponent[] newComponents = new BaseComponent[components.length + 1]; - newComponents[0] = new TextComponent(space); - - System.arraycopy(components, 0, newComponents, 1, newComponents.length - 1); - return newComponents; - } } diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml new file mode 100644 index 0000000..e5139a9 --- /dev/null +++ b/src/main/resources/config.yml @@ -0,0 +1,25 @@ +FirstJoinMode: VANILLA + +Formats: + admin: + priority: 10 + join: + actions: + - '[BROADCAST] &8(&a+&8) &c&lADMIN &f%player_name%' + - '[SOUND] ENTITY_PLAYER_LEVELUP;10;5' + - '[ACTIONBAR] &ashop.example.com;5' + - '[JSON_MESSAGE] {"text":"&9Click to go to our discord","clickEvent":{"action":"open_url","value":"https://discord.gg/hPNYUMUauD"}}' + quit: + actions: + - '[BROADCAST] &8(&c-&8) &f%player_name%' + default: + priority: 5 + join: + actions: + - '[BROADCAST] &8(&a+&8) &f%player_name%' + - '[SOUND] ENTITY_PLAYER_LEVELUP;10;5' + - '[ACTIONBAR] &ashop.example.com' + - '[FIREWORK] STAR;10;2;255,120,200;100,50,30;10,20,30;40;10;20' + quit: + actions: + - '[BROADCAST] &8(&c-&8) &f%player_name%' diff --git a/src/main/resources/credentials.yml b/src/main/resources/credentials.yml new file mode 100644 index 0000000..f314a06 --- /dev/null +++ b/src/main/resources/credentials.yml @@ -0,0 +1,6 @@ +host: localhost +port: 3306 +database: easyjoin +username: root +password: password +use-ssl: false diff --git a/src/main/resources/paper-plugin.yml b/src/main/resources/paper-plugin.yml new file mode 100644 index 0000000..9780491 --- /dev/null +++ b/src/main/resources/paper-plugin.yml @@ -0,0 +1,6 @@ +api-version: '1.21' +name: EasyJoin +version: ${project.version} +main: me.espryth.easyjoin.EasyJoinPlugin +authors: [Espryth, Mapacheee] +package-state: internal diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml new file mode 100644 index 0000000..c8a24b9 --- /dev/null +++ b/src/main/resources/plugin.yml @@ -0,0 +1,6 @@ +name: EasyJoin +version: ${project.version} +main: me.espryth.easyjoin.EasyJoinPlugin +api-version: '1.21' +authors: [Espryth, Mapacheee] +softdepend: [PlaceholderAPI, AuthMe, nLogin] From 603ce4036ca0857c0bd6723451169e73b2985640 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjam=C3=ADn=20Isasmendi=20C?= Date: Tue, 17 Feb 2026 23:04:12 -0400 Subject: [PATCH 02/14] refactor build gradle --- build.gradle.kts | 50 +++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 47 insertions(+), 3 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index 5e7b895..fcd6d80 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -25,11 +25,14 @@ repositories { maven("https://repo.codemc.io/repository/maven-public/") } + dependencies { compileOnly("io.papermc.paper:paper-api:1.21.1-R0.1-SNAPSHOT") api("com.thewinterframework:paper:1.0.4") { exclude(group = "io.papermc.paper", module = "paper-api") + exclude(group = "com.google.guava", module = "guava") + exclude(group = "com.google.code.gson", module = "gson") } annotationProcessor("com.thewinterframework:paper:1.0.4") @@ -49,20 +52,61 @@ dependencies { api("org.incendo:cloud-paper:2.0.0-beta.10") api("org.incendo:cloud-annotations:2.0.0") - compileOnly("me.clip:placeholderapi:2.11.6") compileOnly("fr.xephi:authme:5.6.0-SNAPSHOT") compileOnly("com.nickuc.login:nlogin-api:10.0") + implementation("com.zaxxer:HikariCP:7.0.2") implementation("net.kyori:adventure-text-serializer-legacy:4.26.1") implementation("net.kyori:adventure-text-minimessage:4.26.1") - implementation("com.zaxxer:HikariCP:7.0.2") } tasks.shadowJar { - relocate("com.zaxxer.hikari", "me.espryth.easyjoin.libs.hikari") + minimize { + exclude(dependency("com.thewinterframework:.*")) + exclude(dependency("com.google.inject:.*")) + exclude(dependency("org.incendo:.*")) + } + + relocate("com.thewinterframework", "me.espryth.easyjoin.libs.winter") + relocate("com.google.inject", "me.espryth.easyjoin.libs.guice") + relocate("org.incendo.cloud", "me.espryth.easyjoin.libs.cloud") + relocate("javax.inject", "me.espryth.easyjoin.libs.inject") + relocate("aopalliance", "me.espryth.easyjoin.libs.aopalliance") + relocate("io.leangen.geantyref", "me.espryth.easyjoin.libs.geantyref") + + exclude("org/checkerframework/**") + exclude("META-INF/maven/org.checkerframework/**") + exclude("com/google/errorprone/**") + exclude("com/google/j2objc/**") + + exclude("META-INF/MANIFEST.MF") + exclude("META-INF/*.SF") + exclude("META-INF/*.DSA") + exclude("META-INF/*.RSA") + exclude("META-INF/versions/**") + exclude("META-INF/maven/**") + exclude("META-INF/proguard/**") + exclude("META-INF/native-image/**") + exclude("module-info.class") + exclude("**/module-info.class") + exclude("META-INF/*.kotlin_module") + archiveClassifier.set("") + + mergeServiceFiles() + + manifest { + attributes( + "Implementation-Title" to project.name, + "Implementation-Version" to project.version, + "Multi-Release" to "false" + ) + } + + isPreserveFileTimestamps = false + isReproducibleFileOrder = true } tasks.build { From b9043e9962ac0d211d87712e118b752c4a8507df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjam=C3=ADn=20Isasmendi=20C?= Date: Tue, 17 Feb 2026 23:04:26 -0400 Subject: [PATCH 03/14] remove auth plugin support --- .../easyjoin/listener/AuthMeListener.java | 38 --------------- .../easyjoin/listener/NLoginListener.java | 47 ------------------- src/main/resources/paper-plugin.yml | 5 ++ src/main/resources/plugin.yml | 2 +- 4 files changed, 6 insertions(+), 86 deletions(-) delete mode 100644 src/main/java/me/espryth/easyjoin/listener/AuthMeListener.java delete mode 100644 src/main/java/me/espryth/easyjoin/listener/NLoginListener.java diff --git a/src/main/java/me/espryth/easyjoin/listener/AuthMeListener.java b/src/main/java/me/espryth/easyjoin/listener/AuthMeListener.java deleted file mode 100644 index be247f1..0000000 --- a/src/main/java/me/espryth/easyjoin/listener/AuthMeListener.java +++ /dev/null @@ -1,38 +0,0 @@ -package me.espryth.easyjoin.listener; - -import com.thewinterframework.service.annotation.Service; -import fr.xephi.authme.events.LoginEvent; -import me.espryth.easyjoin.action.ActionQueue; -import me.espryth.easyjoin.format.Format; -import me.espryth.easyjoin.service.FormatService; -import org.bukkit.Bukkit; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.Listener; -import org.bukkit.plugin.Plugin; - -import java.util.Optional; - -@Service -public class AuthMeListener implements Listener { - - private final Plugin plugin; - private final FormatService formatService; - - public AuthMeListener(Plugin plugin, FormatService formatService) { - this.plugin = plugin; - this.formatService = formatService; - } - - @EventHandler - public void onLogin(LoginEvent event) { - if (Bukkit.getPluginManager().getPlugin("AuthMe") == null) return; - Player player = event.getPlayer(); - Optional formatOpt = formatService.getFormatForPlayer(player, false); - if (formatOpt.isEmpty()) formatOpt = formatService.getDefaultFormat(false); - - formatOpt.ifPresent(format -> { - new ActionQueue(format.authActions(), plugin).executeAll(player); - }); - } -} diff --git a/src/main/java/me/espryth/easyjoin/listener/NLoginListener.java b/src/main/java/me/espryth/easyjoin/listener/NLoginListener.java deleted file mode 100644 index c196453..0000000 --- a/src/main/java/me/espryth/easyjoin/listener/NLoginListener.java +++ /dev/null @@ -1,47 +0,0 @@ -package me.espryth.easyjoin.listener; - -import com.nickuc.login.api.event.bukkit.auth.LoginEvent; -import com.nickuc.login.api.event.bukkit.auth.RegisterEvent; -import com.thewinterframework.service.annotation.Service; -import me.espryth.easyjoin.action.ActionQueue; -import me.espryth.easyjoin.format.Format; -import me.espryth.easyjoin.service.FormatService; -import org.bukkit.Bukkit; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.Listener; -import org.bukkit.plugin.Plugin; - -import java.util.Optional; - -@Service -public class NLoginListener implements Listener { - - private final Plugin plugin; - private final FormatService formatService; - - public NLoginListener(Plugin plugin, FormatService formatService) { - this.plugin = plugin; - this.formatService = formatService; - } - - @EventHandler - public void onLogin(LoginEvent event) { - executeActions(event.getPlayer()); - } - - @EventHandler - public void onRegister(RegisterEvent event) { - executeActions(event.getPlayer()); - } - - private void executeActions(Player player) { - if (Bukkit.getPluginManager().getPlugin("nLogin") == null) return; - Optional formatOpt = formatService.getFormatForPlayer(player, false); - if (formatOpt.isEmpty()) formatOpt = formatService.getDefaultFormat(false); - - formatOpt.ifPresent(format -> { - new ActionQueue(format.authActions(), plugin).executeAll(player); - }); - } -} diff --git a/src/main/resources/paper-plugin.yml b/src/main/resources/paper-plugin.yml index 9780491..65efa2d 100644 --- a/src/main/resources/paper-plugin.yml +++ b/src/main/resources/paper-plugin.yml @@ -4,3 +4,8 @@ version: ${project.version} main: me.espryth.easyjoin.EasyJoinPlugin authors: [Espryth, Mapacheee] package-state: internal +dependencies: + server: + PlaceholderAPI: + load: AFTER + required: false \ No newline at end of file diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index c8a24b9..e26af79 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -3,4 +3,4 @@ version: ${project.version} main: me.espryth.easyjoin.EasyJoinPlugin api-version: '1.21' authors: [Espryth, Mapacheee] -softdepend: [PlaceholderAPI, AuthMe, nLogin] +softdepend: [PlaceholderAPI] From c294b9d56d079dc8ecdadc977b817df76827ae85 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjam=C3=ADn=20Isasmendi=20C?= Date: Tue, 17 Feb 2026 23:47:01 -0400 Subject: [PATCH 04/14] change deprecated methods --- .../me/espryth/easyjoin/listener/PlayerListener.java | 4 ++-- .../me/espryth/easyjoin/service/ActionService.java | 12 +++++------- .../java/me/espryth/easyjoin/util/AvatarUtils.java | 3 ++- 3 files changed, 9 insertions(+), 10 deletions(-) diff --git a/src/main/java/me/espryth/easyjoin/listener/PlayerListener.java b/src/main/java/me/espryth/easyjoin/listener/PlayerListener.java index bf1300b..5ad74e9 100644 --- a/src/main/java/me/espryth/easyjoin/listener/PlayerListener.java +++ b/src/main/java/me/espryth/easyjoin/listener/PlayerListener.java @@ -30,7 +30,7 @@ public PlayerListener(Plugin plugin, FormatService formatService, FirstJoinServi @EventHandler public void onJoin(PlayerJoinEvent event) { Player player = event.getPlayer(); - event.setJoinMessage(null); + event.joinMessage(null); firstJoinService.isFirstJoin(player).thenAccept(isFirst -> { Optional formatOpt = formatService.getFormatForPlayer(player, isFirst); @@ -47,7 +47,7 @@ public void onJoin(PlayerJoinEvent event) { @EventHandler public void onQuit(PlayerQuitEvent event) { Player player = event.getPlayer(); - event.setQuitMessage(null); + event.quitMessage(null); Optional formatOpt = formatService.getFormatForPlayer(player, false); if (formatOpt.isEmpty()) formatOpt = formatService.getDefaultFormat(false); diff --git a/src/main/java/me/espryth/easyjoin/service/ActionService.java b/src/main/java/me/espryth/easyjoin/service/ActionService.java index f56e2b3..51ab5d1 100644 --- a/src/main/java/me/espryth/easyjoin/service/ActionService.java +++ b/src/main/java/me/espryth/easyjoin/service/ActionService.java @@ -6,15 +6,12 @@ import me.espryth.easyjoin.util.MessageUtils; import net.kyori.adventure.text.Component; import net.kyori.adventure.text.serializer.gson.GsonComponentSerializer; -import net.md_5.bungee.api.ChatMessageType; -import net.md_5.bungee.api.chat.TextComponent; import org.bukkit.Bukkit; import org.bukkit.Color; import org.bukkit.FireworkEffect; import org.bukkit.Sound; import org.bukkit.entity.EntityType; import org.bukkit.entity.Firework; -import org.bukkit.entity.Player; import org.bukkit.inventory.meta.FireworkMeta; import java.util.*; @@ -48,9 +45,9 @@ private void registerDefaultActions() { registerAction("[MESSAGE]", data -> (player, queue) -> { Component msg = MessageUtils.colorizeToComponent(me.clip.placeholderapi.PlaceholderAPI.setPlaceholders(player, data)); if (data.startsWith("")) { - // Centering with Components is harder, let's keep it legacy for centering or try to adapt String legacy = MessageUtils.formatString(player, data); - player.sendMessage(MessageUtils.getCenteredMessage(legacy.replace("", ""))); + Component centeredMsg = MessageUtils.colorizeToComponent(MessageUtils.getCenteredMessage(legacy.replace("", ""))); + player.sendMessage(centeredMsg); } else { player.sendMessage(msg); } @@ -60,7 +57,8 @@ private void registerDefaultActions() { Component msg = MessageUtils.colorizeToComponent(me.clip.placeholderapi.PlaceholderAPI.setPlaceholders(player, data)); if (data.startsWith("")) { String legacy = MessageUtils.formatString(player, data); - Bukkit.broadcastMessage(MessageUtils.getCenteredMessage(legacy.replace("", ""))); + Component centeredMsg = MessageUtils.colorizeToComponent(MessageUtils.getCenteredMessage(legacy.replace("", ""))); + Bukkit.broadcast(centeredMsg); } else { Bukkit.broadcast(msg); } @@ -148,7 +146,7 @@ private void registerDefaultActions() { registerAction("[CLEARCHAT]", data -> (player, queue) -> { int lines = Integer.parseInt(data); - for (int i = 0; i < lines; i++) player.sendMessage(" "); + for (int i = 0; i < lines; i++) player.sendMessage(Component.text(" ")); }); registerAction("[FIREWORK]", data -> (player, queue) -> { diff --git a/src/main/java/me/espryth/easyjoin/util/AvatarUtils.java b/src/main/java/me/espryth/easyjoin/util/AvatarUtils.java index 763238f..b7713b7 100644 --- a/src/main/java/me/espryth/easyjoin/util/AvatarUtils.java +++ b/src/main/java/me/espryth/easyjoin/util/AvatarUtils.java @@ -7,6 +7,7 @@ import javax.imageio.ImageIO; import java.awt.image.BufferedImage; import java.io.IOException; +import java.net.URI; import java.net.URL; import java.util.ArrayList; import java.util.List; @@ -19,7 +20,7 @@ public static List getAvatar(Player player) { public static List getAvatar(String playerName) { try { - URL url = new URL("https://mc-heads.net/avatar/" + playerName + "/8"); + URL url = URI.create("https://mc-heads.net/avatar/" + playerName + "/8").toURL(); BufferedImage image = ImageIO.read(url); List lines = new ArrayList<>(); From 4a5f3f7aad5a8f857f3b986d702355ad085407e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjam=C3=ADn=20Isasmendi=20C?= Date: Wed, 18 Feb 2026 09:13:09 -0400 Subject: [PATCH 05/14] refactor ActionService --- .../easyjoin/service/ActionService.java | 242 +++++++++--------- 1 file changed, 116 insertions(+), 126 deletions(-) diff --git a/src/main/java/me/espryth/easyjoin/service/ActionService.java b/src/main/java/me/espryth/easyjoin/service/ActionService.java index 51ab5d1..6a7e105 100644 --- a/src/main/java/me/espryth/easyjoin/service/ActionService.java +++ b/src/main/java/me/espryth/easyjoin/service/ActionService.java @@ -1,20 +1,21 @@ package me.espryth.easyjoin.service; import com.thewinterframework.service.annotation.Service; +import me.clip.placeholderapi.PlaceholderAPI; import me.espryth.easyjoin.action.Action; import me.espryth.easyjoin.util.AvatarUtils; import me.espryth.easyjoin.util.MessageUtils; import net.kyori.adventure.text.Component; import net.kyori.adventure.text.serializer.gson.GsonComponentSerializer; -import org.bukkit.Bukkit; -import org.bukkit.Color; -import org.bukkit.FireworkEffect; -import org.bukkit.Sound; +import net.kyori.adventure.title.Title; +import org.bukkit.*; import org.bukkit.entity.EntityType; import org.bukkit.entity.Firework; +import org.bukkit.entity.Player; import org.bukkit.inventory.meta.FireworkMeta; import java.util.*; +import java.util.function.Consumer; @Service public class ActionService { @@ -42,28 +43,14 @@ public Optional parseAction(String line) { } private void registerDefaultActions() { - registerAction("[MESSAGE]", data -> (player, queue) -> { - Component msg = MessageUtils.colorizeToComponent(me.clip.placeholderapi.PlaceholderAPI.setPlaceholders(player, data)); - if (data.startsWith("")) { - String legacy = MessageUtils.formatString(player, data); - Component centeredMsg = MessageUtils.colorizeToComponent(MessageUtils.getCenteredMessage(legacy.replace("", ""))); - player.sendMessage(centeredMsg); - } else { - player.sendMessage(msg); - } - }); + // Mensajes + registerAction("[MESSAGE]", data -> (player, queue) -> + sendMessage(player, data, player::sendMessage)); - registerAction("[BROADCAST]", data -> (player, queue) -> { - Component msg = MessageUtils.colorizeToComponent(me.clip.placeholderapi.PlaceholderAPI.setPlaceholders(player, data)); - if (data.startsWith("")) { - String legacy = MessageUtils.formatString(player, data); - Component centeredMsg = MessageUtils.colorizeToComponent(MessageUtils.getCenteredMessage(legacy.replace("", ""))); - Bukkit.broadcast(centeredMsg); - } else { - Bukkit.broadcast(msg); - } - }); + registerAction("[BROADCAST]", data -> (player, queue) -> + sendMessage(player, data, Bukkit::broadcast)); + // Mensajes JSON registerAction("[JSON_MESSAGE]", data -> (player, queue) -> { String json = MessageUtils.formatString(player, data); player.sendMessage(GsonComponentSerializer.gson().deserialize(json)); @@ -74,106 +61,36 @@ private void registerDefaultActions() { Bukkit.broadcast(GsonComponentSerializer.gson().deserialize(json)); }); + // Action bar registerAction("[ACTIONBAR]", data -> (player, queue) -> { - String[] parts = data.split(";"); - Component msg = MessageUtils.colorizeToComponent(me.clip.placeholderapi.PlaceholderAPI.setPlaceholders(player, parts[0])); + Component msg = MessageUtils.colorizeToComponent(PlaceholderAPI.setPlaceholders(player, data)); player.sendActionBar(msg); }); registerAction("[BROADCAST_ACTIONBAR]", data -> (player, queue) -> { - String[] parts = data.split(";"); - Component msg = MessageUtils.colorizeToComponent(me.clip.placeholderapi.PlaceholderAPI.setPlaceholders(player, parts[0])); - Bukkit.broadcast(msg); + Component msg = MessageUtils.colorizeToComponent(PlaceholderAPI.setPlaceholders(player, data)); + Bukkit.getOnlinePlayers().forEach(p -> p.sendActionBar(msg)); }); - registerAction("[TITLE]", data -> (player, queue) -> { - String[] parts = data.split(";"); - String titleStr = parts.length > 0 ? parts[0] : ""; - String subtitleStr = parts.length > 1 ? parts[1] : ""; - int fadeIn = parts.length > 2 ? Integer.parseInt(parts[2]) : 10; - int stay = parts.length > 3 ? Integer.parseInt(parts[3]) : 70; - int fadeOut = parts.length > 4 ? Integer.parseInt(parts[4]) : 20; - - Component title = MessageUtils.colorizeToComponent(me.clip.placeholderapi.PlaceholderAPI.setPlaceholders(player, titleStr)); - Component subtitle = MessageUtils.colorizeToComponent(me.clip.placeholderapi.PlaceholderAPI.setPlaceholders(player, subtitleStr)); - - player.showTitle(net.kyori.adventure.title.Title.title(title, subtitle, net.kyori.adventure.title.Title.Times.times( - java.time.Duration.ofMillis(fadeIn * 50L), - java.time.Duration.ofMillis(stay * 50L), - java.time.Duration.ofMillis(fadeOut * 50L) - ))); - }); + registerAction("[TITLE]", data -> (player, queue) -> + showTitle(player, data, player::showTitle)); - registerAction("[BROADCAST_TITLE]", data -> (player, queue) -> { - String[] parts = data.split(";"); - String titleStr = parts.length > 0 ? parts[0] : ""; - String subtitleStr = parts.length > 1 ? parts[1] : ""; - int fadeIn = parts.length > 2 ? Integer.parseInt(parts[2]) : 10; - int stay = parts.length > 3 ? Integer.parseInt(parts[3]) : 70; - int fadeOut = parts.length > 4 ? Integer.parseInt(parts[4]) : 20; - - Component title = MessageUtils.colorizeToComponent(me.clip.placeholderapi.PlaceholderAPI.setPlaceholders(player, titleStr)); - Component subtitle = MessageUtils.colorizeToComponent(me.clip.placeholderapi.PlaceholderAPI.setPlaceholders(player, subtitleStr)); - - Bukkit.getOnlinePlayers().forEach(p -> p.showTitle(net.kyori.adventure.title.Title.title(title, subtitle, net.kyori.adventure.title.Title.Times.times( - java.time.Duration.ofMillis(fadeIn * 50L), - java.time.Duration.ofMillis(stay * 50L), - java.time.Duration.ofMillis(fadeOut * 50L) - )))); - }); + registerAction("[BROADCAST_TITLE]", data -> (player, queue) -> + showTitle(player, data, title -> Bukkit.getOnlinePlayers().forEach(p -> p.showTitle(title)))); - registerAction("[AVATAR_MESSAGE]", data -> (player, queue) -> { - List avatar = AvatarUtils.getAvatar(player); - String[] lines = data.split(""); - for (int i = 0; i < 8; i++) { - Component avatarLine = avatar.size() > i ? avatar.get(i) : Component.text(" "); - String messageLine = lines.length > i ? lines[i] : ""; - Component formattedMessageLine = MessageUtils.colorizeToComponent(me.clip.placeholderapi.PlaceholderAPI.setPlaceholders(player, messageLine)); - player.sendMessage(avatarLine.append(Component.text(" ")).append(formattedMessageLine)); - } - }); + registerAction("[AVATAR_MESSAGE]", data -> (player, queue) -> + sendAvatarMessage(player, data, player::sendMessage)); - registerAction("[AVATAR_BROADCAST]", data -> (player, queue) -> { - List avatar = AvatarUtils.getAvatar(player); - String[] lines = data.split(""); - for (int i = 0; i < 8; i++) { - Component avatarLine = avatar.size() > i ? avatar.get(i) : Component.text(" "); - String messageLine = lines.length > i ? lines[i] : ""; - Component formattedMessageLine = MessageUtils.colorizeToComponent(me.clip.placeholderapi.PlaceholderAPI.setPlaceholders(player, messageLine)); - Bukkit.broadcast(avatarLine.append(Component.text(" ")).append(formattedMessageLine)); - } - }); + registerAction("[AVATAR_BROADCAST]", data -> (player, queue) -> + sendAvatarMessage(player, data, Bukkit::broadcast)); registerAction("[CLEARCHAT]", data -> (player, queue) -> { int lines = Integer.parseInt(data); for (int i = 0; i < lines; i++) player.sendMessage(Component.text(" ")); }); - registerAction("[FIREWORK]", data -> (player, queue) -> { - String[] parts = data.split(";"); - if (parts.length < 3) return; - try { - FireworkEffect.Type type = FireworkEffect.Type.valueOf(parts[0].toUpperCase()); - int amount = Integer.parseInt(parts[1]); - int power = Integer.parseInt(parts[2]); - List colors = new ArrayList<>(); - List fades = new ArrayList<>(); - for (int i = 3; i < parts.length; i++) { - String[] rgb = parts[i].split(","); - Color color = Color.fromRGB(Integer.parseInt(rgb[0]), Integer.parseInt(rgb[1]), Integer.parseInt(rgb[2])); - if (i % 2 == 0) fades.add(color); else colors.add(color); - } - Firework firework = (Firework) player.getLocation().getWorld().spawnEntity(player.getLocation(), EntityType.FIREWORK_ROCKET); - FireworkMeta meta = firework.getFireworkMeta(); - meta.setPower(power); - meta.addEffect(FireworkEffect.builder().with(type).withColor(colors).withFade(fades).trail(true).build()); - firework.setFireworkMeta(meta); - for (int i = 1; i < amount; i++) { - Firework f = (Firework) player.getLocation().getWorld().spawnEntity(player.getLocation(), EntityType.FIREWORK_ROCKET); - f.setFireworkMeta(meta); - } - } catch (Exception ignored) {} - }); + registerAction("[FIREWORK]", data -> (player, queue) -> + spawnFirework(player, data)); registerAction("[CONSOLE]", data -> (player, queue) -> { String cmd = MessageUtils.formatString(player, data); @@ -185,25 +102,12 @@ private void registerDefaultActions() { player.performCommand(cmd); }); - registerAction("[SOUND]", data -> (player, queue) -> { - String[] parts = data.split(";"); - try { - Sound sound = Sound.valueOf(parts[0].toUpperCase()); - float volume = parts.length > 1 ? Float.parseFloat(parts[1]) : 1.0f; - float pitch = parts.length > 2 ? Float.parseFloat(parts[2]) : 1.0f; - player.playSound(player.getLocation(), sound, volume, pitch); - } catch (Exception ignored) {} - }); + registerAction("[SOUND]", data -> (player, queue) -> + playSound(player, data, player::playSound)); - registerAction("[BROADCAST_SOUND]", data -> (player, queue) -> { - String[] parts = data.split(";"); - try { - Sound sound = Sound.valueOf(parts[0].toUpperCase()); - float volume = parts.length > 1 ? Float.parseFloat(parts[1]) : 1.0f; - float pitch = parts.length > 2 ? Float.parseFloat(parts[2]) : 1.0f; - Bukkit.getOnlinePlayers().forEach(p -> p.playSound(p.getLocation(), sound, volume, pitch)); - } catch (Exception ignored) {} - }); + registerAction("[BROADCAST_SOUND]", data -> (player, queue) -> + playSound(player, data, (loc, sound, vol, pitch) -> + Bukkit.getOnlinePlayers().forEach(p -> p.playSound(loc, sound, vol, pitch)))); registerAction("[DELAY]", data -> (player, queue) -> { try { @@ -217,6 +121,92 @@ private void registerDefaultActions() { }); } + private void sendMessage(Player player, String data, Consumer sender) { + Component msg = MessageUtils.colorizeToComponent(PlaceholderAPI.setPlaceholders(player, data)); + if (data.startsWith("")) { + String legacy = MessageUtils.formatString(player, data); + Component centeredMsg = MessageUtils.colorizeToComponent(MessageUtils.getCenteredMessage(legacy.replace("", ""))); + sender.accept(centeredMsg); + } else { + sender.accept(msg); + } + } + + private void showTitle(Player player, String data, Consumer titleSender) { + String[] parts = data.split(";"); + String titleStr = parts.length > 0 ? parts[0] : ""; + String subtitleStr = parts.length > 1 ? parts[1] : ""; + int fadeIn = parts.length > 2 ? Integer.parseInt(parts[2]) : 10; + int stay = parts.length > 3 ? Integer.parseInt(parts[3]) : 70; + int fadeOut = parts.length > 4 ? Integer.parseInt(parts[4]) : 20; + + Component title = MessageUtils.colorizeToComponent(PlaceholderAPI.setPlaceholders(player, titleStr)); + Component subtitle = MessageUtils.colorizeToComponent(PlaceholderAPI.setPlaceholders(player, subtitleStr)); + + var titleObj = Title.title( + title, + subtitle, + Title.Times.times( + java.time.Duration.ofMillis(fadeIn * 50L), + java.time.Duration.ofMillis(stay * 50L), + java.time.Duration.ofMillis(fadeOut * 50L) + ) + ); + titleSender.accept(titleObj); + } + + private void sendAvatarMessage(Player player, String data, Consumer<Component> sender) { + List<Component> avatar = AvatarUtils.getAvatar(player); + String[] lines = data.split("<nl>"); + for (int i = 0; i < 8; i++) { + Component avatarLine = avatar.size() > i ? avatar.get(i) : Component.text(" "); + String messageLine = lines.length > i ? lines[i] : ""; + Component formattedMessageLine = MessageUtils.colorizeToComponent(PlaceholderAPI.setPlaceholders(player, messageLine)); + sender.accept(avatarLine.append(Component.text(" ")).append(formattedMessageLine)); + } + } + + private void spawnFirework(Player player, String data) { + String[] parts = data.split(";"); + if (parts.length < 3) return; + try { + FireworkEffect.Type type = FireworkEffect.Type.valueOf(parts[0].toUpperCase()); + int amount = Integer.parseInt(parts[1]); + int power = Integer.parseInt(parts[2]); + List<Color> colors = new ArrayList<>(); + List<Color> fades = new ArrayList<>(); + for (int i = 3; i < parts.length; i++) { + String[] rgb = parts[i].split(","); + Color color = Color.fromRGB(Integer.parseInt(rgb[0]), Integer.parseInt(rgb[1]), Integer.parseInt(rgb[2])); + if (i % 2 == 0) fades.add(color); else colors.add(color); + } + Firework firework = (Firework) player.getLocation().getWorld().spawnEntity(player.getLocation(), EntityType.FIREWORK_ROCKET); + FireworkMeta meta = firework.getFireworkMeta(); + meta.setPower(power); + meta.addEffect(FireworkEffect.builder().with(type).withColor(colors).withFade(fades).trail(true).build()); + firework.setFireworkMeta(meta); + for (int i = 1; i < amount; i++) { + Firework f = (Firework) player.getLocation().getWorld().spawnEntity(player.getLocation(), EntityType.FIREWORK_ROCKET); + f.setFireworkMeta(meta); + } + } catch (Exception ignored) {} + } + + @FunctionalInterface + private interface SoundPlayer { + void play(Location location, Sound sound, float volume, float pitch); + } + + private void playSound(org.bukkit.entity.Player player, String data, SoundPlayer soundPlayer) { + String[] parts = data.split(";"); + try { + Sound sound = Sound.valueOf(parts[0].toUpperCase()); + float volume = parts.length > 1 ? Float.parseFloat(parts[1]) : 1.0f; + float pitch = parts.length > 2 ? Float.parseFloat(parts[2]) : 1.0f; + soundPlayer.play(player.getLocation(), sound, volume, pitch); + } catch (Exception ignored) {} + } + @FunctionalInterface public interface ActionFactory { Action create(String data); From 7a712b5bdb77d87b50a9ac62a3c67c9a2261aae7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjam=C3=ADn=20Isasmendi=20C?= <bisasmendic@gmail.com> Date: Wed, 18 Feb 2026 11:42:29 -0400 Subject: [PATCH 06/14] minor refactor --- build.gradle.kts | 20 +- .../espryth/easyjoin/command/MainCommand.java | 36 +++- .../me/espryth/easyjoin/config/AppConfig.java | 3 +- .../easyjoin/database/DatabaseService.java | 86 +++++++++ .../easyjoin/database/FirstJoinDao.java | 17 ++ .../me/espryth/easyjoin/format/Format.java | 3 +- .../easyjoin/listener/PlayerListener.java | 6 +- .../easyjoin/service/ActionService.java | 129 ++++++++----- .../easyjoin/service/FirstJoinService.java | 81 +++----- .../easyjoin/service/FormatService.java | 27 ++- .../me/espryth/easyjoin/util/AvatarUtils.java | 181 ++++++++++++++++-- src/main/resources/config.yml | 139 +++++++++++++- src/main/resources/plugin.yml | 2 + 13 files changed, 588 insertions(+), 142 deletions(-) create mode 100644 src/main/java/me/espryth/easyjoin/database/DatabaseService.java create mode 100644 src/main/java/me/espryth/easyjoin/database/FirstJoinDao.java diff --git a/build.gradle.kts b/build.gradle.kts index fcd6d80..39b1a0c 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -38,9 +38,13 @@ dependencies { api("com.thewinterframework:configuration:1.0.2") { exclude(group = "io.papermc.paper", module = "paper-api") + exclude(group = "org.spongepowered", module = "configurate-core") + exclude(group = "org.spongepowered", module = "configurate-hocon") } annotationProcessor("com.thewinterframework:configuration:1.0.2") + api("org.spongepowered:configurate-core:4.2.0") + api("org.spongepowered:configurate-hocon:4.2.0") api("com.thewinterframework:command:1.0.1") { exclude(group = "io.papermc.paper", module = "paper-api") exclude(group = "org.incendo", module = "cloud-paper") @@ -53,12 +57,12 @@ dependencies { api("org.incendo:cloud-paper:2.0.0-beta.10") api("org.incendo:cloud-annotations:2.0.0") compileOnly("me.clip:placeholderapi:2.11.6") - compileOnly("fr.xephi:authme:5.6.0-SNAPSHOT") - compileOnly("com.nickuc.login:nlogin-api:10.0") - implementation("com.zaxxer:HikariCP:7.0.2") - implementation("net.kyori:adventure-text-serializer-legacy:4.26.1") - implementation("net.kyori:adventure-text-minimessage:4.26.1") + api("org.jdbi:jdbi3-core:3.45.4") + api("org.jdbi:jdbi3-sqlobject:3.45.4") + api("com.zaxxer:HikariCP:6.2.1") + //implementation("net.kyori:adventure-text-serializer-legacy:4.26.1") + //implementation("net.kyori:adventure-text-minimessage:4.26.1") } @@ -67,6 +71,9 @@ tasks.shadowJar { exclude(dependency("com.thewinterframework:.*")) exclude(dependency("com.google.inject:.*")) exclude(dependency("org.incendo:.*")) + exclude(dependency("org.spongepowered:.*")) + exclude(dependency("org.jdbi:.*")) + exclude(dependency("com.zaxxer:.*")) } relocate("com.thewinterframework", "me.espryth.easyjoin.libs.winter") @@ -75,6 +82,9 @@ tasks.shadowJar { relocate("javax.inject", "me.espryth.easyjoin.libs.inject") relocate("aopalliance", "me.espryth.easyjoin.libs.aopalliance") relocate("io.leangen.geantyref", "me.espryth.easyjoin.libs.geantyref") + relocate("org.spongepowered.configurate", "me.espryth.easyjoin.libs.configurate") + relocate("org.jdbi", "me.espryth.easyjoin.libs.jdbi") + relocate("com.zaxxer.hikari", "me.espryth.easyjoin.libs.hikari") exclude("org/checkerframework/**") exclude("META-INF/maven/org.checkerframework/**") diff --git a/src/main/java/me/espryth/easyjoin/command/MainCommand.java b/src/main/java/me/espryth/easyjoin/command/MainCommand.java index ff40f02..0f1a364 100644 --- a/src/main/java/me/espryth/easyjoin/command/MainCommand.java +++ b/src/main/java/me/espryth/easyjoin/command/MainCommand.java @@ -1,25 +1,34 @@ package me.espryth.easyjoin.command; -import com.google.inject.Inject; +import jakarta.inject.Inject; import com.thewinterframework.command.CommandComponent; import com.thewinterframework.service.ReloadServiceManager; +import me.espryth.easyjoin.action.ActionQueue; +import me.espryth.easyjoin.format.Format; import me.espryth.easyjoin.service.FormatService; import me.espryth.easyjoin.util.MessageUtils; import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; +import org.incendo.cloud.annotations.Argument; import org.incendo.cloud.annotations.Command; import org.incendo.cloud.annotations.Permission; import org.incendo.cloud.paper.util.sender.Source; +import org.slf4j.Logger; + +import java.util.Optional; @CommandComponent public class MainCommand { private final ReloadServiceManager reloadServiceManager; private final FormatService formatService; + private final Logger logger; @Inject - public MainCommand(ReloadServiceManager reloadServiceManager, FormatService formatService) { + public MainCommand(ReloadServiceManager reloadServiceManager, FormatService formatService, Logger logger) { this.reloadServiceManager = reloadServiceManager; this.formatService = formatService; + this.logger = logger; } @Command("easyjoin") @@ -28,6 +37,7 @@ public void mainHelp(Source source) { sender.sendMessage(MessageUtils.colorize("&e&lEasy&6&lJoin &fV3")); if (sender.hasPermission("easyjoin.admin")) { sender.sendMessage(MessageUtils.colorize("&f- /ej reload")); + sender.sendMessage(MessageUtils.colorize("&f- /ej join <formatId> - simulate join for the given format (player only)")); } } @@ -36,7 +46,27 @@ public void mainHelp(Source source) { public void reload(Source source) { CommandSender sender = (CommandSender) source.source(); reloadServiceManager.reload(); - formatService.loadFormats(); + formatService.loadFormats(logger); sender.sendMessage(MessageUtils.colorize("&aConfiguration reloaded!")); } + + @Command("easyjoin testjoin <formatId>") + @Permission("easyjoin.admin") + public void testJoin(Source source, @Argument("formatId") String formatId) { + CommandSender sender = (CommandSender) source.source(); + if (!(sender instanceof Player)) { + sender.sendMessage(MessageUtils.colorize("&cThis command can only be used by a player.")); + return; + } + + Player player = (Player) sender; + Optional<Format> formatOpt = formatService.getFormatById(formatId); + if (formatOpt.isEmpty()) { + sender.sendMessage(MessageUtils.colorize("&cNo format found with id: " + formatId)); + return; + } + + new ActionQueue(formatOpt.get().joinActions(), null).executeAll(player); + sender.sendMessage(MessageUtils.colorize("&aExecuted join actions for format: " + formatId)); + } } diff --git a/src/main/java/me/espryth/easyjoin/config/AppConfig.java b/src/main/java/me/espryth/easyjoin/config/AppConfig.java index d69ba92..a85c3b4 100644 --- a/src/main/java/me/espryth/easyjoin/config/AppConfig.java +++ b/src/main/java/me/espryth/easyjoin/config/AppConfig.java @@ -17,8 +17,7 @@ public record FormatSection( int priority, @Setting("isFirstJoinFormat") boolean isFirstJoinFormat, @Setting("join") ActionSection join, - @Setting("quit") ActionSection quit, - @Setting("auth") ActionSection auth + @Setting("quit") ActionSection quit ) {} @ConfigSerializable diff --git a/src/main/java/me/espryth/easyjoin/database/DatabaseService.java b/src/main/java/me/espryth/easyjoin/database/DatabaseService.java new file mode 100644 index 0000000..abb194a --- /dev/null +++ b/src/main/java/me/espryth/easyjoin/database/DatabaseService.java @@ -0,0 +1,86 @@ +package me.espryth.easyjoin.database; + +import com.thewinterframework.configurate.Container; +import com.thewinterframework.service.annotation.Service; +import com.thewinterframework.service.annotation.lifecycle.OnDisable; +import com.thewinterframework.service.annotation.lifecycle.OnEnable; +import com.zaxxer.hikari.HikariConfig; +import com.zaxxer.hikari.HikariDataSource; +import jakarta.inject.Inject; +import me.espryth.easyjoin.config.AppConfig; +import me.espryth.easyjoin.config.CredentialsConfig; +import org.jdbi.v3.core.Jdbi; +import org.jdbi.v3.sqlobject.SqlObjectPlugin; +import org.slf4j.Logger; + +import java.util.Optional; + +@Service +public class DatabaseService { + + private final Container<AppConfig> appConfig; + private final Container<CredentialsConfig> credentialsConfig; + private HikariDataSource dataSource; + private Jdbi jdbi; + private boolean enabled = false; + + @Inject + public DatabaseService(Container<AppConfig> appConfig, Container<CredentialsConfig> credentialsConfig) { + this.appConfig = appConfig; + this.credentialsConfig = credentialsConfig; + } + + @OnEnable + public void setup(Logger logger) { + if (!appConfig.get().firstJoinMode().equalsIgnoreCase("MYSQL")) { + logger.info("Database mode is not MYSQL, skipping database initialization"); + return; + } + + try { + CredentialsConfig creds = credentialsConfig.get(); + + HikariConfig config = new HikariConfig(); + config.setJdbcUrl(String.format( + "jdbc:mysql://%s:%d/%s?useSSL=%s&allowPublicKeyRetrieval=true", + creds.host(), creds.port(), creds.database(), creds.useSsl() + )); + config.setUsername(creds.username()); + config.setPassword(creds.password()); + config.setMaximumPoolSize(10); + config.setMinimumIdle(2); + config.setIdleTimeout(300000); + config.setConnectionTimeout(10000); + config.setPoolName("EasyJoin-Pool"); + + this.dataSource = new HikariDataSource(config); + this.jdbi = Jdbi.create(dataSource); + this.jdbi.installPlugin(new SqlObjectPlugin()); + + jdbi.useExtension(FirstJoinDao.class, FirstJoinDao::createTable); + + this.enabled = true; + logger.info("Database connection established successfully!"); + + } catch (Exception e) { + logger.error("Failed to initialize database connection", e); + this.enabled = false; + } + } + + @OnDisable + public void shutdown(Logger logger) { + if (dataSource != null && !dataSource.isClosed()) { + dataSource.close(); + logger.info("Database connection closed"); + } + } + + public boolean isEnabled() { + return enabled && dataSource != null && !dataSource.isClosed(); + } + + public Optional<Jdbi> getJdbi() { + return isEnabled() ? Optional.of(jdbi) : Optional.empty(); + } +} diff --git a/src/main/java/me/espryth/easyjoin/database/FirstJoinDao.java b/src/main/java/me/espryth/easyjoin/database/FirstJoinDao.java new file mode 100644 index 0000000..0e7bb94 --- /dev/null +++ b/src/main/java/me/espryth/easyjoin/database/FirstJoinDao.java @@ -0,0 +1,17 @@ +package me.espryth.easyjoin.database; + +import org.jdbi.v3.sqlobject.customizer.Bind; +import org.jdbi.v3.sqlobject.statement.SqlQuery; +import org.jdbi.v3.sqlobject.statement.SqlUpdate; + +public interface FirstJoinDao { + + @SqlUpdate("CREATE TABLE IF NOT EXISTS EJFirstJoin(uuid VARCHAR(36) PRIMARY KEY)") + void createTable(); + + @SqlQuery("SELECT COUNT(*) > 0 FROM EJFirstJoin WHERE uuid = :uuid") + boolean exists(@Bind("uuid") String uuid); + + @SqlUpdate("INSERT IGNORE INTO EJFirstJoin(uuid) VALUES(:uuid)") + void insert(@Bind("uuid") String uuid); +} diff --git a/src/main/java/me/espryth/easyjoin/format/Format.java b/src/main/java/me/espryth/easyjoin/format/Format.java index f9f0dfe..51b6745 100644 --- a/src/main/java/me/espryth/easyjoin/format/Format.java +++ b/src/main/java/me/espryth/easyjoin/format/Format.java @@ -9,6 +9,5 @@ public record Format( int priority, boolean isFirstJoinFormat, List<Action> joinActions, - List<Action> quitActions, - List<Action> authActions + List<Action> quitActions ) {} diff --git a/src/main/java/me/espryth/easyjoin/listener/PlayerListener.java b/src/main/java/me/espryth/easyjoin/listener/PlayerListener.java index 5ad74e9..b1fe235 100644 --- a/src/main/java/me/espryth/easyjoin/listener/PlayerListener.java +++ b/src/main/java/me/espryth/easyjoin/listener/PlayerListener.java @@ -1,6 +1,7 @@ package me.espryth.easyjoin.listener; -import com.thewinterframework.service.annotation.Service; +import com.thewinterframework.paper.listener.ListenerComponent; +import jakarta.inject.Inject; import me.espryth.easyjoin.action.ActionQueue; import me.espryth.easyjoin.format.Format; import me.espryth.easyjoin.service.FirstJoinService; @@ -14,13 +15,14 @@ import java.util.Optional; -@Service +@ListenerComponent public class PlayerListener implements Listener { private final Plugin plugin; private final FormatService formatService; private final FirstJoinService firstJoinService; + @Inject public PlayerListener(Plugin plugin, FormatService formatService, FirstJoinService firstJoinService) { this.plugin = plugin; this.formatService = formatService; diff --git a/src/main/java/me/espryth/easyjoin/service/ActionService.java b/src/main/java/me/espryth/easyjoin/service/ActionService.java index 6a7e105..5a5c98e 100644 --- a/src/main/java/me/espryth/easyjoin/service/ActionService.java +++ b/src/main/java/me/espryth/easyjoin/service/ActionService.java @@ -5,6 +5,8 @@ import me.espryth.easyjoin.action.Action; import me.espryth.easyjoin.util.AvatarUtils; import me.espryth.easyjoin.util.MessageUtils; +import net.kyori.adventure.key.Key; +import net.kyori.adventure.sound.Sound; import net.kyori.adventure.text.Component; import net.kyori.adventure.text.serializer.gson.GsonComponentSerializer; import net.kyori.adventure.title.Title; @@ -14,6 +16,7 @@ import org.bukkit.entity.Player; import org.bukkit.inventory.meta.FireworkMeta; +import java.time.Duration; import java.util.*; import java.util.function.Consumer; @@ -43,14 +46,12 @@ public Optional<Action> parseAction(String line) { } private void registerDefaultActions() { - // Mensajes registerAction("[MESSAGE]", data -> (player, queue) -> - sendMessage(player, data, player::sendMessage)); + sendMessage(player, data, player::sendMessage)); registerAction("[BROADCAST]", data -> (player, queue) -> - sendMessage(player, data, Bukkit::broadcast)); + sendMessage(player, data, Bukkit::broadcast)); - // Mensajes JSON registerAction("[JSON_MESSAGE]", data -> (player, queue) -> { String json = MessageUtils.formatString(player, data); player.sendMessage(GsonComponentSerializer.gson().deserialize(json)); @@ -61,7 +62,6 @@ private void registerDefaultActions() { Bukkit.broadcast(GsonComponentSerializer.gson().deserialize(json)); }); - // Action bar registerAction("[ACTIONBAR]", data -> (player, queue) -> { Component msg = MessageUtils.colorizeToComponent(PlaceholderAPI.setPlaceholders(player, data)); player.sendActionBar(msg); @@ -73,16 +73,16 @@ private void registerDefaultActions() { }); registerAction("[TITLE]", data -> (player, queue) -> - showTitle(player, data, player::showTitle)); + showTitle(player, data, player::showTitle)); registerAction("[BROADCAST_TITLE]", data -> (player, queue) -> - showTitle(player, data, title -> Bukkit.getOnlinePlayers().forEach(p -> p.showTitle(title)))); + showTitle(player, data, title -> Bukkit.getOnlinePlayers().forEach(p -> p.showTitle(title)))); registerAction("[AVATAR_MESSAGE]", data -> (player, queue) -> - sendAvatarMessage(player, data, player::sendMessage)); + sendAvatarMessage(player, data, player::sendMessage)); registerAction("[AVATAR_BROADCAST]", data -> (player, queue) -> - sendAvatarMessage(player, data, Bukkit::broadcast)); + sendAvatarMessage(player, data, Bukkit::broadcast)); registerAction("[CLEARCHAT]", data -> (player, queue) -> { int lines = Integer.parseInt(data); @@ -90,7 +90,7 @@ private void registerDefaultActions() { }); registerAction("[FIREWORK]", data -> (player, queue) -> - spawnFirework(player, data)); + spawnFirework(player, data)); registerAction("[CONSOLE]", data -> (player, queue) -> { String cmd = MessageUtils.formatString(player, data); @@ -103,11 +103,10 @@ private void registerDefaultActions() { }); registerAction("[SOUND]", data -> (player, queue) -> - playSound(player, data, player::playSound)); + playSoundCommand(player, data)); registerAction("[BROADCAST_SOUND]", data -> (player, queue) -> - playSound(player, data, (loc, sound, vol, pitch) -> - Bukkit.getOnlinePlayers().forEach(p -> p.playSound(loc, sound, vol, pitch)))); + playBroadcastSoundCommand(data)); registerAction("[DELAY]", data -> (player, queue) -> { try { @@ -144,13 +143,13 @@ private void showTitle(Player player, String data, Consumer<Title> titleSender) Component subtitle = MessageUtils.colorizeToComponent(PlaceholderAPI.setPlaceholders(player, subtitleStr)); var titleObj = Title.title( - title, - subtitle, - Title.Times.times( - java.time.Duration.ofMillis(fadeIn * 50L), - java.time.Duration.ofMillis(stay * 50L), - java.time.Duration.ofMillis(fadeOut * 50L) - ) + title, + subtitle, + Title.Times.times( + Duration.ofMillis(fadeIn * 50L), + Duration.ofMillis(stay * 50L), + Duration.ofMillis(fadeOut * 50L) + ) ); titleSender.accept(titleObj); } @@ -169,46 +168,74 @@ private void sendAvatarMessage(Player player, String data, Consumer<Component> s private void spawnFirework(Player player, String data) { String[] parts = data.split(";"); if (parts.length < 3) return; + FireworkEffect.Type type = FireworkEffect.Type.valueOf(parts[0].toUpperCase()); + int amount = Integer.parseInt(parts[1]); + int power = Integer.parseInt(parts[2]); + List<Color> colors = new ArrayList<>(); + List<Color> fades = new ArrayList<>(); + + for (int i = 3; i < parts.length; i++) { + String[] rgb = parts[i].split(","); + Color color = Color.fromRGB(Integer.parseInt(rgb[0]), Integer.parseInt(rgb[1]), Integer.parseInt(rgb[2])); + if (i % 2 == 0) fades.add(color); else colors.add(color); + } + + Firework firework = (Firework) player.getLocation().getWorld().spawnEntity(player.getLocation(), EntityType.FIREWORK_ROCKET); + FireworkMeta meta = firework.getFireworkMeta(); + meta.setPower(power); + meta.addEffect(FireworkEffect.builder().with(type).withColor(colors).withFade(fades).trail(true).build()); + firework.setFireworkMeta(meta); + + for (int i = 1; i < amount; i++) { + Firework f = (Firework) player.getLocation().getWorld().spawnEntity(player.getLocation(), EntityType.FIREWORK_ROCKET); + f.setFireworkMeta(meta); + } + } + + private Sound parseSound(String data) { + String[] parts = data.split(";"); + String soundName = parts.length > 0 ? parts[0].trim() : ""; + float volume = parts.length > 1 ? Float.parseFloat(parts[1]) : 1.0f; + float pitch = parts.length > 2 ? Float.parseFloat(parts[2]) : 1.0f; + String sourceName = parts.length > 3 ? parts[3].toUpperCase() : "MASTER"; + + Key key; try { - FireworkEffect.Type type = FireworkEffect.Type.valueOf(parts[0].toUpperCase()); - int amount = Integer.parseInt(parts[1]); - int power = Integer.parseInt(parts[2]); - List<Color> colors = new ArrayList<>(); - List<Color> fades = new ArrayList<>(); - for (int i = 3; i < parts.length; i++) { - String[] rgb = parts[i].split(","); - Color color = Color.fromRGB(Integer.parseInt(rgb[0]), Integer.parseInt(rgb[1]), Integer.parseInt(rgb[2])); - if (i % 2 == 0) fades.add(color); else colors.add(color); + org.bukkit.Sound bukkitSound = org.bukkit.Sound.valueOf(soundName.toUpperCase()); + key = bukkitSound.key(); + } catch (IllegalArgumentException e) { + String lowerCase = soundName.toLowerCase(); + if (soundName.contains(":")) { + key = Key.key(lowerCase); + } else { + key = Key.key("minecraft", lowerCase); } - Firework firework = (Firework) player.getLocation().getWorld().spawnEntity(player.getLocation(), EntityType.FIREWORK_ROCKET); - FireworkMeta meta = firework.getFireworkMeta(); - meta.setPower(power); - meta.addEffect(FireworkEffect.builder().with(type).withColor(colors).withFade(fades).trail(true).build()); - firework.setFireworkMeta(meta); - for (int i = 1; i < amount; i++) { - Firework f = (Firework) player.getLocation().getWorld().spawnEntity(player.getLocation(), EntityType.FIREWORK_ROCKET); - f.setFireworkMeta(meta); - } - } catch (Exception ignored) {} + } + + Sound.Source source = Sound.Source.MASTER; + try { + source = Sound.Source.valueOf(sourceName); + } catch (IllegalArgumentException ignored) {} + + return Sound.sound(key, source, volume, pitch); } - @FunctionalInterface - private interface SoundPlayer { - void play(Location location, Sound sound, float volume, float pitch); + private void playSoundCommand(Player player, String data) { + Sound sound = parseSound(data); + player.playSound(sound); + } - private void playSound(org.bukkit.entity.Player player, String data, SoundPlayer soundPlayer) { - String[] parts = data.split(";"); - try { - Sound sound = Sound.valueOf(parts[0].toUpperCase()); - float volume = parts.length > 1 ? Float.parseFloat(parts[1]) : 1.0f; - float pitch = parts.length > 2 ? Float.parseFloat(parts[2]) : 1.0f; - soundPlayer.play(player.getLocation(), sound, volume, pitch); - } catch (Exception ignored) {} + private void playBroadcastSoundCommand(String data) { + Sound sound = parseSound(data); + for (Player p : Bukkit.getOnlinePlayers()) { + p.playSound(sound); + } + } @FunctionalInterface public interface ActionFactory { Action create(String data); } -} +} \ No newline at end of file diff --git a/src/main/java/me/espryth/easyjoin/service/FirstJoinService.java b/src/main/java/me/espryth/easyjoin/service/FirstJoinService.java index 4ad0456..ca4a8fb 100644 --- a/src/main/java/me/espryth/easyjoin/service/FirstJoinService.java +++ b/src/main/java/me/espryth/easyjoin/service/FirstJoinService.java @@ -2,16 +2,12 @@ import com.thewinterframework.configurate.Container; import com.thewinterframework.service.annotation.Service; -import com.zaxxer.hikari.HikariConfig; -import com.zaxxer.hikari.HikariDataSource; +import jakarta.inject.Inject; import me.espryth.easyjoin.config.AppConfig; -import me.espryth.easyjoin.config.CredentialsConfig; +import me.espryth.easyjoin.database.DatabaseService; +import me.espryth.easyjoin.database.FirstJoinDao; import org.bukkit.entity.Player; -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; import java.util.HashSet; import java.util.Set; import java.util.UUID; @@ -21,34 +17,13 @@ public class FirstJoinService { private final Container<AppConfig> appConfig; - private final Container<CredentialsConfig> credentialsConfig; - private HikariDataSource dataSource; + private final DatabaseService databaseService; private final Set<UUID> cache = new HashSet<>(); - public FirstJoinService(Container<AppConfig> appConfig, Container<CredentialsConfig> credentialsConfig) { + @Inject + public FirstJoinService(Container<AppConfig> appConfig, DatabaseService databaseService) { this.appConfig = appConfig; - this.credentialsConfig = credentialsConfig; - setupDatabase(); - } - - private void setupDatabase() { - if (!appConfig.get().firstJoinMode().equalsIgnoreCase("MYSQL")) return; - - CredentialsConfig creds = credentialsConfig.get(); - HikariConfig config = new HikariConfig(); - config.setJdbcUrl("jdbc:mysql://" + creds.host() + ":" + creds.port() + "/" + creds.database() + "?useSSL=" + creds.useSsl()); - config.setUsername(creds.username()); - config.setPassword(creds.password()); - config.setMaximumPoolSize(10); - - this.dataSource = new HikariDataSource(config); - - try (Connection conn = dataSource.getConnection(); - PreparedStatement stmt = conn.prepareStatement("CREATE TABLE IF NOT EXISTS EJFirstJoin(uuid VARCHAR(36) PRIMARY KEY)")) { - stmt.executeUpdate(); - } catch (SQLException e) { - e.printStackTrace(); - } + this.databaseService = databaseService; } public CompletableFuture<Boolean> isFirstJoin(Player player) { @@ -56,35 +31,41 @@ public CompletableFuture<Boolean> isFirstJoin(Player player) { return CompletableFuture.completedFuture(!player.hasPlayedBefore()); } - if (cache.contains(player.getUniqueId())) return CompletableFuture.completedFuture(false); + if (cache.contains(player.getUniqueId())) { + return CompletableFuture.completedFuture(false); + } return CompletableFuture.supplyAsync(() -> { - try (Connection conn = dataSource.getConnection(); - PreparedStatement stmt = conn.prepareStatement("SELECT 1 FROM EJFirstJoin WHERE uuid = ?")) { - stmt.setString(1, player.getUniqueId().toString()); - try (ResultSet rs = stmt.executeQuery()) { - boolean exists = rs.next(); - if (exists) cache.add(player.getUniqueId()); - return !exists; - } - } catch (SQLException e) { - e.printStackTrace(); + if (!databaseService.isEnabled()) { return !player.hasPlayedBefore(); } + + return databaseService.getJdbi() + .map(jdbi -> jdbi.withExtension(FirstJoinDao.class, dao -> { + boolean exists = dao.exists(player.getUniqueId().toString()); + if (exists) { + cache.add(player.getUniqueId()); + } + return !exists; + })) + .orElse(!player.hasPlayedBefore()); }); } public void markAsJoined(Player player) { - if (!appConfig.get().firstJoinMode().equalsIgnoreCase("MYSQL")) return; + if (!appConfig.get().firstJoinMode().equalsIgnoreCase("MYSQL")) { + return; + } cache.add(player.getUniqueId()); + CompletableFuture.runAsync(() -> { - try (Connection conn = dataSource.getConnection(); - PreparedStatement stmt = conn.prepareStatement("INSERT IGNORE INTO EJFirstJoin(uuid) VALUES(?)")) { - stmt.setString(1, player.getUniqueId().toString()); - stmt.executeUpdate(); - } catch (SQLException e) { - e.printStackTrace(); + if (databaseService.isEnabled()) { + databaseService.getJdbi().ifPresent(jdbi -> + jdbi.useExtension(FirstJoinDao.class, dao -> + dao.insert(player.getUniqueId().toString()) + ) + ); } }); } diff --git a/src/main/java/me/espryth/easyjoin/service/FormatService.java b/src/main/java/me/espryth/easyjoin/service/FormatService.java index 6bb3ac9..22afb62 100644 --- a/src/main/java/me/espryth/easyjoin/service/FormatService.java +++ b/src/main/java/me/espryth/easyjoin/service/FormatService.java @@ -2,10 +2,13 @@ import com.thewinterframework.configurate.Container; import com.thewinterframework.service.annotation.Service; +import com.thewinterframework.service.annotation.lifecycle.OnEnable; +import jakarta.inject.Inject; import me.espryth.easyjoin.action.Action; import me.espryth.easyjoin.config.AppConfig; import me.espryth.easyjoin.format.Format; import org.bukkit.entity.Player; +import org.slf4j.Logger; import java.util.*; import java.util.stream.Collectors; @@ -17,31 +20,37 @@ public class FormatService { private final ActionService actionService; private final Map<String, Format> formats = new HashMap<>(); + @Inject public FormatService(Container<AppConfig> config, ActionService actionService) { this.config = config; this.actionService = actionService; - loadFormats(); } - public void loadFormats() { + @OnEnable + public void loadFormats(Logger logger) { formats.clear(); AppConfig appConfig = config.get(); - if (appConfig.formats() == null) return; + if (appConfig.formats() == null) { + logger.error("No formats found in configuration!"); + return; + } appConfig.formats().forEach((id, section) -> { List<Action> join = parseActions(section.join()); List<Action> quit = parseActions(section.quit()); - List<Action> auth = parseActions(section.auth()); formats.put(id, new Format( id, section.priority(), section.isFirstJoinFormat(), join, - quit, - auth + quit )); + + logger.info("Loaded format: {} (priority: {}, firstJoin: {})", id, section.priority(), section.isFirstJoinFormat()); }); + + logger.info("Total formats loaded: {}", formats.size()); } private List<Action> parseActions(AppConfig.ActionSection section) { @@ -56,7 +65,7 @@ private List<Action> parseActions(AppConfig.ActionSection section) { public Optional<Format> getFormatForPlayer(Player player, boolean isFirstJoin) { return formats.values().stream() .filter(f -> isFirstJoin == f.isFirstJoinFormat()) - .filter(f -> player.hasPermission("easyjoin." + f.id())) + .filter(f -> f.id().equalsIgnoreCase("default") || player.hasPermission("easyjoin." + f.id())) .max(Comparator.comparingInt(Format::priority)); } @@ -66,4 +75,8 @@ public Optional<Format> getDefaultFormat(boolean isFirstJoin) { .filter(f -> f.id().equalsIgnoreCase("default")) .findFirst(); } + + public Optional<Format> getFormatById(String id) { + return Optional.ofNullable(formats.get(id)); + } } diff --git a/src/main/java/me/espryth/easyjoin/util/AvatarUtils.java b/src/main/java/me/espryth/easyjoin/util/AvatarUtils.java index b7713b7..586f741 100644 --- a/src/main/java/me/espryth/easyjoin/util/AvatarUtils.java +++ b/src/main/java/me/espryth/easyjoin/util/AvatarUtils.java @@ -5,37 +5,186 @@ import org.bukkit.entity.Player; import javax.imageio.ImageIO; +import java.awt.Graphics2D; +import java.awt.RenderingHints; import java.awt.image.BufferedImage; import java.io.IOException; import java.net.URI; import java.net.URL; +import java.nio.charset.StandardCharsets; import java.util.ArrayList; +import java.util.Base64; import java.util.List; public class AvatarUtils { public static List<Component> getAvatar(Player player) { - return getAvatar(player.getName()); + return getAvatar(player.getUniqueId().toString().replace("-", ""), player.getName()); } - public static List<Component> getAvatar(String playerName) { + public static List<Component> getAvatar(String uuid, String playerName) { + BufferedImage image = fetchSkinFromMojang(uuid, 64); + if (image == null) image = fetchAshcon(playerName, 64); + if (image == null) image = fetchMcHeads(playerName, 8); + if (image == null) return generatePlaceholder(playerName, 8, 8); + + if (image.getWidth() >= 32) { + BufferedImage head = cropHeadFromSkin(image); + BufferedImage small = resize(head, 8, 8); + return imageToComponents(small); + } + + return imageToComponents(image); + } + + private static BufferedImage fetchSkinFromMojang(String uuid, int targetSize) { + try { + URL profileUrl = URI.create("https://sessionserver.mojang.com/session/minecraft/profile/" + uuid).toURL(); + byte[] profileBytes = profileUrl.openStream().readAllBytes(); + String profileJson = new String(profileBytes, StandardCharsets.UTF_8); + + String textureBase64 = extractBase64Texture(profileJson); + if (textureBase64 == null) return null; + + String textureJson = new String(Base64.getDecoder().decode(textureBase64), StandardCharsets.UTF_8); + String skinUrl = extractSkinUrlFromTextureJson(textureJson); + if (skinUrl == null) return null; + + URL skinUrlObj = URI.create(skinUrl).toURL(); + BufferedImage skin = ImageIO.read(skinUrlObj); + return skin; + } catch (IOException e) { + return null; + } + } + + private static BufferedImage fetchAshcon(String playerName, int size) { + try { + URL url = URI.create("https://api.ashcon.app/mojang/v2/user/" + playerName).toURL(); + byte[] data = url.openStream().readAllBytes(); + String json = new String(data, StandardCharsets.UTF_8); + int texturesIdx = json.indexOf("\"textures\""); + if (texturesIdx < 0) return null; + int skinIdx = json.indexOf("\"skin\"", texturesIdx); + if (skinIdx < 0) return null; + int urlIdx = json.indexOf("\"url\"", skinIdx); + if (urlIdx < 0) return null; + int colon = json.indexOf(':', urlIdx); + if (colon < 0) return null; + int firstQuote = json.indexOf('"', colon); + if (firstQuote < 0) return null; + int secondQuote = json.indexOf('"', firstQuote + 1); + if (secondQuote < 0) return null; + String skinUrl = json.substring(firstQuote + 1, secondQuote); + if (skinUrl.isBlank()) return null; + return ImageIO.read(URI.create(skinUrl).toURL()); + } catch (IOException e) { + return null; + } + } + + private static BufferedImage fetchMcHeads(String playerName, int size) { + try { + URL url = URI.create("https://mc-heads.net/avatar/" + playerName + "/" + size).toURL(); + return ImageIO.read(url); + } catch (IOException e) { + return null; + } + } + + private static String extractBase64Texture(String profileJson) { + int props = profileJson.indexOf("\"properties\""); + if (props < 0) return null; + int valueIndex = profileJson.indexOf("\"value\"", props); + if (valueIndex < 0) return null; + int colon = profileJson.indexOf(':', valueIndex); + if (colon < 0) return null; + int firstQuote = profileJson.indexOf('"', colon); + if (firstQuote < 0) return null; + int secondQuote = profileJson.indexOf('"', firstQuote + 1); + if (secondQuote < 0) return null; + String base64 = profileJson.substring(firstQuote + 1, secondQuote); + if (base64.isBlank()) return null; + return base64; + } + + private static String extractSkinUrlFromTextureJson(String textureJson) { + int skinIdx = textureJson.indexOf("\"SKIN\""); + if (skinIdx < 0) return null; + int urlIdx = textureJson.indexOf("\"url\"", skinIdx); + if (urlIdx < 0) return null; + int colon = textureJson.indexOf(':', urlIdx); + if (colon < 0) return null; + int firstQuote = textureJson.indexOf('"', colon); + if (firstQuote < 0) return null; + int secondQuote = textureJson.indexOf('"', firstQuote + 1); + if (secondQuote < 0) return null; + String url = textureJson.substring(firstQuote + 1, secondQuote); + return url; + } + + private static BufferedImage cropHeadFromSkin(BufferedImage skin) { + int width = skin.getWidth(); + int scale = Math.max(1, width / 64); + int headX = 8 * scale; + int headY = 8 * scale; + int headSize = 8 * scale; try { - URL url = URI.create("https://mc-heads.net/avatar/" + playerName + "/8").toURL(); - BufferedImage image = ImageIO.read(url); - List<Component> lines = new ArrayList<>(); - - for (int y = 0; y < image.getHeight(); y++) { - Component line = Component.empty(); - for (int x = 0; x < image.getWidth(); x++) { - int rgb = image.getRGB(x, y); - TextColor color = TextColor.color(rgb); - line = line.append(Component.text("█").color(color)); + BufferedImage head = skin.getSubimage(headX, headY, headSize, headSize); + return head; + } catch (Exception e) { + return skin; + } + } + + private static BufferedImage resize(BufferedImage img, int newW, int newH) { + BufferedImage resized = new BufferedImage(newW, newH, BufferedImage.TYPE_INT_ARGB); + Graphics2D g2 = resized.createGraphics(); + g2.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR); + g2.drawImage(img, 0, 0, newW, newH, null); + g2.dispose(); + return resized; + } + + private static List<Component> imageToComponents(BufferedImage image) { + List<Component> lines = new ArrayList<>(); + for (int y = 0; y < image.getHeight(); y++) { + Component line = Component.empty(); + for (int x = 0; x < image.getWidth(); x++) { + int rgba = image.getRGB(x, y); + int alpha = (rgba >> 24) & 0xFF; + if (alpha < 64) { + line = line.append(Component.text(" ")); + continue; } - lines.add(line); + int rgb = rgba & 0xFFFFFF; + TextColor color = TextColor.color(rgb); + line = line.append(Component.text("█").color(color)); } - return lines; - } catch (IOException e) { - return new ArrayList<>(); + lines.add(line); + } + return lines; + } + + private static List<Component> generatePlaceholder(String seed, int width, int height) { + List<Component> lines = new ArrayList<>(); + int hash = seed.hashCode(); + int baseR = (hash >> 16) & 0xFF; + int baseG = (hash >> 8) & 0xFF; + int baseB = hash & 0xFF; + + for (int y = 0; y < height; y++) { + Component line = Component.empty(); + for (int x = 0; x < width; x++) { + int r = (baseR + x * 10 + y * 5) & 0xFF; + int g = (baseG + x * 7 + y * 3) & 0xFF; + int b = (baseB + x * 4 + y * 9) & 0xFF; + int rgb = (r << 16) | (g << 8) | b; + TextColor color = TextColor.color(rgb); + line = line.append(Component.text("█").color(color)); + } + lines.add(line); } + return lines; } } diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml index e5139a9..a674c11 100644 --- a/src/main/resources/config.yml +++ b/src/main/resources/config.yml @@ -1,25 +1,156 @@ +# ============================================================ +# EASYJOIN CONFIGURATION +# ============================================================ + +# First Join Detection Mode +# VANILLA - Uses Bukkit's hasPlayedBefore() method (simple, no database needed) +# MYSQL - Uses MySQL database for cross-server first join detection (BungeeCord/Velocity networks) FirstJoinMode: VANILLA +# ============================================================ +# AVAILABLE ACTIONS +# ============================================================ +# +# MESSAGE ACTIONS: +# [MESSAGE] <text> +# Sends a message to the player +# Use <c> at the start to center the message +# Example: [MESSAGE] &aWelcome to the server! +# Example: [MESSAGE] <c>&6Centered Message +# +# [BROADCAST] <text> +# Sends a message to all online players +# Use <c> at the start to center the message +# Example: [BROADCAST] &e%player_name% joined! +# +# [JSON_MESSAGE] <json> +# Sends a JSON message to the player (clickable, hoverable) +# Example: [JSON_MESSAGE] {"text":"Click me","clickEvent":{"action":"open_url","value":"https://example.com"}} +# +# [JSON_BROADCAST] <json> +# Sends a JSON message to all online players +# +# [ACTIONBAR] <text> +# Shows a message in the player's action bar +# Example: [ACTIONBAR] &aWelcome back! +# +# [BROADCAST_ACTIONBAR] <text> +# Shows a message in all players' action bars +# +# TITLE ACTIONS: +# [TITLE] <title>;<subtitle>;<fadeIn>;<stay>;<fadeOut> +# Shows a title to the player +# Times are in ticks (20 ticks = 1 second) +# Example: [TITLE] &6Welcome;&eEnjoy your stay!;10;70;20 +# +# [BROADCAST_TITLE] <title>;<subtitle>;<fadeIn>;<stay>;<fadeOut> +# Shows a title to all online players +# +# AVATAR ACTIONS: +# [AVATAR_MESSAGE] <line1><nl><line2><nl>... +# Sends a message with the player's Minecraft skin avatar +# Use <nl> to separate lines (up to 8 lines) +# Example: [AVATAR_MESSAGE] &aWelcome<nl>&7%player_name% +# +# [AVATAR_BROADCAST] <line1><nl><line2><nl>... +# Broadcasts a message with the player's avatar to all players +# +# SOUND ACTIONS: +# [SOUND] <sound>;<volume>;<pitch> +# Plays a sound to the player +# Sound names: https://jd.papermc.io/paper/1.21.11/org/bukkit/Sound.html +# Example: [SOUND] ENTITY_PLAYER_LEVELUP;1;1 +# +# [BROADCAST_SOUND] <sound>;<volume>;<pitch> +# Plays a sound to all online players +# +# FIREWORK ACTION: +# [FIREWORK] <type>;<amount>;<power>;<r,g,b>;<r,g,b>;... +# Spawns fireworks at the player's location +# Types: BALL, BALL_LARGE, BURST, CREEPER, STAR +# Colors are in RGB format (0-255) +# Example: [FIREWORK] STAR;3;2;255,215,0;255,140,0 +# +# COMMAND ACTIONS: +# [CONSOLE] <command> +# Executes a command as console +# Example: [CONSOLE] give %player_name% diamond 1 +# +# [PLAYER] <command> +# Makes the player execute a command +# Example: [PLAYER] spawn +# +# UTILITY ACTIONS: +# [CLEARCHAT] <lines> +# Clears the player's chat by sending empty lines +# Example: [CLEARCHAT] 100 +# +# [DELAY] <seconds> +# Pauses execution for specified seconds before next action +# Example: [DELAY] 3 +# +# ============================================================ +# PLACEHOLDERS +# ============================================================ +# All actions support PlaceholderAPI placeholders +# Common placeholders: +# %player_name% - Player's name +# %player_uuid% - Player's UUID +# %player_health% - Player's health +# %server_online% - Online player count +# %server_max_players% - Max player count +# +# Full list: https://wiki.placeholderapi.com/users/placeholder-list/ +# ============================================================ +# FORMATS +# ============================================================ +# Formats define what happens when a player joins/quits +# +# Format Properties: +# priority - Higher priority formats are selected first (integer) +# isFirstJoinFormat - If true, only triggers for first-time players (boolean) +# join - Actions executed when player joins +# quit - Actions executed when player quits +# +# Permission: easyjoin.<format_id> (e.g., easyjoin.admin) +# Players without any format permission will use the "default" format +# ============================================================ + Formats: admin: priority: 10 + isFirstJoinFormat: false join: actions: - '[BROADCAST] &8(&a+&8) &c&lADMIN &f%player_name%' - - '[SOUND] ENTITY_PLAYER_LEVELUP;10;5' - - '[ACTIONBAR] &ashop.example.com;5' + - '[SOUND] ENTITY_PLAYER_LEVELUP;1;1' + - '[ACTIONBAR] &ashop.example.com' - '[JSON_MESSAGE] {"text":"&9Click to go to our discord","clickEvent":{"action":"open_url","value":"https://discord.gg/hPNYUMUauD"}}' quit: actions: - '[BROADCAST] &8(&c-&8) &f%player_name%' + default: priority: 5 + isFirstJoinFormat: false join: actions: + - '<DELAY> 5' - '[BROADCAST] &8(&a+&8) &f%player_name%' - - '[SOUND] ENTITY_PLAYER_LEVELUP;10;5' + - '[AVATAR_MESSAGE] &aWelcome to the server!<nl>&7%player_name%<nl>&bEnjoy your stay!' + - '[SOUND] ENTITY_PLAYER_LEVELUP;1;1' - '[ACTIONBAR] &ashop.example.com' - - '[FIREWORK] STAR;10;2;255,120,200;100,50,30;10,20,30;40;10;20' quit: actions: - '[BROADCAST] &8(&c-&8) &f%player_name%' + + firstjoin: + priority: 15 + isFirstJoinFormat: true + join: + actions: + - '[BROADCAST] &e&lWELCOME &f%player_name% &e<o the server!' + - '[SOUND] ENTITY_PLAYER_LEVELUP;1;1' + - '[FIREWORK] STAR;3;2;255,215,0;255,140,0' + quit: + actions: [] \ No newline at end of file diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index e26af79..4ee24d6 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -4,3 +4,5 @@ main: me.espryth.easyjoin.EasyJoinPlugin api-version: '1.21' authors: [Espryth, Mapacheee] softdepend: [PlaceholderAPI] +libraries: + - com.zaxxer:HikariCP:7.0.2 From 9f046c4ba1c672b94f85719f655de3c8350c3a55 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjam=C3=ADn=20Isasmendi=20C?= <bisasmendic@gmail.com> Date: Wed, 18 Feb 2026 11:50:40 -0400 Subject: [PATCH 07/14] fix sound --- build.gradle.kts | 2 +- .../easyjoin/service/ActionService.java | 80 +++++++++---------- 2 files changed, 40 insertions(+), 42 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index 39b1a0c..ca65660 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -27,7 +27,7 @@ repositories { dependencies { - compileOnly("io.papermc.paper:paper-api:1.21.1-R0.1-SNAPSHOT") + compileOnly("io.papermc.paper:paper-api:1.21.4-R0.1-SNAPSHOT") api("com.thewinterframework:paper:1.0.4") { exclude(group = "io.papermc.paper", module = "paper-api") diff --git a/src/main/java/me/espryth/easyjoin/service/ActionService.java b/src/main/java/me/espryth/easyjoin/service/ActionService.java index 5a5c98e..c511baa 100644 --- a/src/main/java/me/espryth/easyjoin/service/ActionService.java +++ b/src/main/java/me/espryth/easyjoin/service/ActionService.java @@ -46,11 +46,9 @@ public Optional<Action> parseAction(String line) { } private void registerDefaultActions() { - registerAction("[MESSAGE]", data -> (player, queue) -> - sendMessage(player, data, player::sendMessage)); + registerAction("[MESSAGE]", data -> (player, queue) -> sendMessage(player, data, player::sendMessage)); - registerAction("[BROADCAST]", data -> (player, queue) -> - sendMessage(player, data, Bukkit::broadcast)); + registerAction("[BROADCAST]", data -> (player, queue) -> sendMessage(player, data, Bukkit::broadcast)); registerAction("[JSON_MESSAGE]", data -> (player, queue) -> { String json = MessageUtils.formatString(player, data); @@ -72,25 +70,24 @@ private void registerDefaultActions() { Bukkit.getOnlinePlayers().forEach(p -> p.sendActionBar(msg)); }); - registerAction("[TITLE]", data -> (player, queue) -> - showTitle(player, data, player::showTitle)); + registerAction("[TITLE]", data -> (player, queue) -> showTitle(player, data, player::showTitle)); - registerAction("[BROADCAST_TITLE]", data -> (player, queue) -> - showTitle(player, data, title -> Bukkit.getOnlinePlayers().forEach(p -> p.showTitle(title)))); + registerAction("[BROADCAST_TITLE]", data -> (player, queue) -> showTitle(player, data, + title -> Bukkit.getOnlinePlayers().forEach(p -> p.showTitle(title)))); - registerAction("[AVATAR_MESSAGE]", data -> (player, queue) -> - sendAvatarMessage(player, data, player::sendMessage)); + registerAction("[AVATAR_MESSAGE]", + data -> (player, queue) -> sendAvatarMessage(player, data, player::sendMessage)); - registerAction("[AVATAR_BROADCAST]", data -> (player, queue) -> - sendAvatarMessage(player, data, Bukkit::broadcast)); + registerAction("[AVATAR_BROADCAST]", + data -> (player, queue) -> sendAvatarMessage(player, data, Bukkit::broadcast)); registerAction("[CLEARCHAT]", data -> (player, queue) -> { int lines = Integer.parseInt(data); - for (int i = 0; i < lines; i++) player.sendMessage(Component.text(" ")); + for (int i = 0; i < lines; i++) + player.sendMessage(Component.text(" ")); }); - registerAction("[FIREWORK]", data -> (player, queue) -> - spawnFirework(player, data)); + registerAction("[FIREWORK]", data -> (player, queue) -> spawnFirework(player, data)); registerAction("[CONSOLE]", data -> (player, queue) -> { String cmd = MessageUtils.formatString(player, data); @@ -102,11 +99,9 @@ private void registerDefaultActions() { player.performCommand(cmd); }); - registerAction("[SOUND]", data -> (player, queue) -> - playSoundCommand(player, data)); + registerAction("[SOUND]", data -> (player, queue) -> playSoundCommand(player, data)); - registerAction("[BROADCAST_SOUND]", data -> (player, queue) -> - playBroadcastSoundCommand(data)); + registerAction("[BROADCAST_SOUND]", data -> (player, queue) -> playBroadcastSoundCommand(data)); registerAction("[DELAY]", data -> (player, queue) -> { try { @@ -116,7 +111,8 @@ private void registerDefaultActions() { queue.setPaused(false); queue.executeAll(player); }, delay * 20L); - } catch (NumberFormatException ignored) {} + } catch (NumberFormatException ignored) { + } }); } @@ -124,7 +120,8 @@ private void sendMessage(Player player, String data, Consumer<Component> sender) Component msg = MessageUtils.colorizeToComponent(PlaceholderAPI.setPlaceholders(player, data)); if (data.startsWith("<c>")) { String legacy = MessageUtils.formatString(player, data); - Component centeredMsg = MessageUtils.colorizeToComponent(MessageUtils.getCenteredMessage(legacy.replace("<c>", ""))); + Component centeredMsg = MessageUtils + .colorizeToComponent(MessageUtils.getCenteredMessage(legacy.replace("<c>", ""))); sender.accept(centeredMsg); } else { sender.accept(msg); @@ -148,9 +145,7 @@ private void showTitle(Player player, String data, Consumer<Title> titleSender) Title.Times.times( Duration.ofMillis(fadeIn * 50L), Duration.ofMillis(stay * 50L), - Duration.ofMillis(fadeOut * 50L) - ) - ); + Duration.ofMillis(fadeOut * 50L))); titleSender.accept(titleObj); } @@ -160,14 +155,16 @@ private void sendAvatarMessage(Player player, String data, Consumer<Component> s for (int i = 0; i < 8; i++) { Component avatarLine = avatar.size() > i ? avatar.get(i) : Component.text(" "); String messageLine = lines.length > i ? lines[i] : ""; - Component formattedMessageLine = MessageUtils.colorizeToComponent(PlaceholderAPI.setPlaceholders(player, messageLine)); + Component formattedMessageLine = MessageUtils + .colorizeToComponent(PlaceholderAPI.setPlaceholders(player, messageLine)); sender.accept(avatarLine.append(Component.text(" ")).append(formattedMessageLine)); } } private void spawnFirework(Player player, String data) { String[] parts = data.split(";"); - if (parts.length < 3) return; + if (parts.length < 3) + return; FireworkEffect.Type type = FireworkEffect.Type.valueOf(parts[0].toUpperCase()); int amount = Integer.parseInt(parts[1]); int power = Integer.parseInt(parts[2]); @@ -177,17 +174,22 @@ private void spawnFirework(Player player, String data) { for (int i = 3; i < parts.length; i++) { String[] rgb = parts[i].split(","); Color color = Color.fromRGB(Integer.parseInt(rgb[0]), Integer.parseInt(rgb[1]), Integer.parseInt(rgb[2])); - if (i % 2 == 0) fades.add(color); else colors.add(color); + if (i % 2 == 0) + fades.add(color); + else + colors.add(color); } - Firework firework = (Firework) player.getLocation().getWorld().spawnEntity(player.getLocation(), EntityType.FIREWORK_ROCKET); + Firework firework = (Firework) player.getLocation().getWorld().spawnEntity(player.getLocation(), + EntityType.FIREWORK_ROCKET); FireworkMeta meta = firework.getFireworkMeta(); meta.setPower(power); meta.addEffect(FireworkEffect.builder().with(type).withColor(colors).withFade(fades).trail(true).build()); firework.setFireworkMeta(meta); for (int i = 1; i < amount; i++) { - Firework f = (Firework) player.getLocation().getWorld().spawnEntity(player.getLocation(), EntityType.FIREWORK_ROCKET); + Firework f = (Firework) player.getLocation().getWorld().spawnEntity(player.getLocation(), + EntityType.FIREWORK_ROCKET); f.setFireworkMeta(meta); } } @@ -199,23 +201,19 @@ private Sound parseSound(String data) { float pitch = parts.length > 2 ? Float.parseFloat(parts[2]) : 1.0f; String sourceName = parts.length > 3 ? parts[3].toUpperCase() : "MASTER"; - Key key; - try { - org.bukkit.Sound bukkitSound = org.bukkit.Sound.valueOf(soundName.toUpperCase()); - key = bukkitSound.key(); - } catch (IllegalArgumentException e) { - String lowerCase = soundName.toLowerCase(); - if (soundName.contains(":")) { - key = Key.key(lowerCase); - } else { - key = Key.key("minecraft", lowerCase); - } + final Key key; + final String lower = soundName.toLowerCase(); + if (lower.contains(":")) { + key = Key.key(lower); + } else { + key = Key.key("minecraft", lower.replace('_', '.')); } Sound.Source source = Sound.Source.MASTER; try { source = Sound.Source.valueOf(sourceName); - } catch (IllegalArgumentException ignored) {} + } catch (IllegalArgumentException ignored) { + } return Sound.sound(key, source, volume, pitch); } From 1eade4e90ad00445269956f89394d1727f747d0a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjam=C3=ADn=20Isasmendi=20C?= <bisasmendic@gmail.com> Date: Wed, 18 Feb 2026 12:01:15 -0400 Subject: [PATCH 08/14] remove unused try catch --- .../me/espryth/easyjoin/service/ActionService.java | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/src/main/java/me/espryth/easyjoin/service/ActionService.java b/src/main/java/me/espryth/easyjoin/service/ActionService.java index c511baa..f350817 100644 --- a/src/main/java/me/espryth/easyjoin/service/ActionService.java +++ b/src/main/java/me/espryth/easyjoin/service/ActionService.java @@ -104,15 +104,11 @@ private void registerDefaultActions() { registerAction("[BROADCAST_SOUND]", data -> (player, queue) -> playBroadcastSoundCommand(data)); registerAction("[DELAY]", data -> (player, queue) -> { - try { - int delay = Integer.parseInt(data); - queue.setPaused(true); - Bukkit.getScheduler().runTaskLater(queue.getPlugin(), () -> { - queue.setPaused(false); - queue.executeAll(player); - }, delay * 20L); - } catch (NumberFormatException ignored) { - } + int delay = Integer.parseInt(data); + queue.setPaused(true); + Bukkit.getScheduler().runTaskLater(queue.getPlugin(), () -> { + queue.setPaused(false); + queue.executeAll(player);}, delay * 20L); }); } From 48d2c8e8a76f981dfddcee49909b47a515f1a366 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjam=C3=ADn=20Isasmendi=20C?= <bisasmendic@gmail.com> Date: Wed, 18 Feb 2026 12:19:47 -0400 Subject: [PATCH 09/14] add folia support --- .../java/me/espryth/easyjoin/action/ActionQueue.java | 2 +- .../java/me/espryth/easyjoin/command/MainCommand.java | 11 ++++++++--- .../me/espryth/easyjoin/service/ActionService.java | 5 +++-- src/main/resources/paper-plugin.yml | 1 + 4 files changed, 13 insertions(+), 6 deletions(-) diff --git a/src/main/java/me/espryth/easyjoin/action/ActionQueue.java b/src/main/java/me/espryth/easyjoin/action/ActionQueue.java index 11e9604..fc8c647 100644 --- a/src/main/java/me/espryth/easyjoin/action/ActionQueue.java +++ b/src/main/java/me/espryth/easyjoin/action/ActionQueue.java @@ -20,7 +20,7 @@ public ActionQueue(List<Action> actions, Plugin plugin) { public void executeAll(Player player) { if (!Bukkit.isPrimaryThread()) { - Bukkit.getScheduler().runTask(plugin, () -> executeAll(player)); + player.getScheduler().run(plugin, t -> executeAll(player), null); return; } while (cursor < actions.size()) { diff --git a/src/main/java/me/espryth/easyjoin/command/MainCommand.java b/src/main/java/me/espryth/easyjoin/command/MainCommand.java index 0f1a364..c3c2a35 100644 --- a/src/main/java/me/espryth/easyjoin/command/MainCommand.java +++ b/src/main/java/me/espryth/easyjoin/command/MainCommand.java @@ -14,6 +14,7 @@ import org.incendo.cloud.annotations.Permission; import org.incendo.cloud.paper.util.sender.Source; import org.slf4j.Logger; +import org.bukkit.plugin.Plugin; import java.util.Optional; @@ -23,12 +24,15 @@ public class MainCommand { private final ReloadServiceManager reloadServiceManager; private final FormatService formatService; private final Logger logger; + private final Plugin plugin; @Inject - public MainCommand(ReloadServiceManager reloadServiceManager, FormatService formatService, Logger logger) { + public MainCommand(ReloadServiceManager reloadServiceManager, + FormatService formatService, Logger logger, Plugin plugin) { this.reloadServiceManager = reloadServiceManager; this.formatService = formatService; this.logger = logger; + this.plugin = plugin; } @Command("easyjoin") @@ -37,7 +41,8 @@ public void mainHelp(Source source) { sender.sendMessage(MessageUtils.colorize("&e&lEasy&6&lJoin &fV3")); if (sender.hasPermission("easyjoin.admin")) { sender.sendMessage(MessageUtils.colorize("&f- /ej reload")); - sender.sendMessage(MessageUtils.colorize("&f- /ej join <formatId> - simulate join for the given format (player only)")); + sender.sendMessage(MessageUtils + .colorize("&f- /ej join <formatId> - simulate join for the given format (player only)")); } } @@ -66,7 +71,7 @@ public void testJoin(Source source, @Argument("formatId") String formatId) { return; } - new ActionQueue(formatOpt.get().joinActions(), null).executeAll(player); + new ActionQueue(formatOpt.get().joinActions(), plugin).executeAll(player); sender.sendMessage(MessageUtils.colorize("&aExecuted join actions for format: " + formatId)); } } diff --git a/src/main/java/me/espryth/easyjoin/service/ActionService.java b/src/main/java/me/espryth/easyjoin/service/ActionService.java index f350817..3604c38 100644 --- a/src/main/java/me/espryth/easyjoin/service/ActionService.java +++ b/src/main/java/me/espryth/easyjoin/service/ActionService.java @@ -106,9 +106,10 @@ private void registerDefaultActions() { registerAction("[DELAY]", data -> (player, queue) -> { int delay = Integer.parseInt(data); queue.setPaused(true); - Bukkit.getScheduler().runTaskLater(queue.getPlugin(), () -> { + player.getScheduler().runDelayed(queue.getPlugin(), t -> { queue.setPaused(false); - queue.executeAll(player);}, delay * 20L); + queue.executeAll(player); + }, null, delay * 20L); }); } diff --git a/src/main/resources/paper-plugin.yml b/src/main/resources/paper-plugin.yml index 65efa2d..1054b94 100644 --- a/src/main/resources/paper-plugin.yml +++ b/src/main/resources/paper-plugin.yml @@ -3,6 +3,7 @@ name: EasyJoin version: ${project.version} main: me.espryth.easyjoin.EasyJoinPlugin authors: [Espryth, Mapacheee] +folia-supported: true package-state: internal dependencies: server: From 60feb44e7aff3d7c13e7c1254841d54bdb32f23f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjam=C3=ADn=20Isasmendi=20C?= <bisasmendic@gmail.com> Date: Wed, 18 Feb 2026 12:29:59 -0400 Subject: [PATCH 10/14] minor fix in parse message --- .../me/espryth/easyjoin/util/MessageUtils.java | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/src/main/java/me/espryth/easyjoin/util/MessageUtils.java b/src/main/java/me/espryth/easyjoin/util/MessageUtils.java index 0c494d5..2f79147 100644 --- a/src/main/java/me/espryth/easyjoin/util/MessageUtils.java +++ b/src/main/java/me/espryth/easyjoin/util/MessageUtils.java @@ -21,22 +21,28 @@ public class MessageUtils { private final static int CENTER_PX = 154; public static String colorize(String text) { - if (text == null) return ""; + if (text == null) + return ""; String newText = HEX_COLOR_PATTERN.matcher(text).replaceAll(BUKKIT_HEX_COLOR); + if (newText.indexOf('§') >= 0) { + return newText; + } Component component = MINI_MESSAGE.deserialize(newText); if (component.equals(Component.text(newText))) { - // If MiniMessage didn't find any tags, fallback to legacy component = LegacyComponentSerializer.legacyAmpersand().deserialize(newText); } return LegacyComponentSerializer.legacySection().serialize(component); } public static Component colorizeToComponent(String text) { - if (text == null) return Component.empty(); + if (text == null) + return Component.empty(); String newText = HEX_COLOR_PATTERN.matcher(text).replaceAll(BUKKIT_HEX_COLOR); + if (newText.indexOf('§') >= 0) { + return LegacyComponentSerializer.legacySection().deserialize(newText); + } Component component = MINI_MESSAGE.deserialize(newText); if (component.equals(Component.text(newText))) { - // If MiniMessage didn't find any tags, fallback to legacy return LegacyComponentSerializer.legacyAmpersand().deserialize(newText); } return component; @@ -51,7 +57,8 @@ public static String getCenteredMessage(String message) { } public static String getCenteredSpace(String message) { - if (message == null || message.isEmpty()) return ""; + if (message == null || message.isEmpty()) + return ""; int messagePxSize = 0; boolean previousCode = false; From 3746581ff7d9d48b4d1adef8692fc5e962d51aef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjam=C3=ADn=20Isasmendi=20C?= <bisasmendic@gmail.com> Date: Wed, 18 Feb 2026 17:42:09 -0400 Subject: [PATCH 11/14] fix center message & minor changes --- .../easyjoin/service/ActionService.java | 22 ++++++++++++++----- .../espryth/easyjoin/util/MessageUtils.java | 21 ++++++++++++++++-- 2 files changed, 35 insertions(+), 8 deletions(-) diff --git a/src/main/java/me/espryth/easyjoin/service/ActionService.java b/src/main/java/me/espryth/easyjoin/service/ActionService.java index 3604c38..8c830a0 100644 --- a/src/main/java/me/espryth/easyjoin/service/ActionService.java +++ b/src/main/java/me/espryth/easyjoin/service/ActionService.java @@ -149,11 +149,24 @@ private void showTitle(Player player, String data, Consumer<Title> titleSender) private void sendAvatarMessage(Player player, String data, Consumer<Component> sender) { List<Component> avatar = AvatarUtils.getAvatar(player); String[] lines = data.split("<nl>"); + final int AVATAR_OFFSET_PX = 76; + for (int i = 0; i < 8; i++) { Component avatarLine = avatar.size() > i ? avatar.get(i) : Component.text(" "); String messageLine = lines.length > i ? lines[i] : ""; - Component formattedMessageLine = MessageUtils - .colorizeToComponent(PlaceholderAPI.setPlaceholders(player, messageLine)); + + final Component formattedMessageLine; + + if (messageLine.startsWith("<c>")) { + String stripped = messageLine.substring(3); + String legacy = MessageUtils.formatString(player, stripped); + String centered = MessageUtils.getCenteredMessageWithOffset(legacy, AVATAR_OFFSET_PX); + formattedMessageLine = MessageUtils.colorizeToComponent(centered); + } else { + formattedMessageLine = MessageUtils + .colorizeToComponent(PlaceholderAPI.setPlaceholders(player, messageLine)); + } + sender.accept(avatarLine.append(Component.text(" ")).append(formattedMessageLine)); } } @@ -207,10 +220,7 @@ private Sound parseSound(String data) { } Sound.Source source = Sound.Source.MASTER; - try { - source = Sound.Source.valueOf(sourceName); - } catch (IllegalArgumentException ignored) { - } + source = Sound.Source.valueOf(sourceName); return Sound.sound(key, source, volume, pitch); } diff --git a/src/main/java/me/espryth/easyjoin/util/MessageUtils.java b/src/main/java/me/espryth/easyjoin/util/MessageUtils.java index 2f79147..62b9242 100644 --- a/src/main/java/me/espryth/easyjoin/util/MessageUtils.java +++ b/src/main/java/me/espryth/easyjoin/util/MessageUtils.java @@ -53,10 +53,27 @@ public static String formatString(Player player, String s) { } public static String getCenteredMessage(String message) { - return getCenteredSpace(message) + message; + return getCenteredSpace(message, CENTER_PX) + message; + } + + /** + * Centers a message accounting for content already occupying the left side + * (e.g. an avatar). + * + * @param message the text to center (with legacy § codes already applied) + * @param offsetPx pixels already consumed on the left (avatar width + + * separator) + */ + public static String getCenteredMessageWithOffset(String message, int offsetPx) { + int effectiveCenter = CENTER_PX - (offsetPx / 2); + return getCenteredSpace(message, effectiveCenter) + message; } public static String getCenteredSpace(String message) { + return getCenteredSpace(message, CENTER_PX); + } + + private static String getCenteredSpace(String message, int centerPx) { if (message == null || message.isEmpty()) return ""; @@ -78,7 +95,7 @@ public static String getCenteredSpace(String message) { } int halvedMessageSize = messagePxSize / 2; - int toCompensate = CENTER_PX - halvedMessageSize; + int toCompensate = centerPx - halvedMessageSize; int spaceLength = DefaultFontInfo.SPACE.getLength() + 1; int compensated = 0; StringBuilder sb = new StringBuilder(); From 46ba0167976f113d020fdbadbd49fd1b061dd4cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjam=C3=ADn=20Isasmendi=20C?= <bisasmendic@gmail.com> Date: Wed, 18 Feb 2026 18:54:15 -0400 Subject: [PATCH 12/14] fix links in avatar messages --- .../espryth/easyjoin/service/ActionService.java | 8 +++++--- .../me/espryth/easyjoin/util/MessageUtils.java | 16 ++++++++++++++++ 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/src/main/java/me/espryth/easyjoin/service/ActionService.java b/src/main/java/me/espryth/easyjoin/service/ActionService.java index 8c830a0..3ae9e40 100644 --- a/src/main/java/me/espryth/easyjoin/service/ActionService.java +++ b/src/main/java/me/espryth/easyjoin/service/ActionService.java @@ -159,9 +159,11 @@ private void sendAvatarMessage(Player player, String data, Consumer<Component> s if (messageLine.startsWith("<c>")) { String stripped = messageLine.substring(3); - String legacy = MessageUtils.formatString(player, stripped); - String centered = MessageUtils.getCenteredMessageWithOffset(legacy, AVATAR_OFFSET_PX); - formattedMessageLine = MessageUtils.colorizeToComponent(centered); + String withPlaceholders = PlaceholderAPI.setPlaceholders(player, stripped); + String legacyForMeasure = MessageUtils.colorize(withPlaceholders); + Component padding = MessageUtils.getCenteredSpaceComponent(legacyForMeasure, AVATAR_OFFSET_PX); + Component content = MessageUtils.colorizeToComponent(withPlaceholders); + formattedMessageLine = padding.append(content); } else { formattedMessageLine = MessageUtils .colorizeToComponent(PlaceholderAPI.setPlaceholders(player, messageLine)); diff --git a/src/main/java/me/espryth/easyjoin/util/MessageUtils.java b/src/main/java/me/espryth/easyjoin/util/MessageUtils.java index 62b9242..0e1e87b 100644 --- a/src/main/java/me/espryth/easyjoin/util/MessageUtils.java +++ b/src/main/java/me/espryth/easyjoin/util/MessageUtils.java @@ -69,6 +69,22 @@ public static String getCenteredMessageWithOffset(String message, int offsetPx) return getCenteredSpace(message, effectiveCenter) + message; } + /** + * Returns a Component containing only the centering spaces needed to center + * {@code miniMessageText} with the given left offset, without converting the + * text itself to legacy format. + * + * @param legacyText the text already serialized to legacy § codes, used only + * for pixel-width measurement + * @param offsetPx pixels already consumed on the left (avatar width + + * separator) + * @return a plain Component of spaces to prepend before the real Component + */ + public static Component getCenteredSpaceComponent(String legacyText, int offsetPx) { + int effectiveCenter = CENTER_PX - (offsetPx / 2); + return Component.text(getCenteredSpace(legacyText, effectiveCenter)); + } + public static String getCenteredSpace(String message) { return getCenteredSpace(message, CENTER_PX); } From 000aab81c81d8a0fef2f3e2393fa4ee2f9f6fc5e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjam=C3=ADn=20Isasmendi=20C?= <bisasmendic@gmail.com> Date: Sat, 21 Feb 2026 10:18:34 -0400 Subject: [PATCH 13/14] add test leave & suggestion arguments --- .../espryth/easyjoin/command/MainCommand.java | 37 +++++++++++++++++-- .../easyjoin/service/ActionService.java | 16 +++++--- .../easyjoin/service/FormatService.java | 4 ++ 3 files changed, 47 insertions(+), 10 deletions(-) diff --git a/src/main/java/me/espryth/easyjoin/command/MainCommand.java b/src/main/java/me/espryth/easyjoin/command/MainCommand.java index c3c2a35..fd8d284 100644 --- a/src/main/java/me/espryth/easyjoin/command/MainCommand.java +++ b/src/main/java/me/espryth/easyjoin/command/MainCommand.java @@ -12,10 +12,14 @@ import org.incendo.cloud.annotations.Argument; import org.incendo.cloud.annotations.Command; import org.incendo.cloud.annotations.Permission; +import org.incendo.cloud.annotations.suggestion.Suggestions; +import org.incendo.cloud.context.CommandContext; +import org.incendo.cloud.context.CommandInput; import org.incendo.cloud.paper.util.sender.Source; import org.slf4j.Logger; import org.bukkit.plugin.Plugin; +import java.util.List; import java.util.Optional; @CommandComponent @@ -43,6 +47,8 @@ public void mainHelp(Source source) { sender.sendMessage(MessageUtils.colorize("&f- /ej reload")); sender.sendMessage(MessageUtils .colorize("&f- /ej join <formatId> - simulate join for the given format (player only)")); + sender.sendMessage(MessageUtils + .colorize("&f- /ej leave <formatId> - simulate quit for the given format (player only)")); } } @@ -55,16 +61,20 @@ public void reload(Source source) { sender.sendMessage(MessageUtils.colorize("&aConfiguration reloaded!")); } + @Suggestions("formats") + public List<String> suggestFormats(CommandContext<Source> context, CommandInput input) { + return formatService.getFormatIds(); + } + @Command("easyjoin testjoin <formatId>") @Permission("easyjoin.admin") - public void testJoin(Source source, @Argument("formatId") String formatId) { - CommandSender sender = (CommandSender) source.source(); - if (!(sender instanceof Player)) { + public void testJoin(Source source, @Argument(value = "formatId", suggestions = "formats") String formatId) { + CommandSender sender = source.source(); + if (!(sender instanceof Player player)) { sender.sendMessage(MessageUtils.colorize("&cThis command can only be used by a player.")); return; } - Player player = (Player) sender; Optional<Format> formatOpt = formatService.getFormatById(formatId); if (formatOpt.isEmpty()) { sender.sendMessage(MessageUtils.colorize("&cNo format found with id: " + formatId)); @@ -74,4 +84,23 @@ public void testJoin(Source source, @Argument("formatId") String formatId) { new ActionQueue(formatOpt.get().joinActions(), plugin).executeAll(player); sender.sendMessage(MessageUtils.colorize("&aExecuted join actions for format: " + formatId)); } + + @Command("easyjoin testleave <formatId>") + @Permission("easyjoin.admin") + public void testLeave(Source source, @Argument(value = "formatId", suggestions = "formats") String formatId) { + CommandSender sender = source.source(); + if (!(sender instanceof Player player)) { + sender.sendMessage(MessageUtils.colorize("&cThis command can only be used by a player.")); + return; + } + + Optional<Format> formatOpt = formatService.getFormatById(formatId); + if (formatOpt.isEmpty()) { + sender.sendMessage(MessageUtils.colorize("&cNo format found with id: " + formatId)); + return; + } + + new ActionQueue(formatOpt.get().quitActions(), plugin).executeAll(player); + sender.sendMessage(MessageUtils.colorize("&aExecuted quit actions for format: " + formatId)); + } } diff --git a/src/main/java/me/espryth/easyjoin/service/ActionService.java b/src/main/java/me/espryth/easyjoin/service/ActionService.java index 3ae9e40..e587dca 100644 --- a/src/main/java/me/espryth/easyjoin/service/ActionService.java +++ b/src/main/java/me/espryth/easyjoin/service/ActionService.java @@ -214,12 +214,15 @@ private Sound parseSound(String data) { String sourceName = parts.length > 3 ? parts[3].toUpperCase() : "MASTER"; final Key key; - final String lower = soundName.toLowerCase(); - if (lower.contains(":")) { - key = Key.key(lower); - } else { - key = Key.key("minecraft", lower.replace('_', '.')); + String namespace = "minecraft"; + String path = soundName; + if (soundName.contains(":")) { + String[] split = soundName.split(":" , 2); + namespace = split[0].toLowerCase(Locale.ROOT); + path = split[1]; } + path = path.toLowerCase(Locale.ROOT).replace('_', '.'); + key = Key.key(namespace, path); Sound.Source source = Sound.Source.MASTER; source = Sound.Source.valueOf(sourceName); @@ -245,4 +248,5 @@ private void playBroadcastSoundCommand(String data) { public interface ActionFactory { Action create(String data); } -} \ No newline at end of file +} + diff --git a/src/main/java/me/espryth/easyjoin/service/FormatService.java b/src/main/java/me/espryth/easyjoin/service/FormatService.java index 22afb62..4c3c5d6 100644 --- a/src/main/java/me/espryth/easyjoin/service/FormatService.java +++ b/src/main/java/me/espryth/easyjoin/service/FormatService.java @@ -79,4 +79,8 @@ public Optional<Format> getDefaultFormat(boolean isFirstJoin) { public Optional<Format> getFormatById(String id) { return Optional.ofNullable(formats.get(id)); } + + public List<String> getFormatIds() { + return new ArrayList<>(formats.keySet()); + } } From e289c05c5eb9a6133f91de482ab150d8853f515c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjam=C3=ADn=20Isasmendi=20C?= <bisasmendic@gmail.com> Date: Sat, 28 Feb 2026 12:38:15 -0400 Subject: [PATCH 14/14] refactor avatar, offline users supported with SkinRestorer --- build.gradle.kts | 1 + .../me/espryth/easyjoin/util/AvatarUtils.java | 357 ++++++++++++++---- src/main/resources/paper-plugin.yml | 3 + src/main/resources/plugin.yml | 2 +- 4 files changed, 283 insertions(+), 80 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index ca65660..a2ea87d 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -57,6 +57,7 @@ dependencies { api("org.incendo:cloud-paper:2.0.0-beta.10") api("org.incendo:cloud-annotations:2.0.0") compileOnly("me.clip:placeholderapi:2.11.6") + compileOnly("net.skinsrestorer:skinsrestorer-api:15.5.2") api("org.jdbi:jdbi3-core:3.45.4") api("org.jdbi:jdbi3-sqlobject:3.45.4") diff --git a/src/main/java/me/espryth/easyjoin/util/AvatarUtils.java b/src/main/java/me/espryth/easyjoin/util/AvatarUtils.java index 586f741..857ee94 100644 --- a/src/main/java/me/espryth/easyjoin/util/AvatarUtils.java +++ b/src/main/java/me/espryth/easyjoin/util/AvatarUtils.java @@ -2,150 +2,313 @@ import net.kyori.adventure.text.Component; import net.kyori.adventure.text.format.TextColor; +import org.bukkit.Bukkit; import org.bukkit.entity.Player; - +import net.skinsrestorer.api.SkinsRestorer; +import net.skinsrestorer.api.SkinsRestorerProvider; +import net.skinsrestorer.api.storage.PlayerStorage; +import net.skinsrestorer.api.PropertyUtils; import javax.imageio.ImageIO; import java.awt.Graphics2D; import java.awt.RenderingHints; import java.awt.image.BufferedImage; import java.io.IOException; +import java.io.InputStream; +import java.net.HttpURLConnection; import java.net.URI; import java.net.URL; +import net.skinsrestorer.api.property.SkinProperty; import java.nio.charset.StandardCharsets; -import java.util.ArrayList; -import java.util.Base64; -import java.util.List; +import java.util.*; +import java.util.concurrent.ConcurrentHashMap; +import java.util.logging.Level; +import java.util.logging.Logger; public class AvatarUtils { + private static final Logger LOGGER = Logger.getLogger("EasyJoin"); + private static final int CONNECT_TIMEOUT_MS = 3000; + private static final int READ_TIMEOUT_MS = 3000; + private static final long CACHE_TTL_MS = 10 * 60 * 1000L; // 10 minutes + private static final Map<UUID, CachedAvatar> AVATAR_CACHE = new ConcurrentHashMap<>(); + + /** + * Returns the 8-line avatar for the given player, using cache when available. + */ public static List<Component> getAvatar(Player player) { - return getAvatar(player.getUniqueId().toString().replace("-", ""), player.getName()); + UUID uuid = player.getUniqueId(); + String uuidStr = uuid.toString().replace("-", ""); + String playerName = player.getName(); + + CachedAvatar cached = AVATAR_CACHE.get(uuid); + if (cached != null && !cached.isExpired()) { + return cached.lines(); + } + + List<Component> avatar = fetchAvatarWithFallbacks(player, uuidStr, playerName); + AVATAR_CACHE.put(uuid, new CachedAvatar(avatar, System.currentTimeMillis())); + + return avatar; + } + + /** + * Clears the cached avatar for a specific player (e.g. on skin change). + */ + public static void invalidateCache(UUID uuid) { + AVATAR_CACHE.remove(uuid); } - public static List<Component> getAvatar(String uuid, String playerName) { - BufferedImage image = fetchSkinFromMojang(uuid, 64); - if (image == null) image = fetchAshcon(playerName, 64); - if (image == null) image = fetchMcHeads(playerName, 8); - if (image == null) return generatePlaceholder(playerName, 8, 8); + /** + * Clears all cached avatars. + */ + public static void clearCache() { + AVATAR_CACHE.clear(); + } + + private static List<Component> fetchAvatarWithFallbacks(Player player, String uuid, String playerName) { + BufferedImage image = fetchFromSkinsRestorer(player); + if (image != null) { + BufferedImage head = cropHeadWithOverlay(image); + BufferedImage small = resize(head, 8, 8); + return imageToComponents(small); + } + + image = fetchCrafatar(uuid, 8); + if (image != null) return imageToComponents(ensureSize(image, 8, 8)); - if (image.getWidth() >= 32) { - BufferedImage head = cropHeadFromSkin(image); + image = fetchMcHeads(playerName, 8); + if (image != null) return imageToComponents(ensureSize(image, 8, 8)); + + image = fetchSkinFromMojang(uuid); + if (image != null) { + BufferedImage head = cropHeadWithOverlay(image); BufferedImage small = resize(head, 8, 8); return imageToComponents(small); } - return imageToComponents(image); + return generatePlaceholder(playerName, 8, 8); + } + + /** + * Tries to get the skin texture URL from SkinsRestorer if it is installed. + * This allows offline/cracked players who set a skin via SkinsRestorer to + * display the correct avatar. + * + * @return the full skin image, or null if SkinsRestorer is not installed + * or the skin could not be retrieved + */ + private static BufferedImage fetchFromSkinsRestorer(Player player) { + try { + if (!Bukkit.getPluginManager().isPluginEnabled("SkinsRestorer")) { + return null; + } + + return fetchFromSkinsRestorerInternal(player); + } catch (Throwable t) { + LOGGER.log(Level.FINE, "SkinsRestorer integration failed", t); + return null; + } + } + + /** + * Internal method that actually uses SkinsRestorer API classes. + * Separated so the outer method can catch NoClassDefFoundError safely. + */ + private static BufferedImage fetchFromSkinsRestorerInternal(Player player) { + try { + SkinsRestorer api = SkinsRestorerProvider.get(); + PlayerStorage playerStorage = api.getPlayerStorage(); + + Optional<SkinProperty> propertyOpt = + playerStorage.getSkinForPlayer(player.getUniqueId(), player.getName()); + + if (propertyOpt.isEmpty()) return null; + + String skinUrl = PropertyUtils.getSkinTextureUrl(propertyOpt.get()); + if (skinUrl == null || skinUrl.isBlank()) return null; + + return downloadImage(URI.create(skinUrl).toURL()); + } catch (Exception e) { + LOGGER.log(Level.FINE, "Failed to fetch skin from SkinsRestorer for " + player.getName(), e); + return null; + } + } + + /** + * Fetches the player's head avatar from Crafatar with the overlay layer applied. + */ + private static BufferedImage fetchCrafatar(String uuid, int size) { + try { + URL url = URI.create( + "https://crafatar.com/avatars/" + uuid + "?size=" + size + "&overlay" + ).toURL(); + return downloadImage(url); + } catch (Exception e) { + LOGGER.log(Level.FINE, "Crafatar fetch failed for " + uuid, e); + return null; + } + } + + /** + * Fetches the player's head avatar from mc-heads.net. + */ + private static BufferedImage fetchMcHeads(String playerName, int size) { + try { + URL url = URI.create( + "https://mc-heads.net/avatar/" + playerName + "/" + size + ).toURL(); + return downloadImage(url); + } catch (Exception e) { + LOGGER.log(Level.FINE, "mc-heads fetch failed for " + playerName, e); + return null; + } } - private static BufferedImage fetchSkinFromMojang(String uuid, int targetSize) { + /** + * Fetches the full skin texture from the Mojang session server. + */ + private static BufferedImage fetchSkinFromMojang(String uuid) { try { - URL profileUrl = URI.create("https://sessionserver.mojang.com/session/minecraft/profile/" + uuid).toURL(); - byte[] profileBytes = profileUrl.openStream().readAllBytes(); - String profileJson = new String(profileBytes, StandardCharsets.UTF_8); + URL profileUrl = URI.create( + "https://sessionserver.mojang.com/session/minecraft/profile/" + uuid + ).toURL(); + String profileJson = downloadString(profileUrl); + if (profileJson == null) return null; String textureBase64 = extractBase64Texture(profileJson); if (textureBase64 == null) return null; - String textureJson = new String(Base64.getDecoder().decode(textureBase64), StandardCharsets.UTF_8); + String textureJson = new String( + Base64.getDecoder().decode(textureBase64), StandardCharsets.UTF_8 + ); String skinUrl = extractSkinUrlFromTextureJson(textureJson); if (skinUrl == null) return null; - URL skinUrlObj = URI.create(skinUrl).toURL(); - BufferedImage skin = ImageIO.read(skinUrlObj); - return skin; - } catch (IOException e) { + return downloadImage(URI.create(skinUrl).toURL()); + } catch (Exception e) { + LOGGER.log(Level.FINE, "Mojang skin fetch failed for " + uuid, e); return null; } } - private static BufferedImage fetchAshcon(String playerName, int size) { + private static BufferedImage downloadImage(URL url) { + HttpURLConnection conn = null; try { - URL url = URI.create("https://api.ashcon.app/mojang/v2/user/" + playerName).toURL(); - byte[] data = url.openStream().readAllBytes(); - String json = new String(data, StandardCharsets.UTF_8); - int texturesIdx = json.indexOf("\"textures\""); - if (texturesIdx < 0) return null; - int skinIdx = json.indexOf("\"skin\"", texturesIdx); - if (skinIdx < 0) return null; - int urlIdx = json.indexOf("\"url\"", skinIdx); - if (urlIdx < 0) return null; - int colon = json.indexOf(':', urlIdx); - if (colon < 0) return null; - int firstQuote = json.indexOf('"', colon); - if (firstQuote < 0) return null; - int secondQuote = json.indexOf('"', firstQuote + 1); - if (secondQuote < 0) return null; - String skinUrl = json.substring(firstQuote + 1, secondQuote); - if (skinUrl.isBlank()) return null; - return ImageIO.read(URI.create(skinUrl).toURL()); + conn = openConnection(url); + int code = conn.getResponseCode(); + if (code != 200) return null; + try (InputStream in = conn.getInputStream()) { + return ImageIO.read(in); + } } catch (IOException e) { return null; + } finally { + if (conn != null) conn.disconnect(); } } - private static BufferedImage fetchMcHeads(String playerName, int size) { + private static String downloadString(URL url) { + HttpURLConnection conn = null; try { - URL url = URI.create("https://mc-heads.net/avatar/" + playerName + "/" + size).toURL(); - return ImageIO.read(url); + conn = openConnection(url); + int code = conn.getResponseCode(); + if (code != 200) return null; + try (InputStream in = conn.getInputStream()) { + return new String(in.readAllBytes(), StandardCharsets.UTF_8); + } } catch (IOException e) { return null; + } finally { + if (conn != null) conn.disconnect(); } } - private static String extractBase64Texture(String profileJson) { - int props = profileJson.indexOf("\"properties\""); - if (props < 0) return null; - int valueIndex = profileJson.indexOf("\"value\"", props); - if (valueIndex < 0) return null; - int colon = profileJson.indexOf(':', valueIndex); - if (colon < 0) return null; - int firstQuote = profileJson.indexOf('"', colon); - if (firstQuote < 0) return null; - int secondQuote = profileJson.indexOf('"', firstQuote + 1); - if (secondQuote < 0) return null; - String base64 = profileJson.substring(firstQuote + 1, secondQuote); - if (base64.isBlank()) return null; - return base64; - } - - private static String extractSkinUrlFromTextureJson(String textureJson) { - int skinIdx = textureJson.indexOf("\"SKIN\""); - if (skinIdx < 0) return null; - int urlIdx = textureJson.indexOf("\"url\"", skinIdx); - if (urlIdx < 0) return null; - int colon = textureJson.indexOf(':', urlIdx); - if (colon < 0) return null; - int firstQuote = textureJson.indexOf('"', colon); - if (firstQuote < 0) return null; - int secondQuote = textureJson.indexOf('"', firstQuote + 1); - if (secondQuote < 0) return null; - String url = textureJson.substring(firstQuote + 1, secondQuote); - return url; + private static HttpURLConnection openConnection(URL url) throws IOException { + HttpURLConnection conn = (HttpURLConnection) url.openConnection(); + conn.setConnectTimeout(CONNECT_TIMEOUT_MS); + conn.setReadTimeout(READ_TIMEOUT_MS); + conn.setRequestProperty("User-Agent", "EasyJoin-Plugin"); + conn.setInstanceFollowRedirects(true); + return conn; } - private static BufferedImage cropHeadFromSkin(BufferedImage skin) { + /** + * Crops the head (8×8 at offset 8,8) from a full skin and composites the + * overlay / hat layer (8×8 at offset 40,8) on top, respecting alpha. + */ + private static BufferedImage cropHeadWithOverlay(BufferedImage skin) { int width = skin.getWidth(); int scale = Math.max(1, width / 64); - int headX = 8 * scale; - int headY = 8 * scale; int headSize = 8 * scale; + + int baseX = 8 * scale; + int baseY = 8 * scale; + + int overlayX = 40 * scale; + int overlayY = 8 * scale; + try { - BufferedImage head = skin.getSubimage(headX, headY, headSize, headSize); + BufferedImage head = new BufferedImage(headSize, headSize, BufferedImage.TYPE_INT_ARGB); + Graphics2D g = head.createGraphics(); + g.drawImage(skin.getSubimage(baseX, baseY, headSize, headSize), 0, 0, null); + + if (skin.getWidth() >= overlayX + headSize && skin.getHeight() >= overlayY + headSize) { + BufferedImage overlay = skin.getSubimage(overlayX, overlayY, headSize, headSize); + if (!isFullyTransparent(overlay)) { + g.drawImage(overlay, 0, 0, null); + } + } + + g.dispose(); return head; } catch (Exception e) { - return skin; + try { + return skin.getSubimage(baseX, baseY, headSize, headSize); + } catch (Exception ex) { + return skin; + } } } + /** + * Checks if an image region is fully transparent (all pixels have alpha == 0). + * Some skins have an empty overlay layer filled with alpha-0 black pixels; + * drawing that would be harmless but we skip it for safety. + */ + private static boolean isFullyTransparent(BufferedImage img) { + for (int y = 0; y < img.getHeight(); y++) { + for (int x = 0; x < img.getWidth(); x++) { + int alpha = (img.getRGB(x, y) >> 24) & 0xFF; + if (alpha > 0) return false; + } + } + return true; + } + + /** + * Resizes an image using NEAREST_NEIGHBOR interpolation to keep pixel-art + * sharp (no blurring). + */ private static BufferedImage resize(BufferedImage img, int newW, int newH) { BufferedImage resized = new BufferedImage(newW, newH, BufferedImage.TYPE_INT_ARGB); Graphics2D g2 = resized.createGraphics(); - g2.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR); + g2.setRenderingHint( + RenderingHints.KEY_INTERPOLATION, + RenderingHints.VALUE_INTERPOLATION_NEAREST_NEIGHBOR + ); g2.drawImage(img, 0, 0, newW, newH, null); g2.dispose(); return resized; } + /** + * Ensures the image is exactly the target size, resizing if needed. + */ + private static BufferedImage ensureSize(BufferedImage img, int w, int h) { + if (img.getWidth() == w && img.getHeight() == h) return img; + return resize(img, w, h); + } + private static List<Component> imageToComponents(BufferedImage image) { List<Component> lines = new ArrayList<>(); for (int y = 0; y < image.getHeight(); y++) { @@ -187,4 +350,40 @@ private static List<Component> generatePlaceholder(String seed, int width, int h } return lines; } + + private static String extractBase64Texture(String profileJson) { + int props = profileJson.indexOf("\"properties\""); + if (props < 0) return null; + int valueIndex = profileJson.indexOf("\"value\"", props); + if (valueIndex < 0) return null; + int colon = profileJson.indexOf(':', valueIndex); + if (colon < 0) return null; + int firstQuote = profileJson.indexOf('"', colon); + if (firstQuote < 0) return null; + int secondQuote = profileJson.indexOf('"', firstQuote + 1); + if (secondQuote < 0) return null; + String base64 = profileJson.substring(firstQuote + 1, secondQuote); + if (base64.isBlank()) return null; + return base64; + } + + private static String extractSkinUrlFromTextureJson(String textureJson) { + int skinIdx = textureJson.indexOf("\"SKIN\""); + if (skinIdx < 0) return null; + int urlIdx = textureJson.indexOf("\"url\"", skinIdx); + if (urlIdx < 0) return null; + int colon = textureJson.indexOf(':', urlIdx); + if (colon < 0) return null; + int firstQuote = textureJson.indexOf('"', colon); + if (firstQuote < 0) return null; + int secondQuote = textureJson.indexOf('"', firstQuote + 1); + if (secondQuote < 0) return null; + return textureJson.substring(firstQuote + 1, secondQuote); + } + + private record CachedAvatar(List<Component> lines, long timestamp) { + boolean isExpired() { + return System.currentTimeMillis() - timestamp > CACHE_TTL_MS; + } + } } diff --git a/src/main/resources/paper-plugin.yml b/src/main/resources/paper-plugin.yml index 1054b94..1f915cc 100644 --- a/src/main/resources/paper-plugin.yml +++ b/src/main/resources/paper-plugin.yml @@ -8,5 +8,8 @@ package-state: internal dependencies: server: PlaceholderAPI: + load: AFTER + required: false + SkinsRestorer: load: AFTER required: false \ No newline at end of file diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index 4ee24d6..f0d78e1 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -3,6 +3,6 @@ version: ${project.version} main: me.espryth.easyjoin.EasyJoinPlugin api-version: '1.21' authors: [Espryth, Mapacheee] -softdepend: [PlaceholderAPI] +softdepend: [PlaceholderAPI, SkinsRestorer] libraries: - com.zaxxer:HikariCP:7.0.2