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..a2ea87d
--- /dev/null
+++ b/build.gradle.kts
@@ -0,0 +1,125 @@
+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.4-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")
+
+ 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")
+ 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("net.skinsrestorer:skinsrestorer-api:15.5.2")
+
+ 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")
+}
+
+
+tasks.shadowJar {
+ minimize {
+ 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")
+ 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")
+ 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/**")
+ 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 {
+ dependsOn(tasks.shadowJar)
+}
diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar
new file mode 100644
index 0000000..8bdaf60
Binary files /dev/null and b/gradle/wrapper/gradle-wrapper.jar differ
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/MessageUtils.java b/plugin/src/main/java/me/espryth/easyjoin/plugin/utils/MessageUtils.java
deleted file mode 100644
index f5bfaba..0000000
--- a/plugin/src/main/java/me/espryth/easyjoin/plugin/utils/MessageUtils.java
+++ /dev/null
@@ -1,93 +0,0 @@
-package me.espryth.easyjoin.plugin.utils;
-
-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 org.bukkit.entity.Player;
-
-import java.util.regex.Pattern;
-
-public class MessageUtils {
-
- private final static int CENTER_PX = 154;
-
- 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";
-
- public static String colorize(String text) {
- String newText = HEX_COLOR_PATTERN.matcher(text).replaceAll(BUKKIT_HEX_COLOR);
- return ChatColor.translateAlternateColorCodes('&', newText);
- }
-
- public static String formatString(Player player, String s) {
- return PlaceholderAPI.setPlaceholders(player, colorize(s));
- }
-
- public static String getCenteredMessage(String message) {
- return getCenteredSpace(message) + message;
- }
-
- public static String getCenteredSpace(String message) {
-
- if(message == null || message.equals("")) return "";
-
- int messagePxSize = 0;
- boolean previousCode = false;
- boolean isBold = false;
-
- for(char c : message.toCharArray()){
-
- if(c == '§'){
- previousCode = true;
- continue;
- }else if(previousCode){
- previousCode = false;
- if(c == 'l' || c == 'L'){
- isBold = true;
- continue;
- }else isBold = false;
- }else{
- DefaultFontInfo dFI = DefaultFontInfo.getDefaultFontInfo(c);
- messagePxSize += isBold ? dFI.getBoldLength() : dFI.getLength();
- messagePxSize++;
- }
- }
-
- int halvedMessageSize = messagePxSize / 2;
- int toCompensate = CENTER_PX - halvedMessageSize;
- int spaceLength = DefaultFontInfo.SPACE.getLength() + 1;
- int compensated = 0;
- StringBuilder sb = new StringBuilder();
- 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/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..fc8c647
--- /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()) {
+ player.getScheduler().run(plugin, t -> executeAll(player), null);
+ 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..fd8d284
--- /dev/null
+++ b/src/main/java/me/espryth/easyjoin/command/MainCommand.java
@@ -0,0 +1,106 @@
+package me.espryth.easyjoin.command;
+
+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.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
+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, Plugin plugin) {
+ this.reloadServiceManager = reloadServiceManager;
+ this.formatService = formatService;
+ this.logger = logger;
+ this.plugin = plugin;
+ }
+
+ @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"));
+ sender.sendMessage(MessageUtils
+ .colorize("&f- /ej join - simulate join for the given format (player only)"));
+ sender.sendMessage(MessageUtils
+ .colorize("&f- /ej leave - simulate quit for the given format (player only)"));
+ }
+ }
+
+ @Command("easyjoin reload")
+ @Permission("easyjoin.admin")
+ public void reload(Source source) {
+ CommandSender sender = (CommandSender) source.source();
+ reloadServiceManager.reload();
+ formatService.loadFormats(logger);
+ sender.sendMessage(MessageUtils.colorize("&aConfiguration reloaded!"));
+ }
+
+ @Suggestions("formats")
+ public List suggestFormats(CommandContext context, CommandInput input) {
+ return formatService.getFormatIds();
+ }
+
+ @Command("easyjoin testjoin ")
+ @Permission("easyjoin.admin")
+ 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;
+ }
+
+ Optional formatOpt = formatService.getFormatById(formatId);
+ if (formatOpt.isEmpty()) {
+ sender.sendMessage(MessageUtils.colorize("&cNo format found with id: " + formatId));
+ return;
+ }
+
+ new ActionQueue(formatOpt.get().joinActions(), plugin).executeAll(player);
+ sender.sendMessage(MessageUtils.colorize("&aExecuted join actions for format: " + formatId));
+ }
+
+ @Command("easyjoin testleave ")
+ @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 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/config/AppConfig.java b/src/main/java/me/espryth/easyjoin/config/AppConfig.java
new file mode 100644
index 0000000..a85c3b4
--- /dev/null
+++ b/src/main/java/me/espryth/easyjoin/config/AppConfig.java
@@ -0,0 +1,27 @@
+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
+ ) {}
+
+ @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/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;
+ private final Container credentialsConfig;
+ private HikariDataSource dataSource;
+ private Jdbi jdbi;
+ private boolean enabled = false;
+
+ @Inject
+ public DatabaseService(Container appConfig, Container 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 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
new file mode 100644
index 0000000..51b6745
--- /dev/null
+++ b/src/main/java/me/espryth/easyjoin/format/Format.java
@@ -0,0 +1,13 @@
+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
+) {}
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..b1fe235
--- /dev/null
+++ b/src/main/java/me/espryth/easyjoin/listener/PlayerListener.java
@@ -0,0 +1,61 @@
+package me.espryth.easyjoin.listener;
+
+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;
+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;
+
+@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;
+ this.firstJoinService = firstJoinService;
+ }
+
+ @EventHandler
+ public void onJoin(PlayerJoinEvent event) {
+ Player player = event.getPlayer();
+ event.joinMessage(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.quitMessage(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..e587dca
--- /dev/null
+++ b/src/main/java/me/espryth/easyjoin/service/ActionService.java
@@ -0,0 +1,252 @@
+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.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;
+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.time.Duration;
+import java.util.*;
+import java.util.function.Consumer;
+
+@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) -> sendMessage(player, data, player::sendMessage));
+
+ registerAction("[BROADCAST]", data -> (player, queue) -> sendMessage(player, data, Bukkit::broadcast));
+
+ 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) -> {
+ Component msg = MessageUtils.colorizeToComponent(PlaceholderAPI.setPlaceholders(player, data));
+ player.sendActionBar(msg);
+ });
+
+ registerAction("[BROADCAST_ACTIONBAR]", data -> (player, queue) -> {
+ Component msg = MessageUtils.colorizeToComponent(PlaceholderAPI.setPlaceholders(player, data));
+ Bukkit.getOnlinePlayers().forEach(p -> p.sendActionBar(msg));
+ });
+
+ 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("[AVATAR_MESSAGE]",
+ data -> (player, queue) -> sendAvatarMessage(player, data, player::sendMessage));
+
+ 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) -> spawnFirework(player, data));
+
+ 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) -> playSoundCommand(player, data));
+
+ registerAction("[BROADCAST_SOUND]", data -> (player, queue) -> playBroadcastSoundCommand(data));
+
+ registerAction("[DELAY]", data -> (player, queue) -> {
+ int delay = Integer.parseInt(data);
+ queue.setPaused(true);
+ player.getScheduler().runDelayed(queue.getPlugin(), t -> {
+ queue.setPaused(false);
+ queue.executeAll(player);
+ }, null, delay * 20L);
+ });
+ }
+
+ 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(
+ Duration.ofMillis(fadeIn * 50L),
+ Duration.ofMillis(stay * 50L),
+ Duration.ofMillis(fadeOut * 50L)));
+ titleSender.accept(titleObj);
+ }
+
+ private void sendAvatarMessage(Player player, String data, Consumer sender) {
+ List avatar = AvatarUtils.getAvatar(player);
+ String[] lines = data.split("");
+ 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] : "";
+
+ final Component formattedMessageLine;
+
+ if (messageLine.startsWith("")) {
+ String stripped = messageLine.substring(3);
+ 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));
+ }
+
+ sender.accept(avatarLine.append(Component.text(" ")).append(formattedMessageLine));
+ }
+ }
+
+ 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 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);
+ }
+ }
+
+ 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";
+
+ final Key key;
+ 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);
+
+ return Sound.sound(key, source, volume, pitch);
+ }
+
+ private void playSoundCommand(Player player, String data) {
+ Sound sound = parseSound(data);
+ player.playSound(sound);
+
+ }
+
+ 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);
+ }
+}
+
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..ca4a8fb
--- /dev/null
+++ b/src/main/java/me/espryth/easyjoin/service/FirstJoinService.java
@@ -0,0 +1,72 @@
+package me.espryth.easyjoin.service;
+
+import com.thewinterframework.configurate.Container;
+import com.thewinterframework.service.annotation.Service;
+import jakarta.inject.Inject;
+import me.espryth.easyjoin.config.AppConfig;
+import me.espryth.easyjoin.database.DatabaseService;
+import me.espryth.easyjoin.database.FirstJoinDao;
+import org.bukkit.entity.Player;
+
+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 DatabaseService databaseService;
+ private final Set cache = new HashSet<>();
+
+ @Inject
+ public FirstJoinService(Container appConfig, DatabaseService databaseService) {
+ this.appConfig = appConfig;
+ this.databaseService = databaseService;
+ }
+
+ 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(() -> {
+ 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;
+ }
+
+ cache.add(player.getUniqueId());
+
+ CompletableFuture.runAsync(() -> {
+ 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
new file mode 100644
index 0000000..4c3c5d6
--- /dev/null
+++ b/src/main/java/me/espryth/easyjoin/service/FormatService.java
@@ -0,0 +1,86 @@
+package me.espryth.easyjoin.service;
+
+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;
+
+@Service
+public class FormatService {
+
+ private final Container config;
+ private final ActionService actionService;
+ private final Map formats = new HashMap<>();
+
+ @Inject
+ public FormatService(Container config, ActionService actionService) {
+ this.config = config;
+ this.actionService = actionService;
+ }
+
+ @OnEnable
+ public void loadFormats(Logger logger) {
+ formats.clear();
+ AppConfig appConfig = config.get();
+ if (appConfig.formats() == null) {
+ logger.error("No formats found in configuration!");
+ return;
+ }
+
+ appConfig.formats().forEach((id, section) -> {
+ List join = parseActions(section.join());
+ List quit = parseActions(section.quit());
+
+ formats.put(id, new Format(
+ id,
+ section.priority(),
+ section.isFirstJoinFormat(),
+ join,
+ quit
+ ));
+
+ logger.info("Loaded format: {} (priority: {}, firstJoin: {})", id, section.priority(), section.isFirstJoinFormat());
+ });
+
+ logger.info("Total formats loaded: {}", formats.size());
+ }
+
+ 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 -> f.id().equalsIgnoreCase("default") || 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();
+ }
+
+ public Optional getFormatById(String id) {
+ return Optional.ofNullable(formats.get(id));
+ }
+
+ public List getFormatIds() {
+ return new ArrayList<>(formats.keySet());
+ }
+}
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..857ee94
--- /dev/null
+++ b/src/main/java/me/espryth/easyjoin/util/AvatarUtils.java
@@ -0,0 +1,389 @@
+package me.espryth.easyjoin.util;
+
+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.*;
+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 AVATAR_CACHE = new ConcurrentHashMap<>();
+
+ /**
+ * Returns the 8-line avatar for the given player, using cache when available.
+ */
+ public static List getAvatar(Player player) {
+ 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 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);
+ }
+
+ /**
+ * Clears all cached avatars.
+ */
+ public static void clearCache() {
+ AVATAR_CACHE.clear();
+ }
+
+ private static List 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));
+
+ 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 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 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;
+ }
+ }
+
+ /**
+ * 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();
+ 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 skinUrl = extractSkinUrlFromTextureJson(textureJson);
+ if (skinUrl == null) return null;
+
+ 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 downloadImage(URL url) {
+ HttpURLConnection conn = null;
+ try {
+ 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 String downloadString(URL url) {
+ HttpURLConnection conn = null;
+ try {
+ 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 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;
+ }
+
+ /**
+ * 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 headSize = 8 * scale;
+
+ int baseX = 8 * scale;
+ int baseY = 8 * scale;
+
+ int overlayX = 40 * scale;
+ int overlayY = 8 * scale;
+
+ try {
+ 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) {
+ 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_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 imageToComponents(BufferedImage image) {
+ 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 rgba = image.getRGB(x, y);
+ int alpha = (rgba >> 24) & 0xFF;
+ if (alpha < 64) {
+ line = line.append(Component.text(" "));
+ continue;
+ }
+ int rgb = rgba & 0xFFFFFF;
+ TextColor color = TextColor.color(rgb);
+ line = line.append(Component.text("█").color(color));
+ }
+ lines.add(line);
+ }
+ return lines;
+ }
+
+ private static List generatePlaceholder(String seed, int width, int height) {
+ List 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;
+ }
+
+ 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 lines, long timestamp) {
+ boolean isExpired() {
+ return System.currentTimeMillis() - timestamp > CACHE_TTL_MS;
+ }
+ }
+}
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/src/main/java/me/espryth/easyjoin/util/MessageUtils.java b/src/main/java/me/espryth/easyjoin/util/MessageUtils.java
new file mode 100644
index 0000000..0e1e87b
--- /dev/null
+++ b/src/main/java/me/espryth/easyjoin/util/MessageUtils.java
@@ -0,0 +1,124 @@
+package me.espryth.easyjoin.util;
+
+import me.clip.placeholderapi.PlaceholderAPI;
+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 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 = "§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);
+ if (newText.indexOf('§') >= 0) {
+ return newText;
+ }
+ Component component = MINI_MESSAGE.deserialize(newText);
+ if (component.equals(Component.text(newText))) {
+ 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);
+ if (newText.indexOf('§') >= 0) {
+ return LegacyComponentSerializer.legacySection().deserialize(newText);
+ }
+ Component component = MINI_MESSAGE.deserialize(newText);
+ if (component.equals(Component.text(newText))) {
+ return LegacyComponentSerializer.legacyAmpersand().deserialize(newText);
+ }
+ return component;
+ }
+
+ public static String formatString(Player player, String s) {
+ return PlaceholderAPI.setPlaceholders(player, colorize(s));
+ }
+
+ public static String getCenteredMessage(String 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;
+ }
+
+ /**
+ * 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);
+ }
+
+ private static String getCenteredSpace(String message, int centerPx) {
+ if (message == null || message.isEmpty())
+ return "";
+
+ int messagePxSize = 0;
+ boolean previousCode = false;
+ boolean isBold = false;
+
+ for (char c : message.toCharArray()) {
+ if (c == '§') {
+ previousCode = true;
+ } else if (previousCode) {
+ previousCode = false;
+ isBold = (c == 'l' || c == 'L');
+ } else {
+ DefaultFontInfo dFI = DefaultFontInfo.getDefaultFontInfo(c);
+ messagePxSize += isBold ? dFI.getBoldLength() : dFI.getLength();
+ messagePxSize++;
+ }
+ }
+
+ int halvedMessageSize = messagePxSize / 2;
+ int toCompensate = centerPx - halvedMessageSize;
+ int spaceLength = DefaultFontInfo.SPACE.getLength() + 1;
+ int compensated = 0;
+ StringBuilder sb = new StringBuilder();
+ while (compensated < toCompensate) {
+ sb.append(" ");
+ compensated += spaceLength;
+ }
+ return sb.toString();
+ }
+}
diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml
new file mode 100644
index 0000000..a674c11
--- /dev/null
+++ b/src/main/resources/config.yml
@@ -0,0 +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]
+# Sends a message to the player
+# Use at the start to center the message
+# Example: [MESSAGE] &aWelcome to the server!
+# Example: [MESSAGE] &6Centered Message
+#
+# [BROADCAST]
+# Sends a message to all online players
+# Use at the start to center the message
+# Example: [BROADCAST] &e%player_name% joined!
+#
+# [JSON_MESSAGE]
+# 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]
+# Sends a JSON message to all online players
+#
+# [ACTIONBAR]
+# Shows a message in the player's action bar
+# Example: [ACTIONBAR] &aWelcome back!
+#
+# [BROADCAST_ACTIONBAR]
+# Shows a message in all players' action bars
+#
+# TITLE ACTIONS:
+# [TITLE] ;;;;
+# 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] ;;;;
+# Shows a title to all online players
+#
+# AVATAR ACTIONS:
+# [AVATAR_MESSAGE] ...
+# Sends a message with the player's Minecraft skin avatar
+# Use to separate lines (up to 8 lines)
+# Example: [AVATAR_MESSAGE] &aWelcome&7%player_name%
+#
+# [AVATAR_BROADCAST] ...
+# Broadcasts a message with the player's avatar to all players
+#
+# SOUND ACTIONS:
+# [SOUND] ;;
+# 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] ;;
+# Plays a sound to all online players
+#
+# FIREWORK ACTION:
+# [FIREWORK] ;;;;;...
+# 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]
+# Executes a command as console
+# Example: [CONSOLE] give %player_name% diamond 1
+#
+# [PLAYER]
+# Makes the player execute a command
+# Example: [PLAYER] spawn
+#
+# UTILITY ACTIONS:
+# [CLEARCHAT]
+# Clears the player's chat by sending empty lines
+# Example: [CLEARCHAT] 100
+#
+# [DELAY]
+# 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. (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;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:
+ - ' 5'
+ - '[BROADCAST] &8(&a+&8) &f%player_name%'
+ - '[AVATAR_MESSAGE] &aWelcome to the server!&7%player_name%&bEnjoy your stay!'
+ - '[SOUND] ENTITY_PLAYER_LEVELUP;1;1'
+ - '[ACTIONBAR] &ashop.example.com'
+ 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/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..1f915cc
--- /dev/null
+++ b/src/main/resources/paper-plugin.yml
@@ -0,0 +1,15 @@
+api-version: '1.21'
+name: EasyJoin
+version: ${project.version}
+main: me.espryth.easyjoin.EasyJoinPlugin
+authors: [Espryth, Mapacheee]
+folia-supported: true
+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
new file mode 100644
index 0000000..f0d78e1
--- /dev/null
+++ b/src/main/resources/plugin.yml
@@ -0,0 +1,8 @@
+name: EasyJoin
+version: ${project.version}
+main: me.espryth.easyjoin.EasyJoinPlugin
+api-version: '1.21'
+authors: [Espryth, Mapacheee]
+softdepend: [PlaceholderAPI, SkinsRestorer]
+libraries:
+ - com.zaxxer:HikariCP:7.0.2