From 8e95a49bec0c1d857630a07a2701f1ce9d58e337 Mon Sep 17 00:00:00 2001 From: SrJss <31166687+jonagamerpro1234@users.noreply.github.com> Date: Mon, 24 Oct 2022 21:30:28 -0300 Subject: [PATCH 01/27] add langs file and more --- .../config/Lang.java | 6 +- .../CustomJoinAndQuitMessage.java | 8 ++ .../files/LangFile.java | 81 +++++++++++++++++++ .../files/utils/PreConfigLoader.java | 27 +++++-- .../files/utils/Settings.java | 7 ++ .../listeners/{ => chat}/JoinListener.java | 2 +- .../inventory/DisplayInventoryListener.java | 4 + bukkit/src/main/resources/config.yml | 2 + bukkit/src/main/resources/langs/de-DE.yml | 25 ------ bukkit/src/main/resources/langs/en-US.yml | 25 ------ bukkit/src/main/resources/langs/es-ES.yml | 25 ------ bukkit/src/main/resources/langs/fr-FR.yml | 25 ------ bukkit/src/main/resources/langs/ru-RU.yml | 25 ------ bukkit/src/main/resources/langs/zh-CN.yml | 25 ------ bukkit/src/main/resources/langs/zh-TW.yml | 25 ------ 15 files changed, 128 insertions(+), 184 deletions(-) create mode 100644 bukkit/src/main/java/jss/customjoinandquitmessage/files/utils/Settings.java rename bukkit/src/main/java/jss/customjoinandquitmessage/listeners/{ => chat}/JoinListener.java (88%) create mode 100644 bukkit/src/main/java/jss/customjoinandquitmessage/listeners/inventory/DisplayInventoryListener.java delete mode 100644 bukkit/src/main/resources/langs/de-DE.yml delete mode 100644 bukkit/src/main/resources/langs/en-US.yml delete mode 100644 bukkit/src/main/resources/langs/es-ES.yml delete mode 100644 bukkit/src/main/resources/langs/fr-FR.yml delete mode 100644 bukkit/src/main/resources/langs/ru-RU.yml delete mode 100644 bukkit/src/main/resources/langs/zh-CN.yml delete mode 100644 bukkit/src/main/resources/langs/zh-TW.yml diff --git a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/config/Lang.java b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/config/Lang.java index 4d6af73..22a54da 100644 --- a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/config/Lang.java +++ b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/config/Lang.java @@ -23,9 +23,9 @@ public class Lang { private CustomJoinAndQuitMessages plugin; private FileConfiguration locale = null; private File localeFile = null; - private Locale localeObject; - private String localeName; - private int index; + private final Locale localeObject; + private final String localeName; + private final int index; public Lang(final CustomJoinAndQuitMessages plugin, final String localeName, final int index) { this.plugin = plugin; diff --git a/bukkit/src/main/java/jss/customjoinandquitmessage/CustomJoinAndQuitMessage.java b/bukkit/src/main/java/jss/customjoinandquitmessage/CustomJoinAndQuitMessage.java index ec30ac4..7876057 100644 --- a/bukkit/src/main/java/jss/customjoinandquitmessage/CustomJoinAndQuitMessage.java +++ b/bukkit/src/main/java/jss/customjoinandquitmessage/CustomJoinAndQuitMessage.java @@ -1,6 +1,8 @@ package jss.customjoinandquitmessage; import jss.customjoinandquitmessage.commands.CommandHandler; +import jss.customjoinandquitmessage.files.utils.PreConfigLoader; +import org.bukkit.Bukkit; import org.bukkit.plugin.PluginDescriptionFile; import org.bukkit.plugin.java.JavaPlugin; @@ -10,9 +12,15 @@ public final class CustomJoinAndQuitMessage extends JavaPlugin { private static CustomJoinAndQuitMessage instance; public final String version = jss.getVersion(); public String newestVersion; + private final PreConfigLoader preConfigLoader = new PreConfigLoader(); public void onEnable() { instance = this; + + if(!preConfigLoader.loadLangs()){ + Bukkit.getPluginManager().disablePlugins(); + } + CommandHandler commandHandler = new CommandHandler(); commandHandler.register(); diff --git a/bukkit/src/main/java/jss/customjoinandquitmessage/files/LangFile.java b/bukkit/src/main/java/jss/customjoinandquitmessage/files/LangFile.java index 7f05d5e..dbb2686 100644 --- a/bukkit/src/main/java/jss/customjoinandquitmessage/files/LangFile.java +++ b/bukkit/src/main/java/jss/customjoinandquitmessage/files/LangFile.java @@ -1,4 +1,85 @@ package jss.customjoinandquitmessage.files; +import jss.customjoinandquitmessage.CustomJoinAndQuitMessage; +import org.bukkit.configuration.file.FileConfiguration; +import org.bukkit.configuration.file.YamlConfiguration; +import org.jetbrains.annotations.NotNull; + +import java.io.File; +import java.util.Locale; + public class LangFile { + + private CustomJoinAndQuitMessage plugin; + private FileConfiguration config; + private File file; + private final Locale localeObj; + private final String localeName; + private final int index; + + public LangFile(@NotNull String localeName, int index){ + this.index = index; + this.localeName = localeName; + getConfig(localeName); + loadMessages(); + localeObj = new Locale(localeName.substring(0,2),localeName.substring(3,5)); + } + + + public FileConfiguration getConfig(final String name) { + if(config == null){ + reload(name); + } + return config; + } + + public void reload(final String name){ + File dir = new File(plugin.getDataFolder(),"langs"); + + if(!dir.exists()){ + //noinspection ResultOfMethodCallIgnored + dir.mkdir(); + } + + if(file == null){ + file = new File(dir.getPath(), name + ".yml"); + } + + if(dir.exists()){ + config = YamlConfiguration.loadConfiguration(file); + }else{ + + if(plugin.getResource("langs/" + name + ".yml") != null){ + plugin.saveResource("langs" + name + ".yml", true); + file = new File(plugin.getDataFolder() + File.separator + "langs", name + ".yml"); + config = YamlConfiguration.loadConfiguration(file); + } + } + } + + private void loadMessages(){ + + } + + public String getLocaleName() { + return this.localeName; + } + + public String getLanguageName() { + if (localeObj == null) { + return "unknown"; + } + return localeObj.getDisplayLanguage(localeObj); + } + + public String getCountryName() { + if (localeObj == null) { + return "unknown"; + } + return localeObj.getDisplayCountry(localeObj); + } + + public int getIndex() { + return index; + } } diff --git a/bukkit/src/main/java/jss/customjoinandquitmessage/files/utils/PreConfigLoader.java b/bukkit/src/main/java/jss/customjoinandquitmessage/files/utils/PreConfigLoader.java index 54d9818..e40e8de 100644 --- a/bukkit/src/main/java/jss/customjoinandquitmessage/files/utils/PreConfigLoader.java +++ b/bukkit/src/main/java/jss/customjoinandquitmessage/files/utils/PreConfigLoader.java @@ -1,17 +1,34 @@ package jss.customjoinandquitmessage.files.utils; +import jss.customjoinandquitmessage.files.LangFile; + +import java.io.IOException; import java.util.HashMap; public class PreConfigLoader { public void loadConfigs(){ - + Settings.config_Lang = "en_US"; } - public void loadLangs(){ - HashMap availableLangs = new HashMap<>(); - - + public boolean loadLangs(){ + HashMap availableLangs = new HashMap<>(); + FileList fileList = new FileList(); + int index = 1; + + try { + for(String code : fileList.list()){ + availableLangs.put(code, new LangFile(code, index++)); + } + } catch (IOException e) { + throw new RuntimeException(e); + } + + if(!availableLangs.containsKey(Settings.config_Lang)){ + Settings.config_Lang = "en_US"; + availableLangs.put(Settings.config_Lang, new LangFile(Settings.config_Lang,0)); + } + return true; } } diff --git a/bukkit/src/main/java/jss/customjoinandquitmessage/files/utils/Settings.java b/bukkit/src/main/java/jss/customjoinandquitmessage/files/utils/Settings.java new file mode 100644 index 0000000..5e25404 --- /dev/null +++ b/bukkit/src/main/java/jss/customjoinandquitmessage/files/utils/Settings.java @@ -0,0 +1,7 @@ +package jss.customjoinandquitmessage.files.utils; + +public class Settings { + + public static String config_Lang; + +} diff --git a/bukkit/src/main/java/jss/customjoinandquitmessage/listeners/JoinListener.java b/bukkit/src/main/java/jss/customjoinandquitmessage/listeners/chat/JoinListener.java similarity index 88% rename from bukkit/src/main/java/jss/customjoinandquitmessage/listeners/JoinListener.java rename to bukkit/src/main/java/jss/customjoinandquitmessage/listeners/chat/JoinListener.java index 6286cb1..26b1303 100644 --- a/bukkit/src/main/java/jss/customjoinandquitmessage/listeners/JoinListener.java +++ b/bukkit/src/main/java/jss/customjoinandquitmessage/listeners/chat/JoinListener.java @@ -1,4 +1,4 @@ -package jss.customjoinandquitmessage.listeners; +package jss.customjoinandquitmessage.listeners.chat; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; diff --git a/bukkit/src/main/java/jss/customjoinandquitmessage/listeners/inventory/DisplayInventoryListener.java b/bukkit/src/main/java/jss/customjoinandquitmessage/listeners/inventory/DisplayInventoryListener.java new file mode 100644 index 0000000..5699be7 --- /dev/null +++ b/bukkit/src/main/java/jss/customjoinandquitmessage/listeners/inventory/DisplayInventoryListener.java @@ -0,0 +1,4 @@ +package jss.customjoinandquitmessage.listeners.inventory; + +public class DisplayInventoryListener { +} diff --git a/bukkit/src/main/resources/config.yml b/bukkit/src/main/resources/config.yml index c76cc56..efa83b3 100644 --- a/bukkit/src/main/resources/config.yml +++ b/bukkit/src/main/resources/config.yml @@ -1,4 +1,6 @@ +Lang: en-US + ChatFormat: diff --git a/bukkit/src/main/resources/langs/de-DE.yml b/bukkit/src/main/resources/langs/de-DE.yml deleted file mode 100644 index 09d869c..0000000 --- a/bukkit/src/main/resources/langs/de-DE.yml +++ /dev/null @@ -1,25 +0,0 @@ -Prefix: "&e[&dCustomJoinAndQuitMessage&e]" -NoPermission: "&cYou don't have permissions!" -UsageMainCommand: "&7Use &9/Cjm &ehelp &7for more information" -UnknownArguments: "&cUnknown argument!" -ReloadCommand: "&aAll plugin files have been reloaded" -UsageDisplayCommand: "&7Usa &9/Cjm &edisplay &d &7to see a preview" -UnknownSound: "&eThe sound is not from this version or is misspelled!" -DisabledCommand: "&cThis command is disabled" -UpdateAlert: - Console: - - "======================================-" - - " || The {version} is out of date" - - " || - Newest version: {newversion}" - - " || - Your version: {version}" - - " || - Update here on Spigot: {spigot}" - - " || - Update here on GitHub: {github}" - - "======================================-" - Player: - - "&aVersion &e{newversion} &ais now available for download" - - "&b&nClick &7here to go to the plugin page" -HelpCommand: - - " &6&l* &9/Cjm &ehelp &7shows this same message" - - " &6&l* &9/Cjm &ereload &7reload all plugin files" - - " &6&l* &9/Cjm &einfo &7shows plugin information like support links..." - - " &6&l* &9/Cjm &edisplay &7it is used to see the messages and functions of the plugin without having to leave the server" diff --git a/bukkit/src/main/resources/langs/en-US.yml b/bukkit/src/main/resources/langs/en-US.yml deleted file mode 100644 index ff2a0bc..0000000 --- a/bukkit/src/main/resources/langs/en-US.yml +++ /dev/null @@ -1,25 +0,0 @@ -Prefix: "&e[&dCustomJoinAndQuitMessage&e]" -NoPermission: "&cYou don't have permissions!" -UsageMainCommand: "&7Use &9/Cjm &ehelp &7for more information" -UnknownArguments: "&cUnknown argument!" -ReloadCommand: "&aAll plugin files have been reloaded" -UsageDisplayCommand: "&7Use &9/Cjm &edisplay &d &7to see a preview" -UnknownSound: "&eThe sound is not from this version or is misspelled!" -DisabledCommand: "&cThis command is disabled" -UpdateAlert: - Console: - - "======================================-" - - " || The {version} is out of date" - - " || - The Newest version: {newversion}" - - " || - Your version: {version}" - - " || - Update here on Spigot: {spigot}" - - " || - Update here on GitHub: {github}" - - "======================================-" - Player: - - "&aVersion &e{newversion} &ais now available for download" - - "&b&nClick &7here to go to the plugin page" -HelpCommand: - - " &6&l* &9/Cjm &ehelp &7shows this same message" - - " &6&l* &9/Cjm &ereload &7reload all plugin files" - - " &6&l* &9/Cjm &einfo &7shows plugin information like support links..." - - " &6&l* &9/Cjm &edisplay &7it is used to see the messages and functions of the plugin without having to leave the server" diff --git a/bukkit/src/main/resources/langs/es-ES.yml b/bukkit/src/main/resources/langs/es-ES.yml deleted file mode 100644 index 375da8a..0000000 --- a/bukkit/src/main/resources/langs/es-ES.yml +++ /dev/null @@ -1,25 +0,0 @@ -Prefix: "&e[&dCustomJoinAndQuitMessage&e]" -NoPermission: "&cNo tienes permisos!" -UsageMainCommand: "&7Usa &9/Cjm &ehelp &7para más información" -UnknownArguments: "¡&cArgumento desconocido!" -ReloadCommand: "&aSe han recargado todos los archivos del plugin" -UsageDisplayCommand: "&7Usa &9/Cjm &edisplay &d &7para ver una previsualización" -UnknownSound: "\"&eEl sonido no es de esta version o esta mal escrito!" -DisabledCommand: "&cEste comando se encuentra desactivado" -UpdateAlert: - Console: - - "======================================-" - - " || La {version} esta desactualizada" - - "La versión más nueva: {newversion}" - - "Tu versión: {version}" - - "Actualizar aqui en Spigot: {spigot}" - - "Actualizar aquí en GitHub: {github}" - - "======================================-" - Player: - - "&aLa version &e{newversion} está disponible para descargar" - - "&b&nClic &7aqui para ir a la página del plugin" -HelpCommand: - - " &6&l* &9/Cjm &ehelp &7muestra este mismo mensaje" - - " &6&l* &9/Cjm heredad recarga todos los archivos del plugin" - - " &6&l* &9/Cjm &einfo &7muestra informacion del plugin como los links de soporte..." - - " &6&l* &9/Cjm &edisplay &7sirve para ver los mensajes y funciones del plugin sin tener que salir del servidor" diff --git a/bukkit/src/main/resources/langs/fr-FR.yml b/bukkit/src/main/resources/langs/fr-FR.yml deleted file mode 100644 index 09d869c..0000000 --- a/bukkit/src/main/resources/langs/fr-FR.yml +++ /dev/null @@ -1,25 +0,0 @@ -Prefix: "&e[&dCustomJoinAndQuitMessage&e]" -NoPermission: "&cYou don't have permissions!" -UsageMainCommand: "&7Use &9/Cjm &ehelp &7for more information" -UnknownArguments: "&cUnknown argument!" -ReloadCommand: "&aAll plugin files have been reloaded" -UsageDisplayCommand: "&7Usa &9/Cjm &edisplay &d &7to see a preview" -UnknownSound: "&eThe sound is not from this version or is misspelled!" -DisabledCommand: "&cThis command is disabled" -UpdateAlert: - Console: - - "======================================-" - - " || The {version} is out of date" - - " || - Newest version: {newversion}" - - " || - Your version: {version}" - - " || - Update here on Spigot: {spigot}" - - " || - Update here on GitHub: {github}" - - "======================================-" - Player: - - "&aVersion &e{newversion} &ais now available for download" - - "&b&nClick &7here to go to the plugin page" -HelpCommand: - - " &6&l* &9/Cjm &ehelp &7shows this same message" - - " &6&l* &9/Cjm &ereload &7reload all plugin files" - - " &6&l* &9/Cjm &einfo &7shows plugin information like support links..." - - " &6&l* &9/Cjm &edisplay &7it is used to see the messages and functions of the plugin without having to leave the server" diff --git a/bukkit/src/main/resources/langs/ru-RU.yml b/bukkit/src/main/resources/langs/ru-RU.yml deleted file mode 100644 index 09d869c..0000000 --- a/bukkit/src/main/resources/langs/ru-RU.yml +++ /dev/null @@ -1,25 +0,0 @@ -Prefix: "&e[&dCustomJoinAndQuitMessage&e]" -NoPermission: "&cYou don't have permissions!" -UsageMainCommand: "&7Use &9/Cjm &ehelp &7for more information" -UnknownArguments: "&cUnknown argument!" -ReloadCommand: "&aAll plugin files have been reloaded" -UsageDisplayCommand: "&7Usa &9/Cjm &edisplay &d &7to see a preview" -UnknownSound: "&eThe sound is not from this version or is misspelled!" -DisabledCommand: "&cThis command is disabled" -UpdateAlert: - Console: - - "======================================-" - - " || The {version} is out of date" - - " || - Newest version: {newversion}" - - " || - Your version: {version}" - - " || - Update here on Spigot: {spigot}" - - " || - Update here on GitHub: {github}" - - "======================================-" - Player: - - "&aVersion &e{newversion} &ais now available for download" - - "&b&nClick &7here to go to the plugin page" -HelpCommand: - - " &6&l* &9/Cjm &ehelp &7shows this same message" - - " &6&l* &9/Cjm &ereload &7reload all plugin files" - - " &6&l* &9/Cjm &einfo &7shows plugin information like support links..." - - " &6&l* &9/Cjm &edisplay &7it is used to see the messages and functions of the plugin without having to leave the server" diff --git a/bukkit/src/main/resources/langs/zh-CN.yml b/bukkit/src/main/resources/langs/zh-CN.yml deleted file mode 100644 index 09d869c..0000000 --- a/bukkit/src/main/resources/langs/zh-CN.yml +++ /dev/null @@ -1,25 +0,0 @@ -Prefix: "&e[&dCustomJoinAndQuitMessage&e]" -NoPermission: "&cYou don't have permissions!" -UsageMainCommand: "&7Use &9/Cjm &ehelp &7for more information" -UnknownArguments: "&cUnknown argument!" -ReloadCommand: "&aAll plugin files have been reloaded" -UsageDisplayCommand: "&7Usa &9/Cjm &edisplay &d &7to see a preview" -UnknownSound: "&eThe sound is not from this version or is misspelled!" -DisabledCommand: "&cThis command is disabled" -UpdateAlert: - Console: - - "======================================-" - - " || The {version} is out of date" - - " || - Newest version: {newversion}" - - " || - Your version: {version}" - - " || - Update here on Spigot: {spigot}" - - " || - Update here on GitHub: {github}" - - "======================================-" - Player: - - "&aVersion &e{newversion} &ais now available for download" - - "&b&nClick &7here to go to the plugin page" -HelpCommand: - - " &6&l* &9/Cjm &ehelp &7shows this same message" - - " &6&l* &9/Cjm &ereload &7reload all plugin files" - - " &6&l* &9/Cjm &einfo &7shows plugin information like support links..." - - " &6&l* &9/Cjm &edisplay &7it is used to see the messages and functions of the plugin without having to leave the server" diff --git a/bukkit/src/main/resources/langs/zh-TW.yml b/bukkit/src/main/resources/langs/zh-TW.yml deleted file mode 100644 index 09d869c..0000000 --- a/bukkit/src/main/resources/langs/zh-TW.yml +++ /dev/null @@ -1,25 +0,0 @@ -Prefix: "&e[&dCustomJoinAndQuitMessage&e]" -NoPermission: "&cYou don't have permissions!" -UsageMainCommand: "&7Use &9/Cjm &ehelp &7for more information" -UnknownArguments: "&cUnknown argument!" -ReloadCommand: "&aAll plugin files have been reloaded" -UsageDisplayCommand: "&7Usa &9/Cjm &edisplay &d &7to see a preview" -UnknownSound: "&eThe sound is not from this version or is misspelled!" -DisabledCommand: "&cThis command is disabled" -UpdateAlert: - Console: - - "======================================-" - - " || The {version} is out of date" - - " || - Newest version: {newversion}" - - " || - Your version: {version}" - - " || - Update here on Spigot: {spigot}" - - " || - Update here on GitHub: {github}" - - "======================================-" - Player: - - "&aVersion &e{newversion} &ais now available for download" - - "&b&nClick &7here to go to the plugin page" -HelpCommand: - - " &6&l* &9/Cjm &ehelp &7shows this same message" - - " &6&l* &9/Cjm &ereload &7reload all plugin files" - - " &6&l* &9/Cjm &einfo &7shows plugin information like support links..." - - " &6&l* &9/Cjm &edisplay &7it is used to see the messages and functions of the plugin without having to leave the server" From 7b95c6a45fff0ea0e515631b5b02f98f664e48e9 Mon Sep 17 00:00:00 2001 From: SrJss <31166687+jonagamerpro1234@users.noreply.github.com> Date: Tue, 8 Nov 2022 23:29:15 -0300 Subject: [PATCH 02/27] Bug fix hooks and remove vault hook --- .../CustomJoinAndQuitMessagesOld.iml | 2 +- CustomJoinAndQuitMessagesOld/pom.xml | 7 ++++- .../CustomJoinAndQuitMessages.java | 4 ++- .../config/PreConfigLoader.java | 30 +++++++++---------- .../hook/HookManager.java | 12 ++------ .../hook/LuckPermsHook.java | 30 ++----------------- .../listener/JoinListener.java | 3 +- .../customjoinandquitmessages/utils/Util.java | 1 - 8 files changed, 33 insertions(+), 56 deletions(-) diff --git a/CustomJoinAndQuitMessagesOld/CustomJoinAndQuitMessagesOld.iml b/CustomJoinAndQuitMessagesOld/CustomJoinAndQuitMessagesOld.iml index 3788c2e..f9cdb8a 100644 --- a/CustomJoinAndQuitMessagesOld/CustomJoinAndQuitMessagesOld.iml +++ b/CustomJoinAndQuitMessagesOld/CustomJoinAndQuitMessagesOld.iml @@ -51,7 +51,6 @@ - @@ -89,5 +88,6 @@ + \ No newline at end of file diff --git a/CustomJoinAndQuitMessagesOld/pom.xml b/CustomJoinAndQuitMessagesOld/pom.xml index c166c5e..5910e10 100644 --- a/CustomJoinAndQuitMessagesOld/pom.xml +++ b/CustomJoinAndQuitMessagesOld/pom.xml @@ -9,7 +9,7 @@ CustomJoinAndQuitMessagesOld - 1.7.6-b1 + 1.7.6-beta.1 11 @@ -221,6 +221,11 @@ + + org.apache.commons + commons-lang3 + 3.12.0 + \ No newline at end of file diff --git a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/CustomJoinAndQuitMessages.java b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/CustomJoinAndQuitMessages.java index 088d6ab..3868d35 100644 --- a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/CustomJoinAndQuitMessages.java +++ b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/CustomJoinAndQuitMessages.java @@ -27,7 +27,7 @@ public class CustomJoinAndQuitMessages extends JavaPlugin { public String version = this.jss.getVersion(); private Map availableLangs = new HashMap<>(); private final ConfigFile configFile = new ConfigFile(this, "config.yml"); - private final HookManager hooksManager = new HookManager(this); + private final HookManager hooksManager = new HookManager(); private final PreConfigLoader preConfigLoader = new PreConfigLoader(this); private String updateVersion; private boolean useLegacyConfig = false; @@ -69,7 +69,9 @@ public void onEnable() { groupsFile.saveDefaultConfig(); groupsFile.create(); + hooksManager.load(); + setupEvents(); setupCommands(); diff --git a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/config/PreConfigLoader.java b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/config/PreConfigLoader.java index 3fdf18b..ed2e936 100644 --- a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/config/PreConfigLoader.java +++ b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/config/PreConfigLoader.java @@ -23,19 +23,19 @@ public void loadConfig() { try { //Other - Settings.update = config.getString("Config.Update").equals("true"); + Settings.update = Objects.equals(config.getString("Config.Update"), "true"); Settings.c_type = config.getString("Config.Type"); - Settings.is_Group_Display = config.getString("Config.Type").equalsIgnoreCase("group"); + Settings.is_Group_Display = Objects.requireNonNull(config.getString("Config.Type")).equalsIgnoreCase("group"); //Join - Settings.join = config.getString("Join.Enabled").equals("true"); + Settings.join = Objects.equals(config.getString("Join.Enabled"), "true"); Settings.join_message = config.getString("Join.Text"); Settings.join_type = config.getString("Join.Type"); - Settings.firstjoin = config.getString("Join.First-Join.Enabled").equals("true"); + Settings.firstjoin = Objects.equals(config.getString("Join.First-Join.Enabled"), "true"); Settings.join_message_first = config.getString("Join.First-Join.Text"); - Settings.join_actionbar = config.getString("Join.ActionBar.Enabled").equals("true"); + Settings.join_actionbar = Objects.equals(config.getString("Join.ActionBar.Enabled"), "true"); Settings.join_message_actionbar_text = config.getString("Join.ActionBar.Text"); Settings.join_message_title_title = config.getString("Join.Title.Title"); @@ -45,34 +45,34 @@ public void loadConfig() { Settings.join_title_stay = config.getInt("Join.Title.Stay"); Settings.join_title_fadeout = config.getInt("Join.Title.FadeOut"); - Settings.join_sound = config.getString("Join.Sound.Enabled").equals("true"); + Settings.join_sound = Objects.equals(config.getString("Join.Sound.Enabled"), "true"); Settings.join_sound_name = config.getString("Join.Sound.Name"); Settings.join_sound_pitch = Float.parseFloat(Objects.requireNonNull(config.getString("Join.Sound.Pitch"))); Settings.join_sound_vol = config.getInt("Join.Sound.Volume"); //Quit - Settings.quit = config.getString("Quit.Enabled").equals("true"); + Settings.quit = Objects.equals(config.getString("Quit.Enabled"), "true"); Settings.quit_type = config.getString("Quit.Type"); Settings.quit_message = config.getString("Quit.Text"); //Welcome - Settings.welcome = config.getString("Welcome.Enabled").equals("true"); + Settings.welcome = Objects.equals(config.getString("Welcome.Enabled"), "true"); Settings.list_welcome = config.getStringList("Welcome.Text"); //Hooks - Settings.hook_discordsrv = config.getString("Hooks.DiscordSRV.Enabled").equals("true"); + Settings.hook_discordsrv = Objects.equals(config.getString("Hooks.DiscordSRV.Enabled"), "true"); Settings.hook_discordsrv_channelid = config.getString("Hooks.DiscordSRV.Channel-ID"); - Settings.hook_essentialsDiscord = config.getString("Hooks.EssentialsDiscord.Enabled").equals("true"); + Settings.hook_essentialsDiscord = Objects.equals(config.getString("Hooks.EssentialsDiscord.Enabled"), "true"); Settings.hook_essentialsDiscord_channelid = config.getString("Hooks.EssentialsDiscord.Channel-ID"); - Settings.hook_essentialsDiscord_use_default_channel = config.getString("Hooks.EssentialsDiscord.Use-Default-Channel").equals("true"); + Settings.hook_essentialsDiscord_use_default_channel = config.getBoolean("Hooks.EssentialsDiscord.Use-Default-Channel"); - Settings.hook_luckperms = config.getBoolean("Hooks. LuckPerms.Enabled"); - Settings.hook_luckperms_autoUpdate_group = config.getString("Hooks.LuckPerms.AutoUpdateGroup.Enabled").equals("true"); + Settings.hook_luckperms = config.getBoolean("Hooks.LuckPerms.Enabled"); + Settings.hook_luckperms_autoUpdate_group = config.getBoolean("Hooks.LuckPerms.AutoUpdateGroup.Enabled"); Settings.hook_luckperms_autoUpdate_group_tick = config.getLong("Hooks.LuckPerms.AutoUpdateGroup.Tick"); - Settings.hook_essentials = config.getString("Hooks.Essentials.Enabled").equals("true"); - Settings.hook_essentials_hideplayervanish = config.getString("Hooks.Essentials.HidePlayerIsVanish").equals("true"); + Settings.hook_essentials = Objects.equals(config.getString("Hooks.Essentials.Enabled"), "true"); + Settings.hook_essentials_hideplayervanish = config.getBoolean("Hooks.Essentials.HidePlayerIsVanish"); } catch (Exception e) { Logger.error("&cThere was an error loading the &b[PreConfigLoader]&7, please reload the plugin"); diff --git a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/hook/HookManager.java b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/hook/HookManager.java index de1df20..050c520 100644 --- a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/hook/HookManager.java +++ b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/hook/HookManager.java @@ -7,14 +7,12 @@ public class HookManager { private static HookManager instance; - private final CustomJoinAndQuitMessages plugin; private final DiscordSRVHHook discordSRVHHook = new DiscordSRVHHook(this); private final EssentialsXDiscordHook essentialsXDiscordHook = new EssentialsXDiscordHook(this); private final EssentialsXHook essentialsXHook = new EssentialsXHook(this); - private final LuckPermsHook luckPermsHook = new LuckPermsHook(this); + private final LuckPermsHook luckPermsHook = new LuckPermsHook(); - public HookManager(CustomJoinAndQuitMessages plugin) { - this.plugin = plugin; + public HookManager() { instance = this; } @@ -31,7 +29,7 @@ public void load() { new DiscordSRVHHook(this), new EssentialsXDiscordHook(this), new EssentialsXHook(this), - new LuckPermsHook(this)); + luckPermsHook); } private void initHooks(IHook @NotNull ... hooks) { @@ -40,10 +38,6 @@ private void initHooks(IHook @NotNull ... hooks) { } } - public CustomJoinAndQuitMessages getPlugin() { - return plugin; - } - public DiscordSRVHHook getDiscordSRVHHook() { return discordSRVHHook; } diff --git a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/hook/LuckPermsHook.java b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/hook/LuckPermsHook.java index dc2f90d..2151419 100644 --- a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/hook/LuckPermsHook.java +++ b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/hook/LuckPermsHook.java @@ -8,18 +8,13 @@ import net.luckperms.api.LuckPerms; import net.luckperms.api.LuckPermsProvider; import org.bukkit.Bukkit; -import org.bukkit.entity.Player; import org.jetbrains.annotations.Contract; import org.jetbrains.annotations.NotNull; public class LuckPermsHook implements IHook { - private final HookManager hookManager; private boolean isEnabled; - public LuckPermsHook(HookManager hookManager) { - this.hookManager = hookManager; - } @Contract(pure = true) public static @NotNull LuckPerms getApi() { @@ -30,16 +25,19 @@ public void setup() { if (!Bukkit.getPluginManager().isPluginEnabled("LuckPerms")) { Logger.warning("&eLuckPerms not enabled! - Disable Features..."); this.isEnabled = false; + System.out.println("Cjm Softdepend: Luckperms false - check plugin installed in plugin folder"); return; } if (!Settings.hook_luckperms) { this.isEnabled = false; + System.out.println("Cjm Softdepend: Luckperms false - Hook Enabled in config"); Logger.warning("&eLuckPerms not enabled! - Disable Features..."); return; } this.isEnabled = true; + System.out.println("Cjm Softdepend: Luckperms true - The plugin has successfully loaded the dependency"); Util.sendColorMessage(EventUtils.getStaticConsoleSender(), Util.getPrefix() + "&aLoading LuckPerms features..."); } @@ -47,26 +45,4 @@ public boolean isEnabled() { return isEnabled; } - public boolean isGroup(Player player, String name) { - LuckPerms api = LuckPermsProvider.get(); - String group = api.getUserManager().getUser(player.getName()).getPrimaryGroup(); - boolean a = false; - if (name.equals(group)) { - a = true; - } - return a; - } - - public String getGroup(Player player) { - if (player != null) { - Logger.debug("Player: N/A"); - } - LuckPerms api = LuckPermsProvider.get(); - String group = api.getUserManager().getUser(player.getName()).getPrimaryGroup(); - return group; - } - - public HookManager getHookManager() { - return hookManager; - } } diff --git a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/listener/JoinListener.java b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/listener/JoinListener.java index af8ea36..a47e801 100644 --- a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/listener/JoinListener.java +++ b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/listener/JoinListener.java @@ -54,6 +54,8 @@ public void onJoinListener(@NotNull PlayerJoinEvent e) { PlayerManager playerManager = new PlayerManager(); playerManager.createPlayer(p, tempGroup); + Util.sendColorMessage(p, Util.getPrefix() + " &eLuckPermHook is: " + luckPermsHook.isEnabled()); + if (Settings.c_type.equalsIgnoreCase("group")){ if (luckPermsHook.isEnabled()) { if (!playerManager.getGroup(p).equalsIgnoreCase(Objects.requireNonNull(LuckPermsHook.getApi(). @@ -75,7 +77,6 @@ public void onJoinListener(@NotNull PlayerJoinEvent e) { Util.sendColorMessage(p, Util.getVar(p, text)); } - if (essentialsXHook.isEnabled()) { if (Settings.hook_essentials_hideplayervanish) { if (essentialsXHook.isVanish(p)) { diff --git a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/utils/Util.java b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/utils/Util.java index 74aebd6..0a06fb6 100644 --- a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/utils/Util.java +++ b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/utils/Util.java @@ -19,7 +19,6 @@ @SuppressWarnings("deprecation") public class Util { - private final static String prefix = getPrefix(); public static @NotNull String setLine(String color) { From 306b1e0f6c890915405a1ea18575d883f1948c05 Mon Sep 17 00:00:00 2001 From: SrJss <31166687+jonagamerpro1234@users.noreply.github.com> Date: Thu, 24 Nov 2022 19:04:56 -0300 Subject: [PATCH 03/27] Fix debug message for LuckPermsHook --- .../config/PreConfigLoader.java | 1 + .../jss/customjoinandquitmessages/gui/DisplayGui.java | 9 ++++----- .../customjoinandquitmessages/listener/JoinListener.java | 4 +++- .../jss/customjoinandquitmessages/utils/Settings.java | 1 + .../src/main/resources/config.yml | 2 +- 5 files changed, 10 insertions(+), 7 deletions(-) diff --git a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/config/PreConfigLoader.java b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/config/PreConfigLoader.java index ed2e936..39e33e3 100644 --- a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/config/PreConfigLoader.java +++ b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/config/PreConfigLoader.java @@ -23,6 +23,7 @@ public void loadConfig() { try { //Other + Settings.settings_debug = config.getBoolean("Config.Debug"); Settings.update = Objects.equals(config.getString("Config.Update"), "true"); Settings.c_type = config.getString("Config.Type"); Settings.is_Group_Display = Objects.requireNonNull(config.getString("Config.Type")).equalsIgnoreCase("group"); diff --git a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/gui/DisplayGui.java b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/gui/DisplayGui.java index 7f0ea43..26b31ab 100644 --- a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/gui/DisplayGui.java +++ b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/gui/DisplayGui.java @@ -14,8 +14,8 @@ public class DisplayGui { private Inventory inv; private ItemStack item; private ItemMeta meta; - private Player player; - private CustomJoinAndQuitMessages plugin; + private final Player player; + private final CustomJoinAndQuitMessages plugin; public DisplayGui(Player player, CustomJoinAndQuitMessages plugin) { this.player = player; @@ -28,9 +28,6 @@ public void create() { for (int i = 0; i < 54; i++) { inv.setItem(i, setDecoration()); - if (i == 54) { - break; - } } setItems(); } @@ -38,7 +35,9 @@ public void create() { public ItemStack setDecoration() { item = XMaterial.BLACK_STAINED_GLASS_PANE.parseItem(); + assert item != null; meta = item.getItemMeta(); + assert meta != null; meta.setDisplayName(null); item.setItemMeta(meta); return item; diff --git a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/listener/JoinListener.java b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/listener/JoinListener.java index a47e801..4ee77aa 100644 --- a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/listener/JoinListener.java +++ b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/listener/JoinListener.java @@ -54,7 +54,9 @@ public void onJoinListener(@NotNull PlayerJoinEvent e) { PlayerManager playerManager = new PlayerManager(); playerManager.createPlayer(p, tempGroup); - Util.sendColorMessage(p, Util.getPrefix() + " &eLuckPermHook is: " + luckPermsHook.isEnabled()); + if(Settings.settings_debug){ + Logger.debug(" &eLuckPermHook is: " + luckPermsHook.isEnabled()); + } if (Settings.c_type.equalsIgnoreCase("group")){ if (luckPermsHook.isEnabled()) { diff --git a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/utils/Settings.java b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/utils/Settings.java index 3fa2c7b..52ca45b 100644 --- a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/utils/Settings.java +++ b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/utils/Settings.java @@ -10,6 +10,7 @@ public class Settings { public static boolean is_Group_Display; public static boolean update; public static String c_type; + public static boolean settings_debug; //Join section public static String join_type; diff --git a/CustomJoinAndQuitMessagesOld/src/main/resources/config.yml b/CustomJoinAndQuitMessagesOld/src/main/resources/config.yml index 9a737e8..d4b6207 100644 --- a/CustomJoinAndQuitMessagesOld/src/main/resources/config.yml +++ b/CustomJoinAndQuitMessagesOld/src/main/resources/config.yml @@ -20,7 +20,7 @@ Config: Update: true # |Debug| shows you important information about the plugin loading - Debug: false + Debug: true # |Type| the type is a way of knowing what is being used whether in the [normal] | [group] | [none] format Type: normal From 3c0702d04e80a9b0efcf69439bd9c15877a33e19 Mon Sep 17 00:00:00 2001 From: SrJss <31166687+jonagamerpro1234@users.noreply.github.com> Date: Sun, 18 Dec 2022 22:38:01 -0300 Subject: [PATCH 04/27] Fixed bug with null prefix in messages and also added support for version 1.19.3 --- .../CustomJoinAndQuitMessagesOld.iml | 8 +- CustomJoinAndQuitMessagesOld/pom.xml | 4 +- .../CustomJoinAndQuitMessages.java | 3 +- .../commands/CustomJoinAndQuitCmd.java | 42 ++++--- .../config/ConfigFile.java | 1 + .../config/GroupsFile.java | 3 +- .../config/Lang.java | 2 + .../config/PlayerFile.java | 1 + .../FileLister.java} | 4 +- .../config/{ => utils}/FileManager.java | 2 +- .../config/{ => utils}/PreConfigLoader.java | 7 +- .../gui/DisplayGui.java | 1 - .../hook/DiscordSRVHHook.java | 3 +- .../hook/EssentialsXDiscordHook.java | 3 +- .../hook/EssentialsXHook.java | 3 +- .../hook/LuckPermsHook.java | 2 +- .../hook/PlaceholderApiHook.java | 3 +- .../listener/JoinListener.java | 3 +- .../listener/TaskLoader.java | 2 +- .../manager/GroupManager.java | 2 +- .../{hook => manager}/HookManager.java | 4 +- .../manager/InventoryView.java | 4 +- .../utils/Logger.java | 18 ++- .../utils/Settings.java | 1 + .../customjoinandquitmessages/utils/Util.java | 110 +++++++----------- .../utils/interfaces/IHook.java | 1 + .../src/main/resources/config.yml | 2 +- .../src/main/resources/groups.yml | 4 +- .../src/main/resources/lang/de-DE.yml | 2 +- .../src/main/resources/lang/en-US.yml | 2 +- .../src/main/resources/lang/es-ES.yml | 2 +- .../src/main/resources/lang/fr-FR.yml | 2 +- .../src/main/resources/lang/messages.yml | 1 + .../src/main/resources/lang/ru-RU.yml | 2 +- .../src/main/resources/lang/zh-CN.yml | 2 +- .../src/main/resources/lang/zh-TW.yml | 2 +- .../src/main/resources/plugin.yml | 2 +- 37 files changed, 130 insertions(+), 130 deletions(-) rename CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/config/{FileListener.java => utils/FileLister.java} (97%) rename CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/config/{ => utils}/FileManager.java (96%) rename CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/config/{ => utils}/PreConfigLoader.java (94%) rename CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/{hook => manager}/HookManager.java (93%) diff --git a/CustomJoinAndQuitMessagesOld/CustomJoinAndQuitMessagesOld.iml b/CustomJoinAndQuitMessagesOld/CustomJoinAndQuitMessagesOld.iml index f9cdb8a..5b440d6 100644 --- a/CustomJoinAndQuitMessagesOld/CustomJoinAndQuitMessagesOld.iml +++ b/CustomJoinAndQuitMessagesOld/CustomJoinAndQuitMessagesOld.iml @@ -21,14 +21,14 @@ - - + + - + - + diff --git a/CustomJoinAndQuitMessagesOld/pom.xml b/CustomJoinAndQuitMessagesOld/pom.xml index 5910e10..096bbb7 100644 --- a/CustomJoinAndQuitMessagesOld/pom.xml +++ b/CustomJoinAndQuitMessagesOld/pom.xml @@ -9,7 +9,7 @@ CustomJoinAndQuitMessagesOld - 1.7.6-beta.1 + 1.7.6-beta.3 11 @@ -143,7 +143,7 @@ org.spigotmc spigot-api - 1.19.2-R0.1-SNAPSHOT + 1.19.3-R0.1-SNAPSHOT provided diff --git a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/CustomJoinAndQuitMessages.java b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/CustomJoinAndQuitMessages.java index 3868d35..3aee1cf 100644 --- a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/CustomJoinAndQuitMessages.java +++ b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/CustomJoinAndQuitMessages.java @@ -2,7 +2,8 @@ import jss.customjoinandquitmessages.commands.CustomJoinAndQuitCmd; import jss.customjoinandquitmessages.config.*; -import jss.customjoinandquitmessages.hook.HookManager; +import jss.customjoinandquitmessages.config.utils.PreConfigLoader; +import jss.customjoinandquitmessages.manager.HookManager; import jss.customjoinandquitmessages.listener.JoinListener; import jss.customjoinandquitmessages.listener.TaskLoader; import jss.customjoinandquitmessages.manager.InventoryView; diff --git a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/commands/CustomJoinAndQuitCmd.java b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/commands/CustomJoinAndQuitCmd.java index 458575f..6538145 100644 --- a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/commands/CustomJoinAndQuitCmd.java +++ b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/commands/CustomJoinAndQuitCmd.java @@ -26,6 +26,7 @@ public CustomJoinAndQuitCmd(@NotNull CustomJoinAndQuitMessages plugin) { public boolean onCommand(@NotNull CommandSender sender, @NotNull Command cmd, @NotNull String label, String[] args) { if (!(sender instanceof Player)) { if (args.length >= 1) { + if (args[0].equalsIgnoreCase("help")) { List list = plugin.Locale().help_1; Util.sendColorMessage(sender, "&5-=-=-=-=-=-=-=-=-=-=-=&6[&d" + plugin.name + "&6]&5=-=-=-=-=-=-=-=-=-=-=-"); @@ -35,24 +36,27 @@ public boolean onCommand(@NotNull CommandSender sender, @NotNull Command cmd, @N Util.sendColorMessage(sender, "&5-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-"); } else if (args[0].equalsIgnoreCase("reload")) { plugin.reloadAllFiles(); - Util.sendColorMessage(sender, Util.getPrefix() + " " + plugin.Locale().reload); + Util.sendColorMessage(sender, Util.getPrefix(false) + plugin.Locale().reload); } else if (args[0].equalsIgnoreCase("info")) { - Util.sendColorMessage(sender, "&5 <||=-=-=-=-=" + Util.getPrefix() + "&5=-=-=-=-=-=-"); - Util.sendColorMessage(sender, "&5 <|| &c* &bName: &3" + plugin.name); - Util.sendColorMessage(sender, "&5 <|| &c* &bAuthor: &3jonagamerpro1234"); - Util.sendColorMessage(sender, "&5 <|| &c* &bVersion: &a" + plugin.version); - Util.sendColorMessage(sender, "&5 <|| &c* &bUpdate: &e" + plugin.useLatestversion); - Util.sendColorMessage(sender, "&5 <||=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-"); + Util.sendColorMessage(sender, "&5-=-=-=-=-=[&b" + plugin.name + "&5]=-=-=-=-=-=-"); + Util.sendColorMessage(sender, "&6 ● &bAuthor: &3jonagamerpro1234"); + Util.sendColorMessage(sender, "&6 ● &eYour Version: &7" + plugin.version); + Util.sendColorMessage(sender, "&6 ● &aLast version: &7" + plugin.getUpdateVersion()); + Util.sendColorMessage(sender, "&6 ● &9Discord: &7https://discord.gg/c5GhQDQCK5"); + Util.sendColorMessage(sender, "&5-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-"); } else { - Util.sendColorMessage(sender, Util.getPrefix() + " " + plugin.Locale().Error_Cmd); + Util.sendColorMessage(sender, Util.getPrefix(true) + plugin.Locale().Error_Cmd); } return true; } - Util.sendColorMessage(sender, Util.getPrefix() + " " + plugin.Locale().Help_cmd); + + Util.sendColorMessage(sender, Util.getPrefix(true) + plugin.Locale().Help_cmd); return false; } Player j = (Player) sender; + if (args.length >= 1) { + if (args[0].equalsIgnoreCase("help")) { if ((j.isOp()) || (j.hasPermission("Cjm.Help"))) { Util.sendColorMessage(j, "&5-=-=-=-=-=-=-=-=-=-=-=&6[&d" + plugin.name + "&6]&5=-=-=-=-=-=-=-=-=-=-=-"); @@ -65,28 +69,32 @@ public boolean onCommand(@NotNull CommandSender sender, @NotNull Command cmd, @N } return true; } + if (args[0].equalsIgnoreCase("reload") || args[0].equalsIgnoreCase("rl")) { if ((j.isOp()) || (j.hasPermission("Cjm.Reload"))) { plugin.reloadAllFiles(); - Util.sendColorMessage(j, Util.getPrefixPlayer() + " " + plugin.Locale().reload); + Util.sendColorMessage(j, Util.getPrefix(false) + plugin.Locale().reload); } else { Util.sendTextComponent116Hover(j, "TEXT", plugin.Locale().No_Permission, plugin.Locale().No_Permission_Label); } return true; } + if (args[0].equalsIgnoreCase("info")) { Util.sendColorMessage(j, "&5-=-=-=-=-=[&b" + plugin.name + "&5]=-=-=-=-=-=-"); - Util.sendColorMessage(j, "&5> &3Author: &6jonagamerpro1234"); - Util.sendColorMessage(j, "&5> &3Version: &6" + plugin.version); - Util.sendColorMessage(j, "&5> &3Last version: &a" + plugin.getUpdateVersion()); - Util.sendColorMessage(j, "&5> &3Discord: &9 https://discord.gg/c5GhQDQCK5"); - Util.sendColorMessage(j, "&5-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-"); + Util.sendColorMessage(j, "&6 ● &bAuthor: &3jonagamerpro1234"); + Util.sendColorMessage(j, "&6 ● &eYour Version: &7" + plugin.version); + Util.sendColorMessage(j, "&6 ● &aLast version: &7" + plugin.getUpdateVersion()); + Util.sendColorMessage(j, "&6 ● &9Discord: &7https://discord.gg/c5GhQDQCK5"); + Util.sendColorMessage(j, "&5-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-"); return true; } - Util.sendColorMessage(j, Util.getPrefixPlayer() + " " + plugin.Locale().Error_Cmd); + + Util.sendColorMessage(j, Util.getPrefix(true) + plugin.Locale().Error_Cmd); return true; } - Util.sendColorMessage(j, Util.getPrefixPlayer() + " " + plugin.Locale().Help_cmd); + + Util.sendColorMessage(j, Util.getPrefix(true) + plugin.Locale().Help_cmd); return true; } diff --git a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/config/ConfigFile.java b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/config/ConfigFile.java index 0288f97..088ed96 100644 --- a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/config/ConfigFile.java +++ b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/config/ConfigFile.java @@ -1,6 +1,7 @@ package jss.customjoinandquitmessages.config; import jss.customjoinandquitmessages.CustomJoinAndQuitMessages; +import jss.customjoinandquitmessages.config.utils.FileManager; import org.bukkit.configuration.file.FileConfiguration; import org.bukkit.configuration.file.YamlConfiguration; diff --git a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/config/GroupsFile.java b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/config/GroupsFile.java index dc9ff9d..b17e7ee 100644 --- a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/config/GroupsFile.java +++ b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/config/GroupsFile.java @@ -1,6 +1,7 @@ package jss.customjoinandquitmessages.config; import jss.customjoinandquitmessages.CustomJoinAndQuitMessages; +import jss.customjoinandquitmessages.config.utils.FileManager; import org.bukkit.configuration.file.FileConfiguration; import org.bukkit.configuration.file.YamlConfiguration; @@ -66,4 +67,4 @@ public void saveDefaultConfig() { saveResources(this.path, false); } } -} +} \ No newline at end of file diff --git a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/config/Lang.java b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/config/Lang.java index 22a54da..7a911b3 100644 --- a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/config/Lang.java +++ b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/config/Lang.java @@ -2,6 +2,7 @@ import jss.customjoinandquitmessages.CustomJoinAndQuitMessages; import jss.customjoinandquitmessages.utils.Logger; +import jss.customjoinandquitmessages.utils.Settings; import org.bukkit.configuration.file.FileConfiguration; import org.bukkit.configuration.file.YamlConfiguration; @@ -69,6 +70,7 @@ public void reloadlang(final String localeName) { private void loadLocale() { String main = "CustomJoinAndQuitMessage"; + Settings.messages_prefix = locale.getString(main + ".Prefix"); Error_Cmd = locale.getString(main + ".Error-Cmd"); Error_Console = locale.getString(main + ".Error-Console"); Error_Sound = locale.getString(main + ".Sound-Error"); diff --git a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/config/PlayerFile.java b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/config/PlayerFile.java index e8a43de..2d82ddd 100644 --- a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/config/PlayerFile.java +++ b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/config/PlayerFile.java @@ -1,6 +1,7 @@ package jss.customjoinandquitmessages.config; import jss.customjoinandquitmessages.CustomJoinAndQuitMessages; +import jss.customjoinandquitmessages.config.utils.FileManager; import org.bukkit.configuration.file.FileConfiguration; import org.bukkit.configuration.file.YamlConfiguration; diff --git a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/config/FileListener.java b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/config/utils/FileLister.java similarity index 97% rename from CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/config/FileListener.java rename to CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/config/utils/FileLister.java index dab7221..835f9cc 100644 --- a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/config/FileListener.java +++ b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/config/utils/FileLister.java @@ -1,4 +1,4 @@ -package jss.customjoinandquitmessages.config; +package jss.customjoinandquitmessages.config.utils; import jss.customjoinandquitmessages.CustomJoinAndQuitMessages; import jss.customjoinandquitmessages.utils.Logger; @@ -15,7 +15,7 @@ import java.util.jar.JarFile; -public class FileListener { +public class FileLister { private final CustomJoinAndQuitMessages plugin = CustomJoinAndQuitMessages.get(); diff --git a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/config/FileManager.java b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/config/utils/FileManager.java similarity index 96% rename from CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/config/FileManager.java rename to CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/config/utils/FileManager.java index 77d39be..8434bd4 100644 --- a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/config/FileManager.java +++ b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/config/utils/FileManager.java @@ -1,4 +1,4 @@ -package jss.customjoinandquitmessages.config; +package jss.customjoinandquitmessages.config.utils; import jss.customjoinandquitmessages.CustomJoinAndQuitMessages; import org.bukkit.plugin.java.JavaPlugin; diff --git a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/config/PreConfigLoader.java b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/config/utils/PreConfigLoader.java similarity index 94% rename from CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/config/PreConfigLoader.java rename to CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/config/utils/PreConfigLoader.java index 39e33e3..d91289e 100644 --- a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/config/PreConfigLoader.java +++ b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/config/utils/PreConfigLoader.java @@ -1,6 +1,7 @@ -package jss.customjoinandquitmessages.config; +package jss.customjoinandquitmessages.config.utils; import jss.customjoinandquitmessages.CustomJoinAndQuitMessages; +import jss.customjoinandquitmessages.config.Lang; import jss.customjoinandquitmessages.utils.Logger; import jss.customjoinandquitmessages.utils.Settings; import jss.customjoinandquitmessages.utils.Util; @@ -84,7 +85,7 @@ public void loadConfig() { public boolean loadLangs() { Settings.defaultLanguage = plugin.getConfig().getString("Config.Lang", "en-US"); HashMap availableLocales = new HashMap<>(); - FileListener fl = new FileListener(); + FileLister fl = new FileLister(); try { int index = 1; for (String code : fl.list()) { @@ -94,7 +95,7 @@ public boolean loadLangs() { plugin.getLogger().severe("Could not add locales!"); } if (!availableLocales.containsKey(Settings.defaultLanguage)) { - Logger.warning(Util.getPrefix() + "&eLoad File: " + Settings.defaultLanguage + ".yml' not found in /locale folder. Using /locale/en-US.yml"); + Logger.warning(Util.getPrefix(true) + "&eLoad File: " + Settings.defaultLanguage + ".yml' not found in /locale folder. Using /locale/en-US.yml"); Settings.defaultLanguage = "en-US"; availableLocales.put(Settings.defaultLanguage, new Lang(plugin, Settings.defaultLanguage, 0)); } diff --git a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/gui/DisplayGui.java b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/gui/DisplayGui.java index 26b31ab..a81e90c 100644 --- a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/gui/DisplayGui.java +++ b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/gui/DisplayGui.java @@ -32,7 +32,6 @@ public void create() { setItems(); } - public ItemStack setDecoration() { item = XMaterial.BLACK_STAINED_GLASS_PANE.parseItem(); assert item != null; diff --git a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/hook/DiscordSRVHHook.java b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/hook/DiscordSRVHHook.java index d61e69c..a27bfe9 100644 --- a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/hook/DiscordSRVHHook.java +++ b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/hook/DiscordSRVHHook.java @@ -1,5 +1,6 @@ package jss.customjoinandquitmessages.hook; +import jss.customjoinandquitmessages.manager.HookManager; import jss.customjoinandquitmessages.utils.EventUtils; import jss.customjoinandquitmessages.utils.Logger; import jss.customjoinandquitmessages.utils.Settings; @@ -30,7 +31,7 @@ public void setup() { } this.isEnabled = true; - Util.sendColorMessage(EventUtils.getStaticConsoleSender(), Util.getPrefix() + "&aLoading DiscordSRV features..."); + Util.sendColorMessage(EventUtils.getStaticConsoleSender(), Util.getPrefix(true) + "&aLoading DiscordSRV features..."); } public boolean isEnabled() { diff --git a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/hook/EssentialsXDiscordHook.java b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/hook/EssentialsXDiscordHook.java index d3b2011..58eb3de 100644 --- a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/hook/EssentialsXDiscordHook.java +++ b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/hook/EssentialsXDiscordHook.java @@ -1,5 +1,6 @@ package jss.customjoinandquitmessages.hook; +import jss.customjoinandquitmessages.manager.HookManager; import jss.customjoinandquitmessages.utils.EventUtils; import jss.customjoinandquitmessages.utils.Logger; import jss.customjoinandquitmessages.utils.Settings; @@ -34,7 +35,7 @@ public void setup() { this.service = Bukkit.getServicesManager().load(DiscordService.class); this.isEnabled = true; - Util.sendColorMessage(EventUtils.getStaticConsoleSender(), Util.getPrefix() + "&aLoading EssentialsDiscord features..."); + Util.sendColorMessage(EventUtils.getStaticConsoleSender(), Util.getPrefix(true) + "&aLoading EssentialsDiscord features..."); Logger.warning("&e!!These features are still under development and may have bugs!!"); } diff --git a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/hook/EssentialsXHook.java b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/hook/EssentialsXHook.java index a33c128..08d5c4f 100644 --- a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/hook/EssentialsXHook.java +++ b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/hook/EssentialsXHook.java @@ -1,6 +1,7 @@ package jss.customjoinandquitmessages.hook; import com.earth2me.essentials.Essentials; +import jss.customjoinandquitmessages.manager.HookManager; import jss.customjoinandquitmessages.utils.EventUtils; import jss.customjoinandquitmessages.utils.Logger; import jss.customjoinandquitmessages.utils.Settings; @@ -34,7 +35,7 @@ public void setup() { this.essentials = (Essentials) Bukkit.getPluginManager().getPlugin("Essentials"); this.isEnabled = true; - Util.sendColorMessage(EventUtils.getStaticConsoleSender(), Util.getPrefix() + "&aLoading Essentials features..."); + Util.sendColorMessage(EventUtils.getStaticConsoleSender(), Util.getPrefix(true) + "&aLoading Essentials features..."); Logger.warning("&e!!These features are still under development and may have bugs!!"); } diff --git a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/hook/LuckPermsHook.java b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/hook/LuckPermsHook.java index 2151419..1135fed 100644 --- a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/hook/LuckPermsHook.java +++ b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/hook/LuckPermsHook.java @@ -38,7 +38,7 @@ public void setup() { this.isEnabled = true; System.out.println("Cjm Softdepend: Luckperms true - The plugin has successfully loaded the dependency"); - Util.sendColorMessage(EventUtils.getStaticConsoleSender(), Util.getPrefix() + "&aLoading LuckPerms features..."); + Util.sendColorMessage(EventUtils.getStaticConsoleSender(), Util.getPrefix(true) + "&aLoading LuckPerms features..."); } public boolean isEnabled() { diff --git a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/hook/PlaceholderApiHook.java b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/hook/PlaceholderApiHook.java index 7406c43..0e06175 100644 --- a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/hook/PlaceholderApiHook.java +++ b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/hook/PlaceholderApiHook.java @@ -1,5 +1,6 @@ package jss.customjoinandquitmessages.hook; +import jss.customjoinandquitmessages.manager.HookManager; import jss.customjoinandquitmessages.utils.EventUtils; import jss.customjoinandquitmessages.utils.Logger; import jss.customjoinandquitmessages.utils.Util; @@ -23,7 +24,7 @@ public void setup() { } this.isEnabled = true; - Util.sendColorMessage(EventUtils.getStaticConsoleSender(), Util.getPrefix() + "&aLoading PlaceholderAPI features..."); + Util.sendColorMessage(EventUtils.getStaticConsoleSender(), Util.getPrefix(true) + "&aLoading PlaceholderAPI features..."); } public boolean isEnabled() { diff --git a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/listener/JoinListener.java b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/listener/JoinListener.java index 4ee77aa..885944f 100644 --- a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/listener/JoinListener.java +++ b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/listener/JoinListener.java @@ -6,6 +6,7 @@ import jss.customjoinandquitmessages.CustomJoinAndQuitMessages; import jss.customjoinandquitmessages.hook.*; import jss.customjoinandquitmessages.json.Json; +import jss.customjoinandquitmessages.manager.HookManager; import jss.customjoinandquitmessages.manager.PlayerManager; import jss.customjoinandquitmessages.utils.*; import net.md_5.bungee.api.chat.ClickEvent; @@ -242,7 +243,7 @@ public void onUpdate(@NotNull PlayerJoinEvent e) { if ((p.isOp()) || (p.hasPermission("Cjm.Update.Notify"))) { new UpdateChecker(CustomJoinAndQuitMessages.get(), UpdateSettings.ID).getUpdateVersion(version -> { if (!CustomJoinAndQuitMessages.get().getDescription().getVersion().equalsIgnoreCase(version)) { - TextComponent component = new TextComponent(Util.color(Util.getPrefixPlayer() + TextComponent component = new TextComponent(Util.color(Util.getPrefix(true) + " &aThere is a new version available for download, Click on this message to copy the link")); component.setClickEvent(new ClickEvent(Action.OPEN_URL, UpdateSettings.URL_PlUGIN[0])); p.spigot().sendMessage(component); diff --git a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/listener/TaskLoader.java b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/listener/TaskLoader.java index 36fc7fa..baa7198 100644 --- a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/listener/TaskLoader.java +++ b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/listener/TaskLoader.java @@ -1,7 +1,7 @@ package jss.customjoinandquitmessages.listener; import jss.customjoinandquitmessages.CustomJoinAndQuitMessages; -import jss.customjoinandquitmessages.hook.HookManager; +import jss.customjoinandquitmessages.manager.HookManager; import jss.customjoinandquitmessages.hook.LuckPermsHook; import jss.customjoinandquitmessages.manager.PlayerManager; import jss.customjoinandquitmessages.utils.Logger; diff --git a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/manager/GroupManager.java b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/manager/GroupManager.java index ed292e1..d5cb639 100644 --- a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/manager/GroupManager.java +++ b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/manager/GroupManager.java @@ -25,7 +25,7 @@ public Set getGroupList() { } public boolean existsGroup(String group) { - if(group == null){ + if(group != null){ Logger.error("&cGroup could not be found: &e" + group); return false; } diff --git a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/hook/HookManager.java b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/manager/HookManager.java similarity index 93% rename from CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/hook/HookManager.java rename to CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/manager/HookManager.java index 050c520..38d2301 100644 --- a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/hook/HookManager.java +++ b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/manager/HookManager.java @@ -1,6 +1,6 @@ -package jss.customjoinandquitmessages.hook; +package jss.customjoinandquitmessages.manager; -import jss.customjoinandquitmessages.CustomJoinAndQuitMessages; +import jss.customjoinandquitmessages.hook.*; import jss.customjoinandquitmessages.utils.interfaces.IHook; import org.jetbrains.annotations.NotNull; diff --git a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/manager/InventoryView.java b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/manager/InventoryView.java index 7b0e679..d4eee83 100644 --- a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/manager/InventoryView.java +++ b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/manager/InventoryView.java @@ -4,8 +4,8 @@ public class InventoryView { - private Player player; - private String inventoryName; + private final Player player; + private final String inventoryName; public InventoryView(Player player, String inventoryName) { this.player = player; diff --git a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/utils/Logger.java b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/utils/Logger.java index eff6ae4..1848dc5 100644 --- a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/utils/Logger.java +++ b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/utils/Logger.java @@ -3,31 +3,29 @@ public class Logger { public static void error(String msg) { - Util.sendColorConsoleMessage(EventUtils.getStaticConsoleSender(), Util.getPrefix() + "&8-> &e[&cERROR&e] &7" + msg); + Util.sendColorConsoleMessage(EventUtils.getStaticConsoleSender(), Util.getPrefix(true) + "&8-> &e[&cERROR&e] &7" + msg); } public static void warning(String msg) { - Util.sendColorConsoleMessage(EventUtils.getStaticConsoleSender(), Util.getPrefix() + "&8-> &e[&dWARNING&e] &7" + msg); + Util.sendColorConsoleMessage(EventUtils.getStaticConsoleSender(), Util.getPrefix(true) + "&8-> &e[&dWARNING&e] &7" + msg); } public static void info(String msg) { - Util.sendColorConsoleMessage(EventUtils.getStaticConsoleSender(), Util.getPrefix() + "&8-> &e[&9INFO&e] &7" + msg); + Util.sendColorConsoleMessage(EventUtils.getStaticConsoleSender(), Util.getPrefix(true) + "&8-> &e[&9INFO&e] &7" + msg); } public static void outLine(String msg) { - Util.sendColorConsoleMessage(EventUtils.getStaticConsoleSender(), Util.getPrefix() + "&8-> &e[&bOUTLINE&e] &7" + msg); + Util.sendColorConsoleMessage(EventUtils.getStaticConsoleSender(), Util.getPrefix(true) + "&8-> &e[&bOUTLINE&e] &7" + msg); } public static void success(String msg) { - Util.sendColorConsoleMessage(EventUtils.getStaticConsoleSender(), Util.getPrefix() + "&8-> &e[&aSUCCESS&e] &7" + msg); + Util.sendColorConsoleMessage(EventUtils.getStaticConsoleSender(), Util.getPrefix(true) + "&8-> &e[&aSUCCESS&e] &7" + msg); } public static void debug(String msg) { - Util.sendColorConsoleMessage(EventUtils.getStaticConsoleSender(), Util.getPrefix() + "&8-> &e[&dDEBUG&e] &7" + msg); - } - - public static void defaultMessage(String msg) { - Util.sendColorConsoleMessage(EventUtils.getStaticConsoleSender(), Util.getPrefix() + msg); + if(Settings.settings_debug) { + Util.sendColorConsoleMessage(EventUtils.getStaticConsoleSender(), Util.getPrefix(true) + "&8-> &e[&dDEBUG&e] &7" + msg); + } } } diff --git a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/utils/Settings.java b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/utils/Settings.java index 52ca45b..0e475a6 100644 --- a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/utils/Settings.java +++ b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/utils/Settings.java @@ -4,6 +4,7 @@ public class Settings { + public static String messages_prefix; public static boolean hook_luckperms_autoUpdate_group; //Others public static String defaultLanguage; diff --git a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/utils/Util.java b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/utils/Util.java index 0a06fb6..8f2f390 100644 --- a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/utils/Util.java +++ b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/utils/Util.java @@ -11,15 +11,12 @@ import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -import java.lang.reflect.InvocationTargetException; import java.util.ArrayList; -import java.util.Collection; import java.util.List; -import java.util.Random; @SuppressWarnings("deprecation") public class Util { - private final static String prefix = getPrefix(); + private final static String prefix = getPrefix(true); public static @NotNull String setLine(String color) { return color(color + "-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-"); @@ -56,49 +53,25 @@ private static void sendEnable(String message) { } @Contract(pure = true) - public static @NotNull String getPrefix() { - return "&e[&dCustomJoinAndQuitMessages&e]&7 "; - } - - @Contract(pure = true) - public static @NotNull String getPrefixPlayer() { - return "&6[&dCustomJoinAndQuitMessages&6]&7 "; - } - - public static void sendLoadTitle(String version) { - sendEnable("&d ______ _____ ____ __ ___"); - sendEnable("&d / ____/ / / | / __ \\ / |/ /"); - sendEnable("&d / / __ / / /| |/ / / / / /|_/ / &bBy jonagamerpro1234"); - sendEnable("&d / /___/ /_/ / ___ / /_/ / / / / / &bVersion &a" + version); - sendEnable("&d \\____/\\____/_/ |_\\___\\_\\/_/ /_/ &aThanks for using CustomJoinAndQuitMessage &c<3"); - } - - public static void setEnabled(String version) { - sendEnable(prefix, "&5 <||============================================----"); - sendEnable(prefix, "&5 <|| &c* &bThe plugin is &d[&aSuccessfully activated&d]"); - sendEnable(prefix, "&5 <|| &c* &bVersion: &e[&a" + version + "&e]"); - sendEnable(prefix, "&5 <|| &c* &bBy: &e[&bjonagamerpro1234&e]"); - sendEnable(prefix, "&5 <|| &c* &bTested Versions &3|&a1.8.x &3- &a1.19.x&3| &eComing Soon -> &c1.20"); - sendEnable(prefix, "&5 <||============================================----"); + public static @NotNull String getPrefix(boolean ignore) { + String prefix; + if(ignore){ + prefix = "&e[&dCustomJoinAndQuitMessages&e] &7"; + }else{ + prefix = Settings.messages_prefix + " &7"; + } + return prefix; } - public static void setDisabled(String version) { - sendEnable(prefix, "&5 <||============================================----"); - sendEnable(prefix, "&5 <|| &c* &bThe plugin is &d[&cSuccessfully disabled&c]"); - sendEnable(prefix, "&5 <|| &c* &bVersion: &e[&a" + version + "&e]"); - sendEnable(prefix, "&5 <|| &c* &bBy: &e[&bjonagamerpro1234&e]"); - sendEnable(prefix, "&5 <|| &c* &bTested Versions &3|&a1.8.x &3- &a1.19.x&3| &eComing Soon -> &c1.20"); - sendEnable(prefix, "&5 <|| &a* &eThanks for using CustomJoinAndQuitMessage &c<3"); - sendEnable(prefix, "&5 <||============================================----"); - } - public static @NotNull List setTabLimit(final @NotNull List list, final String inic) { + public static @NotNull List setTabLimit(final @NotNull List options, final String lastArgs) { final List returned = new ArrayList<>(); - for (String s : list) { + + for (String s : options) { if (s == null) { continue; } - if (s.toLowerCase().startsWith(inic.toLowerCase())) { + if (s.toLowerCase().startsWith(lastArgs.toLowerCase())) { returned.add(s); } } @@ -106,15 +79,15 @@ public static void setDisabled(String version) { } @SuppressWarnings("unused") - public static void sendTextComponentHover(@NotNull Player j, String action, String message, String submessage, String color) { + public static void sendTextComponentHover(@NotNull Player j, String action, String message, String subMessage, String color) { TextComponent msg = new TextComponent(color(message)); - msg.setHoverEvent(new HoverEvent(HoverEvent.Action.valueOf(getActionHoverType(action)), new ComponentBuilder(submessage).color(ChatColor.of(color)).create())); + msg.setHoverEvent(new HoverEvent(HoverEvent.Action.valueOf(getActionHoverType(action)), new ComponentBuilder(subMessage).color(ChatColor.of(color)).create())); j.spigot().sendMessage(msg); } - public static void sendTextComponent116Hover(@NotNull Player j, String action, String message, String submessage) { + public static void sendTextComponent116Hover(@NotNull Player j, String action, String message, String subMessage) { TextComponent msg = new TextComponent(color(message)); - msg.setHoverEvent(new HoverEvent(HoverEvent.Action.valueOf(getActionHoverType(action)), new ComponentBuilder(color(submessage)).create())); + msg.setHoverEvent(new HoverEvent(HoverEvent.Action.valueOf(getActionHoverType(action)), new ComponentBuilder(color(subMessage)).create())); j.spigot().sendMessage(msg); } @@ -157,33 +130,40 @@ public static void sendAllPlayerBaseComponent(BaseComponent component) { public static @NotNull String getVar(@NotNull Player player, String text) { text = text.replace("", player.getName()); text = text.replace("", player.getDisplayName()); - text = text.replaceAll("", player.getWorld().getName()); text = text.replace("<0>", " "); - text = placeholderReplace(text, player); - text = getOnlinePlayers(text); + text = onPlaceholderAPI(player, text); return text; } - private static String placeholderReplace(String text, Player player) { - if (Bukkit.getPluginManager().isPluginEnabled("PlaceholderAPI")) { - return PlaceholderAPI.setPlaceholders(player, text); - } - return text; + public static String onPlaceholderAPI(Player player, String text){ + return Bukkit.getPluginManager().isPluginEnabled("PlaceholderAPI") ? PlaceholderAPI.setPlaceholders(player, text) : text; } - public static @NotNull String getOnlinePlayers(String text) { - int playersOnline = 0; - try { - if (Bukkit.class.getMethod("getOnlinePlayers").getReturnType() == Collection.class) { - playersOnline = ((Collection) Bukkit.class.getMethod("getOnlinePlayers", new Class[0]).invoke(null, new Object[0])).size(); - } else { - playersOnline = ((Player[]) Bukkit.class.getMethod("getOnlinePlayers", new Class[0]).invoke(null, new Object[0])).length; - } - } catch (NoSuchMethodException | InvocationTargetException | IllegalAccessException ignored) { - } - text = text.replace("", "" + playersOnline); - text = text.replace("", "" + playersOnline); - return text; + public static void sendLoadTitle(String version) { + sendEnable("&d ______ _____ ____ __ ___"); + sendEnable("&d / ____/ / / | / __ \\ / |/ /"); + sendEnable("&d / / __ / / /| |/ / / / / /|_/ / &bBy jonagamerpro1234"); + sendEnable("&d / /___/ /_/ / ___ / /_/ / / / / / &bVersion &a" + version); + sendEnable("&d \\____/\\____/_/ |_\\___\\_\\/_/ /_/ &aThanks for using CustomJoinAndQuitMessage &c<3"); + } + + public static void setEnabled(String version) { + sendEnable(prefix, "&5 <||============================================----"); + sendEnable(prefix, "&5 <|| &c* &bThe plugin is &d[&aSuccessfully activated&d]"); + sendEnable(prefix, "&5 <|| &c* &bVersion: &e[&a" + version + "&e]"); + sendEnable(prefix, "&5 <|| &c* &bBy: &e[&bjonagamerpro1234&e]"); + sendEnable(prefix, "&5 <|| &c* &bTested Versions &3|&a1.8.x &3- &a1.19.x&3| &eComing Soon -> &c1.20"); + sendEnable(prefix, "&5 <||============================================----"); + } + + public static void setDisabled(String version) { + sendEnable(prefix, "&5 <||============================================----"); + sendEnable(prefix, "&5 <|| &c* &bThe plugin is &d[&cSuccessfully disabled&c]"); + sendEnable(prefix, "&5 <|| &c* &bVersion: &e[&a" + version + "&e]"); + sendEnable(prefix, "&5 <|| &c* &bBy: &e[&bjonagamerpro1234&e]"); + sendEnable(prefix, "&5 <|| &c* &bTested Versions &3|&a1.8.x &3- &a1.19.x&3| &eComing Soon -> &c1.20"); + sendEnable(prefix, "&5 <|| &a* &eThanks for using CustomJoinAndQuitMessage &c<3"); + sendEnable(prefix, "&5 <||============================================----"); } } diff --git a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/utils/interfaces/IHook.java b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/utils/interfaces/IHook.java index 0b6a0da..407cb04 100644 --- a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/utils/interfaces/IHook.java +++ b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/utils/interfaces/IHook.java @@ -1,5 +1,6 @@ package jss.customjoinandquitmessages.utils.interfaces; +@FunctionalInterface public interface IHook { void setup(); } diff --git a/CustomJoinAndQuitMessagesOld/src/main/resources/config.yml b/CustomJoinAndQuitMessagesOld/src/main/resources/config.yml index d4b6207..7ddcc2d 100644 --- a/CustomJoinAndQuitMessagesOld/src/main/resources/config.yml +++ b/CustomJoinAndQuitMessagesOld/src/main/resources/config.yml @@ -1,7 +1,7 @@ # ______ _____ ____ __ ___ # / ____/ / / | / __ \ / |/ / # / / __ / / /| |/ / / / / /|_/ / By jonagamerpro1234 -# / /___/ /_/ / ___ / /_/ / / / / / Version 1.7.5 +# / /___/ /_/ / ___ / /_/ / / / / / Version ${project.version} # \____/\____/_/ |_\___\_\/_/ /_/ Thanks for using CustomJoinAndQuitMessage <3 # # ● A simple plugin for personalization of the join and quit messages and more... diff --git a/CustomJoinAndQuitMessagesOld/src/main/resources/groups.yml b/CustomJoinAndQuitMessagesOld/src/main/resources/groups.yml index 3a2eb8b..76fbff6 100644 --- a/CustomJoinAndQuitMessagesOld/src/main/resources/groups.yml +++ b/CustomJoinAndQuitMessagesOld/src/main/resources/groups.yml @@ -1,14 +1,14 @@ # ______ _____ ____ __ ___ # / ____/ / / | / __ \ / |/ / # / / __ / / /| |/ / / / / /|_/ / By jonagamerpro1234 -# / /___/ /_/ / ___ / /_/ / / / / / Version 1.7.6 +# / /___/ /_/ / ___ / /_/ / / / / / Version ${project.version} # \____/\____/_/ |_\___\_\/_/ /_/ Thanks for using CustomJoinAndQuitMessage <3 # # ● Here you can add new groups and configure them, but for this to work you need LuckPerms # ● The group name has to be the same as the range name or the group customization will not work # ● For more information you can visit the CustomJoinAndQuitMessages Wiki # -# ● Wiki [Working Progress]: +# ● Wiki [Working Progress]: --- # default: diff --git a/CustomJoinAndQuitMessagesOld/src/main/resources/lang/de-DE.yml b/CustomJoinAndQuitMessagesOld/src/main/resources/lang/de-DE.yml index 3e68241..ac7fced 100644 --- a/CustomJoinAndQuitMessagesOld/src/main/resources/lang/de-DE.yml +++ b/CustomJoinAndQuitMessagesOld/src/main/resources/lang/de-DE.yml @@ -1,5 +1,5 @@ ---- CustomJoinAndQuitMessage: + Prefix: '&e[&dCustomJoinAndQuitMessages&e]' Help-Msg: - '&b/CustomJoinAndQuitMessage &8| &9/Cjm &7Dies sind die Varianten des Haupt-Plugin-Befehls' - '&b/Cjm &ehelp &7zeige die gleiche Nachricht' diff --git a/CustomJoinAndQuitMessagesOld/src/main/resources/lang/en-US.yml b/CustomJoinAndQuitMessagesOld/src/main/resources/lang/en-US.yml index d7bc57f..e2ac6a4 100644 --- a/CustomJoinAndQuitMessagesOld/src/main/resources/lang/en-US.yml +++ b/CustomJoinAndQuitMessagesOld/src/main/resources/lang/en-US.yml @@ -1,5 +1,5 @@ ---- CustomJoinAndQuitMessage: + Prefix: '&e[&dCustomJoinAndQuitMessages&e]' Help-Msg: - '&b/CustomJoinAndQuitMessage &8| &9/Cjm &7these are the variants of the main plugin command' - '&b/Cjm &ehelp &7show this same message' diff --git a/CustomJoinAndQuitMessagesOld/src/main/resources/lang/es-ES.yml b/CustomJoinAndQuitMessagesOld/src/main/resources/lang/es-ES.yml index 1f655db..6dd4a71 100644 --- a/CustomJoinAndQuitMessagesOld/src/main/resources/lang/es-ES.yml +++ b/CustomJoinAndQuitMessagesOld/src/main/resources/lang/es-ES.yml @@ -1,5 +1,5 @@ ---- CustomJoinAndQuitMessage: + Prefix: '&e[&dCustomJoinAndQuitMessages&e]' Help-Msg: - '&b/CustomJoinAndQuitMessage &8| &9/Cjm &7estas son las variantes del comando principal del plugin' - '&b/Cjm &ehelp &7muestra el mensaje este mismo mensaje' diff --git a/CustomJoinAndQuitMessagesOld/src/main/resources/lang/fr-FR.yml b/CustomJoinAndQuitMessagesOld/src/main/resources/lang/fr-FR.yml index 72a046f..64adf91 100644 --- a/CustomJoinAndQuitMessagesOld/src/main/resources/lang/fr-FR.yml +++ b/CustomJoinAndQuitMessagesOld/src/main/resources/lang/fr-FR.yml @@ -1,5 +1,5 @@ ---- CustomJoinAndQuitMessage: + Prefix: '&e[&dCustomJoinAndQuitMessages&e]' Help-Msg: - '&b/CustomJoinAndQuitMessage &8| &9/Cjm &7ce sont les variantes de la commande principale du plugin' - '&b/Cjm &ehelp &7afficher ce meme message' diff --git a/CustomJoinAndQuitMessagesOld/src/main/resources/lang/messages.yml b/CustomJoinAndQuitMessagesOld/src/main/resources/lang/messages.yml index 34ec7ee..e2ac6a4 100644 --- a/CustomJoinAndQuitMessagesOld/src/main/resources/lang/messages.yml +++ b/CustomJoinAndQuitMessagesOld/src/main/resources/lang/messages.yml @@ -1,4 +1,5 @@ CustomJoinAndQuitMessage: + Prefix: '&e[&dCustomJoinAndQuitMessages&e]' Help-Msg: - '&b/CustomJoinAndQuitMessage &8| &9/Cjm &7these are the variants of the main plugin command' - '&b/Cjm &ehelp &7show this same message' diff --git a/CustomJoinAndQuitMessagesOld/src/main/resources/lang/ru-RU.yml b/CustomJoinAndQuitMessagesOld/src/main/resources/lang/ru-RU.yml index b701f36..a34e9bc 100644 --- a/CustomJoinAndQuitMessagesOld/src/main/resources/lang/ru-RU.yml +++ b/CustomJoinAndQuitMessagesOld/src/main/resources/lang/ru-RU.yml @@ -1,5 +1,5 @@ ---- CustomJoinAndQuitMessage: + Prefix: '&e[&dCustomJoinAndQuitMessages&e]' Help-Msg: - '&b/CustomJoinAndQuitMessage &8| &9/Cjm &7это варианты основной команды плагина' - '&b/Cjm &ehelp &7показать это же сообщение' diff --git a/CustomJoinAndQuitMessagesOld/src/main/resources/lang/zh-CN.yml b/CustomJoinAndQuitMessagesOld/src/main/resources/lang/zh-CN.yml index a86efde..8922d81 100644 --- a/CustomJoinAndQuitMessagesOld/src/main/resources/lang/zh-CN.yml +++ b/CustomJoinAndQuitMessagesOld/src/main/resources/lang/zh-CN.yml @@ -1,5 +1,5 @@ ---- CustomJoinAndQuitMessage: + Prefix: '&e[&dCustomJoinAndQuitMessages&e]' Help-Msg: - '&b/CustomJoinAndQuitMessage &8| &9/Cjm &7这些是主要插件命令的变体' - '&b/Cjm &ehelp &7显示相同的消息' diff --git a/CustomJoinAndQuitMessagesOld/src/main/resources/lang/zh-TW.yml b/CustomJoinAndQuitMessagesOld/src/main/resources/lang/zh-TW.yml index bb73b55..711549b 100644 --- a/CustomJoinAndQuitMessagesOld/src/main/resources/lang/zh-TW.yml +++ b/CustomJoinAndQuitMessagesOld/src/main/resources/lang/zh-TW.yml @@ -1,5 +1,5 @@ ---- CustomJoinAndQuitMessage: + Prefix: '&e[&dCustomJoinAndQuitMessages&e]' Help-Msg: - '&b/CustomJoinAndQuitMessage &8| &9/Cjm &7這些是主插件命令的變體' - '&b/Cjm &ehelp &7顯示相同的消息' diff --git a/CustomJoinAndQuitMessagesOld/src/main/resources/plugin.yml b/CustomJoinAndQuitMessagesOld/src/main/resources/plugin.yml index 4f78f55..3827cb6 100644 --- a/CustomJoinAndQuitMessagesOld/src/main/resources/plugin.yml +++ b/CustomJoinAndQuitMessagesOld/src/main/resources/plugin.yml @@ -4,7 +4,7 @@ version: "${version}" author: jonagamerpro1234 api-version: 1.13 prefix: CustomJoinAndQuitMessages -website: https://www.spigotmc.org/resources/custom-join-and-quit-message-1-7-x-1-17-x.57006/ +website: https://www.spigotmc.org/resources/custom-join-and-quit-message-1-8-x-1-19-x.57006/ loadbefore: [ Essentials ] softdepend: [ PlaceholderAPI, DiscordSRV, From 64a81be9fd49d58b06884e6afafe431d25dfc393 Mon Sep 17 00:00:00 2001 From: SrJss <31166687+jonagamerpro1234@users.noreply.github.com> Date: Sat, 7 Jan 2023 19:42:49 -0300 Subject: [PATCH 05/27] Update Crowdin configuration file --- crowdin.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/crowdin.yml b/crowdin.yml index 4f77ee9..ec45c50 100644 --- a/crowdin.yml +++ b/crowdin.yml @@ -1,3 +1,5 @@ files: - source: /bukkit/src/main/resources/langs/messages.yml translation: /bukkit/src/main/resources/langs/%locale_with_underscore%.yml + - source: /CustomJoinAndQuitMessagesOld/src/main/resources/lang/messages.yml + translation: /CustomJoinAndQuitMessagesOld/src/main/resources/%locale_with_underscore%.yml From dedd0b0fb4dce64e20671f6bf2699aa2c55b1e11 Mon Sep 17 00:00:00 2001 From: SrJss <31166687+jonagamerpro1234@users.noreply.github.com> Date: Sat, 7 Jan 2023 21:44:02 -0300 Subject: [PATCH 06/27] Recode FileLister --- CustomJoinAndQuitMessagesOld/pom.xml | 2 +- .../config/utils/FileLister.java | 93 +++++++++++++++---- .../src/main/resources/lang/messages.yml | 2 +- 3 files changed, 76 insertions(+), 21 deletions(-) diff --git a/CustomJoinAndQuitMessagesOld/pom.xml b/CustomJoinAndQuitMessagesOld/pom.xml index 096bbb7..2295bf8 100644 --- a/CustomJoinAndQuitMessagesOld/pom.xml +++ b/CustomJoinAndQuitMessagesOld/pom.xml @@ -9,7 +9,7 @@ CustomJoinAndQuitMessagesOld - 1.7.6-beta.3 + 1.7.6-beta.4 11 diff --git a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/config/utils/FileLister.java b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/config/utils/FileLister.java index 835f9cc..cba1ed1 100644 --- a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/config/utils/FileLister.java +++ b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/config/utils/FileLister.java @@ -4,15 +4,17 @@ import jss.customjoinandquitmessages.utils.Logger; import org.bukkit.plugin.java.JavaPlugin; -import java.io.File; -import java.io.FilenameFilter; import java.io.IOException; import java.lang.reflect.Method; +import java.nio.file.DirectoryStream; +import java.nio.file.Files; +import java.nio.file.Path; import java.util.ArrayList; import java.util.Enumeration; import java.util.List; import java.util.jar.JarEntry; import java.util.jar.JarFile; +import java.util.regex.Pattern; public class FileLister { @@ -20,24 +22,79 @@ public class FileLister { private final CustomJoinAndQuitMessages plugin = CustomJoinAndQuitMessages.get(); public List list() throws IOException { - List result = new ArrayList(); + List result = new ArrayList<>(); - File localeDir = new File(plugin.getDataFolder(), "lang"); - if (localeDir.exists()) { - FilenameFilter ymlFilter = new FilenameFilter() { - public boolean accept(File dir, String name) { - String lowercaseName = name.toLowerCase(); - if (plugin.getConfig().getString("Config.Debug").equals("true")) { - Logger.debug("&eLoad Lang File: &9" + name); + Path langDir = plugin.getDataFolder().toPath().resolve("lang"); + + Logger.debug("Path: " + langDir); + + if(Files.exists(langDir)) { + Pattern langFilePattern = Pattern.compile("^[a-z]{2}(-[A-Z]{2})?\\.yml$"); + + try (DirectoryStream stream = Files.newDirectoryStream(langDir)) { + + for (Path entry : stream) { + String fileName = entry.getFileName().toString(); + if (langFilePattern.matcher(fileName).matches()) { + result.add(fileName.replace(".yml", "")); + } + } + + if (!result.isEmpty()) { + return result; + } + } + + + Path jarFile; + + try { + Method method = JavaPlugin.class.getDeclaredMethod("getFile"); + method.setAccessible(true); + + jarFile = (Path) method.invoke(this.plugin); + } catch (Exception ex) { + throw new IOException(ex); + } + + try (JarFile jar = new JarFile(jarFile.toFile())) { + Enumeration entries = jar.entries(); + while (entries.hasMoreElements()) { + JarEntry entry = entries.nextElement(); + String path = entry.getName(); + + if (!path.startsWith("lang")) { + continue; } - if (lowercaseName.endsWith(".yml") && name.length() == 9 && name.substring(2, 3).equals("-")) { - return true; - } else { - if (lowercaseName.endsWith(".yml") && !lowercaseName.equals("messages.yml")) { - Logger.warning("&eFile: " + name + "is not in the correct format for a lang file - &bskipping..."); + + if (entry.getName().endsWith(".yml")) { + String name = entry.getName().replace(".yml", "").replace("lang/", ""); + if (langFilePattern.matcher(name).matches()) { + result.add(name); } - return false; } + + } + } + } + return result; + } + + /* Old lines of the method list() v1.7.5 -> removed in v1.7.6-beta.4 + File localeDir = new File(plugin.getDataFolder(), "lang"); + if (localeDir.exists()) { + FilenameFilter ymlFilter = (dir, name) -> { + String lowercaseName = name.toLowerCase(); + if (plugin.getConfig().getString("Config.Debug").equals("true")) { + Logger.debug("&eLoad Lang File: &9" + name); + } + if (lowercaseName.endsWith(".yml") && name.length() == 9 && name.substring(2, 3).equals("-")) { + return true; + } else { + if (lowercaseName.endsWith(".yml") && !lowercaseName.equals("messages.yml")) { + Logger.warning("&eFile: " + name + "is not in the correct format for a lang file - &bskipping..."); + } + return false; } }; for (String fileName : localeDir.list(ymlFilter)) { @@ -74,7 +131,5 @@ public boolean accept(File dir, String name) { } } - jar.close(); - return result; - } + jar.close();*/ } diff --git a/CustomJoinAndQuitMessagesOld/src/main/resources/lang/messages.yml b/CustomJoinAndQuitMessagesOld/src/main/resources/lang/messages.yml index e2ac6a4..432bd2f 100644 --- a/CustomJoinAndQuitMessagesOld/src/main/resources/lang/messages.yml +++ b/CustomJoinAndQuitMessagesOld/src/main/resources/lang/messages.yml @@ -5,7 +5,7 @@ CustomJoinAndQuitMessage: - '&b/Cjm &ehelp &7show this same message' - '&b/Cjm &ereload &7reload the plugin files' - '&b/Cjm &einfo &7shows information about the plugin' - Help-Cmd: '&7Use &b/Cjm &6help&7 for more infomation' + Help-Cmd: '&7Use &b/Cjm &6help&7 for more information' Reload: '&aReload Completed' Error-Cmd: '&cUnknown Argument' No-Permission: '&cYou dont have permission to do that!' From 2730c3c0a6a38e3bd75f455e1d85c60cb3a59997 Mon Sep 17 00:00:00 2001 From: SrJss <31166687+jonagamerpro1234@users.noreply.github.com> Date: Sat, 7 Jan 2023 21:46:57 -0300 Subject: [PATCH 07/27] Update Crowdin configuration file --- crowdin.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crowdin.yml b/crowdin.yml index ec45c50..efebd21 100644 --- a/crowdin.yml +++ b/crowdin.yml @@ -2,4 +2,4 @@ files: - source: /bukkit/src/main/resources/langs/messages.yml translation: /bukkit/src/main/resources/langs/%locale_with_underscore%.yml - source: /CustomJoinAndQuitMessagesOld/src/main/resources/lang/messages.yml - translation: /CustomJoinAndQuitMessagesOld/src/main/resources/%locale_with_underscore%.yml + translation: /CustomJoinAndQuitMessagesOld/src/main/resources/lang/%locale_with_underscore%.yml From 7a572774281ec5ed9239f1e727bb234e30ddf323 Mon Sep 17 00:00:00 2001 From: SrJss <31166687+jonagamerpro1234@users.noreply.github.com> Date: Sat, 7 Jan 2023 21:56:28 -0300 Subject: [PATCH 08/27] removed old lines codes --- .../customjoinandquitmessages/config/Lang.java | 11 ++++++----- .../config/utils/FileLister.java | 8 +++++++- .../config/utils/FileManager.java | 8 ++++---- .../config/utils/PreConfigLoader.java | 2 +- .../src/main/resources/de_DE.yml | 16 ---------------- .../src/main/resources/en_US.yml | 16 ---------------- .../src/main/resources/es_ES.yml | 16 ---------------- .../src/main/resources/fr_FR.yml | 16 ---------------- .../src/main/resources/lang/de-DE.yml | 16 ---------------- .../src/main/resources/lang/en-US.yml | 16 ---------------- .../src/main/resources/lang/es-ES.yml | 16 ---------------- .../src/main/resources/lang/fr-FR.yml | 16 ---------------- .../src/main/resources/lang/ru-RU.yml | 16 ---------------- .../src/main/resources/lang/zh-CN.yml | 16 ---------------- .../src/main/resources/lang/zh-TW.yml | 16 ---------------- .../src/main/resources/ru_RU.yml | 16 ---------------- .../src/main/resources/zh_CN.yml | 16 ---------------- .../src/main/resources/zh_TW.yml | 16 ---------------- 18 files changed, 18 insertions(+), 235 deletions(-) delete mode 100644 CustomJoinAndQuitMessagesOld/src/main/resources/de_DE.yml delete mode 100644 CustomJoinAndQuitMessagesOld/src/main/resources/en_US.yml delete mode 100644 CustomJoinAndQuitMessagesOld/src/main/resources/es_ES.yml delete mode 100644 CustomJoinAndQuitMessagesOld/src/main/resources/fr_FR.yml delete mode 100644 CustomJoinAndQuitMessagesOld/src/main/resources/lang/de-DE.yml delete mode 100644 CustomJoinAndQuitMessagesOld/src/main/resources/lang/en-US.yml delete mode 100644 CustomJoinAndQuitMessagesOld/src/main/resources/lang/es-ES.yml delete mode 100644 CustomJoinAndQuitMessagesOld/src/main/resources/lang/fr-FR.yml delete mode 100644 CustomJoinAndQuitMessagesOld/src/main/resources/lang/ru-RU.yml delete mode 100644 CustomJoinAndQuitMessagesOld/src/main/resources/lang/zh-CN.yml delete mode 100644 CustomJoinAndQuitMessagesOld/src/main/resources/lang/zh-TW.yml delete mode 100644 CustomJoinAndQuitMessagesOld/src/main/resources/ru_RU.yml delete mode 100644 CustomJoinAndQuitMessagesOld/src/main/resources/zh_CN.yml delete mode 100644 CustomJoinAndQuitMessagesOld/src/main/resources/zh_TW.yml diff --git a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/config/Lang.java b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/config/Lang.java index 7a911b3..2b5cf03 100644 --- a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/config/Lang.java +++ b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/config/Lang.java @@ -21,7 +21,7 @@ public class Lang { public String Error_Console; public String Error_Sound; public String error_null_group; - private CustomJoinAndQuitMessages plugin; + private final CustomJoinAndQuitMessages plugin; private FileConfiguration locale = null; private File localeFile = null; private final Locale localeObject; @@ -32,19 +32,19 @@ public Lang(final CustomJoinAndQuitMessages plugin, final String localeName, fin this.plugin = plugin; this.index = index; this.localeName = localeName; - getlang(localeName); + getLang(localeName); loadLocale(); localeObject = new Locale(localeName.substring(0, 2), localeName.substring(3, 5)); } - public FileConfiguration getlang(final String localeName) { + public FileConfiguration getLang(final String localeName) { if (this.locale == null) { - reloadlang(localeName); + reloadLang(localeName); } return locale; } - public void reloadlang(final String localeName) { + public void reloadLang(final String localeName) { final File localeDir = new File(plugin.getDataFolder() + File.separator + "lang"); if (!localeDir.exists()) { @@ -103,4 +103,5 @@ public String getCountryName() { public int getIndex() { return index; } + } diff --git a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/config/utils/FileLister.java b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/config/utils/FileLister.java index cba1ed1..2fb39f9 100644 --- a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/config/utils/FileLister.java +++ b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/config/utils/FileLister.java @@ -29,7 +29,7 @@ public List list() throws IOException { Logger.debug("Path: " + langDir); if(Files.exists(langDir)) { - Pattern langFilePattern = Pattern.compile("^[a-z]{2}(-[A-Z]{2})?\\.yml$"); + Pattern langFilePattern = Pattern.compile("^[a-z]{2}(_[A-Z]{2})?\\.yml$"); try (DirectoryStream stream = Files.newDirectoryStream(langDir)) { @@ -77,6 +77,12 @@ public List list() throws IOException { } } } + Logger.debug("List of available languages"); + for (String s : result){ + Logger.debug(" * " + s); + } + Logger.debug("============================"); + return result; } diff --git a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/config/utils/FileManager.java b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/config/utils/FileManager.java index 8434bd4..04c8fd2 100644 --- a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/config/utils/FileManager.java +++ b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/config/utils/FileManager.java @@ -8,7 +8,7 @@ public class FileManager { - private CustomJoinAndQuitMessages plugin; + private final CustomJoinAndQuitMessages plugin; public FileManager(CustomJoinAndQuitMessages plugin) { super(); @@ -26,8 +26,8 @@ public void createVoidFolder(String name) { } } - public void createFolderAndFile(String namefolder, String namefile) { - File folder = new File(getDataFolder(), namefolder); + public void createFolderAndFile(String nameFolder, String nameFile) { + File folder = new File(getDataFolder(), nameFolder); if (!folder.exists()) { try { folder.mkdir(); @@ -36,7 +36,7 @@ public void createFolderAndFile(String namefolder, String namefile) { } } - File file = new File(folder, namefile); + File file = new File(folder, nameFile); if (!file.exists()) { try { file.createNewFile(); diff --git a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/config/utils/PreConfigLoader.java b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/config/utils/PreConfigLoader.java index d91289e..331f05a 100644 --- a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/config/utils/PreConfigLoader.java +++ b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/config/utils/PreConfigLoader.java @@ -95,7 +95,7 @@ public boolean loadLangs() { plugin.getLogger().severe("Could not add locales!"); } if (!availableLocales.containsKey(Settings.defaultLanguage)) { - Logger.warning(Util.getPrefix(true) + "&eLoad File: " + Settings.defaultLanguage + ".yml' not found in /locale folder. Using /locale/en-US.yml"); + Logger.warning(Util.getPrefix(true) + "&eLoad File: " + Settings.defaultLanguage + ".yml' not found in /lang/ folder. Using /lang/en-US.yml"); Settings.defaultLanguage = "en-US"; availableLocales.put(Settings.defaultLanguage, new Lang(plugin, Settings.defaultLanguage, 0)); } diff --git a/CustomJoinAndQuitMessagesOld/src/main/resources/de_DE.yml b/CustomJoinAndQuitMessagesOld/src/main/resources/de_DE.yml deleted file mode 100644 index 9a074c3..0000000 --- a/CustomJoinAndQuitMessagesOld/src/main/resources/de_DE.yml +++ /dev/null @@ -1,16 +0,0 @@ -CustomJoinAndQuitMessage: - Prefix: '&e[&dCustomJoinAndQuitMessages&e]' - Help-Msg: - - '&b/CustomJoinAndQuitMessage &8| &9/Cjm &7these are the variants of the main plugin command' - - '&b/Cjm &ehelp &7show this same message' - - '&b/Cjm &ereload &7reload the plugin files' - - '&b/Cjm &einfo &7shows information about the plugin' - Help-Cmd: '&7Use &b/Cjm &6help&7 for more infomation' - Reload: '&aReload Completed' - Error-Cmd: '&cUnknown Argument' - No-Permission: '&cYou dont have permission to do that!' - No-Permission-Label: 'Ask the server owner or an administrator for help for more information.' - Sound-Error: 'the sound does not belong to the current version or the name is wrong' - DisplayManager.Error: '&c|!| &cPlease set de option for execute featured' - DisplayManager.Sound.Usage: '&7Please select one of these two options to execute the function &e' - Groups.NotFoundGroup: '&cThe group could not be found' diff --git a/CustomJoinAndQuitMessagesOld/src/main/resources/en_US.yml b/CustomJoinAndQuitMessagesOld/src/main/resources/en_US.yml deleted file mode 100644 index 9a074c3..0000000 --- a/CustomJoinAndQuitMessagesOld/src/main/resources/en_US.yml +++ /dev/null @@ -1,16 +0,0 @@ -CustomJoinAndQuitMessage: - Prefix: '&e[&dCustomJoinAndQuitMessages&e]' - Help-Msg: - - '&b/CustomJoinAndQuitMessage &8| &9/Cjm &7these are the variants of the main plugin command' - - '&b/Cjm &ehelp &7show this same message' - - '&b/Cjm &ereload &7reload the plugin files' - - '&b/Cjm &einfo &7shows information about the plugin' - Help-Cmd: '&7Use &b/Cjm &6help&7 for more infomation' - Reload: '&aReload Completed' - Error-Cmd: '&cUnknown Argument' - No-Permission: '&cYou dont have permission to do that!' - No-Permission-Label: 'Ask the server owner or an administrator for help for more information.' - Sound-Error: 'the sound does not belong to the current version or the name is wrong' - DisplayManager.Error: '&c|!| &cPlease set de option for execute featured' - DisplayManager.Sound.Usage: '&7Please select one of these two options to execute the function &e' - Groups.NotFoundGroup: '&cThe group could not be found' diff --git a/CustomJoinAndQuitMessagesOld/src/main/resources/es_ES.yml b/CustomJoinAndQuitMessagesOld/src/main/resources/es_ES.yml deleted file mode 100644 index 9a074c3..0000000 --- a/CustomJoinAndQuitMessagesOld/src/main/resources/es_ES.yml +++ /dev/null @@ -1,16 +0,0 @@ -CustomJoinAndQuitMessage: - Prefix: '&e[&dCustomJoinAndQuitMessages&e]' - Help-Msg: - - '&b/CustomJoinAndQuitMessage &8| &9/Cjm &7these are the variants of the main plugin command' - - '&b/Cjm &ehelp &7show this same message' - - '&b/Cjm &ereload &7reload the plugin files' - - '&b/Cjm &einfo &7shows information about the plugin' - Help-Cmd: '&7Use &b/Cjm &6help&7 for more infomation' - Reload: '&aReload Completed' - Error-Cmd: '&cUnknown Argument' - No-Permission: '&cYou dont have permission to do that!' - No-Permission-Label: 'Ask the server owner or an administrator for help for more information.' - Sound-Error: 'the sound does not belong to the current version or the name is wrong' - DisplayManager.Error: '&c|!| &cPlease set de option for execute featured' - DisplayManager.Sound.Usage: '&7Please select one of these two options to execute the function &e' - Groups.NotFoundGroup: '&cThe group could not be found' diff --git a/CustomJoinAndQuitMessagesOld/src/main/resources/fr_FR.yml b/CustomJoinAndQuitMessagesOld/src/main/resources/fr_FR.yml deleted file mode 100644 index 9a074c3..0000000 --- a/CustomJoinAndQuitMessagesOld/src/main/resources/fr_FR.yml +++ /dev/null @@ -1,16 +0,0 @@ -CustomJoinAndQuitMessage: - Prefix: '&e[&dCustomJoinAndQuitMessages&e]' - Help-Msg: - - '&b/CustomJoinAndQuitMessage &8| &9/Cjm &7these are the variants of the main plugin command' - - '&b/Cjm &ehelp &7show this same message' - - '&b/Cjm &ereload &7reload the plugin files' - - '&b/Cjm &einfo &7shows information about the plugin' - Help-Cmd: '&7Use &b/Cjm &6help&7 for more infomation' - Reload: '&aReload Completed' - Error-Cmd: '&cUnknown Argument' - No-Permission: '&cYou dont have permission to do that!' - No-Permission-Label: 'Ask the server owner or an administrator for help for more information.' - Sound-Error: 'the sound does not belong to the current version or the name is wrong' - DisplayManager.Error: '&c|!| &cPlease set de option for execute featured' - DisplayManager.Sound.Usage: '&7Please select one of these two options to execute the function &e' - Groups.NotFoundGroup: '&cThe group could not be found' diff --git a/CustomJoinAndQuitMessagesOld/src/main/resources/lang/de-DE.yml b/CustomJoinAndQuitMessagesOld/src/main/resources/lang/de-DE.yml deleted file mode 100644 index ac7fced..0000000 --- a/CustomJoinAndQuitMessagesOld/src/main/resources/lang/de-DE.yml +++ /dev/null @@ -1,16 +0,0 @@ -CustomJoinAndQuitMessage: - Prefix: '&e[&dCustomJoinAndQuitMessages&e]' - Help-Msg: - - '&b/CustomJoinAndQuitMessage &8| &9/Cjm &7Dies sind die Varianten des Haupt-Plugin-Befehls' - - '&b/Cjm &ehelp &7zeige die gleiche Nachricht' - - '&b/Cjm &ereload &7Laden Sie die Plugin-Dateien neu' - - '&b/Cjm &einfo &7zeigt Informationen zum Plugin an' - Help-Cmd: '&7Verwenden &b/Cjm &6help&7 f?r mehr Informationen' - Reload: '&aNachladen abgeschlossen' - Error-Cmd: '&cUnbekanntes Argument' - No-Permission: '&cSie haben keine Erlaubnis dazu!' - No-Permission-Label: 'Bitten Sie den Serverbesitzer oder einen Administrator um Hilfe, um weitere Informationen zu erhalten' - Sound-Error: 'Der Sound geh?rt nicht zur aktuellen Version oder der Name ist falsch' - DisplayManager.Error: '&c|!| &cPlease set de option for execute featured' - DisplayManager.Sound.Usage: '&7Please select one of these two options to execute the function &e' - Groups.NotFoundGroup: '&cThe group could not be found' diff --git a/CustomJoinAndQuitMessagesOld/src/main/resources/lang/en-US.yml b/CustomJoinAndQuitMessagesOld/src/main/resources/lang/en-US.yml deleted file mode 100644 index e2ac6a4..0000000 --- a/CustomJoinAndQuitMessagesOld/src/main/resources/lang/en-US.yml +++ /dev/null @@ -1,16 +0,0 @@ -CustomJoinAndQuitMessage: - Prefix: '&e[&dCustomJoinAndQuitMessages&e]' - Help-Msg: - - '&b/CustomJoinAndQuitMessage &8| &9/Cjm &7these are the variants of the main plugin command' - - '&b/Cjm &ehelp &7show this same message' - - '&b/Cjm &ereload &7reload the plugin files' - - '&b/Cjm &einfo &7shows information about the plugin' - Help-Cmd: '&7Use &b/Cjm &6help&7 for more infomation' - Reload: '&aReload Completed' - Error-Cmd: '&cUnknown Argument' - No-Permission: '&cYou dont have permission to do that!' - No-Permission-Label: 'Ask the server owner or an administrator for help for more information.' - Sound-Error: 'the sound does not belong to the current version or the name is wrong' - DisplayManager.Error: '&c|!| &cPlease set de option for execute featured' - DisplayManager.Sound.Usage: '&7Please select one of these two options to execute the function &e' - Groups.NotFoundGroup: '&cThe group could not be found' \ No newline at end of file diff --git a/CustomJoinAndQuitMessagesOld/src/main/resources/lang/es-ES.yml b/CustomJoinAndQuitMessagesOld/src/main/resources/lang/es-ES.yml deleted file mode 100644 index 6dd4a71..0000000 --- a/CustomJoinAndQuitMessagesOld/src/main/resources/lang/es-ES.yml +++ /dev/null @@ -1,16 +0,0 @@ -CustomJoinAndQuitMessage: - Prefix: '&e[&dCustomJoinAndQuitMessages&e]' - Help-Msg: - - '&b/CustomJoinAndQuitMessage &8| &9/Cjm &7estas son las variantes del comando principal del plugin' - - '&b/Cjm &ehelp &7muestra el mensaje este mismo mensaje' - - '&b/Cjm &ereload &7Recarga los archivos de plugin' - - '&b/Cjm &einfo &7muestra informacion importante sobre el plugin' - Help-Cmd: '&7Usa &b/Cjm &6help &7para mas ayuda' - Reload: '&aRecarga Completada' - Error-Cmd: '&cArgumento desconosido' - No-Permission: '&cNo tienes permiso para hacer eso!' - No-Permission-Label: '&bSolicite ayuda al propietario del servidor o al administrador para obtener mas informacion..' - Sound-Error: '&cEl sonido no pertenece a la version actual o el nombre es incorrecto' - DisplayManager.Error: '&c|!| &cPor favor, establezca la opción para ejecutar la función' - DisplayManager.Sound.Usage: '&7Por favor, seleccione una de estas dos opciones para ejecutar la función &e' - Groups.NotFoundGroup: '&cNo se ha podido encontrar el grupo' diff --git a/CustomJoinAndQuitMessagesOld/src/main/resources/lang/fr-FR.yml b/CustomJoinAndQuitMessagesOld/src/main/resources/lang/fr-FR.yml deleted file mode 100644 index 64adf91..0000000 --- a/CustomJoinAndQuitMessagesOld/src/main/resources/lang/fr-FR.yml +++ /dev/null @@ -1,16 +0,0 @@ -CustomJoinAndQuitMessage: - Prefix: '&e[&dCustomJoinAndQuitMessages&e]' - Help-Msg: - - '&b/CustomJoinAndQuitMessage &8| &9/Cjm &7ce sont les variantes de la commande principale du plugin' - - '&b/Cjm &ehelp &7afficher ce meme message' - - '&b/Cjm &ereload &7recharger les fichiers du plugin' - - '&b/Cjm &einfo &7affiche des informations sur le plugin' - Help-Cmd: '&7Utilisation &b/Cjm &6help &7pour plus d''informations' - Reload: '&aRecharger terminé' - Error-Cmd: '&cArgument inconnu' - No-Permission: '&cVous n''avez pas la permission de faire ?a!' - No-Permission-Label: 'Demandez de l''aide au propriétaire du serveur ou à un administrateur pour plus d''informations' - Sound-Error: 'le son n''appartient pas ? la version actuelle ou le nom est erron?' - DisplayManager.Error: '&c|!| &cVeuillez définir l''option d''exécution' - DisplayManager.Sound.Usage: '&7Veuillez sélectionner l''une de ces deux options pour exécuter la fonction &e' - Groups.NotFoundGroup: '&cLe groupe est introuvable' diff --git a/CustomJoinAndQuitMessagesOld/src/main/resources/lang/ru-RU.yml b/CustomJoinAndQuitMessagesOld/src/main/resources/lang/ru-RU.yml deleted file mode 100644 index a34e9bc..0000000 --- a/CustomJoinAndQuitMessagesOld/src/main/resources/lang/ru-RU.yml +++ /dev/null @@ -1,16 +0,0 @@ -CustomJoinAndQuitMessage: - Prefix: '&e[&dCustomJoinAndQuitMessages&e]' - Help-Msg: - - '&b/CustomJoinAndQuitMessage &8| &9/Cjm &7это варианты основной команды плагина' - - '&b/Cjm &ehelp &7показать это же сообщение' - - '&b/Cjm &ereload &7перезагрузить файлы плагина' - - '&b/Cjm &einfo &7показывает информацию о плагине' - Help-Cmd: '&7Используйте &b/Cjm &6help&7 для более подробной информации' - Reload: '&aПерезагрузка прошла успешно' - Error-Cmd: '&cНеизвестный аргумент' - No-Permission: '&cУ вас недостаточно прав для соверщения этого действия!' - No-Permission-Label: 'Обратитесь к владельцу сервера или администратору за помощью для получения дополнительной информации.' - Sound-Error: 'звук отсутствует в текущей версии или введено неверное название' - DisplayManager.Error: '&c|!| &cПожалуйста, установите опции для исполнения выбранного' - DisplayManager.Sound.Usage: '&7Пожалуйста, выберите одну из двух опций для выполнения функции &e' - Groups.NotFoundGroup: '&cThe group could not be found' diff --git a/CustomJoinAndQuitMessagesOld/src/main/resources/lang/zh-CN.yml b/CustomJoinAndQuitMessagesOld/src/main/resources/lang/zh-CN.yml deleted file mode 100644 index 8922d81..0000000 --- a/CustomJoinAndQuitMessagesOld/src/main/resources/lang/zh-CN.yml +++ /dev/null @@ -1,16 +0,0 @@ -CustomJoinAndQuitMessage: - Prefix: '&e[&dCustomJoinAndQuitMessages&e]' - Help-Msg: - - '&b/CustomJoinAndQuitMessage &8| &9/Cjm &7这些是主要插件命令的变体' - - '&b/Cjm &ehelp &7显示相同的消息' - - '&b/Cjm &ereload &7重新加载插件文件' - - '&b/Cjm &einfo &7显示有关插件的信息' - Help-Cmd: '&7用 &b/Cjm &6help&7 想要查询更多的信息' - Reload: '&a重新加载完成' - Error-Cmd: '&c未知参数' - No-Permission: '&c您无权执行此操作!' - No-Permission-Label: '向服务器所有者或管理员寻求帮助以获取更多信息' - Sound-Error: '声音不属于当前版本或名称错误' - DisplayManager.Error: '&c|!| &cPlease set de option for execute featured' - DisplayManager.Sound.Usage: '&7Please select one of these two options to execute the function &e' - Groups.NotFoundGroup: '&cThe group could not be found' diff --git a/CustomJoinAndQuitMessagesOld/src/main/resources/lang/zh-TW.yml b/CustomJoinAndQuitMessagesOld/src/main/resources/lang/zh-TW.yml deleted file mode 100644 index 711549b..0000000 --- a/CustomJoinAndQuitMessagesOld/src/main/resources/lang/zh-TW.yml +++ /dev/null @@ -1,16 +0,0 @@ -CustomJoinAndQuitMessage: - Prefix: '&e[&dCustomJoinAndQuitMessages&e]' - Help-Msg: - - '&b/CustomJoinAndQuitMessage &8| &9/Cjm &7這些是主插件命令的變體' - - '&b/Cjm &ehelp &7顯示相同的消息' - - '&b/Cjm &ereload &7重新加載插件文件' - - '&b/Cjm &einfo &7顯示有關插件的信息' - Help-Cmd: '&7Use &b/Cjm &6help&7想要查詢更多的信息' - Reload: '&a重新加載完成' - Error-Cmd: '&c未知參數' - No-Permission: '&c您無權執行此操作' - No-Permission-Label: '向服務器所有者或管理員尋求幫助以獲取更多信息' - Sound-Error: '聲音不屬於當前版本名稱錯誤' - DisplayManager.Error: '&c|!| &cPlease set de option for execute featured' - DisplayManager.Sound.Usage: '&7Please select one of these two options to execute the function &e' - Groups.NotFoundGroup: '&cThe group could not be found' diff --git a/CustomJoinAndQuitMessagesOld/src/main/resources/ru_RU.yml b/CustomJoinAndQuitMessagesOld/src/main/resources/ru_RU.yml deleted file mode 100644 index 9a074c3..0000000 --- a/CustomJoinAndQuitMessagesOld/src/main/resources/ru_RU.yml +++ /dev/null @@ -1,16 +0,0 @@ -CustomJoinAndQuitMessage: - Prefix: '&e[&dCustomJoinAndQuitMessages&e]' - Help-Msg: - - '&b/CustomJoinAndQuitMessage &8| &9/Cjm &7these are the variants of the main plugin command' - - '&b/Cjm &ehelp &7show this same message' - - '&b/Cjm &ereload &7reload the plugin files' - - '&b/Cjm &einfo &7shows information about the plugin' - Help-Cmd: '&7Use &b/Cjm &6help&7 for more infomation' - Reload: '&aReload Completed' - Error-Cmd: '&cUnknown Argument' - No-Permission: '&cYou dont have permission to do that!' - No-Permission-Label: 'Ask the server owner or an administrator for help for more information.' - Sound-Error: 'the sound does not belong to the current version or the name is wrong' - DisplayManager.Error: '&c|!| &cPlease set de option for execute featured' - DisplayManager.Sound.Usage: '&7Please select one of these two options to execute the function &e' - Groups.NotFoundGroup: '&cThe group could not be found' diff --git a/CustomJoinAndQuitMessagesOld/src/main/resources/zh_CN.yml b/CustomJoinAndQuitMessagesOld/src/main/resources/zh_CN.yml deleted file mode 100644 index 9a074c3..0000000 --- a/CustomJoinAndQuitMessagesOld/src/main/resources/zh_CN.yml +++ /dev/null @@ -1,16 +0,0 @@ -CustomJoinAndQuitMessage: - Prefix: '&e[&dCustomJoinAndQuitMessages&e]' - Help-Msg: - - '&b/CustomJoinAndQuitMessage &8| &9/Cjm &7these are the variants of the main plugin command' - - '&b/Cjm &ehelp &7show this same message' - - '&b/Cjm &ereload &7reload the plugin files' - - '&b/Cjm &einfo &7shows information about the plugin' - Help-Cmd: '&7Use &b/Cjm &6help&7 for more infomation' - Reload: '&aReload Completed' - Error-Cmd: '&cUnknown Argument' - No-Permission: '&cYou dont have permission to do that!' - No-Permission-Label: 'Ask the server owner or an administrator for help for more information.' - Sound-Error: 'the sound does not belong to the current version or the name is wrong' - DisplayManager.Error: '&c|!| &cPlease set de option for execute featured' - DisplayManager.Sound.Usage: '&7Please select one of these two options to execute the function &e' - Groups.NotFoundGroup: '&cThe group could not be found' diff --git a/CustomJoinAndQuitMessagesOld/src/main/resources/zh_TW.yml b/CustomJoinAndQuitMessagesOld/src/main/resources/zh_TW.yml deleted file mode 100644 index 9a074c3..0000000 --- a/CustomJoinAndQuitMessagesOld/src/main/resources/zh_TW.yml +++ /dev/null @@ -1,16 +0,0 @@ -CustomJoinAndQuitMessage: - Prefix: '&e[&dCustomJoinAndQuitMessages&e]' - Help-Msg: - - '&b/CustomJoinAndQuitMessage &8| &9/Cjm &7these are the variants of the main plugin command' - - '&b/Cjm &ehelp &7show this same message' - - '&b/Cjm &ereload &7reload the plugin files' - - '&b/Cjm &einfo &7shows information about the plugin' - Help-Cmd: '&7Use &b/Cjm &6help&7 for more infomation' - Reload: '&aReload Completed' - Error-Cmd: '&cUnknown Argument' - No-Permission: '&cYou dont have permission to do that!' - No-Permission-Label: 'Ask the server owner or an administrator for help for more information.' - Sound-Error: 'the sound does not belong to the current version or the name is wrong' - DisplayManager.Error: '&c|!| &cPlease set de option for execute featured' - DisplayManager.Sound.Usage: '&7Please select one of these two options to execute the function &e' - Groups.NotFoundGroup: '&cThe group could not be found' From 3c70f6ced9634af389bacfd24a56f119ef2a20a9 Mon Sep 17 00:00:00 2001 From: SrJss <31166687+jonagamerpro1234@users.noreply.github.com> Date: Sat, 7 Jan 2023 23:13:19 -0300 Subject: [PATCH 09/27] release v1.7.6 --- CustomJoinAndQuitMessagesOld/pom.xml | 2 +- .../json/{Json.java => MessageBuilder.java} | 12 ++-- .../listener/JoinListener.java | 56 ++++++++--------- .../manager/DisplayManager.java | 62 +++++++++---------- .../utils/GroupHelper.java | 56 ++++++++--------- 5 files changed, 94 insertions(+), 94 deletions(-) rename CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/json/{Json.java => MessageBuilder.java} (90%) diff --git a/CustomJoinAndQuitMessagesOld/pom.xml b/CustomJoinAndQuitMessagesOld/pom.xml index 2295bf8..1456b85 100644 --- a/CustomJoinAndQuitMessagesOld/pom.xml +++ b/CustomJoinAndQuitMessagesOld/pom.xml @@ -9,7 +9,7 @@ CustomJoinAndQuitMessagesOld - 1.7.6-beta.4 + 1.7.6-Release 11 diff --git a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/json/Json.java b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/json/MessageBuilder.java similarity index 90% rename from CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/json/Json.java rename to CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/json/MessageBuilder.java index 69cc6ef..b72bc25 100644 --- a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/json/Json.java +++ b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/json/MessageBuilder.java @@ -11,7 +11,7 @@ import java.util.List; -public class Json { +public class MessageBuilder { private final Player player; private final String text; @@ -20,7 +20,7 @@ public class Json { private String executeCommand; private String openUrl; - public Json(Player player, String text) { + public MessageBuilder(Player player, String text) { this.player = player; this.text = text; this.hoverText = null; @@ -34,7 +34,7 @@ public String getText() { return text; } - public Json setHover(@NotNull List hover) { + public MessageBuilder setHover(@NotNull List hover) { this.hoverText = new BaseComponent[hover.size()]; for (int i = 0; i < hover.size(); i++) { TextComponent component = new TextComponent(); @@ -48,17 +48,17 @@ public Json setHover(@NotNull List hover) { return this; } - public Json setSuggestCommand(String suggestCommand) { + public MessageBuilder setSuggestCommand(String suggestCommand) { this.suggestCommand = suggestCommand; return this; } - public Json setExecuteCommand(String executeCommand) { + public MessageBuilder setExecuteCommand(String executeCommand) { this.executeCommand = executeCommand; return this; } - public Json setOpenURL(String url) { + public MessageBuilder setOpenURL(String url) { this.openUrl = url; return this; } diff --git a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/listener/JoinListener.java b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/listener/JoinListener.java index 885944f..4ffb809 100644 --- a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/listener/JoinListener.java +++ b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/listener/JoinListener.java @@ -5,7 +5,7 @@ import github.scarsz.discordsrv.util.DiscordUtil; import jss.customjoinandquitmessages.CustomJoinAndQuitMessages; import jss.customjoinandquitmessages.hook.*; -import jss.customjoinandquitmessages.json.Json; +import jss.customjoinandquitmessages.json.MessageBuilder; import jss.customjoinandquitmessages.manager.HookManager; import jss.customjoinandquitmessages.manager.PlayerManager; import jss.customjoinandquitmessages.utils.*; @@ -113,10 +113,10 @@ public void onJoinListener(@NotNull PlayerJoinEvent e) { text = Util.color(Util.getVar(p, text)); - Json json = new Json(p, text); + MessageBuilder messageBuilder = new MessageBuilder(p, text); if (config.getBoolean("Config.Show-Chat-In-Console")) { - Logger.info(json.getText()); + Logger.info(messageBuilder.getText()); } if (isNormalType) { @@ -128,7 +128,7 @@ public void onJoinListener(@NotNull PlayerJoinEvent e) { DiscordUtil.sendMessageBlocking( DiscordUtil.getTextChannelById(Settings.hook_discordsrv_channelid), - Util.colorless(json.getText())); + Util.colorless(messageBuilder.getText())); } if (essentialsXDiscordHook.isEnabled()) { @@ -136,7 +136,7 @@ public void onJoinListener(@NotNull PlayerJoinEvent e) { return; essentialsXDiscordHook.sendJoinMessage(Settings.hook_essentialsDiscord_channelid, - Util.colorless(json.getText())); + Util.colorless(messageBuilder.getText())); } } else if (isModifyType) { boolean isHover = Objects.equals(config.getString("Join.HoverEvent.Enabled"), "true"); @@ -168,34 +168,34 @@ public void onJoinListener(@NotNull PlayerJoinEvent e) { if (isClick) { assert isClick_Mode != null; if (isClick_Mode.equalsIgnoreCase("command")) { - json.setHover(Hover_Text).setExecuteCommand(Action_Command).sendToAll(); + messageBuilder.setHover(Hover_Text).setExecuteCommand(Action_Command).sendToAll(); } else if (isClick_Mode.equalsIgnoreCase("url")) { - json.setHover(Hover_Text).setOpenURL(Action_Url).sendToAll(); + messageBuilder.setHover(Hover_Text).setOpenURL(Action_Url).sendToAll(); } else if (isClick_Mode.equalsIgnoreCase("suggest")) { - json.setHover(Hover_Text).setSuggestCommand(Action_Suggest).sendToAll(); + messageBuilder.setHover(Hover_Text).setSuggestCommand(Action_Suggest).sendToAll(); } } else { - json.setHover(Hover_Text).sendToAll(); + messageBuilder.setHover(Hover_Text).sendToAll(); } } else { if (isClick) { assert isClick_Mode != null; if (isClick_Mode.equalsIgnoreCase("command")) { - json.setExecuteCommand(Action_Command).sendToAll(); + messageBuilder.setExecuteCommand(Action_Command).sendToAll(); } else if (isClick_Mode.equalsIgnoreCase("url")) { - json.setOpenURL(Action_Url).sendToAll(); + messageBuilder.setOpenURL(Action_Url).sendToAll(); } else if (isClick_Mode.equalsIgnoreCase("suggest")) { - json.setSuggestCommand(Action_Suggest).sendToAll(); + messageBuilder.setSuggestCommand(Action_Suggest).sendToAll(); } } else { - json.sendToAll(); + messageBuilder.sendToAll(); } } if (discordSRVHHook.isEnabled()) { DiscordUtil.sendMessageBlocking( DiscordUtil.getTextChannelById(Settings.hook_discordsrv_channelid), - Util.colorless(json.getText())); + Util.colorless(messageBuilder.getText())); } if (isTitle) { @@ -288,10 +288,10 @@ public void onQuit(@NotNull PlayerQuitEvent e) { text = Util.color(text); text = Util.getVar(p, text); - Json json = new Json(p, text); + MessageBuilder messageBuilder = new MessageBuilder(p, text); if (config.getBoolean("Config.Show-Chat-In-Console")) { - Logger.info(json.getText()); + Logger.info(messageBuilder.getText()); } if (isNormalType) { @@ -301,14 +301,14 @@ public void onQuit(@NotNull PlayerQuitEvent e) { return; DiscordUtil.sendMessageBlocking( DiscordUtil.getTextChannelById(Settings.hook_discordsrv_channelid), - Util.colorless(json.getText())); + Util.colorless(messageBuilder.getText())); } if (essentialsXDiscordHook.isEnabled()) { if (Settings.hook_essentialsDiscord_channelid.equalsIgnoreCase("none")) return; essentialsXDiscordHook.sendQuitMessage(Settings.hook_essentialsDiscord_channelid, - Util.colorless(json.getText())); + Util.colorless(messageBuilder.getText())); } } else if (isModifyType) { @@ -332,27 +332,27 @@ public void onQuit(@NotNull PlayerQuitEvent e) { if (isClick) { assert isClick_Mode != null; if (isClick_Mode.equalsIgnoreCase("command")) { - json.setHover(Hover_Text).setExecuteCommand(Action_Command).sendToAll(); + messageBuilder.setHover(Hover_Text).setExecuteCommand(Action_Command).sendToAll(); } else if (isClick_Mode.equalsIgnoreCase("url")) { - json.setHover(Hover_Text).setOpenURL(Action_Url).sendToAll(); + messageBuilder.setHover(Hover_Text).setOpenURL(Action_Url).sendToAll(); } else if (isClick_Mode.equalsIgnoreCase("suggest")) { - json.setHover(Hover_Text).setSuggestCommand(Action_Suggest).sendToAll(); + messageBuilder.setHover(Hover_Text).setSuggestCommand(Action_Suggest).sendToAll(); } } else { - json.setHover(Hover_Text).sendToAll(); + messageBuilder.setHover(Hover_Text).sendToAll(); } } else { if (isClick) { assert isClick_Mode != null; if (isClick_Mode.equalsIgnoreCase("command")) { - json.setExecuteCommand(Action_Command).sendToAll(); + messageBuilder.setExecuteCommand(Action_Command).sendToAll(); } else if (isClick_Mode.equalsIgnoreCase("url")) { - json.setOpenURL(Action_Url).sendToAll(); + messageBuilder.setOpenURL(Action_Url).sendToAll(); } else if (isClick_Mode.equalsIgnoreCase("suggest")) { - json.setSuggestCommand(Action_Suggest).sendToAll(); + messageBuilder.setSuggestCommand(Action_Suggest).sendToAll(); } } else { - json.sendToAll(); + messageBuilder.sendToAll(); } } @@ -363,7 +363,7 @@ public void onQuit(@NotNull PlayerQuitEvent e) { DiscordUtil.sendMessageBlocking( DiscordUtil.getTextChannelById(Settings.hook_discordsrv_channelid), - Util.colorless(json.getText())); + Util.colorless(messageBuilder.getText())); } if (essentialsXDiscordHook.isEnabled()) { @@ -372,7 +372,7 @@ public void onQuit(@NotNull PlayerQuitEvent e) { return; essentialsXDiscordHook.sendQuitMessage(Settings.hook_essentialsDiscord_channelid, - Util.colorless(json.getText())); + Util.colorless(messageBuilder.getText())); } try { diff --git a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/manager/DisplayManager.java b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/manager/DisplayManager.java index a6b1834..981990f 100644 --- a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/manager/DisplayManager.java +++ b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/manager/DisplayManager.java @@ -3,7 +3,7 @@ import com.cryptomorin.xseries.messages.ActionBar; import com.cryptomorin.xseries.messages.Titles; import jss.customjoinandquitmessages.CustomJoinAndQuitMessages; -import jss.customjoinandquitmessages.json.Json; +import jss.customjoinandquitmessages.json.MessageBuilder; import jss.customjoinandquitmessages.utils.Logger; import jss.customjoinandquitmessages.utils.Settings; import jss.customjoinandquitmessages.utils.Util; @@ -76,35 +76,35 @@ public void showFirstJoinMessage() { Action_Suggest = config.getString("Join.ClickEvent.Actions.Suggest-Command"); } - Json json = new Json(player, Util.color(Util.getVar(player, text))); + MessageBuilder messageBuilder = new MessageBuilder(player, Util.color(Util.getVar(player, text))); if (isNormalType) { - json.send(); + messageBuilder.send(); return; } else if (isModifyType) { if (isHover) { if (isClick) { if (isClick_Mode.equalsIgnoreCase("command")) { - json.setHover(Hover_Text).setExecuteCommand(Action_Command).send(); + messageBuilder.setHover(Hover_Text).setExecuteCommand(Action_Command).send(); } else if (isClick_Mode.equalsIgnoreCase("url")) { - json.setHover(Hover_Text).setOpenURL(Action_Url).send(); + messageBuilder.setHover(Hover_Text).setOpenURL(Action_Url).send(); } else if (isClick_Mode.equalsIgnoreCase("suggest")) { - json.setHover(Hover_Text).setSuggestCommand(Action_Suggest).send(); + messageBuilder.setHover(Hover_Text).setSuggestCommand(Action_Suggest).send(); } } else { - json.setHover(Hover_Text).send(); + messageBuilder.setHover(Hover_Text).send(); } } else { if (isClick) { if (isClick_Mode.equalsIgnoreCase("command")) { - json.setExecuteCommand(Action_Command).send(); + messageBuilder.setExecuteCommand(Action_Command).send(); } else if (isClick_Mode.equalsIgnoreCase("url")) { - json.setOpenURL(Action_Url).send(); + messageBuilder.setOpenURL(Action_Url).send(); } else if (isClick_Mode.equalsIgnoreCase("suggest")) { - json.setSuggestCommand(Action_Suggest).send(); + messageBuilder.setSuggestCommand(Action_Suggest).send(); } } else { - json.send(); + messageBuilder.send(); } } } @@ -155,35 +155,35 @@ public void showJoinMessage() { Action_Suggest = config.getString("Join.ClickEvent.Actions.Suggest-Command"); } - Json json = new Json(player, Util.color(Util.getVar(player, text))); + MessageBuilder messageBuilder = new MessageBuilder(player, Util.color(Util.getVar(player, text))); if (isNormalType) { - json.send(); + messageBuilder.send(); return; } else if (isModifyType) { if (isHover) { if (isClick) { if (isClick_Mode.equalsIgnoreCase("command")) { - json.setHover(Hover_Text).setExecuteCommand(Action_Command).send(); + messageBuilder.setHover(Hover_Text).setExecuteCommand(Action_Command).send(); } else if (isClick_Mode.equalsIgnoreCase("url")) { - json.setHover(Hover_Text).setOpenURL(Action_Url).send(); + messageBuilder.setHover(Hover_Text).setOpenURL(Action_Url).send(); } else if (isClick_Mode.equalsIgnoreCase("suggest")) { - json.setHover(Hover_Text).setSuggestCommand(Action_Suggest).send(); + messageBuilder.setHover(Hover_Text).setSuggestCommand(Action_Suggest).send(); } } else { - json.setHover(Hover_Text).send(); + messageBuilder.setHover(Hover_Text).send(); } } else { if (isClick) { if (isClick_Mode.equalsIgnoreCase("command")) { - json.setExecuteCommand(Action_Command).send(); + messageBuilder.setExecuteCommand(Action_Command).send(); } else if (isClick_Mode.equalsIgnoreCase("url")) { - json.setOpenURL(Action_Url).send(); + messageBuilder.setOpenURL(Action_Url).send(); } else if (isClick_Mode.equalsIgnoreCase("suggest")) { - json.setSuggestCommand(Action_Suggest).send(); + messageBuilder.setSuggestCommand(Action_Suggest).send(); } } else { - json.send(); + messageBuilder.send(); } } } @@ -234,35 +234,35 @@ public void showQuitMessage() { Action_Suggest = config.getString("Quit.ClickEvent.Actions.Suggest-Command"); } - Json json = new Json(player, Util.color(Util.getVar(player, text))); + MessageBuilder messageBuilder = new MessageBuilder(player, Util.color(Util.getVar(player, text))); if (isNormalType) { - json.send(); + messageBuilder.send(); return; } else if (isModifyType) { if (isHover) { if (isClick) { if (isClick_Mode.equalsIgnoreCase("command")) { - json.setHover(Hover_Text).setExecuteCommand(Action_Command).send(); + messageBuilder.setHover(Hover_Text).setExecuteCommand(Action_Command).send(); } else if (isClick_Mode.equalsIgnoreCase("url")) { - json.setHover(Hover_Text).setOpenURL(Action_Url).send(); + messageBuilder.setHover(Hover_Text).setOpenURL(Action_Url).send(); } else if (isClick_Mode.equalsIgnoreCase("suggest")) { - json.setHover(Hover_Text).setSuggestCommand(Action_Suggest).send(); + messageBuilder.setHover(Hover_Text).setSuggestCommand(Action_Suggest).send(); } } else { - json.setHover(Hover_Text).send(); + messageBuilder.setHover(Hover_Text).send(); } } else { if (isClick) { if (isClick_Mode.equalsIgnoreCase("command")) { - json.setExecuteCommand(Action_Command).send(); + messageBuilder.setExecuteCommand(Action_Command).send(); } else if (isClick_Mode.equalsIgnoreCase("url")) { - json.setOpenURL(Action_Url).send(); + messageBuilder.setOpenURL(Action_Url).send(); } else if (isClick_Mode.equalsIgnoreCase("suggest")) { - json.setSuggestCommand(Action_Suggest).send(); + messageBuilder.setSuggestCommand(Action_Suggest).send(); } } else { - json.send(); + messageBuilder.send(); } } } diff --git a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/utils/GroupHelper.java b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/utils/GroupHelper.java index c833af3..fe89f6b 100644 --- a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/utils/GroupHelper.java +++ b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/utils/GroupHelper.java @@ -5,7 +5,7 @@ import github.scarsz.discordsrv.util.DiscordUtil; import jss.customjoinandquitmessages.hook.DiscordSRVHHook; import jss.customjoinandquitmessages.hook.EssentialsXDiscordHook; -import jss.customjoinandquitmessages.json.Json; +import jss.customjoinandquitmessages.json.MessageBuilder; import jss.customjoinandquitmessages.manager.GroupManager; import org.bukkit.Bukkit; import org.bukkit.Location; @@ -62,10 +62,10 @@ public void onJoin(Player player, FileConfiguration config, PlayerJoinEvent play boolean isNormalType = groupManager.getType(group).equalsIgnoreCase("normal"); boolean isModifyType = groupManager.getType(group).equalsIgnoreCase("modify"); - Json json = new Json(player, temp); + MessageBuilder messageBuilder = new MessageBuilder(player, temp); if (config.getBoolean("Config.Show-Chat-In-Console")) { - Logger.info(json.getText()); + Logger.info(messageBuilder.getText()); } if (isNormalType) { @@ -77,7 +77,7 @@ public void onJoin(Player player, FileConfiguration config, PlayerJoinEvent play DiscordUtil.sendMessageBlocking( DiscordUtil.getTextChannelById(Settings.hook_discordsrv_channelid), - Util.colorless(json.getText())); + Util.colorless(messageBuilder.getText())); } if (essentialsXDiscordHook.isEnabled()) { @@ -85,7 +85,7 @@ public void onJoin(Player player, FileConfiguration config, PlayerJoinEvent play return; essentialsXDiscordHook.sendJoinMessage(Settings.hook_essentialsDiscord_channelid, - Util.colorless(json.getText())); + Util.colorless(messageBuilder.getText())); } } else if (isModifyType) { @@ -116,33 +116,33 @@ public void onJoin(Player player, FileConfiguration config, PlayerJoinEvent play if (isHover) { if (isClick) { if (isClick_Mode.equalsIgnoreCase("command")) { - json.setHover(Hover_Text).setExecuteCommand(Action_Command).sendToAll(); + messageBuilder.setHover(Hover_Text).setExecuteCommand(Action_Command).sendToAll(); } else if (isClick_Mode.equalsIgnoreCase("url")) { - json.setHover(Hover_Text).setOpenURL(Action_Url).sendToAll(); + messageBuilder.setHover(Hover_Text).setOpenURL(Action_Url).sendToAll(); } else if (isClick_Mode.equalsIgnoreCase("suggest")) { - json.setHover(Hover_Text).setSuggestCommand(Action_Suggest).sendToAll(); + messageBuilder.setHover(Hover_Text).setSuggestCommand(Action_Suggest).sendToAll(); } } else { - json.setHover(Hover_Text).sendToAll(); + messageBuilder.setHover(Hover_Text).sendToAll(); } } else { if (isClick) { if (isClick_Mode.equalsIgnoreCase("command")) { - json.setExecuteCommand(Action_Command).sendToAll(); + messageBuilder.setExecuteCommand(Action_Command).sendToAll(); } else if (isClick_Mode.equalsIgnoreCase("url")) { - json.setOpenURL(Action_Url).sendToAll(); + messageBuilder.setOpenURL(Action_Url).sendToAll(); } else if (isClick_Mode.equalsIgnoreCase("suggest")) { - json.setSuggestCommand(Action_Suggest).sendToAll(); + messageBuilder.setSuggestCommand(Action_Suggest).sendToAll(); } } else { - json.sendToAll(); + messageBuilder.sendToAll(); } } if (discordSRVHHook.isEnabled()) { DiscordUtil.sendMessageBlocking( DiscordUtil.getTextChannelById(Settings.hook_discordsrv_channelid), - Util.colorless(json.getText())); + Util.colorless(messageBuilder.getText())); } if (isTitle) { @@ -181,9 +181,9 @@ public void onQuit(Player player, @NotNull FileConfiguration config, PlayerQuitE quit = Util.color(Util.getVar(player, quit)); - Json json = new Json(player, quit); + MessageBuilder messageBuilder = new MessageBuilder(player, quit); if (config.getBoolean("Config.Show-Chat-In-Console")) { - Logger.info(json.getText()); + Logger.info(messageBuilder.getText()); } if (isNormalType) { @@ -193,14 +193,14 @@ public void onQuit(Player player, @NotNull FileConfiguration config, PlayerQuitE return; DiscordUtil.sendMessageBlocking( DiscordUtil.getTextChannelById(Settings.hook_discordsrv_channelid), - Util.colorless(json.getText())); + Util.colorless(messageBuilder.getText())); } if (essentialsXDiscordHook.isEnabled()) { if (Settings.hook_essentialsDiscord_channelid.equalsIgnoreCase("none")) return; essentialsXDiscordHook.sendQuitMessage(Settings.hook_essentialsDiscord_channelid, - Util.colorless(json.getText())); + Util.colorless(messageBuilder.getText())); } } else if (isModifyType) { @@ -223,26 +223,26 @@ public void onQuit(Player player, @NotNull FileConfiguration config, PlayerQuitE if (isHover) { if (isClick) { if (isClick_Mode.equalsIgnoreCase("command")) { - json.setHover(Hover_Text).setExecuteCommand(Action_Command).sendToAll(); + messageBuilder.setHover(Hover_Text).setExecuteCommand(Action_Command).sendToAll(); } else if (isClick_Mode.equalsIgnoreCase("url")) { - json.setHover(Hover_Text).setOpenURL(Action_Url).sendToAll(); + messageBuilder.setHover(Hover_Text).setOpenURL(Action_Url).sendToAll(); } else if (isClick_Mode.equalsIgnoreCase("suggest")) { - json.setHover(Hover_Text).setSuggestCommand(Action_Suggest).sendToAll(); + messageBuilder.setHover(Hover_Text).setSuggestCommand(Action_Suggest).sendToAll(); } } else { - json.setHover(Hover_Text).sendToAll(); + messageBuilder.setHover(Hover_Text).sendToAll(); } } else { if (isClick) { if (isClick_Mode.equalsIgnoreCase("command")) { - json.setExecuteCommand(Action_Command).sendToAll(); + messageBuilder.setExecuteCommand(Action_Command).sendToAll(); } else if (isClick_Mode.equalsIgnoreCase("url")) { - json.setOpenURL(Action_Url).sendToAll(); + messageBuilder.setOpenURL(Action_Url).sendToAll(); } else if (isClick_Mode.equalsIgnoreCase("suggest")) { - json.setSuggestCommand(Action_Suggest).sendToAll(); + messageBuilder.setSuggestCommand(Action_Suggest).sendToAll(); } } else { - json.sendToAll(); + messageBuilder.sendToAll(); } } @@ -253,7 +253,7 @@ public void onQuit(Player player, @NotNull FileConfiguration config, PlayerQuitE DiscordUtil.sendMessageBlocking( DiscordUtil.getTextChannelById(Settings.hook_discordsrv_channelid), - Util.colorless(json.getText())); + Util.colorless(messageBuilder.getText())); } if (essentialsXDiscordHook.isEnabled()) { @@ -262,7 +262,7 @@ public void onQuit(Player player, @NotNull FileConfiguration config, PlayerQuitE return; essentialsXDiscordHook.sendQuitMessage(Settings.hook_essentialsDiscord_channelid, - Util.colorless(json.getText())); + Util.colorless(messageBuilder.getText())); } try { From 175dea93d14e1f931ad4ecab912037e2331d2029 Mon Sep 17 00:00:00 2001 From: SrJss <31166687+jonagamerpro1234@users.noreply.github.com> Date: Sat, 7 Jan 2023 23:34:39 -0300 Subject: [PATCH 10/27] minor bug fix --- CustomJoinAndQuitMessagesOld/pom.xml | 2 +- CustomJoinAndQuitMessagesOld/src/main/resources/config.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CustomJoinAndQuitMessagesOld/pom.xml b/CustomJoinAndQuitMessagesOld/pom.xml index 1456b85..ccd2cdc 100644 --- a/CustomJoinAndQuitMessagesOld/pom.xml +++ b/CustomJoinAndQuitMessagesOld/pom.xml @@ -9,7 +9,7 @@ CustomJoinAndQuitMessagesOld - 1.7.6-Release + 1.7.7-release 11 diff --git a/CustomJoinAndQuitMessagesOld/src/main/resources/config.yml b/CustomJoinAndQuitMessagesOld/src/main/resources/config.yml index 7ddcc2d..147ca80 100644 --- a/CustomJoinAndQuitMessagesOld/src/main/resources/config.yml +++ b/CustomJoinAndQuitMessagesOld/src/main/resources/config.yml @@ -14,7 +14,7 @@ Config: # |Lang| you can use the available languages of the plugin, or you can add your own translations [ Default = en-US ] - Lang: en-US + Lang: en_US # |Update| This function lets you know if there is a plugin update [Does not disable console messages] Update: true From 95d58273cfc648bed7ea58cd1e62693d866fa43f Mon Sep 17 00:00:00 2001 From: SrJss <31166687+jonagamerpro1234@users.noreply.github.com> Date: Tue, 31 Jan 2023 22:54:25 -0300 Subject: [PATCH 11/27] Added update detection on GitHub --- .../CustomJoinAndQuitMessages.java | 16 +--- .../commands/CommandHandler.java | 4 + .../commands/subcommands/HelpCmd.java | 4 + .../commands/utils/SubCommand.java | 17 ++++ .../json/MessageBuilder.java | 1 - .../listener/JoinListener.java | 9 +- .../utils/UpdateChecker.java | 82 +++++++++++++++++-- .../utils/UpdateSettings.java | 4 +- .../customjoinandquitmessages/utils/Util.java | 5 ++ .../utils/interfaces/UpdateHelper.java | 7 -- .../commands/subcommands/HelpCommand.java | 4 +- .../commands/utils/SubCommand.java | 2 + 12 files changed, 114 insertions(+), 41 deletions(-) create mode 100644 CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/commands/CommandHandler.java create mode 100644 CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/commands/subcommands/HelpCmd.java create mode 100644 CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/commands/utils/SubCommand.java delete mode 100644 CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/utils/interfaces/UpdateHelper.java diff --git a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/CustomJoinAndQuitMessages.java b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/CustomJoinAndQuitMessages.java index 3aee1cf..5035cc9 100644 --- a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/CustomJoinAndQuitMessages.java +++ b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/CustomJoinAndQuitMessages.java @@ -76,19 +76,9 @@ public void onEnable() { setupEvents(); setupCommands(); - new UpdateChecker(this, UpdateSettings.ID).getUpdateVersion(version -> { - updateVersion = version; - if (this.getDescription().getVersion().equalsIgnoreCase(version)) { - Logger.success("&a" + this.name + " is up to date!"); - } else { - Logger.outLine("&5<||" + Util.setLine("&5")); - Logger.warning("&5<||&b" + this.name + " is outdated!"); - Logger.warning("&5<||&bNewest version: &a" + version); - Logger.warning("&5<||&bYour version: &d" + UpdateSettings.VERSION); - Logger.warning("&5<||&bUpdate Here on Spigot: &e" + UpdateSettings.URL_PlUGIN[0]); - Logger.outLine("&5<||" + Util.setLine("&5")); - } - }); + UpdateChecker updateChecker = new UpdateChecker(this); + updateChecker.sendSpigotUpdate(); + updateChecker.sendGithubUpdate(); } public void onDisable() { diff --git a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/commands/CommandHandler.java b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/commands/CommandHandler.java new file mode 100644 index 0000000..0990333 --- /dev/null +++ b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/commands/CommandHandler.java @@ -0,0 +1,4 @@ +package jss.customjoinandquitmessages.commands; + +public class CommandHandler { +} diff --git a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/commands/subcommands/HelpCmd.java b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/commands/subcommands/HelpCmd.java new file mode 100644 index 0000000..26e43e5 --- /dev/null +++ b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/commands/subcommands/HelpCmd.java @@ -0,0 +1,4 @@ +package jss.customjoinandquitmessages.commands.subcommands; + +public class HelpCmd { +} diff --git a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/commands/utils/SubCommand.java b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/commands/utils/SubCommand.java new file mode 100644 index 0000000..9e5edf4 --- /dev/null +++ b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/commands/utils/SubCommand.java @@ -0,0 +1,17 @@ +package jss.customjoinandquitmessages.commands.utils; + +import org.bukkit.command.CommandSender; + +import java.util.List; + +public abstract class SubCommand { + + public abstract String name(); + + public abstract String permission(); + + public abstract boolean perform(CommandSender sender, String[] args); + + public abstract List tabComplete(CommandSender sender, String[] args); + +} diff --git a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/json/MessageBuilder.java b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/json/MessageBuilder.java index b72bc25..64c7eca 100644 --- a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/json/MessageBuilder.java +++ b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/json/MessageBuilder.java @@ -12,7 +12,6 @@ import java.util.List; public class MessageBuilder { - private final Player player; private final String text; private BaseComponent[] hoverText; diff --git a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/listener/JoinListener.java b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/listener/JoinListener.java index 4ffb809..b5b6e13 100644 --- a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/listener/JoinListener.java +++ b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/listener/JoinListener.java @@ -241,14 +241,7 @@ public void onUpdate(@NotNull PlayerJoinEvent e) { Player p = e.getPlayer(); if (Settings.update) { if ((p.isOp()) || (p.hasPermission("Cjm.Update.Notify"))) { - new UpdateChecker(CustomJoinAndQuitMessages.get(), UpdateSettings.ID).getUpdateVersion(version -> { - if (!CustomJoinAndQuitMessages.get().getDescription().getVersion().equalsIgnoreCase(version)) { - TextComponent component = new TextComponent(Util.color(Util.getPrefix(true) - + " &aThere is a new version available for download, Click on this message to copy the link")); - component.setClickEvent(new ClickEvent(Action.OPEN_URL, UpdateSettings.URL_PlUGIN[0])); - p.spigot().sendMessage(component); - } - }); + new UpdateChecker(CustomJoinAndQuitMessages.get()).sendSpigotUpdate(); } } } diff --git a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/utils/UpdateChecker.java b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/utils/UpdateChecker.java index cd6bac3..8b984f2 100644 --- a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/utils/UpdateChecker.java +++ b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/utils/UpdateChecker.java @@ -1,34 +1,98 @@ package jss.customjoinandquitmessages.utils; +import com.google.gson.Gson; +import com.google.gson.JsonObject; import jss.customjoinandquitmessages.CustomJoinAndQuitMessages; -import jss.customjoinandquitmessages.utils.interfaces.UpdateHelper; import org.bukkit.Bukkit; - +import org.jetbrains.annotations.NotNull; import java.io.IOException; import java.io.InputStream; import java.net.URL; import java.util.Scanner; import java.util.function.Consumer; -public class UpdateChecker implements UpdateHelper { +public class UpdateChecker { private final CustomJoinAndQuitMessages plugin; - private final int ID; - public UpdateChecker(CustomJoinAndQuitMessages plugin, int ID) { + public UpdateChecker(CustomJoinAndQuitMessages plugin) { this.plugin = plugin; - this.ID = ID; } - public void getUpdateVersion(Consumer consumer) { + public void sendGithubUpdate(){ + getVersion("github" ,version -> { + if (plugin.getDescription().getVersion().equalsIgnoreCase(version)) { + Logger.success("&a" + plugin.name + " is up to date!"); + } else { + Logger.outLine("&5<||" + Util.setLine("&5")); + Logger.warning("&5<||&b" + plugin.name + " is outdated!"); + Logger.warning("&5<||&bNewest version: &a" + version); + Logger.warning("&5<||&bYour version: &d" + UpdateSettings.VERSION); + Logger.warning("&5<||&bUpdate Here on Github: &e" + UpdateSettings.URL_PlUGIN[1]); + Logger.outLine("&5<||" + Util.setLine("&5")); + } + }); + } + + public void sendSpigotUpdate(){ + getVersion("spigot" ,version -> { + if (plugin.getDescription().getVersion().equalsIgnoreCase(version)) { + Logger.success("&a" + plugin.name + " is up to date!"); + } else { + Logger.outLine("&5<||" + Util.setLine("&5")); + Logger.warning("&5<||&b" + plugin.name + " is outdated!"); + Logger.warning("&5<||&bNewest version: &a" + version); + Logger.warning("&5<||&bYour version: &d" + UpdateSettings.VERSION); + Logger.warning("&5<||&bUpdate Here on Spigot: &e" + UpdateSettings.URL_PlUGIN[0]); + Logger.outLine("&5<||" + Util.setLine("&5")); + } + }); + } + + private void getVersion(@NotNull String source, Consumer consumer) { + String url; + switch (source) { + case "spigot": + url = UpdateSettings.API_UPDATE[0]; + break; + case "github": + url = UpdateSettings.API_UPDATE[1]; + + break; + default: + Logger.error("Invalid source for update check: " + source); + return; + } + + String finalUrl = url; Bukkit.getScheduler().runTaskAsynchronously(this.plugin, () -> { - try (InputStream inputStream = new URL("https://api.spigotmc.org/legacy/update.php?resource=" + this.ID).openStream(); Scanner scanner = new Scanner(inputStream)) { + try (InputStream inputStream = new URL(finalUrl).openStream(); Scanner scanner = new Scanner(inputStream)) { if (scanner.hasNext()) { - consumer.accept(scanner.next()); + + if(source.equals("github")){ + String latestRelease = scanner.next(); + Gson gson = new Gson(); + JsonObject json= gson.fromJson(latestRelease, JsonObject.class); + String versionName = json.get("name").getAsString(); + + if(versionName.contains("Beta")){ + Logger.info("The latest release is a beta version: " + versionName); + Logger.info("You can download the beta Github: " + UpdateSettings.URL_PlUGIN[1]); + }else{ + consumer.accept(scanner.next()); + } + + }else{ + consumer.accept(scanner.next()); + } + + } + } catch (IOException e) { Logger.error("Could not check for updates: &c" + e.getMessage()); } }); } + } diff --git a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/utils/UpdateSettings.java b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/utils/UpdateSettings.java index fe73016..205b798 100644 --- a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/utils/UpdateSettings.java +++ b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/utils/UpdateSettings.java @@ -4,8 +4,8 @@ public class UpdateSettings { - public static String[] URL_PlUGIN = new String[]{"https://www.spigotmc.org/resources/custom-join-and-quit-message-1-7-x-1-16-x.57006/"}; - public static int ID = 57006; + public static String[] URL_PlUGIN = {"https://www.spigotmc.org/resources/custom-join-and-quit-message-1-7-x-1-19-x.57006/","https://github.com/jonagamerpro1234/CustomJoinAndQuitMessages/releases"}; + public static String[] API_UPDATE = {"https://api.spigotmc.org/legacy/update.php?resource=57006","https://api.github.com/repos/jonagamerpro1234/CustomJoinAndQuitMessages/releases/latest"}; private static final CustomJoinAndQuitMessages plugin = CustomJoinAndQuitMessages.get(); public static String VERSION = plugin.version; diff --git a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/utils/Util.java b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/utils/Util.java index 8f2f390..906fd82 100644 --- a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/utils/Util.java +++ b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/utils/Util.java @@ -17,6 +17,7 @@ @SuppressWarnings("deprecation") public class Util { private final static String prefix = getPrefix(true); + private static final String PERMISSION_PREFIX = "cjm."; public static @NotNull String setLine(String color) { return color(color + "-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-"); @@ -166,4 +167,8 @@ public static void setDisabled(String version) { sendEnable(prefix, "&5 <||============================================----"); } + public static boolean setPerm(@NotNull Player player, String permName){ + return player.hasPermission(PERMISSION_PREFIX + permName); + } + } diff --git a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/utils/interfaces/UpdateHelper.java b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/utils/interfaces/UpdateHelper.java deleted file mode 100644 index d1e77be..0000000 --- a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/utils/interfaces/UpdateHelper.java +++ /dev/null @@ -1,7 +0,0 @@ -package jss.customjoinandquitmessages.utils.interfaces; - -import java.util.function.Consumer; - -public interface UpdateHelper { - void getUpdateVersion(Consumer consumer); -} diff --git a/bukkit/src/main/java/jss/customjoinandquitmessage/commands/subcommands/HelpCommand.java b/bukkit/src/main/java/jss/customjoinandquitmessage/commands/subcommands/HelpCommand.java index eec6829..b342400 100644 --- a/bukkit/src/main/java/jss/customjoinandquitmessage/commands/subcommands/HelpCommand.java +++ b/bukkit/src/main/java/jss/customjoinandquitmessage/commands/subcommands/HelpCommand.java @@ -9,7 +9,9 @@ public String name() { return "help"; } - + public String permission(){ + return ""; + } public void onCommand(CommandSender sender, String[] args) { } diff --git a/bukkit/src/main/java/jss/customjoinandquitmessage/commands/utils/SubCommand.java b/bukkit/src/main/java/jss/customjoinandquitmessage/commands/utils/SubCommand.java index 0e402d9..ceb30bf 100644 --- a/bukkit/src/main/java/jss/customjoinandquitmessage/commands/utils/SubCommand.java +++ b/bukkit/src/main/java/jss/customjoinandquitmessage/commands/utils/SubCommand.java @@ -6,6 +6,8 @@ public abstract class SubCommand { public abstract String name(); + public abstract String permission(); + public abstract void onCommand(CommandSender sender, String[] args); public abstract boolean isEnabled(); From 9e2091bbd022d80eeb902dbefe0ff217d003f052 Mon Sep 17 00:00:00 2001 From: SrJss <31166687+jonagamerpro1234@users.noreply.github.com> Date: Fri, 17 Feb 2023 15:31:28 -0300 Subject: [PATCH 12/27] Added update detection on GitHub --- .../CustomJoinAndQuitMessagesOld.iml | 2 +- CustomJoinAndQuitMessagesOld/pom.xml | 5 +- .../CustomJoinAndQuitMessages.java | 16 +++- .../config/utils/FileLister.java | 49 +++++++----- .../config/utils/PreConfigLoader.java | 6 +- .../listener/InventoryListener.java | 55 +++++++------- .../listener/JoinListener.java | 58 ++++++++++++-- .../listener/TaskLoader.java | 4 +- .../storage/PlayerData.java | 45 +++++++++++ .../storage/PlayerJsonStorage.java | 75 +++++++++++++++++++ .../storage/PlayerManager.java | 29 +++++++ .../{utils => update}/UpdateChecker.java | 5 +- .../{utils => update}/UpdateSettings.java | 2 +- .../customjoinandquitmessages/utils/Util.java | 10 +++ .../src/main/resources/config.yml | 23 +++++- 15 files changed, 313 insertions(+), 71 deletions(-) create mode 100644 CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/storage/PlayerData.java create mode 100644 CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/storage/PlayerJsonStorage.java create mode 100644 CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/storage/PlayerManager.java rename CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/{utils => update}/UpdateChecker.java (96%) rename CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/{utils => update}/UpdateSettings.java (93%) diff --git a/CustomJoinAndQuitMessagesOld/CustomJoinAndQuitMessagesOld.iml b/CustomJoinAndQuitMessagesOld/CustomJoinAndQuitMessagesOld.iml index 5b440d6..16b6d1c 100644 --- a/CustomJoinAndQuitMessagesOld/CustomJoinAndQuitMessagesOld.iml +++ b/CustomJoinAndQuitMessagesOld/CustomJoinAndQuitMessagesOld.iml @@ -11,7 +11,7 @@ - + diff --git a/CustomJoinAndQuitMessagesOld/pom.xml b/CustomJoinAndQuitMessagesOld/pom.xml index ccd2cdc..ef87693 100644 --- a/CustomJoinAndQuitMessagesOld/pom.xml +++ b/CustomJoinAndQuitMessagesOld/pom.xml @@ -9,10 +9,10 @@ CustomJoinAndQuitMessagesOld - 1.7.7-release + 1.8.0-release - 11 + 8 UTF-8 @@ -97,6 +97,7 @@ ${project.version} + C:\Users\Alumno\Documents\Server\1.8\plugins diff --git a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/CustomJoinAndQuitMessages.java b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/CustomJoinAndQuitMessages.java index 5035cc9..df9feae 100644 --- a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/CustomJoinAndQuitMessages.java +++ b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/CustomJoinAndQuitMessages.java @@ -1,13 +1,19 @@ package jss.customjoinandquitmessages; import jss.customjoinandquitmessages.commands.CustomJoinAndQuitCmd; -import jss.customjoinandquitmessages.config.*; +import jss.customjoinandquitmessages.config.ConfigFile; +import jss.customjoinandquitmessages.config.GroupsFile; +import jss.customjoinandquitmessages.config.Lang; +import jss.customjoinandquitmessages.config.PlayerFile; import jss.customjoinandquitmessages.config.utils.PreConfigLoader; -import jss.customjoinandquitmessages.manager.HookManager; import jss.customjoinandquitmessages.listener.JoinListener; import jss.customjoinandquitmessages.listener.TaskLoader; +import jss.customjoinandquitmessages.manager.HookManager; import jss.customjoinandquitmessages.manager.InventoryView; -import jss.customjoinandquitmessages.utils.*; +import jss.customjoinandquitmessages.update.UpdateChecker; +import jss.customjoinandquitmessages.utils.Logger; +import jss.customjoinandquitmessages.utils.Settings; +import jss.customjoinandquitmessages.utils.Util; import org.bstats.bukkit.Metrics; import org.bukkit.Bukkit; import org.bukkit.entity.Player; @@ -39,6 +45,8 @@ public class CustomJoinAndQuitMessages extends JavaPlugin { public void onLoad() { Util.sendLoadTitle(version); inventoryViews = new ArrayList<>(); + + Util.createFolder(this,"Players"); } public void onEnable() { @@ -78,7 +86,7 @@ public void onEnable() { UpdateChecker updateChecker = new UpdateChecker(this); updateChecker.sendSpigotUpdate(); - updateChecker.sendGithubUpdate(); + //updateChecker.sendGithubUpdate(); } public void onDisable() { diff --git a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/config/utils/FileLister.java b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/config/utils/FileLister.java index 2fb39f9..02c4c9a 100644 --- a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/config/utils/FileLister.java +++ b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/config/utils/FileLister.java @@ -4,6 +4,8 @@ import jss.customjoinandquitmessages.utils.Logger; import org.bukkit.plugin.java.JavaPlugin; +import java.io.File; +import java.io.FilenameFilter; import java.io.IOException; import java.lang.reflect.Method; import java.nio.file.DirectoryStream; @@ -12,6 +14,7 @@ import java.util.ArrayList; import java.util.Enumeration; import java.util.List; +import java.util.Objects; import java.util.jar.JarEntry; import java.util.jar.JarFile; import java.util.regex.Pattern; @@ -24,7 +27,7 @@ public class FileLister { public List list() throws IOException { List result = new ArrayList<>(); - Path langDir = plugin.getDataFolder().toPath().resolve("lang"); + /*Path langDir = plugin.getDataFolder().toPath().resolve("lang"); Logger.debug("Path: " + langDir); @@ -45,7 +48,6 @@ public List list() throws IOException { } } - Path jarFile; try { @@ -76,25 +78,21 @@ public List list() throws IOException { } } - } - Logger.debug("List of available languages"); - for (String s : result){ - Logger.debug(" * " + s); - } - Logger.debug("============================"); + }*/ + + + File langDir = new File(plugin.getDataFolder(), "lang"); + + Logger.debug("Path: " + langDir); - return result; - } - /* Old lines of the method list() v1.7.5 -> removed in v1.7.6-beta.4 - File localeDir = new File(plugin.getDataFolder(), "lang"); - if (localeDir.exists()) { + if (langDir.exists()) { FilenameFilter ymlFilter = (dir, name) -> { String lowercaseName = name.toLowerCase(); - if (plugin.getConfig().getString("Config.Debug").equals("true")) { + if (plugin.getConfig().getBoolean("Config.Debug")) { Logger.debug("&eLoad Lang File: &9" + name); } - if (lowercaseName.endsWith(".yml") && name.length() == 9 && name.substring(2, 3).equals("-")) { + if (lowercaseName.endsWith(".yml") && name.length() == 9 && name.substring(2, 3).contains("_")) { return true; } else { if (lowercaseName.endsWith(".yml") && !lowercaseName.equals("messages.yml")) { @@ -103,13 +101,13 @@ public List list() throws IOException { return false; } }; - for (String fileName : localeDir.list(ymlFilter)) { + for (String fileName : Objects.requireNonNull(langDir.list(ymlFilter))) { result.add(fileName.replace(".yml", "")); } if (!result.isEmpty()) return result; } - File jarfile = null; + File jarfile; try { Method method = JavaPlugin.class.getDeclaredMethod("getFile"); method.setAccessible(true); @@ -131,11 +129,24 @@ public List list() throws IOException { if (entry.getName().endsWith(".yml")) { String name = entry.getName().replace(".yml", "").replace("lang/", ""); - if (name.length() == 5 && name.substring(2, 3).equals("-")) { + if (name.length() == 5 && name.substring(2, 3).contains("_")) { result.add(name); } } } - jar.close();*/ + jar.close(); + + + Logger.debug("List of available languages"); + for (String s : result){ + Logger.debug(" * " + s); + } + Logger.debug("============================"); + + + return result; + } + + } diff --git a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/config/utils/PreConfigLoader.java b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/config/utils/PreConfigLoader.java index 331f05a..58e7b25 100644 --- a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/config/utils/PreConfigLoader.java +++ b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/config/utils/PreConfigLoader.java @@ -83,7 +83,7 @@ public void loadConfig() { } public boolean loadLangs() { - Settings.defaultLanguage = plugin.getConfig().getString("Config.Lang", "en-US"); + Settings.defaultLanguage = plugin.getConfig().getString("Config.Lang", "en_US"); HashMap availableLocales = new HashMap<>(); FileLister fl = new FileLister(); try { @@ -95,8 +95,8 @@ public boolean loadLangs() { plugin.getLogger().severe("Could not add locales!"); } if (!availableLocales.containsKey(Settings.defaultLanguage)) { - Logger.warning(Util.getPrefix(true) + "&eLoad File: " + Settings.defaultLanguage + ".yml' not found in /lang/ folder. Using /lang/en-US.yml"); - Settings.defaultLanguage = "en-US"; + Logger.warning(Util.getPrefix(true) + "&eLoad File: " + Settings.defaultLanguage + ".yml' not found in /lang/ folder. Using /lang/en_US.yml"); + Settings.defaultLanguage = "en_US"; availableLocales.put(Settings.defaultLanguage, new Lang(plugin, Settings.defaultLanguage, 0)); } plugin.setAvailableLocales(availableLocales); diff --git a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/listener/InventoryListener.java b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/listener/InventoryListener.java index 60b4c24..d89bbae 100644 --- a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/listener/InventoryListener.java +++ b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/listener/InventoryListener.java @@ -40,37 +40,34 @@ public void onInventoryClick(@NotNull InventoryClickEvent e) { DisplayManager displayManager = new DisplayManager(j); - if (slot == 11) { - displayManager.showJoinMessage(); + switch (slot){ + case 11: + displayManager.showJoinMessage(); + break; + + case 13: + displayManager.showQuitMessage(); + break; + case 15: + displayManager.showWelcomeMessage(); + break; + case 29: + displayManager.showTitleMessage(); + break; + case 31: + displayManager.showActionbar(); + break; + case 33: + displayManager.showFirstJoinMessage(); + break; + case 39: + displayManager.showJoinSound(); + break; + case 41: + displayManager.showQuitSound(); + break; } - if (slot == 13) { - displayManager.showQuitMessage(); - } - - if (slot == 15) { - displayManager.showWelcomeMessage(); - } - - if (slot == 29) { - displayManager.showTitleMessage(); - } - - if (slot == 31) { - displayManager.showActionbar(); - } - - if (slot == 33) { - displayManager.showFirstJoinMessage(); - } - - if (slot == 39) { - displayManager.showJoinSound(); - } - - if (slot == 41) { - displayManager.showQuitSound(); - } } } diff --git a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/listener/JoinListener.java b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/listener/JoinListener.java index b5b6e13..337ddaa 100644 --- a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/listener/JoinListener.java +++ b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/listener/JoinListener.java @@ -4,14 +4,20 @@ import com.cryptomorin.xseries.messages.Titles; import github.scarsz.discordsrv.util.DiscordUtil; import jss.customjoinandquitmessages.CustomJoinAndQuitMessages; -import jss.customjoinandquitmessages.hook.*; +import jss.customjoinandquitmessages.hook.DiscordSRVHHook; +import jss.customjoinandquitmessages.hook.EssentialsXDiscordHook; +import jss.customjoinandquitmessages.hook.EssentialsXHook; +import jss.customjoinandquitmessages.hook.LuckPermsHook; import jss.customjoinandquitmessages.json.MessageBuilder; import jss.customjoinandquitmessages.manager.HookManager; import jss.customjoinandquitmessages.manager.PlayerManager; -import jss.customjoinandquitmessages.utils.*; -import net.md_5.bungee.api.chat.ClickEvent; -import net.md_5.bungee.api.chat.ClickEvent.Action; -import net.md_5.bungee.api.chat.TextComponent; +import jss.customjoinandquitmessages.storage.PlayerData; +import jss.customjoinandquitmessages.storage.PlayerJsonStorage; +import jss.customjoinandquitmessages.update.UpdateChecker; +import jss.customjoinandquitmessages.utils.GroupHelper; +import jss.customjoinandquitmessages.utils.Logger; +import jss.customjoinandquitmessages.utils.Settings; +import jss.customjoinandquitmessages.utils.Util; import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.Sound; @@ -43,7 +49,6 @@ public void onJoinListener(@NotNull PlayerJoinEvent e) { EssentialsXDiscordHook essentialsXDiscordHook = HookManager.getInstance().getEssentialsXDiscordHook(); EssentialsXHook essentialsXHook = HookManager.get().getEssentialsXHook(); Player p = e.getPlayer(); - String tempGroup; if (luckPermsHook.isEnabled()) { @@ -52,6 +57,13 @@ public void onJoinListener(@NotNull PlayerJoinEvent e) { tempGroup = "default"; } + PlayerJsonStorage playerJsonStorage = new PlayerJsonStorage(plugin); + PlayerData playerData = playerJsonStorage.loadPlayerData(p.getName()); + + if(playerData == null){ + playerJsonStorage.savePlayerData(new PlayerData(p.getName())); + } + PlayerManager playerManager = new PlayerManager(); playerManager.createPlayer(p, tempGroup); @@ -115,6 +127,7 @@ public void onJoinListener(@NotNull PlayerJoinEvent e) { MessageBuilder messageBuilder = new MessageBuilder(p, text); + //Update Logger if (config.getBoolean("Config.Show-Chat-In-Console")) { Logger.info(messageBuilder.getText()); } @@ -138,6 +151,8 @@ public void onJoinListener(@NotNull PlayerJoinEvent e) { essentialsXDiscordHook.sendJoinMessage(Settings.hook_essentialsDiscord_channelid, Util.colorless(messageBuilder.getText())); } + + //Removed IsModifyType in 1.8.0 } else if (isModifyType) { boolean isHover = Objects.equals(config.getString("Join.HoverEvent.Enabled"), "true"); boolean isClick = Objects.equals(config.getString("Join.ClickEvent.Enabled"), "true"); @@ -152,6 +167,9 @@ public void onJoinListener(@NotNull PlayerJoinEvent e) { String Action_Command = config.getString("Join.ClickEvent.Actions.Command"); String Action_Url = config.getString("Join.ClickEvent.Actions.Url"); String Action_Suggest = config.getString("Join.ClickEvent.Actions.Suggest-Command"); + + List Action_Dev = config.getStringList("Join.ClickEvent.DevActions"); + String Title_Text = config.getString("Join.Title.Title"); String SubTitle_Text = config.getString("Join.Title.SubTitle"); String Actionbar_Text = config.getString("Join.ActionBar.Text"); @@ -178,7 +196,33 @@ public void onJoinListener(@NotNull PlayerJoinEvent e) { messageBuilder.setHover(Hover_Text).sendToAll(); } } else { + if (isClick) { + + for(String action : Action_Dev){ + + String[] parts = action.split(":"); + String type = parts[0].trim(); + String value = parts[1].trim(); + + switch (type){ + case "[Execute]": + messageBuilder.setExecuteCommand(value); + break; + case "[Suggest]": + messageBuilder.setSuggestCommand(value); + break; + case "[Open]": + messageBuilder.setOpenURL(value); + break; + default: + messageBuilder.sendToAll(); + break; + } + } + messageBuilder.sendToAll(); + + /** Temp Disabled assert isClick_Mode != null; if (isClick_Mode.equalsIgnoreCase("command")) { messageBuilder.setExecuteCommand(Action_Command).sendToAll(); @@ -187,6 +231,8 @@ public void onJoinListener(@NotNull PlayerJoinEvent e) { } else if (isClick_Mode.equalsIgnoreCase("suggest")) { messageBuilder.setSuggestCommand(Action_Suggest).sendToAll(); } + */ + } else { messageBuilder.sendToAll(); } diff --git a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/listener/TaskLoader.java b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/listener/TaskLoader.java index baa7198..05da0b3 100644 --- a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/listener/TaskLoader.java +++ b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/listener/TaskLoader.java @@ -1,8 +1,8 @@ package jss.customjoinandquitmessages.listener; import jss.customjoinandquitmessages.CustomJoinAndQuitMessages; -import jss.customjoinandquitmessages.manager.HookManager; import jss.customjoinandquitmessages.hook.LuckPermsHook; +import jss.customjoinandquitmessages.manager.HookManager; import jss.customjoinandquitmessages.manager.PlayerManager; import jss.customjoinandquitmessages.utils.Logger; import jss.customjoinandquitmessages.utils.Settings; @@ -28,6 +28,7 @@ public void onUpdateGroup() { if(Settings.c_type.equalsIgnoreCase("group")){ if (luckPermsHook.isEnabled() && Settings.hook_luckperms_autoUpdate_group) { + for (Player p : Bukkit.getOnlinePlayers()) { PlayerManager playerManager = new PlayerManager(); if (!playerManager.getGroup(p).equalsIgnoreCase(Objects.requireNonNull(LuckPermsHook.getApi().getUserManager().getUser(p.getName())).getPrimaryGroup())) { @@ -36,6 +37,7 @@ public void onUpdateGroup() { Logger.debug("&eThe player already has the same group!"); } } + } else { scheduler.cancelTask(taskGroupId); } diff --git a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/storage/PlayerData.java b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/storage/PlayerData.java new file mode 100644 index 0000000..a72e644 --- /dev/null +++ b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/storage/PlayerData.java @@ -0,0 +1,45 @@ +package jss.customjoinandquitmessages.storage; + +import java.util.List; + +public class PlayerData { + + private final String name; + private String group; + private List joinMessages, quitMessages; + + public PlayerData(String name) { + this.name = name; + this.group = "default"; + this.joinMessages = null; + this.quitMessages = null; + } + + public String getName() { + return name; + } + + public String getGroup() { + return group; + } + + public void setGroup(String group) { + this.group = group; + } + + public List getJoinMessages() { + return joinMessages; + } + + public void setJoinMessages(List joinMessages) { + this.joinMessages = joinMessages; + } + + public List getQuitMessages() { + return quitMessages; + } + + public void setQuitMessages(List quitMessages) { + this.quitMessages = quitMessages; + } +} diff --git a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/storage/PlayerJsonStorage.java b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/storage/PlayerJsonStorage.java new file mode 100644 index 0000000..7e10150 --- /dev/null +++ b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/storage/PlayerJsonStorage.java @@ -0,0 +1,75 @@ +package jss.customjoinandquitmessages.storage; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import jss.customjoinandquitmessages.CustomJoinAndQuitMessages; +import org.jetbrains.annotations.NotNull; + +import java.io.File; +import java.io.FileReader; +import java.io.FileWriter; +import java.io.IOException; + +public class PlayerJsonStorage { + + private final Gson gson; + private File file; + + private final String basePath; + + public PlayerJsonStorage(@NotNull CustomJoinAndQuitMessages plugin) { + this.gson = new GsonBuilder().setPrettyPrinting().create(); + basePath = plugin.getDataFolder() + File.separator + "Players"; + } + + public void savePlayerData(@NotNull PlayerData playerData) { + file = new File(basePath, playerData.getName() + ".json"); + if(file.exists()){ + try (FileWriter writer = new FileWriter(file)) { + gson.toJson(playerData, writer); + } catch (IOException e) { + e.printStackTrace(); + } + }else { + System.out.println("archivo no existe, se procede a crearlo"); + try{ + file.createNewFile(); + FileWriter writer = new FileWriter(file); + gson.toJson(playerData,writer); + writer.flush(); + writer.close(); + }catch (IOException ex){ + ex.printStackTrace(); + } + } + } + + public PlayerData loadPlayerData(String playerName) { + file = new File(basePath, playerName + ".json"); + if(file.exists()){ + try (FileReader reader = new FileReader(file)) { + return gson.fromJson(reader, PlayerData.class); + } catch (IOException e) { + e.printStackTrace(); + return null; + } + }else { + System.out.println("archivo no existe, se procede a crearlo"); + try { + file.createNewFile(); + return new PlayerData(playerName); + } catch (IOException e) { + e.printStackTrace(); + return null; + } + } + } + + public void removePlayerData(String playerName) { + file = new File(basePath, playerName + ".json"); + if (file.exists()){ + file.delete(); + } + } + +} diff --git a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/storage/PlayerManager.java b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/storage/PlayerManager.java new file mode 100644 index 0000000..1e9bbb4 --- /dev/null +++ b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/storage/PlayerManager.java @@ -0,0 +1,29 @@ +package jss.customjoinandquitmessages.storage; + +import jss.customjoinandquitmessages.CustomJoinAndQuitMessages; + +public class PlayerManager { + + private final PlayerData playerData; + private final PlayerJsonStorage playerJsonStorage = new PlayerJsonStorage(CustomJoinAndQuitMessages.get()); + + public PlayerManager(String name){ + playerData = playerJsonStorage.loadPlayerData(name); + } + + public String getName(){ + return playerData.getName(); + } + + public String getGroup(){ + return playerData.getGroup(); + } + + public void setGroup(String group){ + playerData.setGroup(group); + } + + public void savePlayerData(){ + playerJsonStorage.savePlayerData(playerData); + } +} diff --git a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/utils/UpdateChecker.java b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/update/UpdateChecker.java similarity index 96% rename from CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/utils/UpdateChecker.java rename to CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/update/UpdateChecker.java index 8b984f2..7bb9dbd 100644 --- a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/utils/UpdateChecker.java +++ b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/update/UpdateChecker.java @@ -1,10 +1,13 @@ -package jss.customjoinandquitmessages.utils; +package jss.customjoinandquitmessages.update; import com.google.gson.Gson; import com.google.gson.JsonObject; import jss.customjoinandquitmessages.CustomJoinAndQuitMessages; +import jss.customjoinandquitmessages.utils.Logger; +import jss.customjoinandquitmessages.utils.Util; import org.bukkit.Bukkit; import org.jetbrains.annotations.NotNull; + import java.io.IOException; import java.io.InputStream; import java.net.URL; diff --git a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/utils/UpdateSettings.java b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/update/UpdateSettings.java similarity index 93% rename from CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/utils/UpdateSettings.java rename to CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/update/UpdateSettings.java index 205b798..8af1f57 100644 --- a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/utils/UpdateSettings.java +++ b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/update/UpdateSettings.java @@ -1,4 +1,4 @@ -package jss.customjoinandquitmessages.utils; +package jss.customjoinandquitmessages.update; import jss.customjoinandquitmessages.CustomJoinAndQuitMessages; diff --git a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/utils/Util.java b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/utils/Util.java index 906fd82..7f30380 100644 --- a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/utils/Util.java +++ b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/utils/Util.java @@ -1,5 +1,6 @@ package jss.customjoinandquitmessages.utils; +import jss.customjoinandquitmessages.CustomJoinAndQuitMessages; import jss.customjoinandquitmessages.libs.iridiumcolorapi.IridiumColorAPI; import me.clip.placeholderapi.PlaceholderAPI; import net.md_5.bungee.api.ChatColor; @@ -11,6 +12,7 @@ import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; +import java.io.File; import java.util.ArrayList; import java.util.List; @@ -171,4 +173,12 @@ public static boolean setPerm(@NotNull Player player, String permName){ return player.hasPermission(PERMISSION_PREFIX + permName); } + @SuppressWarnings("ResultOfMethodCallIgnored") + public static void createFolder(@NotNull CustomJoinAndQuitMessages plugin, String folderName){ + File file = new File(plugin.getDataFolder(), folderName); + if(!file.exists()){ + file.mkdir(); + } + } + } diff --git a/CustomJoinAndQuitMessagesOld/src/main/resources/config.yml b/CustomJoinAndQuitMessagesOld/src/main/resources/config.yml index 147ca80..6eb0afb 100644 --- a/CustomJoinAndQuitMessagesOld/src/main/resources/config.yml +++ b/CustomJoinAndQuitMessagesOld/src/main/resources/config.yml @@ -17,7 +17,15 @@ Config: Lang: en_US # |Update| This function lets you know if there is a plugin update [Does not disable console messages] - Update: true + Update: + + # |Enabled| Here you can enable or disable this feature + Enabled: true + + # |GetUpdateFrom| you will get the updates from [spigot | github] what is the difference, here below is the explanation of why + # |Spigot| Get only released updates, and you won't receive beta notifications + # |GitHub| Get only the released and beta updates, and you will be able to receive notifications of both versions + GetUpdateFrom: Spigot # |Debug| shows you important information about the plugin loading Debug: true @@ -213,7 +221,12 @@ Quit: # |Mode| there are three different modes which are [ command | suggest | url ] Mode: command - + + DevActions: + - '[Suggest]: /help' + - '[Execute]: /me hola test' + - '[Open]: https://www.spigotmc.org/resources/custom-join-and-quit-message-1-7-x-1-17-x.57006/' + # |Actions| This is where are the available events that you can use Actions: @@ -225,7 +238,7 @@ Quit: # |Suggest-Command| Clicking on the chat suggests a command that you define in the config Suggest-Command: '/msg ' - + # |Sound| In this section you can configure the sound of the join # |Sound list: https://www.spigotmc.org/wiki/cc-sounds-list/ Sound: @@ -250,7 +263,9 @@ Welcome: # |Enabled| Here you can enable or disable this feature Enabled: true - + + UsePerGroupWelcome: false + # |Text| here you can set your own welcome message when entering Text: - '&m=========================================&r' From 033b062d7d16226083434d544504c872ef0fa129 Mon Sep 17 00:00:00 2001 From: SrJss <31166687+jonagamerpro1234@users.noreply.github.com> Date: Fri, 17 Feb 2023 16:25:08 -0300 Subject: [PATCH 13/27] added compatibility with SuperVanish and PremiumVanish --- .../CustomJoinAndQuitMessagesOld.iml | 1 + CustomJoinAndQuitMessagesOld/pom.xml | 8 +++- .../config/utils/FileLister.java | 5 --- .../config/utils/PreConfigLoader.java | 2 +- .../hook/SuperVanishHook.java | 34 +++++++++++++++ .../listener/JoinListener.java | 42 +++++++++++++++---- .../manager/HookManager.java | 14 +++++-- .../customjoinandquitmessages/utils/Util.java | 9 ++++ .../src/main/resources/config.yml | 16 +++---- .../src/main/resources/plugin.yml | 7 ++-- 10 files changed, 108 insertions(+), 30 deletions(-) create mode 100644 CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/hook/SuperVanishHook.java diff --git a/CustomJoinAndQuitMessagesOld/CustomJoinAndQuitMessagesOld.iml b/CustomJoinAndQuitMessagesOld/CustomJoinAndQuitMessagesOld.iml index 16b6d1c..080334c 100644 --- a/CustomJoinAndQuitMessagesOld/CustomJoinAndQuitMessagesOld.iml +++ b/CustomJoinAndQuitMessagesOld/CustomJoinAndQuitMessagesOld.iml @@ -89,5 +89,6 @@ + \ No newline at end of file diff --git a/CustomJoinAndQuitMessagesOld/pom.xml b/CustomJoinAndQuitMessagesOld/pom.xml index ef87693..bf10789 100644 --- a/CustomJoinAndQuitMessagesOld/pom.xml +++ b/CustomJoinAndQuitMessagesOld/pom.xml @@ -9,7 +9,7 @@ CustomJoinAndQuitMessagesOld - 1.8.0-release + 1.7.8-release 8 @@ -227,6 +227,12 @@ commons-lang3 3.12.0 + + com.github.LeonMangler + SuperVanish + 6.2.6-4 + provided + \ No newline at end of file diff --git a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/config/utils/FileLister.java b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/config/utils/FileLister.java index 02c4c9a..248ca92 100644 --- a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/config/utils/FileLister.java +++ b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/config/utils/FileLister.java @@ -8,16 +8,12 @@ import java.io.FilenameFilter; import java.io.IOException; import java.lang.reflect.Method; -import java.nio.file.DirectoryStream; -import java.nio.file.Files; -import java.nio.file.Path; import java.util.ArrayList; import java.util.Enumeration; import java.util.List; import java.util.Objects; import java.util.jar.JarEntry; import java.util.jar.JarFile; -import java.util.regex.Pattern; public class FileLister { @@ -137,7 +133,6 @@ public List list() throws IOException { } jar.close(); - Logger.debug("List of available languages"); for (String s : result){ Logger.debug(" * " + s); diff --git a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/config/utils/PreConfigLoader.java b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/config/utils/PreConfigLoader.java index 58e7b25..15e4d42 100644 --- a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/config/utils/PreConfigLoader.java +++ b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/config/utils/PreConfigLoader.java @@ -25,7 +25,7 @@ public void loadConfig() { //Other Settings.settings_debug = config.getBoolean("Config.Debug"); - Settings.update = Objects.equals(config.getString("Config.Update"), "true"); + Settings.update = Objects.equals(config.getString("Config.Update.Enabled"), "true"); Settings.c_type = config.getString("Config.Type"); Settings.is_Group_Display = Objects.requireNonNull(config.getString("Config.Type")).equalsIgnoreCase("group"); diff --git a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/hook/SuperVanishHook.java b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/hook/SuperVanishHook.java new file mode 100644 index 0000000..eeae565 --- /dev/null +++ b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/hook/SuperVanishHook.java @@ -0,0 +1,34 @@ +package jss.customjoinandquitmessages.hook; + +import de.myzelyam.api.vanish.VanishAPI; +import jss.customjoinandquitmessages.utils.EventUtils; +import jss.customjoinandquitmessages.utils.Logger; +import jss.customjoinandquitmessages.utils.Util; +import jss.customjoinandquitmessages.utils.interfaces.IHook; +import org.bukkit.Bukkit; +import org.bukkit.entity.Player; + +public class SuperVanishHook implements IHook { + + private boolean isEnabled; + + public void setup() { + if (!Bukkit.getPluginManager().isPluginEnabled("SuperVanish") || !Bukkit.getPluginManager().isPluginEnabled("PremiumVanish")) { + Logger.warning("&eSuperVanish or PremiumVanish not enabled! - Disable Features..."); + this.isEnabled = false; + return; + } + + this.isEnabled = true; + Util.sendColorMessage(EventUtils.getStaticConsoleSender(), Util.getPrefix(true) + "&aLoading SuperVanish or PremiumVanish features..."); + + } + + public boolean isEnabled() { + return isEnabled; + } + + public boolean isVanishPlayer(Player player){ + return VanishAPI.isInvisible(player); + } +} diff --git a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/listener/JoinListener.java b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/listener/JoinListener.java index 337ddaa..1b17fb1 100644 --- a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/listener/JoinListener.java +++ b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/listener/JoinListener.java @@ -4,10 +4,7 @@ import com.cryptomorin.xseries.messages.Titles; import github.scarsz.discordsrv.util.DiscordUtil; import jss.customjoinandquitmessages.CustomJoinAndQuitMessages; -import jss.customjoinandquitmessages.hook.DiscordSRVHHook; -import jss.customjoinandquitmessages.hook.EssentialsXDiscordHook; -import jss.customjoinandquitmessages.hook.EssentialsXHook; -import jss.customjoinandquitmessages.hook.LuckPermsHook; +import jss.customjoinandquitmessages.hook.*; import jss.customjoinandquitmessages.json.MessageBuilder; import jss.customjoinandquitmessages.manager.HookManager; import jss.customjoinandquitmessages.manager.PlayerManager; @@ -48,6 +45,7 @@ public void onJoinListener(@NotNull PlayerJoinEvent e) { LuckPermsHook luckPermsHook = HookManager.getInstance().getLuckPermsHook(); EssentialsXDiscordHook essentialsXDiscordHook = HookManager.getInstance().getEssentialsXDiscordHook(); EssentialsXHook essentialsXHook = HookManager.get().getEssentialsXHook(); + SuperVanishHook superVanishHook = HookManager.get().getSuperVanishHook(); Player p = e.getPlayer(); String tempGroup; @@ -92,6 +90,18 @@ public void onJoinListener(@NotNull PlayerJoinEvent e) { Util.sendColorMessage(p, Util.getVar(p, text)); } + if(Util.isVanished(p)){ + e.setJoinMessage(null); + return; + } + + if (superVanishHook.isEnabled()){ + if (superVanishHook.isVanishPlayer(p)){ + e.setJoinMessage(null); + return; + } + } + if (essentialsXHook.isEnabled()) { if (Settings.hook_essentials_hideplayervanish) { if (essentialsXHook.isVanish(p)) { @@ -168,7 +178,7 @@ public void onJoinListener(@NotNull PlayerJoinEvent e) { String Action_Url = config.getString("Join.ClickEvent.Actions.Url"); String Action_Suggest = config.getString("Join.ClickEvent.Actions.Suggest-Command"); - List Action_Dev = config.getStringList("Join.ClickEvent.DevActions"); + //List Action_Dev = config.getStringList("Join.ClickEvent.DevActions"); String Title_Text = config.getString("Join.Title.Title"); String SubTitle_Text = config.getString("Join.Title.SubTitle"); @@ -199,7 +209,7 @@ public void onJoinListener(@NotNull PlayerJoinEvent e) { if (isClick) { - for(String action : Action_Dev){ + /*for(String action : Action_Dev){ String[] parts = action.split(":"); String type = parts[0].trim(); @@ -220,9 +230,8 @@ public void onJoinListener(@NotNull PlayerJoinEvent e) { break; } } - messageBuilder.sendToAll(); + messageBuilder.sendToAll();*/ - /** Temp Disabled assert isClick_Mode != null; if (isClick_Mode.equalsIgnoreCase("command")) { messageBuilder.setExecuteCommand(Action_Command).sendToAll(); @@ -231,7 +240,7 @@ public void onJoinListener(@NotNull PlayerJoinEvent e) { } else if (isClick_Mode.equalsIgnoreCase("suggest")) { messageBuilder.setSuggestCommand(Action_Suggest).sendToAll(); } - */ + } else { messageBuilder.sendToAll(); @@ -300,12 +309,25 @@ public void onQuit(@NotNull PlayerQuitEvent e) { DiscordSRVHHook discordSRVHHook = HookManager.getInstance().getDiscordSRVHHook(); EssentialsXDiscordHook essentialsXDiscordHook = HookManager.getInstance().getEssentialsXDiscordHook(); EssentialsXHook essentialsXHook = HookManager.get().getEssentialsXHook(); + SuperVanishHook superVanishHook = HookManager.get().getSuperVanishHook(); PlayerManager playerManager = new PlayerManager(); boolean isNormal = Settings.c_type.equalsIgnoreCase("normal"); boolean isGroup = Settings.c_type.equalsIgnoreCase("group"); boolean isNone = Settings.c_type.equalsIgnoreCase("none"); + if(Util.isVanished(p)){ + e.setQuitMessage(null); + return; + } + + if (superVanishHook.isEnabled()){ + if (superVanishHook.isVanishPlayer(p)){ + e.setQuitMessage(null); + return; + } + } + if (essentialsXHook.isEnabled()) { if (Settings.hook_essentials_hideplayervanish) { if (essentialsXHook.isVanish(p)) { @@ -443,4 +465,6 @@ public void onQuit(@NotNull PlayerQuitEvent e) { } } + + } diff --git a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/manager/HookManager.java b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/manager/HookManager.java index 38d2301..80b193a 100644 --- a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/manager/HookManager.java +++ b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/manager/HookManager.java @@ -11,6 +11,7 @@ public class HookManager { private final EssentialsXDiscordHook essentialsXDiscordHook = new EssentialsXDiscordHook(this); private final EssentialsXHook essentialsXHook = new EssentialsXHook(this); private final LuckPermsHook luckPermsHook = new LuckPermsHook(); + private final SuperVanishHook superVanishHook = new SuperVanishHook(); public HookManager() { instance = this; @@ -26,10 +27,11 @@ public static HookManager get() { public void load() { initHooks(new PlaceholderApiHook(this), - new DiscordSRVHHook(this), - new EssentialsXDiscordHook(this), - new EssentialsXHook(this), - luckPermsHook); + discordSRVHHook, + essentialsXDiscordHook, + essentialsXHook, + luckPermsHook, + superVanishHook); } private void initHooks(IHook @NotNull ... hooks) { @@ -53,4 +55,8 @@ public EssentialsXHook getEssentialsXHook() { public LuckPermsHook getLuckPermsHook() { return luckPermsHook; } + + public SuperVanishHook getSuperVanishHook() { + return superVanishHook; + } } diff --git a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/utils/Util.java b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/utils/Util.java index 7f30380..4d1a330 100644 --- a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/utils/Util.java +++ b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/utils/Util.java @@ -8,6 +8,7 @@ import org.bukkit.Bukkit; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; +import org.bukkit.metadata.MetadataValue; import org.jetbrains.annotations.Contract; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -169,6 +170,7 @@ public static void setDisabled(String version) { sendEnable(prefix, "&5 <||============================================----"); } + @SuppressWarnings("unused") public static boolean setPerm(@NotNull Player player, String permName){ return player.hasPermission(PERMISSION_PREFIX + permName); } @@ -181,4 +183,11 @@ public static void createFolder(@NotNull CustomJoinAndQuitMessages plugin, Strin } } + public static boolean isVanished(@NotNull Player player) { + for (MetadataValue meta : player.getMetadata("vanished")) { + if (meta.asBoolean()) return true; + } + return false; + } + } diff --git a/CustomJoinAndQuitMessagesOld/src/main/resources/config.yml b/CustomJoinAndQuitMessagesOld/src/main/resources/config.yml index 6eb0afb..8abb878 100644 --- a/CustomJoinAndQuitMessagesOld/src/main/resources/config.yml +++ b/CustomJoinAndQuitMessagesOld/src/main/resources/config.yml @@ -22,13 +22,14 @@ Config: # |Enabled| Here you can enable or disable this feature Enabled: true + # !!This feature is not available yet!! # |GetUpdateFrom| you will get the updates from [spigot | github] what is the difference, here below is the explanation of why # |Spigot| Get only released updates, and you won't receive beta notifications # |GitHub| Get only the released and beta updates, and you will be able to receive notifications of both versions GetUpdateFrom: Spigot # |Debug| shows you important information about the plugin loading - Debug: true + Debug: false # |Type| the type is a way of knowing what is being used whether in the [normal] | [group] | [none] format Type: normal @@ -127,7 +128,13 @@ Join: # |Mode| there are three different modes which are [ command | suggest | url ] Mode: command - + + # This feature is not available yet + DevActions: + - '[Suggest]: /help' + - '[Execute]: /me hello test' + - '[Open]: https://www.spigotmc.org/resources/custom-join-and-quit-message-1-7-x-1-17-x.57006/' + # |Actions| This is where are the available events that you can use Actions: @@ -222,11 +229,6 @@ Quit: # |Mode| there are three different modes which are [ command | suggest | url ] Mode: command - DevActions: - - '[Suggest]: /help' - - '[Execute]: /me hola test' - - '[Open]: https://www.spigotmc.org/resources/custom-join-and-quit-message-1-7-x-1-17-x.57006/' - # |Actions| This is where are the available events that you can use Actions: diff --git a/CustomJoinAndQuitMessagesOld/src/main/resources/plugin.yml b/CustomJoinAndQuitMessagesOld/src/main/resources/plugin.yml index 3827cb6..7508bea 100644 --- a/CustomJoinAndQuitMessagesOld/src/main/resources/plugin.yml +++ b/CustomJoinAndQuitMessagesOld/src/main/resources/plugin.yml @@ -9,7 +9,8 @@ loadbefore: [ Essentials ] softdepend: [ PlaceholderAPI, DiscordSRV, LuckPerms, EssentialsDiscord, - Essentials + Essentials, SuperVanish, + PremiumVanish ] commands: @@ -18,7 +19,7 @@ commands: aliases: - cjm permissions: - cjm.Admin: + cjm.admin: description: give the all permissions children: cjm.update: true @@ -26,7 +27,7 @@ permissions: cjm.command.help: true cjm.command.tabcomplete: true default: op - cjm.Update: + cjm.update: description: allows you to receive notifications of available updates default: op cjm.command.reload: From 52d1e6b32c970d5470b3f06b418c1d1ef9e3aeb1 Mon Sep 17 00:00:00 2001 From: SrJss <31166687+jonagamerpro1234@users.noreply.github.com> Date: Fri, 17 Feb 2023 16:27:53 -0300 Subject: [PATCH 14/27] . --- ...y_with_SuperVanish_and_PremiumVanish.patch | 422 ++++++++++++++++++ 1 file changed, 422 insertions(+) create mode 100644 patches/added_compatibility_with_SuperVanish_and_PremiumVanish.patch diff --git a/patches/added_compatibility_with_SuperVanish_and_PremiumVanish.patch b/patches/added_compatibility_with_SuperVanish_and_PremiumVanish.patch new file mode 100644 index 0000000..dd3375e --- /dev/null +++ b/patches/added_compatibility_with_SuperVanish_and_PremiumVanish.patch @@ -0,0 +1,422 @@ +Index: CustomJoinAndQuitMessagesOld/CustomJoinAndQuitMessagesOld.iml +IDEA additional info: +Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +<+>UTF-8 +=================================================================== +diff --git a/CustomJoinAndQuitMessagesOld/CustomJoinAndQuitMessagesOld.iml b/CustomJoinAndQuitMessagesOld/CustomJoinAndQuitMessagesOld.iml +--- a/CustomJoinAndQuitMessagesOld/CustomJoinAndQuitMessagesOld.iml (revision 9e2091bbd022d80eeb902dbefe0ff217d003f052) ++++ b/CustomJoinAndQuitMessagesOld/CustomJoinAndQuitMessagesOld.iml (revision 033b062d7d16226083434d544504c872ef0fa129) +@@ -89,5 +89,6 @@ + + + ++ + + +\ No newline at end of file +Index: CustomJoinAndQuitMessagesOld/pom.xml +IDEA additional info: +Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +<+>UTF-8 +=================================================================== +diff --git a/CustomJoinAndQuitMessagesOld/pom.xml b/CustomJoinAndQuitMessagesOld/pom.xml +--- a/CustomJoinAndQuitMessagesOld/pom.xml (revision 9e2091bbd022d80eeb902dbefe0ff217d003f052) ++++ b/CustomJoinAndQuitMessagesOld/pom.xml (revision 033b062d7d16226083434d544504c872ef0fa129) +@@ -9,7 +9,7 @@ + + + CustomJoinAndQuitMessagesOld +- 1.8.0-release ++ 1.7.8-release + + + 8 +@@ -226,6 +226,12 @@ + org.apache.commons + commons-lang3 + 3.12.0 ++ ++ ++ com.github.LeonMangler ++ SuperVanish ++ 6.2.6-4 ++ provided + + + +Index: CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/config/utils/FileLister.java +IDEA additional info: +Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +<+>UTF-8 +=================================================================== +diff --git a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/config/utils/FileLister.java b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/config/utils/FileLister.java +--- a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/config/utils/FileLister.java (revision 9e2091bbd022d80eeb902dbefe0ff217d003f052) ++++ b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/config/utils/FileLister.java (revision 033b062d7d16226083434d544504c872ef0fa129) +@@ -8,16 +8,12 @@ + import java.io.FilenameFilter; + import java.io.IOException; + import java.lang.reflect.Method; +-import java.nio.file.DirectoryStream; +-import java.nio.file.Files; +-import java.nio.file.Path; + import java.util.ArrayList; + import java.util.Enumeration; + import java.util.List; + import java.util.Objects; + import java.util.jar.JarEntry; + import java.util.jar.JarFile; +-import java.util.regex.Pattern; + + + public class FileLister { +@@ -137,7 +133,6 @@ + } + jar.close(); + +- + Logger.debug("List of available languages"); + for (String s : result){ + Logger.debug(" * " + s); +Index: CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/config/utils/PreConfigLoader.java +IDEA additional info: +Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +<+>UTF-8 +=================================================================== +diff --git a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/config/utils/PreConfigLoader.java b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/config/utils/PreConfigLoader.java +--- a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/config/utils/PreConfigLoader.java (revision 9e2091bbd022d80eeb902dbefe0ff217d003f052) ++++ b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/config/utils/PreConfigLoader.java (revision 033b062d7d16226083434d544504c872ef0fa129) +@@ -25,7 +25,7 @@ + + //Other + Settings.settings_debug = config.getBoolean("Config.Debug"); +- Settings.update = Objects.equals(config.getString("Config.Update"), "true"); ++ Settings.update = Objects.equals(config.getString("Config.Update.Enabled"), "true"); + Settings.c_type = config.getString("Config.Type"); + Settings.is_Group_Display = Objects.requireNonNull(config.getString("Config.Type")).equalsIgnoreCase("group"); + +Index: CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/hook/SuperVanishHook.java +IDEA additional info: +Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +<+>UTF-8 +=================================================================== +diff --git a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/hook/SuperVanishHook.java b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/hook/SuperVanishHook.java +new file mode 100644 +--- /dev/null (revision 033b062d7d16226083434d544504c872ef0fa129) ++++ b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/hook/SuperVanishHook.java (revision 033b062d7d16226083434d544504c872ef0fa129) +@@ -0,0 +1,34 @@ ++package jss.customjoinandquitmessages.hook; ++ ++import de.myzelyam.api.vanish.VanishAPI; ++import jss.customjoinandquitmessages.utils.EventUtils; ++import jss.customjoinandquitmessages.utils.Logger; ++import jss.customjoinandquitmessages.utils.Util; ++import jss.customjoinandquitmessages.utils.interfaces.IHook; ++import org.bukkit.Bukkit; ++import org.bukkit.entity.Player; ++ ++public class SuperVanishHook implements IHook { ++ ++ private boolean isEnabled; ++ ++ public void setup() { ++ if (!Bukkit.getPluginManager().isPluginEnabled("SuperVanish") || !Bukkit.getPluginManager().isPluginEnabled("PremiumVanish")) { ++ Logger.warning("&eSuperVanish or PremiumVanish not enabled! - Disable Features..."); ++ this.isEnabled = false; ++ return; ++ } ++ ++ this.isEnabled = true; ++ Util.sendColorMessage(EventUtils.getStaticConsoleSender(), Util.getPrefix(true) + "&aLoading SuperVanish or PremiumVanish features..."); ++ ++ } ++ ++ public boolean isEnabled() { ++ return isEnabled; ++ } ++ ++ public boolean isVanishPlayer(Player player){ ++ return VanishAPI.isInvisible(player); ++ } ++} +Index: CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/listener/JoinListener.java +IDEA additional info: +Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +<+>UTF-8 +=================================================================== +diff --git a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/listener/JoinListener.java b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/listener/JoinListener.java +--- a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/listener/JoinListener.java (revision 9e2091bbd022d80eeb902dbefe0ff217d003f052) ++++ b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/listener/JoinListener.java (revision 033b062d7d16226083434d544504c872ef0fa129) +@@ -4,10 +4,7 @@ + import com.cryptomorin.xseries.messages.Titles; + import github.scarsz.discordsrv.util.DiscordUtil; + import jss.customjoinandquitmessages.CustomJoinAndQuitMessages; +-import jss.customjoinandquitmessages.hook.DiscordSRVHHook; +-import jss.customjoinandquitmessages.hook.EssentialsXDiscordHook; +-import jss.customjoinandquitmessages.hook.EssentialsXHook; +-import jss.customjoinandquitmessages.hook.LuckPermsHook; ++import jss.customjoinandquitmessages.hook.*; + import jss.customjoinandquitmessages.json.MessageBuilder; + import jss.customjoinandquitmessages.manager.HookManager; + import jss.customjoinandquitmessages.manager.PlayerManager; +@@ -48,6 +45,7 @@ + LuckPermsHook luckPermsHook = HookManager.getInstance().getLuckPermsHook(); + EssentialsXDiscordHook essentialsXDiscordHook = HookManager.getInstance().getEssentialsXDiscordHook(); + EssentialsXHook essentialsXHook = HookManager.get().getEssentialsXHook(); ++ SuperVanishHook superVanishHook = HookManager.get().getSuperVanishHook(); + Player p = e.getPlayer(); + String tempGroup; + +@@ -92,6 +90,18 @@ + Util.sendColorMessage(p, Util.getVar(p, text)); + } + ++ if(Util.isVanished(p)){ ++ e.setJoinMessage(null); ++ return; ++ } ++ ++ if (superVanishHook.isEnabled()){ ++ if (superVanishHook.isVanishPlayer(p)){ ++ e.setJoinMessage(null); ++ return; ++ } ++ } ++ + if (essentialsXHook.isEnabled()) { + if (Settings.hook_essentials_hideplayervanish) { + if (essentialsXHook.isVanish(p)) { +@@ -168,7 +178,7 @@ + String Action_Url = config.getString("Join.ClickEvent.Actions.Url"); + String Action_Suggest = config.getString("Join.ClickEvent.Actions.Suggest-Command"); + +- List Action_Dev = config.getStringList("Join.ClickEvent.DevActions"); ++ //List Action_Dev = config.getStringList("Join.ClickEvent.DevActions"); + + String Title_Text = config.getString("Join.Title.Title"); + String SubTitle_Text = config.getString("Join.Title.SubTitle"); +@@ -199,7 +209,7 @@ + + if (isClick) { + +- for(String action : Action_Dev){ ++ /*for(String action : Action_Dev){ + + String[] parts = action.split(":"); + String type = parts[0].trim(); +@@ -220,9 +230,8 @@ + break; + } + } +- messageBuilder.sendToAll(); ++ messageBuilder.sendToAll();*/ + +- /** Temp Disabled + assert isClick_Mode != null; + if (isClick_Mode.equalsIgnoreCase("command")) { + messageBuilder.setExecuteCommand(Action_Command).sendToAll(); +@@ -231,7 +240,7 @@ + } else if (isClick_Mode.equalsIgnoreCase("suggest")) { + messageBuilder.setSuggestCommand(Action_Suggest).sendToAll(); + } +- */ ++ + + } else { + messageBuilder.sendToAll(); +@@ -300,12 +309,25 @@ + DiscordSRVHHook discordSRVHHook = HookManager.getInstance().getDiscordSRVHHook(); + EssentialsXDiscordHook essentialsXDiscordHook = HookManager.getInstance().getEssentialsXDiscordHook(); + EssentialsXHook essentialsXHook = HookManager.get().getEssentialsXHook(); ++ SuperVanishHook superVanishHook = HookManager.get().getSuperVanishHook(); + PlayerManager playerManager = new PlayerManager(); + + boolean isNormal = Settings.c_type.equalsIgnoreCase("normal"); + boolean isGroup = Settings.c_type.equalsIgnoreCase("group"); + boolean isNone = Settings.c_type.equalsIgnoreCase("none"); + ++ if(Util.isVanished(p)){ ++ e.setQuitMessage(null); ++ return; ++ } ++ ++ if (superVanishHook.isEnabled()){ ++ if (superVanishHook.isVanishPlayer(p)){ ++ e.setQuitMessage(null); ++ return; ++ } ++ } ++ + if (essentialsXHook.isEnabled()) { + if (Settings.hook_essentials_hideplayervanish) { + if (essentialsXHook.isVanish(p)) { +@@ -443,4 +465,6 @@ + } + } + ++ ++ + } +Index: CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/manager/HookManager.java +IDEA additional info: +Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +<+>UTF-8 +=================================================================== +diff --git a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/manager/HookManager.java b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/manager/HookManager.java +--- a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/manager/HookManager.java (revision 9e2091bbd022d80eeb902dbefe0ff217d003f052) ++++ b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/manager/HookManager.java (revision 033b062d7d16226083434d544504c872ef0fa129) +@@ -11,6 +11,7 @@ + private final EssentialsXDiscordHook essentialsXDiscordHook = new EssentialsXDiscordHook(this); + private final EssentialsXHook essentialsXHook = new EssentialsXHook(this); + private final LuckPermsHook luckPermsHook = new LuckPermsHook(); ++ private final SuperVanishHook superVanishHook = new SuperVanishHook(); + + public HookManager() { + instance = this; +@@ -26,10 +27,11 @@ + + public void load() { + initHooks(new PlaceholderApiHook(this), +- new DiscordSRVHHook(this), +- new EssentialsXDiscordHook(this), +- new EssentialsXHook(this), +- luckPermsHook); ++ discordSRVHHook, ++ essentialsXDiscordHook, ++ essentialsXHook, ++ luckPermsHook, ++ superVanishHook); + } + + private void initHooks(IHook @NotNull ... hooks) { +@@ -53,4 +55,8 @@ + public LuckPermsHook getLuckPermsHook() { + return luckPermsHook; + } ++ ++ public SuperVanishHook getSuperVanishHook() { ++ return superVanishHook; ++ } + } +Index: CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/utils/Util.java +IDEA additional info: +Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +<+>UTF-8 +=================================================================== +diff --git a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/utils/Util.java b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/utils/Util.java +--- a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/utils/Util.java (revision 9e2091bbd022d80eeb902dbefe0ff217d003f052) ++++ b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/utils/Util.java (revision 033b062d7d16226083434d544504c872ef0fa129) +@@ -8,6 +8,7 @@ + import org.bukkit.Bukkit; + import org.bukkit.command.CommandSender; + import org.bukkit.entity.Player; ++import org.bukkit.metadata.MetadataValue; + import org.jetbrains.annotations.Contract; + import org.jetbrains.annotations.NotNull; + import org.jetbrains.annotations.Nullable; +@@ -169,6 +170,7 @@ + sendEnable(prefix, "&5 <||============================================----"); + } + ++ @SuppressWarnings("unused") + public static boolean setPerm(@NotNull Player player, String permName){ + return player.hasPermission(PERMISSION_PREFIX + permName); + } +@@ -181,4 +183,11 @@ + } + } + ++ public static boolean isVanished(@NotNull Player player) { ++ for (MetadataValue meta : player.getMetadata("vanished")) { ++ if (meta.asBoolean()) return true; ++ } ++ return false; ++ } ++ + } +Index: CustomJoinAndQuitMessagesOld/src/main/resources/config.yml +IDEA additional info: +Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +<+>UTF-8 +=================================================================== +diff --git a/CustomJoinAndQuitMessagesOld/src/main/resources/config.yml b/CustomJoinAndQuitMessagesOld/src/main/resources/config.yml +--- a/CustomJoinAndQuitMessagesOld/src/main/resources/config.yml (revision 9e2091bbd022d80eeb902dbefe0ff217d003f052) ++++ b/CustomJoinAndQuitMessagesOld/src/main/resources/config.yml (revision 033b062d7d16226083434d544504c872ef0fa129) +@@ -22,13 +22,14 @@ + # |Enabled| Here you can enable or disable this feature + Enabled: true + ++ # !!This feature is not available yet!! + # |GetUpdateFrom| you will get the updates from [spigot | github] what is the difference, here below is the explanation of why + # |Spigot| Get only released updates, and you won't receive beta notifications + # |GitHub| Get only the released and beta updates, and you will be able to receive notifications of both versions + GetUpdateFrom: Spigot + + # |Debug| shows you important information about the plugin loading +- Debug: true ++ Debug: false + + # |Type| the type is a way of knowing what is being used whether in the [normal] | [group] | [none] format + Type: normal +@@ -127,7 +128,13 @@ + + # |Mode| there are three different modes which are [ command | suggest | url ] + Mode: command +- ++ ++ # This feature is not available yet ++ DevActions: ++ - '[Suggest]: /help' ++ - '[Execute]: /me hello test' ++ - '[Open]: https://www.spigotmc.org/resources/custom-join-and-quit-message-1-7-x-1-17-x.57006/' ++ + # |Actions| This is where are the available events that you can use + Actions: + +@@ -222,11 +229,6 @@ + # |Mode| there are three different modes which are [ command | suggest | url ] + Mode: command + +- DevActions: +- - '[Suggest]: /help' +- - '[Execute]: /me hola test' +- - '[Open]: https://www.spigotmc.org/resources/custom-join-and-quit-message-1-7-x-1-17-x.57006/' +- + # |Actions| This is where are the available events that you can use + Actions: + +Index: CustomJoinAndQuitMessagesOld/src/main/resources/plugin.yml +IDEA additional info: +Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +<+>UTF-8 +=================================================================== +diff --git a/CustomJoinAndQuitMessagesOld/src/main/resources/plugin.yml b/CustomJoinAndQuitMessagesOld/src/main/resources/plugin.yml +--- a/CustomJoinAndQuitMessagesOld/src/main/resources/plugin.yml (revision 9e2091bbd022d80eeb902dbefe0ff217d003f052) ++++ b/CustomJoinAndQuitMessagesOld/src/main/resources/plugin.yml (revision 033b062d7d16226083434d544504c872ef0fa129) +@@ -9,7 +9,8 @@ + softdepend: [ + PlaceholderAPI, DiscordSRV, + LuckPerms, EssentialsDiscord, +- Essentials ++ Essentials, SuperVanish, ++ PremiumVanish + ] + + commands: +@@ -18,7 +19,7 @@ + aliases: + - cjm + permissions: +- cjm.Admin: ++ cjm.admin: + description: give the all permissions + children: + cjm.update: true +@@ -26,7 +27,7 @@ + cjm.command.help: true + cjm.command.tabcomplete: true + default: op +- cjm.Update: ++ cjm.update: + description: allows you to receive notifications of available updates + default: op + cjm.command.reload: From 60d9051d52d70ed86db8e0fc1a50da61f395e55a Mon Sep 17 00:00:00 2001 From: SrJss <31166687+jonagamerpro1234@users.noreply.github.com> Date: Sun, 19 Feb 2023 23:08:41 -0300 Subject: [PATCH 15/27] Removed debugging messages in the LuckPermsHook class. --- .../jss/customjoinandquitmessages/hook/LuckPermsHook.java | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/hook/LuckPermsHook.java b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/hook/LuckPermsHook.java index 1135fed..7a89207 100644 --- a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/hook/LuckPermsHook.java +++ b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/hook/LuckPermsHook.java @@ -25,19 +25,16 @@ public void setup() { if (!Bukkit.getPluginManager().isPluginEnabled("LuckPerms")) { Logger.warning("&eLuckPerms not enabled! - Disable Features..."); this.isEnabled = false; - System.out.println("Cjm Softdepend: Luckperms false - check plugin installed in plugin folder"); return; } if (!Settings.hook_luckperms) { this.isEnabled = false; - System.out.println("Cjm Softdepend: Luckperms false - Hook Enabled in config"); - Logger.warning("&eLuckPerms not enabled! - Disable Features..."); + System.out.println("Cjm Softdepend: Luckperms false - Hook disabled in config"); return; } this.isEnabled = true; - System.out.println("Cjm Softdepend: Luckperms true - The plugin has successfully loaded the dependency"); Util.sendColorMessage(EventUtils.getStaticConsoleSender(), Util.getPrefix(true) + "&aLoading LuckPerms features..."); } From 5436229cc153c4aec4cd6267d80f1e8301022990 Mon Sep 17 00:00:00 2001 From: SrJss <31166687+jonagamerpro1234@users.noreply.github.com> Date: Mon, 20 Feb 2023 20:27:24 -0300 Subject: [PATCH 16/27] Removed types normal and modify of Join and Quit and more. --- CustomJoinAndQuitMessagesOld/pom.xml | 2 +- .../commands/CustomJoinAndQuitCmd.java | 4 +- .../config/utils/PreConfigLoader.java | 14 +- .../hook/DiscordSRVHHook.java | 11 +- .../hook/EssentialsXDiscordHook.java | 19 +- .../listener/JoinListener.java | 362 +++++++----------- .../manager/DisplayManager.java | 151 +++----- .../manager/HookManager.java | 4 +- .../update/UpdateChecker.java | 7 +- .../utils/GroupHelper.java | 309 +++++++-------- .../utils/Settings.java | 23 +- .../customjoinandquitmessages/utils/Util.java | 26 -- .../src/main/resources/config.yml | 14 +- .../src/main/resources/groups.yml | 3 - .../commands/subcommands/InfoCommand.java | 5 + ...messages_in_the_LuckPermsHook_class_.patch | 29 ++ 16 files changed, 391 insertions(+), 592 deletions(-) create mode 100644 patches/Removed_debugging_messages_in_the_LuckPermsHook_class_.patch diff --git a/CustomJoinAndQuitMessagesOld/pom.xml b/CustomJoinAndQuitMessagesOld/pom.xml index bf10789..679ebce 100644 --- a/CustomJoinAndQuitMessagesOld/pom.xml +++ b/CustomJoinAndQuitMessagesOld/pom.xml @@ -9,7 +9,7 @@ CustomJoinAndQuitMessagesOld - 1.7.8-release + 1.7.9-release 8 diff --git a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/commands/CustomJoinAndQuitCmd.java b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/commands/CustomJoinAndQuitCmd.java index 6538145..74e1b6d 100644 --- a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/commands/CustomJoinAndQuitCmd.java +++ b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/commands/CustomJoinAndQuitCmd.java @@ -58,7 +58,7 @@ public boolean onCommand(@NotNull CommandSender sender, @NotNull Command cmd, @N if (args.length >= 1) { if (args[0].equalsIgnoreCase("help")) { - if ((j.isOp()) || (j.hasPermission("Cjm.Help"))) { + if ((j.isOp()) || (j.hasPermission("cjm.command.help"))) { Util.sendColorMessage(j, "&5-=-=-=-=-=-=-=-=-=-=-=&6[&d" + plugin.name + "&6]&5=-=-=-=-=-=-=-=-=-=-=-"); for (String text : plugin.Locale().help_1) { Util.sendColorMessage(j, text); @@ -71,7 +71,7 @@ public boolean onCommand(@NotNull CommandSender sender, @NotNull Command cmd, @N } if (args[0].equalsIgnoreCase("reload") || args[0].equalsIgnoreCase("rl")) { - if ((j.isOp()) || (j.hasPermission("Cjm.Reload"))) { + if ((j.isOp()) || (j.hasPermission(" cjm.command.reload"))) { plugin.reloadAllFiles(); Util.sendColorMessage(j, Util.getPrefix(false) + plugin.Locale().reload); } else { diff --git a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/config/utils/PreConfigLoader.java b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/config/utils/PreConfigLoader.java index 15e4d42..7549451 100644 --- a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/config/utils/PreConfigLoader.java +++ b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/config/utils/PreConfigLoader.java @@ -32,7 +32,6 @@ public void loadConfig() { //Join Settings.join = Objects.equals(config.getString("Join.Enabled"), "true"); Settings.join_message = config.getString("Join.Text"); - Settings.join_type = config.getString("Join.Type"); Settings.firstjoin = Objects.equals(config.getString("Join.First-Join.Enabled"), "true"); Settings.join_message_first = config.getString("Join.First-Join.Text"); @@ -43,9 +42,9 @@ public void loadConfig() { Settings.join_message_title_title = config.getString("Join.Title.Title"); Settings.join_message_title_subtitle = config.getString("Join.Title.SubTitle"); - Settings.join_title_fadein = config.getInt("Join.Title.FadeIn"); + Settings.join_title_fadeIn = config.getInt("Join.Title.FadeIn"); Settings.join_title_stay = config.getInt("Join.Title.Stay"); - Settings.join_title_fadeout = config.getInt("Join.Title.FadeOut"); + Settings.join_title_fadeOut = config.getInt("Join.Title.FadeOut"); Settings.join_sound = Objects.equals(config.getString("Join.Sound.Enabled"), "true"); Settings.join_sound_name = config.getString("Join.Sound.Name"); @@ -54,7 +53,6 @@ public void loadConfig() { //Quit Settings.quit = Objects.equals(config.getString("Quit.Enabled"), "true"); - Settings.quit_type = config.getString("Quit.Type"); Settings.quit_message = config.getString("Quit.Text"); //Welcome @@ -62,11 +60,11 @@ public void loadConfig() { Settings.list_welcome = config.getStringList("Welcome.Text"); //Hooks - Settings.hook_discordsrv = Objects.equals(config.getString("Hooks.DiscordSRV.Enabled"), "true"); - Settings.hook_discordsrv_channelid = config.getString("Hooks.DiscordSRV.Channel-ID"); + Settings.hook_discordSrv = Objects.equals(config.getString("Hooks.DiscordSRV.Enabled"), "true"); + Settings.hook_discordSrv_channelId = config.getString("Hooks.DiscordSRV.Channel-ID"); Settings.hook_essentialsDiscord = Objects.equals(config.getString("Hooks.EssentialsDiscord.Enabled"), "true"); - Settings.hook_essentialsDiscord_channelid = config.getString("Hooks.EssentialsDiscord.Channel-ID"); + Settings.hook_essentialsDiscord_channelId = config.getString("Hooks.EssentialsDiscord.Channel-ID"); Settings.hook_essentialsDiscord_use_default_channel = config.getBoolean("Hooks.EssentialsDiscord.Use-Default-Channel"); Settings.hook_luckperms = config.getBoolean("Hooks.LuckPerms.Enabled"); @@ -74,7 +72,7 @@ public void loadConfig() { Settings.hook_luckperms_autoUpdate_group_tick = config.getLong("Hooks.LuckPerms.AutoUpdateGroup.Tick"); Settings.hook_essentials = Objects.equals(config.getString("Hooks.Essentials.Enabled"), "true"); - Settings.hook_essentials_hideplayervanish = config.getBoolean("Hooks.Essentials.HidePlayerIsVanish"); + Settings.hook_essentials_hidePlayerVanish = config.getBoolean("Hooks.Essentials.HidePlayerIsVanish"); } catch (Exception e) { Logger.error("&cThere was an error loading the &b[PreConfigLoader]&7, please reload the plugin"); diff --git a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/hook/DiscordSRVHHook.java b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/hook/DiscordSRVHHook.java index a27bfe9..c9ecc87 100644 --- a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/hook/DiscordSRVHHook.java +++ b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/hook/DiscordSRVHHook.java @@ -1,6 +1,5 @@ package jss.customjoinandquitmessages.hook; -import jss.customjoinandquitmessages.manager.HookManager; import jss.customjoinandquitmessages.utils.EventUtils; import jss.customjoinandquitmessages.utils.Logger; import jss.customjoinandquitmessages.utils.Settings; @@ -10,13 +9,8 @@ public class DiscordSRVHHook implements IHook { - private HookManager hookManager; private boolean isEnabled; - public DiscordSRVHHook(HookManager hookManager) { - this.hookManager = hookManager; - } - public void setup() { if (!Bukkit.getPluginManager().isPluginEnabled("DiscordSRV")) { Logger.warning("&eDiscordSRV not enabled! - Disable Features..."); @@ -24,7 +18,7 @@ public void setup() { return; } - if (!Settings.hook_discordsrv) { + if (!Settings.hook_discordSrv) { this.isEnabled = false; Logger.warning("&eDiscordSRV not enabled! - Disable Features..."); return; @@ -38,7 +32,4 @@ public boolean isEnabled() { return isEnabled; } - public HookManager getHookManager() { - return hookManager; - } } diff --git a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/hook/EssentialsXDiscordHook.java b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/hook/EssentialsXDiscordHook.java index 58eb3de..23017fc 100644 --- a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/hook/EssentialsXDiscordHook.java +++ b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/hook/EssentialsXDiscordHook.java @@ -1,6 +1,5 @@ package jss.customjoinandquitmessages.hook; -import jss.customjoinandquitmessages.manager.HookManager; import jss.customjoinandquitmessages.utils.EventUtils; import jss.customjoinandquitmessages.utils.Logger; import jss.customjoinandquitmessages.utils.Settings; @@ -12,14 +11,9 @@ public class EssentialsXDiscordHook implements IHook { - private HookManager hookManager; private boolean isEnabled; private DiscordService service; - public EssentialsXDiscordHook(HookManager hookManager) { - this.hookManager = hookManager; - } - public void setup() { if (!Bukkit.getPluginManager().isPluginEnabled("EssentialsDiscord")) { Logger.warning("&eEssentialsDiscord not enabled! - Disable Features..."); @@ -43,27 +37,22 @@ public boolean isEnabled() { return isEnabled; } - public DiscordService getService() { - return service; - } - + @SuppressWarnings("unused") public void sendJoinMessage(String channelId, String message) { if (Settings.hook_essentialsDiscord_use_default_channel) { service.sendMessage(MessageType.DefaultTypes.JOIN, message, false); } else { - service.sendMessage(new MessageType(Settings.hook_essentialsDiscord_channelid), message, false); + service.sendMessage(new MessageType(Settings.hook_essentialsDiscord_channelId), message, false); } } + @SuppressWarnings("unused") public void sendQuitMessage(String channelId, String message) { if (Settings.hook_essentialsDiscord_use_default_channel) { service.sendMessage(MessageType.DefaultTypes.LEAVE, message, false); } else { - service.sendMessage(new MessageType(Settings.hook_essentialsDiscord_channelid), message, false); + service.sendMessage(new MessageType(Settings.hook_essentialsDiscord_channelId), message, false); } } - public HookManager getHookManager() { - return hookManager; - } } diff --git a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/listener/JoinListener.java b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/listener/JoinListener.java index 1b17fb1..27af372 100644 --- a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/listener/JoinListener.java +++ b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/listener/JoinListener.java @@ -103,7 +103,7 @@ public void onJoinListener(@NotNull PlayerJoinEvent e) { } if (essentialsXHook.isEnabled()) { - if (Settings.hook_essentials_hideplayervanish) { + if (Settings.hook_essentials_hidePlayerVanish) { if (essentialsXHook.isVanish(p)) { e.setJoinMessage(null); return; @@ -115,11 +115,10 @@ public void onJoinListener(@NotNull PlayerJoinEvent e) { if (isNormal) { e.setJoinMessage(null); + String text; String join = Settings.join_message; String firstjoin = Settings.join_message_first; - String text; - if (Settings.firstjoin) { if (!p.hasPlayedBefore()) { text = firstjoin; @@ -130,161 +129,106 @@ public void onJoinListener(@NotNull PlayerJoinEvent e) { text = join; } - boolean isNormalType = Settings.join_type.equalsIgnoreCase("normal"); - boolean isModifyType = Settings.join_type.equalsIgnoreCase("modify"); - text = Util.color(Util.getVar(p, text)); - MessageBuilder messageBuilder = new MessageBuilder(p, text); - //Update Logger if (config.getBoolean("Config.Show-Chat-In-Console")) { Logger.info(messageBuilder.getText()); } - if (isNormalType) { - e.setJoinMessage(text); - if (discordSRVHHook.isEnabled()) { - - if (Settings.hook_discordsrv_channelid.equalsIgnoreCase("none")) - return; - - DiscordUtil.sendMessageBlocking( - DiscordUtil.getTextChannelById(Settings.hook_discordsrv_channelid), - Util.colorless(messageBuilder.getText())); - } - - if (essentialsXDiscordHook.isEnabled()) { - if (Settings.hook_essentialsDiscord_channelid.equalsIgnoreCase("none")) - return; - - essentialsXDiscordHook.sendJoinMessage(Settings.hook_essentialsDiscord_channelid, - Util.colorless(messageBuilder.getText())); - } - - //Removed IsModifyType in 1.8.0 - } else if (isModifyType) { - boolean isHover = Objects.equals(config.getString("Join.HoverEvent.Enabled"), "true"); - boolean isClick = Objects.equals(config.getString("Join.ClickEvent.Enabled"), "true"); - boolean isTitle = Objects.equals(config.getString("Join.Title.Enabled"), "true"); - boolean isSound = Objects.equals(config.getString("Join.Sound.Enabled"), "true"); - boolean isActionBar = Objects.equals(config.getString("Join.ActionBar.Enabled"), "true"); - boolean isSoundAll = Objects.equals(config.getString("Join.Sound.Send-To-All"), "true"); - - List Hover_Text = config.getStringList("Join.HoverEvent.Hover"); - - String isClick_Mode = config.getString("Join.ClickEvent.Mode"); - String Action_Command = config.getString("Join.ClickEvent.Actions.Command"); - String Action_Url = config.getString("Join.ClickEvent.Actions.Url"); - String Action_Suggest = config.getString("Join.ClickEvent.Actions.Suggest-Command"); - - //List Action_Dev = config.getStringList("Join.ClickEvent.DevActions"); - - String Title_Text = config.getString("Join.Title.Title"); - String SubTitle_Text = config.getString("Join.Title.SubTitle"); - String Actionbar_Text = config.getString("Join.ActionBar.Text"); - String Sound_Name = config.getString("Join.Sound.Name"); - - int FadeIn = config.getInt("Join.Title.FadeIn"); - int Stay = config.getInt("Join.Title.Stay"); - int FadeOut = config.getInt("Join.Title.FadeOut"); - int Sound_Volume = config.getInt("Join.Sound.Volume"); - - float Sound_Pitch = Float.parseFloat(Objects.requireNonNull(config.getString("Join.Sound.Pitch"))); - - if (isHover) { - if (isClick) { - assert isClick_Mode != null; - if (isClick_Mode.equalsIgnoreCase("command")) { - messageBuilder.setHover(Hover_Text).setExecuteCommand(Action_Command).sendToAll(); - } else if (isClick_Mode.equalsIgnoreCase("url")) { - messageBuilder.setHover(Hover_Text).setOpenURL(Action_Url).sendToAll(); - } else if (isClick_Mode.equalsIgnoreCase("suggest")) { - messageBuilder.setHover(Hover_Text).setSuggestCommand(Action_Suggest).sendToAll(); - } - } else { - messageBuilder.setHover(Hover_Text).sendToAll(); + boolean isHover = config.getBoolean("Join.HoverEvent.Enabled"); + boolean isClick = config.getBoolean("Join.ClickEvent.Enabled"); + boolean isTitle = config.getBoolean("Join.Title.Enabled"); + boolean isSound = config.getBoolean("Join.Sound.Enabled"); + boolean isActionBar = config.getBoolean("Join.ActionBar.Enabled"); + boolean isSoundAll = config.getBoolean("Join.Sound.Send-To-All"); + + List Hover_Text = config.getStringList("Join.HoverEvent.Hover"); + + String isClick_Mode = config.getString("Join.ClickEvent.Mode"); + String Action_Command = config.getString("Join.ClickEvent.Actions.Command"); + String Action_Url = config.getString("Join.ClickEvent.Actions.Url"); + String Action_Suggest = config.getString("Join.ClickEvent.Actions.Suggest-Command"); + String Title_Text = config.getString("Join.Title.Title"); + String SubTitle_Text = config.getString("Join.Title.SubTitle"); + String Actionbar_Text = config.getString("Join.ActionBar.Text"); + String Sound_Name = config.getString("Join.Sound.Name"); + + int FadeIn = config.getInt("Join.Title.FadeIn"); + int Stay = config.getInt("Join.Title.Stay"); + int FadeOut = config.getInt("Join.Title.FadeOut"); + int Sound_Volume = config.getInt("Join.Sound.Volume"); + + float Sound_Pitch = Float.parseFloat(Objects.requireNonNull(config.getString("Join.Sound.Pitch"))); + + if (isHover) { + if (isClick) { + assert isClick_Mode != null; + if (isClick_Mode.equalsIgnoreCase("command")) { + messageBuilder.setHover(Hover_Text).setExecuteCommand(Action_Command).sendToAll(); + } else if (isClick_Mode.equalsIgnoreCase("url")) { + messageBuilder.setHover(Hover_Text).setOpenURL(Action_Url).sendToAll(); + } else if (isClick_Mode.equalsIgnoreCase("suggest")) { + messageBuilder.setHover(Hover_Text).setSuggestCommand(Action_Suggest).sendToAll(); } } else { + messageBuilder.setHover(Hover_Text).sendToAll(); + } + } else { - if (isClick) { - - /*for(String action : Action_Dev){ - - String[] parts = action.split(":"); - String type = parts[0].trim(); - String value = parts[1].trim(); - - switch (type){ - case "[Execute]": - messageBuilder.setExecuteCommand(value); - break; - case "[Suggest]": - messageBuilder.setSuggestCommand(value); - break; - case "[Open]": - messageBuilder.setOpenURL(value); - break; - default: - messageBuilder.sendToAll(); - break; - } - } - messageBuilder.sendToAll();*/ - - assert isClick_Mode != null; - if (isClick_Mode.equalsIgnoreCase("command")) { - messageBuilder.setExecuteCommand(Action_Command).sendToAll(); - } else if (isClick_Mode.equalsIgnoreCase("url")) { - messageBuilder.setOpenURL(Action_Url).sendToAll(); - } else if (isClick_Mode.equalsIgnoreCase("suggest")) { - messageBuilder.setSuggestCommand(Action_Suggest).sendToAll(); - } - - - } else { - messageBuilder.sendToAll(); + if (isClick) { + assert isClick_Mode != null; + if (isClick_Mode.equalsIgnoreCase("command")) { + messageBuilder.setExecuteCommand(Action_Command).sendToAll(); + } else if (isClick_Mode.equalsIgnoreCase("url")) { + messageBuilder.setOpenURL(Action_Url).sendToAll(); + } else if (isClick_Mode.equalsIgnoreCase("suggest")) { + messageBuilder.setSuggestCommand(Action_Suggest).sendToAll(); } + } else { + messageBuilder.sendToAll(); } + } - if (discordSRVHHook.isEnabled()) { - DiscordUtil.sendMessageBlocking( - DiscordUtil.getTextChannelById(Settings.hook_discordsrv_channelid), - Util.colorless(messageBuilder.getText())); - } + if (discordSRVHHook.isEnabled()) { + DiscordUtil.sendMessageBlocking( + DiscordUtil.getTextChannelById(Settings.hook_discordSrv_channelId), + Util.colorless(messageBuilder.getText())); + } - if (isTitle) { - Titles.sendTitle(p, FadeIn, Stay, FadeOut, Util.color(Util.getVar(p, Title_Text)), - Util.color(Util.getVar(p, SubTitle_Text))); - } + if (isTitle) { + Titles.sendTitle(p, FadeIn, Stay, FadeOut, Util.color(Util.getVar(p, Title_Text)), + Util.color(Util.getVar(p, SubTitle_Text))); + } - if (isActionBar) { - ActionBar.sendActionBar(p, Util.color(Util.getVar(p, Actionbar_Text))); - } + if (isActionBar) { + ActionBar.sendActionBar(p, Util.color(Util.getVar(p, Actionbar_Text))); + } - try { - if (isSound) { - if (isSoundAll) { + try { + if (isSound) { + if (isSoundAll) { + Location location = p.getLocation(); + p.playSound(location, Sound.valueOf(Sound_Name), Sound_Volume, Sound_Pitch); + } else { + for (Player pp : Bukkit.getOnlinePlayers()) { Location location = p.getLocation(); - p.playSound(location, Sound.valueOf(Sound_Name), Sound_Volume, Sound_Pitch); - } else { - for (Player pp : Bukkit.getOnlinePlayers()) { - Location location = p.getLocation(); - pp.playSound(location, Sound.valueOf(Sound_Name), Sound_Volume, Sound_Pitch); - } + pp.playSound(location, Sound.valueOf(Sound_Name), Sound_Volume, Sound_Pitch); } } - } catch (Exception ex) { - Logger.warning("&eVerify that the sound name is correct or belongs to the version"); } + } catch (Exception ex) { + Logger.warning("&eVerify that the sound name is correct or belongs to the version"); } + + } else if (isGroup) { e.setJoinMessage(null); GroupHelper groupHelper = new GroupHelper(); groupHelper.setGroup(playerManager.getGroup(p)); groupHelper.setDiscord(discordSRVHHook); groupHelper.setEssentials(essentialsXDiscordHook); - groupHelper.onJoin(p, config, e); + groupHelper.onJoin(p, config); } else if (isNone) { e.setJoinMessage(null); } @@ -295,7 +239,7 @@ public void onJoinListener(@NotNull PlayerJoinEvent e) { public void onUpdate(@NotNull PlayerJoinEvent e) { Player p = e.getPlayer(); if (Settings.update) { - if ((p.isOp()) || (p.hasPermission("Cjm.Update.Notify"))) { + if ((p.isOp()) || (p.hasPermission("cjm.update"))) { new UpdateChecker(CustomJoinAndQuitMessages.get()).sendSpigotUpdate(); } } @@ -329,7 +273,7 @@ public void onQuit(@NotNull PlayerQuitEvent e) { } if (essentialsXHook.isEnabled()) { - if (Settings.hook_essentials_hideplayervanish) { + if (Settings.hook_essentials_hidePlayerVanish) { if (essentialsXHook.isVanish(p)) { e.setQuitMessage(null); return; @@ -341,9 +285,6 @@ public void onQuit(@NotNull PlayerQuitEvent e) { if (isNormal) { e.setQuitMessage(null); - boolean isNormalType = Objects.requireNonNull(config.getString("Quit.Type")).equalsIgnoreCase("normal"); - boolean isModifyType = Objects.requireNonNull(config.getString("Quit.Type")).equalsIgnoreCase("modify"); - String text = config.getString("Quit.Text"); text = Util.color(text); @@ -355,102 +296,81 @@ public void onQuit(@NotNull PlayerQuitEvent e) { Logger.info(messageBuilder.getText()); } - if (isNormalType) { - e.setQuitMessage(text); - if (discordSRVHHook.isEnabled()) { - if (Settings.hook_discordsrv_channelid.equalsIgnoreCase("none")) - return; - DiscordUtil.sendMessageBlocking( - DiscordUtil.getTextChannelById(Settings.hook_discordsrv_channelid), - Util.colorless(messageBuilder.getText())); - } - - if (essentialsXDiscordHook.isEnabled()) { - if (Settings.hook_essentialsDiscord_channelid.equalsIgnoreCase("none")) - return; - essentialsXDiscordHook.sendQuitMessage(Settings.hook_essentialsDiscord_channelid, - Util.colorless(messageBuilder.getText())); - } - } else if (isModifyType) { - - boolean isHover = Objects.equals(config.getString("Quit.HoverEvent.Enabled"), "true"); - boolean isClick = Objects.equals(config.getString("Quit.ClickEvent.Enabled"), "true"); - boolean isSound = Objects.equals(config.getString("Quit.Sound.Enabled"), "true"); - boolean isSoundAll = Objects.equals(config.getString("Quit.Sound.Send-To-All"), "true"); - - List Hover_Text = config.getStringList("Quit.HoverEvent.Hover"); - - String isClick_Mode = config.getString("Quit.ClickEvent.Mode"); - String Action_Command = config.getString("Quit.ClickEvent.Actions.Command"); - String Action_Url = config.getString("Quit.ClickEvent.Actions.Url"); - String Action_Suggest = config.getString("Quit.ClickEvent.Actions.Suggest-Command"); - String Sound_Name = config.getString("Quit.Sound.Name"); - - int Sound_Volume = config.getInt("Quit.Sound.Volume"); - float Sound_Pitch = Float.parseFloat(Objects.requireNonNull(config.getString("Quit.Sound.Pitch"))); - - if (isHover) { - if (isClick) { - assert isClick_Mode != null; - if (isClick_Mode.equalsIgnoreCase("command")) { - messageBuilder.setHover(Hover_Text).setExecuteCommand(Action_Command).sendToAll(); - } else if (isClick_Mode.equalsIgnoreCase("url")) { - messageBuilder.setHover(Hover_Text).setOpenURL(Action_Url).sendToAll(); - } else if (isClick_Mode.equalsIgnoreCase("suggest")) { - messageBuilder.setHover(Hover_Text).setSuggestCommand(Action_Suggest).sendToAll(); - } - } else { - messageBuilder.setHover(Hover_Text).sendToAll(); + boolean isHover = config.getBoolean("Quit.HoverEvent.Enabled"); + boolean isClick = config.getBoolean("Quit.ClickEvent.Enabled"); + boolean isSound = config.getBoolean("Quit.Sound.Enabled"); + boolean isSoundAll = config.getBoolean("Quit.Sound.Send-To-All"); + + List Hover_Text = config.getStringList("Quit.HoverEvent.Hover"); + + String isClick_Mode = config.getString("Quit.ClickEvent.Mode"); + String Action_Command = config.getString("Quit.ClickEvent.Actions.Command"); + String Action_Url = config.getString("Quit.ClickEvent.Actions.Url"); + String Action_Suggest = config.getString("Quit.ClickEvent.Actions.Suggest-Command"); + String Sound_Name = config.getString("Quit.Sound.Name"); + + int Sound_Volume = config.getInt("Quit.Sound.Volume"); + float Sound_Pitch = Float.parseFloat(Objects.requireNonNull(config.getString("Quit.Sound.Pitch"))); + + if (isHover) { + if (isClick) { + assert isClick_Mode != null; + if (isClick_Mode.equalsIgnoreCase("command")) { + messageBuilder.setHover(Hover_Text).setExecuteCommand(Action_Command).sendToAll(); + } else if (isClick_Mode.equalsIgnoreCase("url")) { + messageBuilder.setHover(Hover_Text).setOpenURL(Action_Url).sendToAll(); + } else if (isClick_Mode.equalsIgnoreCase("suggest")) { + messageBuilder.setHover(Hover_Text).setSuggestCommand(Action_Suggest).sendToAll(); } } else { - if (isClick) { - assert isClick_Mode != null; - if (isClick_Mode.equalsIgnoreCase("command")) { - messageBuilder.setExecuteCommand(Action_Command).sendToAll(); - } else if (isClick_Mode.equalsIgnoreCase("url")) { - messageBuilder.setOpenURL(Action_Url).sendToAll(); - } else if (isClick_Mode.equalsIgnoreCase("suggest")) { - messageBuilder.setSuggestCommand(Action_Suggest).sendToAll(); - } - } else { - messageBuilder.sendToAll(); + messageBuilder.setHover(Hover_Text).sendToAll(); + } + } else { + if (isClick) { + assert isClick_Mode != null; + if (isClick_Mode.equalsIgnoreCase("command")) { + messageBuilder.setExecuteCommand(Action_Command).sendToAll(); + } else if (isClick_Mode.equalsIgnoreCase("url")) { + messageBuilder.setOpenURL(Action_Url).sendToAll(); + } else if (isClick_Mode.equalsIgnoreCase("suggest")) { + messageBuilder.setSuggestCommand(Action_Suggest).sendToAll(); } + } else { + messageBuilder.sendToAll(); } + } - if (discordSRVHHook.isEnabled()) { - - if (Settings.hook_discordsrv_channelid.equalsIgnoreCase("none")) - return; - - DiscordUtil.sendMessageBlocking( - DiscordUtil.getTextChannelById(Settings.hook_discordsrv_channelid), - Util.colorless(messageBuilder.getText())); - } + if (discordSRVHHook.isEnabled()) { + if (Settings.hook_discordSrv_channelId.equalsIgnoreCase("none")) + return; - if (essentialsXDiscordHook.isEnabled()) { + DiscordUtil.sendMessageBlocking( + DiscordUtil.getTextChannelById(Settings.hook_discordSrv_channelId), + Util.colorless(messageBuilder.getText())); + } - if (Settings.hook_essentialsDiscord_channelid.equalsIgnoreCase("none")) - return; + if (essentialsXDiscordHook.isEnabled()) { + if (Settings.hook_essentialsDiscord_channelId.equalsIgnoreCase("none")) + return; - essentialsXDiscordHook.sendQuitMessage(Settings.hook_essentialsDiscord_channelid, - Util.colorless(messageBuilder.getText())); - } + essentialsXDiscordHook.sendQuitMessage(Settings.hook_essentialsDiscord_channelId, + Util.colorless(messageBuilder.getText())); + } - try { - if (isSound) { - if (isSoundAll) { + try { + if (isSound) { + if (isSoundAll) { + Location location = p.getLocation(); + p.playSound(location, Sound.valueOf(Sound_Name), Sound_Volume, Sound_Pitch); + } else { + for (Player pp : Bukkit.getOnlinePlayers()) { Location location = p.getLocation(); - p.playSound(location, Sound.valueOf(Sound_Name), Sound_Volume, Sound_Pitch); - } else { - for (Player pp : Bukkit.getOnlinePlayers()) { - Location location = p.getLocation(); - pp.playSound(location, Sound.valueOf(Sound_Name), Sound_Volume, Sound_Pitch); - } + pp.playSound(location, Sound.valueOf(Sound_Name), Sound_Volume, Sound_Pitch); } } - } catch (Exception ex) { - Logger.warning("&eVerify that the sound name is correct or belongs to the version"); } + } catch (Exception ex) { + Logger.warning("&eVerify that the sound name is correct or belongs to the version"); } } else if (isGroup) { e.setQuitMessage(null); @@ -458,13 +378,11 @@ public void onQuit(@NotNull PlayerQuitEvent e) { groupHelper.setGroup(playerManager.getGroup(p)); groupHelper.setDiscord(discordSRVHHook); groupHelper.setEssentials(essentialsXDiscordHook); - groupHelper.onQuit(p, config, e); + groupHelper.onQuit(p, config); } else if (isNone) { e.setQuitMessage(null); } } } - - } diff --git a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/manager/DisplayManager.java b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/manager/DisplayManager.java index 981990f..0d0d827 100644 --- a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/manager/DisplayManager.java +++ b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/manager/DisplayManager.java @@ -12,6 +12,7 @@ import java.util.List; +@SuppressWarnings("all") public class DisplayManager { private final FileConfiguration config = CustomJoinAndQuitMessages.get().getConfigFile().getConfig(); @@ -41,8 +42,6 @@ public void showFirstJoinMessage() { Logger.warning("&e[showFirstJoinMessage] &b-> &7This feature is disabled and you will not be able to see the preview"); String text; - boolean isNormalType; - boolean isModifyType; boolean isHover; boolean isClick; List Hover_Text; @@ -53,8 +52,6 @@ public void showFirstJoinMessage() { if (Settings.is_Group_Display) { text = groups.getString(group + ".FirstJoin.Text"); - isNormalType = groups.getString(group + ".Type").equalsIgnoreCase("normal"); - isModifyType = groups.getString(group + ".Type").equalsIgnoreCase("modify"); isHover = groups.getString(group + ".HoverEvent.Enabled").equals("true"); isClick = groups.getString(group + ".ClickEvent.Enabled").equals("true"); Hover_Text = groups.getStringList(group + ".HoverEvent.Hover"); @@ -64,8 +61,6 @@ public void showFirstJoinMessage() { Action_Suggest = groups.getString(group + ".ClickEvent.Actions.Suggest-Command"); } else { text = Settings.join_message_first; - isNormalType = Settings.join_type.equalsIgnoreCase("normal"); - isModifyType = Settings.join_type.equalsIgnoreCase("modify"); isHover = config.getString("Join.HoverEvent.Enabled").equals("true"); isClick = config.getString("Join.ClickEvent.Enabled").equals("true"); @@ -78,34 +73,29 @@ public void showFirstJoinMessage() { MessageBuilder messageBuilder = new MessageBuilder(player, Util.color(Util.getVar(player, text))); - if (isNormalType) { - messageBuilder.send(); - return; - } else if (isModifyType) { - if (isHover) { - if (isClick) { - if (isClick_Mode.equalsIgnoreCase("command")) { - messageBuilder.setHover(Hover_Text).setExecuteCommand(Action_Command).send(); - } else if (isClick_Mode.equalsIgnoreCase("url")) { - messageBuilder.setHover(Hover_Text).setOpenURL(Action_Url).send(); - } else if (isClick_Mode.equalsIgnoreCase("suggest")) { - messageBuilder.setHover(Hover_Text).setSuggestCommand(Action_Suggest).send(); - } - } else { - messageBuilder.setHover(Hover_Text).send(); + if (isHover) { + if (isClick) { + if (isClick_Mode.equalsIgnoreCase("command")) { + messageBuilder.setHover(Hover_Text).setExecuteCommand(Action_Command).send(); + } else if (isClick_Mode.equalsIgnoreCase("url")) { + messageBuilder.setHover(Hover_Text).setOpenURL(Action_Url).send(); + } else if (isClick_Mode.equalsIgnoreCase("suggest")) { + messageBuilder.setHover(Hover_Text).setSuggestCommand(Action_Suggest).send(); } } else { - if (isClick) { - if (isClick_Mode.equalsIgnoreCase("command")) { - messageBuilder.setExecuteCommand(Action_Command).send(); - } else if (isClick_Mode.equalsIgnoreCase("url")) { - messageBuilder.setOpenURL(Action_Url).send(); - } else if (isClick_Mode.equalsIgnoreCase("suggest")) { - messageBuilder.setSuggestCommand(Action_Suggest).send(); - } - } else { - messageBuilder.send(); + messageBuilder.setHover(Hover_Text).send(); + } + } else { + if (isClick) { + if (isClick_Mode.equalsIgnoreCase("command")) { + messageBuilder.setExecuteCommand(Action_Command).send(); + } else if (isClick_Mode.equalsIgnoreCase("url")) { + messageBuilder.setOpenURL(Action_Url).send(); + } else if (isClick_Mode.equalsIgnoreCase("suggest")) { + messageBuilder.setSuggestCommand(Action_Suggest).send(); } + } else { + messageBuilder.send(); } } } @@ -127,8 +117,6 @@ public void showJoinMessage() { if (Settings.is_Group_Display) { text = groups.getString(group + ".Join-Text"); - isNormalType = groups.getString(group + ".Type").equalsIgnoreCase("normal"); - isModifyType = groups.getString(group + ".Type").equalsIgnoreCase("modify"); isHover = groups.getString(group + ".HoverEvent.Enabled").equals("true"); isClick = groups.getString(group + ".ClickEvent.Enabled").equals("true"); @@ -141,8 +129,6 @@ public void showJoinMessage() { Action_Suggest = groups.getString(group + ".ClickEvent.Actions.Suggest-Command"); } else { text = Settings.join_message; - isNormalType = Settings.join_type.equalsIgnoreCase("normal"); - isModifyType = Settings.join_type.equalsIgnoreCase("modify"); isHover = config.getString("Join.HoverEvent.Enabled").equals("true"); isClick = config.getString("Join.ClickEvent.Enabled").equals("true"); @@ -157,34 +143,29 @@ public void showJoinMessage() { MessageBuilder messageBuilder = new MessageBuilder(player, Util.color(Util.getVar(player, text))); - if (isNormalType) { - messageBuilder.send(); - return; - } else if (isModifyType) { - if (isHover) { - if (isClick) { - if (isClick_Mode.equalsIgnoreCase("command")) { - messageBuilder.setHover(Hover_Text).setExecuteCommand(Action_Command).send(); - } else if (isClick_Mode.equalsIgnoreCase("url")) { - messageBuilder.setHover(Hover_Text).setOpenURL(Action_Url).send(); - } else if (isClick_Mode.equalsIgnoreCase("suggest")) { - messageBuilder.setHover(Hover_Text).setSuggestCommand(Action_Suggest).send(); - } - } else { - messageBuilder.setHover(Hover_Text).send(); + if (isHover) { + if (isClick) { + if (isClick_Mode.equalsIgnoreCase("command")) { + messageBuilder.setHover(Hover_Text).setExecuteCommand(Action_Command).send(); + } else if (isClick_Mode.equalsIgnoreCase("url")) { + messageBuilder.setHover(Hover_Text).setOpenURL(Action_Url).send(); + } else if (isClick_Mode.equalsIgnoreCase("suggest")) { + messageBuilder.setHover(Hover_Text).setSuggestCommand(Action_Suggest).send(); } } else { - if (isClick) { - if (isClick_Mode.equalsIgnoreCase("command")) { - messageBuilder.setExecuteCommand(Action_Command).send(); - } else if (isClick_Mode.equalsIgnoreCase("url")) { - messageBuilder.setOpenURL(Action_Url).send(); - } else if (isClick_Mode.equalsIgnoreCase("suggest")) { - messageBuilder.setSuggestCommand(Action_Suggest).send(); - } - } else { - messageBuilder.send(); + messageBuilder.setHover(Hover_Text).send(); + } + } else { + if (isClick) { + if (isClick_Mode.equalsIgnoreCase("command")) { + messageBuilder.setExecuteCommand(Action_Command).send(); + } else if (isClick_Mode.equalsIgnoreCase("url")) { + messageBuilder.setOpenURL(Action_Url).send(); + } else if (isClick_Mode.equalsIgnoreCase("suggest")) { + messageBuilder.setSuggestCommand(Action_Suggest).send(); } + } else { + messageBuilder.send(); } } } @@ -220,8 +201,6 @@ public void showQuitMessage() { Action_Suggest = groups.getString(group + ".ClickEvent.Actions.Suggest-Command"); } else { text = Settings.quit_message; - isNormalType = Settings.quit_type.equalsIgnoreCase("normal"); - isModifyType = Settings.quit_type.equalsIgnoreCase("modify"); isHover = config.getString("Quit.HoverEvent.Enabled").equals("true"); isClick = config.getString("Quit.ClickEvent.Enabled").equals("true"); @@ -236,36 +215,32 @@ public void showQuitMessage() { MessageBuilder messageBuilder = new MessageBuilder(player, Util.color(Util.getVar(player, text))); - if (isNormalType) { - messageBuilder.send(); - return; - } else if (isModifyType) { - if (isHover) { - if (isClick) { - if (isClick_Mode.equalsIgnoreCase("command")) { - messageBuilder.setHover(Hover_Text).setExecuteCommand(Action_Command).send(); - } else if (isClick_Mode.equalsIgnoreCase("url")) { - messageBuilder.setHover(Hover_Text).setOpenURL(Action_Url).send(); - } else if (isClick_Mode.equalsIgnoreCase("suggest")) { - messageBuilder.setHover(Hover_Text).setSuggestCommand(Action_Suggest).send(); - } - } else { - messageBuilder.setHover(Hover_Text).send(); + if (isHover) { + if (isClick) { + if (isClick_Mode.equalsIgnoreCase("command")) { + messageBuilder.setHover(Hover_Text).setExecuteCommand(Action_Command).send(); + } else if (isClick_Mode.equalsIgnoreCase("url")) { + messageBuilder.setHover(Hover_Text).setOpenURL(Action_Url).send(); + } else if (isClick_Mode.equalsIgnoreCase("suggest")) { + messageBuilder.setHover(Hover_Text).setSuggestCommand(Action_Suggest).send(); } } else { - if (isClick) { - if (isClick_Mode.equalsIgnoreCase("command")) { - messageBuilder.setExecuteCommand(Action_Command).send(); - } else if (isClick_Mode.equalsIgnoreCase("url")) { - messageBuilder.setOpenURL(Action_Url).send(); - } else if (isClick_Mode.equalsIgnoreCase("suggest")) { - messageBuilder.setSuggestCommand(Action_Suggest).send(); - } - } else { - messageBuilder.send(); + messageBuilder.setHover(Hover_Text).send(); + } + } else { + if (isClick) { + if (isClick_Mode.equalsIgnoreCase("command")) { + messageBuilder.setExecuteCommand(Action_Command).send(); + } else if (isClick_Mode.equalsIgnoreCase("url")) { + messageBuilder.setOpenURL(Action_Url).send(); + } else if (isClick_Mode.equalsIgnoreCase("suggest")) { + messageBuilder.setSuggestCommand(Action_Suggest).send(); } + } else { + messageBuilder.send(); } } + } public void showWelcomeMessage() { @@ -281,7 +256,7 @@ public void showTitleMessage() { if (!Settings.join_title) Logger.warning("&e[showTitleMessage] &b-> &7This feature is disabled and you will not be able to see the preview"); - Titles.sendTitle(player, Settings.join_title_fadein, Settings.join_title_stay, Settings.join_title_fadeout, Settings.join_message_title_title, Settings.join_message_title_subtitle); + Titles.sendTitle(player, Settings.join_title_fadeIn, Settings.join_title_stay, Settings.join_title_fadeOut, Settings.join_message_title_title, Settings.join_message_title_subtitle); } public void showActionbar() { diff --git a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/manager/HookManager.java b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/manager/HookManager.java index 80b193a..ab3a328 100644 --- a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/manager/HookManager.java +++ b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/manager/HookManager.java @@ -7,8 +7,8 @@ public class HookManager { private static HookManager instance; - private final DiscordSRVHHook discordSRVHHook = new DiscordSRVHHook(this); - private final EssentialsXDiscordHook essentialsXDiscordHook = new EssentialsXDiscordHook(this); + private final DiscordSRVHHook discordSRVHHook = new DiscordSRVHHook(); + private final EssentialsXDiscordHook essentialsXDiscordHook = new EssentialsXDiscordHook(); private final EssentialsXHook essentialsXHook = new EssentialsXHook(this); private final LuckPermsHook luckPermsHook = new LuckPermsHook(); private final SuperVanishHook superVanishHook = new SuperVanishHook(); diff --git a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/update/UpdateChecker.java b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/update/UpdateChecker.java index 7bb9dbd..2d7d168 100644 --- a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/update/UpdateChecker.java +++ b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/update/UpdateChecker.java @@ -22,6 +22,7 @@ public UpdateChecker(CustomJoinAndQuitMessages plugin) { this.plugin = plugin; } + @SuppressWarnings("unused") public void sendGithubUpdate(){ getVersion("github" ,version -> { if (plugin.getDescription().getVersion().equalsIgnoreCase(version)) { @@ -60,7 +61,6 @@ private void getVersion(@NotNull String source, Consumer consumer) { break; case "github": url = UpdateSettings.API_UPDATE[1]; - break; default: Logger.error("Invalid source for update check: " + source); @@ -76,7 +76,7 @@ private void getVersion(@NotNull String source, Consumer consumer) { String latestRelease = scanner.next(); Gson gson = new Gson(); JsonObject json= gson.fromJson(latestRelease, JsonObject.class); - String versionName = json.get("name").getAsString(); + String versionName = json.get("tag_name").getAsString(); if(versionName.contains("Beta")){ Logger.info("The latest release is a beta version: " + versionName); @@ -88,10 +88,7 @@ private void getVersion(@NotNull String source, Consumer consumer) { }else{ consumer.accept(scanner.next()); } - - } - } catch (IOException e) { Logger.error("Could not check for updates: &c" + e.getMessage()); } diff --git a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/utils/GroupHelper.java b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/utils/GroupHelper.java index fe89f6b..a41bc3a 100644 --- a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/utils/GroupHelper.java +++ b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/utils/GroupHelper.java @@ -12,8 +12,6 @@ import org.bukkit.Sound; import org.bukkit.configuration.file.FileConfiguration; import org.bukkit.entity.Player; -import org.bukkit.event.player.PlayerJoinEvent; -import org.bukkit.event.player.PlayerQuitEvent; import org.jetbrains.annotations.Contract; import org.jetbrains.annotations.NotNull; @@ -43,7 +41,7 @@ public void setEssentials(EssentialsXDiscordHook essentialsXDiscordHook) { this.essentialsXDiscordHook = essentialsXDiscordHook; } - public void onJoin(Player player, FileConfiguration config, PlayerJoinEvent playerJoinEvent) { + public void onJoin(Player player, FileConfiguration config) { String temp = ""; String join = groupManager.getJoin(group); @@ -59,126 +57,97 @@ public void onJoin(Player player, FileConfiguration config, PlayerJoinEvent play temp = Util.color(Util.getVar(player, temp)); - boolean isNormalType = groupManager.getType(group).equalsIgnoreCase("normal"); - boolean isModifyType = groupManager.getType(group).equalsIgnoreCase("modify"); - MessageBuilder messageBuilder = new MessageBuilder(player, temp); if (config.getBoolean("Config.Show-Chat-In-Console")) { Logger.info(messageBuilder.getText()); } - if (isNormalType) { - playerJoinEvent.setJoinMessage(temp); - if (discordSRVHHook.isEnabled()) { - - if (Settings.hook_discordsrv_channelid.equalsIgnoreCase("none")) - return; - - DiscordUtil.sendMessageBlocking( - DiscordUtil.getTextChannelById(Settings.hook_discordsrv_channelid), - Util.colorless(messageBuilder.getText())); - } - - if (essentialsXDiscordHook.isEnabled()) { - if (Settings.hook_essentialsDiscord_channelid.equalsIgnoreCase("none")) - return; - - essentialsXDiscordHook.sendJoinMessage(Settings.hook_essentialsDiscord_channelid, - Util.colorless(messageBuilder.getText())); - } - } else if (isModifyType) { - - boolean isHover = groupManager.isHover(group); - boolean isClick = groupManager.isClick(group); - boolean isTitle = groupManager.isTitle(group); - boolean isSound = groupManager.isSound(group); - boolean isActionBar = groupManager.isActionbar(group); - boolean isSoundAll = groupManager.isSoundAll(group); - - List Hover_Text = groupManager.getHover(group); - - String isClick_Mode = groupManager.getClickMode(group); - String Action_Command = groupManager.getClickCommand(group); - String Action_Url = groupManager.getClickUrl(group); - String Action_Suggest = groupManager.getClickSuggestCommand(group); - String Title_Text = groupManager.getTitle(group); - String SubTitle_Text = groupManager.getSubTitle(group); - String Actionbar_Text = groupManager.getActionbar(group); - String Sound_Name = groupManager.getSound(group); - - int FadeIn = groupManager.getFadeIn(group); - int Stay = groupManager.getStay(group); - int FadeOut = groupManager.getFadeOut(group); - int Sound_Volume = groupManager.getVolume(group); - float Sound_Pitch = groupManager.getPitch(group); - - if (isHover) { - if (isClick) { - if (isClick_Mode.equalsIgnoreCase("command")) { - messageBuilder.setHover(Hover_Text).setExecuteCommand(Action_Command).sendToAll(); - } else if (isClick_Mode.equalsIgnoreCase("url")) { - messageBuilder.setHover(Hover_Text).setOpenURL(Action_Url).sendToAll(); - } else if (isClick_Mode.equalsIgnoreCase("suggest")) { - messageBuilder.setHover(Hover_Text).setSuggestCommand(Action_Suggest).sendToAll(); - } - } else { - messageBuilder.setHover(Hover_Text).sendToAll(); + boolean isHover = groupManager.isHover(group); + boolean isClick = groupManager.isClick(group); + boolean isTitle = groupManager.isTitle(group); + boolean isSound = groupManager.isSound(group); + boolean isActionBar = groupManager.isActionbar(group); + boolean isSoundAll = groupManager.isSoundAll(group); + + List Hover_Text = groupManager.getHover(group); + + String isClick_Mode = groupManager.getClickMode(group); + String Action_Command = groupManager.getClickCommand(group); + String Action_Url = groupManager.getClickUrl(group); + String Action_Suggest = groupManager.getClickSuggestCommand(group); + String Title_Text = groupManager.getTitle(group); + String SubTitle_Text = groupManager.getSubTitle(group); + String Actionbar_Text = groupManager.getActionbar(group); + String Sound_Name = groupManager.getSound(group); + + int FadeIn = groupManager.getFadeIn(group); + int Stay = groupManager.getStay(group); + int FadeOut = groupManager.getFadeOut(group); + int Sound_Volume = groupManager.getVolume(group); + float Sound_Pitch = groupManager.getPitch(group); + + if (isHover) { + if (isClick) { + if (isClick_Mode.equalsIgnoreCase("command")) { + messageBuilder.setHover(Hover_Text).setExecuteCommand(Action_Command).sendToAll(); + } else if (isClick_Mode.equalsIgnoreCase("url")) { + messageBuilder.setHover(Hover_Text).setOpenURL(Action_Url).sendToAll(); + } else if (isClick_Mode.equalsIgnoreCase("suggest")) { + messageBuilder.setHover(Hover_Text).setSuggestCommand(Action_Suggest).sendToAll(); } } else { - if (isClick) { - if (isClick_Mode.equalsIgnoreCase("command")) { - messageBuilder.setExecuteCommand(Action_Command).sendToAll(); - } else if (isClick_Mode.equalsIgnoreCase("url")) { - messageBuilder.setOpenURL(Action_Url).sendToAll(); - } else if (isClick_Mode.equalsIgnoreCase("suggest")) { - messageBuilder.setSuggestCommand(Action_Suggest).sendToAll(); - } - } else { - messageBuilder.sendToAll(); + messageBuilder.setHover(Hover_Text).sendToAll(); + } + } else { + if (isClick) { + if (isClick_Mode.equalsIgnoreCase("command")) { + messageBuilder.setExecuteCommand(Action_Command).sendToAll(); + } else if (isClick_Mode.equalsIgnoreCase("url")) { + messageBuilder.setOpenURL(Action_Url).sendToAll(); + } else if (isClick_Mode.equalsIgnoreCase("suggest")) { + messageBuilder.setSuggestCommand(Action_Suggest).sendToAll(); } + } else { + messageBuilder.sendToAll(); } + } - if (discordSRVHHook.isEnabled()) { - DiscordUtil.sendMessageBlocking( - DiscordUtil.getTextChannelById(Settings.hook_discordsrv_channelid), - Util.colorless(messageBuilder.getText())); - } + if (discordSRVHHook.isEnabled()) { + DiscordUtil.sendMessageBlocking( + DiscordUtil.getTextChannelById(Settings.hook_discordSrv_channelId), + Util.colorless(messageBuilder.getText())); + } - if (isTitle) { - Titles.sendTitle(player, FadeIn, Stay, FadeOut, Util.color(Util.getVar(player, Title_Text)), - Util.color(Util.getVar(player, SubTitle_Text))); - } + if (isTitle) { + Titles.sendTitle(player, FadeIn, Stay, FadeOut, Util.color(Util.getVar(player, Title_Text)), + Util.color(Util.getVar(player, SubTitle_Text))); + } - if (isActionBar) { - ActionBar.sendActionBar(player, Util.color(Util.getVar(player, Actionbar_Text))); - } + if (isActionBar) { + ActionBar.sendActionBar(player, Util.color(Util.getVar(player, Actionbar_Text))); + } - try { - if (isSound) { - if (isSoundAll) { + try { + if (isSound) { + if (isSoundAll) { + Location location = player.getLocation(); + player.playSound(location, Sound.valueOf(Sound_Name), Sound_Volume, Sound_Pitch); + } else { + for (Player pp : Bukkit.getOnlinePlayers()) { Location location = player.getLocation(); - player.playSound(location, Sound.valueOf(Sound_Name), Sound_Volume, Sound_Pitch); - } else { - for (Player pp : Bukkit.getOnlinePlayers()) { - Location location = player.getLocation(); - pp.playSound(location, Sound.valueOf(Sound_Name), Sound_Volume, Sound_Pitch); - } + pp.playSound(location, Sound.valueOf(Sound_Name), Sound_Volume, Sound_Pitch); } } - } catch (Exception ex) { - Logger.warning("&eVerify that the sound name is correct or belongs to the version"); } + } catch (Exception ex) { + Logger.warning("&eVerify that the sound name is correct or belongs to the version"); } } - public void onQuit(Player player, @NotNull FileConfiguration config, PlayerQuitEvent playerQuitEvent) { + public void onQuit(Player player, @NotNull FileConfiguration config) { String quit = groupManager.getQuit(group); - - boolean isNormalType = groupManager.getType(group).equalsIgnoreCase("normal"); - boolean isModifyType = groupManager.getType(group).equalsIgnoreCase("modify"); - quit = Util.color(Util.getVar(player, quit)); MessageBuilder messageBuilder = new MessageBuilder(player, quit); @@ -186,102 +155,82 @@ public void onQuit(Player player, @NotNull FileConfiguration config, PlayerQuitE Logger.info(messageBuilder.getText()); } - if (isNormalType) { - playerQuitEvent.setQuitMessage(quit); - if (discordSRVHHook.isEnabled()) { - if (Settings.hook_discordsrv_channelid.equalsIgnoreCase("none")) - return; - DiscordUtil.sendMessageBlocking( - DiscordUtil.getTextChannelById(Settings.hook_discordsrv_channelid), - Util.colorless(messageBuilder.getText())); - } - - if (essentialsXDiscordHook.isEnabled()) { - if (Settings.hook_essentialsDiscord_channelid.equalsIgnoreCase("none")) - return; - essentialsXDiscordHook.sendQuitMessage(Settings.hook_essentialsDiscord_channelid, - Util.colorless(messageBuilder.getText())); - } - } else if (isModifyType) { - - boolean isHover = groupManager.isHover(group); - boolean isClick = groupManager.isClick(group); - boolean isSound = groupManager.isSound(group); - boolean isSoundAll = groupManager.isSoundAll(group); - - List Hover_Text = groupManager.getHover(group); - - String isClick_Mode = groupManager.getClickMode(group); - String Action_Command = groupManager.getClickCommand(group); - String Action_Url = groupManager.getClickUrl(group); - String Action_Suggest = groupManager.getClickSuggestCommand(group); - String Sound_Name = groupManager.getSound(group); - - int Sound_Volume = groupManager.getVolume(group); - float Sound_Pitch = groupManager.getPitch(group); - - if (isHover) { - if (isClick) { - if (isClick_Mode.equalsIgnoreCase("command")) { - messageBuilder.setHover(Hover_Text).setExecuteCommand(Action_Command).sendToAll(); - } else if (isClick_Mode.equalsIgnoreCase("url")) { - messageBuilder.setHover(Hover_Text).setOpenURL(Action_Url).sendToAll(); - } else if (isClick_Mode.equalsIgnoreCase("suggest")) { - messageBuilder.setHover(Hover_Text).setSuggestCommand(Action_Suggest).sendToAll(); - } - } else { - messageBuilder.setHover(Hover_Text).sendToAll(); + boolean isHover = groupManager.isHover(group); + boolean isClick = groupManager.isClick(group); + boolean isSound = groupManager.isSound(group); + boolean isSoundAll = groupManager.isSoundAll(group); + + List Hover_Text = groupManager.getHover(group); + + String isClick_Mode = groupManager.getClickMode(group); + String Action_Command = groupManager.getClickCommand(group); + String Action_Url = groupManager.getClickUrl(group); + String Action_Suggest = groupManager.getClickSuggestCommand(group); + String Sound_Name = groupManager.getSound(group); + + int Sound_Volume = groupManager.getVolume(group); + float Sound_Pitch = groupManager.getPitch(group); + + if (isHover) { + if (isClick) { + if (isClick_Mode.equalsIgnoreCase("command")) { + messageBuilder.setHover(Hover_Text).setExecuteCommand(Action_Command).sendToAll(); + } else if (isClick_Mode.equalsIgnoreCase("url")) { + messageBuilder.setHover(Hover_Text).setOpenURL(Action_Url).sendToAll(); + } else if (isClick_Mode.equalsIgnoreCase("suggest")) { + messageBuilder.setHover(Hover_Text).setSuggestCommand(Action_Suggest).sendToAll(); } } else { - if (isClick) { - if (isClick_Mode.equalsIgnoreCase("command")) { - messageBuilder.setExecuteCommand(Action_Command).sendToAll(); - } else if (isClick_Mode.equalsIgnoreCase("url")) { - messageBuilder.setOpenURL(Action_Url).sendToAll(); - } else if (isClick_Mode.equalsIgnoreCase("suggest")) { - messageBuilder.setSuggestCommand(Action_Suggest).sendToAll(); - } - } else { - messageBuilder.sendToAll(); + messageBuilder.setHover(Hover_Text).sendToAll(); + } + } else { + if (isClick) { + if (isClick_Mode.equalsIgnoreCase("command")) { + messageBuilder.setExecuteCommand(Action_Command).sendToAll(); + } else if (isClick_Mode.equalsIgnoreCase("url")) { + messageBuilder.setOpenURL(Action_Url).sendToAll(); + } else if (isClick_Mode.equalsIgnoreCase("suggest")) { + messageBuilder.setSuggestCommand(Action_Suggest).sendToAll(); } + } else { + messageBuilder.sendToAll(); } + } - if (discordSRVHHook.isEnabled()) { + if (discordSRVHHook.isEnabled()) { - if (Settings.hook_discordsrv_channelid.equalsIgnoreCase("none")) - return; + if (Settings.hook_discordSrv_channelId.equalsIgnoreCase("none")) + return; - DiscordUtil.sendMessageBlocking( - DiscordUtil.getTextChannelById(Settings.hook_discordsrv_channelid), - Util.colorless(messageBuilder.getText())); - } + DiscordUtil.sendMessageBlocking( + DiscordUtil.getTextChannelById(Settings.hook_discordSrv_channelId), + Util.colorless(messageBuilder.getText())); + } - if (essentialsXDiscordHook.isEnabled()) { + if (essentialsXDiscordHook.isEnabled()) { - if (Settings.hook_essentialsDiscord_channelid.equalsIgnoreCase("none")) - return; + if (Settings.hook_essentialsDiscord_channelId.equalsIgnoreCase("none")) + return; - essentialsXDiscordHook.sendQuitMessage(Settings.hook_essentialsDiscord_channelid, - Util.colorless(messageBuilder.getText())); - } + essentialsXDiscordHook.sendQuitMessage(Settings.hook_essentialsDiscord_channelId, + Util.colorless(messageBuilder.getText())); + } - try { - if (isSound) { - if (isSoundAll) { + try { + if (isSound) { + if (isSoundAll) { + Location location = player.getLocation(); + player.playSound(location, Sound.valueOf(Sound_Name), Sound_Volume, Sound_Pitch); + } else { + for (Player pp : Bukkit.getOnlinePlayers()) { Location location = player.getLocation(); - player.playSound(location, Sound.valueOf(Sound_Name), Sound_Volume, Sound_Pitch); - } else { - for (Player pp : Bukkit.getOnlinePlayers()) { - Location location = player.getLocation(); - pp.playSound(location, Sound.valueOf(Sound_Name), Sound_Volume, Sound_Pitch); - } + pp.playSound(location, Sound.valueOf(Sound_Name), Sound_Volume, Sound_Pitch); } } - } catch (Exception ex) { - Logger.warning("&eVerify that the sound name is correct or belongs to the version"); } + } catch (Exception ex) { + Logger.warning("&eVerify that the sound name is correct or belongs to the version"); } - } } diff --git a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/utils/Settings.java b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/utils/Settings.java index 0e475a6..7a2e63f 100644 --- a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/utils/Settings.java +++ b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/utils/Settings.java @@ -14,7 +14,6 @@ public class Settings { public static boolean settings_debug; //Join section - public static String join_type; public static boolean join; public static String join_message; @@ -25,9 +24,9 @@ public class Settings { public static boolean join_title; public static String join_message_title_title; public static String join_message_title_subtitle; - public static int join_title_fadein; + public static int join_title_fadeIn; public static int join_title_stay; - public static int join_title_fadeout; + public static int join_title_fadeOut; public static boolean join_actionbar; public static String join_message_actionbar_text; @@ -38,33 +37,23 @@ public class Settings { public static int join_sound_vol; //Quit section - - public static String quit_type; - public static boolean quit; public static String quit_message; - public static boolean quit_sound; - public static String quit_sound_name; - public static float quit_sound_pitch; - public static int quit_sound_vol; - //Welcome section public static boolean welcome; public static List list_welcome; //Hooks section - public static boolean hook_discordsrv; - public static boolean hook_discordsrv_use_message; - public static String hook_discordsrv_channelid; + public static boolean hook_discordSrv; + public static String hook_discordSrv_channelId; public static boolean hook_essentials; - public static boolean hook_essentials_hideplayervanish; + public static boolean hook_essentials_hidePlayerVanish; public static boolean hook_essentialsDiscord; public static boolean hook_essentialsDiscord_use_default_channel; - public static String hook_essentialsDiscord_channelid; + public static String hook_essentialsDiscord_channelId; public static boolean hook_luckperms; - public static boolean hook_luckperms_use_group; public static long hook_luckperms_autoUpdate_group_tick; } diff --git a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/utils/Util.java b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/utils/Util.java index 4d1a330..206c353 100644 --- a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/utils/Util.java +++ b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/utils/Util.java @@ -67,10 +67,8 @@ private static void sendEnable(String message) { return prefix; } - public static @NotNull List setTabLimit(final @NotNull List options, final String lastArgs) { final List returned = new ArrayList<>(); - for (String s : options) { if (s == null) { continue; @@ -82,26 +80,12 @@ private static void sendEnable(String message) { return returned; } - @SuppressWarnings("unused") - public static void sendTextComponentHover(@NotNull Player j, String action, String message, String subMessage, String color) { - TextComponent msg = new TextComponent(color(message)); - msg.setHoverEvent(new HoverEvent(HoverEvent.Action.valueOf(getActionHoverType(action)), new ComponentBuilder(subMessage).color(ChatColor.of(color)).create())); - j.spigot().sendMessage(msg); - } - public static void sendTextComponent116Hover(@NotNull Player j, String action, String message, String subMessage) { TextComponent msg = new TextComponent(color(message)); msg.setHoverEvent(new HoverEvent(HoverEvent.Action.valueOf(getActionHoverType(action)), new ComponentBuilder(color(subMessage)).create())); j.spigot().sendMessage(msg); } - @SuppressWarnings("unused") - public static void sendTextComponentClick(@NotNull Player j, String action, String message, String arg0) { - TextComponent msg = new TextComponent(color(message)); - msg.setClickEvent(new ClickEvent(ClickEvent.Action.valueOf(getActionClickType(action)), arg0)); - j.spigot().sendMessage(msg); - } - public static void sendAllPlayerBaseComponent(BaseComponent component) { for (Player p : Bukkit.getOnlinePlayers()) { p.spigot().sendMessage(component); @@ -121,16 +105,6 @@ public static void sendAllPlayerBaseComponent(BaseComponent component) { return null; } - public static @Nullable String getActionClickType(@NotNull String arg) { - if (arg.equalsIgnoreCase("url")) { - return "OPEN_URL"; - } - if (arg.equalsIgnoreCase("cmd")) { - return "RUN_COMMAND"; - } - return null; - } - public static @NotNull String getVar(@NotNull Player player, String text) { text = text.replace("", player.getName()); text = text.replace("", player.getDisplayName()); diff --git a/CustomJoinAndQuitMessagesOld/src/main/resources/config.yml b/CustomJoinAndQuitMessagesOld/src/main/resources/config.yml index 8abb878..be20eea 100644 --- a/CustomJoinAndQuitMessagesOld/src/main/resources/config.yml +++ b/CustomJoinAndQuitMessagesOld/src/main/resources/config.yml @@ -105,9 +105,6 @@ Join: # |Text| Here you can set the join message for the first time Text: '&6Welcome to server &a&6 for the first time' - # |Type| Here you can find two types that are [ normal | modify ] - Type: modify - # |HoverEvent| This section allows you to modify the hover events in the chat HoverEvent: @@ -129,12 +126,6 @@ Join: # |Mode| there are three different modes which are [ command | suggest | url ] Mode: command - # This feature is not available yet - DevActions: - - '[Suggest]: /help' - - '[Execute]: /me hello test' - - '[Open]: https://www.spigotmc.org/resources/custom-join-and-quit-message-1-7-x-1-17-x.57006/' - # |Actions| This is where are the available events that you can use Actions: @@ -205,9 +196,6 @@ Quit: # |Text| This is where Quit customizable message is located Text: '&b[<#:FF8E8E>-&b] <#:A157FF>' - # |Type| Here you can find two types that are [ normal | modify ] - Type: normal - # |HoverEvent| This section allows you to modify the hover events in the chat HoverEvent: @@ -280,7 +268,7 @@ Welcome: - '&m=========================================&r' # # |File-Version|I would not change anything -File-Version: 3 +File-Version: 4 # |> This is the end of the configuration ... [-_-] more things coming soon # # | Config File | diff --git a/CustomJoinAndQuitMessagesOld/src/main/resources/groups.yml b/CustomJoinAndQuitMessagesOld/src/main/resources/groups.yml index 76fbff6..41f0c8e 100644 --- a/CustomJoinAndQuitMessagesOld/src/main/resources/groups.yml +++ b/CustomJoinAndQuitMessagesOld/src/main/resources/groups.yml @@ -32,9 +32,6 @@ default: # |Text| Here you can set the join message for the first time Text: '&6Welcome to server &a&6 for the first time' - - # |Type| Here you can find two types that are [ normal | modify ] - Type: modify # |HoverEvent| This section allows you to modify the hover events in the chat HoverEvent: diff --git a/bukkit/src/main/java/jss/customjoinandquitmessage/commands/subcommands/InfoCommand.java b/bukkit/src/main/java/jss/customjoinandquitmessage/commands/subcommands/InfoCommand.java index bb52974..67096d3 100644 --- a/bukkit/src/main/java/jss/customjoinandquitmessage/commands/subcommands/InfoCommand.java +++ b/bukkit/src/main/java/jss/customjoinandquitmessage/commands/subcommands/InfoCommand.java @@ -9,6 +9,11 @@ public String name() { return "info"; } + @Override + public String permission() { + return null; + } + public void onCommand(CommandSender sender, String[] args) { } diff --git a/patches/Removed_debugging_messages_in_the_LuckPermsHook_class_.patch b/patches/Removed_debugging_messages_in_the_LuckPermsHook_class_.patch new file mode 100644 index 0000000..443a306 --- /dev/null +++ b/patches/Removed_debugging_messages_in_the_LuckPermsHook_class_.patch @@ -0,0 +1,29 @@ +Index: CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/hook/LuckPermsHook.java +IDEA additional info: +Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +<+>UTF-8 +=================================================================== +diff --git a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/hook/LuckPermsHook.java b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/hook/LuckPermsHook.java +--- a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/hook/LuckPermsHook.java (revision 52d1e6b32c970d5470b3f06b418c1d1ef9e3aeb1) ++++ b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/hook/LuckPermsHook.java (revision 60d9051d52d70ed86db8e0fc1a50da61f395e55a) +@@ -25,19 +25,16 @@ + if (!Bukkit.getPluginManager().isPluginEnabled("LuckPerms")) { + Logger.warning("&eLuckPerms not enabled! - Disable Features..."); + this.isEnabled = false; +- System.out.println("Cjm Softdepend: Luckperms false - check plugin installed in plugin folder"); + return; + } + + if (!Settings.hook_luckperms) { + this.isEnabled = false; +- System.out.println("Cjm Softdepend: Luckperms false - Hook Enabled in config"); +- Logger.warning("&eLuckPerms not enabled! - Disable Features..."); ++ System.out.println("Cjm Softdepend: Luckperms false - Hook disabled in config"); + return; + } + + this.isEnabled = true; +- System.out.println("Cjm Softdepend: Luckperms true - The plugin has successfully loaded the dependency"); + Util.sendColorMessage(EventUtils.getStaticConsoleSender(), Util.getPrefix(true) + "&aLoading LuckPerms features..."); + } + From 6f51455f26ef7aad69f1b9446a2a31237d1f5040 Mon Sep 17 00:00:00 2001 From: SrJss <31166687+jonagamerpro1234@users.noreply.github.com> Date: Mon, 27 Feb 2023 14:10:35 -0300 Subject: [PATCH 17/27] Fixed PlayerStorageData --- .../CustomJoinAndQuitMessages.java | 3 +- .../listener/JoinListener.java | 11 +- ...nd_modify_of_Join_and_Quit_and_more_.patch | 1659 +++++++++++++++++ 3 files changed, 1661 insertions(+), 12 deletions(-) create mode 100644 patches/Removed_types_normal_and_modify_of_Join_and_Quit_and_more_.patch diff --git a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/CustomJoinAndQuitMessages.java b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/CustomJoinAndQuitMessages.java index df9feae..038e276 100644 --- a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/CustomJoinAndQuitMessages.java +++ b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/CustomJoinAndQuitMessages.java @@ -28,7 +28,6 @@ public class CustomJoinAndQuitMessages extends JavaPlugin { private static CustomJoinAndQuitMessages plugin; public Metrics metrics; - public boolean useLatestversion; private final PluginDescriptionFile jss = getDescription(); public String name = this.jss.getName(); public String version = this.jss.getVersion(); @@ -46,7 +45,7 @@ public void onLoad() { Util.sendLoadTitle(version); inventoryViews = new ArrayList<>(); - Util.createFolder(this,"Players"); + //Util.createFolder(this,"Players"); } public void onEnable() { diff --git a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/listener/JoinListener.java b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/listener/JoinListener.java index 27af372..c54e1b0 100644 --- a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/listener/JoinListener.java +++ b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/listener/JoinListener.java @@ -8,8 +8,6 @@ import jss.customjoinandquitmessages.json.MessageBuilder; import jss.customjoinandquitmessages.manager.HookManager; import jss.customjoinandquitmessages.manager.PlayerManager; -import jss.customjoinandquitmessages.storage.PlayerData; -import jss.customjoinandquitmessages.storage.PlayerJsonStorage; import jss.customjoinandquitmessages.update.UpdateChecker; import jss.customjoinandquitmessages.utils.GroupHelper; import jss.customjoinandquitmessages.utils.Logger; @@ -55,13 +53,6 @@ public void onJoinListener(@NotNull PlayerJoinEvent e) { tempGroup = "default"; } - PlayerJsonStorage playerJsonStorage = new PlayerJsonStorage(plugin); - PlayerData playerData = playerJsonStorage.loadPlayerData(p.getName()); - - if(playerData == null){ - playerJsonStorage.savePlayerData(new PlayerData(p.getName())); - } - PlayerManager playerManager = new PlayerManager(); playerManager.createPlayer(p, tempGroup); @@ -245,7 +236,7 @@ public void onUpdate(@NotNull PlayerJoinEvent e) { } } - @EventHandler + @EventHandler(priority = EventPriority.HIGH) public void onQuit(@NotNull PlayerQuitEvent e) { FileConfiguration config = plugin.getConfigFile().getConfig(); Player p = e.getPlayer(); diff --git a/patches/Removed_types_normal_and_modify_of_Join_and_Quit_and_more_.patch b/patches/Removed_types_normal_and_modify_of_Join_and_Quit_and_more_.patch new file mode 100644 index 0000000..a5d45d5 --- /dev/null +++ b/patches/Removed_types_normal_and_modify_of_Join_and_Quit_and_more_.patch @@ -0,0 +1,1659 @@ +Index: CustomJoinAndQuitMessagesOld/pom.xml +IDEA additional info: +Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +<+>UTF-8 +=================================================================== +diff --git a/CustomJoinAndQuitMessagesOld/pom.xml b/CustomJoinAndQuitMessagesOld/pom.xml +--- a/CustomJoinAndQuitMessagesOld/pom.xml (revision 60d9051d52d70ed86db8e0fc1a50da61f395e55a) ++++ b/CustomJoinAndQuitMessagesOld/pom.xml (revision 5436229cc153c4aec4cd6267d80f1e8301022990) +@@ -9,7 +9,7 @@ + + + CustomJoinAndQuitMessagesOld +- 1.7.8-release ++ 1.7.9-release + + + 8 +Index: CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/commands/CustomJoinAndQuitCmd.java +IDEA additional info: +Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +<+>UTF-8 +=================================================================== +diff --git a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/commands/CustomJoinAndQuitCmd.java b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/commands/CustomJoinAndQuitCmd.java +--- a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/commands/CustomJoinAndQuitCmd.java (revision 60d9051d52d70ed86db8e0fc1a50da61f395e55a) ++++ b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/commands/CustomJoinAndQuitCmd.java (revision 5436229cc153c4aec4cd6267d80f1e8301022990) +@@ -58,7 +58,7 @@ + if (args.length >= 1) { + + if (args[0].equalsIgnoreCase("help")) { +- if ((j.isOp()) || (j.hasPermission("Cjm.Help"))) { ++ if ((j.isOp()) || (j.hasPermission("cjm.command.help"))) { + Util.sendColorMessage(j, "&5-=-=-=-=-=-=-=-=-=-=-=&6[&d" + plugin.name + "&6]&5=-=-=-=-=-=-=-=-=-=-=-"); + for (String text : plugin.Locale().help_1) { + Util.sendColorMessage(j, text); +@@ -71,7 +71,7 @@ + } + + if (args[0].equalsIgnoreCase("reload") || args[0].equalsIgnoreCase("rl")) { +- if ((j.isOp()) || (j.hasPermission("Cjm.Reload"))) { ++ if ((j.isOp()) || (j.hasPermission(" cjm.command.reload"))) { + plugin.reloadAllFiles(); + Util.sendColorMessage(j, Util.getPrefix(false) + plugin.Locale().reload); + } else { +Index: CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/config/utils/PreConfigLoader.java +IDEA additional info: +Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +<+>UTF-8 +=================================================================== +diff --git a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/config/utils/PreConfigLoader.java b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/config/utils/PreConfigLoader.java +--- a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/config/utils/PreConfigLoader.java (revision 60d9051d52d70ed86db8e0fc1a50da61f395e55a) ++++ b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/config/utils/PreConfigLoader.java (revision 5436229cc153c4aec4cd6267d80f1e8301022990) +@@ -32,7 +32,6 @@ + //Join + Settings.join = Objects.equals(config.getString("Join.Enabled"), "true"); + Settings.join_message = config.getString("Join.Text"); +- Settings.join_type = config.getString("Join.Type"); + + Settings.firstjoin = Objects.equals(config.getString("Join.First-Join.Enabled"), "true"); + Settings.join_message_first = config.getString("Join.First-Join.Text"); +@@ -43,9 +42,9 @@ + Settings.join_message_title_title = config.getString("Join.Title.Title"); + Settings.join_message_title_subtitle = config.getString("Join.Title.SubTitle"); + +- Settings.join_title_fadein = config.getInt("Join.Title.FadeIn"); ++ Settings.join_title_fadeIn = config.getInt("Join.Title.FadeIn"); + Settings.join_title_stay = config.getInt("Join.Title.Stay"); +- Settings.join_title_fadeout = config.getInt("Join.Title.FadeOut"); ++ Settings.join_title_fadeOut = config.getInt("Join.Title.FadeOut"); + + Settings.join_sound = Objects.equals(config.getString("Join.Sound.Enabled"), "true"); + Settings.join_sound_name = config.getString("Join.Sound.Name"); +@@ -54,7 +53,6 @@ + + //Quit + Settings.quit = Objects.equals(config.getString("Quit.Enabled"), "true"); +- Settings.quit_type = config.getString("Quit.Type"); + Settings.quit_message = config.getString("Quit.Text"); + + //Welcome +@@ -62,11 +60,11 @@ + Settings.list_welcome = config.getStringList("Welcome.Text"); + + //Hooks +- Settings.hook_discordsrv = Objects.equals(config.getString("Hooks.DiscordSRV.Enabled"), "true"); +- Settings.hook_discordsrv_channelid = config.getString("Hooks.DiscordSRV.Channel-ID"); ++ Settings.hook_discordSrv = Objects.equals(config.getString("Hooks.DiscordSRV.Enabled"), "true"); ++ Settings.hook_discordSrv_channelId = config.getString("Hooks.DiscordSRV.Channel-ID"); + + Settings.hook_essentialsDiscord = Objects.equals(config.getString("Hooks.EssentialsDiscord.Enabled"), "true"); +- Settings.hook_essentialsDiscord_channelid = config.getString("Hooks.EssentialsDiscord.Channel-ID"); ++ Settings.hook_essentialsDiscord_channelId = config.getString("Hooks.EssentialsDiscord.Channel-ID"); + Settings.hook_essentialsDiscord_use_default_channel = config.getBoolean("Hooks.EssentialsDiscord.Use-Default-Channel"); + + Settings.hook_luckperms = config.getBoolean("Hooks.LuckPerms.Enabled"); +@@ -74,7 +72,7 @@ + Settings.hook_luckperms_autoUpdate_group_tick = config.getLong("Hooks.LuckPerms.AutoUpdateGroup.Tick"); + + Settings.hook_essentials = Objects.equals(config.getString("Hooks.Essentials.Enabled"), "true"); +- Settings.hook_essentials_hideplayervanish = config.getBoolean("Hooks.Essentials.HidePlayerIsVanish"); ++ Settings.hook_essentials_hidePlayerVanish = config.getBoolean("Hooks.Essentials.HidePlayerIsVanish"); + + } catch (Exception e) { + Logger.error("&cThere was an error loading the &b[PreConfigLoader]&7, please reload the plugin"); +Index: CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/hook/DiscordSRVHHook.java +IDEA additional info: +Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +<+>UTF-8 +=================================================================== +diff --git a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/hook/DiscordSRVHHook.java b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/hook/DiscordSRVHHook.java +--- a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/hook/DiscordSRVHHook.java (revision 60d9051d52d70ed86db8e0fc1a50da61f395e55a) ++++ b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/hook/DiscordSRVHHook.java (revision 5436229cc153c4aec4cd6267d80f1e8301022990) +@@ -1,6 +1,5 @@ + package jss.customjoinandquitmessages.hook; + +-import jss.customjoinandquitmessages.manager.HookManager; + import jss.customjoinandquitmessages.utils.EventUtils; + import jss.customjoinandquitmessages.utils.Logger; + import jss.customjoinandquitmessages.utils.Settings; +@@ -10,13 +9,8 @@ + + public class DiscordSRVHHook implements IHook { + +- private HookManager hookManager; + private boolean isEnabled; + +- public DiscordSRVHHook(HookManager hookManager) { +- this.hookManager = hookManager; +- } +- + public void setup() { + if (!Bukkit.getPluginManager().isPluginEnabled("DiscordSRV")) { + Logger.warning("&eDiscordSRV not enabled! - Disable Features..."); +@@ -24,7 +18,7 @@ + return; + } + +- if (!Settings.hook_discordsrv) { ++ if (!Settings.hook_discordSrv) { + this.isEnabled = false; + Logger.warning("&eDiscordSRV not enabled! - Disable Features..."); + return; +@@ -38,7 +32,4 @@ + return isEnabled; + } + +- public HookManager getHookManager() { +- return hookManager; +- } + } +Index: CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/hook/EssentialsXDiscordHook.java +IDEA additional info: +Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +<+>UTF-8 +=================================================================== +diff --git a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/hook/EssentialsXDiscordHook.java b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/hook/EssentialsXDiscordHook.java +--- a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/hook/EssentialsXDiscordHook.java (revision 60d9051d52d70ed86db8e0fc1a50da61f395e55a) ++++ b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/hook/EssentialsXDiscordHook.java (revision 5436229cc153c4aec4cd6267d80f1e8301022990) +@@ -1,6 +1,5 @@ + package jss.customjoinandquitmessages.hook; + +-import jss.customjoinandquitmessages.manager.HookManager; + import jss.customjoinandquitmessages.utils.EventUtils; + import jss.customjoinandquitmessages.utils.Logger; + import jss.customjoinandquitmessages.utils.Settings; +@@ -12,14 +11,9 @@ + + public class EssentialsXDiscordHook implements IHook { + +- private HookManager hookManager; + private boolean isEnabled; + private DiscordService service; + +- public EssentialsXDiscordHook(HookManager hookManager) { +- this.hookManager = hookManager; +- } +- + public void setup() { + if (!Bukkit.getPluginManager().isPluginEnabled("EssentialsDiscord")) { + Logger.warning("&eEssentialsDiscord not enabled! - Disable Features..."); +@@ -43,27 +37,22 @@ + return isEnabled; + } + +- public DiscordService getService() { +- return service; +- } +- ++ @SuppressWarnings("unused") + public void sendJoinMessage(String channelId, String message) { + if (Settings.hook_essentialsDiscord_use_default_channel) { + service.sendMessage(MessageType.DefaultTypes.JOIN, message, false); + } else { +- service.sendMessage(new MessageType(Settings.hook_essentialsDiscord_channelid), message, false); ++ service.sendMessage(new MessageType(Settings.hook_essentialsDiscord_channelId), message, false); + } + } + ++ @SuppressWarnings("unused") + public void sendQuitMessage(String channelId, String message) { + if (Settings.hook_essentialsDiscord_use_default_channel) { + service.sendMessage(MessageType.DefaultTypes.LEAVE, message, false); + } else { +- service.sendMessage(new MessageType(Settings.hook_essentialsDiscord_channelid), message, false); ++ service.sendMessage(new MessageType(Settings.hook_essentialsDiscord_channelId), message, false); + } + } + +- public HookManager getHookManager() { +- return hookManager; +- } + } +Index: CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/listener/JoinListener.java +IDEA additional info: +Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +<+>UTF-8 +=================================================================== +diff --git a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/listener/JoinListener.java b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/listener/JoinListener.java +--- a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/listener/JoinListener.java (revision 60d9051d52d70ed86db8e0fc1a50da61f395e55a) ++++ b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/listener/JoinListener.java (revision 5436229cc153c4aec4cd6267d80f1e8301022990) +@@ -103,7 +103,7 @@ + } + + if (essentialsXHook.isEnabled()) { +- if (Settings.hook_essentials_hideplayervanish) { ++ if (Settings.hook_essentials_hidePlayerVanish) { + if (essentialsXHook.isVanish(p)) { + e.setJoinMessage(null); + return; +@@ -115,11 +115,10 @@ + if (isNormal) { + e.setJoinMessage(null); + ++ String text; + String join = Settings.join_message; + String firstjoin = Settings.join_message_first; + +- String text; +- + if (Settings.firstjoin) { + if (!p.hasPlayedBefore()) { + text = firstjoin; +@@ -130,161 +129,106 @@ + text = join; + } + +- boolean isNormalType = Settings.join_type.equalsIgnoreCase("normal"); +- boolean isModifyType = Settings.join_type.equalsIgnoreCase("modify"); +- + text = Util.color(Util.getVar(p, text)); +- + MessageBuilder messageBuilder = new MessageBuilder(p, text); + +- //Update Logger + if (config.getBoolean("Config.Show-Chat-In-Console")) { + Logger.info(messageBuilder.getText()); + } + +- if (isNormalType) { +- e.setJoinMessage(text); +- if (discordSRVHHook.isEnabled()) { +- +- if (Settings.hook_discordsrv_channelid.equalsIgnoreCase("none")) +- return; +- +- DiscordUtil.sendMessageBlocking( +- DiscordUtil.getTextChannelById(Settings.hook_discordsrv_channelid), +- Util.colorless(messageBuilder.getText())); +- } +- +- if (essentialsXDiscordHook.isEnabled()) { +- if (Settings.hook_essentialsDiscord_channelid.equalsIgnoreCase("none")) +- return; +- +- essentialsXDiscordHook.sendJoinMessage(Settings.hook_essentialsDiscord_channelid, +- Util.colorless(messageBuilder.getText())); +- } +- +- //Removed IsModifyType in 1.8.0 +- } else if (isModifyType) { +- boolean isHover = Objects.equals(config.getString("Join.HoverEvent.Enabled"), "true"); +- boolean isClick = Objects.equals(config.getString("Join.ClickEvent.Enabled"), "true"); +- boolean isTitle = Objects.equals(config.getString("Join.Title.Enabled"), "true"); +- boolean isSound = Objects.equals(config.getString("Join.Sound.Enabled"), "true"); +- boolean isActionBar = Objects.equals(config.getString("Join.ActionBar.Enabled"), "true"); +- boolean isSoundAll = Objects.equals(config.getString("Join.Sound.Send-To-All"), "true"); ++ boolean isHover = config.getBoolean("Join.HoverEvent.Enabled"); ++ boolean isClick = config.getBoolean("Join.ClickEvent.Enabled"); ++ boolean isTitle = config.getBoolean("Join.Title.Enabled"); ++ boolean isSound = config.getBoolean("Join.Sound.Enabled"); ++ boolean isActionBar = config.getBoolean("Join.ActionBar.Enabled"); ++ boolean isSoundAll = config.getBoolean("Join.Sound.Send-To-All"); + +- List Hover_Text = config.getStringList("Join.HoverEvent.Hover"); ++ List Hover_Text = config.getStringList("Join.HoverEvent.Hover"); + +- String isClick_Mode = config.getString("Join.ClickEvent.Mode"); +- String Action_Command = config.getString("Join.ClickEvent.Actions.Command"); +- String Action_Url = config.getString("Join.ClickEvent.Actions.Url"); +- String Action_Suggest = config.getString("Join.ClickEvent.Actions.Suggest-Command"); +- +- //List Action_Dev = config.getStringList("Join.ClickEvent.DevActions"); +- +- String Title_Text = config.getString("Join.Title.Title"); +- String SubTitle_Text = config.getString("Join.Title.SubTitle"); +- String Actionbar_Text = config.getString("Join.ActionBar.Text"); +- String Sound_Name = config.getString("Join.Sound.Name"); ++ String isClick_Mode = config.getString("Join.ClickEvent.Mode"); ++ String Action_Command = config.getString("Join.ClickEvent.Actions.Command"); ++ String Action_Url = config.getString("Join.ClickEvent.Actions.Url"); ++ String Action_Suggest = config.getString("Join.ClickEvent.Actions.Suggest-Command"); ++ String Title_Text = config.getString("Join.Title.Title"); ++ String SubTitle_Text = config.getString("Join.Title.SubTitle"); ++ String Actionbar_Text = config.getString("Join.ActionBar.Text"); ++ String Sound_Name = config.getString("Join.Sound.Name"); + +- int FadeIn = config.getInt("Join.Title.FadeIn"); +- int Stay = config.getInt("Join.Title.Stay"); +- int FadeOut = config.getInt("Join.Title.FadeOut"); +- int Sound_Volume = config.getInt("Join.Sound.Volume"); ++ int FadeIn = config.getInt("Join.Title.FadeIn"); ++ int Stay = config.getInt("Join.Title.Stay"); ++ int FadeOut = config.getInt("Join.Title.FadeOut"); ++ int Sound_Volume = config.getInt("Join.Sound.Volume"); + +- float Sound_Pitch = Float.parseFloat(Objects.requireNonNull(config.getString("Join.Sound.Pitch"))); ++ float Sound_Pitch = Float.parseFloat(Objects.requireNonNull(config.getString("Join.Sound.Pitch"))); + +- if (isHover) { +- if (isClick) { +- assert isClick_Mode != null; +- if (isClick_Mode.equalsIgnoreCase("command")) { +- messageBuilder.setHover(Hover_Text).setExecuteCommand(Action_Command).sendToAll(); +- } else if (isClick_Mode.equalsIgnoreCase("url")) { +- messageBuilder.setHover(Hover_Text).setOpenURL(Action_Url).sendToAll(); +- } else if (isClick_Mode.equalsIgnoreCase("suggest")) { +- messageBuilder.setHover(Hover_Text).setSuggestCommand(Action_Suggest).sendToAll(); +- } +- } else { +- messageBuilder.setHover(Hover_Text).sendToAll(); +- } +- } else { ++ if (isHover) { ++ if (isClick) { ++ assert isClick_Mode != null; ++ if (isClick_Mode.equalsIgnoreCase("command")) { ++ messageBuilder.setHover(Hover_Text).setExecuteCommand(Action_Command).sendToAll(); ++ } else if (isClick_Mode.equalsIgnoreCase("url")) { ++ messageBuilder.setHover(Hover_Text).setOpenURL(Action_Url).sendToAll(); ++ } else if (isClick_Mode.equalsIgnoreCase("suggest")) { ++ messageBuilder.setHover(Hover_Text).setSuggestCommand(Action_Suggest).sendToAll(); ++ } ++ } else { ++ messageBuilder.setHover(Hover_Text).sendToAll(); ++ } ++ } else { + +- if (isClick) { +- +- /*for(String action : Action_Dev){ +- +- String[] parts = action.split(":"); +- String type = parts[0].trim(); +- String value = parts[1].trim(); +- +- switch (type){ +- case "[Execute]": +- messageBuilder.setExecuteCommand(value); +- break; +- case "[Suggest]": +- messageBuilder.setSuggestCommand(value); +- break; +- case "[Open]": +- messageBuilder.setOpenURL(value); +- break; +- default: +- messageBuilder.sendToAll(); +- break; +- } +- } +- messageBuilder.sendToAll();*/ +- +- assert isClick_Mode != null; +- if (isClick_Mode.equalsIgnoreCase("command")) { +- messageBuilder.setExecuteCommand(Action_Command).sendToAll(); +- } else if (isClick_Mode.equalsIgnoreCase("url")) { +- messageBuilder.setOpenURL(Action_Url).sendToAll(); +- } else if (isClick_Mode.equalsIgnoreCase("suggest")) { +- messageBuilder.setSuggestCommand(Action_Suggest).sendToAll(); +- } +- +- +- } else { +- messageBuilder.sendToAll(); +- } +- } ++ if (isClick) { ++ assert isClick_Mode != null; ++ if (isClick_Mode.equalsIgnoreCase("command")) { ++ messageBuilder.setExecuteCommand(Action_Command).sendToAll(); ++ } else if (isClick_Mode.equalsIgnoreCase("url")) { ++ messageBuilder.setOpenURL(Action_Url).sendToAll(); ++ } else if (isClick_Mode.equalsIgnoreCase("suggest")) { ++ messageBuilder.setSuggestCommand(Action_Suggest).sendToAll(); ++ } ++ } else { ++ messageBuilder.sendToAll(); ++ } ++ } + +- if (discordSRVHHook.isEnabled()) { +- DiscordUtil.sendMessageBlocking( +- DiscordUtil.getTextChannelById(Settings.hook_discordsrv_channelid), +- Util.colorless(messageBuilder.getText())); +- } ++ if (discordSRVHHook.isEnabled()) { ++ DiscordUtil.sendMessageBlocking( ++ DiscordUtil.getTextChannelById(Settings.hook_discordSrv_channelId), ++ Util.colorless(messageBuilder.getText())); ++ } + +- if (isTitle) { +- Titles.sendTitle(p, FadeIn, Stay, FadeOut, Util.color(Util.getVar(p, Title_Text)), +- Util.color(Util.getVar(p, SubTitle_Text))); +- } ++ if (isTitle) { ++ Titles.sendTitle(p, FadeIn, Stay, FadeOut, Util.color(Util.getVar(p, Title_Text)), ++ Util.color(Util.getVar(p, SubTitle_Text))); ++ } + +- if (isActionBar) { +- ActionBar.sendActionBar(p, Util.color(Util.getVar(p, Actionbar_Text))); +- } ++ if (isActionBar) { ++ ActionBar.sendActionBar(p, Util.color(Util.getVar(p, Actionbar_Text))); ++ } + +- try { +- if (isSound) { +- if (isSoundAll) { +- Location location = p.getLocation(); +- p.playSound(location, Sound.valueOf(Sound_Name), Sound_Volume, Sound_Pitch); +- } else { +- for (Player pp : Bukkit.getOnlinePlayers()) { +- Location location = p.getLocation(); +- pp.playSound(location, Sound.valueOf(Sound_Name), Sound_Volume, Sound_Pitch); +- } +- } +- } +- } catch (Exception ex) { +- Logger.warning("&eVerify that the sound name is correct or belongs to the version"); +- } ++ try { ++ if (isSound) { ++ if (isSoundAll) { ++ Location location = p.getLocation(); ++ p.playSound(location, Sound.valueOf(Sound_Name), Sound_Volume, Sound_Pitch); ++ } else { ++ for (Player pp : Bukkit.getOnlinePlayers()) { ++ Location location = p.getLocation(); ++ pp.playSound(location, Sound.valueOf(Sound_Name), Sound_Volume, Sound_Pitch); ++ } ++ } ++ } ++ } catch (Exception ex) { ++ Logger.warning("&eVerify that the sound name is correct or belongs to the version"); + } ++ ++ + } else if (isGroup) { + e.setJoinMessage(null); + GroupHelper groupHelper = new GroupHelper(); + groupHelper.setGroup(playerManager.getGroup(p)); + groupHelper.setDiscord(discordSRVHHook); + groupHelper.setEssentials(essentialsXDiscordHook); +- groupHelper.onJoin(p, config, e); ++ groupHelper.onJoin(p, config); + } else if (isNone) { + e.setJoinMessage(null); + } +@@ -295,7 +239,7 @@ + public void onUpdate(@NotNull PlayerJoinEvent e) { + Player p = e.getPlayer(); + if (Settings.update) { +- if ((p.isOp()) || (p.hasPermission("Cjm.Update.Notify"))) { ++ if ((p.isOp()) || (p.hasPermission("cjm.update"))) { + new UpdateChecker(CustomJoinAndQuitMessages.get()).sendSpigotUpdate(); + } + } +@@ -329,7 +273,7 @@ + } + + if (essentialsXHook.isEnabled()) { +- if (Settings.hook_essentials_hideplayervanish) { ++ if (Settings.hook_essentials_hidePlayerVanish) { + if (essentialsXHook.isVanish(p)) { + e.setQuitMessage(null); + return; +@@ -341,9 +285,6 @@ + if (isNormal) { + e.setQuitMessage(null); + +- boolean isNormalType = Objects.requireNonNull(config.getString("Quit.Type")).equalsIgnoreCase("normal"); +- boolean isModifyType = Objects.requireNonNull(config.getString("Quit.Type")).equalsIgnoreCase("modify"); +- + String text = config.getString("Quit.Text"); + + text = Util.color(text); +@@ -355,102 +296,81 @@ + Logger.info(messageBuilder.getText()); + } + +- if (isNormalType) { +- e.setQuitMessage(text); +- if (discordSRVHHook.isEnabled()) { +- if (Settings.hook_discordsrv_channelid.equalsIgnoreCase("none")) +- return; +- DiscordUtil.sendMessageBlocking( +- DiscordUtil.getTextChannelById(Settings.hook_discordsrv_channelid), +- Util.colorless(messageBuilder.getText())); +- } +- +- if (essentialsXDiscordHook.isEnabled()) { +- if (Settings.hook_essentialsDiscord_channelid.equalsIgnoreCase("none")) +- return; +- essentialsXDiscordHook.sendQuitMessage(Settings.hook_essentialsDiscord_channelid, +- Util.colorless(messageBuilder.getText())); +- } +- } else if (isModifyType) { +- +- boolean isHover = Objects.equals(config.getString("Quit.HoverEvent.Enabled"), "true"); +- boolean isClick = Objects.equals(config.getString("Quit.ClickEvent.Enabled"), "true"); +- boolean isSound = Objects.equals(config.getString("Quit.Sound.Enabled"), "true"); +- boolean isSoundAll = Objects.equals(config.getString("Quit.Sound.Send-To-All"), "true"); ++ boolean isHover = config.getBoolean("Quit.HoverEvent.Enabled"); ++ boolean isClick = config.getBoolean("Quit.ClickEvent.Enabled"); ++ boolean isSound = config.getBoolean("Quit.Sound.Enabled"); ++ boolean isSoundAll = config.getBoolean("Quit.Sound.Send-To-All"); + +- List Hover_Text = config.getStringList("Quit.HoverEvent.Hover"); ++ List Hover_Text = config.getStringList("Quit.HoverEvent.Hover"); + +- String isClick_Mode = config.getString("Quit.ClickEvent.Mode"); +- String Action_Command = config.getString("Quit.ClickEvent.Actions.Command"); +- String Action_Url = config.getString("Quit.ClickEvent.Actions.Url"); +- String Action_Suggest = config.getString("Quit.ClickEvent.Actions.Suggest-Command"); +- String Sound_Name = config.getString("Quit.Sound.Name"); ++ String isClick_Mode = config.getString("Quit.ClickEvent.Mode"); ++ String Action_Command = config.getString("Quit.ClickEvent.Actions.Command"); ++ String Action_Url = config.getString("Quit.ClickEvent.Actions.Url"); ++ String Action_Suggest = config.getString("Quit.ClickEvent.Actions.Suggest-Command"); ++ String Sound_Name = config.getString("Quit.Sound.Name"); + +- int Sound_Volume = config.getInt("Quit.Sound.Volume"); +- float Sound_Pitch = Float.parseFloat(Objects.requireNonNull(config.getString("Quit.Sound.Pitch"))); ++ int Sound_Volume = config.getInt("Quit.Sound.Volume"); ++ float Sound_Pitch = Float.parseFloat(Objects.requireNonNull(config.getString("Quit.Sound.Pitch"))); + +- if (isHover) { +- if (isClick) { +- assert isClick_Mode != null; +- if (isClick_Mode.equalsIgnoreCase("command")) { +- messageBuilder.setHover(Hover_Text).setExecuteCommand(Action_Command).sendToAll(); +- } else if (isClick_Mode.equalsIgnoreCase("url")) { +- messageBuilder.setHover(Hover_Text).setOpenURL(Action_Url).sendToAll(); +- } else if (isClick_Mode.equalsIgnoreCase("suggest")) { +- messageBuilder.setHover(Hover_Text).setSuggestCommand(Action_Suggest).sendToAll(); +- } +- } else { +- messageBuilder.setHover(Hover_Text).sendToAll(); +- } +- } else { +- if (isClick) { +- assert isClick_Mode != null; +- if (isClick_Mode.equalsIgnoreCase("command")) { +- messageBuilder.setExecuteCommand(Action_Command).sendToAll(); +- } else if (isClick_Mode.equalsIgnoreCase("url")) { +- messageBuilder.setOpenURL(Action_Url).sendToAll(); +- } else if (isClick_Mode.equalsIgnoreCase("suggest")) { +- messageBuilder.setSuggestCommand(Action_Suggest).sendToAll(); +- } +- } else { +- messageBuilder.sendToAll(); +- } +- } ++ if (isHover) { ++ if (isClick) { ++ assert isClick_Mode != null; ++ if (isClick_Mode.equalsIgnoreCase("command")) { ++ messageBuilder.setHover(Hover_Text).setExecuteCommand(Action_Command).sendToAll(); ++ } else if (isClick_Mode.equalsIgnoreCase("url")) { ++ messageBuilder.setHover(Hover_Text).setOpenURL(Action_Url).sendToAll(); ++ } else if (isClick_Mode.equalsIgnoreCase("suggest")) { ++ messageBuilder.setHover(Hover_Text).setSuggestCommand(Action_Suggest).sendToAll(); ++ } ++ } else { ++ messageBuilder.setHover(Hover_Text).sendToAll(); ++ } ++ } else { ++ if (isClick) { ++ assert isClick_Mode != null; ++ if (isClick_Mode.equalsIgnoreCase("command")) { ++ messageBuilder.setExecuteCommand(Action_Command).sendToAll(); ++ } else if (isClick_Mode.equalsIgnoreCase("url")) { ++ messageBuilder.setOpenURL(Action_Url).sendToAll(); ++ } else if (isClick_Mode.equalsIgnoreCase("suggest")) { ++ messageBuilder.setSuggestCommand(Action_Suggest).sendToAll(); ++ } ++ } else { ++ messageBuilder.sendToAll(); ++ } ++ } + +- if (discordSRVHHook.isEnabled()) { +- +- if (Settings.hook_discordsrv_channelid.equalsIgnoreCase("none")) +- return; ++ if (discordSRVHHook.isEnabled()) { ++ if (Settings.hook_discordSrv_channelId.equalsIgnoreCase("none")) ++ return; + +- DiscordUtil.sendMessageBlocking( +- DiscordUtil.getTextChannelById(Settings.hook_discordsrv_channelid), +- Util.colorless(messageBuilder.getText())); +- } ++ DiscordUtil.sendMessageBlocking( ++ DiscordUtil.getTextChannelById(Settings.hook_discordSrv_channelId), ++ Util.colorless(messageBuilder.getText())); ++ } + +- if (essentialsXDiscordHook.isEnabled()) { +- +- if (Settings.hook_essentialsDiscord_channelid.equalsIgnoreCase("none")) +- return; ++ if (essentialsXDiscordHook.isEnabled()) { ++ if (Settings.hook_essentialsDiscord_channelId.equalsIgnoreCase("none")) ++ return; + +- essentialsXDiscordHook.sendQuitMessage(Settings.hook_essentialsDiscord_channelid, +- Util.colorless(messageBuilder.getText())); +- } ++ essentialsXDiscordHook.sendQuitMessage(Settings.hook_essentialsDiscord_channelId, ++ Util.colorless(messageBuilder.getText())); ++ } + +- try { +- if (isSound) { +- if (isSoundAll) { +- Location location = p.getLocation(); +- p.playSound(location, Sound.valueOf(Sound_Name), Sound_Volume, Sound_Pitch); +- } else { +- for (Player pp : Bukkit.getOnlinePlayers()) { +- Location location = p.getLocation(); +- pp.playSound(location, Sound.valueOf(Sound_Name), Sound_Volume, Sound_Pitch); +- } +- } +- } +- } catch (Exception ex) { +- Logger.warning("&eVerify that the sound name is correct or belongs to the version"); +- } ++ try { ++ if (isSound) { ++ if (isSoundAll) { ++ Location location = p.getLocation(); ++ p.playSound(location, Sound.valueOf(Sound_Name), Sound_Volume, Sound_Pitch); ++ } else { ++ for (Player pp : Bukkit.getOnlinePlayers()) { ++ Location location = p.getLocation(); ++ pp.playSound(location, Sound.valueOf(Sound_Name), Sound_Volume, Sound_Pitch); ++ } ++ } ++ } ++ } catch (Exception ex) { ++ Logger.warning("&eVerify that the sound name is correct or belongs to the version"); + } + } else if (isGroup) { + e.setQuitMessage(null); +@@ -458,13 +378,11 @@ + groupHelper.setGroup(playerManager.getGroup(p)); + groupHelper.setDiscord(discordSRVHHook); + groupHelper.setEssentials(essentialsXDiscordHook); +- groupHelper.onQuit(p, config, e); ++ groupHelper.onQuit(p, config); + } else if (isNone) { + e.setQuitMessage(null); + } + } + } + +- +- + } +Index: CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/manager/DisplayManager.java +IDEA additional info: +Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +<+>UTF-8 +=================================================================== +diff --git a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/manager/DisplayManager.java b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/manager/DisplayManager.java +--- a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/manager/DisplayManager.java (revision 60d9051d52d70ed86db8e0fc1a50da61f395e55a) ++++ b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/manager/DisplayManager.java (revision 5436229cc153c4aec4cd6267d80f1e8301022990) +@@ -12,6 +12,7 @@ + + import java.util.List; + ++@SuppressWarnings("all") + public class DisplayManager { + + private final FileConfiguration config = CustomJoinAndQuitMessages.get().getConfigFile().getConfig(); +@@ -41,8 +42,6 @@ + Logger.warning("&e[showFirstJoinMessage] &b-> &7This feature is disabled and you will not be able to see the preview"); + + String text; +- boolean isNormalType; +- boolean isModifyType; + boolean isHover; + boolean isClick; + List Hover_Text; +@@ -53,8 +52,6 @@ + + if (Settings.is_Group_Display) { + text = groups.getString(group + ".FirstJoin.Text"); +- isNormalType = groups.getString(group + ".Type").equalsIgnoreCase("normal"); +- isModifyType = groups.getString(group + ".Type").equalsIgnoreCase("modify"); + isHover = groups.getString(group + ".HoverEvent.Enabled").equals("true"); + isClick = groups.getString(group + ".ClickEvent.Enabled").equals("true"); + Hover_Text = groups.getStringList(group + ".HoverEvent.Hover"); +@@ -64,8 +61,6 @@ + Action_Suggest = groups.getString(group + ".ClickEvent.Actions.Suggest-Command"); + } else { + text = Settings.join_message_first; +- isNormalType = Settings.join_type.equalsIgnoreCase("normal"); +- isModifyType = Settings.join_type.equalsIgnoreCase("modify"); + + isHover = config.getString("Join.HoverEvent.Enabled").equals("true"); + isClick = config.getString("Join.ClickEvent.Enabled").equals("true"); +@@ -78,34 +73,29 @@ + + MessageBuilder messageBuilder = new MessageBuilder(player, Util.color(Util.getVar(player, text))); + +- if (isNormalType) { +- messageBuilder.send(); +- return; +- } else if (isModifyType) { +- if (isHover) { +- if (isClick) { +- if (isClick_Mode.equalsIgnoreCase("command")) { +- messageBuilder.setHover(Hover_Text).setExecuteCommand(Action_Command).send(); +- } else if (isClick_Mode.equalsIgnoreCase("url")) { +- messageBuilder.setHover(Hover_Text).setOpenURL(Action_Url).send(); +- } else if (isClick_Mode.equalsIgnoreCase("suggest")) { +- messageBuilder.setHover(Hover_Text).setSuggestCommand(Action_Suggest).send(); +- } +- } else { +- messageBuilder.setHover(Hover_Text).send(); +- } +- } else { +- if (isClick) { +- if (isClick_Mode.equalsIgnoreCase("command")) { +- messageBuilder.setExecuteCommand(Action_Command).send(); +- } else if (isClick_Mode.equalsIgnoreCase("url")) { +- messageBuilder.setOpenURL(Action_Url).send(); +- } else if (isClick_Mode.equalsIgnoreCase("suggest")) { +- messageBuilder.setSuggestCommand(Action_Suggest).send(); +- } +- } else { +- messageBuilder.send(); +- } ++ if (isHover) { ++ if (isClick) { ++ if (isClick_Mode.equalsIgnoreCase("command")) { ++ messageBuilder.setHover(Hover_Text).setExecuteCommand(Action_Command).send(); ++ } else if (isClick_Mode.equalsIgnoreCase("url")) { ++ messageBuilder.setHover(Hover_Text).setOpenURL(Action_Url).send(); ++ } else if (isClick_Mode.equalsIgnoreCase("suggest")) { ++ messageBuilder.setHover(Hover_Text).setSuggestCommand(Action_Suggest).send(); ++ } ++ } else { ++ messageBuilder.setHover(Hover_Text).send(); ++ } ++ } else { ++ if (isClick) { ++ if (isClick_Mode.equalsIgnoreCase("command")) { ++ messageBuilder.setExecuteCommand(Action_Command).send(); ++ } else if (isClick_Mode.equalsIgnoreCase("url")) { ++ messageBuilder.setOpenURL(Action_Url).send(); ++ } else if (isClick_Mode.equalsIgnoreCase("suggest")) { ++ messageBuilder.setSuggestCommand(Action_Suggest).send(); ++ } ++ } else { ++ messageBuilder.send(); + } + } + } +@@ -127,8 +117,6 @@ + + if (Settings.is_Group_Display) { + text = groups.getString(group + ".Join-Text"); +- isNormalType = groups.getString(group + ".Type").equalsIgnoreCase("normal"); +- isModifyType = groups.getString(group + ".Type").equalsIgnoreCase("modify"); + + isHover = groups.getString(group + ".HoverEvent.Enabled").equals("true"); + isClick = groups.getString(group + ".ClickEvent.Enabled").equals("true"); +@@ -141,8 +129,6 @@ + Action_Suggest = groups.getString(group + ".ClickEvent.Actions.Suggest-Command"); + } else { + text = Settings.join_message; +- isNormalType = Settings.join_type.equalsIgnoreCase("normal"); +- isModifyType = Settings.join_type.equalsIgnoreCase("modify"); + + isHover = config.getString("Join.HoverEvent.Enabled").equals("true"); + isClick = config.getString("Join.ClickEvent.Enabled").equals("true"); +@@ -157,34 +143,29 @@ + + MessageBuilder messageBuilder = new MessageBuilder(player, Util.color(Util.getVar(player, text))); + +- if (isNormalType) { +- messageBuilder.send(); +- return; +- } else if (isModifyType) { +- if (isHover) { +- if (isClick) { +- if (isClick_Mode.equalsIgnoreCase("command")) { +- messageBuilder.setHover(Hover_Text).setExecuteCommand(Action_Command).send(); +- } else if (isClick_Mode.equalsIgnoreCase("url")) { +- messageBuilder.setHover(Hover_Text).setOpenURL(Action_Url).send(); +- } else if (isClick_Mode.equalsIgnoreCase("suggest")) { +- messageBuilder.setHover(Hover_Text).setSuggestCommand(Action_Suggest).send(); +- } +- } else { +- messageBuilder.setHover(Hover_Text).send(); +- } +- } else { +- if (isClick) { +- if (isClick_Mode.equalsIgnoreCase("command")) { +- messageBuilder.setExecuteCommand(Action_Command).send(); +- } else if (isClick_Mode.equalsIgnoreCase("url")) { +- messageBuilder.setOpenURL(Action_Url).send(); +- } else if (isClick_Mode.equalsIgnoreCase("suggest")) { +- messageBuilder.setSuggestCommand(Action_Suggest).send(); +- } +- } else { +- messageBuilder.send(); +- } ++ if (isHover) { ++ if (isClick) { ++ if (isClick_Mode.equalsIgnoreCase("command")) { ++ messageBuilder.setHover(Hover_Text).setExecuteCommand(Action_Command).send(); ++ } else if (isClick_Mode.equalsIgnoreCase("url")) { ++ messageBuilder.setHover(Hover_Text).setOpenURL(Action_Url).send(); ++ } else if (isClick_Mode.equalsIgnoreCase("suggest")) { ++ messageBuilder.setHover(Hover_Text).setSuggestCommand(Action_Suggest).send(); ++ } ++ } else { ++ messageBuilder.setHover(Hover_Text).send(); ++ } ++ } else { ++ if (isClick) { ++ if (isClick_Mode.equalsIgnoreCase("command")) { ++ messageBuilder.setExecuteCommand(Action_Command).send(); ++ } else if (isClick_Mode.equalsIgnoreCase("url")) { ++ messageBuilder.setOpenURL(Action_Url).send(); ++ } else if (isClick_Mode.equalsIgnoreCase("suggest")) { ++ messageBuilder.setSuggestCommand(Action_Suggest).send(); ++ } ++ } else { ++ messageBuilder.send(); + } + } + } +@@ -220,8 +201,6 @@ + Action_Suggest = groups.getString(group + ".ClickEvent.Actions.Suggest-Command"); + } else { + text = Settings.quit_message; +- isNormalType = Settings.quit_type.equalsIgnoreCase("normal"); +- isModifyType = Settings.quit_type.equalsIgnoreCase("modify"); + + isHover = config.getString("Quit.HoverEvent.Enabled").equals("true"); + isClick = config.getString("Quit.ClickEvent.Enabled").equals("true"); +@@ -236,36 +215,32 @@ + + MessageBuilder messageBuilder = new MessageBuilder(player, Util.color(Util.getVar(player, text))); + +- if (isNormalType) { +- messageBuilder.send(); +- return; +- } else if (isModifyType) { +- if (isHover) { +- if (isClick) { +- if (isClick_Mode.equalsIgnoreCase("command")) { +- messageBuilder.setHover(Hover_Text).setExecuteCommand(Action_Command).send(); +- } else if (isClick_Mode.equalsIgnoreCase("url")) { +- messageBuilder.setHover(Hover_Text).setOpenURL(Action_Url).send(); +- } else if (isClick_Mode.equalsIgnoreCase("suggest")) { +- messageBuilder.setHover(Hover_Text).setSuggestCommand(Action_Suggest).send(); +- } +- } else { +- messageBuilder.setHover(Hover_Text).send(); +- } +- } else { +- if (isClick) { +- if (isClick_Mode.equalsIgnoreCase("command")) { +- messageBuilder.setExecuteCommand(Action_Command).send(); +- } else if (isClick_Mode.equalsIgnoreCase("url")) { +- messageBuilder.setOpenURL(Action_Url).send(); +- } else if (isClick_Mode.equalsIgnoreCase("suggest")) { +- messageBuilder.setSuggestCommand(Action_Suggest).send(); +- } +- } else { +- messageBuilder.send(); +- } ++ if (isHover) { ++ if (isClick) { ++ if (isClick_Mode.equalsIgnoreCase("command")) { ++ messageBuilder.setHover(Hover_Text).setExecuteCommand(Action_Command).send(); ++ } else if (isClick_Mode.equalsIgnoreCase("url")) { ++ messageBuilder.setHover(Hover_Text).setOpenURL(Action_Url).send(); ++ } else if (isClick_Mode.equalsIgnoreCase("suggest")) { ++ messageBuilder.setHover(Hover_Text).setSuggestCommand(Action_Suggest).send(); ++ } ++ } else { ++ messageBuilder.setHover(Hover_Text).send(); ++ } ++ } else { ++ if (isClick) { ++ if (isClick_Mode.equalsIgnoreCase("command")) { ++ messageBuilder.setExecuteCommand(Action_Command).send(); ++ } else if (isClick_Mode.equalsIgnoreCase("url")) { ++ messageBuilder.setOpenURL(Action_Url).send(); ++ } else if (isClick_Mode.equalsIgnoreCase("suggest")) { ++ messageBuilder.setSuggestCommand(Action_Suggest).send(); ++ } ++ } else { ++ messageBuilder.send(); + } + } ++ + } + + public void showWelcomeMessage() { +@@ -281,7 +256,7 @@ + if (!Settings.join_title) + Logger.warning("&e[showTitleMessage] &b-> &7This feature is disabled and you will not be able to see the preview"); + +- Titles.sendTitle(player, Settings.join_title_fadein, Settings.join_title_stay, Settings.join_title_fadeout, Settings.join_message_title_title, Settings.join_message_title_subtitle); ++ Titles.sendTitle(player, Settings.join_title_fadeIn, Settings.join_title_stay, Settings.join_title_fadeOut, Settings.join_message_title_title, Settings.join_message_title_subtitle); + } + + public void showActionbar() { +Index: CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/manager/HookManager.java +IDEA additional info: +Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +<+>UTF-8 +=================================================================== +diff --git a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/manager/HookManager.java b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/manager/HookManager.java +--- a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/manager/HookManager.java (revision 60d9051d52d70ed86db8e0fc1a50da61f395e55a) ++++ b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/manager/HookManager.java (revision 5436229cc153c4aec4cd6267d80f1e8301022990) +@@ -7,8 +7,8 @@ + public class HookManager { + + private static HookManager instance; +- private final DiscordSRVHHook discordSRVHHook = new DiscordSRVHHook(this); +- private final EssentialsXDiscordHook essentialsXDiscordHook = new EssentialsXDiscordHook(this); ++ private final DiscordSRVHHook discordSRVHHook = new DiscordSRVHHook(); ++ private final EssentialsXDiscordHook essentialsXDiscordHook = new EssentialsXDiscordHook(); + private final EssentialsXHook essentialsXHook = new EssentialsXHook(this); + private final LuckPermsHook luckPermsHook = new LuckPermsHook(); + private final SuperVanishHook superVanishHook = new SuperVanishHook(); +Index: CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/update/UpdateChecker.java +IDEA additional info: +Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +<+>UTF-8 +=================================================================== +diff --git a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/update/UpdateChecker.java b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/update/UpdateChecker.java +--- a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/update/UpdateChecker.java (revision 60d9051d52d70ed86db8e0fc1a50da61f395e55a) ++++ b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/update/UpdateChecker.java (revision 5436229cc153c4aec4cd6267d80f1e8301022990) +@@ -22,6 +22,7 @@ + this.plugin = plugin; + } + ++ @SuppressWarnings("unused") + public void sendGithubUpdate(){ + getVersion("github" ,version -> { + if (plugin.getDescription().getVersion().equalsIgnoreCase(version)) { +@@ -60,7 +61,6 @@ + break; + case "github": + url = UpdateSettings.API_UPDATE[1]; +- + break; + default: + Logger.error("Invalid source for update check: " + source); +@@ -76,7 +76,7 @@ + String latestRelease = scanner.next(); + Gson gson = new Gson(); + JsonObject json= gson.fromJson(latestRelease, JsonObject.class); +- String versionName = json.get("name").getAsString(); ++ String versionName = json.get("tag_name").getAsString(); + + if(versionName.contains("Beta")){ + Logger.info("The latest release is a beta version: " + versionName); +@@ -88,10 +88,7 @@ + }else{ + consumer.accept(scanner.next()); + } +- +- + } +- + } catch (IOException e) { + Logger.error("Could not check for updates: &c" + e.getMessage()); + } +Index: CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/utils/GroupHelper.java +IDEA additional info: +Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +<+>UTF-8 +=================================================================== +diff --git a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/utils/GroupHelper.java b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/utils/GroupHelper.java +--- a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/utils/GroupHelper.java (revision 60d9051d52d70ed86db8e0fc1a50da61f395e55a) ++++ b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/utils/GroupHelper.java (revision 5436229cc153c4aec4cd6267d80f1e8301022990) +@@ -12,8 +12,6 @@ + import org.bukkit.Sound; + import org.bukkit.configuration.file.FileConfiguration; + import org.bukkit.entity.Player; +-import org.bukkit.event.player.PlayerJoinEvent; +-import org.bukkit.event.player.PlayerQuitEvent; + import org.jetbrains.annotations.Contract; + import org.jetbrains.annotations.NotNull; + +@@ -43,7 +41,7 @@ + this.essentialsXDiscordHook = essentialsXDiscordHook; + } + +- public void onJoin(Player player, FileConfiguration config, PlayerJoinEvent playerJoinEvent) { ++ public void onJoin(Player player, FileConfiguration config) { + String temp = ""; + + String join = groupManager.getJoin(group); +@@ -59,126 +57,97 @@ + + temp = Util.color(Util.getVar(player, temp)); + +- boolean isNormalType = groupManager.getType(group).equalsIgnoreCase("normal"); +- boolean isModifyType = groupManager.getType(group).equalsIgnoreCase("modify"); +- + MessageBuilder messageBuilder = new MessageBuilder(player, temp); + + if (config.getBoolean("Config.Show-Chat-In-Console")) { + Logger.info(messageBuilder.getText()); + } + +- if (isNormalType) { +- playerJoinEvent.setJoinMessage(temp); +- if (discordSRVHHook.isEnabled()) { +- +- if (Settings.hook_discordsrv_channelid.equalsIgnoreCase("none")) +- return; +- +- DiscordUtil.sendMessageBlocking( +- DiscordUtil.getTextChannelById(Settings.hook_discordsrv_channelid), +- Util.colorless(messageBuilder.getText())); +- } +- +- if (essentialsXDiscordHook.isEnabled()) { +- if (Settings.hook_essentialsDiscord_channelid.equalsIgnoreCase("none")) +- return; +- +- essentialsXDiscordHook.sendJoinMessage(Settings.hook_essentialsDiscord_channelid, +- Util.colorless(messageBuilder.getText())); +- } +- } else if (isModifyType) { +- +- boolean isHover = groupManager.isHover(group); +- boolean isClick = groupManager.isClick(group); +- boolean isTitle = groupManager.isTitle(group); +- boolean isSound = groupManager.isSound(group); +- boolean isActionBar = groupManager.isActionbar(group); +- boolean isSoundAll = groupManager.isSoundAll(group); ++ boolean isHover = groupManager.isHover(group); ++ boolean isClick = groupManager.isClick(group); ++ boolean isTitle = groupManager.isTitle(group); ++ boolean isSound = groupManager.isSound(group); ++ boolean isActionBar = groupManager.isActionbar(group); ++ boolean isSoundAll = groupManager.isSoundAll(group); + +- List Hover_Text = groupManager.getHover(group); ++ List Hover_Text = groupManager.getHover(group); + +- String isClick_Mode = groupManager.getClickMode(group); +- String Action_Command = groupManager.getClickCommand(group); +- String Action_Url = groupManager.getClickUrl(group); +- String Action_Suggest = groupManager.getClickSuggestCommand(group); +- String Title_Text = groupManager.getTitle(group); +- String SubTitle_Text = groupManager.getSubTitle(group); +- String Actionbar_Text = groupManager.getActionbar(group); +- String Sound_Name = groupManager.getSound(group); ++ String isClick_Mode = groupManager.getClickMode(group); ++ String Action_Command = groupManager.getClickCommand(group); ++ String Action_Url = groupManager.getClickUrl(group); ++ String Action_Suggest = groupManager.getClickSuggestCommand(group); ++ String Title_Text = groupManager.getTitle(group); ++ String SubTitle_Text = groupManager.getSubTitle(group); ++ String Actionbar_Text = groupManager.getActionbar(group); ++ String Sound_Name = groupManager.getSound(group); + +- int FadeIn = groupManager.getFadeIn(group); +- int Stay = groupManager.getStay(group); +- int FadeOut = groupManager.getFadeOut(group); +- int Sound_Volume = groupManager.getVolume(group); +- float Sound_Pitch = groupManager.getPitch(group); ++ int FadeIn = groupManager.getFadeIn(group); ++ int Stay = groupManager.getStay(group); ++ int FadeOut = groupManager.getFadeOut(group); ++ int Sound_Volume = groupManager.getVolume(group); ++ float Sound_Pitch = groupManager.getPitch(group); + +- if (isHover) { +- if (isClick) { +- if (isClick_Mode.equalsIgnoreCase("command")) { +- messageBuilder.setHover(Hover_Text).setExecuteCommand(Action_Command).sendToAll(); +- } else if (isClick_Mode.equalsIgnoreCase("url")) { +- messageBuilder.setHover(Hover_Text).setOpenURL(Action_Url).sendToAll(); +- } else if (isClick_Mode.equalsIgnoreCase("suggest")) { +- messageBuilder.setHover(Hover_Text).setSuggestCommand(Action_Suggest).sendToAll(); +- } +- } else { +- messageBuilder.setHover(Hover_Text).sendToAll(); +- } +- } else { +- if (isClick) { +- if (isClick_Mode.equalsIgnoreCase("command")) { +- messageBuilder.setExecuteCommand(Action_Command).sendToAll(); +- } else if (isClick_Mode.equalsIgnoreCase("url")) { +- messageBuilder.setOpenURL(Action_Url).sendToAll(); +- } else if (isClick_Mode.equalsIgnoreCase("suggest")) { +- messageBuilder.setSuggestCommand(Action_Suggest).sendToAll(); +- } +- } else { +- messageBuilder.sendToAll(); +- } +- } ++ if (isHover) { ++ if (isClick) { ++ if (isClick_Mode.equalsIgnoreCase("command")) { ++ messageBuilder.setHover(Hover_Text).setExecuteCommand(Action_Command).sendToAll(); ++ } else if (isClick_Mode.equalsIgnoreCase("url")) { ++ messageBuilder.setHover(Hover_Text).setOpenURL(Action_Url).sendToAll(); ++ } else if (isClick_Mode.equalsIgnoreCase("suggest")) { ++ messageBuilder.setHover(Hover_Text).setSuggestCommand(Action_Suggest).sendToAll(); ++ } ++ } else { ++ messageBuilder.setHover(Hover_Text).sendToAll(); ++ } ++ } else { ++ if (isClick) { ++ if (isClick_Mode.equalsIgnoreCase("command")) { ++ messageBuilder.setExecuteCommand(Action_Command).sendToAll(); ++ } else if (isClick_Mode.equalsIgnoreCase("url")) { ++ messageBuilder.setOpenURL(Action_Url).sendToAll(); ++ } else if (isClick_Mode.equalsIgnoreCase("suggest")) { ++ messageBuilder.setSuggestCommand(Action_Suggest).sendToAll(); ++ } ++ } else { ++ messageBuilder.sendToAll(); ++ } ++ } + +- if (discordSRVHHook.isEnabled()) { +- DiscordUtil.sendMessageBlocking( +- DiscordUtil.getTextChannelById(Settings.hook_discordsrv_channelid), +- Util.colorless(messageBuilder.getText())); +- } ++ if (discordSRVHHook.isEnabled()) { ++ DiscordUtil.sendMessageBlocking( ++ DiscordUtil.getTextChannelById(Settings.hook_discordSrv_channelId), ++ Util.colorless(messageBuilder.getText())); ++ } + +- if (isTitle) { +- Titles.sendTitle(player, FadeIn, Stay, FadeOut, Util.color(Util.getVar(player, Title_Text)), +- Util.color(Util.getVar(player, SubTitle_Text))); +- } ++ if (isTitle) { ++ Titles.sendTitle(player, FadeIn, Stay, FadeOut, Util.color(Util.getVar(player, Title_Text)), ++ Util.color(Util.getVar(player, SubTitle_Text))); ++ } + +- if (isActionBar) { +- ActionBar.sendActionBar(player, Util.color(Util.getVar(player, Actionbar_Text))); +- } ++ if (isActionBar) { ++ ActionBar.sendActionBar(player, Util.color(Util.getVar(player, Actionbar_Text))); ++ } + +- try { +- if (isSound) { +- if (isSoundAll) { +- Location location = player.getLocation(); +- player.playSound(location, Sound.valueOf(Sound_Name), Sound_Volume, Sound_Pitch); +- } else { +- for (Player pp : Bukkit.getOnlinePlayers()) { +- Location location = player.getLocation(); +- pp.playSound(location, Sound.valueOf(Sound_Name), Sound_Volume, Sound_Pitch); +- } +- } +- } +- } catch (Exception ex) { +- Logger.warning("&eVerify that the sound name is correct or belongs to the version"); +- } ++ try { ++ if (isSound) { ++ if (isSoundAll) { ++ Location location = player.getLocation(); ++ player.playSound(location, Sound.valueOf(Sound_Name), Sound_Volume, Sound_Pitch); ++ } else { ++ for (Player pp : Bukkit.getOnlinePlayers()) { ++ Location location = player.getLocation(); ++ pp.playSound(location, Sound.valueOf(Sound_Name), Sound_Volume, Sound_Pitch); ++ } ++ } ++ } ++ } catch (Exception ex) { ++ Logger.warning("&eVerify that the sound name is correct or belongs to the version"); + } + } + +- public void onQuit(Player player, @NotNull FileConfiguration config, PlayerQuitEvent playerQuitEvent) { ++ public void onQuit(Player player, @NotNull FileConfiguration config) { + String quit = groupManager.getQuit(group); + +- +- boolean isNormalType = groupManager.getType(group).equalsIgnoreCase("normal"); +- boolean isModifyType = groupManager.getType(group).equalsIgnoreCase("modify"); +- + quit = Util.color(Util.getVar(player, quit)); + + MessageBuilder messageBuilder = new MessageBuilder(player, quit); +@@ -186,102 +155,82 @@ + Logger.info(messageBuilder.getText()); + } + +- if (isNormalType) { +- playerQuitEvent.setQuitMessage(quit); +- if (discordSRVHHook.isEnabled()) { +- if (Settings.hook_discordsrv_channelid.equalsIgnoreCase("none")) +- return; +- DiscordUtil.sendMessageBlocking( +- DiscordUtil.getTextChannelById(Settings.hook_discordsrv_channelid), +- Util.colorless(messageBuilder.getText())); +- } +- +- if (essentialsXDiscordHook.isEnabled()) { +- if (Settings.hook_essentialsDiscord_channelid.equalsIgnoreCase("none")) +- return; +- essentialsXDiscordHook.sendQuitMessage(Settings.hook_essentialsDiscord_channelid, +- Util.colorless(messageBuilder.getText())); +- } +- } else if (isModifyType) { +- +- boolean isHover = groupManager.isHover(group); +- boolean isClick = groupManager.isClick(group); +- boolean isSound = groupManager.isSound(group); +- boolean isSoundAll = groupManager.isSoundAll(group); ++ boolean isHover = groupManager.isHover(group); ++ boolean isClick = groupManager.isClick(group); ++ boolean isSound = groupManager.isSound(group); ++ boolean isSoundAll = groupManager.isSoundAll(group); + +- List Hover_Text = groupManager.getHover(group); ++ List Hover_Text = groupManager.getHover(group); + +- String isClick_Mode = groupManager.getClickMode(group); +- String Action_Command = groupManager.getClickCommand(group); +- String Action_Url = groupManager.getClickUrl(group); +- String Action_Suggest = groupManager.getClickSuggestCommand(group); +- String Sound_Name = groupManager.getSound(group); ++ String isClick_Mode = groupManager.getClickMode(group); ++ String Action_Command = groupManager.getClickCommand(group); ++ String Action_Url = groupManager.getClickUrl(group); ++ String Action_Suggest = groupManager.getClickSuggestCommand(group); ++ String Sound_Name = groupManager.getSound(group); + +- int Sound_Volume = groupManager.getVolume(group); +- float Sound_Pitch = groupManager.getPitch(group); ++ int Sound_Volume = groupManager.getVolume(group); ++ float Sound_Pitch = groupManager.getPitch(group); + +- if (isHover) { +- if (isClick) { +- if (isClick_Mode.equalsIgnoreCase("command")) { +- messageBuilder.setHover(Hover_Text).setExecuteCommand(Action_Command).sendToAll(); +- } else if (isClick_Mode.equalsIgnoreCase("url")) { +- messageBuilder.setHover(Hover_Text).setOpenURL(Action_Url).sendToAll(); +- } else if (isClick_Mode.equalsIgnoreCase("suggest")) { +- messageBuilder.setHover(Hover_Text).setSuggestCommand(Action_Suggest).sendToAll(); +- } +- } else { +- messageBuilder.setHover(Hover_Text).sendToAll(); +- } +- } else { +- if (isClick) { +- if (isClick_Mode.equalsIgnoreCase("command")) { +- messageBuilder.setExecuteCommand(Action_Command).sendToAll(); +- } else if (isClick_Mode.equalsIgnoreCase("url")) { +- messageBuilder.setOpenURL(Action_Url).sendToAll(); +- } else if (isClick_Mode.equalsIgnoreCase("suggest")) { +- messageBuilder.setSuggestCommand(Action_Suggest).sendToAll(); +- } +- } else { +- messageBuilder.sendToAll(); +- } +- } ++ if (isHover) { ++ if (isClick) { ++ if (isClick_Mode.equalsIgnoreCase("command")) { ++ messageBuilder.setHover(Hover_Text).setExecuteCommand(Action_Command).sendToAll(); ++ } else if (isClick_Mode.equalsIgnoreCase("url")) { ++ messageBuilder.setHover(Hover_Text).setOpenURL(Action_Url).sendToAll(); ++ } else if (isClick_Mode.equalsIgnoreCase("suggest")) { ++ messageBuilder.setHover(Hover_Text).setSuggestCommand(Action_Suggest).sendToAll(); ++ } ++ } else { ++ messageBuilder.setHover(Hover_Text).sendToAll(); ++ } ++ } else { ++ if (isClick) { ++ if (isClick_Mode.equalsIgnoreCase("command")) { ++ messageBuilder.setExecuteCommand(Action_Command).sendToAll(); ++ } else if (isClick_Mode.equalsIgnoreCase("url")) { ++ messageBuilder.setOpenURL(Action_Url).sendToAll(); ++ } else if (isClick_Mode.equalsIgnoreCase("suggest")) { ++ messageBuilder.setSuggestCommand(Action_Suggest).sendToAll(); ++ } ++ } else { ++ messageBuilder.sendToAll(); ++ } ++ } + +- if (discordSRVHHook.isEnabled()) { ++ if (discordSRVHHook.isEnabled()) { + +- if (Settings.hook_discordsrv_channelid.equalsIgnoreCase("none")) +- return; ++ if (Settings.hook_discordSrv_channelId.equalsIgnoreCase("none")) ++ return; + +- DiscordUtil.sendMessageBlocking( +- DiscordUtil.getTextChannelById(Settings.hook_discordsrv_channelid), +- Util.colorless(messageBuilder.getText())); +- } ++ DiscordUtil.sendMessageBlocking( ++ DiscordUtil.getTextChannelById(Settings.hook_discordSrv_channelId), ++ Util.colorless(messageBuilder.getText())); ++ } + +- if (essentialsXDiscordHook.isEnabled()) { ++ if (essentialsXDiscordHook.isEnabled()) { + +- if (Settings.hook_essentialsDiscord_channelid.equalsIgnoreCase("none")) +- return; ++ if (Settings.hook_essentialsDiscord_channelId.equalsIgnoreCase("none")) ++ return; + +- essentialsXDiscordHook.sendQuitMessage(Settings.hook_essentialsDiscord_channelid, +- Util.colorless(messageBuilder.getText())); +- } ++ essentialsXDiscordHook.sendQuitMessage(Settings.hook_essentialsDiscord_channelId, ++ Util.colorless(messageBuilder.getText())); ++ } + +- try { +- if (isSound) { +- if (isSoundAll) { +- Location location = player.getLocation(); +- player.playSound(location, Sound.valueOf(Sound_Name), Sound_Volume, Sound_Pitch); +- } else { +- for (Player pp : Bukkit.getOnlinePlayers()) { +- Location location = player.getLocation(); +- pp.playSound(location, Sound.valueOf(Sound_Name), Sound_Volume, Sound_Pitch); +- } +- } +- } +- } catch (Exception ex) { +- Logger.warning("&eVerify that the sound name is correct or belongs to the version"); +- } +- } ++ try { ++ if (isSound) { ++ if (isSoundAll) { ++ Location location = player.getLocation(); ++ player.playSound(location, Sound.valueOf(Sound_Name), Sound_Volume, Sound_Pitch); ++ } else { ++ for (Player pp : Bukkit.getOnlinePlayers()) { ++ Location location = player.getLocation(); ++ pp.playSound(location, Sound.valueOf(Sound_Name), Sound_Volume, Sound_Pitch); ++ } ++ } ++ } ++ } catch (Exception ex) { ++ Logger.warning("&eVerify that the sound name is correct or belongs to the version"); ++ } ++ } + +- } +- + } +Index: CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/utils/Settings.java +IDEA additional info: +Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +<+>UTF-8 +=================================================================== +diff --git a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/utils/Settings.java b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/utils/Settings.java +--- a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/utils/Settings.java (revision 60d9051d52d70ed86db8e0fc1a50da61f395e55a) ++++ b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/utils/Settings.java (revision 5436229cc153c4aec4cd6267d80f1e8301022990) +@@ -14,7 +14,6 @@ + public static boolean settings_debug; + + //Join section +- public static String join_type; + + public static boolean join; + public static String join_message; +@@ -25,9 +24,9 @@ + public static boolean join_title; + public static String join_message_title_title; + public static String join_message_title_subtitle; +- public static int join_title_fadein; ++ public static int join_title_fadeIn; + public static int join_title_stay; +- public static int join_title_fadeout; ++ public static int join_title_fadeOut; + + public static boolean join_actionbar; + public static String join_message_actionbar_text; +@@ -38,33 +37,23 @@ + public static int join_sound_vol; + + //Quit section +- +- public static String quit_type; +- + public static boolean quit; + public static String quit_message; + +- public static boolean quit_sound; +- public static String quit_sound_name; +- public static float quit_sound_pitch; +- public static int quit_sound_vol; +- + //Welcome section + public static boolean welcome; + public static List list_welcome; + + //Hooks section +- public static boolean hook_discordsrv; +- public static boolean hook_discordsrv_use_message; +- public static String hook_discordsrv_channelid; ++ public static boolean hook_discordSrv; ++ public static String hook_discordSrv_channelId; + + public static boolean hook_essentials; +- public static boolean hook_essentials_hideplayervanish; ++ public static boolean hook_essentials_hidePlayerVanish; + + public static boolean hook_essentialsDiscord; + public static boolean hook_essentialsDiscord_use_default_channel; +- public static String hook_essentialsDiscord_channelid; ++ public static String hook_essentialsDiscord_channelId; + public static boolean hook_luckperms; +- public static boolean hook_luckperms_use_group; + public static long hook_luckperms_autoUpdate_group_tick; + } +Index: CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/utils/Util.java +IDEA additional info: +Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +<+>UTF-8 +=================================================================== +diff --git a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/utils/Util.java b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/utils/Util.java +--- a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/utils/Util.java (revision 60d9051d52d70ed86db8e0fc1a50da61f395e55a) ++++ b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/utils/Util.java (revision 5436229cc153c4aec4cd6267d80f1e8301022990) +@@ -67,10 +67,8 @@ + return prefix; + } + +- + public static @NotNull List setTabLimit(final @NotNull List options, final String lastArgs) { + final List returned = new ArrayList<>(); +- + for (String s : options) { + if (s == null) { + continue; +@@ -82,25 +80,11 @@ + return returned; + } + +- @SuppressWarnings("unused") +- public static void sendTextComponentHover(@NotNull Player j, String action, String message, String subMessage, String color) { +- TextComponent msg = new TextComponent(color(message)); +- msg.setHoverEvent(new HoverEvent(HoverEvent.Action.valueOf(getActionHoverType(action)), new ComponentBuilder(subMessage).color(ChatColor.of(color)).create())); +- j.spigot().sendMessage(msg); +- } +- + public static void sendTextComponent116Hover(@NotNull Player j, String action, String message, String subMessage) { + TextComponent msg = new TextComponent(color(message)); + msg.setHoverEvent(new HoverEvent(HoverEvent.Action.valueOf(getActionHoverType(action)), new ComponentBuilder(color(subMessage)).create())); + j.spigot().sendMessage(msg); + } +- +- @SuppressWarnings("unused") +- public static void sendTextComponentClick(@NotNull Player j, String action, String message, String arg0) { +- TextComponent msg = new TextComponent(color(message)); +- msg.setClickEvent(new ClickEvent(ClickEvent.Action.valueOf(getActionClickType(action)), arg0)); +- j.spigot().sendMessage(msg); +- } + + public static void sendAllPlayerBaseComponent(BaseComponent component) { + for (Player p : Bukkit.getOnlinePlayers()) { +@@ -120,16 +104,6 @@ + } + return null; + } +- +- public static @Nullable String getActionClickType(@NotNull String arg) { +- if (arg.equalsIgnoreCase("url")) { +- return "OPEN_URL"; +- } +- if (arg.equalsIgnoreCase("cmd")) { +- return "RUN_COMMAND"; +- } +- return null; +- } + + public static @NotNull String getVar(@NotNull Player player, String text) { + text = text.replace("", player.getName()); +Index: CustomJoinAndQuitMessagesOld/src/main/resources/config.yml +IDEA additional info: +Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +<+>UTF-8 +=================================================================== +diff --git a/CustomJoinAndQuitMessagesOld/src/main/resources/config.yml b/CustomJoinAndQuitMessagesOld/src/main/resources/config.yml +--- a/CustomJoinAndQuitMessagesOld/src/main/resources/config.yml (revision 60d9051d52d70ed86db8e0fc1a50da61f395e55a) ++++ b/CustomJoinAndQuitMessagesOld/src/main/resources/config.yml (revision 5436229cc153c4aec4cd6267d80f1e8301022990) +@@ -105,9 +105,6 @@ + # |Text| Here you can set the join message for the first time + Text: '&6Welcome to server &a&6 for the first time' + +- # |Type| Here you can find two types that are [ normal | modify ] +- Type: modify +- + # |HoverEvent| This section allows you to modify the hover events in the chat + HoverEvent: + +@@ -129,12 +126,6 @@ + # |Mode| there are three different modes which are [ command | suggest | url ] + Mode: command + +- # This feature is not available yet +- DevActions: +- - '[Suggest]: /help' +- - '[Execute]: /me hello test' +- - '[Open]: https://www.spigotmc.org/resources/custom-join-and-quit-message-1-7-x-1-17-x.57006/' +- + # |Actions| This is where are the available events that you can use + Actions: + +@@ -205,9 +196,6 @@ + # |Text| This is where Quit customizable message is located + Text: '&b[<#:FF8E8E>-&b] <#:A157FF>' + +- # |Type| Here you can find two types that are [ normal | modify ] +- Type: normal +- + # |HoverEvent| This section allows you to modify the hover events in the chat + HoverEvent: + +@@ -280,7 +268,7 @@ + - '&m=========================================&r' + # + # |File-Version|I would not change anything +-File-Version: 3 ++File-Version: 4 + # |> This is the end of the configuration ... [-_-] more things coming soon + # + # | Config File | +Index: CustomJoinAndQuitMessagesOld/src/main/resources/groups.yml +IDEA additional info: +Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +<+>UTF-8 +=================================================================== +diff --git a/CustomJoinAndQuitMessagesOld/src/main/resources/groups.yml b/CustomJoinAndQuitMessagesOld/src/main/resources/groups.yml +--- a/CustomJoinAndQuitMessagesOld/src/main/resources/groups.yml (revision 60d9051d52d70ed86db8e0fc1a50da61f395e55a) ++++ b/CustomJoinAndQuitMessagesOld/src/main/resources/groups.yml (revision 5436229cc153c4aec4cd6267d80f1e8301022990) +@@ -32,9 +32,6 @@ + + # |Text| Here you can set the join message for the first time + Text: '&6Welcome to server &a&6 for the first time' +- +- # |Type| Here you can find two types that are [ normal | modify ] +- Type: modify + + # |HoverEvent| This section allows you to modify the hover events in the chat + HoverEvent: +Index: bukkit/src/main/java/jss/customjoinandquitmessage/commands/subcommands/InfoCommand.java +IDEA additional info: +Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +<+>UTF-8 +=================================================================== +diff --git a/bukkit/src/main/java/jss/customjoinandquitmessage/commands/subcommands/InfoCommand.java b/bukkit/src/main/java/jss/customjoinandquitmessage/commands/subcommands/InfoCommand.java +--- a/bukkit/src/main/java/jss/customjoinandquitmessage/commands/subcommands/InfoCommand.java (revision 60d9051d52d70ed86db8e0fc1a50da61f395e55a) ++++ b/bukkit/src/main/java/jss/customjoinandquitmessage/commands/subcommands/InfoCommand.java (revision 5436229cc153c4aec4cd6267d80f1e8301022990) +@@ -9,6 +9,11 @@ + return "info"; + } + ++ @Override ++ public String permission() { ++ return null; ++ } ++ + public void onCommand(CommandSender sender, String[] args) { + + } +Index: patches/Removed_debugging_messages_in_the_LuckPermsHook_class_.patch +IDEA additional info: +Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +<+>UTF-8 +=================================================================== +diff --git a/patches/Removed_debugging_messages_in_the_LuckPermsHook_class_.patch b/patches/Removed_debugging_messages_in_the_LuckPermsHook_class_.patch +new file mode 100644 +--- /dev/null (revision 5436229cc153c4aec4cd6267d80f1e8301022990) ++++ b/patches/Removed_debugging_messages_in_the_LuckPermsHook_class_.patch (revision 5436229cc153c4aec4cd6267d80f1e8301022990) +@@ -0,0 +1,29 @@ ++Index: CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/hook/LuckPermsHook.java ++IDEA additional info: ++Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP ++<+>UTF-8 ++=================================================================== ++diff --git a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/hook/LuckPermsHook.java b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/hook/LuckPermsHook.java ++--- a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/hook/LuckPermsHook.java (revision 52d1e6b32c970d5470b3f06b418c1d1ef9e3aeb1) +++++ b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/hook/LuckPermsHook.java (revision 60d9051d52d70ed86db8e0fc1a50da61f395e55a) ++@@ -25,19 +25,16 @@ ++ if (!Bukkit.getPluginManager().isPluginEnabled("LuckPerms")) { ++ Logger.warning("&eLuckPerms not enabled! - Disable Features..."); ++ this.isEnabled = false; ++- System.out.println("Cjm Softdepend: Luckperms false - check plugin installed in plugin folder"); ++ return; ++ } ++ ++ if (!Settings.hook_luckperms) { ++ this.isEnabled = false; ++- System.out.println("Cjm Softdepend: Luckperms false - Hook Enabled in config"); ++- Logger.warning("&eLuckPerms not enabled! - Disable Features..."); +++ System.out.println("Cjm Softdepend: Luckperms false - Hook disabled in config"); ++ return; ++ } ++ ++ this.isEnabled = true; ++- System.out.println("Cjm Softdepend: Luckperms true - The plugin has successfully loaded the dependency"); ++ Util.sendColorMessage(EventUtils.getStaticConsoleSender(), Util.getPrefix(true) + "&aLoading LuckPerms features..."); ++ } ++ From e3e6f528ca2c93af4251b9955aa457aff0fd3a62 Mon Sep 17 00:00:00 2001 From: SrJss <31166687+jonagamerpro1234@users.noreply.github.com> Date: Mon, 27 Feb 2023 14:12:59 -0300 Subject: [PATCH 18/27] Removed method getType of the GroupManager class --- .../manager/GroupManager.java | 12 +- patches/Fixed_PlayerStorageData.patch | 1734 +++++++++++++++++ 2 files changed, 1737 insertions(+), 9 deletions(-) create mode 100644 patches/Fixed_PlayerStorageData.patch diff --git a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/manager/GroupManager.java b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/manager/GroupManager.java index d5cb639..fa3fd84 100644 --- a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/manager/GroupManager.java +++ b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/manager/GroupManager.java @@ -77,11 +77,11 @@ public List getHover(String group) { } public boolean isClick(String group) { - boolean isclick = false; + boolean isClick = false; if (existsGroup(group)) { - isclick = config.getBoolean(group + ".ClickEvent.Enabled"); + isClick = config.getBoolean(group + ".ClickEvent.Enabled"); } - return isclick; + return isClick; } public String getClickMode(String group) { @@ -112,12 +112,6 @@ public String getClickSuggestCommand(String group) { return null; } - public String getType(String group){ - if (existsGroup(group)) { - return config.getString(group + ".Type"); - } - return null; - } public boolean isTitle(String group){ boolean istitle = false; diff --git a/patches/Fixed_PlayerStorageData.patch b/patches/Fixed_PlayerStorageData.patch new file mode 100644 index 0000000..1fd0fd3 --- /dev/null +++ b/patches/Fixed_PlayerStorageData.patch @@ -0,0 +1,1734 @@ +Index: CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/CustomJoinAndQuitMessages.java +IDEA additional info: +Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +<+>UTF-8 +=================================================================== +diff --git a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/CustomJoinAndQuitMessages.java b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/CustomJoinAndQuitMessages.java +--- a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/CustomJoinAndQuitMessages.java (revision 5436229cc153c4aec4cd6267d80f1e8301022990) ++++ b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/CustomJoinAndQuitMessages.java (revision 6f51455f26ef7aad69f1b9446a2a31237d1f5040) +@@ -28,7 +28,6 @@ + + private static CustomJoinAndQuitMessages plugin; + public Metrics metrics; +- public boolean useLatestversion; + private final PluginDescriptionFile jss = getDescription(); + public String name = this.jss.getName(); + public String version = this.jss.getVersion(); +@@ -46,7 +45,7 @@ + Util.sendLoadTitle(version); + inventoryViews = new ArrayList<>(); + +- Util.createFolder(this,"Players"); ++ //Util.createFolder(this,"Players"); + } + + public void onEnable() { +Index: CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/listener/JoinListener.java +IDEA additional info: +Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +<+>UTF-8 +=================================================================== +diff --git a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/listener/JoinListener.java b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/listener/JoinListener.java +--- a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/listener/JoinListener.java (revision 5436229cc153c4aec4cd6267d80f1e8301022990) ++++ b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/listener/JoinListener.java (revision 6f51455f26ef7aad69f1b9446a2a31237d1f5040) +@@ -8,8 +8,6 @@ + import jss.customjoinandquitmessages.json.MessageBuilder; + import jss.customjoinandquitmessages.manager.HookManager; + import jss.customjoinandquitmessages.manager.PlayerManager; +-import jss.customjoinandquitmessages.storage.PlayerData; +-import jss.customjoinandquitmessages.storage.PlayerJsonStorage; + import jss.customjoinandquitmessages.update.UpdateChecker; + import jss.customjoinandquitmessages.utils.GroupHelper; + import jss.customjoinandquitmessages.utils.Logger; +@@ -55,13 +53,6 @@ + tempGroup = "default"; + } + +- PlayerJsonStorage playerJsonStorage = new PlayerJsonStorage(plugin); +- PlayerData playerData = playerJsonStorage.loadPlayerData(p.getName()); +- +- if(playerData == null){ +- playerJsonStorage.savePlayerData(new PlayerData(p.getName())); +- } +- + PlayerManager playerManager = new PlayerManager(); + playerManager.createPlayer(p, tempGroup); + +@@ -245,7 +236,7 @@ + } + } + +- @EventHandler ++ @EventHandler(priority = EventPriority.HIGH) + public void onQuit(@NotNull PlayerQuitEvent e) { + FileConfiguration config = plugin.getConfigFile().getConfig(); + Player p = e.getPlayer(); +Index: patches/Removed_types_normal_and_modify_of_Join_and_Quit_and_more_.patch +IDEA additional info: +Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +<+>UTF-8 +=================================================================== +diff --git a/patches/Removed_types_normal_and_modify_of_Join_and_Quit_and_more_.patch b/patches/Removed_types_normal_and_modify_of_Join_and_Quit_and_more_.patch +new file mode 100644 +--- /dev/null (revision 6f51455f26ef7aad69f1b9446a2a31237d1f5040) ++++ b/patches/Removed_types_normal_and_modify_of_Join_and_Quit_and_more_.patch (revision 6f51455f26ef7aad69f1b9446a2a31237d1f5040) +@@ -0,0 +1,1659 @@ ++Index: CustomJoinAndQuitMessagesOld/pom.xml ++IDEA additional info: ++Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP ++<+>UTF-8 ++=================================================================== ++diff --git a/CustomJoinAndQuitMessagesOld/pom.xml b/CustomJoinAndQuitMessagesOld/pom.xml ++--- a/CustomJoinAndQuitMessagesOld/pom.xml (revision 60d9051d52d70ed86db8e0fc1a50da61f395e55a) +++++ b/CustomJoinAndQuitMessagesOld/pom.xml (revision 5436229cc153c4aec4cd6267d80f1e8301022990) ++@@ -9,7 +9,7 @@ ++ ++ ++ CustomJoinAndQuitMessagesOld ++- 1.7.8-release +++ 1.7.9-release ++ ++ ++ 8 ++Index: CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/commands/CustomJoinAndQuitCmd.java ++IDEA additional info: ++Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP ++<+>UTF-8 ++=================================================================== ++diff --git a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/commands/CustomJoinAndQuitCmd.java b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/commands/CustomJoinAndQuitCmd.java ++--- a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/commands/CustomJoinAndQuitCmd.java (revision 60d9051d52d70ed86db8e0fc1a50da61f395e55a) +++++ b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/commands/CustomJoinAndQuitCmd.java (revision 5436229cc153c4aec4cd6267d80f1e8301022990) ++@@ -58,7 +58,7 @@ ++ if (args.length >= 1) { ++ ++ if (args[0].equalsIgnoreCase("help")) { ++- if ((j.isOp()) || (j.hasPermission("Cjm.Help"))) { +++ if ((j.isOp()) || (j.hasPermission("cjm.command.help"))) { ++ Util.sendColorMessage(j, "&5-=-=-=-=-=-=-=-=-=-=-=&6[&d" + plugin.name + "&6]&5=-=-=-=-=-=-=-=-=-=-=-"); ++ for (String text : plugin.Locale().help_1) { ++ Util.sendColorMessage(j, text); ++@@ -71,7 +71,7 @@ ++ } ++ ++ if (args[0].equalsIgnoreCase("reload") || args[0].equalsIgnoreCase("rl")) { ++- if ((j.isOp()) || (j.hasPermission("Cjm.Reload"))) { +++ if ((j.isOp()) || (j.hasPermission(" cjm.command.reload"))) { ++ plugin.reloadAllFiles(); ++ Util.sendColorMessage(j, Util.getPrefix(false) + plugin.Locale().reload); ++ } else { ++Index: CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/config/utils/PreConfigLoader.java ++IDEA additional info: ++Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP ++<+>UTF-8 ++=================================================================== ++diff --git a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/config/utils/PreConfigLoader.java b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/config/utils/PreConfigLoader.java ++--- a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/config/utils/PreConfigLoader.java (revision 60d9051d52d70ed86db8e0fc1a50da61f395e55a) +++++ b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/config/utils/PreConfigLoader.java (revision 5436229cc153c4aec4cd6267d80f1e8301022990) ++@@ -32,7 +32,6 @@ ++ //Join ++ Settings.join = Objects.equals(config.getString("Join.Enabled"), "true"); ++ Settings.join_message = config.getString("Join.Text"); ++- Settings.join_type = config.getString("Join.Type"); ++ ++ Settings.firstjoin = Objects.equals(config.getString("Join.First-Join.Enabled"), "true"); ++ Settings.join_message_first = config.getString("Join.First-Join.Text"); ++@@ -43,9 +42,9 @@ ++ Settings.join_message_title_title = config.getString("Join.Title.Title"); ++ Settings.join_message_title_subtitle = config.getString("Join.Title.SubTitle"); ++ ++- Settings.join_title_fadein = config.getInt("Join.Title.FadeIn"); +++ Settings.join_title_fadeIn = config.getInt("Join.Title.FadeIn"); ++ Settings.join_title_stay = config.getInt("Join.Title.Stay"); ++- Settings.join_title_fadeout = config.getInt("Join.Title.FadeOut"); +++ Settings.join_title_fadeOut = config.getInt("Join.Title.FadeOut"); ++ ++ Settings.join_sound = Objects.equals(config.getString("Join.Sound.Enabled"), "true"); ++ Settings.join_sound_name = config.getString("Join.Sound.Name"); ++@@ -54,7 +53,6 @@ ++ ++ //Quit ++ Settings.quit = Objects.equals(config.getString("Quit.Enabled"), "true"); ++- Settings.quit_type = config.getString("Quit.Type"); ++ Settings.quit_message = config.getString("Quit.Text"); ++ ++ //Welcome ++@@ -62,11 +60,11 @@ ++ Settings.list_welcome = config.getStringList("Welcome.Text"); ++ ++ //Hooks ++- Settings.hook_discordsrv = Objects.equals(config.getString("Hooks.DiscordSRV.Enabled"), "true"); ++- Settings.hook_discordsrv_channelid = config.getString("Hooks.DiscordSRV.Channel-ID"); +++ Settings.hook_discordSrv = Objects.equals(config.getString("Hooks.DiscordSRV.Enabled"), "true"); +++ Settings.hook_discordSrv_channelId = config.getString("Hooks.DiscordSRV.Channel-ID"); ++ ++ Settings.hook_essentialsDiscord = Objects.equals(config.getString("Hooks.EssentialsDiscord.Enabled"), "true"); ++- Settings.hook_essentialsDiscord_channelid = config.getString("Hooks.EssentialsDiscord.Channel-ID"); +++ Settings.hook_essentialsDiscord_channelId = config.getString("Hooks.EssentialsDiscord.Channel-ID"); ++ Settings.hook_essentialsDiscord_use_default_channel = config.getBoolean("Hooks.EssentialsDiscord.Use-Default-Channel"); ++ ++ Settings.hook_luckperms = config.getBoolean("Hooks.LuckPerms.Enabled"); ++@@ -74,7 +72,7 @@ ++ Settings.hook_luckperms_autoUpdate_group_tick = config.getLong("Hooks.LuckPerms.AutoUpdateGroup.Tick"); ++ ++ Settings.hook_essentials = Objects.equals(config.getString("Hooks.Essentials.Enabled"), "true"); ++- Settings.hook_essentials_hideplayervanish = config.getBoolean("Hooks.Essentials.HidePlayerIsVanish"); +++ Settings.hook_essentials_hidePlayerVanish = config.getBoolean("Hooks.Essentials.HidePlayerIsVanish"); ++ ++ } catch (Exception e) { ++ Logger.error("&cThere was an error loading the &b[PreConfigLoader]&7, please reload the plugin"); ++Index: CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/hook/DiscordSRVHHook.java ++IDEA additional info: ++Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP ++<+>UTF-8 ++=================================================================== ++diff --git a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/hook/DiscordSRVHHook.java b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/hook/DiscordSRVHHook.java ++--- a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/hook/DiscordSRVHHook.java (revision 60d9051d52d70ed86db8e0fc1a50da61f395e55a) +++++ b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/hook/DiscordSRVHHook.java (revision 5436229cc153c4aec4cd6267d80f1e8301022990) ++@@ -1,6 +1,5 @@ ++ package jss.customjoinandquitmessages.hook; ++ ++-import jss.customjoinandquitmessages.manager.HookManager; ++ import jss.customjoinandquitmessages.utils.EventUtils; ++ import jss.customjoinandquitmessages.utils.Logger; ++ import jss.customjoinandquitmessages.utils.Settings; ++@@ -10,13 +9,8 @@ ++ ++ public class DiscordSRVHHook implements IHook { ++ ++- private HookManager hookManager; ++ private boolean isEnabled; ++ ++- public DiscordSRVHHook(HookManager hookManager) { ++- this.hookManager = hookManager; ++- } ++- ++ public void setup() { ++ if (!Bukkit.getPluginManager().isPluginEnabled("DiscordSRV")) { ++ Logger.warning("&eDiscordSRV not enabled! - Disable Features..."); ++@@ -24,7 +18,7 @@ ++ return; ++ } ++ ++- if (!Settings.hook_discordsrv) { +++ if (!Settings.hook_discordSrv) { ++ this.isEnabled = false; ++ Logger.warning("&eDiscordSRV not enabled! - Disable Features..."); ++ return; ++@@ -38,7 +32,4 @@ ++ return isEnabled; ++ } ++ ++- public HookManager getHookManager() { ++- return hookManager; ++- } ++ } ++Index: CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/hook/EssentialsXDiscordHook.java ++IDEA additional info: ++Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP ++<+>UTF-8 ++=================================================================== ++diff --git a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/hook/EssentialsXDiscordHook.java b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/hook/EssentialsXDiscordHook.java ++--- a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/hook/EssentialsXDiscordHook.java (revision 60d9051d52d70ed86db8e0fc1a50da61f395e55a) +++++ b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/hook/EssentialsXDiscordHook.java (revision 5436229cc153c4aec4cd6267d80f1e8301022990) ++@@ -1,6 +1,5 @@ ++ package jss.customjoinandquitmessages.hook; ++ ++-import jss.customjoinandquitmessages.manager.HookManager; ++ import jss.customjoinandquitmessages.utils.EventUtils; ++ import jss.customjoinandquitmessages.utils.Logger; ++ import jss.customjoinandquitmessages.utils.Settings; ++@@ -12,14 +11,9 @@ ++ ++ public class EssentialsXDiscordHook implements IHook { ++ ++- private HookManager hookManager; ++ private boolean isEnabled; ++ private DiscordService service; ++ ++- public EssentialsXDiscordHook(HookManager hookManager) { ++- this.hookManager = hookManager; ++- } ++- ++ public void setup() { ++ if (!Bukkit.getPluginManager().isPluginEnabled("EssentialsDiscord")) { ++ Logger.warning("&eEssentialsDiscord not enabled! - Disable Features..."); ++@@ -43,27 +37,22 @@ ++ return isEnabled; ++ } ++ ++- public DiscordService getService() { ++- return service; ++- } ++- +++ @SuppressWarnings("unused") ++ public void sendJoinMessage(String channelId, String message) { ++ if (Settings.hook_essentialsDiscord_use_default_channel) { ++ service.sendMessage(MessageType.DefaultTypes.JOIN, message, false); ++ } else { ++- service.sendMessage(new MessageType(Settings.hook_essentialsDiscord_channelid), message, false); +++ service.sendMessage(new MessageType(Settings.hook_essentialsDiscord_channelId), message, false); ++ } ++ } ++ +++ @SuppressWarnings("unused") ++ public void sendQuitMessage(String channelId, String message) { ++ if (Settings.hook_essentialsDiscord_use_default_channel) { ++ service.sendMessage(MessageType.DefaultTypes.LEAVE, message, false); ++ } else { ++- service.sendMessage(new MessageType(Settings.hook_essentialsDiscord_channelid), message, false); +++ service.sendMessage(new MessageType(Settings.hook_essentialsDiscord_channelId), message, false); ++ } ++ } ++ ++- public HookManager getHookManager() { ++- return hookManager; ++- } ++ } ++Index: CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/listener/JoinListener.java ++IDEA additional info: ++Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP ++<+>UTF-8 ++=================================================================== ++diff --git a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/listener/JoinListener.java b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/listener/JoinListener.java ++--- a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/listener/JoinListener.java (revision 60d9051d52d70ed86db8e0fc1a50da61f395e55a) +++++ b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/listener/JoinListener.java (revision 5436229cc153c4aec4cd6267d80f1e8301022990) ++@@ -103,7 +103,7 @@ ++ } ++ ++ if (essentialsXHook.isEnabled()) { ++- if (Settings.hook_essentials_hideplayervanish) { +++ if (Settings.hook_essentials_hidePlayerVanish) { ++ if (essentialsXHook.isVanish(p)) { ++ e.setJoinMessage(null); ++ return; ++@@ -115,11 +115,10 @@ ++ if (isNormal) { ++ e.setJoinMessage(null); ++ +++ String text; ++ String join = Settings.join_message; ++ String firstjoin = Settings.join_message_first; ++ ++- String text; ++- ++ if (Settings.firstjoin) { ++ if (!p.hasPlayedBefore()) { ++ text = firstjoin; ++@@ -130,161 +129,106 @@ ++ text = join; ++ } ++ ++- boolean isNormalType = Settings.join_type.equalsIgnoreCase("normal"); ++- boolean isModifyType = Settings.join_type.equalsIgnoreCase("modify"); ++- ++ text = Util.color(Util.getVar(p, text)); ++- ++ MessageBuilder messageBuilder = new MessageBuilder(p, text); ++ ++- //Update Logger ++ if (config.getBoolean("Config.Show-Chat-In-Console")) { ++ Logger.info(messageBuilder.getText()); ++ } ++ ++- if (isNormalType) { ++- e.setJoinMessage(text); ++- if (discordSRVHHook.isEnabled()) { ++- ++- if (Settings.hook_discordsrv_channelid.equalsIgnoreCase("none")) ++- return; ++- ++- DiscordUtil.sendMessageBlocking( ++- DiscordUtil.getTextChannelById(Settings.hook_discordsrv_channelid), ++- Util.colorless(messageBuilder.getText())); ++- } ++- ++- if (essentialsXDiscordHook.isEnabled()) { ++- if (Settings.hook_essentialsDiscord_channelid.equalsIgnoreCase("none")) ++- return; ++- ++- essentialsXDiscordHook.sendJoinMessage(Settings.hook_essentialsDiscord_channelid, ++- Util.colorless(messageBuilder.getText())); ++- } ++- ++- //Removed IsModifyType in 1.8.0 ++- } else if (isModifyType) { ++- boolean isHover = Objects.equals(config.getString("Join.HoverEvent.Enabled"), "true"); ++- boolean isClick = Objects.equals(config.getString("Join.ClickEvent.Enabled"), "true"); ++- boolean isTitle = Objects.equals(config.getString("Join.Title.Enabled"), "true"); ++- boolean isSound = Objects.equals(config.getString("Join.Sound.Enabled"), "true"); ++- boolean isActionBar = Objects.equals(config.getString("Join.ActionBar.Enabled"), "true"); ++- boolean isSoundAll = Objects.equals(config.getString("Join.Sound.Send-To-All"), "true"); +++ boolean isHover = config.getBoolean("Join.HoverEvent.Enabled"); +++ boolean isClick = config.getBoolean("Join.ClickEvent.Enabled"); +++ boolean isTitle = config.getBoolean("Join.Title.Enabled"); +++ boolean isSound = config.getBoolean("Join.Sound.Enabled"); +++ boolean isActionBar = config.getBoolean("Join.ActionBar.Enabled"); +++ boolean isSoundAll = config.getBoolean("Join.Sound.Send-To-All"); ++ ++- List Hover_Text = config.getStringList("Join.HoverEvent.Hover"); +++ List Hover_Text = config.getStringList("Join.HoverEvent.Hover"); ++ ++- String isClick_Mode = config.getString("Join.ClickEvent.Mode"); ++- String Action_Command = config.getString("Join.ClickEvent.Actions.Command"); ++- String Action_Url = config.getString("Join.ClickEvent.Actions.Url"); ++- String Action_Suggest = config.getString("Join.ClickEvent.Actions.Suggest-Command"); ++- ++- //List Action_Dev = config.getStringList("Join.ClickEvent.DevActions"); ++- ++- String Title_Text = config.getString("Join.Title.Title"); ++- String SubTitle_Text = config.getString("Join.Title.SubTitle"); ++- String Actionbar_Text = config.getString("Join.ActionBar.Text"); ++- String Sound_Name = config.getString("Join.Sound.Name"); +++ String isClick_Mode = config.getString("Join.ClickEvent.Mode"); +++ String Action_Command = config.getString("Join.ClickEvent.Actions.Command"); +++ String Action_Url = config.getString("Join.ClickEvent.Actions.Url"); +++ String Action_Suggest = config.getString("Join.ClickEvent.Actions.Suggest-Command"); +++ String Title_Text = config.getString("Join.Title.Title"); +++ String SubTitle_Text = config.getString("Join.Title.SubTitle"); +++ String Actionbar_Text = config.getString("Join.ActionBar.Text"); +++ String Sound_Name = config.getString("Join.Sound.Name"); ++ ++- int FadeIn = config.getInt("Join.Title.FadeIn"); ++- int Stay = config.getInt("Join.Title.Stay"); ++- int FadeOut = config.getInt("Join.Title.FadeOut"); ++- int Sound_Volume = config.getInt("Join.Sound.Volume"); +++ int FadeIn = config.getInt("Join.Title.FadeIn"); +++ int Stay = config.getInt("Join.Title.Stay"); +++ int FadeOut = config.getInt("Join.Title.FadeOut"); +++ int Sound_Volume = config.getInt("Join.Sound.Volume"); ++ ++- float Sound_Pitch = Float.parseFloat(Objects.requireNonNull(config.getString("Join.Sound.Pitch"))); +++ float Sound_Pitch = Float.parseFloat(Objects.requireNonNull(config.getString("Join.Sound.Pitch"))); ++ ++- if (isHover) { ++- if (isClick) { ++- assert isClick_Mode != null; ++- if (isClick_Mode.equalsIgnoreCase("command")) { ++- messageBuilder.setHover(Hover_Text).setExecuteCommand(Action_Command).sendToAll(); ++- } else if (isClick_Mode.equalsIgnoreCase("url")) { ++- messageBuilder.setHover(Hover_Text).setOpenURL(Action_Url).sendToAll(); ++- } else if (isClick_Mode.equalsIgnoreCase("suggest")) { ++- messageBuilder.setHover(Hover_Text).setSuggestCommand(Action_Suggest).sendToAll(); ++- } ++- } else { ++- messageBuilder.setHover(Hover_Text).sendToAll(); ++- } ++- } else { +++ if (isHover) { +++ if (isClick) { +++ assert isClick_Mode != null; +++ if (isClick_Mode.equalsIgnoreCase("command")) { +++ messageBuilder.setHover(Hover_Text).setExecuteCommand(Action_Command).sendToAll(); +++ } else if (isClick_Mode.equalsIgnoreCase("url")) { +++ messageBuilder.setHover(Hover_Text).setOpenURL(Action_Url).sendToAll(); +++ } else if (isClick_Mode.equalsIgnoreCase("suggest")) { +++ messageBuilder.setHover(Hover_Text).setSuggestCommand(Action_Suggest).sendToAll(); +++ } +++ } else { +++ messageBuilder.setHover(Hover_Text).sendToAll(); +++ } +++ } else { ++ ++- if (isClick) { ++- ++- /*for(String action : Action_Dev){ ++- ++- String[] parts = action.split(":"); ++- String type = parts[0].trim(); ++- String value = parts[1].trim(); ++- ++- switch (type){ ++- case "[Execute]": ++- messageBuilder.setExecuteCommand(value); ++- break; ++- case "[Suggest]": ++- messageBuilder.setSuggestCommand(value); ++- break; ++- case "[Open]": ++- messageBuilder.setOpenURL(value); ++- break; ++- default: ++- messageBuilder.sendToAll(); ++- break; ++- } ++- } ++- messageBuilder.sendToAll();*/ ++- ++- assert isClick_Mode != null; ++- if (isClick_Mode.equalsIgnoreCase("command")) { ++- messageBuilder.setExecuteCommand(Action_Command).sendToAll(); ++- } else if (isClick_Mode.equalsIgnoreCase("url")) { ++- messageBuilder.setOpenURL(Action_Url).sendToAll(); ++- } else if (isClick_Mode.equalsIgnoreCase("suggest")) { ++- messageBuilder.setSuggestCommand(Action_Suggest).sendToAll(); ++- } ++- ++- ++- } else { ++- messageBuilder.sendToAll(); ++- } ++- } +++ if (isClick) { +++ assert isClick_Mode != null; +++ if (isClick_Mode.equalsIgnoreCase("command")) { +++ messageBuilder.setExecuteCommand(Action_Command).sendToAll(); +++ } else if (isClick_Mode.equalsIgnoreCase("url")) { +++ messageBuilder.setOpenURL(Action_Url).sendToAll(); +++ } else if (isClick_Mode.equalsIgnoreCase("suggest")) { +++ messageBuilder.setSuggestCommand(Action_Suggest).sendToAll(); +++ } +++ } else { +++ messageBuilder.sendToAll(); +++ } +++ } ++ ++- if (discordSRVHHook.isEnabled()) { ++- DiscordUtil.sendMessageBlocking( ++- DiscordUtil.getTextChannelById(Settings.hook_discordsrv_channelid), ++- Util.colorless(messageBuilder.getText())); ++- } +++ if (discordSRVHHook.isEnabled()) { +++ DiscordUtil.sendMessageBlocking( +++ DiscordUtil.getTextChannelById(Settings.hook_discordSrv_channelId), +++ Util.colorless(messageBuilder.getText())); +++ } ++ ++- if (isTitle) { ++- Titles.sendTitle(p, FadeIn, Stay, FadeOut, Util.color(Util.getVar(p, Title_Text)), ++- Util.color(Util.getVar(p, SubTitle_Text))); ++- } +++ if (isTitle) { +++ Titles.sendTitle(p, FadeIn, Stay, FadeOut, Util.color(Util.getVar(p, Title_Text)), +++ Util.color(Util.getVar(p, SubTitle_Text))); +++ } ++ ++- if (isActionBar) { ++- ActionBar.sendActionBar(p, Util.color(Util.getVar(p, Actionbar_Text))); ++- } +++ if (isActionBar) { +++ ActionBar.sendActionBar(p, Util.color(Util.getVar(p, Actionbar_Text))); +++ } ++ ++- try { ++- if (isSound) { ++- if (isSoundAll) { ++- Location location = p.getLocation(); ++- p.playSound(location, Sound.valueOf(Sound_Name), Sound_Volume, Sound_Pitch); ++- } else { ++- for (Player pp : Bukkit.getOnlinePlayers()) { ++- Location location = p.getLocation(); ++- pp.playSound(location, Sound.valueOf(Sound_Name), Sound_Volume, Sound_Pitch); ++- } ++- } ++- } ++- } catch (Exception ex) { ++- Logger.warning("&eVerify that the sound name is correct or belongs to the version"); ++- } +++ try { +++ if (isSound) { +++ if (isSoundAll) { +++ Location location = p.getLocation(); +++ p.playSound(location, Sound.valueOf(Sound_Name), Sound_Volume, Sound_Pitch); +++ } else { +++ for (Player pp : Bukkit.getOnlinePlayers()) { +++ Location location = p.getLocation(); +++ pp.playSound(location, Sound.valueOf(Sound_Name), Sound_Volume, Sound_Pitch); +++ } +++ } +++ } +++ } catch (Exception ex) { +++ Logger.warning("&eVerify that the sound name is correct or belongs to the version"); ++ } +++ +++ ++ } else if (isGroup) { ++ e.setJoinMessage(null); ++ GroupHelper groupHelper = new GroupHelper(); ++ groupHelper.setGroup(playerManager.getGroup(p)); ++ groupHelper.setDiscord(discordSRVHHook); ++ groupHelper.setEssentials(essentialsXDiscordHook); ++- groupHelper.onJoin(p, config, e); +++ groupHelper.onJoin(p, config); ++ } else if (isNone) { ++ e.setJoinMessage(null); ++ } ++@@ -295,7 +239,7 @@ ++ public void onUpdate(@NotNull PlayerJoinEvent e) { ++ Player p = e.getPlayer(); ++ if (Settings.update) { ++- if ((p.isOp()) || (p.hasPermission("Cjm.Update.Notify"))) { +++ if ((p.isOp()) || (p.hasPermission("cjm.update"))) { ++ new UpdateChecker(CustomJoinAndQuitMessages.get()).sendSpigotUpdate(); ++ } ++ } ++@@ -329,7 +273,7 @@ ++ } ++ ++ if (essentialsXHook.isEnabled()) { ++- if (Settings.hook_essentials_hideplayervanish) { +++ if (Settings.hook_essentials_hidePlayerVanish) { ++ if (essentialsXHook.isVanish(p)) { ++ e.setQuitMessage(null); ++ return; ++@@ -341,9 +285,6 @@ ++ if (isNormal) { ++ e.setQuitMessage(null); ++ ++- boolean isNormalType = Objects.requireNonNull(config.getString("Quit.Type")).equalsIgnoreCase("normal"); ++- boolean isModifyType = Objects.requireNonNull(config.getString("Quit.Type")).equalsIgnoreCase("modify"); ++- ++ String text = config.getString("Quit.Text"); ++ ++ text = Util.color(text); ++@@ -355,102 +296,81 @@ ++ Logger.info(messageBuilder.getText()); ++ } ++ ++- if (isNormalType) { ++- e.setQuitMessage(text); ++- if (discordSRVHHook.isEnabled()) { ++- if (Settings.hook_discordsrv_channelid.equalsIgnoreCase("none")) ++- return; ++- DiscordUtil.sendMessageBlocking( ++- DiscordUtil.getTextChannelById(Settings.hook_discordsrv_channelid), ++- Util.colorless(messageBuilder.getText())); ++- } ++- ++- if (essentialsXDiscordHook.isEnabled()) { ++- if (Settings.hook_essentialsDiscord_channelid.equalsIgnoreCase("none")) ++- return; ++- essentialsXDiscordHook.sendQuitMessage(Settings.hook_essentialsDiscord_channelid, ++- Util.colorless(messageBuilder.getText())); ++- } ++- } else if (isModifyType) { ++- ++- boolean isHover = Objects.equals(config.getString("Quit.HoverEvent.Enabled"), "true"); ++- boolean isClick = Objects.equals(config.getString("Quit.ClickEvent.Enabled"), "true"); ++- boolean isSound = Objects.equals(config.getString("Quit.Sound.Enabled"), "true"); ++- boolean isSoundAll = Objects.equals(config.getString("Quit.Sound.Send-To-All"), "true"); +++ boolean isHover = config.getBoolean("Quit.HoverEvent.Enabled"); +++ boolean isClick = config.getBoolean("Quit.ClickEvent.Enabled"); +++ boolean isSound = config.getBoolean("Quit.Sound.Enabled"); +++ boolean isSoundAll = config.getBoolean("Quit.Sound.Send-To-All"); ++ ++- List Hover_Text = config.getStringList("Quit.HoverEvent.Hover"); +++ List Hover_Text = config.getStringList("Quit.HoverEvent.Hover"); ++ ++- String isClick_Mode = config.getString("Quit.ClickEvent.Mode"); ++- String Action_Command = config.getString("Quit.ClickEvent.Actions.Command"); ++- String Action_Url = config.getString("Quit.ClickEvent.Actions.Url"); ++- String Action_Suggest = config.getString("Quit.ClickEvent.Actions.Suggest-Command"); ++- String Sound_Name = config.getString("Quit.Sound.Name"); +++ String isClick_Mode = config.getString("Quit.ClickEvent.Mode"); +++ String Action_Command = config.getString("Quit.ClickEvent.Actions.Command"); +++ String Action_Url = config.getString("Quit.ClickEvent.Actions.Url"); +++ String Action_Suggest = config.getString("Quit.ClickEvent.Actions.Suggest-Command"); +++ String Sound_Name = config.getString("Quit.Sound.Name"); ++ ++- int Sound_Volume = config.getInt("Quit.Sound.Volume"); ++- float Sound_Pitch = Float.parseFloat(Objects.requireNonNull(config.getString("Quit.Sound.Pitch"))); +++ int Sound_Volume = config.getInt("Quit.Sound.Volume"); +++ float Sound_Pitch = Float.parseFloat(Objects.requireNonNull(config.getString("Quit.Sound.Pitch"))); ++ ++- if (isHover) { ++- if (isClick) { ++- assert isClick_Mode != null; ++- if (isClick_Mode.equalsIgnoreCase("command")) { ++- messageBuilder.setHover(Hover_Text).setExecuteCommand(Action_Command).sendToAll(); ++- } else if (isClick_Mode.equalsIgnoreCase("url")) { ++- messageBuilder.setHover(Hover_Text).setOpenURL(Action_Url).sendToAll(); ++- } else if (isClick_Mode.equalsIgnoreCase("suggest")) { ++- messageBuilder.setHover(Hover_Text).setSuggestCommand(Action_Suggest).sendToAll(); ++- } ++- } else { ++- messageBuilder.setHover(Hover_Text).sendToAll(); ++- } ++- } else { ++- if (isClick) { ++- assert isClick_Mode != null; ++- if (isClick_Mode.equalsIgnoreCase("command")) { ++- messageBuilder.setExecuteCommand(Action_Command).sendToAll(); ++- } else if (isClick_Mode.equalsIgnoreCase("url")) { ++- messageBuilder.setOpenURL(Action_Url).sendToAll(); ++- } else if (isClick_Mode.equalsIgnoreCase("suggest")) { ++- messageBuilder.setSuggestCommand(Action_Suggest).sendToAll(); ++- } ++- } else { ++- messageBuilder.sendToAll(); ++- } ++- } +++ if (isHover) { +++ if (isClick) { +++ assert isClick_Mode != null; +++ if (isClick_Mode.equalsIgnoreCase("command")) { +++ messageBuilder.setHover(Hover_Text).setExecuteCommand(Action_Command).sendToAll(); +++ } else if (isClick_Mode.equalsIgnoreCase("url")) { +++ messageBuilder.setHover(Hover_Text).setOpenURL(Action_Url).sendToAll(); +++ } else if (isClick_Mode.equalsIgnoreCase("suggest")) { +++ messageBuilder.setHover(Hover_Text).setSuggestCommand(Action_Suggest).sendToAll(); +++ } +++ } else { +++ messageBuilder.setHover(Hover_Text).sendToAll(); +++ } +++ } else { +++ if (isClick) { +++ assert isClick_Mode != null; +++ if (isClick_Mode.equalsIgnoreCase("command")) { +++ messageBuilder.setExecuteCommand(Action_Command).sendToAll(); +++ } else if (isClick_Mode.equalsIgnoreCase("url")) { +++ messageBuilder.setOpenURL(Action_Url).sendToAll(); +++ } else if (isClick_Mode.equalsIgnoreCase("suggest")) { +++ messageBuilder.setSuggestCommand(Action_Suggest).sendToAll(); +++ } +++ } else { +++ messageBuilder.sendToAll(); +++ } +++ } ++ ++- if (discordSRVHHook.isEnabled()) { ++- ++- if (Settings.hook_discordsrv_channelid.equalsIgnoreCase("none")) ++- return; +++ if (discordSRVHHook.isEnabled()) { +++ if (Settings.hook_discordSrv_channelId.equalsIgnoreCase("none")) +++ return; ++ ++- DiscordUtil.sendMessageBlocking( ++- DiscordUtil.getTextChannelById(Settings.hook_discordsrv_channelid), ++- Util.colorless(messageBuilder.getText())); ++- } +++ DiscordUtil.sendMessageBlocking( +++ DiscordUtil.getTextChannelById(Settings.hook_discordSrv_channelId), +++ Util.colorless(messageBuilder.getText())); +++ } ++ ++- if (essentialsXDiscordHook.isEnabled()) { ++- ++- if (Settings.hook_essentialsDiscord_channelid.equalsIgnoreCase("none")) ++- return; +++ if (essentialsXDiscordHook.isEnabled()) { +++ if (Settings.hook_essentialsDiscord_channelId.equalsIgnoreCase("none")) +++ return; ++ ++- essentialsXDiscordHook.sendQuitMessage(Settings.hook_essentialsDiscord_channelid, ++- Util.colorless(messageBuilder.getText())); ++- } +++ essentialsXDiscordHook.sendQuitMessage(Settings.hook_essentialsDiscord_channelId, +++ Util.colorless(messageBuilder.getText())); +++ } ++ ++- try { ++- if (isSound) { ++- if (isSoundAll) { ++- Location location = p.getLocation(); ++- p.playSound(location, Sound.valueOf(Sound_Name), Sound_Volume, Sound_Pitch); ++- } else { ++- for (Player pp : Bukkit.getOnlinePlayers()) { ++- Location location = p.getLocation(); ++- pp.playSound(location, Sound.valueOf(Sound_Name), Sound_Volume, Sound_Pitch); ++- } ++- } ++- } ++- } catch (Exception ex) { ++- Logger.warning("&eVerify that the sound name is correct or belongs to the version"); ++- } +++ try { +++ if (isSound) { +++ if (isSoundAll) { +++ Location location = p.getLocation(); +++ p.playSound(location, Sound.valueOf(Sound_Name), Sound_Volume, Sound_Pitch); +++ } else { +++ for (Player pp : Bukkit.getOnlinePlayers()) { +++ Location location = p.getLocation(); +++ pp.playSound(location, Sound.valueOf(Sound_Name), Sound_Volume, Sound_Pitch); +++ } +++ } +++ } +++ } catch (Exception ex) { +++ Logger.warning("&eVerify that the sound name is correct or belongs to the version"); ++ } ++ } else if (isGroup) { ++ e.setQuitMessage(null); ++@@ -458,13 +378,11 @@ ++ groupHelper.setGroup(playerManager.getGroup(p)); ++ groupHelper.setDiscord(discordSRVHHook); ++ groupHelper.setEssentials(essentialsXDiscordHook); ++- groupHelper.onQuit(p, config, e); +++ groupHelper.onQuit(p, config); ++ } else if (isNone) { ++ e.setQuitMessage(null); ++ } ++ } ++ } ++ ++- ++- ++ } ++Index: CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/manager/DisplayManager.java ++IDEA additional info: ++Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP ++<+>UTF-8 ++=================================================================== ++diff --git a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/manager/DisplayManager.java b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/manager/DisplayManager.java ++--- a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/manager/DisplayManager.java (revision 60d9051d52d70ed86db8e0fc1a50da61f395e55a) +++++ b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/manager/DisplayManager.java (revision 5436229cc153c4aec4cd6267d80f1e8301022990) ++@@ -12,6 +12,7 @@ ++ ++ import java.util.List; ++ +++@SuppressWarnings("all") ++ public class DisplayManager { ++ ++ private final FileConfiguration config = CustomJoinAndQuitMessages.get().getConfigFile().getConfig(); ++@@ -41,8 +42,6 @@ ++ Logger.warning("&e[showFirstJoinMessage] &b-> &7This feature is disabled and you will not be able to see the preview"); ++ ++ String text; ++- boolean isNormalType; ++- boolean isModifyType; ++ boolean isHover; ++ boolean isClick; ++ List Hover_Text; ++@@ -53,8 +52,6 @@ ++ ++ if (Settings.is_Group_Display) { ++ text = groups.getString(group + ".FirstJoin.Text"); ++- isNormalType = groups.getString(group + ".Type").equalsIgnoreCase("normal"); ++- isModifyType = groups.getString(group + ".Type").equalsIgnoreCase("modify"); ++ isHover = groups.getString(group + ".HoverEvent.Enabled").equals("true"); ++ isClick = groups.getString(group + ".ClickEvent.Enabled").equals("true"); ++ Hover_Text = groups.getStringList(group + ".HoverEvent.Hover"); ++@@ -64,8 +61,6 @@ ++ Action_Suggest = groups.getString(group + ".ClickEvent.Actions.Suggest-Command"); ++ } else { ++ text = Settings.join_message_first; ++- isNormalType = Settings.join_type.equalsIgnoreCase("normal"); ++- isModifyType = Settings.join_type.equalsIgnoreCase("modify"); ++ ++ isHover = config.getString("Join.HoverEvent.Enabled").equals("true"); ++ isClick = config.getString("Join.ClickEvent.Enabled").equals("true"); ++@@ -78,34 +73,29 @@ ++ ++ MessageBuilder messageBuilder = new MessageBuilder(player, Util.color(Util.getVar(player, text))); ++ ++- if (isNormalType) { ++- messageBuilder.send(); ++- return; ++- } else if (isModifyType) { ++- if (isHover) { ++- if (isClick) { ++- if (isClick_Mode.equalsIgnoreCase("command")) { ++- messageBuilder.setHover(Hover_Text).setExecuteCommand(Action_Command).send(); ++- } else if (isClick_Mode.equalsIgnoreCase("url")) { ++- messageBuilder.setHover(Hover_Text).setOpenURL(Action_Url).send(); ++- } else if (isClick_Mode.equalsIgnoreCase("suggest")) { ++- messageBuilder.setHover(Hover_Text).setSuggestCommand(Action_Suggest).send(); ++- } ++- } else { ++- messageBuilder.setHover(Hover_Text).send(); ++- } ++- } else { ++- if (isClick) { ++- if (isClick_Mode.equalsIgnoreCase("command")) { ++- messageBuilder.setExecuteCommand(Action_Command).send(); ++- } else if (isClick_Mode.equalsIgnoreCase("url")) { ++- messageBuilder.setOpenURL(Action_Url).send(); ++- } else if (isClick_Mode.equalsIgnoreCase("suggest")) { ++- messageBuilder.setSuggestCommand(Action_Suggest).send(); ++- } ++- } else { ++- messageBuilder.send(); ++- } +++ if (isHover) { +++ if (isClick) { +++ if (isClick_Mode.equalsIgnoreCase("command")) { +++ messageBuilder.setHover(Hover_Text).setExecuteCommand(Action_Command).send(); +++ } else if (isClick_Mode.equalsIgnoreCase("url")) { +++ messageBuilder.setHover(Hover_Text).setOpenURL(Action_Url).send(); +++ } else if (isClick_Mode.equalsIgnoreCase("suggest")) { +++ messageBuilder.setHover(Hover_Text).setSuggestCommand(Action_Suggest).send(); +++ } +++ } else { +++ messageBuilder.setHover(Hover_Text).send(); +++ } +++ } else { +++ if (isClick) { +++ if (isClick_Mode.equalsIgnoreCase("command")) { +++ messageBuilder.setExecuteCommand(Action_Command).send(); +++ } else if (isClick_Mode.equalsIgnoreCase("url")) { +++ messageBuilder.setOpenURL(Action_Url).send(); +++ } else if (isClick_Mode.equalsIgnoreCase("suggest")) { +++ messageBuilder.setSuggestCommand(Action_Suggest).send(); +++ } +++ } else { +++ messageBuilder.send(); ++ } ++ } ++ } ++@@ -127,8 +117,6 @@ ++ ++ if (Settings.is_Group_Display) { ++ text = groups.getString(group + ".Join-Text"); ++- isNormalType = groups.getString(group + ".Type").equalsIgnoreCase("normal"); ++- isModifyType = groups.getString(group + ".Type").equalsIgnoreCase("modify"); ++ ++ isHover = groups.getString(group + ".HoverEvent.Enabled").equals("true"); ++ isClick = groups.getString(group + ".ClickEvent.Enabled").equals("true"); ++@@ -141,8 +129,6 @@ ++ Action_Suggest = groups.getString(group + ".ClickEvent.Actions.Suggest-Command"); ++ } else { ++ text = Settings.join_message; ++- isNormalType = Settings.join_type.equalsIgnoreCase("normal"); ++- isModifyType = Settings.join_type.equalsIgnoreCase("modify"); ++ ++ isHover = config.getString("Join.HoverEvent.Enabled").equals("true"); ++ isClick = config.getString("Join.ClickEvent.Enabled").equals("true"); ++@@ -157,34 +143,29 @@ ++ ++ MessageBuilder messageBuilder = new MessageBuilder(player, Util.color(Util.getVar(player, text))); ++ ++- if (isNormalType) { ++- messageBuilder.send(); ++- return; ++- } else if (isModifyType) { ++- if (isHover) { ++- if (isClick) { ++- if (isClick_Mode.equalsIgnoreCase("command")) { ++- messageBuilder.setHover(Hover_Text).setExecuteCommand(Action_Command).send(); ++- } else if (isClick_Mode.equalsIgnoreCase("url")) { ++- messageBuilder.setHover(Hover_Text).setOpenURL(Action_Url).send(); ++- } else if (isClick_Mode.equalsIgnoreCase("suggest")) { ++- messageBuilder.setHover(Hover_Text).setSuggestCommand(Action_Suggest).send(); ++- } ++- } else { ++- messageBuilder.setHover(Hover_Text).send(); ++- } ++- } else { ++- if (isClick) { ++- if (isClick_Mode.equalsIgnoreCase("command")) { ++- messageBuilder.setExecuteCommand(Action_Command).send(); ++- } else if (isClick_Mode.equalsIgnoreCase("url")) { ++- messageBuilder.setOpenURL(Action_Url).send(); ++- } else if (isClick_Mode.equalsIgnoreCase("suggest")) { ++- messageBuilder.setSuggestCommand(Action_Suggest).send(); ++- } ++- } else { ++- messageBuilder.send(); ++- } +++ if (isHover) { +++ if (isClick) { +++ if (isClick_Mode.equalsIgnoreCase("command")) { +++ messageBuilder.setHover(Hover_Text).setExecuteCommand(Action_Command).send(); +++ } else if (isClick_Mode.equalsIgnoreCase("url")) { +++ messageBuilder.setHover(Hover_Text).setOpenURL(Action_Url).send(); +++ } else if (isClick_Mode.equalsIgnoreCase("suggest")) { +++ messageBuilder.setHover(Hover_Text).setSuggestCommand(Action_Suggest).send(); +++ } +++ } else { +++ messageBuilder.setHover(Hover_Text).send(); +++ } +++ } else { +++ if (isClick) { +++ if (isClick_Mode.equalsIgnoreCase("command")) { +++ messageBuilder.setExecuteCommand(Action_Command).send(); +++ } else if (isClick_Mode.equalsIgnoreCase("url")) { +++ messageBuilder.setOpenURL(Action_Url).send(); +++ } else if (isClick_Mode.equalsIgnoreCase("suggest")) { +++ messageBuilder.setSuggestCommand(Action_Suggest).send(); +++ } +++ } else { +++ messageBuilder.send(); ++ } ++ } ++ } ++@@ -220,8 +201,6 @@ ++ Action_Suggest = groups.getString(group + ".ClickEvent.Actions.Suggest-Command"); ++ } else { ++ text = Settings.quit_message; ++- isNormalType = Settings.quit_type.equalsIgnoreCase("normal"); ++- isModifyType = Settings.quit_type.equalsIgnoreCase("modify"); ++ ++ isHover = config.getString("Quit.HoverEvent.Enabled").equals("true"); ++ isClick = config.getString("Quit.ClickEvent.Enabled").equals("true"); ++@@ -236,36 +215,32 @@ ++ ++ MessageBuilder messageBuilder = new MessageBuilder(player, Util.color(Util.getVar(player, text))); ++ ++- if (isNormalType) { ++- messageBuilder.send(); ++- return; ++- } else if (isModifyType) { ++- if (isHover) { ++- if (isClick) { ++- if (isClick_Mode.equalsIgnoreCase("command")) { ++- messageBuilder.setHover(Hover_Text).setExecuteCommand(Action_Command).send(); ++- } else if (isClick_Mode.equalsIgnoreCase("url")) { ++- messageBuilder.setHover(Hover_Text).setOpenURL(Action_Url).send(); ++- } else if (isClick_Mode.equalsIgnoreCase("suggest")) { ++- messageBuilder.setHover(Hover_Text).setSuggestCommand(Action_Suggest).send(); ++- } ++- } else { ++- messageBuilder.setHover(Hover_Text).send(); ++- } ++- } else { ++- if (isClick) { ++- if (isClick_Mode.equalsIgnoreCase("command")) { ++- messageBuilder.setExecuteCommand(Action_Command).send(); ++- } else if (isClick_Mode.equalsIgnoreCase("url")) { ++- messageBuilder.setOpenURL(Action_Url).send(); ++- } else if (isClick_Mode.equalsIgnoreCase("suggest")) { ++- messageBuilder.setSuggestCommand(Action_Suggest).send(); ++- } ++- } else { ++- messageBuilder.send(); ++- } +++ if (isHover) { +++ if (isClick) { +++ if (isClick_Mode.equalsIgnoreCase("command")) { +++ messageBuilder.setHover(Hover_Text).setExecuteCommand(Action_Command).send(); +++ } else if (isClick_Mode.equalsIgnoreCase("url")) { +++ messageBuilder.setHover(Hover_Text).setOpenURL(Action_Url).send(); +++ } else if (isClick_Mode.equalsIgnoreCase("suggest")) { +++ messageBuilder.setHover(Hover_Text).setSuggestCommand(Action_Suggest).send(); +++ } +++ } else { +++ messageBuilder.setHover(Hover_Text).send(); +++ } +++ } else { +++ if (isClick) { +++ if (isClick_Mode.equalsIgnoreCase("command")) { +++ messageBuilder.setExecuteCommand(Action_Command).send(); +++ } else if (isClick_Mode.equalsIgnoreCase("url")) { +++ messageBuilder.setOpenURL(Action_Url).send(); +++ } else if (isClick_Mode.equalsIgnoreCase("suggest")) { +++ messageBuilder.setSuggestCommand(Action_Suggest).send(); +++ } +++ } else { +++ messageBuilder.send(); ++ } ++ } +++ ++ } ++ ++ public void showWelcomeMessage() { ++@@ -281,7 +256,7 @@ ++ if (!Settings.join_title) ++ Logger.warning("&e[showTitleMessage] &b-> &7This feature is disabled and you will not be able to see the preview"); ++ ++- Titles.sendTitle(player, Settings.join_title_fadein, Settings.join_title_stay, Settings.join_title_fadeout, Settings.join_message_title_title, Settings.join_message_title_subtitle); +++ Titles.sendTitle(player, Settings.join_title_fadeIn, Settings.join_title_stay, Settings.join_title_fadeOut, Settings.join_message_title_title, Settings.join_message_title_subtitle); ++ } ++ ++ public void showActionbar() { ++Index: CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/manager/HookManager.java ++IDEA additional info: ++Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP ++<+>UTF-8 ++=================================================================== ++diff --git a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/manager/HookManager.java b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/manager/HookManager.java ++--- a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/manager/HookManager.java (revision 60d9051d52d70ed86db8e0fc1a50da61f395e55a) +++++ b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/manager/HookManager.java (revision 5436229cc153c4aec4cd6267d80f1e8301022990) ++@@ -7,8 +7,8 @@ ++ public class HookManager { ++ ++ private static HookManager instance; ++- private final DiscordSRVHHook discordSRVHHook = new DiscordSRVHHook(this); ++- private final EssentialsXDiscordHook essentialsXDiscordHook = new EssentialsXDiscordHook(this); +++ private final DiscordSRVHHook discordSRVHHook = new DiscordSRVHHook(); +++ private final EssentialsXDiscordHook essentialsXDiscordHook = new EssentialsXDiscordHook(); ++ private final EssentialsXHook essentialsXHook = new EssentialsXHook(this); ++ private final LuckPermsHook luckPermsHook = new LuckPermsHook(); ++ private final SuperVanishHook superVanishHook = new SuperVanishHook(); ++Index: CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/update/UpdateChecker.java ++IDEA additional info: ++Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP ++<+>UTF-8 ++=================================================================== ++diff --git a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/update/UpdateChecker.java b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/update/UpdateChecker.java ++--- a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/update/UpdateChecker.java (revision 60d9051d52d70ed86db8e0fc1a50da61f395e55a) +++++ b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/update/UpdateChecker.java (revision 5436229cc153c4aec4cd6267d80f1e8301022990) ++@@ -22,6 +22,7 @@ ++ this.plugin = plugin; ++ } ++ +++ @SuppressWarnings("unused") ++ public void sendGithubUpdate(){ ++ getVersion("github" ,version -> { ++ if (plugin.getDescription().getVersion().equalsIgnoreCase(version)) { ++@@ -60,7 +61,6 @@ ++ break; ++ case "github": ++ url = UpdateSettings.API_UPDATE[1]; ++- ++ break; ++ default: ++ Logger.error("Invalid source for update check: " + source); ++@@ -76,7 +76,7 @@ ++ String latestRelease = scanner.next(); ++ Gson gson = new Gson(); ++ JsonObject json= gson.fromJson(latestRelease, JsonObject.class); ++- String versionName = json.get("name").getAsString(); +++ String versionName = json.get("tag_name").getAsString(); ++ ++ if(versionName.contains("Beta")){ ++ Logger.info("The latest release is a beta version: " + versionName); ++@@ -88,10 +88,7 @@ ++ }else{ ++ consumer.accept(scanner.next()); ++ } ++- ++- ++ } ++- ++ } catch (IOException e) { ++ Logger.error("Could not check for updates: &c" + e.getMessage()); ++ } ++Index: CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/utils/GroupHelper.java ++IDEA additional info: ++Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP ++<+>UTF-8 ++=================================================================== ++diff --git a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/utils/GroupHelper.java b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/utils/GroupHelper.java ++--- a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/utils/GroupHelper.java (revision 60d9051d52d70ed86db8e0fc1a50da61f395e55a) +++++ b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/utils/GroupHelper.java (revision 5436229cc153c4aec4cd6267d80f1e8301022990) ++@@ -12,8 +12,6 @@ ++ import org.bukkit.Sound; ++ import org.bukkit.configuration.file.FileConfiguration; ++ import org.bukkit.entity.Player; ++-import org.bukkit.event.player.PlayerJoinEvent; ++-import org.bukkit.event.player.PlayerQuitEvent; ++ import org.jetbrains.annotations.Contract; ++ import org.jetbrains.annotations.NotNull; ++ ++@@ -43,7 +41,7 @@ ++ this.essentialsXDiscordHook = essentialsXDiscordHook; ++ } ++ ++- public void onJoin(Player player, FileConfiguration config, PlayerJoinEvent playerJoinEvent) { +++ public void onJoin(Player player, FileConfiguration config) { ++ String temp = ""; ++ ++ String join = groupManager.getJoin(group); ++@@ -59,126 +57,97 @@ ++ ++ temp = Util.color(Util.getVar(player, temp)); ++ ++- boolean isNormalType = groupManager.getType(group).equalsIgnoreCase("normal"); ++- boolean isModifyType = groupManager.getType(group).equalsIgnoreCase("modify"); ++- ++ MessageBuilder messageBuilder = new MessageBuilder(player, temp); ++ ++ if (config.getBoolean("Config.Show-Chat-In-Console")) { ++ Logger.info(messageBuilder.getText()); ++ } ++ ++- if (isNormalType) { ++- playerJoinEvent.setJoinMessage(temp); ++- if (discordSRVHHook.isEnabled()) { ++- ++- if (Settings.hook_discordsrv_channelid.equalsIgnoreCase("none")) ++- return; ++- ++- DiscordUtil.sendMessageBlocking( ++- DiscordUtil.getTextChannelById(Settings.hook_discordsrv_channelid), ++- Util.colorless(messageBuilder.getText())); ++- } ++- ++- if (essentialsXDiscordHook.isEnabled()) { ++- if (Settings.hook_essentialsDiscord_channelid.equalsIgnoreCase("none")) ++- return; ++- ++- essentialsXDiscordHook.sendJoinMessage(Settings.hook_essentialsDiscord_channelid, ++- Util.colorless(messageBuilder.getText())); ++- } ++- } else if (isModifyType) { ++- ++- boolean isHover = groupManager.isHover(group); ++- boolean isClick = groupManager.isClick(group); ++- boolean isTitle = groupManager.isTitle(group); ++- boolean isSound = groupManager.isSound(group); ++- boolean isActionBar = groupManager.isActionbar(group); ++- boolean isSoundAll = groupManager.isSoundAll(group); +++ boolean isHover = groupManager.isHover(group); +++ boolean isClick = groupManager.isClick(group); +++ boolean isTitle = groupManager.isTitle(group); +++ boolean isSound = groupManager.isSound(group); +++ boolean isActionBar = groupManager.isActionbar(group); +++ boolean isSoundAll = groupManager.isSoundAll(group); ++ ++- List Hover_Text = groupManager.getHover(group); +++ List Hover_Text = groupManager.getHover(group); ++ ++- String isClick_Mode = groupManager.getClickMode(group); ++- String Action_Command = groupManager.getClickCommand(group); ++- String Action_Url = groupManager.getClickUrl(group); ++- String Action_Suggest = groupManager.getClickSuggestCommand(group); ++- String Title_Text = groupManager.getTitle(group); ++- String SubTitle_Text = groupManager.getSubTitle(group); ++- String Actionbar_Text = groupManager.getActionbar(group); ++- String Sound_Name = groupManager.getSound(group); +++ String isClick_Mode = groupManager.getClickMode(group); +++ String Action_Command = groupManager.getClickCommand(group); +++ String Action_Url = groupManager.getClickUrl(group); +++ String Action_Suggest = groupManager.getClickSuggestCommand(group); +++ String Title_Text = groupManager.getTitle(group); +++ String SubTitle_Text = groupManager.getSubTitle(group); +++ String Actionbar_Text = groupManager.getActionbar(group); +++ String Sound_Name = groupManager.getSound(group); ++ ++- int FadeIn = groupManager.getFadeIn(group); ++- int Stay = groupManager.getStay(group); ++- int FadeOut = groupManager.getFadeOut(group); ++- int Sound_Volume = groupManager.getVolume(group); ++- float Sound_Pitch = groupManager.getPitch(group); +++ int FadeIn = groupManager.getFadeIn(group); +++ int Stay = groupManager.getStay(group); +++ int FadeOut = groupManager.getFadeOut(group); +++ int Sound_Volume = groupManager.getVolume(group); +++ float Sound_Pitch = groupManager.getPitch(group); ++ ++- if (isHover) { ++- if (isClick) { ++- if (isClick_Mode.equalsIgnoreCase("command")) { ++- messageBuilder.setHover(Hover_Text).setExecuteCommand(Action_Command).sendToAll(); ++- } else if (isClick_Mode.equalsIgnoreCase("url")) { ++- messageBuilder.setHover(Hover_Text).setOpenURL(Action_Url).sendToAll(); ++- } else if (isClick_Mode.equalsIgnoreCase("suggest")) { ++- messageBuilder.setHover(Hover_Text).setSuggestCommand(Action_Suggest).sendToAll(); ++- } ++- } else { ++- messageBuilder.setHover(Hover_Text).sendToAll(); ++- } ++- } else { ++- if (isClick) { ++- if (isClick_Mode.equalsIgnoreCase("command")) { ++- messageBuilder.setExecuteCommand(Action_Command).sendToAll(); ++- } else if (isClick_Mode.equalsIgnoreCase("url")) { ++- messageBuilder.setOpenURL(Action_Url).sendToAll(); ++- } else if (isClick_Mode.equalsIgnoreCase("suggest")) { ++- messageBuilder.setSuggestCommand(Action_Suggest).sendToAll(); ++- } ++- } else { ++- messageBuilder.sendToAll(); ++- } ++- } +++ if (isHover) { +++ if (isClick) { +++ if (isClick_Mode.equalsIgnoreCase("command")) { +++ messageBuilder.setHover(Hover_Text).setExecuteCommand(Action_Command).sendToAll(); +++ } else if (isClick_Mode.equalsIgnoreCase("url")) { +++ messageBuilder.setHover(Hover_Text).setOpenURL(Action_Url).sendToAll(); +++ } else if (isClick_Mode.equalsIgnoreCase("suggest")) { +++ messageBuilder.setHover(Hover_Text).setSuggestCommand(Action_Suggest).sendToAll(); +++ } +++ } else { +++ messageBuilder.setHover(Hover_Text).sendToAll(); +++ } +++ } else { +++ if (isClick) { +++ if (isClick_Mode.equalsIgnoreCase("command")) { +++ messageBuilder.setExecuteCommand(Action_Command).sendToAll(); +++ } else if (isClick_Mode.equalsIgnoreCase("url")) { +++ messageBuilder.setOpenURL(Action_Url).sendToAll(); +++ } else if (isClick_Mode.equalsIgnoreCase("suggest")) { +++ messageBuilder.setSuggestCommand(Action_Suggest).sendToAll(); +++ } +++ } else { +++ messageBuilder.sendToAll(); +++ } +++ } ++ ++- if (discordSRVHHook.isEnabled()) { ++- DiscordUtil.sendMessageBlocking( ++- DiscordUtil.getTextChannelById(Settings.hook_discordsrv_channelid), ++- Util.colorless(messageBuilder.getText())); ++- } +++ if (discordSRVHHook.isEnabled()) { +++ DiscordUtil.sendMessageBlocking( +++ DiscordUtil.getTextChannelById(Settings.hook_discordSrv_channelId), +++ Util.colorless(messageBuilder.getText())); +++ } ++ ++- if (isTitle) { ++- Titles.sendTitle(player, FadeIn, Stay, FadeOut, Util.color(Util.getVar(player, Title_Text)), ++- Util.color(Util.getVar(player, SubTitle_Text))); ++- } +++ if (isTitle) { +++ Titles.sendTitle(player, FadeIn, Stay, FadeOut, Util.color(Util.getVar(player, Title_Text)), +++ Util.color(Util.getVar(player, SubTitle_Text))); +++ } ++ ++- if (isActionBar) { ++- ActionBar.sendActionBar(player, Util.color(Util.getVar(player, Actionbar_Text))); ++- } +++ if (isActionBar) { +++ ActionBar.sendActionBar(player, Util.color(Util.getVar(player, Actionbar_Text))); +++ } ++ ++- try { ++- if (isSound) { ++- if (isSoundAll) { ++- Location location = player.getLocation(); ++- player.playSound(location, Sound.valueOf(Sound_Name), Sound_Volume, Sound_Pitch); ++- } else { ++- for (Player pp : Bukkit.getOnlinePlayers()) { ++- Location location = player.getLocation(); ++- pp.playSound(location, Sound.valueOf(Sound_Name), Sound_Volume, Sound_Pitch); ++- } ++- } ++- } ++- } catch (Exception ex) { ++- Logger.warning("&eVerify that the sound name is correct or belongs to the version"); ++- } +++ try { +++ if (isSound) { +++ if (isSoundAll) { +++ Location location = player.getLocation(); +++ player.playSound(location, Sound.valueOf(Sound_Name), Sound_Volume, Sound_Pitch); +++ } else { +++ for (Player pp : Bukkit.getOnlinePlayers()) { +++ Location location = player.getLocation(); +++ pp.playSound(location, Sound.valueOf(Sound_Name), Sound_Volume, Sound_Pitch); +++ } +++ } +++ } +++ } catch (Exception ex) { +++ Logger.warning("&eVerify that the sound name is correct or belongs to the version"); ++ } ++ } ++ ++- public void onQuit(Player player, @NotNull FileConfiguration config, PlayerQuitEvent playerQuitEvent) { +++ public void onQuit(Player player, @NotNull FileConfiguration config) { ++ String quit = groupManager.getQuit(group); ++ ++- ++- boolean isNormalType = groupManager.getType(group).equalsIgnoreCase("normal"); ++- boolean isModifyType = groupManager.getType(group).equalsIgnoreCase("modify"); ++- ++ quit = Util.color(Util.getVar(player, quit)); ++ ++ MessageBuilder messageBuilder = new MessageBuilder(player, quit); ++@@ -186,102 +155,82 @@ ++ Logger.info(messageBuilder.getText()); ++ } ++ ++- if (isNormalType) { ++- playerQuitEvent.setQuitMessage(quit); ++- if (discordSRVHHook.isEnabled()) { ++- if (Settings.hook_discordsrv_channelid.equalsIgnoreCase("none")) ++- return; ++- DiscordUtil.sendMessageBlocking( ++- DiscordUtil.getTextChannelById(Settings.hook_discordsrv_channelid), ++- Util.colorless(messageBuilder.getText())); ++- } ++- ++- if (essentialsXDiscordHook.isEnabled()) { ++- if (Settings.hook_essentialsDiscord_channelid.equalsIgnoreCase("none")) ++- return; ++- essentialsXDiscordHook.sendQuitMessage(Settings.hook_essentialsDiscord_channelid, ++- Util.colorless(messageBuilder.getText())); ++- } ++- } else if (isModifyType) { ++- ++- boolean isHover = groupManager.isHover(group); ++- boolean isClick = groupManager.isClick(group); ++- boolean isSound = groupManager.isSound(group); ++- boolean isSoundAll = groupManager.isSoundAll(group); +++ boolean isHover = groupManager.isHover(group); +++ boolean isClick = groupManager.isClick(group); +++ boolean isSound = groupManager.isSound(group); +++ boolean isSoundAll = groupManager.isSoundAll(group); ++ ++- List Hover_Text = groupManager.getHover(group); +++ List Hover_Text = groupManager.getHover(group); ++ ++- String isClick_Mode = groupManager.getClickMode(group); ++- String Action_Command = groupManager.getClickCommand(group); ++- String Action_Url = groupManager.getClickUrl(group); ++- String Action_Suggest = groupManager.getClickSuggestCommand(group); ++- String Sound_Name = groupManager.getSound(group); +++ String isClick_Mode = groupManager.getClickMode(group); +++ String Action_Command = groupManager.getClickCommand(group); +++ String Action_Url = groupManager.getClickUrl(group); +++ String Action_Suggest = groupManager.getClickSuggestCommand(group); +++ String Sound_Name = groupManager.getSound(group); ++ ++- int Sound_Volume = groupManager.getVolume(group); ++- float Sound_Pitch = groupManager.getPitch(group); +++ int Sound_Volume = groupManager.getVolume(group); +++ float Sound_Pitch = groupManager.getPitch(group); ++ ++- if (isHover) { ++- if (isClick) { ++- if (isClick_Mode.equalsIgnoreCase("command")) { ++- messageBuilder.setHover(Hover_Text).setExecuteCommand(Action_Command).sendToAll(); ++- } else if (isClick_Mode.equalsIgnoreCase("url")) { ++- messageBuilder.setHover(Hover_Text).setOpenURL(Action_Url).sendToAll(); ++- } else if (isClick_Mode.equalsIgnoreCase("suggest")) { ++- messageBuilder.setHover(Hover_Text).setSuggestCommand(Action_Suggest).sendToAll(); ++- } ++- } else { ++- messageBuilder.setHover(Hover_Text).sendToAll(); ++- } ++- } else { ++- if (isClick) { ++- if (isClick_Mode.equalsIgnoreCase("command")) { ++- messageBuilder.setExecuteCommand(Action_Command).sendToAll(); ++- } else if (isClick_Mode.equalsIgnoreCase("url")) { ++- messageBuilder.setOpenURL(Action_Url).sendToAll(); ++- } else if (isClick_Mode.equalsIgnoreCase("suggest")) { ++- messageBuilder.setSuggestCommand(Action_Suggest).sendToAll(); ++- } ++- } else { ++- messageBuilder.sendToAll(); ++- } ++- } +++ if (isHover) { +++ if (isClick) { +++ if (isClick_Mode.equalsIgnoreCase("command")) { +++ messageBuilder.setHover(Hover_Text).setExecuteCommand(Action_Command).sendToAll(); +++ } else if (isClick_Mode.equalsIgnoreCase("url")) { +++ messageBuilder.setHover(Hover_Text).setOpenURL(Action_Url).sendToAll(); +++ } else if (isClick_Mode.equalsIgnoreCase("suggest")) { +++ messageBuilder.setHover(Hover_Text).setSuggestCommand(Action_Suggest).sendToAll(); +++ } +++ } else { +++ messageBuilder.setHover(Hover_Text).sendToAll(); +++ } +++ } else { +++ if (isClick) { +++ if (isClick_Mode.equalsIgnoreCase("command")) { +++ messageBuilder.setExecuteCommand(Action_Command).sendToAll(); +++ } else if (isClick_Mode.equalsIgnoreCase("url")) { +++ messageBuilder.setOpenURL(Action_Url).sendToAll(); +++ } else if (isClick_Mode.equalsIgnoreCase("suggest")) { +++ messageBuilder.setSuggestCommand(Action_Suggest).sendToAll(); +++ } +++ } else { +++ messageBuilder.sendToAll(); +++ } +++ } ++ ++- if (discordSRVHHook.isEnabled()) { +++ if (discordSRVHHook.isEnabled()) { ++ ++- if (Settings.hook_discordsrv_channelid.equalsIgnoreCase("none")) ++- return; +++ if (Settings.hook_discordSrv_channelId.equalsIgnoreCase("none")) +++ return; ++ ++- DiscordUtil.sendMessageBlocking( ++- DiscordUtil.getTextChannelById(Settings.hook_discordsrv_channelid), ++- Util.colorless(messageBuilder.getText())); ++- } +++ DiscordUtil.sendMessageBlocking( +++ DiscordUtil.getTextChannelById(Settings.hook_discordSrv_channelId), +++ Util.colorless(messageBuilder.getText())); +++ } ++ ++- if (essentialsXDiscordHook.isEnabled()) { +++ if (essentialsXDiscordHook.isEnabled()) { ++ ++- if (Settings.hook_essentialsDiscord_channelid.equalsIgnoreCase("none")) ++- return; +++ if (Settings.hook_essentialsDiscord_channelId.equalsIgnoreCase("none")) +++ return; ++ ++- essentialsXDiscordHook.sendQuitMessage(Settings.hook_essentialsDiscord_channelid, ++- Util.colorless(messageBuilder.getText())); ++- } +++ essentialsXDiscordHook.sendQuitMessage(Settings.hook_essentialsDiscord_channelId, +++ Util.colorless(messageBuilder.getText())); +++ } ++ ++- try { ++- if (isSound) { ++- if (isSoundAll) { ++- Location location = player.getLocation(); ++- player.playSound(location, Sound.valueOf(Sound_Name), Sound_Volume, Sound_Pitch); ++- } else { ++- for (Player pp : Bukkit.getOnlinePlayers()) { ++- Location location = player.getLocation(); ++- pp.playSound(location, Sound.valueOf(Sound_Name), Sound_Volume, Sound_Pitch); ++- } ++- } ++- } ++- } catch (Exception ex) { ++- Logger.warning("&eVerify that the sound name is correct or belongs to the version"); ++- } ++- } +++ try { +++ if (isSound) { +++ if (isSoundAll) { +++ Location location = player.getLocation(); +++ player.playSound(location, Sound.valueOf(Sound_Name), Sound_Volume, Sound_Pitch); +++ } else { +++ for (Player pp : Bukkit.getOnlinePlayers()) { +++ Location location = player.getLocation(); +++ pp.playSound(location, Sound.valueOf(Sound_Name), Sound_Volume, Sound_Pitch); +++ } +++ } +++ } +++ } catch (Exception ex) { +++ Logger.warning("&eVerify that the sound name is correct or belongs to the version"); +++ } +++ } ++ ++- } ++- ++ } ++Index: CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/utils/Settings.java ++IDEA additional info: ++Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP ++<+>UTF-8 ++=================================================================== ++diff --git a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/utils/Settings.java b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/utils/Settings.java ++--- a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/utils/Settings.java (revision 60d9051d52d70ed86db8e0fc1a50da61f395e55a) +++++ b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/utils/Settings.java (revision 5436229cc153c4aec4cd6267d80f1e8301022990) ++@@ -14,7 +14,6 @@ ++ public static boolean settings_debug; ++ ++ //Join section ++- public static String join_type; ++ ++ public static boolean join; ++ public static String join_message; ++@@ -25,9 +24,9 @@ ++ public static boolean join_title; ++ public static String join_message_title_title; ++ public static String join_message_title_subtitle; ++- public static int join_title_fadein; +++ public static int join_title_fadeIn; ++ public static int join_title_stay; ++- public static int join_title_fadeout; +++ public static int join_title_fadeOut; ++ ++ public static boolean join_actionbar; ++ public static String join_message_actionbar_text; ++@@ -38,33 +37,23 @@ ++ public static int join_sound_vol; ++ ++ //Quit section ++- ++- public static String quit_type; ++- ++ public static boolean quit; ++ public static String quit_message; ++ ++- public static boolean quit_sound; ++- public static String quit_sound_name; ++- public static float quit_sound_pitch; ++- public static int quit_sound_vol; ++- ++ //Welcome section ++ public static boolean welcome; ++ public static List list_welcome; ++ ++ //Hooks section ++- public static boolean hook_discordsrv; ++- public static boolean hook_discordsrv_use_message; ++- public static String hook_discordsrv_channelid; +++ public static boolean hook_discordSrv; +++ public static String hook_discordSrv_channelId; ++ ++ public static boolean hook_essentials; ++- public static boolean hook_essentials_hideplayervanish; +++ public static boolean hook_essentials_hidePlayerVanish; ++ ++ public static boolean hook_essentialsDiscord; ++ public static boolean hook_essentialsDiscord_use_default_channel; ++- public static String hook_essentialsDiscord_channelid; +++ public static String hook_essentialsDiscord_channelId; ++ public static boolean hook_luckperms; ++- public static boolean hook_luckperms_use_group; ++ public static long hook_luckperms_autoUpdate_group_tick; ++ } ++Index: CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/utils/Util.java ++IDEA additional info: ++Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP ++<+>UTF-8 ++=================================================================== ++diff --git a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/utils/Util.java b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/utils/Util.java ++--- a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/utils/Util.java (revision 60d9051d52d70ed86db8e0fc1a50da61f395e55a) +++++ b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/utils/Util.java (revision 5436229cc153c4aec4cd6267d80f1e8301022990) ++@@ -67,10 +67,8 @@ ++ return prefix; ++ } ++ ++- ++ public static @NotNull List setTabLimit(final @NotNull List options, final String lastArgs) { ++ final List returned = new ArrayList<>(); ++- ++ for (String s : options) { ++ if (s == null) { ++ continue; ++@@ -82,25 +80,11 @@ ++ return returned; ++ } ++ ++- @SuppressWarnings("unused") ++- public static void sendTextComponentHover(@NotNull Player j, String action, String message, String subMessage, String color) { ++- TextComponent msg = new TextComponent(color(message)); ++- msg.setHoverEvent(new HoverEvent(HoverEvent.Action.valueOf(getActionHoverType(action)), new ComponentBuilder(subMessage).color(ChatColor.of(color)).create())); ++- j.spigot().sendMessage(msg); ++- } ++- ++ public static void sendTextComponent116Hover(@NotNull Player j, String action, String message, String subMessage) { ++ TextComponent msg = new TextComponent(color(message)); ++ msg.setHoverEvent(new HoverEvent(HoverEvent.Action.valueOf(getActionHoverType(action)), new ComponentBuilder(color(subMessage)).create())); ++ j.spigot().sendMessage(msg); ++ } ++- ++- @SuppressWarnings("unused") ++- public static void sendTextComponentClick(@NotNull Player j, String action, String message, String arg0) { ++- TextComponent msg = new TextComponent(color(message)); ++- msg.setClickEvent(new ClickEvent(ClickEvent.Action.valueOf(getActionClickType(action)), arg0)); ++- j.spigot().sendMessage(msg); ++- } ++ ++ public static void sendAllPlayerBaseComponent(BaseComponent component) { ++ for (Player p : Bukkit.getOnlinePlayers()) { ++@@ -120,16 +104,6 @@ ++ } ++ return null; ++ } ++- ++- public static @Nullable String getActionClickType(@NotNull String arg) { ++- if (arg.equalsIgnoreCase("url")) { ++- return "OPEN_URL"; ++- } ++- if (arg.equalsIgnoreCase("cmd")) { ++- return "RUN_COMMAND"; ++- } ++- return null; ++- } ++ ++ public static @NotNull String getVar(@NotNull Player player, String text) { ++ text = text.replace("", player.getName()); ++Index: CustomJoinAndQuitMessagesOld/src/main/resources/config.yml ++IDEA additional info: ++Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP ++<+>UTF-8 ++=================================================================== ++diff --git a/CustomJoinAndQuitMessagesOld/src/main/resources/config.yml b/CustomJoinAndQuitMessagesOld/src/main/resources/config.yml ++--- a/CustomJoinAndQuitMessagesOld/src/main/resources/config.yml (revision 60d9051d52d70ed86db8e0fc1a50da61f395e55a) +++++ b/CustomJoinAndQuitMessagesOld/src/main/resources/config.yml (revision 5436229cc153c4aec4cd6267d80f1e8301022990) ++@@ -105,9 +105,6 @@ ++ # |Text| Here you can set the join message for the first time ++ Text: '&6Welcome to server &a&6 for the first time' ++ ++- # |Type| Here you can find two types that are [ normal | modify ] ++- Type: modify ++- ++ # |HoverEvent| This section allows you to modify the hover events in the chat ++ HoverEvent: ++ ++@@ -129,12 +126,6 @@ ++ # |Mode| there are three different modes which are [ command | suggest | url ] ++ Mode: command ++ ++- # This feature is not available yet ++- DevActions: ++- - '[Suggest]: /help' ++- - '[Execute]: /me hello test' ++- - '[Open]: https://www.spigotmc.org/resources/custom-join-and-quit-message-1-7-x-1-17-x.57006/' ++- ++ # |Actions| This is where are the available events that you can use ++ Actions: ++ ++@@ -205,9 +196,6 @@ ++ # |Text| This is where Quit customizable message is located ++ Text: '&b[<#:FF8E8E>-&b] <#:A157FF>' ++ ++- # |Type| Here you can find two types that are [ normal | modify ] ++- Type: normal ++- ++ # |HoverEvent| This section allows you to modify the hover events in the chat ++ HoverEvent: ++ ++@@ -280,7 +268,7 @@ ++ - '&m=========================================&r' ++ # ++ # |File-Version|I would not change anything ++-File-Version: 3 +++File-Version: 4 ++ # |> This is the end of the configuration ... [-_-] more things coming soon ++ # ++ # | Config File | ++Index: CustomJoinAndQuitMessagesOld/src/main/resources/groups.yml ++IDEA additional info: ++Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP ++<+>UTF-8 ++=================================================================== ++diff --git a/CustomJoinAndQuitMessagesOld/src/main/resources/groups.yml b/CustomJoinAndQuitMessagesOld/src/main/resources/groups.yml ++--- a/CustomJoinAndQuitMessagesOld/src/main/resources/groups.yml (revision 60d9051d52d70ed86db8e0fc1a50da61f395e55a) +++++ b/CustomJoinAndQuitMessagesOld/src/main/resources/groups.yml (revision 5436229cc153c4aec4cd6267d80f1e8301022990) ++@@ -32,9 +32,6 @@ ++ ++ # |Text| Here you can set the join message for the first time ++ Text: '&6Welcome to server &a&6 for the first time' ++- ++- # |Type| Here you can find two types that are [ normal | modify ] ++- Type: modify ++ ++ # |HoverEvent| This section allows you to modify the hover events in the chat ++ HoverEvent: ++Index: bukkit/src/main/java/jss/customjoinandquitmessage/commands/subcommands/InfoCommand.java ++IDEA additional info: ++Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP ++<+>UTF-8 ++=================================================================== ++diff --git a/bukkit/src/main/java/jss/customjoinandquitmessage/commands/subcommands/InfoCommand.java b/bukkit/src/main/java/jss/customjoinandquitmessage/commands/subcommands/InfoCommand.java ++--- a/bukkit/src/main/java/jss/customjoinandquitmessage/commands/subcommands/InfoCommand.java (revision 60d9051d52d70ed86db8e0fc1a50da61f395e55a) +++++ b/bukkit/src/main/java/jss/customjoinandquitmessage/commands/subcommands/InfoCommand.java (revision 5436229cc153c4aec4cd6267d80f1e8301022990) ++@@ -9,6 +9,11 @@ ++ return "info"; ++ } ++ +++ @Override +++ public String permission() { +++ return null; +++ } +++ ++ public void onCommand(CommandSender sender, String[] args) { ++ ++ } ++Index: patches/Removed_debugging_messages_in_the_LuckPermsHook_class_.patch ++IDEA additional info: ++Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP ++<+>UTF-8 ++=================================================================== ++diff --git a/patches/Removed_debugging_messages_in_the_LuckPermsHook_class_.patch b/patches/Removed_debugging_messages_in_the_LuckPermsHook_class_.patch ++new file mode 100644 ++--- /dev/null (revision 5436229cc153c4aec4cd6267d80f1e8301022990) +++++ b/patches/Removed_debugging_messages_in_the_LuckPermsHook_class_.patch (revision 5436229cc153c4aec4cd6267d80f1e8301022990) ++@@ -0,0 +1,29 @@ +++Index: CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/hook/LuckPermsHook.java +++IDEA additional info: +++Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +++<+>UTF-8 +++=================================================================== +++diff --git a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/hook/LuckPermsHook.java b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/hook/LuckPermsHook.java +++--- a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/hook/LuckPermsHook.java (revision 52d1e6b32c970d5470b3f06b418c1d1ef9e3aeb1) ++++++ b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/hook/LuckPermsHook.java (revision 60d9051d52d70ed86db8e0fc1a50da61f395e55a) +++@@ -25,19 +25,16 @@ +++ if (!Bukkit.getPluginManager().isPluginEnabled("LuckPerms")) { +++ Logger.warning("&eLuckPerms not enabled! - Disable Features..."); +++ this.isEnabled = false; +++- System.out.println("Cjm Softdepend: Luckperms false - check plugin installed in plugin folder"); +++ return; +++ } +++ +++ if (!Settings.hook_luckperms) { +++ this.isEnabled = false; +++- System.out.println("Cjm Softdepend: Luckperms false - Hook Enabled in config"); +++- Logger.warning("&eLuckPerms not enabled! - Disable Features..."); ++++ System.out.println("Cjm Softdepend: Luckperms false - Hook disabled in config"); +++ return; +++ } +++ +++ this.isEnabled = true; +++- System.out.println("Cjm Softdepend: Luckperms true - The plugin has successfully loaded the dependency"); +++ Util.sendColorMessage(EventUtils.getStaticConsoleSender(), Util.getPrefix(true) + "&aLoading LuckPerms features..."); +++ } +++ From 3ebdfb92a2bbde47af6d6a9c7eaa2d8195f92df5 Mon Sep 17 00:00:00 2001 From: SrJss <31166687+jonagamerpro1234@users.noreply.github.com> Date: Mon, 27 Feb 2023 14:38:39 -0300 Subject: [PATCH 19/27] Update config --- .../src/main/resources/config.yml | 2 +- ...od_getType_of_the_GroupManager_class.patch | 1780 +++++++++++++++++ 2 files changed, 1781 insertions(+), 1 deletion(-) create mode 100644 patches/Removed_method_getType_of_the_GroupManager_class.patch diff --git a/CustomJoinAndQuitMessagesOld/src/main/resources/config.yml b/CustomJoinAndQuitMessagesOld/src/main/resources/config.yml index be20eea..04eaa55 100644 --- a/CustomJoinAndQuitMessagesOld/src/main/resources/config.yml +++ b/CustomJoinAndQuitMessagesOld/src/main/resources/config.yml @@ -13,7 +13,7 @@ # Config: - # |Lang| you can use the available languages of the plugin, or you can add your own translations [ Default = en-US ] + # |Lang| you can use the available languages of the plugin, or you can add your own translations [ Default = en_US ] Lang: en_US # |Update| This function lets you know if there is a plugin update [Does not disable console messages] diff --git a/patches/Removed_method_getType_of_the_GroupManager_class.patch b/patches/Removed_method_getType_of_the_GroupManager_class.patch new file mode 100644 index 0000000..d07bbf9 --- /dev/null +++ b/patches/Removed_method_getType_of_the_GroupManager_class.patch @@ -0,0 +1,1780 @@ +Index: CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/manager/GroupManager.java +IDEA additional info: +Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +<+>UTF-8 +=================================================================== +diff --git a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/manager/GroupManager.java b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/manager/GroupManager.java +--- a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/manager/GroupManager.java (revision 6f51455f26ef7aad69f1b9446a2a31237d1f5040) ++++ b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/manager/GroupManager.java (revision e3e6f528ca2c93af4251b9955aa457aff0fd3a62) +@@ -77,11 +77,11 @@ + } + + public boolean isClick(String group) { +- boolean isclick = false; ++ boolean isClick = false; + if (existsGroup(group)) { +- isclick = config.getBoolean(group + ".ClickEvent.Enabled"); ++ isClick = config.getBoolean(group + ".ClickEvent.Enabled"); + } +- return isclick; ++ return isClick; + } + + public String getClickMode(String group) { +@@ -112,12 +112,6 @@ + return null; + } + +- public String getType(String group){ +- if (existsGroup(group)) { +- return config.getString(group + ".Type"); +- } +- return null; +- } + + public boolean isTitle(String group){ + boolean istitle = false; +Index: patches/Fixed_PlayerStorageData.patch +IDEA additional info: +Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +<+>UTF-8 +=================================================================== +diff --git a/patches/Fixed_PlayerStorageData.patch b/patches/Fixed_PlayerStorageData.patch +new file mode 100644 +--- /dev/null (revision e3e6f528ca2c93af4251b9955aa457aff0fd3a62) ++++ b/patches/Fixed_PlayerStorageData.patch (revision e3e6f528ca2c93af4251b9955aa457aff0fd3a62) +@@ -0,0 +1,1734 @@ ++Index: CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/CustomJoinAndQuitMessages.java ++IDEA additional info: ++Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP ++<+>UTF-8 ++=================================================================== ++diff --git a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/CustomJoinAndQuitMessages.java b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/CustomJoinAndQuitMessages.java ++--- a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/CustomJoinAndQuitMessages.java (revision 5436229cc153c4aec4cd6267d80f1e8301022990) +++++ b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/CustomJoinAndQuitMessages.java (revision 6f51455f26ef7aad69f1b9446a2a31237d1f5040) ++@@ -28,7 +28,6 @@ ++ ++ private static CustomJoinAndQuitMessages plugin; ++ public Metrics metrics; ++- public boolean useLatestversion; ++ private final PluginDescriptionFile jss = getDescription(); ++ public String name = this.jss.getName(); ++ public String version = this.jss.getVersion(); ++@@ -46,7 +45,7 @@ ++ Util.sendLoadTitle(version); ++ inventoryViews = new ArrayList<>(); ++ ++- Util.createFolder(this,"Players"); +++ //Util.createFolder(this,"Players"); ++ } ++ ++ public void onEnable() { ++Index: CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/listener/JoinListener.java ++IDEA additional info: ++Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP ++<+>UTF-8 ++=================================================================== ++diff --git a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/listener/JoinListener.java b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/listener/JoinListener.java ++--- a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/listener/JoinListener.java (revision 5436229cc153c4aec4cd6267d80f1e8301022990) +++++ b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/listener/JoinListener.java (revision 6f51455f26ef7aad69f1b9446a2a31237d1f5040) ++@@ -8,8 +8,6 @@ ++ import jss.customjoinandquitmessages.json.MessageBuilder; ++ import jss.customjoinandquitmessages.manager.HookManager; ++ import jss.customjoinandquitmessages.manager.PlayerManager; ++-import jss.customjoinandquitmessages.storage.PlayerData; ++-import jss.customjoinandquitmessages.storage.PlayerJsonStorage; ++ import jss.customjoinandquitmessages.update.UpdateChecker; ++ import jss.customjoinandquitmessages.utils.GroupHelper; ++ import jss.customjoinandquitmessages.utils.Logger; ++@@ -55,13 +53,6 @@ ++ tempGroup = "default"; ++ } ++ ++- PlayerJsonStorage playerJsonStorage = new PlayerJsonStorage(plugin); ++- PlayerData playerData = playerJsonStorage.loadPlayerData(p.getName()); ++- ++- if(playerData == null){ ++- playerJsonStorage.savePlayerData(new PlayerData(p.getName())); ++- } ++- ++ PlayerManager playerManager = new PlayerManager(); ++ playerManager.createPlayer(p, tempGroup); ++ ++@@ -245,7 +236,7 @@ ++ } ++ } ++ ++- @EventHandler +++ @EventHandler(priority = EventPriority.HIGH) ++ public void onQuit(@NotNull PlayerQuitEvent e) { ++ FileConfiguration config = plugin.getConfigFile().getConfig(); ++ Player p = e.getPlayer(); ++Index: patches/Removed_types_normal_and_modify_of_Join_and_Quit_and_more_.patch ++IDEA additional info: ++Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP ++<+>UTF-8 ++=================================================================== ++diff --git a/patches/Removed_types_normal_and_modify_of_Join_and_Quit_and_more_.patch b/patches/Removed_types_normal_and_modify_of_Join_and_Quit_and_more_.patch ++new file mode 100644 ++--- /dev/null (revision 6f51455f26ef7aad69f1b9446a2a31237d1f5040) +++++ b/patches/Removed_types_normal_and_modify_of_Join_and_Quit_and_more_.patch (revision 6f51455f26ef7aad69f1b9446a2a31237d1f5040) ++@@ -0,0 +1,1659 @@ +++Index: CustomJoinAndQuitMessagesOld/pom.xml +++IDEA additional info: +++Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +++<+>UTF-8 +++=================================================================== +++diff --git a/CustomJoinAndQuitMessagesOld/pom.xml b/CustomJoinAndQuitMessagesOld/pom.xml +++--- a/CustomJoinAndQuitMessagesOld/pom.xml (revision 60d9051d52d70ed86db8e0fc1a50da61f395e55a) ++++++ b/CustomJoinAndQuitMessagesOld/pom.xml (revision 5436229cc153c4aec4cd6267d80f1e8301022990) +++@@ -9,7 +9,7 @@ +++ +++ +++ CustomJoinAndQuitMessagesOld +++- 1.7.8-release ++++ 1.7.9-release +++ +++ +++ 8 +++Index: CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/commands/CustomJoinAndQuitCmd.java +++IDEA additional info: +++Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +++<+>UTF-8 +++=================================================================== +++diff --git a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/commands/CustomJoinAndQuitCmd.java b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/commands/CustomJoinAndQuitCmd.java +++--- a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/commands/CustomJoinAndQuitCmd.java (revision 60d9051d52d70ed86db8e0fc1a50da61f395e55a) ++++++ b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/commands/CustomJoinAndQuitCmd.java (revision 5436229cc153c4aec4cd6267d80f1e8301022990) +++@@ -58,7 +58,7 @@ +++ if (args.length >= 1) { +++ +++ if (args[0].equalsIgnoreCase("help")) { +++- if ((j.isOp()) || (j.hasPermission("Cjm.Help"))) { ++++ if ((j.isOp()) || (j.hasPermission("cjm.command.help"))) { +++ Util.sendColorMessage(j, "&5-=-=-=-=-=-=-=-=-=-=-=&6[&d" + plugin.name + "&6]&5=-=-=-=-=-=-=-=-=-=-=-"); +++ for (String text : plugin.Locale().help_1) { +++ Util.sendColorMessage(j, text); +++@@ -71,7 +71,7 @@ +++ } +++ +++ if (args[0].equalsIgnoreCase("reload") || args[0].equalsIgnoreCase("rl")) { +++- if ((j.isOp()) || (j.hasPermission("Cjm.Reload"))) { ++++ if ((j.isOp()) || (j.hasPermission(" cjm.command.reload"))) { +++ plugin.reloadAllFiles(); +++ Util.sendColorMessage(j, Util.getPrefix(false) + plugin.Locale().reload); +++ } else { +++Index: CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/config/utils/PreConfigLoader.java +++IDEA additional info: +++Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +++<+>UTF-8 +++=================================================================== +++diff --git a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/config/utils/PreConfigLoader.java b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/config/utils/PreConfigLoader.java +++--- a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/config/utils/PreConfigLoader.java (revision 60d9051d52d70ed86db8e0fc1a50da61f395e55a) ++++++ b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/config/utils/PreConfigLoader.java (revision 5436229cc153c4aec4cd6267d80f1e8301022990) +++@@ -32,7 +32,6 @@ +++ //Join +++ Settings.join = Objects.equals(config.getString("Join.Enabled"), "true"); +++ Settings.join_message = config.getString("Join.Text"); +++- Settings.join_type = config.getString("Join.Type"); +++ +++ Settings.firstjoin = Objects.equals(config.getString("Join.First-Join.Enabled"), "true"); +++ Settings.join_message_first = config.getString("Join.First-Join.Text"); +++@@ -43,9 +42,9 @@ +++ Settings.join_message_title_title = config.getString("Join.Title.Title"); +++ Settings.join_message_title_subtitle = config.getString("Join.Title.SubTitle"); +++ +++- Settings.join_title_fadein = config.getInt("Join.Title.FadeIn"); ++++ Settings.join_title_fadeIn = config.getInt("Join.Title.FadeIn"); +++ Settings.join_title_stay = config.getInt("Join.Title.Stay"); +++- Settings.join_title_fadeout = config.getInt("Join.Title.FadeOut"); ++++ Settings.join_title_fadeOut = config.getInt("Join.Title.FadeOut"); +++ +++ Settings.join_sound = Objects.equals(config.getString("Join.Sound.Enabled"), "true"); +++ Settings.join_sound_name = config.getString("Join.Sound.Name"); +++@@ -54,7 +53,6 @@ +++ +++ //Quit +++ Settings.quit = Objects.equals(config.getString("Quit.Enabled"), "true"); +++- Settings.quit_type = config.getString("Quit.Type"); +++ Settings.quit_message = config.getString("Quit.Text"); +++ +++ //Welcome +++@@ -62,11 +60,11 @@ +++ Settings.list_welcome = config.getStringList("Welcome.Text"); +++ +++ //Hooks +++- Settings.hook_discordsrv = Objects.equals(config.getString("Hooks.DiscordSRV.Enabled"), "true"); +++- Settings.hook_discordsrv_channelid = config.getString("Hooks.DiscordSRV.Channel-ID"); ++++ Settings.hook_discordSrv = Objects.equals(config.getString("Hooks.DiscordSRV.Enabled"), "true"); ++++ Settings.hook_discordSrv_channelId = config.getString("Hooks.DiscordSRV.Channel-ID"); +++ +++ Settings.hook_essentialsDiscord = Objects.equals(config.getString("Hooks.EssentialsDiscord.Enabled"), "true"); +++- Settings.hook_essentialsDiscord_channelid = config.getString("Hooks.EssentialsDiscord.Channel-ID"); ++++ Settings.hook_essentialsDiscord_channelId = config.getString("Hooks.EssentialsDiscord.Channel-ID"); +++ Settings.hook_essentialsDiscord_use_default_channel = config.getBoolean("Hooks.EssentialsDiscord.Use-Default-Channel"); +++ +++ Settings.hook_luckperms = config.getBoolean("Hooks.LuckPerms.Enabled"); +++@@ -74,7 +72,7 @@ +++ Settings.hook_luckperms_autoUpdate_group_tick = config.getLong("Hooks.LuckPerms.AutoUpdateGroup.Tick"); +++ +++ Settings.hook_essentials = Objects.equals(config.getString("Hooks.Essentials.Enabled"), "true"); +++- Settings.hook_essentials_hideplayervanish = config.getBoolean("Hooks.Essentials.HidePlayerIsVanish"); ++++ Settings.hook_essentials_hidePlayerVanish = config.getBoolean("Hooks.Essentials.HidePlayerIsVanish"); +++ +++ } catch (Exception e) { +++ Logger.error("&cThere was an error loading the &b[PreConfigLoader]&7, please reload the plugin"); +++Index: CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/hook/DiscordSRVHHook.java +++IDEA additional info: +++Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +++<+>UTF-8 +++=================================================================== +++diff --git a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/hook/DiscordSRVHHook.java b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/hook/DiscordSRVHHook.java +++--- a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/hook/DiscordSRVHHook.java (revision 60d9051d52d70ed86db8e0fc1a50da61f395e55a) ++++++ b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/hook/DiscordSRVHHook.java (revision 5436229cc153c4aec4cd6267d80f1e8301022990) +++@@ -1,6 +1,5 @@ +++ package jss.customjoinandquitmessages.hook; +++ +++-import jss.customjoinandquitmessages.manager.HookManager; +++ import jss.customjoinandquitmessages.utils.EventUtils; +++ import jss.customjoinandquitmessages.utils.Logger; +++ import jss.customjoinandquitmessages.utils.Settings; +++@@ -10,13 +9,8 @@ +++ +++ public class DiscordSRVHHook implements IHook { +++ +++- private HookManager hookManager; +++ private boolean isEnabled; +++ +++- public DiscordSRVHHook(HookManager hookManager) { +++- this.hookManager = hookManager; +++- } +++- +++ public void setup() { +++ if (!Bukkit.getPluginManager().isPluginEnabled("DiscordSRV")) { +++ Logger.warning("&eDiscordSRV not enabled! - Disable Features..."); +++@@ -24,7 +18,7 @@ +++ return; +++ } +++ +++- if (!Settings.hook_discordsrv) { ++++ if (!Settings.hook_discordSrv) { +++ this.isEnabled = false; +++ Logger.warning("&eDiscordSRV not enabled! - Disable Features..."); +++ return; +++@@ -38,7 +32,4 @@ +++ return isEnabled; +++ } +++ +++- public HookManager getHookManager() { +++- return hookManager; +++- } +++ } +++Index: CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/hook/EssentialsXDiscordHook.java +++IDEA additional info: +++Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +++<+>UTF-8 +++=================================================================== +++diff --git a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/hook/EssentialsXDiscordHook.java b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/hook/EssentialsXDiscordHook.java +++--- a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/hook/EssentialsXDiscordHook.java (revision 60d9051d52d70ed86db8e0fc1a50da61f395e55a) ++++++ b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/hook/EssentialsXDiscordHook.java (revision 5436229cc153c4aec4cd6267d80f1e8301022990) +++@@ -1,6 +1,5 @@ +++ package jss.customjoinandquitmessages.hook; +++ +++-import jss.customjoinandquitmessages.manager.HookManager; +++ import jss.customjoinandquitmessages.utils.EventUtils; +++ import jss.customjoinandquitmessages.utils.Logger; +++ import jss.customjoinandquitmessages.utils.Settings; +++@@ -12,14 +11,9 @@ +++ +++ public class EssentialsXDiscordHook implements IHook { +++ +++- private HookManager hookManager; +++ private boolean isEnabled; +++ private DiscordService service; +++ +++- public EssentialsXDiscordHook(HookManager hookManager) { +++- this.hookManager = hookManager; +++- } +++- +++ public void setup() { +++ if (!Bukkit.getPluginManager().isPluginEnabled("EssentialsDiscord")) { +++ Logger.warning("&eEssentialsDiscord not enabled! - Disable Features..."); +++@@ -43,27 +37,22 @@ +++ return isEnabled; +++ } +++ +++- public DiscordService getService() { +++- return service; +++- } +++- ++++ @SuppressWarnings("unused") +++ public void sendJoinMessage(String channelId, String message) { +++ if (Settings.hook_essentialsDiscord_use_default_channel) { +++ service.sendMessage(MessageType.DefaultTypes.JOIN, message, false); +++ } else { +++- service.sendMessage(new MessageType(Settings.hook_essentialsDiscord_channelid), message, false); ++++ service.sendMessage(new MessageType(Settings.hook_essentialsDiscord_channelId), message, false); +++ } +++ } +++ ++++ @SuppressWarnings("unused") +++ public void sendQuitMessage(String channelId, String message) { +++ if (Settings.hook_essentialsDiscord_use_default_channel) { +++ service.sendMessage(MessageType.DefaultTypes.LEAVE, message, false); +++ } else { +++- service.sendMessage(new MessageType(Settings.hook_essentialsDiscord_channelid), message, false); ++++ service.sendMessage(new MessageType(Settings.hook_essentialsDiscord_channelId), message, false); +++ } +++ } +++ +++- public HookManager getHookManager() { +++- return hookManager; +++- } +++ } +++Index: CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/listener/JoinListener.java +++IDEA additional info: +++Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +++<+>UTF-8 +++=================================================================== +++diff --git a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/listener/JoinListener.java b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/listener/JoinListener.java +++--- a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/listener/JoinListener.java (revision 60d9051d52d70ed86db8e0fc1a50da61f395e55a) ++++++ b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/listener/JoinListener.java (revision 5436229cc153c4aec4cd6267d80f1e8301022990) +++@@ -103,7 +103,7 @@ +++ } +++ +++ if (essentialsXHook.isEnabled()) { +++- if (Settings.hook_essentials_hideplayervanish) { ++++ if (Settings.hook_essentials_hidePlayerVanish) { +++ if (essentialsXHook.isVanish(p)) { +++ e.setJoinMessage(null); +++ return; +++@@ -115,11 +115,10 @@ +++ if (isNormal) { +++ e.setJoinMessage(null); +++ ++++ String text; +++ String join = Settings.join_message; +++ String firstjoin = Settings.join_message_first; +++ +++- String text; +++- +++ if (Settings.firstjoin) { +++ if (!p.hasPlayedBefore()) { +++ text = firstjoin; +++@@ -130,161 +129,106 @@ +++ text = join; +++ } +++ +++- boolean isNormalType = Settings.join_type.equalsIgnoreCase("normal"); +++- boolean isModifyType = Settings.join_type.equalsIgnoreCase("modify"); +++- +++ text = Util.color(Util.getVar(p, text)); +++- +++ MessageBuilder messageBuilder = new MessageBuilder(p, text); +++ +++- //Update Logger +++ if (config.getBoolean("Config.Show-Chat-In-Console")) { +++ Logger.info(messageBuilder.getText()); +++ } +++ +++- if (isNormalType) { +++- e.setJoinMessage(text); +++- if (discordSRVHHook.isEnabled()) { +++- +++- if (Settings.hook_discordsrv_channelid.equalsIgnoreCase("none")) +++- return; +++- +++- DiscordUtil.sendMessageBlocking( +++- DiscordUtil.getTextChannelById(Settings.hook_discordsrv_channelid), +++- Util.colorless(messageBuilder.getText())); +++- } +++- +++- if (essentialsXDiscordHook.isEnabled()) { +++- if (Settings.hook_essentialsDiscord_channelid.equalsIgnoreCase("none")) +++- return; +++- +++- essentialsXDiscordHook.sendJoinMessage(Settings.hook_essentialsDiscord_channelid, +++- Util.colorless(messageBuilder.getText())); +++- } +++- +++- //Removed IsModifyType in 1.8.0 +++- } else if (isModifyType) { +++- boolean isHover = Objects.equals(config.getString("Join.HoverEvent.Enabled"), "true"); +++- boolean isClick = Objects.equals(config.getString("Join.ClickEvent.Enabled"), "true"); +++- boolean isTitle = Objects.equals(config.getString("Join.Title.Enabled"), "true"); +++- boolean isSound = Objects.equals(config.getString("Join.Sound.Enabled"), "true"); +++- boolean isActionBar = Objects.equals(config.getString("Join.ActionBar.Enabled"), "true"); +++- boolean isSoundAll = Objects.equals(config.getString("Join.Sound.Send-To-All"), "true"); ++++ boolean isHover = config.getBoolean("Join.HoverEvent.Enabled"); ++++ boolean isClick = config.getBoolean("Join.ClickEvent.Enabled"); ++++ boolean isTitle = config.getBoolean("Join.Title.Enabled"); ++++ boolean isSound = config.getBoolean("Join.Sound.Enabled"); ++++ boolean isActionBar = config.getBoolean("Join.ActionBar.Enabled"); ++++ boolean isSoundAll = config.getBoolean("Join.Sound.Send-To-All"); +++ +++- List Hover_Text = config.getStringList("Join.HoverEvent.Hover"); ++++ List Hover_Text = config.getStringList("Join.HoverEvent.Hover"); +++ +++- String isClick_Mode = config.getString("Join.ClickEvent.Mode"); +++- String Action_Command = config.getString("Join.ClickEvent.Actions.Command"); +++- String Action_Url = config.getString("Join.ClickEvent.Actions.Url"); +++- String Action_Suggest = config.getString("Join.ClickEvent.Actions.Suggest-Command"); +++- +++- //List Action_Dev = config.getStringList("Join.ClickEvent.DevActions"); +++- +++- String Title_Text = config.getString("Join.Title.Title"); +++- String SubTitle_Text = config.getString("Join.Title.SubTitle"); +++- String Actionbar_Text = config.getString("Join.ActionBar.Text"); +++- String Sound_Name = config.getString("Join.Sound.Name"); ++++ String isClick_Mode = config.getString("Join.ClickEvent.Mode"); ++++ String Action_Command = config.getString("Join.ClickEvent.Actions.Command"); ++++ String Action_Url = config.getString("Join.ClickEvent.Actions.Url"); ++++ String Action_Suggest = config.getString("Join.ClickEvent.Actions.Suggest-Command"); ++++ String Title_Text = config.getString("Join.Title.Title"); ++++ String SubTitle_Text = config.getString("Join.Title.SubTitle"); ++++ String Actionbar_Text = config.getString("Join.ActionBar.Text"); ++++ String Sound_Name = config.getString("Join.Sound.Name"); +++ +++- int FadeIn = config.getInt("Join.Title.FadeIn"); +++- int Stay = config.getInt("Join.Title.Stay"); +++- int FadeOut = config.getInt("Join.Title.FadeOut"); +++- int Sound_Volume = config.getInt("Join.Sound.Volume"); ++++ int FadeIn = config.getInt("Join.Title.FadeIn"); ++++ int Stay = config.getInt("Join.Title.Stay"); ++++ int FadeOut = config.getInt("Join.Title.FadeOut"); ++++ int Sound_Volume = config.getInt("Join.Sound.Volume"); +++ +++- float Sound_Pitch = Float.parseFloat(Objects.requireNonNull(config.getString("Join.Sound.Pitch"))); ++++ float Sound_Pitch = Float.parseFloat(Objects.requireNonNull(config.getString("Join.Sound.Pitch"))); +++ +++- if (isHover) { +++- if (isClick) { +++- assert isClick_Mode != null; +++- if (isClick_Mode.equalsIgnoreCase("command")) { +++- messageBuilder.setHover(Hover_Text).setExecuteCommand(Action_Command).sendToAll(); +++- } else if (isClick_Mode.equalsIgnoreCase("url")) { +++- messageBuilder.setHover(Hover_Text).setOpenURL(Action_Url).sendToAll(); +++- } else if (isClick_Mode.equalsIgnoreCase("suggest")) { +++- messageBuilder.setHover(Hover_Text).setSuggestCommand(Action_Suggest).sendToAll(); +++- } +++- } else { +++- messageBuilder.setHover(Hover_Text).sendToAll(); +++- } +++- } else { ++++ if (isHover) { ++++ if (isClick) { ++++ assert isClick_Mode != null; ++++ if (isClick_Mode.equalsIgnoreCase("command")) { ++++ messageBuilder.setHover(Hover_Text).setExecuteCommand(Action_Command).sendToAll(); ++++ } else if (isClick_Mode.equalsIgnoreCase("url")) { ++++ messageBuilder.setHover(Hover_Text).setOpenURL(Action_Url).sendToAll(); ++++ } else if (isClick_Mode.equalsIgnoreCase("suggest")) { ++++ messageBuilder.setHover(Hover_Text).setSuggestCommand(Action_Suggest).sendToAll(); ++++ } ++++ } else { ++++ messageBuilder.setHover(Hover_Text).sendToAll(); ++++ } ++++ } else { +++ +++- if (isClick) { +++- +++- /*for(String action : Action_Dev){ +++- +++- String[] parts = action.split(":"); +++- String type = parts[0].trim(); +++- String value = parts[1].trim(); +++- +++- switch (type){ +++- case "[Execute]": +++- messageBuilder.setExecuteCommand(value); +++- break; +++- case "[Suggest]": +++- messageBuilder.setSuggestCommand(value); +++- break; +++- case "[Open]": +++- messageBuilder.setOpenURL(value); +++- break; +++- default: +++- messageBuilder.sendToAll(); +++- break; +++- } +++- } +++- messageBuilder.sendToAll();*/ +++- +++- assert isClick_Mode != null; +++- if (isClick_Mode.equalsIgnoreCase("command")) { +++- messageBuilder.setExecuteCommand(Action_Command).sendToAll(); +++- } else if (isClick_Mode.equalsIgnoreCase("url")) { +++- messageBuilder.setOpenURL(Action_Url).sendToAll(); +++- } else if (isClick_Mode.equalsIgnoreCase("suggest")) { +++- messageBuilder.setSuggestCommand(Action_Suggest).sendToAll(); +++- } +++- +++- +++- } else { +++- messageBuilder.sendToAll(); +++- } +++- } ++++ if (isClick) { ++++ assert isClick_Mode != null; ++++ if (isClick_Mode.equalsIgnoreCase("command")) { ++++ messageBuilder.setExecuteCommand(Action_Command).sendToAll(); ++++ } else if (isClick_Mode.equalsIgnoreCase("url")) { ++++ messageBuilder.setOpenURL(Action_Url).sendToAll(); ++++ } else if (isClick_Mode.equalsIgnoreCase("suggest")) { ++++ messageBuilder.setSuggestCommand(Action_Suggest).sendToAll(); ++++ } ++++ } else { ++++ messageBuilder.sendToAll(); ++++ } ++++ } +++ +++- if (discordSRVHHook.isEnabled()) { +++- DiscordUtil.sendMessageBlocking( +++- DiscordUtil.getTextChannelById(Settings.hook_discordsrv_channelid), +++- Util.colorless(messageBuilder.getText())); +++- } ++++ if (discordSRVHHook.isEnabled()) { ++++ DiscordUtil.sendMessageBlocking( ++++ DiscordUtil.getTextChannelById(Settings.hook_discordSrv_channelId), ++++ Util.colorless(messageBuilder.getText())); ++++ } +++ +++- if (isTitle) { +++- Titles.sendTitle(p, FadeIn, Stay, FadeOut, Util.color(Util.getVar(p, Title_Text)), +++- Util.color(Util.getVar(p, SubTitle_Text))); +++- } ++++ if (isTitle) { ++++ Titles.sendTitle(p, FadeIn, Stay, FadeOut, Util.color(Util.getVar(p, Title_Text)), ++++ Util.color(Util.getVar(p, SubTitle_Text))); ++++ } +++ +++- if (isActionBar) { +++- ActionBar.sendActionBar(p, Util.color(Util.getVar(p, Actionbar_Text))); +++- } ++++ if (isActionBar) { ++++ ActionBar.sendActionBar(p, Util.color(Util.getVar(p, Actionbar_Text))); ++++ } +++ +++- try { +++- if (isSound) { +++- if (isSoundAll) { +++- Location location = p.getLocation(); +++- p.playSound(location, Sound.valueOf(Sound_Name), Sound_Volume, Sound_Pitch); +++- } else { +++- for (Player pp : Bukkit.getOnlinePlayers()) { +++- Location location = p.getLocation(); +++- pp.playSound(location, Sound.valueOf(Sound_Name), Sound_Volume, Sound_Pitch); +++- } +++- } +++- } +++- } catch (Exception ex) { +++- Logger.warning("&eVerify that the sound name is correct or belongs to the version"); +++- } ++++ try { ++++ if (isSound) { ++++ if (isSoundAll) { ++++ Location location = p.getLocation(); ++++ p.playSound(location, Sound.valueOf(Sound_Name), Sound_Volume, Sound_Pitch); ++++ } else { ++++ for (Player pp : Bukkit.getOnlinePlayers()) { ++++ Location location = p.getLocation(); ++++ pp.playSound(location, Sound.valueOf(Sound_Name), Sound_Volume, Sound_Pitch); ++++ } ++++ } ++++ } ++++ } catch (Exception ex) { ++++ Logger.warning("&eVerify that the sound name is correct or belongs to the version"); +++ } ++++ ++++ +++ } else if (isGroup) { +++ e.setJoinMessage(null); +++ GroupHelper groupHelper = new GroupHelper(); +++ groupHelper.setGroup(playerManager.getGroup(p)); +++ groupHelper.setDiscord(discordSRVHHook); +++ groupHelper.setEssentials(essentialsXDiscordHook); +++- groupHelper.onJoin(p, config, e); ++++ groupHelper.onJoin(p, config); +++ } else if (isNone) { +++ e.setJoinMessage(null); +++ } +++@@ -295,7 +239,7 @@ +++ public void onUpdate(@NotNull PlayerJoinEvent e) { +++ Player p = e.getPlayer(); +++ if (Settings.update) { +++- if ((p.isOp()) || (p.hasPermission("Cjm.Update.Notify"))) { ++++ if ((p.isOp()) || (p.hasPermission("cjm.update"))) { +++ new UpdateChecker(CustomJoinAndQuitMessages.get()).sendSpigotUpdate(); +++ } +++ } +++@@ -329,7 +273,7 @@ +++ } +++ +++ if (essentialsXHook.isEnabled()) { +++- if (Settings.hook_essentials_hideplayervanish) { ++++ if (Settings.hook_essentials_hidePlayerVanish) { +++ if (essentialsXHook.isVanish(p)) { +++ e.setQuitMessage(null); +++ return; +++@@ -341,9 +285,6 @@ +++ if (isNormal) { +++ e.setQuitMessage(null); +++ +++- boolean isNormalType = Objects.requireNonNull(config.getString("Quit.Type")).equalsIgnoreCase("normal"); +++- boolean isModifyType = Objects.requireNonNull(config.getString("Quit.Type")).equalsIgnoreCase("modify"); +++- +++ String text = config.getString("Quit.Text"); +++ +++ text = Util.color(text); +++@@ -355,102 +296,81 @@ +++ Logger.info(messageBuilder.getText()); +++ } +++ +++- if (isNormalType) { +++- e.setQuitMessage(text); +++- if (discordSRVHHook.isEnabled()) { +++- if (Settings.hook_discordsrv_channelid.equalsIgnoreCase("none")) +++- return; +++- DiscordUtil.sendMessageBlocking( +++- DiscordUtil.getTextChannelById(Settings.hook_discordsrv_channelid), +++- Util.colorless(messageBuilder.getText())); +++- } +++- +++- if (essentialsXDiscordHook.isEnabled()) { +++- if (Settings.hook_essentialsDiscord_channelid.equalsIgnoreCase("none")) +++- return; +++- essentialsXDiscordHook.sendQuitMessage(Settings.hook_essentialsDiscord_channelid, +++- Util.colorless(messageBuilder.getText())); +++- } +++- } else if (isModifyType) { +++- +++- boolean isHover = Objects.equals(config.getString("Quit.HoverEvent.Enabled"), "true"); +++- boolean isClick = Objects.equals(config.getString("Quit.ClickEvent.Enabled"), "true"); +++- boolean isSound = Objects.equals(config.getString("Quit.Sound.Enabled"), "true"); +++- boolean isSoundAll = Objects.equals(config.getString("Quit.Sound.Send-To-All"), "true"); ++++ boolean isHover = config.getBoolean("Quit.HoverEvent.Enabled"); ++++ boolean isClick = config.getBoolean("Quit.ClickEvent.Enabled"); ++++ boolean isSound = config.getBoolean("Quit.Sound.Enabled"); ++++ boolean isSoundAll = config.getBoolean("Quit.Sound.Send-To-All"); +++ +++- List Hover_Text = config.getStringList("Quit.HoverEvent.Hover"); ++++ List Hover_Text = config.getStringList("Quit.HoverEvent.Hover"); +++ +++- String isClick_Mode = config.getString("Quit.ClickEvent.Mode"); +++- String Action_Command = config.getString("Quit.ClickEvent.Actions.Command"); +++- String Action_Url = config.getString("Quit.ClickEvent.Actions.Url"); +++- String Action_Suggest = config.getString("Quit.ClickEvent.Actions.Suggest-Command"); +++- String Sound_Name = config.getString("Quit.Sound.Name"); ++++ String isClick_Mode = config.getString("Quit.ClickEvent.Mode"); ++++ String Action_Command = config.getString("Quit.ClickEvent.Actions.Command"); ++++ String Action_Url = config.getString("Quit.ClickEvent.Actions.Url"); ++++ String Action_Suggest = config.getString("Quit.ClickEvent.Actions.Suggest-Command"); ++++ String Sound_Name = config.getString("Quit.Sound.Name"); +++ +++- int Sound_Volume = config.getInt("Quit.Sound.Volume"); +++- float Sound_Pitch = Float.parseFloat(Objects.requireNonNull(config.getString("Quit.Sound.Pitch"))); ++++ int Sound_Volume = config.getInt("Quit.Sound.Volume"); ++++ float Sound_Pitch = Float.parseFloat(Objects.requireNonNull(config.getString("Quit.Sound.Pitch"))); +++ +++- if (isHover) { +++- if (isClick) { +++- assert isClick_Mode != null; +++- if (isClick_Mode.equalsIgnoreCase("command")) { +++- messageBuilder.setHover(Hover_Text).setExecuteCommand(Action_Command).sendToAll(); +++- } else if (isClick_Mode.equalsIgnoreCase("url")) { +++- messageBuilder.setHover(Hover_Text).setOpenURL(Action_Url).sendToAll(); +++- } else if (isClick_Mode.equalsIgnoreCase("suggest")) { +++- messageBuilder.setHover(Hover_Text).setSuggestCommand(Action_Suggest).sendToAll(); +++- } +++- } else { +++- messageBuilder.setHover(Hover_Text).sendToAll(); +++- } +++- } else { +++- if (isClick) { +++- assert isClick_Mode != null; +++- if (isClick_Mode.equalsIgnoreCase("command")) { +++- messageBuilder.setExecuteCommand(Action_Command).sendToAll(); +++- } else if (isClick_Mode.equalsIgnoreCase("url")) { +++- messageBuilder.setOpenURL(Action_Url).sendToAll(); +++- } else if (isClick_Mode.equalsIgnoreCase("suggest")) { +++- messageBuilder.setSuggestCommand(Action_Suggest).sendToAll(); +++- } +++- } else { +++- messageBuilder.sendToAll(); +++- } +++- } ++++ if (isHover) { ++++ if (isClick) { ++++ assert isClick_Mode != null; ++++ if (isClick_Mode.equalsIgnoreCase("command")) { ++++ messageBuilder.setHover(Hover_Text).setExecuteCommand(Action_Command).sendToAll(); ++++ } else if (isClick_Mode.equalsIgnoreCase("url")) { ++++ messageBuilder.setHover(Hover_Text).setOpenURL(Action_Url).sendToAll(); ++++ } else if (isClick_Mode.equalsIgnoreCase("suggest")) { ++++ messageBuilder.setHover(Hover_Text).setSuggestCommand(Action_Suggest).sendToAll(); ++++ } ++++ } else { ++++ messageBuilder.setHover(Hover_Text).sendToAll(); ++++ } ++++ } else { ++++ if (isClick) { ++++ assert isClick_Mode != null; ++++ if (isClick_Mode.equalsIgnoreCase("command")) { ++++ messageBuilder.setExecuteCommand(Action_Command).sendToAll(); ++++ } else if (isClick_Mode.equalsIgnoreCase("url")) { ++++ messageBuilder.setOpenURL(Action_Url).sendToAll(); ++++ } else if (isClick_Mode.equalsIgnoreCase("suggest")) { ++++ messageBuilder.setSuggestCommand(Action_Suggest).sendToAll(); ++++ } ++++ } else { ++++ messageBuilder.sendToAll(); ++++ } ++++ } +++ +++- if (discordSRVHHook.isEnabled()) { +++- +++- if (Settings.hook_discordsrv_channelid.equalsIgnoreCase("none")) +++- return; ++++ if (discordSRVHHook.isEnabled()) { ++++ if (Settings.hook_discordSrv_channelId.equalsIgnoreCase("none")) ++++ return; +++ +++- DiscordUtil.sendMessageBlocking( +++- DiscordUtil.getTextChannelById(Settings.hook_discordsrv_channelid), +++- Util.colorless(messageBuilder.getText())); +++- } ++++ DiscordUtil.sendMessageBlocking( ++++ DiscordUtil.getTextChannelById(Settings.hook_discordSrv_channelId), ++++ Util.colorless(messageBuilder.getText())); ++++ } +++ +++- if (essentialsXDiscordHook.isEnabled()) { +++- +++- if (Settings.hook_essentialsDiscord_channelid.equalsIgnoreCase("none")) +++- return; ++++ if (essentialsXDiscordHook.isEnabled()) { ++++ if (Settings.hook_essentialsDiscord_channelId.equalsIgnoreCase("none")) ++++ return; +++ +++- essentialsXDiscordHook.sendQuitMessage(Settings.hook_essentialsDiscord_channelid, +++- Util.colorless(messageBuilder.getText())); +++- } ++++ essentialsXDiscordHook.sendQuitMessage(Settings.hook_essentialsDiscord_channelId, ++++ Util.colorless(messageBuilder.getText())); ++++ } +++ +++- try { +++- if (isSound) { +++- if (isSoundAll) { +++- Location location = p.getLocation(); +++- p.playSound(location, Sound.valueOf(Sound_Name), Sound_Volume, Sound_Pitch); +++- } else { +++- for (Player pp : Bukkit.getOnlinePlayers()) { +++- Location location = p.getLocation(); +++- pp.playSound(location, Sound.valueOf(Sound_Name), Sound_Volume, Sound_Pitch); +++- } +++- } +++- } +++- } catch (Exception ex) { +++- Logger.warning("&eVerify that the sound name is correct or belongs to the version"); +++- } ++++ try { ++++ if (isSound) { ++++ if (isSoundAll) { ++++ Location location = p.getLocation(); ++++ p.playSound(location, Sound.valueOf(Sound_Name), Sound_Volume, Sound_Pitch); ++++ } else { ++++ for (Player pp : Bukkit.getOnlinePlayers()) { ++++ Location location = p.getLocation(); ++++ pp.playSound(location, Sound.valueOf(Sound_Name), Sound_Volume, Sound_Pitch); ++++ } ++++ } ++++ } ++++ } catch (Exception ex) { ++++ Logger.warning("&eVerify that the sound name is correct or belongs to the version"); +++ } +++ } else if (isGroup) { +++ e.setQuitMessage(null); +++@@ -458,13 +378,11 @@ +++ groupHelper.setGroup(playerManager.getGroup(p)); +++ groupHelper.setDiscord(discordSRVHHook); +++ groupHelper.setEssentials(essentialsXDiscordHook); +++- groupHelper.onQuit(p, config, e); ++++ groupHelper.onQuit(p, config); +++ } else if (isNone) { +++ e.setQuitMessage(null); +++ } +++ } +++ } +++ +++- +++- +++ } +++Index: CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/manager/DisplayManager.java +++IDEA additional info: +++Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +++<+>UTF-8 +++=================================================================== +++diff --git a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/manager/DisplayManager.java b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/manager/DisplayManager.java +++--- a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/manager/DisplayManager.java (revision 60d9051d52d70ed86db8e0fc1a50da61f395e55a) ++++++ b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/manager/DisplayManager.java (revision 5436229cc153c4aec4cd6267d80f1e8301022990) +++@@ -12,6 +12,7 @@ +++ +++ import java.util.List; +++ ++++@SuppressWarnings("all") +++ public class DisplayManager { +++ +++ private final FileConfiguration config = CustomJoinAndQuitMessages.get().getConfigFile().getConfig(); +++@@ -41,8 +42,6 @@ +++ Logger.warning("&e[showFirstJoinMessage] &b-> &7This feature is disabled and you will not be able to see the preview"); +++ +++ String text; +++- boolean isNormalType; +++- boolean isModifyType; +++ boolean isHover; +++ boolean isClick; +++ List Hover_Text; +++@@ -53,8 +52,6 @@ +++ +++ if (Settings.is_Group_Display) { +++ text = groups.getString(group + ".FirstJoin.Text"); +++- isNormalType = groups.getString(group + ".Type").equalsIgnoreCase("normal"); +++- isModifyType = groups.getString(group + ".Type").equalsIgnoreCase("modify"); +++ isHover = groups.getString(group + ".HoverEvent.Enabled").equals("true"); +++ isClick = groups.getString(group + ".ClickEvent.Enabled").equals("true"); +++ Hover_Text = groups.getStringList(group + ".HoverEvent.Hover"); +++@@ -64,8 +61,6 @@ +++ Action_Suggest = groups.getString(group + ".ClickEvent.Actions.Suggest-Command"); +++ } else { +++ text = Settings.join_message_first; +++- isNormalType = Settings.join_type.equalsIgnoreCase("normal"); +++- isModifyType = Settings.join_type.equalsIgnoreCase("modify"); +++ +++ isHover = config.getString("Join.HoverEvent.Enabled").equals("true"); +++ isClick = config.getString("Join.ClickEvent.Enabled").equals("true"); +++@@ -78,34 +73,29 @@ +++ +++ MessageBuilder messageBuilder = new MessageBuilder(player, Util.color(Util.getVar(player, text))); +++ +++- if (isNormalType) { +++- messageBuilder.send(); +++- return; +++- } else if (isModifyType) { +++- if (isHover) { +++- if (isClick) { +++- if (isClick_Mode.equalsIgnoreCase("command")) { +++- messageBuilder.setHover(Hover_Text).setExecuteCommand(Action_Command).send(); +++- } else if (isClick_Mode.equalsIgnoreCase("url")) { +++- messageBuilder.setHover(Hover_Text).setOpenURL(Action_Url).send(); +++- } else if (isClick_Mode.equalsIgnoreCase("suggest")) { +++- messageBuilder.setHover(Hover_Text).setSuggestCommand(Action_Suggest).send(); +++- } +++- } else { +++- messageBuilder.setHover(Hover_Text).send(); +++- } +++- } else { +++- if (isClick) { +++- if (isClick_Mode.equalsIgnoreCase("command")) { +++- messageBuilder.setExecuteCommand(Action_Command).send(); +++- } else if (isClick_Mode.equalsIgnoreCase("url")) { +++- messageBuilder.setOpenURL(Action_Url).send(); +++- } else if (isClick_Mode.equalsIgnoreCase("suggest")) { +++- messageBuilder.setSuggestCommand(Action_Suggest).send(); +++- } +++- } else { +++- messageBuilder.send(); +++- } ++++ if (isHover) { ++++ if (isClick) { ++++ if (isClick_Mode.equalsIgnoreCase("command")) { ++++ messageBuilder.setHover(Hover_Text).setExecuteCommand(Action_Command).send(); ++++ } else if (isClick_Mode.equalsIgnoreCase("url")) { ++++ messageBuilder.setHover(Hover_Text).setOpenURL(Action_Url).send(); ++++ } else if (isClick_Mode.equalsIgnoreCase("suggest")) { ++++ messageBuilder.setHover(Hover_Text).setSuggestCommand(Action_Suggest).send(); ++++ } ++++ } else { ++++ messageBuilder.setHover(Hover_Text).send(); ++++ } ++++ } else { ++++ if (isClick) { ++++ if (isClick_Mode.equalsIgnoreCase("command")) { ++++ messageBuilder.setExecuteCommand(Action_Command).send(); ++++ } else if (isClick_Mode.equalsIgnoreCase("url")) { ++++ messageBuilder.setOpenURL(Action_Url).send(); ++++ } else if (isClick_Mode.equalsIgnoreCase("suggest")) { ++++ messageBuilder.setSuggestCommand(Action_Suggest).send(); ++++ } ++++ } else { ++++ messageBuilder.send(); +++ } +++ } +++ } +++@@ -127,8 +117,6 @@ +++ +++ if (Settings.is_Group_Display) { +++ text = groups.getString(group + ".Join-Text"); +++- isNormalType = groups.getString(group + ".Type").equalsIgnoreCase("normal"); +++- isModifyType = groups.getString(group + ".Type").equalsIgnoreCase("modify"); +++ +++ isHover = groups.getString(group + ".HoverEvent.Enabled").equals("true"); +++ isClick = groups.getString(group + ".ClickEvent.Enabled").equals("true"); +++@@ -141,8 +129,6 @@ +++ Action_Suggest = groups.getString(group + ".ClickEvent.Actions.Suggest-Command"); +++ } else { +++ text = Settings.join_message; +++- isNormalType = Settings.join_type.equalsIgnoreCase("normal"); +++- isModifyType = Settings.join_type.equalsIgnoreCase("modify"); +++ +++ isHover = config.getString("Join.HoverEvent.Enabled").equals("true"); +++ isClick = config.getString("Join.ClickEvent.Enabled").equals("true"); +++@@ -157,34 +143,29 @@ +++ +++ MessageBuilder messageBuilder = new MessageBuilder(player, Util.color(Util.getVar(player, text))); +++ +++- if (isNormalType) { +++- messageBuilder.send(); +++- return; +++- } else if (isModifyType) { +++- if (isHover) { +++- if (isClick) { +++- if (isClick_Mode.equalsIgnoreCase("command")) { +++- messageBuilder.setHover(Hover_Text).setExecuteCommand(Action_Command).send(); +++- } else if (isClick_Mode.equalsIgnoreCase("url")) { +++- messageBuilder.setHover(Hover_Text).setOpenURL(Action_Url).send(); +++- } else if (isClick_Mode.equalsIgnoreCase("suggest")) { +++- messageBuilder.setHover(Hover_Text).setSuggestCommand(Action_Suggest).send(); +++- } +++- } else { +++- messageBuilder.setHover(Hover_Text).send(); +++- } +++- } else { +++- if (isClick) { +++- if (isClick_Mode.equalsIgnoreCase("command")) { +++- messageBuilder.setExecuteCommand(Action_Command).send(); +++- } else if (isClick_Mode.equalsIgnoreCase("url")) { +++- messageBuilder.setOpenURL(Action_Url).send(); +++- } else if (isClick_Mode.equalsIgnoreCase("suggest")) { +++- messageBuilder.setSuggestCommand(Action_Suggest).send(); +++- } +++- } else { +++- messageBuilder.send(); +++- } ++++ if (isHover) { ++++ if (isClick) { ++++ if (isClick_Mode.equalsIgnoreCase("command")) { ++++ messageBuilder.setHover(Hover_Text).setExecuteCommand(Action_Command).send(); ++++ } else if (isClick_Mode.equalsIgnoreCase("url")) { ++++ messageBuilder.setHover(Hover_Text).setOpenURL(Action_Url).send(); ++++ } else if (isClick_Mode.equalsIgnoreCase("suggest")) { ++++ messageBuilder.setHover(Hover_Text).setSuggestCommand(Action_Suggest).send(); ++++ } ++++ } else { ++++ messageBuilder.setHover(Hover_Text).send(); ++++ } ++++ } else { ++++ if (isClick) { ++++ if (isClick_Mode.equalsIgnoreCase("command")) { ++++ messageBuilder.setExecuteCommand(Action_Command).send(); ++++ } else if (isClick_Mode.equalsIgnoreCase("url")) { ++++ messageBuilder.setOpenURL(Action_Url).send(); ++++ } else if (isClick_Mode.equalsIgnoreCase("suggest")) { ++++ messageBuilder.setSuggestCommand(Action_Suggest).send(); ++++ } ++++ } else { ++++ messageBuilder.send(); +++ } +++ } +++ } +++@@ -220,8 +201,6 @@ +++ Action_Suggest = groups.getString(group + ".ClickEvent.Actions.Suggest-Command"); +++ } else { +++ text = Settings.quit_message; +++- isNormalType = Settings.quit_type.equalsIgnoreCase("normal"); +++- isModifyType = Settings.quit_type.equalsIgnoreCase("modify"); +++ +++ isHover = config.getString("Quit.HoverEvent.Enabled").equals("true"); +++ isClick = config.getString("Quit.ClickEvent.Enabled").equals("true"); +++@@ -236,36 +215,32 @@ +++ +++ MessageBuilder messageBuilder = new MessageBuilder(player, Util.color(Util.getVar(player, text))); +++ +++- if (isNormalType) { +++- messageBuilder.send(); +++- return; +++- } else if (isModifyType) { +++- if (isHover) { +++- if (isClick) { +++- if (isClick_Mode.equalsIgnoreCase("command")) { +++- messageBuilder.setHover(Hover_Text).setExecuteCommand(Action_Command).send(); +++- } else if (isClick_Mode.equalsIgnoreCase("url")) { +++- messageBuilder.setHover(Hover_Text).setOpenURL(Action_Url).send(); +++- } else if (isClick_Mode.equalsIgnoreCase("suggest")) { +++- messageBuilder.setHover(Hover_Text).setSuggestCommand(Action_Suggest).send(); +++- } +++- } else { +++- messageBuilder.setHover(Hover_Text).send(); +++- } +++- } else { +++- if (isClick) { +++- if (isClick_Mode.equalsIgnoreCase("command")) { +++- messageBuilder.setExecuteCommand(Action_Command).send(); +++- } else if (isClick_Mode.equalsIgnoreCase("url")) { +++- messageBuilder.setOpenURL(Action_Url).send(); +++- } else if (isClick_Mode.equalsIgnoreCase("suggest")) { +++- messageBuilder.setSuggestCommand(Action_Suggest).send(); +++- } +++- } else { +++- messageBuilder.send(); +++- } ++++ if (isHover) { ++++ if (isClick) { ++++ if (isClick_Mode.equalsIgnoreCase("command")) { ++++ messageBuilder.setHover(Hover_Text).setExecuteCommand(Action_Command).send(); ++++ } else if (isClick_Mode.equalsIgnoreCase("url")) { ++++ messageBuilder.setHover(Hover_Text).setOpenURL(Action_Url).send(); ++++ } else if (isClick_Mode.equalsIgnoreCase("suggest")) { ++++ messageBuilder.setHover(Hover_Text).setSuggestCommand(Action_Suggest).send(); ++++ } ++++ } else { ++++ messageBuilder.setHover(Hover_Text).send(); ++++ } ++++ } else { ++++ if (isClick) { ++++ if (isClick_Mode.equalsIgnoreCase("command")) { ++++ messageBuilder.setExecuteCommand(Action_Command).send(); ++++ } else if (isClick_Mode.equalsIgnoreCase("url")) { ++++ messageBuilder.setOpenURL(Action_Url).send(); ++++ } else if (isClick_Mode.equalsIgnoreCase("suggest")) { ++++ messageBuilder.setSuggestCommand(Action_Suggest).send(); ++++ } ++++ } else { ++++ messageBuilder.send(); +++ } +++ } ++++ +++ } +++ +++ public void showWelcomeMessage() { +++@@ -281,7 +256,7 @@ +++ if (!Settings.join_title) +++ Logger.warning("&e[showTitleMessage] &b-> &7This feature is disabled and you will not be able to see the preview"); +++ +++- Titles.sendTitle(player, Settings.join_title_fadein, Settings.join_title_stay, Settings.join_title_fadeout, Settings.join_message_title_title, Settings.join_message_title_subtitle); ++++ Titles.sendTitle(player, Settings.join_title_fadeIn, Settings.join_title_stay, Settings.join_title_fadeOut, Settings.join_message_title_title, Settings.join_message_title_subtitle); +++ } +++ +++ public void showActionbar() { +++Index: CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/manager/HookManager.java +++IDEA additional info: +++Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +++<+>UTF-8 +++=================================================================== +++diff --git a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/manager/HookManager.java b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/manager/HookManager.java +++--- a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/manager/HookManager.java (revision 60d9051d52d70ed86db8e0fc1a50da61f395e55a) ++++++ b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/manager/HookManager.java (revision 5436229cc153c4aec4cd6267d80f1e8301022990) +++@@ -7,8 +7,8 @@ +++ public class HookManager { +++ +++ private static HookManager instance; +++- private final DiscordSRVHHook discordSRVHHook = new DiscordSRVHHook(this); +++- private final EssentialsXDiscordHook essentialsXDiscordHook = new EssentialsXDiscordHook(this); ++++ private final DiscordSRVHHook discordSRVHHook = new DiscordSRVHHook(); ++++ private final EssentialsXDiscordHook essentialsXDiscordHook = new EssentialsXDiscordHook(); +++ private final EssentialsXHook essentialsXHook = new EssentialsXHook(this); +++ private final LuckPermsHook luckPermsHook = new LuckPermsHook(); +++ private final SuperVanishHook superVanishHook = new SuperVanishHook(); +++Index: CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/update/UpdateChecker.java +++IDEA additional info: +++Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +++<+>UTF-8 +++=================================================================== +++diff --git a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/update/UpdateChecker.java b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/update/UpdateChecker.java +++--- a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/update/UpdateChecker.java (revision 60d9051d52d70ed86db8e0fc1a50da61f395e55a) ++++++ b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/update/UpdateChecker.java (revision 5436229cc153c4aec4cd6267d80f1e8301022990) +++@@ -22,6 +22,7 @@ +++ this.plugin = plugin; +++ } +++ ++++ @SuppressWarnings("unused") +++ public void sendGithubUpdate(){ +++ getVersion("github" ,version -> { +++ if (plugin.getDescription().getVersion().equalsIgnoreCase(version)) { +++@@ -60,7 +61,6 @@ +++ break; +++ case "github": +++ url = UpdateSettings.API_UPDATE[1]; +++- +++ break; +++ default: +++ Logger.error("Invalid source for update check: " + source); +++@@ -76,7 +76,7 @@ +++ String latestRelease = scanner.next(); +++ Gson gson = new Gson(); +++ JsonObject json= gson.fromJson(latestRelease, JsonObject.class); +++- String versionName = json.get("name").getAsString(); ++++ String versionName = json.get("tag_name").getAsString(); +++ +++ if(versionName.contains("Beta")){ +++ Logger.info("The latest release is a beta version: " + versionName); +++@@ -88,10 +88,7 @@ +++ }else{ +++ consumer.accept(scanner.next()); +++ } +++- +++- +++ } +++- +++ } catch (IOException e) { +++ Logger.error("Could not check for updates: &c" + e.getMessage()); +++ } +++Index: CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/utils/GroupHelper.java +++IDEA additional info: +++Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +++<+>UTF-8 +++=================================================================== +++diff --git a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/utils/GroupHelper.java b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/utils/GroupHelper.java +++--- a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/utils/GroupHelper.java (revision 60d9051d52d70ed86db8e0fc1a50da61f395e55a) ++++++ b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/utils/GroupHelper.java (revision 5436229cc153c4aec4cd6267d80f1e8301022990) +++@@ -12,8 +12,6 @@ +++ import org.bukkit.Sound; +++ import org.bukkit.configuration.file.FileConfiguration; +++ import org.bukkit.entity.Player; +++-import org.bukkit.event.player.PlayerJoinEvent; +++-import org.bukkit.event.player.PlayerQuitEvent; +++ import org.jetbrains.annotations.Contract; +++ import org.jetbrains.annotations.NotNull; +++ +++@@ -43,7 +41,7 @@ +++ this.essentialsXDiscordHook = essentialsXDiscordHook; +++ } +++ +++- public void onJoin(Player player, FileConfiguration config, PlayerJoinEvent playerJoinEvent) { ++++ public void onJoin(Player player, FileConfiguration config) { +++ String temp = ""; +++ +++ String join = groupManager.getJoin(group); +++@@ -59,126 +57,97 @@ +++ +++ temp = Util.color(Util.getVar(player, temp)); +++ +++- boolean isNormalType = groupManager.getType(group).equalsIgnoreCase("normal"); +++- boolean isModifyType = groupManager.getType(group).equalsIgnoreCase("modify"); +++- +++ MessageBuilder messageBuilder = new MessageBuilder(player, temp); +++ +++ if (config.getBoolean("Config.Show-Chat-In-Console")) { +++ Logger.info(messageBuilder.getText()); +++ } +++ +++- if (isNormalType) { +++- playerJoinEvent.setJoinMessage(temp); +++- if (discordSRVHHook.isEnabled()) { +++- +++- if (Settings.hook_discordsrv_channelid.equalsIgnoreCase("none")) +++- return; +++- +++- DiscordUtil.sendMessageBlocking( +++- DiscordUtil.getTextChannelById(Settings.hook_discordsrv_channelid), +++- Util.colorless(messageBuilder.getText())); +++- } +++- +++- if (essentialsXDiscordHook.isEnabled()) { +++- if (Settings.hook_essentialsDiscord_channelid.equalsIgnoreCase("none")) +++- return; +++- +++- essentialsXDiscordHook.sendJoinMessage(Settings.hook_essentialsDiscord_channelid, +++- Util.colorless(messageBuilder.getText())); +++- } +++- } else if (isModifyType) { +++- +++- boolean isHover = groupManager.isHover(group); +++- boolean isClick = groupManager.isClick(group); +++- boolean isTitle = groupManager.isTitle(group); +++- boolean isSound = groupManager.isSound(group); +++- boolean isActionBar = groupManager.isActionbar(group); +++- boolean isSoundAll = groupManager.isSoundAll(group); ++++ boolean isHover = groupManager.isHover(group); ++++ boolean isClick = groupManager.isClick(group); ++++ boolean isTitle = groupManager.isTitle(group); ++++ boolean isSound = groupManager.isSound(group); ++++ boolean isActionBar = groupManager.isActionbar(group); ++++ boolean isSoundAll = groupManager.isSoundAll(group); +++ +++- List Hover_Text = groupManager.getHover(group); ++++ List Hover_Text = groupManager.getHover(group); +++ +++- String isClick_Mode = groupManager.getClickMode(group); +++- String Action_Command = groupManager.getClickCommand(group); +++- String Action_Url = groupManager.getClickUrl(group); +++- String Action_Suggest = groupManager.getClickSuggestCommand(group); +++- String Title_Text = groupManager.getTitle(group); +++- String SubTitle_Text = groupManager.getSubTitle(group); +++- String Actionbar_Text = groupManager.getActionbar(group); +++- String Sound_Name = groupManager.getSound(group); ++++ String isClick_Mode = groupManager.getClickMode(group); ++++ String Action_Command = groupManager.getClickCommand(group); ++++ String Action_Url = groupManager.getClickUrl(group); ++++ String Action_Suggest = groupManager.getClickSuggestCommand(group); ++++ String Title_Text = groupManager.getTitle(group); ++++ String SubTitle_Text = groupManager.getSubTitle(group); ++++ String Actionbar_Text = groupManager.getActionbar(group); ++++ String Sound_Name = groupManager.getSound(group); +++ +++- int FadeIn = groupManager.getFadeIn(group); +++- int Stay = groupManager.getStay(group); +++- int FadeOut = groupManager.getFadeOut(group); +++- int Sound_Volume = groupManager.getVolume(group); +++- float Sound_Pitch = groupManager.getPitch(group); ++++ int FadeIn = groupManager.getFadeIn(group); ++++ int Stay = groupManager.getStay(group); ++++ int FadeOut = groupManager.getFadeOut(group); ++++ int Sound_Volume = groupManager.getVolume(group); ++++ float Sound_Pitch = groupManager.getPitch(group); +++ +++- if (isHover) { +++- if (isClick) { +++- if (isClick_Mode.equalsIgnoreCase("command")) { +++- messageBuilder.setHover(Hover_Text).setExecuteCommand(Action_Command).sendToAll(); +++- } else if (isClick_Mode.equalsIgnoreCase("url")) { +++- messageBuilder.setHover(Hover_Text).setOpenURL(Action_Url).sendToAll(); +++- } else if (isClick_Mode.equalsIgnoreCase("suggest")) { +++- messageBuilder.setHover(Hover_Text).setSuggestCommand(Action_Suggest).sendToAll(); +++- } +++- } else { +++- messageBuilder.setHover(Hover_Text).sendToAll(); +++- } +++- } else { +++- if (isClick) { +++- if (isClick_Mode.equalsIgnoreCase("command")) { +++- messageBuilder.setExecuteCommand(Action_Command).sendToAll(); +++- } else if (isClick_Mode.equalsIgnoreCase("url")) { +++- messageBuilder.setOpenURL(Action_Url).sendToAll(); +++- } else if (isClick_Mode.equalsIgnoreCase("suggest")) { +++- messageBuilder.setSuggestCommand(Action_Suggest).sendToAll(); +++- } +++- } else { +++- messageBuilder.sendToAll(); +++- } +++- } ++++ if (isHover) { ++++ if (isClick) { ++++ if (isClick_Mode.equalsIgnoreCase("command")) { ++++ messageBuilder.setHover(Hover_Text).setExecuteCommand(Action_Command).sendToAll(); ++++ } else if (isClick_Mode.equalsIgnoreCase("url")) { ++++ messageBuilder.setHover(Hover_Text).setOpenURL(Action_Url).sendToAll(); ++++ } else if (isClick_Mode.equalsIgnoreCase("suggest")) { ++++ messageBuilder.setHover(Hover_Text).setSuggestCommand(Action_Suggest).sendToAll(); ++++ } ++++ } else { ++++ messageBuilder.setHover(Hover_Text).sendToAll(); ++++ } ++++ } else { ++++ if (isClick) { ++++ if (isClick_Mode.equalsIgnoreCase("command")) { ++++ messageBuilder.setExecuteCommand(Action_Command).sendToAll(); ++++ } else if (isClick_Mode.equalsIgnoreCase("url")) { ++++ messageBuilder.setOpenURL(Action_Url).sendToAll(); ++++ } else if (isClick_Mode.equalsIgnoreCase("suggest")) { ++++ messageBuilder.setSuggestCommand(Action_Suggest).sendToAll(); ++++ } ++++ } else { ++++ messageBuilder.sendToAll(); ++++ } ++++ } +++ +++- if (discordSRVHHook.isEnabled()) { +++- DiscordUtil.sendMessageBlocking( +++- DiscordUtil.getTextChannelById(Settings.hook_discordsrv_channelid), +++- Util.colorless(messageBuilder.getText())); +++- } ++++ if (discordSRVHHook.isEnabled()) { ++++ DiscordUtil.sendMessageBlocking( ++++ DiscordUtil.getTextChannelById(Settings.hook_discordSrv_channelId), ++++ Util.colorless(messageBuilder.getText())); ++++ } +++ +++- if (isTitle) { +++- Titles.sendTitle(player, FadeIn, Stay, FadeOut, Util.color(Util.getVar(player, Title_Text)), +++- Util.color(Util.getVar(player, SubTitle_Text))); +++- } ++++ if (isTitle) { ++++ Titles.sendTitle(player, FadeIn, Stay, FadeOut, Util.color(Util.getVar(player, Title_Text)), ++++ Util.color(Util.getVar(player, SubTitle_Text))); ++++ } +++ +++- if (isActionBar) { +++- ActionBar.sendActionBar(player, Util.color(Util.getVar(player, Actionbar_Text))); +++- } ++++ if (isActionBar) { ++++ ActionBar.sendActionBar(player, Util.color(Util.getVar(player, Actionbar_Text))); ++++ } +++ +++- try { +++- if (isSound) { +++- if (isSoundAll) { +++- Location location = player.getLocation(); +++- player.playSound(location, Sound.valueOf(Sound_Name), Sound_Volume, Sound_Pitch); +++- } else { +++- for (Player pp : Bukkit.getOnlinePlayers()) { +++- Location location = player.getLocation(); +++- pp.playSound(location, Sound.valueOf(Sound_Name), Sound_Volume, Sound_Pitch); +++- } +++- } +++- } +++- } catch (Exception ex) { +++- Logger.warning("&eVerify that the sound name is correct or belongs to the version"); +++- } ++++ try { ++++ if (isSound) { ++++ if (isSoundAll) { ++++ Location location = player.getLocation(); ++++ player.playSound(location, Sound.valueOf(Sound_Name), Sound_Volume, Sound_Pitch); ++++ } else { ++++ for (Player pp : Bukkit.getOnlinePlayers()) { ++++ Location location = player.getLocation(); ++++ pp.playSound(location, Sound.valueOf(Sound_Name), Sound_Volume, Sound_Pitch); ++++ } ++++ } ++++ } ++++ } catch (Exception ex) { ++++ Logger.warning("&eVerify that the sound name is correct or belongs to the version"); +++ } +++ } +++ +++- public void onQuit(Player player, @NotNull FileConfiguration config, PlayerQuitEvent playerQuitEvent) { ++++ public void onQuit(Player player, @NotNull FileConfiguration config) { +++ String quit = groupManager.getQuit(group); +++ +++- +++- boolean isNormalType = groupManager.getType(group).equalsIgnoreCase("normal"); +++- boolean isModifyType = groupManager.getType(group).equalsIgnoreCase("modify"); +++- +++ quit = Util.color(Util.getVar(player, quit)); +++ +++ MessageBuilder messageBuilder = new MessageBuilder(player, quit); +++@@ -186,102 +155,82 @@ +++ Logger.info(messageBuilder.getText()); +++ } +++ +++- if (isNormalType) { +++- playerQuitEvent.setQuitMessage(quit); +++- if (discordSRVHHook.isEnabled()) { +++- if (Settings.hook_discordsrv_channelid.equalsIgnoreCase("none")) +++- return; +++- DiscordUtil.sendMessageBlocking( +++- DiscordUtil.getTextChannelById(Settings.hook_discordsrv_channelid), +++- Util.colorless(messageBuilder.getText())); +++- } +++- +++- if (essentialsXDiscordHook.isEnabled()) { +++- if (Settings.hook_essentialsDiscord_channelid.equalsIgnoreCase("none")) +++- return; +++- essentialsXDiscordHook.sendQuitMessage(Settings.hook_essentialsDiscord_channelid, +++- Util.colorless(messageBuilder.getText())); +++- } +++- } else if (isModifyType) { +++- +++- boolean isHover = groupManager.isHover(group); +++- boolean isClick = groupManager.isClick(group); +++- boolean isSound = groupManager.isSound(group); +++- boolean isSoundAll = groupManager.isSoundAll(group); ++++ boolean isHover = groupManager.isHover(group); ++++ boolean isClick = groupManager.isClick(group); ++++ boolean isSound = groupManager.isSound(group); ++++ boolean isSoundAll = groupManager.isSoundAll(group); +++ +++- List Hover_Text = groupManager.getHover(group); ++++ List Hover_Text = groupManager.getHover(group); +++ +++- String isClick_Mode = groupManager.getClickMode(group); +++- String Action_Command = groupManager.getClickCommand(group); +++- String Action_Url = groupManager.getClickUrl(group); +++- String Action_Suggest = groupManager.getClickSuggestCommand(group); +++- String Sound_Name = groupManager.getSound(group); ++++ String isClick_Mode = groupManager.getClickMode(group); ++++ String Action_Command = groupManager.getClickCommand(group); ++++ String Action_Url = groupManager.getClickUrl(group); ++++ String Action_Suggest = groupManager.getClickSuggestCommand(group); ++++ String Sound_Name = groupManager.getSound(group); +++ +++- int Sound_Volume = groupManager.getVolume(group); +++- float Sound_Pitch = groupManager.getPitch(group); ++++ int Sound_Volume = groupManager.getVolume(group); ++++ float Sound_Pitch = groupManager.getPitch(group); +++ +++- if (isHover) { +++- if (isClick) { +++- if (isClick_Mode.equalsIgnoreCase("command")) { +++- messageBuilder.setHover(Hover_Text).setExecuteCommand(Action_Command).sendToAll(); +++- } else if (isClick_Mode.equalsIgnoreCase("url")) { +++- messageBuilder.setHover(Hover_Text).setOpenURL(Action_Url).sendToAll(); +++- } else if (isClick_Mode.equalsIgnoreCase("suggest")) { +++- messageBuilder.setHover(Hover_Text).setSuggestCommand(Action_Suggest).sendToAll(); +++- } +++- } else { +++- messageBuilder.setHover(Hover_Text).sendToAll(); +++- } +++- } else { +++- if (isClick) { +++- if (isClick_Mode.equalsIgnoreCase("command")) { +++- messageBuilder.setExecuteCommand(Action_Command).sendToAll(); +++- } else if (isClick_Mode.equalsIgnoreCase("url")) { +++- messageBuilder.setOpenURL(Action_Url).sendToAll(); +++- } else if (isClick_Mode.equalsIgnoreCase("suggest")) { +++- messageBuilder.setSuggestCommand(Action_Suggest).sendToAll(); +++- } +++- } else { +++- messageBuilder.sendToAll(); +++- } +++- } ++++ if (isHover) { ++++ if (isClick) { ++++ if (isClick_Mode.equalsIgnoreCase("command")) { ++++ messageBuilder.setHover(Hover_Text).setExecuteCommand(Action_Command).sendToAll(); ++++ } else if (isClick_Mode.equalsIgnoreCase("url")) { ++++ messageBuilder.setHover(Hover_Text).setOpenURL(Action_Url).sendToAll(); ++++ } else if (isClick_Mode.equalsIgnoreCase("suggest")) { ++++ messageBuilder.setHover(Hover_Text).setSuggestCommand(Action_Suggest).sendToAll(); ++++ } ++++ } else { ++++ messageBuilder.setHover(Hover_Text).sendToAll(); ++++ } ++++ } else { ++++ if (isClick) { ++++ if (isClick_Mode.equalsIgnoreCase("command")) { ++++ messageBuilder.setExecuteCommand(Action_Command).sendToAll(); ++++ } else if (isClick_Mode.equalsIgnoreCase("url")) { ++++ messageBuilder.setOpenURL(Action_Url).sendToAll(); ++++ } else if (isClick_Mode.equalsIgnoreCase("suggest")) { ++++ messageBuilder.setSuggestCommand(Action_Suggest).sendToAll(); ++++ } ++++ } else { ++++ messageBuilder.sendToAll(); ++++ } ++++ } +++ +++- if (discordSRVHHook.isEnabled()) { ++++ if (discordSRVHHook.isEnabled()) { +++ +++- if (Settings.hook_discordsrv_channelid.equalsIgnoreCase("none")) +++- return; ++++ if (Settings.hook_discordSrv_channelId.equalsIgnoreCase("none")) ++++ return; +++ +++- DiscordUtil.sendMessageBlocking( +++- DiscordUtil.getTextChannelById(Settings.hook_discordsrv_channelid), +++- Util.colorless(messageBuilder.getText())); +++- } ++++ DiscordUtil.sendMessageBlocking( ++++ DiscordUtil.getTextChannelById(Settings.hook_discordSrv_channelId), ++++ Util.colorless(messageBuilder.getText())); ++++ } +++ +++- if (essentialsXDiscordHook.isEnabled()) { ++++ if (essentialsXDiscordHook.isEnabled()) { +++ +++- if (Settings.hook_essentialsDiscord_channelid.equalsIgnoreCase("none")) +++- return; ++++ if (Settings.hook_essentialsDiscord_channelId.equalsIgnoreCase("none")) ++++ return; +++ +++- essentialsXDiscordHook.sendQuitMessage(Settings.hook_essentialsDiscord_channelid, +++- Util.colorless(messageBuilder.getText())); +++- } ++++ essentialsXDiscordHook.sendQuitMessage(Settings.hook_essentialsDiscord_channelId, ++++ Util.colorless(messageBuilder.getText())); ++++ } +++ +++- try { +++- if (isSound) { +++- if (isSoundAll) { +++- Location location = player.getLocation(); +++- player.playSound(location, Sound.valueOf(Sound_Name), Sound_Volume, Sound_Pitch); +++- } else { +++- for (Player pp : Bukkit.getOnlinePlayers()) { +++- Location location = player.getLocation(); +++- pp.playSound(location, Sound.valueOf(Sound_Name), Sound_Volume, Sound_Pitch); +++- } +++- } +++- } +++- } catch (Exception ex) { +++- Logger.warning("&eVerify that the sound name is correct or belongs to the version"); +++- } +++- } ++++ try { ++++ if (isSound) { ++++ if (isSoundAll) { ++++ Location location = player.getLocation(); ++++ player.playSound(location, Sound.valueOf(Sound_Name), Sound_Volume, Sound_Pitch); ++++ } else { ++++ for (Player pp : Bukkit.getOnlinePlayers()) { ++++ Location location = player.getLocation(); ++++ pp.playSound(location, Sound.valueOf(Sound_Name), Sound_Volume, Sound_Pitch); ++++ } ++++ } ++++ } ++++ } catch (Exception ex) { ++++ Logger.warning("&eVerify that the sound name is correct or belongs to the version"); ++++ } ++++ } +++ +++- } +++- +++ } +++Index: CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/utils/Settings.java +++IDEA additional info: +++Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +++<+>UTF-8 +++=================================================================== +++diff --git a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/utils/Settings.java b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/utils/Settings.java +++--- a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/utils/Settings.java (revision 60d9051d52d70ed86db8e0fc1a50da61f395e55a) ++++++ b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/utils/Settings.java (revision 5436229cc153c4aec4cd6267d80f1e8301022990) +++@@ -14,7 +14,6 @@ +++ public static boolean settings_debug; +++ +++ //Join section +++- public static String join_type; +++ +++ public static boolean join; +++ public static String join_message; +++@@ -25,9 +24,9 @@ +++ public static boolean join_title; +++ public static String join_message_title_title; +++ public static String join_message_title_subtitle; +++- public static int join_title_fadein; ++++ public static int join_title_fadeIn; +++ public static int join_title_stay; +++- public static int join_title_fadeout; ++++ public static int join_title_fadeOut; +++ +++ public static boolean join_actionbar; +++ public static String join_message_actionbar_text; +++@@ -38,33 +37,23 @@ +++ public static int join_sound_vol; +++ +++ //Quit section +++- +++- public static String quit_type; +++- +++ public static boolean quit; +++ public static String quit_message; +++ +++- public static boolean quit_sound; +++- public static String quit_sound_name; +++- public static float quit_sound_pitch; +++- public static int quit_sound_vol; +++- +++ //Welcome section +++ public static boolean welcome; +++ public static List list_welcome; +++ +++ //Hooks section +++- public static boolean hook_discordsrv; +++- public static boolean hook_discordsrv_use_message; +++- public static String hook_discordsrv_channelid; ++++ public static boolean hook_discordSrv; ++++ public static String hook_discordSrv_channelId; +++ +++ public static boolean hook_essentials; +++- public static boolean hook_essentials_hideplayervanish; ++++ public static boolean hook_essentials_hidePlayerVanish; +++ +++ public static boolean hook_essentialsDiscord; +++ public static boolean hook_essentialsDiscord_use_default_channel; +++- public static String hook_essentialsDiscord_channelid; ++++ public static String hook_essentialsDiscord_channelId; +++ public static boolean hook_luckperms; +++- public static boolean hook_luckperms_use_group; +++ public static long hook_luckperms_autoUpdate_group_tick; +++ } +++Index: CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/utils/Util.java +++IDEA additional info: +++Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +++<+>UTF-8 +++=================================================================== +++diff --git a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/utils/Util.java b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/utils/Util.java +++--- a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/utils/Util.java (revision 60d9051d52d70ed86db8e0fc1a50da61f395e55a) ++++++ b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/utils/Util.java (revision 5436229cc153c4aec4cd6267d80f1e8301022990) +++@@ -67,10 +67,8 @@ +++ return prefix; +++ } +++ +++- +++ public static @NotNull List setTabLimit(final @NotNull List options, final String lastArgs) { +++ final List returned = new ArrayList<>(); +++- +++ for (String s : options) { +++ if (s == null) { +++ continue; +++@@ -82,25 +80,11 @@ +++ return returned; +++ } +++ +++- @SuppressWarnings("unused") +++- public static void sendTextComponentHover(@NotNull Player j, String action, String message, String subMessage, String color) { +++- TextComponent msg = new TextComponent(color(message)); +++- msg.setHoverEvent(new HoverEvent(HoverEvent.Action.valueOf(getActionHoverType(action)), new ComponentBuilder(subMessage).color(ChatColor.of(color)).create())); +++- j.spigot().sendMessage(msg); +++- } +++- +++ public static void sendTextComponent116Hover(@NotNull Player j, String action, String message, String subMessage) { +++ TextComponent msg = new TextComponent(color(message)); +++ msg.setHoverEvent(new HoverEvent(HoverEvent.Action.valueOf(getActionHoverType(action)), new ComponentBuilder(color(subMessage)).create())); +++ j.spigot().sendMessage(msg); +++ } +++- +++- @SuppressWarnings("unused") +++- public static void sendTextComponentClick(@NotNull Player j, String action, String message, String arg0) { +++- TextComponent msg = new TextComponent(color(message)); +++- msg.setClickEvent(new ClickEvent(ClickEvent.Action.valueOf(getActionClickType(action)), arg0)); +++- j.spigot().sendMessage(msg); +++- } +++ +++ public static void sendAllPlayerBaseComponent(BaseComponent component) { +++ for (Player p : Bukkit.getOnlinePlayers()) { +++@@ -120,16 +104,6 @@ +++ } +++ return null; +++ } +++- +++- public static @Nullable String getActionClickType(@NotNull String arg) { +++- if (arg.equalsIgnoreCase("url")) { +++- return "OPEN_URL"; +++- } +++- if (arg.equalsIgnoreCase("cmd")) { +++- return "RUN_COMMAND"; +++- } +++- return null; +++- } +++ +++ public static @NotNull String getVar(@NotNull Player player, String text) { +++ text = text.replace("", player.getName()); +++Index: CustomJoinAndQuitMessagesOld/src/main/resources/config.yml +++IDEA additional info: +++Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +++<+>UTF-8 +++=================================================================== +++diff --git a/CustomJoinAndQuitMessagesOld/src/main/resources/config.yml b/CustomJoinAndQuitMessagesOld/src/main/resources/config.yml +++--- a/CustomJoinAndQuitMessagesOld/src/main/resources/config.yml (revision 60d9051d52d70ed86db8e0fc1a50da61f395e55a) ++++++ b/CustomJoinAndQuitMessagesOld/src/main/resources/config.yml (revision 5436229cc153c4aec4cd6267d80f1e8301022990) +++@@ -105,9 +105,6 @@ +++ # |Text| Here you can set the join message for the first time +++ Text: '&6Welcome to server &a&6 for the first time' +++ +++- # |Type| Here you can find two types that are [ normal | modify ] +++- Type: modify +++- +++ # |HoverEvent| This section allows you to modify the hover events in the chat +++ HoverEvent: +++ +++@@ -129,12 +126,6 @@ +++ # |Mode| there are three different modes which are [ command | suggest | url ] +++ Mode: command +++ +++- # This feature is not available yet +++- DevActions: +++- - '[Suggest]: /help' +++- - '[Execute]: /me hello test' +++- - '[Open]: https://www.spigotmc.org/resources/custom-join-and-quit-message-1-7-x-1-17-x.57006/' +++- +++ # |Actions| This is where are the available events that you can use +++ Actions: +++ +++@@ -205,9 +196,6 @@ +++ # |Text| This is where Quit customizable message is located +++ Text: '&b[<#:FF8E8E>-&b] <#:A157FF>' +++ +++- # |Type| Here you can find two types that are [ normal | modify ] +++- Type: normal +++- +++ # |HoverEvent| This section allows you to modify the hover events in the chat +++ HoverEvent: +++ +++@@ -280,7 +268,7 @@ +++ - '&m=========================================&r' +++ # +++ # |File-Version|I would not change anything +++-File-Version: 3 ++++File-Version: 4 +++ # |> This is the end of the configuration ... [-_-] more things coming soon +++ # +++ # | Config File | +++Index: CustomJoinAndQuitMessagesOld/src/main/resources/groups.yml +++IDEA additional info: +++Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +++<+>UTF-8 +++=================================================================== +++diff --git a/CustomJoinAndQuitMessagesOld/src/main/resources/groups.yml b/CustomJoinAndQuitMessagesOld/src/main/resources/groups.yml +++--- a/CustomJoinAndQuitMessagesOld/src/main/resources/groups.yml (revision 60d9051d52d70ed86db8e0fc1a50da61f395e55a) ++++++ b/CustomJoinAndQuitMessagesOld/src/main/resources/groups.yml (revision 5436229cc153c4aec4cd6267d80f1e8301022990) +++@@ -32,9 +32,6 @@ +++ +++ # |Text| Here you can set the join message for the first time +++ Text: '&6Welcome to server &a&6 for the first time' +++- +++- # |Type| Here you can find two types that are [ normal | modify ] +++- Type: modify +++ +++ # |HoverEvent| This section allows you to modify the hover events in the chat +++ HoverEvent: +++Index: bukkit/src/main/java/jss/customjoinandquitmessage/commands/subcommands/InfoCommand.java +++IDEA additional info: +++Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +++<+>UTF-8 +++=================================================================== +++diff --git a/bukkit/src/main/java/jss/customjoinandquitmessage/commands/subcommands/InfoCommand.java b/bukkit/src/main/java/jss/customjoinandquitmessage/commands/subcommands/InfoCommand.java +++--- a/bukkit/src/main/java/jss/customjoinandquitmessage/commands/subcommands/InfoCommand.java (revision 60d9051d52d70ed86db8e0fc1a50da61f395e55a) ++++++ b/bukkit/src/main/java/jss/customjoinandquitmessage/commands/subcommands/InfoCommand.java (revision 5436229cc153c4aec4cd6267d80f1e8301022990) +++@@ -9,6 +9,11 @@ +++ return "info"; +++ } +++ ++++ @Override ++++ public String permission() { ++++ return null; ++++ } ++++ +++ public void onCommand(CommandSender sender, String[] args) { +++ +++ } +++Index: patches/Removed_debugging_messages_in_the_LuckPermsHook_class_.patch +++IDEA additional info: +++Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +++<+>UTF-8 +++=================================================================== +++diff --git a/patches/Removed_debugging_messages_in_the_LuckPermsHook_class_.patch b/patches/Removed_debugging_messages_in_the_LuckPermsHook_class_.patch +++new file mode 100644 +++--- /dev/null (revision 5436229cc153c4aec4cd6267d80f1e8301022990) ++++++ b/patches/Removed_debugging_messages_in_the_LuckPermsHook_class_.patch (revision 5436229cc153c4aec4cd6267d80f1e8301022990) +++@@ -0,0 +1,29 @@ ++++Index: CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/hook/LuckPermsHook.java ++++IDEA additional info: ++++Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP ++++<+>UTF-8 ++++=================================================================== ++++diff --git a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/hook/LuckPermsHook.java b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/hook/LuckPermsHook.java ++++--- a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/hook/LuckPermsHook.java (revision 52d1e6b32c970d5470b3f06b418c1d1ef9e3aeb1) +++++++ b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/hook/LuckPermsHook.java (revision 60d9051d52d70ed86db8e0fc1a50da61f395e55a) ++++@@ -25,19 +25,16 @@ ++++ if (!Bukkit.getPluginManager().isPluginEnabled("LuckPerms")) { ++++ Logger.warning("&eLuckPerms not enabled! - Disable Features..."); ++++ this.isEnabled = false; ++++- System.out.println("Cjm Softdepend: Luckperms false - check plugin installed in plugin folder"); ++++ return; ++++ } ++++ ++++ if (!Settings.hook_luckperms) { ++++ this.isEnabled = false; ++++- System.out.println("Cjm Softdepend: Luckperms false - Hook Enabled in config"); ++++- Logger.warning("&eLuckPerms not enabled! - Disable Features..."); +++++ System.out.println("Cjm Softdepend: Luckperms false - Hook disabled in config"); ++++ return; ++++ } ++++ ++++ this.isEnabled = true; ++++- System.out.println("Cjm Softdepend: Luckperms true - The plugin has successfully loaded the dependency"); ++++ Util.sendColorMessage(EventUtils.getStaticConsoleSender(), Util.getPrefix(true) + "&aLoading LuckPerms features..."); ++++ } ++++ From c4ee702cbd4d72f8013cea8d0d73788a1ead4a36 Mon Sep 17 00:00:00 2001 From: ItsQuadrus Date: Thu, 23 Mar 2023 18:55:36 +0100 Subject: [PATCH 20/27] Clearer installation instructions --- README.md | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 663617c..ce53744 100644 --- a/README.md +++ b/README.md @@ -17,10 +17,11 @@ A simple to use plugin that will allow you to customize the join and quit message, it also brings a message customization option that will allow you to add special actions. ## Installation -* download the plugin -* you turn off your server so that no error occurs -* drag the plugin into the plugins folder of your server -* you turn on the server and it would be ready +1. Stop your server +2. Download the plugin +3. Drag the jar file into the plugins folder +4. Start your server +5. The plugin is ready for use! ## Support * [Issue Tracker](https://github.com/jonagamerpro1234/CustomJoinAndQuitMessages/issues) From d95eeb4f788d3a38a9488e0142510ed0a4a880ef Mon Sep 17 00:00:00 2001 From: SrJss <31166687+jonagamerpro1234@users.noreply.github.com> Date: Sun, 9 Apr 2023 22:14:28 -0400 Subject: [PATCH 21/27] Update Logger and more changes... --- CustomJoinAndQuitMessagesOld/pom.xml | 2 +- .../CustomJoinAndQuitMessages.java | 29 +- .../config/Lang.java | 29 +- .../config/PlayerFile.java | 1 - .../config/utils/FileLister.java | 2 +- .../config/utils/PreConfigLoader.java | 16 +- .../hook/DiscordSRVHHook.java | 2 +- .../hook/EssentialsXDiscordHook.java | 2 +- .../hook/EssentialsXHook.java | 7 +- .../hook/LuckPermsHook.java | 2 +- .../hook/PlaceholderApiHook.java | 9 +- .../hook/SuperVanishHook.java | 2 +- .../listener/InventoryListener.java | 2 +- .../listener/TaskLoader.java | 4 +- .../listener/{ => chat}/JoinListener.java | 155 +- .../listener/chat/QuitListener.java | 178 ++ .../manager/DisplayManager.java | 2 +- .../manager/GroupManager.java | 30 +- .../storage/PlayerJsonStorage.java | 2 +- .../update/UpdateChecker.java | 10 +- .../utils/GroupHelper.java | 1 + .../{manager => utils}/InventoryView.java | 2 +- .../utils/Logger.java | 31 - .../utils/Settings.java | 7 +- .../customjoinandquitmessages/utils/Util.java | 4 +- .../utils/logger/FileLogger.java | 83 + .../utils/logger/Logger.java | 44 + .../src/main/resources/config.yml | 3 +- .../commands/subcommands/DisplayCommand.java | 6 + .../commands/subcommands/ReloadCommand.java | 5 + .../files/LangFile.java | 31 +- .../files/utils/FileList.java | 2 +- .../files/utils/PreConfigLoader.java | 8 +- .../listeners/chat/JoinListener.java | 7 +- .../listeners/chat/QuitListener.java | 14 + bukkit/src/main/resources/config.yml | 133 +- bukkit/src/main/resources/groups.yml | 128 ++ bukkit/src/main/resources/plugin.yml | 39 +- patches/Update_config.patch | 1807 +++++++++++++++++ 39 files changed, 2518 insertions(+), 323 deletions(-) rename CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/listener/{ => chat}/JoinListener.java (59%) create mode 100644 CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/listener/chat/QuitListener.java rename CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/{manager => utils}/InventoryView.java (90%) delete mode 100644 CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/utils/Logger.java create mode 100644 CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/utils/logger/FileLogger.java create mode 100644 CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/utils/logger/Logger.java create mode 100644 bukkit/src/main/java/jss/customjoinandquitmessage/listeners/chat/QuitListener.java create mode 100644 bukkit/src/main/resources/groups.yml create mode 100644 patches/Update_config.patch diff --git a/CustomJoinAndQuitMessagesOld/pom.xml b/CustomJoinAndQuitMessagesOld/pom.xml index 679ebce..8a7ed90 100644 --- a/CustomJoinAndQuitMessagesOld/pom.xml +++ b/CustomJoinAndQuitMessagesOld/pom.xml @@ -9,7 +9,7 @@ CustomJoinAndQuitMessagesOld - 1.7.9-release + 1.7.10-beta 8 diff --git a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/CustomJoinAndQuitMessages.java b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/CustomJoinAndQuitMessages.java index 038e276..f0687b1 100644 --- a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/CustomJoinAndQuitMessages.java +++ b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/CustomJoinAndQuitMessages.java @@ -6,12 +6,13 @@ import jss.customjoinandquitmessages.config.Lang; import jss.customjoinandquitmessages.config.PlayerFile; import jss.customjoinandquitmessages.config.utils.PreConfigLoader; -import jss.customjoinandquitmessages.listener.JoinListener; +import jss.customjoinandquitmessages.listener.chat.JoinListener; import jss.customjoinandquitmessages.listener.TaskLoader; +import jss.customjoinandquitmessages.listener.chat.QuitListener; import jss.customjoinandquitmessages.manager.HookManager; -import jss.customjoinandquitmessages.manager.InventoryView; +import jss.customjoinandquitmessages.utils.InventoryView; import jss.customjoinandquitmessages.update.UpdateChecker; -import jss.customjoinandquitmessages.utils.Logger; +import jss.customjoinandquitmessages.utils.logger.Logger; import jss.customjoinandquitmessages.utils.Settings; import jss.customjoinandquitmessages.utils.Util; import org.bstats.bukkit.Metrics; @@ -20,6 +21,7 @@ import org.bukkit.plugin.PluginDescriptionFile; import org.bukkit.plugin.java.JavaPlugin; +import java.io.File; import java.util.ArrayList; import java.util.HashMap; import java.util.Map; @@ -35,6 +37,7 @@ public class CustomJoinAndQuitMessages extends JavaPlugin { private final ConfigFile configFile = new ConfigFile(this, "config.yml"); private final HookManager hooksManager = new HookManager(); private final PreConfigLoader preConfigLoader = new PreConfigLoader(this); + @SuppressWarnings("unused") private String updateVersion; private boolean useLegacyConfig = false; private ArrayList inventoryViews; @@ -45,7 +48,11 @@ public void onLoad() { Util.sendLoadTitle(version); inventoryViews = new ArrayList<>(); - //Util.createFolder(this,"Players"); + File logDirectory = new File(getDataFolder(), "logs"); + if (!logDirectory.exists()) { + //noinspection ResultOfMethodCallIgnored + logDirectory.mkdirs(); + } } public void onEnable() { @@ -67,7 +74,7 @@ public void onEnable() { String cfg = getConfigFile().getConfig().getString("File-Version"); boolean old_cfg = getConfigFile().getConfig().contains("Config.Config-Version"); assert cfg != null; - if (!cfg.equals("3") || old_cfg) { + if (!cfg.equals("4") || old_cfg) { useLegacyConfig = true; } @@ -85,7 +92,6 @@ public void onEnable() { UpdateChecker updateChecker = new UpdateChecker(this); updateChecker.sendSpigotUpdate(); - //updateChecker.sendGithubUpdate(); } public void onDisable() { @@ -101,6 +107,7 @@ public void setupCommands() { public void setupEvents() { new JoinListener(); + new QuitListener(); TaskLoader taskLoader = new TaskLoader(this); taskLoader.onUpdateGroup(); } @@ -114,7 +121,7 @@ public void reloadAllFiles() { } public Lang Locale() { - return availableLangs.get(Settings.defaultLanguage); + return availableLangs.get(Settings.settings_defaultLanguage); } public void setAvailableLocales(HashMap availableLangs) { @@ -144,14 +151,6 @@ public void registerInventory(Player player, String inventoryName) { } } - @SuppressWarnings({"SuspiciousListRemoveInLoop", "unused"}) - public void unregisterInventory(Player player) { - for (int i = 0; i < inventoryViews.size(); i++) { - if (inventoryViews.get(i).getPlayer().getName().equals(player.getName())) { - inventoryViews.remove(i); - } - } - } public InventoryView getInventoryView(Player player) { for (InventoryView inventoryView : inventoryViews) { diff --git a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/config/Lang.java b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/config/Lang.java index 2b5cf03..87b81dd 100644 --- a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/config/Lang.java +++ b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/config/Lang.java @@ -1,7 +1,7 @@ package jss.customjoinandquitmessages.config; import jss.customjoinandquitmessages.CustomJoinAndQuitMessages; -import jss.customjoinandquitmessages.utils.Logger; +import jss.customjoinandquitmessages.utils.logger.Logger; import jss.customjoinandquitmessages.utils.Settings; import org.bukkit.configuration.file.FileConfiguration; import org.bukkit.configuration.file.YamlConfiguration; @@ -10,6 +10,7 @@ import java.util.List; import java.util.Locale; +@SuppressWarnings("all") public class Lang { public String No_Permission; @@ -22,7 +23,7 @@ public class Lang { public String Error_Sound; public String error_null_group; private final CustomJoinAndQuitMessages plugin; - private FileConfiguration locale = null; + private FileConfiguration locale; private File localeFile = null; private final Locale localeObject; private final String localeName; @@ -70,7 +71,7 @@ public void reloadLang(final String localeName) { private void loadLocale() { String main = "CustomJoinAndQuitMessage"; - Settings.messages_prefix = locale.getString(main + ".Prefix"); + Settings.messages_prefix = locale.getString(main + ".Prefix"); Error_Cmd = locale.getString(main + ".Error-Cmd"); Error_Console = locale.getString(main + ".Error-Console"); Error_Sound = locale.getString(main + ".Sound-Error"); @@ -82,26 +83,4 @@ private void loadLocale() { error_null_group = locale.getString(main + ".Groups.NotFoundGroup"); } - public String getLocaleName() { - return this.localeName; - } - - public String getLanguageName() { - if (localeObject == null) { - return "unknown"; - } - return localeObject.getDisplayLanguage(localeObject); - } - - public String getCountryName() { - if (localeObject == null) { - return "unknown"; - } - return localeObject.getDisplayCountry(localeObject); - } - - public int getIndex() { - return index; - } - } diff --git a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/config/PlayerFile.java b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/config/PlayerFile.java index 2d82ddd..afeac89 100644 --- a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/config/PlayerFile.java +++ b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/config/PlayerFile.java @@ -9,7 +9,6 @@ import java.nio.charset.StandardCharsets; public class PlayerFile extends FileManager { - private File file; private FileConfiguration config; private final String path; diff --git a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/config/utils/FileLister.java b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/config/utils/FileLister.java index 248ca92..b31864d 100644 --- a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/config/utils/FileLister.java +++ b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/config/utils/FileLister.java @@ -1,7 +1,7 @@ package jss.customjoinandquitmessages.config.utils; import jss.customjoinandquitmessages.CustomJoinAndQuitMessages; -import jss.customjoinandquitmessages.utils.Logger; +import jss.customjoinandquitmessages.utils.logger.Logger; import org.bukkit.plugin.java.JavaPlugin; import java.io.File; diff --git a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/config/utils/PreConfigLoader.java b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/config/utils/PreConfigLoader.java index 7549451..482ef61 100644 --- a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/config/utils/PreConfigLoader.java +++ b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/config/utils/PreConfigLoader.java @@ -2,7 +2,7 @@ import jss.customjoinandquitmessages.CustomJoinAndQuitMessages; import jss.customjoinandquitmessages.config.Lang; -import jss.customjoinandquitmessages.utils.Logger; +import jss.customjoinandquitmessages.utils.logger.Logger; import jss.customjoinandquitmessages.utils.Settings; import jss.customjoinandquitmessages.utils.Util; import org.bukkit.configuration.file.FileConfiguration; @@ -25,8 +25,8 @@ public void loadConfig() { //Other Settings.settings_debug = config.getBoolean("Config.Debug"); - Settings.update = Objects.equals(config.getString("Config.Update.Enabled"), "true"); - Settings.c_type = config.getString("Config.Type"); + Settings.settings_update = Objects.equals(config.getString("Config.Update.Enabled"), "true"); + Settings.chatformat_type = config.getString("Config.Type"); Settings.is_Group_Display = Objects.requireNonNull(config.getString("Config.Type")).equalsIgnoreCase("group"); //Join @@ -81,7 +81,7 @@ public void loadConfig() { } public boolean loadLangs() { - Settings.defaultLanguage = plugin.getConfig().getString("Config.Lang", "en_US"); + Settings.settings_defaultLanguage = plugin.getConfig().getString("Config.Lang", "en_US"); HashMap availableLocales = new HashMap<>(); FileLister fl = new FileLister(); try { @@ -92,10 +92,10 @@ public boolean loadLangs() { } catch (IOException e1) { plugin.getLogger().severe("Could not add locales!"); } - if (!availableLocales.containsKey(Settings.defaultLanguage)) { - Logger.warning(Util.getPrefix(true) + "&eLoad File: " + Settings.defaultLanguage + ".yml' not found in /lang/ folder. Using /lang/en_US.yml"); - Settings.defaultLanguage = "en_US"; - availableLocales.put(Settings.defaultLanguage, new Lang(plugin, Settings.defaultLanguage, 0)); + if (!availableLocales.containsKey(Settings.settings_defaultLanguage)) { + Logger.warning(Util.getPrefix(true) + "&eLoad File: " + Settings.settings_defaultLanguage + ".yml' not found in /lang/ folder. Using /lang/en_US.yml"); + Settings.settings_defaultLanguage = "en_US"; + availableLocales.put(Settings.settings_defaultLanguage, new Lang(plugin, Settings.settings_defaultLanguage, 0)); } plugin.setAvailableLocales(availableLocales); return true; diff --git a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/hook/DiscordSRVHHook.java b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/hook/DiscordSRVHHook.java index c9ecc87..e00bd21 100644 --- a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/hook/DiscordSRVHHook.java +++ b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/hook/DiscordSRVHHook.java @@ -1,7 +1,7 @@ package jss.customjoinandquitmessages.hook; import jss.customjoinandquitmessages.utils.EventUtils; -import jss.customjoinandquitmessages.utils.Logger; +import jss.customjoinandquitmessages.utils.logger.Logger; import jss.customjoinandquitmessages.utils.Settings; import jss.customjoinandquitmessages.utils.Util; import jss.customjoinandquitmessages.utils.interfaces.IHook; diff --git a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/hook/EssentialsXDiscordHook.java b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/hook/EssentialsXDiscordHook.java index 23017fc..908010d 100644 --- a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/hook/EssentialsXDiscordHook.java +++ b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/hook/EssentialsXDiscordHook.java @@ -1,7 +1,7 @@ package jss.customjoinandquitmessages.hook; import jss.customjoinandquitmessages.utils.EventUtils; -import jss.customjoinandquitmessages.utils.Logger; +import jss.customjoinandquitmessages.utils.logger.Logger; import jss.customjoinandquitmessages.utils.Settings; import jss.customjoinandquitmessages.utils.Util; import jss.customjoinandquitmessages.utils.interfaces.IHook; diff --git a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/hook/EssentialsXHook.java b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/hook/EssentialsXHook.java index 08d5c4f..c81d450 100644 --- a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/hook/EssentialsXHook.java +++ b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/hook/EssentialsXHook.java @@ -3,7 +3,7 @@ import com.earth2me.essentials.Essentials; import jss.customjoinandquitmessages.manager.HookManager; import jss.customjoinandquitmessages.utils.EventUtils; -import jss.customjoinandquitmessages.utils.Logger; +import jss.customjoinandquitmessages.utils.logger.Logger; import jss.customjoinandquitmessages.utils.Settings; import jss.customjoinandquitmessages.utils.Util; import jss.customjoinandquitmessages.utils.interfaces.IHook; @@ -12,7 +12,7 @@ public class EssentialsXHook implements IHook { - private HookManager hookManager; + private final HookManager hookManager; private boolean isEnabled; private Essentials essentials; @@ -47,7 +47,4 @@ public boolean isEnabled() { return isEnabled; } - public HookManager getHookManager() { - return hookManager; - } } diff --git a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/hook/LuckPermsHook.java b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/hook/LuckPermsHook.java index 7a89207..0a019fb 100644 --- a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/hook/LuckPermsHook.java +++ b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/hook/LuckPermsHook.java @@ -1,7 +1,7 @@ package jss.customjoinandquitmessages.hook; import jss.customjoinandquitmessages.utils.EventUtils; -import jss.customjoinandquitmessages.utils.Logger; +import jss.customjoinandquitmessages.utils.logger.Logger; import jss.customjoinandquitmessages.utils.Settings; import jss.customjoinandquitmessages.utils.Util; import jss.customjoinandquitmessages.utils.interfaces.IHook; diff --git a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/hook/PlaceholderApiHook.java b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/hook/PlaceholderApiHook.java index 0e06175..7ea947f 100644 --- a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/hook/PlaceholderApiHook.java +++ b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/hook/PlaceholderApiHook.java @@ -2,14 +2,15 @@ import jss.customjoinandquitmessages.manager.HookManager; import jss.customjoinandquitmessages.utils.EventUtils; -import jss.customjoinandquitmessages.utils.Logger; +import jss.customjoinandquitmessages.utils.logger.Logger; import jss.customjoinandquitmessages.utils.Util; import jss.customjoinandquitmessages.utils.interfaces.IHook; import org.bukkit.Bukkit; public class PlaceholderApiHook implements IHook { - private HookManager hooksManager; + @SuppressWarnings("unused") + private final HookManager hooksManager; private boolean isEnabled; public PlaceholderApiHook(HookManager hooksManager) { @@ -31,8 +32,4 @@ public boolean isEnabled() { return this.isEnabled; } - public HookManager getHooksManager() { - return hooksManager; - } - } diff --git a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/hook/SuperVanishHook.java b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/hook/SuperVanishHook.java index eeae565..2465fdb 100644 --- a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/hook/SuperVanishHook.java +++ b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/hook/SuperVanishHook.java @@ -2,7 +2,7 @@ import de.myzelyam.api.vanish.VanishAPI; import jss.customjoinandquitmessages.utils.EventUtils; -import jss.customjoinandquitmessages.utils.Logger; +import jss.customjoinandquitmessages.utils.logger.Logger; import jss.customjoinandquitmessages.utils.Util; import jss.customjoinandquitmessages.utils.interfaces.IHook; import org.bukkit.Bukkit; diff --git a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/listener/InventoryListener.java b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/listener/InventoryListener.java index d89bbae..cdc4b9c 100644 --- a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/listener/InventoryListener.java +++ b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/listener/InventoryListener.java @@ -2,7 +2,7 @@ import jss.customjoinandquitmessages.CustomJoinAndQuitMessages; import jss.customjoinandquitmessages.manager.DisplayManager; -import jss.customjoinandquitmessages.manager.InventoryView; +import jss.customjoinandquitmessages.utils.InventoryView; import org.bukkit.Bukkit; import org.bukkit.entity.Player; import org.bukkit.event.Listener; diff --git a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/listener/TaskLoader.java b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/listener/TaskLoader.java index 05da0b3..6793d6c 100644 --- a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/listener/TaskLoader.java +++ b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/listener/TaskLoader.java @@ -4,7 +4,7 @@ import jss.customjoinandquitmessages.hook.LuckPermsHook; import jss.customjoinandquitmessages.manager.HookManager; import jss.customjoinandquitmessages.manager.PlayerManager; -import jss.customjoinandquitmessages.utils.Logger; +import jss.customjoinandquitmessages.utils.logger.Logger; import jss.customjoinandquitmessages.utils.Settings; import org.bukkit.Bukkit; import org.bukkit.entity.Player; @@ -26,7 +26,7 @@ public void onUpdateGroup() { taskGroupId = scheduler.scheduleSyncRepeatingTask(plugin, () -> { LuckPermsHook luckPermsHook = HookManager.get().getLuckPermsHook(); - if(Settings.c_type.equalsIgnoreCase("group")){ + if(Settings.chatformat_type.equalsIgnoreCase("group")){ if (luckPermsHook.isEnabled() && Settings.hook_luckperms_autoUpdate_group) { for (Player p : Bukkit.getOnlinePlayers()) { diff --git a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/listener/JoinListener.java b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/listener/chat/JoinListener.java similarity index 59% rename from CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/listener/JoinListener.java rename to CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/listener/chat/JoinListener.java index c54e1b0..06866cc 100644 --- a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/listener/JoinListener.java +++ b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/listener/chat/JoinListener.java @@ -1,4 +1,4 @@ -package jss.customjoinandquitmessages.listener; +package jss.customjoinandquitmessages.listener.chat; import com.cryptomorin.xseries.messages.ActionBar; import com.cryptomorin.xseries.messages.Titles; @@ -10,7 +10,7 @@ import jss.customjoinandquitmessages.manager.PlayerManager; import jss.customjoinandquitmessages.update.UpdateChecker; import jss.customjoinandquitmessages.utils.GroupHelper; -import jss.customjoinandquitmessages.utils.Logger; +import jss.customjoinandquitmessages.utils.logger.Logger; import jss.customjoinandquitmessages.utils.Settings; import jss.customjoinandquitmessages.utils.Util; import org.bukkit.Bukkit; @@ -22,7 +22,6 @@ import org.bukkit.event.EventPriority; import org.bukkit.event.Listener; import org.bukkit.event.player.PlayerJoinEvent; -import org.bukkit.event.player.PlayerQuitEvent; import org.jetbrains.annotations.NotNull; import java.util.List; @@ -60,7 +59,7 @@ public void onJoinListener(@NotNull PlayerJoinEvent e) { Logger.debug(" &eLuckPermHook is: " + luckPermsHook.isEnabled()); } - if (Settings.c_type.equalsIgnoreCase("group")){ + if (Settings.chatformat_type.equalsIgnoreCase("group")){ if (luckPermsHook.isEnabled()) { if (!playerManager.getGroup(p).equalsIgnoreCase(Objects.requireNonNull(LuckPermsHook.getApi(). getUserManager().getUser(p.getName())).getPrimaryGroup())) { @@ -72,9 +71,9 @@ public void onJoinListener(@NotNull PlayerJoinEvent e) { } } - boolean isNormal = Settings.c_type.equalsIgnoreCase("normal"); - boolean isGroup = Settings.c_type.equalsIgnoreCase("group"); - boolean isNone = Settings.c_type.equalsIgnoreCase("none"); + boolean isNormal = Settings.chatformat_type.equalsIgnoreCase("normal"); + boolean isGroup = Settings.chatformat_type.equalsIgnoreCase("group"); + boolean isNone = Settings.chatformat_type.equalsIgnoreCase("none"); if (Settings.welcome) { for (String text : Settings.list_welcome) @@ -229,151 +228,11 @@ public void onJoinListener(@NotNull PlayerJoinEvent e) { @EventHandler(priority = EventPriority.HIGH) public void onUpdate(@NotNull PlayerJoinEvent e) { Player p = e.getPlayer(); - if (Settings.update) { + if (Settings.settings_update) { if ((p.isOp()) || (p.hasPermission("cjm.update"))) { new UpdateChecker(CustomJoinAndQuitMessages.get()).sendSpigotUpdate(); } } } - @EventHandler(priority = EventPriority.HIGH) - public void onQuit(@NotNull PlayerQuitEvent e) { - FileConfiguration config = plugin.getConfigFile().getConfig(); - Player p = e.getPlayer(); - - DiscordSRVHHook discordSRVHHook = HookManager.getInstance().getDiscordSRVHHook(); - EssentialsXDiscordHook essentialsXDiscordHook = HookManager.getInstance().getEssentialsXDiscordHook(); - EssentialsXHook essentialsXHook = HookManager.get().getEssentialsXHook(); - SuperVanishHook superVanishHook = HookManager.get().getSuperVanishHook(); - PlayerManager playerManager = new PlayerManager(); - - boolean isNormal = Settings.c_type.equalsIgnoreCase("normal"); - boolean isGroup = Settings.c_type.equalsIgnoreCase("group"); - boolean isNone = Settings.c_type.equalsIgnoreCase("none"); - - if(Util.isVanished(p)){ - e.setQuitMessage(null); - return; - } - - if (superVanishHook.isEnabled()){ - if (superVanishHook.isVanishPlayer(p)){ - e.setQuitMessage(null); - return; - } - } - - if (essentialsXHook.isEnabled()) { - if (Settings.hook_essentials_hidePlayerVanish) { - if (essentialsXHook.isVanish(p)) { - e.setQuitMessage(null); - return; - } - } - } - - if (Settings.quit) { - if (isNormal) { - e.setQuitMessage(null); - - String text = config.getString("Quit.Text"); - - text = Util.color(text); - text = Util.getVar(p, text); - - MessageBuilder messageBuilder = new MessageBuilder(p, text); - - if (config.getBoolean("Config.Show-Chat-In-Console")) { - Logger.info(messageBuilder.getText()); - } - - boolean isHover = config.getBoolean("Quit.HoverEvent.Enabled"); - boolean isClick = config.getBoolean("Quit.ClickEvent.Enabled"); - boolean isSound = config.getBoolean("Quit.Sound.Enabled"); - boolean isSoundAll = config.getBoolean("Quit.Sound.Send-To-All"); - - List Hover_Text = config.getStringList("Quit.HoverEvent.Hover"); - - String isClick_Mode = config.getString("Quit.ClickEvent.Mode"); - String Action_Command = config.getString("Quit.ClickEvent.Actions.Command"); - String Action_Url = config.getString("Quit.ClickEvent.Actions.Url"); - String Action_Suggest = config.getString("Quit.ClickEvent.Actions.Suggest-Command"); - String Sound_Name = config.getString("Quit.Sound.Name"); - - int Sound_Volume = config.getInt("Quit.Sound.Volume"); - float Sound_Pitch = Float.parseFloat(Objects.requireNonNull(config.getString("Quit.Sound.Pitch"))); - - if (isHover) { - if (isClick) { - assert isClick_Mode != null; - if (isClick_Mode.equalsIgnoreCase("command")) { - messageBuilder.setHover(Hover_Text).setExecuteCommand(Action_Command).sendToAll(); - } else if (isClick_Mode.equalsIgnoreCase("url")) { - messageBuilder.setHover(Hover_Text).setOpenURL(Action_Url).sendToAll(); - } else if (isClick_Mode.equalsIgnoreCase("suggest")) { - messageBuilder.setHover(Hover_Text).setSuggestCommand(Action_Suggest).sendToAll(); - } - } else { - messageBuilder.setHover(Hover_Text).sendToAll(); - } - } else { - if (isClick) { - assert isClick_Mode != null; - if (isClick_Mode.equalsIgnoreCase("command")) { - messageBuilder.setExecuteCommand(Action_Command).sendToAll(); - } else if (isClick_Mode.equalsIgnoreCase("url")) { - messageBuilder.setOpenURL(Action_Url).sendToAll(); - } else if (isClick_Mode.equalsIgnoreCase("suggest")) { - messageBuilder.setSuggestCommand(Action_Suggest).sendToAll(); - } - } else { - messageBuilder.sendToAll(); - } - } - - if (discordSRVHHook.isEnabled()) { - if (Settings.hook_discordSrv_channelId.equalsIgnoreCase("none")) - return; - - DiscordUtil.sendMessageBlocking( - DiscordUtil.getTextChannelById(Settings.hook_discordSrv_channelId), - Util.colorless(messageBuilder.getText())); - } - - if (essentialsXDiscordHook.isEnabled()) { - if (Settings.hook_essentialsDiscord_channelId.equalsIgnoreCase("none")) - return; - - essentialsXDiscordHook.sendQuitMessage(Settings.hook_essentialsDiscord_channelId, - Util.colorless(messageBuilder.getText())); - } - - try { - if (isSound) { - if (isSoundAll) { - Location location = p.getLocation(); - p.playSound(location, Sound.valueOf(Sound_Name), Sound_Volume, Sound_Pitch); - } else { - for (Player pp : Bukkit.getOnlinePlayers()) { - Location location = p.getLocation(); - pp.playSound(location, Sound.valueOf(Sound_Name), Sound_Volume, Sound_Pitch); - } - } - } - } catch (Exception ex) { - Logger.warning("&eVerify that the sound name is correct or belongs to the version"); - } - } else if (isGroup) { - e.setQuitMessage(null); - GroupHelper groupHelper = GroupHelper.get(); - groupHelper.setGroup(playerManager.getGroup(p)); - groupHelper.setDiscord(discordSRVHHook); - groupHelper.setEssentials(essentialsXDiscordHook); - groupHelper.onQuit(p, config); - } else if (isNone) { - e.setQuitMessage(null); - } - } - } - } diff --git a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/listener/chat/QuitListener.java b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/listener/chat/QuitListener.java new file mode 100644 index 0000000..04afe1e --- /dev/null +++ b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/listener/chat/QuitListener.java @@ -0,0 +1,178 @@ +package jss.customjoinandquitmessages.listener.chat; + +import github.scarsz.discordsrv.util.DiscordUtil; +import jss.customjoinandquitmessages.CustomJoinAndQuitMessages; +import jss.customjoinandquitmessages.hook.DiscordSRVHHook; +import jss.customjoinandquitmessages.hook.EssentialsXDiscordHook; +import jss.customjoinandquitmessages.hook.EssentialsXHook; +import jss.customjoinandquitmessages.hook.SuperVanishHook; +import jss.customjoinandquitmessages.json.MessageBuilder; +import jss.customjoinandquitmessages.manager.HookManager; +import jss.customjoinandquitmessages.manager.PlayerManager; +import jss.customjoinandquitmessages.utils.GroupHelper; +import jss.customjoinandquitmessages.utils.logger.Logger; +import jss.customjoinandquitmessages.utils.Settings; +import jss.customjoinandquitmessages.utils.Util; +import org.bukkit.Bukkit; +import org.bukkit.Location; +import org.bukkit.Sound; +import org.bukkit.configuration.file.FileConfiguration; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.Listener; +import org.bukkit.event.player.PlayerQuitEvent; +import org.jetbrains.annotations.NotNull; + +import java.util.List; +import java.util.Objects; + +public class QuitListener implements Listener { + + private final CustomJoinAndQuitMessages plugin = CustomJoinAndQuitMessages.get(); + + public QuitListener() { + Bukkit.getPluginManager().registerEvents(this, plugin); + } + + @EventHandler(priority = EventPriority.HIGH) + public void onQuit(@NotNull PlayerQuitEvent e) { + FileConfiguration config = plugin.getConfigFile().getConfig(); + Player p = e.getPlayer(); + + DiscordSRVHHook discordSRVHHook = HookManager.getInstance().getDiscordSRVHHook(); + EssentialsXDiscordHook essentialsXDiscordHook = HookManager.getInstance().getEssentialsXDiscordHook(); + EssentialsXHook essentialsXHook = HookManager.get().getEssentialsXHook(); + SuperVanishHook superVanishHook = HookManager.get().getSuperVanishHook(); + PlayerManager playerManager = new PlayerManager(); + + boolean isNormal = Settings.chatformat_type.equalsIgnoreCase("normal"); + boolean isGroup = Settings.chatformat_type.equalsIgnoreCase("group"); + boolean isNone = Settings.chatformat_type.equalsIgnoreCase("none"); + + if(Util.isVanished(p)){ + e.setQuitMessage(null); + return; + } + + if (superVanishHook.isEnabled()){ + if (superVanishHook.isVanishPlayer(p)){ + e.setQuitMessage(null); + return; + } + } + + if (essentialsXHook.isEnabled()) { + if (Settings.hook_essentials_hidePlayerVanish) { + if (essentialsXHook.isVanish(p)) { + e.setQuitMessage(null); + return; + } + } + } + + if (Settings.quit) { + if (isNormal) { + e.setQuitMessage(null); + + String text = config.getString("Quit.Text"); + + text = Util.color(text); + text = Util.getVar(p, text); + + MessageBuilder messageBuilder = new MessageBuilder(p, text); + + if (config.getBoolean("Config.Show-Chat-In-Console")) { + Logger.info(messageBuilder.getText()); + } + + boolean isHover = config.getBoolean("Quit.HoverEvent.Enabled"); + boolean isClick = config.getBoolean("Quit.ClickEvent.Enabled"); + boolean isSound = config.getBoolean("Quit.Sound.Enabled"); + boolean isSoundAll = config.getBoolean("Quit.Sound.Send-To-All"); + + List Hover_Text = config.getStringList("Quit.HoverEvent.Hover"); + + String isClick_Mode = config.getString("Quit.ClickEvent.Mode"); + String Action_Command = config.getString("Quit.ClickEvent.Actions.Command"); + String Action_Url = config.getString("Quit.ClickEvent.Actions.Url"); + String Action_Suggest = config.getString("Quit.ClickEvent.Actions.Suggest-Command"); + String Sound_Name = config.getString("Quit.Sound.Name"); + + int Sound_Volume = config.getInt("Quit.Sound.Volume"); + float Sound_Pitch = Float.parseFloat(Objects.requireNonNull(config.getString("Quit.Sound.Pitch"))); + + if (isHover) { + if (isClick) { + assert isClick_Mode != null; + if (isClick_Mode.equalsIgnoreCase("command")) { + messageBuilder.setHover(Hover_Text).setExecuteCommand(Action_Command).sendToAll(); + } else if (isClick_Mode.equalsIgnoreCase("url")) { + messageBuilder.setHover(Hover_Text).setOpenURL(Action_Url).sendToAll(); + } else if (isClick_Mode.equalsIgnoreCase("suggest")) { + messageBuilder.setHover(Hover_Text).setSuggestCommand(Action_Suggest).sendToAll(); + } + } else { + messageBuilder.setHover(Hover_Text).sendToAll(); + } + } else { + if (isClick) { + assert isClick_Mode != null; + if (isClick_Mode.equalsIgnoreCase("command")) { + messageBuilder.setExecuteCommand(Action_Command).sendToAll(); + } else if (isClick_Mode.equalsIgnoreCase("url")) { + messageBuilder.setOpenURL(Action_Url).sendToAll(); + } else if (isClick_Mode.equalsIgnoreCase("suggest")) { + messageBuilder.setSuggestCommand(Action_Suggest).sendToAll(); + } + } else { + messageBuilder.sendToAll(); + } + } + + if (discordSRVHHook.isEnabled()) { + if (Settings.hook_discordSrv_channelId.equalsIgnoreCase("none")) + return; + + DiscordUtil.sendMessageBlocking( + DiscordUtil.getTextChannelById(Settings.hook_discordSrv_channelId), + Util.colorless(messageBuilder.getText())); + } + + if (essentialsXDiscordHook.isEnabled()) { + if (Settings.hook_essentialsDiscord_channelId.equalsIgnoreCase("none")) + return; + + essentialsXDiscordHook.sendQuitMessage(Settings.hook_essentialsDiscord_channelId, + Util.colorless(messageBuilder.getText())); + } + + try { + if (isSound) { + if (isSoundAll) { + Location location = p.getLocation(); + p.playSound(location, Sound.valueOf(Sound_Name), Sound_Volume, Sound_Pitch); + } else { + for (Player pp : Bukkit.getOnlinePlayers()) { + Location location = p.getLocation(); + pp.playSound(location, Sound.valueOf(Sound_Name), Sound_Volume, Sound_Pitch); + } + } + } + } catch (Exception ex) { + Logger.warning("&eVerify that the sound name is correct or belongs to the version"); + } + } else if (isGroup) { + e.setQuitMessage(null); + GroupHelper groupHelper = GroupHelper.get(); + groupHelper.setGroup(playerManager.getGroup(p)); + groupHelper.setDiscord(discordSRVHHook); + groupHelper.setEssentials(essentialsXDiscordHook); + groupHelper.onQuit(p, config); + } else if (isNone) { + e.setQuitMessage(null); + } + } + } + +} diff --git a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/manager/DisplayManager.java b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/manager/DisplayManager.java index 0d0d827..f896af8 100644 --- a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/manager/DisplayManager.java +++ b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/manager/DisplayManager.java @@ -4,7 +4,7 @@ import com.cryptomorin.xseries.messages.Titles; import jss.customjoinandquitmessages.CustomJoinAndQuitMessages; import jss.customjoinandquitmessages.json.MessageBuilder; -import jss.customjoinandquitmessages.utils.Logger; +import jss.customjoinandquitmessages.utils.logger.Logger; import jss.customjoinandquitmessages.utils.Settings; import jss.customjoinandquitmessages.utils.Util; import org.bukkit.configuration.file.FileConfiguration; diff --git a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/manager/GroupManager.java b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/manager/GroupManager.java index fa3fd84..71f8504 100644 --- a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/manager/GroupManager.java +++ b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/manager/GroupManager.java @@ -1,7 +1,6 @@ package jss.customjoinandquitmessages.manager; import jss.customjoinandquitmessages.CustomJoinAndQuitMessages; -import jss.customjoinandquitmessages.utils.Logger; import org.bukkit.configuration.file.FileConfiguration; import org.jetbrains.annotations.Contract; import org.jetbrains.annotations.NotNull; @@ -25,10 +24,6 @@ public Set getGroupList() { } public boolean existsGroup(String group) { - if(group != null){ - Logger.error("&cGroup could not be found: &e" + group); - return false; - } return getGroupList().contains(group); } @@ -112,13 +107,12 @@ public String getClickSuggestCommand(String group) { return null; } - public boolean isTitle(String group){ - boolean istitle = false; + boolean isTitle = false; if (existsGroup(group)) { - istitle = config.getBoolean(group + ".Title.Enabled"); + isTitle = config.getBoolean(group + ".Title.Enabled"); } - return istitle; + return isTitle; } public String getTitle(String group){ @@ -157,11 +151,11 @@ public int getFadeOut(String group){ } public boolean isActionbar(String group){ - boolean isactionbar = false; + boolean isActionBar = false; if(existsGroup(group)) { - isactionbar = config.getBoolean(group + ".Actionbar.Enabled"); + isActionBar = config.getBoolean(group + ".Actionbar.Enabled"); } - return isactionbar; + return isActionBar; } public String getActionbar(String group){ @@ -172,19 +166,19 @@ public String getActionbar(String group){ } public boolean isSound(String group) { - boolean issound = false; + boolean isSound = false; if(existsGroup(group)) { - issound = config.getBoolean(group + "Sound.Enabled"); + isSound = config.getBoolean(group + "Sound.Enabled"); } - return issound; + return isSound; } public boolean isSoundAll(String group){ - boolean issoundall = false; + boolean isSoundAll = false; if(existsGroup(group)){ - issoundall = config.getBoolean(group + "Sound.Send-To-All"); + isSoundAll = config.getBoolean(group + "Sound.Send-To-All"); } - return issoundall; + return isSoundAll; } public String getSound(String group){ diff --git a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/storage/PlayerJsonStorage.java b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/storage/PlayerJsonStorage.java index 7e10150..308d2a1 100644 --- a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/storage/PlayerJsonStorage.java +++ b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/storage/PlayerJsonStorage.java @@ -31,7 +31,7 @@ public void savePlayerData(@NotNull PlayerData playerData) { e.printStackTrace(); } }else { - System.out.println("archivo no existe, se procede a crearlo"); + try{ file.createNewFile(); FileWriter writer = new FileWriter(file); diff --git a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/update/UpdateChecker.java b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/update/UpdateChecker.java index 2d7d168..3e9e231 100644 --- a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/update/UpdateChecker.java +++ b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/update/UpdateChecker.java @@ -3,7 +3,7 @@ import com.google.gson.Gson; import com.google.gson.JsonObject; import jss.customjoinandquitmessages.CustomJoinAndQuitMessages; -import jss.customjoinandquitmessages.utils.Logger; +import jss.customjoinandquitmessages.utils.logger.Logger; import jss.customjoinandquitmessages.utils.Util; import org.bukkit.Bukkit; import org.jetbrains.annotations.NotNull; @@ -28,12 +28,12 @@ public void sendGithubUpdate(){ if (plugin.getDescription().getVersion().equalsIgnoreCase(version)) { Logger.success("&a" + plugin.name + " is up to date!"); } else { - Logger.outLine("&5<||" + Util.setLine("&5")); + Logger.outLine("&5<||" + Util.setLine()); Logger.warning("&5<||&b" + plugin.name + " is outdated!"); Logger.warning("&5<||&bNewest version: &a" + version); Logger.warning("&5<||&bYour version: &d" + UpdateSettings.VERSION); Logger.warning("&5<||&bUpdate Here on Github: &e" + UpdateSettings.URL_PlUGIN[1]); - Logger.outLine("&5<||" + Util.setLine("&5")); + Logger.outLine("&5<||" + Util.setLine()); } }); } @@ -43,12 +43,12 @@ public void sendSpigotUpdate(){ if (plugin.getDescription().getVersion().equalsIgnoreCase(version)) { Logger.success("&a" + plugin.name + " is up to date!"); } else { - Logger.outLine("&5<||" + Util.setLine("&5")); + Logger.outLine("&5<||" + Util.setLine()); Logger.warning("&5<||&b" + plugin.name + " is outdated!"); Logger.warning("&5<||&bNewest version: &a" + version); Logger.warning("&5<||&bYour version: &d" + UpdateSettings.VERSION); Logger.warning("&5<||&bUpdate Here on Spigot: &e" + UpdateSettings.URL_PlUGIN[0]); - Logger.outLine("&5<||" + Util.setLine("&5")); + Logger.outLine("&5<||" + Util.setLine()); } }); } diff --git a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/utils/GroupHelper.java b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/utils/GroupHelper.java index a41bc3a..ab4ae8c 100644 --- a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/utils/GroupHelper.java +++ b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/utils/GroupHelper.java @@ -7,6 +7,7 @@ import jss.customjoinandquitmessages.hook.EssentialsXDiscordHook; import jss.customjoinandquitmessages.json.MessageBuilder; import jss.customjoinandquitmessages.manager.GroupManager; +import jss.customjoinandquitmessages.utils.logger.Logger; import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.Sound; diff --git a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/manager/InventoryView.java b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/utils/InventoryView.java similarity index 90% rename from CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/manager/InventoryView.java rename to CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/utils/InventoryView.java index d4eee83..08774bf 100644 --- a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/manager/InventoryView.java +++ b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/utils/InventoryView.java @@ -1,4 +1,4 @@ -package jss.customjoinandquitmessages.manager; +package jss.customjoinandquitmessages.utils; import org.bukkit.entity.Player; diff --git a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/utils/Logger.java b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/utils/Logger.java deleted file mode 100644 index 1848dc5..0000000 --- a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/utils/Logger.java +++ /dev/null @@ -1,31 +0,0 @@ -package jss.customjoinandquitmessages.utils; - -public class Logger { - - public static void error(String msg) { - Util.sendColorConsoleMessage(EventUtils.getStaticConsoleSender(), Util.getPrefix(true) + "&8-> &e[&cERROR&e] &7" + msg); - } - - public static void warning(String msg) { - Util.sendColorConsoleMessage(EventUtils.getStaticConsoleSender(), Util.getPrefix(true) + "&8-> &e[&dWARNING&e] &7" + msg); - } - - public static void info(String msg) { - Util.sendColorConsoleMessage(EventUtils.getStaticConsoleSender(), Util.getPrefix(true) + "&8-> &e[&9INFO&e] &7" + msg); - } - - public static void outLine(String msg) { - Util.sendColorConsoleMessage(EventUtils.getStaticConsoleSender(), Util.getPrefix(true) + "&8-> &e[&bOUTLINE&e] &7" + msg); - } - - public static void success(String msg) { - Util.sendColorConsoleMessage(EventUtils.getStaticConsoleSender(), Util.getPrefix(true) + "&8-> &e[&aSUCCESS&e] &7" + msg); - } - - public static void debug(String msg) { - if(Settings.settings_debug) { - Util.sendColorConsoleMessage(EventUtils.getStaticConsoleSender(), Util.getPrefix(true) + "&8-> &e[&dDEBUG&e] &7" + msg); - } - } - -} diff --git a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/utils/Settings.java b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/utils/Settings.java index 7a2e63f..7836891 100644 --- a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/utils/Settings.java +++ b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/utils/Settings.java @@ -7,14 +7,13 @@ public class Settings { public static String messages_prefix; public static boolean hook_luckperms_autoUpdate_group; //Others - public static String defaultLanguage; + public static String settings_defaultLanguage; public static boolean is_Group_Display; - public static boolean update; - public static String c_type; + public static boolean settings_update; + public static String chatformat_type; public static boolean settings_debug; //Join section - public static boolean join; public static String join_message; diff --git a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/utils/Util.java b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/utils/Util.java index 206c353..d08bd20 100644 --- a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/utils/Util.java +++ b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/utils/Util.java @@ -22,8 +22,8 @@ public class Util { private final static String prefix = getPrefix(true); private static final String PERMISSION_PREFIX = "cjm."; - public static @NotNull String setLine(String color) { - return color(color + "-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-"); + public static @NotNull String setLine() { + return color("-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-"); } public static @NotNull String color(String text) { diff --git a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/utils/logger/FileLogger.java b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/utils/logger/FileLogger.java new file mode 100644 index 0000000..acc4953 --- /dev/null +++ b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/utils/logger/FileLogger.java @@ -0,0 +1,83 @@ +package jss.customjoinandquitmessages.utils.logger; + +import jss.customjoinandquitmessages.CustomJoinAndQuitMessages; +import org.bukkit.Bukkit; +import org.jetbrains.annotations.NotNull; + +import java.io.*; +import java.time.LocalDateTime; +import java.time.format.DateTimeFormatter; + +public class FileLogger { + + private static final CustomJoinAndQuitMessages plugin = CustomJoinAndQuitMessages.get(); + private static final DateTimeFormatter DATE_TIME_FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); + private static final String LOG_DIRECTORY = "plugins/CustomJoinAndQuitMessages/logs"; + + private static void log(String message, Throwable exception) { + String logFileName = LOG_DIRECTORY + "/" + getLogFileName(); + String logMessage = "[" + LocalDateTime.now().format(DATE_TIME_FORMATTER) + "] " + message + System.lineSeparator(); + String stackTrace = ""; + + if (exception != null) { + StringWriter sw = new StringWriter(); + PrintWriter pw = new PrintWriter(sw); + exception.printStackTrace(pw); + stackTrace = sw.toString(); + } + + File logFile = new File(logFileName); + boolean fileExists = logFile.exists(); + + try (BufferedWriter writer = new BufferedWriter(new FileWriter(logFileName, true))) { + if (!fileExists) { + //noinspection ResultOfMethodCallIgnored + logFile.createNewFile(); + createHeadFile(writer); + } + + writer.write(logMessage.replaceAll("&[0-9a-fA-Fklmnor]", "")); + writer.write(stackTrace); + } catch (IOException e) { + e.printStackTrace(); + } + } + + public static void logError(String message, Exception e) { + log("[ERROR] " + message, e); + } + + public static void logWarning(String message) { + log("[WARNING] " + message, null); + } + + public static void logInfo(String message) { + log("[INFO] " + message, null); + } + + public static void logOutLine(String message) { + log("[OUTLINE] " + message, null); + } + + public static void logSuccess(String message) { + log("[SUCCESS] " + message, null); + } + + public static void logDebug(String message) { + log("[DEBUG] " + message, null); + } + + private static void createHeadFile(@NotNull BufferedWriter writer) throws IOException { + writer.write("Plugin version: " + plugin.version + System.lineSeparator()); + writer.write("Java version: " + System.getProperty("java.version") + System.lineSeparator()); + writer.write("Server software: " + Bukkit.getServer().getName() + " " + Bukkit.getServer().getVersion() + System.lineSeparator()); + writer.write("------------------------------" + System.lineSeparator()); + writer.write(System.lineSeparator()); + } + + private static @NotNull String getLogFileName() { + DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd"); + return LocalDateTime.now().format(formatter) + ".log"; + } + +} diff --git a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/utils/logger/Logger.java b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/utils/logger/Logger.java new file mode 100644 index 0000000..693f384 --- /dev/null +++ b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/utils/logger/Logger.java @@ -0,0 +1,44 @@ +package jss.customjoinandquitmessages.utils.logger; + +import jss.customjoinandquitmessages.utils.EventUtils; +import jss.customjoinandquitmessages.utils.Settings; +import jss.customjoinandquitmessages.utils.Util; + +public class Logger { + + public static void error(String msg) { + try{ + Util.sendColorConsoleMessage(EventUtils.getStaticConsoleSender(), Util.getPrefix(true) + "&8: &e[&cERROR&e] &7" + msg); + }catch (Exception e){ + FileLogger.logError(msg, e); + } + } + + public static void warning(String msg) { + Util.sendColorConsoleMessage(EventUtils.getStaticConsoleSender(), Util.getPrefix(true) + "&8: &e[&dWARNING&e] &7" + msg); + FileLogger.logWarning(msg); + } + + public static void info(String msg) { + Util.sendColorConsoleMessage(EventUtils.getStaticConsoleSender(), Util.getPrefix(true) + "&8: &e[&9INFO&e] &7" + msg); + FileLogger.logInfo(msg); + } + + public static void outLine(String msg) { + Util.sendColorConsoleMessage(EventUtils.getStaticConsoleSender(), Util.getPrefix(true) + "&8: &e[&bOUTLINE&e] &7" + msg); + FileLogger.logOutLine(msg); + } + + public static void success(String msg) { + Util.sendColorConsoleMessage(EventUtils.getStaticConsoleSender(), Util.getPrefix(true) + "&8: &e[&aSUCCESS&e] &7" + msg); + FileLogger.logSuccess(msg); + } + + public static void debug(String msg) { + if(Settings.settings_debug) { + Util.sendColorConsoleMessage(EventUtils.getStaticConsoleSender(), Util.getPrefix(true) + "&8: &e[&dDEBUG&e] &7" + msg); + FileLogger.logDebug(msg); + } + } + +} diff --git a/CustomJoinAndQuitMessagesOld/src/main/resources/config.yml b/CustomJoinAndQuitMessagesOld/src/main/resources/config.yml index 04eaa55..a5b9c19 100644 --- a/CustomJoinAndQuitMessagesOld/src/main/resources/config.yml +++ b/CustomJoinAndQuitMessagesOld/src/main/resources/config.yml @@ -64,7 +64,7 @@ Hooks: # |Channel-ID| Here is the id of the channel that is used for the chat Channel-ID: 'none' - # + # |Essentials| Essentials: @@ -254,6 +254,7 @@ Welcome: # |Enabled| Here you can enable or disable this feature Enabled: true + # UsePerGroupWelcome: false # |Text| here you can set your own welcome message when entering diff --git a/bukkit/src/main/java/jss/customjoinandquitmessage/commands/subcommands/DisplayCommand.java b/bukkit/src/main/java/jss/customjoinandquitmessage/commands/subcommands/DisplayCommand.java index fb44164..8144c1e 100644 --- a/bukkit/src/main/java/jss/customjoinandquitmessage/commands/subcommands/DisplayCommand.java +++ b/bukkit/src/main/java/jss/customjoinandquitmessage/commands/subcommands/DisplayCommand.java @@ -3,12 +3,18 @@ import jss.customjoinandquitmessage.commands.utils.SubCommand; import org.bukkit.command.CommandSender; +@SuppressWarnings("unused") public class DisplayCommand extends SubCommand { public String name() { return "display"; } + @Override + public String permission() { + return null; + } + public void onCommand(CommandSender sender, String[] args) { diff --git a/bukkit/src/main/java/jss/customjoinandquitmessage/commands/subcommands/ReloadCommand.java b/bukkit/src/main/java/jss/customjoinandquitmessage/commands/subcommands/ReloadCommand.java index 766db2f..ac38f36 100644 --- a/bukkit/src/main/java/jss/customjoinandquitmessage/commands/subcommands/ReloadCommand.java +++ b/bukkit/src/main/java/jss/customjoinandquitmessage/commands/subcommands/ReloadCommand.java @@ -9,6 +9,11 @@ public String name() { return "reload"; } + @Override + public String permission() { + return null; + } + public void onCommand(CommandSender sender, String[] args) { diff --git a/bukkit/src/main/java/jss/customjoinandquitmessage/files/LangFile.java b/bukkit/src/main/java/jss/customjoinandquitmessage/files/LangFile.java index dbb2686..0e92cac 100644 --- a/bukkit/src/main/java/jss/customjoinandquitmessage/files/LangFile.java +++ b/bukkit/src/main/java/jss/customjoinandquitmessage/files/LangFile.java @@ -8,16 +8,19 @@ import java.io.File; import java.util.Locale; +@SuppressWarnings("ALL") public class LangFile { - private CustomJoinAndQuitMessage plugin; + private final CustomJoinAndQuitMessage plugin; private FileConfiguration config; private File file; + private final Locale localeObj; private final String localeName; - private final int index; + private int index; - public LangFile(@NotNull String localeName, int index){ + public LangFile(CustomJoinAndQuitMessage plugin, @NotNull String localeName, int index){ + this.plugin = plugin; this.index = index; this.localeName = localeName; getConfig(localeName); @@ -25,7 +28,6 @@ public LangFile(@NotNull String localeName, int index){ localeObj = new Locale(localeName.substring(0,2),localeName.substring(3,5)); } - public FileConfiguration getConfig(final String name) { if(config == null){ reload(name); @@ -61,25 +63,4 @@ private void loadMessages(){ } - public String getLocaleName() { - return this.localeName; - } - - public String getLanguageName() { - if (localeObj == null) { - return "unknown"; - } - return localeObj.getDisplayLanguage(localeObj); - } - - public String getCountryName() { - if (localeObj == null) { - return "unknown"; - } - return localeObj.getDisplayCountry(localeObj); - } - - public int getIndex() { - return index; - } } diff --git a/bukkit/src/main/java/jss/customjoinandquitmessage/files/utils/FileList.java b/bukkit/src/main/java/jss/customjoinandquitmessage/files/utils/FileList.java index d58b286..3d1c5fc 100644 --- a/bukkit/src/main/java/jss/customjoinandquitmessage/files/utils/FileList.java +++ b/bukkit/src/main/java/jss/customjoinandquitmessage/files/utils/FileList.java @@ -24,7 +24,7 @@ public List list() throws IOException { List result = new ArrayList<>(); - File dir = new File(plugin.getDataFolder(), "lang"); + File dir = new File(plugin.getDataFolder(), "langs"); if(dir.exists()){ diff --git a/bukkit/src/main/java/jss/customjoinandquitmessage/files/utils/PreConfigLoader.java b/bukkit/src/main/java/jss/customjoinandquitmessage/files/utils/PreConfigLoader.java index e40e8de..3c658e2 100644 --- a/bukkit/src/main/java/jss/customjoinandquitmessage/files/utils/PreConfigLoader.java +++ b/bukkit/src/main/java/jss/customjoinandquitmessage/files/utils/PreConfigLoader.java @@ -1,5 +1,6 @@ package jss.customjoinandquitmessage.files.utils; +import jss.customjoinandquitmessage.CustomJoinAndQuitMessage; import jss.customjoinandquitmessage.files.LangFile; import java.io.IOException; @@ -7,6 +8,9 @@ public class PreConfigLoader { + private final CustomJoinAndQuitMessage plugin = CustomJoinAndQuitMessage.get(); + + @SuppressWarnings("unused") public void loadConfigs(){ Settings.config_Lang = "en_US"; } @@ -18,7 +22,7 @@ public boolean loadLangs(){ try { for(String code : fileList.list()){ - availableLangs.put(code, new LangFile(code, index++)); + availableLangs.put(code, new LangFile(plugin, code, index++)); } } catch (IOException e) { throw new RuntimeException(e); @@ -26,7 +30,7 @@ public boolean loadLangs(){ if(!availableLangs.containsKey(Settings.config_Lang)){ Settings.config_Lang = "en_US"; - availableLangs.put(Settings.config_Lang, new LangFile(Settings.config_Lang,0)); + availableLangs.put(Settings.config_Lang, new LangFile(plugin, Settings.config_Lang,0)); } return true; } diff --git a/bukkit/src/main/java/jss/customjoinandquitmessage/listeners/chat/JoinListener.java b/bukkit/src/main/java/jss/customjoinandquitmessage/listeners/chat/JoinListener.java index 26b1303..7ac28ef 100644 --- a/bukkit/src/main/java/jss/customjoinandquitmessage/listeners/chat/JoinListener.java +++ b/bukkit/src/main/java/jss/customjoinandquitmessage/listeners/chat/JoinListener.java @@ -3,7 +3,6 @@ import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; import org.bukkit.event.player.PlayerJoinEvent; -import org.bukkit.event.player.PlayerQuitEvent; public class JoinListener implements Listener { @@ -15,11 +14,7 @@ public void onJoin(PlayerJoinEvent e){ } @EventHandler - public void onQuit(PlayerQuitEvent e){ - - } - - private void onUpdate(){ + private void onUpdate(PlayerJoinEvent e){ } diff --git a/bukkit/src/main/java/jss/customjoinandquitmessage/listeners/chat/QuitListener.java b/bukkit/src/main/java/jss/customjoinandquitmessage/listeners/chat/QuitListener.java new file mode 100644 index 0000000..7f4574c --- /dev/null +++ b/bukkit/src/main/java/jss/customjoinandquitmessage/listeners/chat/QuitListener.java @@ -0,0 +1,14 @@ +package jss.customjoinandquitmessage.listeners.chat; + +import org.bukkit.event.EventHandler; +import org.bukkit.event.Listener; +import org.bukkit.event.player.PlayerQuitEvent; + +public class QuitListener implements Listener { + + @EventHandler + public void onQuit(PlayerQuitEvent e){ + + } + +} diff --git a/bukkit/src/main/resources/config.yml b/bukkit/src/main/resources/config.yml index efa83b3..6086d79 100644 --- a/bukkit/src/main/resources/config.yml +++ b/bukkit/src/main/resources/config.yml @@ -1,30 +1,153 @@ +# ______ _____ ____ __ ___ +# / ____/ / / | / __ \ / |/ / +# / / __ / / /| |/ / / / / /|_/ / By jonagamerpro1234 +# / /___/ /_/ / ___ / /_/ / / / / / Version ${project.version} +# \____/\____/_/ |_\___\_\/_/ /_/ Thanks for using CustomJoinAndQuitMessage <3 +# +# ● A simple plugin for personalization of the join and quit messages and more... +# +# ● Spigot: https://www.spigotmc.org/resources/custom-join-and-quit-message-1-8-x-1-19-x.57006/ +# ● Discord: https://discord.gg/c5GhQDQCK5 +# ● Issue Tracker: https://github.com/jonagamerpro1234/CustomJoinAndQuitMessages/issues +# ● Plugin Statistics: https://bstats.org/plugin/bukkit/CustomJoinAndQuitMessages/6318 -Lang: en-US +# | Settings | +Settings: + # Shows you important information about the plugin loading + Debug: true + # You can use the available languages of the plugin, or you can add your own translations [ Default = en_US ] + Lang: en_US + + # This function lets you know if there is a plugin update [Does not disable console messages] + Update: + + # Here you can enable or disable this feature + Enabled: true + + # You will get the updates from [spigot | github] what is the difference, here below is the explanation of why + # |Spigot| Get only released updates, and you won't receive beta notifications + # |GitHub| Get only the released and beta updates, and you will be able to receive notifications of both versions + GetFromUpdate: spigot + +# | Hooks | +Hooks: + + # Here you can configure everything related to LuckPerms and or deactivate or activate functions + LuckPerms: + + # Here you can enable or disable this feature + Enabled: true + + # This function allows the plugin to detect if the player has changed rank in a period of time defined in the [Tick] section + AutoUpdateGroup: + + # Here you can enable or disable this feature + Enabled: true + + # Here you can define the time that the actions are automatically executed [Default = 600], 600 tick = 30 sec + Tick: 600 + + # Here you can define the discord channel where the messages from minecraft to discord are seen + DiscordSVR: + + # Here you can enable or disable this feature + Enabled: true + + # Here is the id of the channel that is used for the chat + Channel-Id: "none" + + # Aqui podras cambiar los ajustes de cada implementacion que funciona con EssentialsX + EssentialsX: + + # This allows you to join or quit the server without the message being shown to other players. + HidePlayerIsVanish: true + + # Here you can define the discord channel where the messages from minecraft to discord are seen + # (!) Es necesario tener el plugin de [ EssentialsDiscord ] para que funcione bien todo + EssentialsDiscord: + + # Here you can enable or disable this feature + Enabled: true + + # Here is the id of the channel that is used for the chat + Channel-Id: "none" + + # Usara el canal que se encuentra definido en la configuracion del plugin EssentialsDiscord y ignorara el Channel-Id de CustomJoinAndMessages + UseDefaultChannel: false + + +# | ChatFormat | +# Aqui pordras personalizar los mensajes de entrada y salida del jugador y tambien podras personalizar los mensajes con diversas funciones +# (!) Para personalizacion de grupos es necesario que cambie el tipo a [ group ] ChatFormat: # Esta funcion desactiva el formato personalizado del plugin y usa el metodo setFormat de spigot, pero no funcionaran los eventos de Hover y Click # [!] Esto permite tener una mejor compatibilidad con otros plugins pero deshabilita algunas funciones del plugin + # [!] Esta funcion es experimental, lo que significa que puede sufrir varios cambios o incluso puede ser eliminada definitivamente UsaLegacyFormat: false + # Here you can enable or disable the chat to be seen in the console + ShowChatInConsole: true + + # Aqui podras configurar el tipo del formato los cuales son + # |normal| Sirve para la personalizacion general de todos los jugadores de los mensajes de entrada y salida, esto no permite usar las funciones de grupo + # |group| Sirve para la personalizacion por gropu y desabilita la personalizacion general y permite una personalizacion mejor para cada grupo + # (!) Es necesario tener LuckPerms para usar la personalizacion de grupo + Type: normal + + # | Join | Join: + # Here you can enable or disable this feature Enabled: true - Format: "" + # Aqui puedes definir el mensaje de entra + Format: "&e[&a+&e] &3{player} &7has joined the server" + # | First Join | First-Join: + # Here you can enable or disable this feature Enabled: true - Format: "" + Format: "&3Welcome to the server, we hope you enjoy your time here and have a good time" + # | Quit | Quit: + # Here you can enable or disable this feature Enabled: true - Format: + # Aqui puedes definir el mensaje de salida + Format: "&e[&c-&e] &3{player} &7has left the server" + +# |Welcome| +Welcome: + + # Here you can enable or disable this feature + Enabled: true + + # Permite usa un mensaje de bienvenida por grupo y desactiva el mensaje general de bienvenida + UsePerGroupWelcome: false + + # Here you can set your own welcome message when entering + Text: + - '&m=========================================&r' + - '<0>' + - '&e> &7Welcome To The Server &b' + - '<0>' + - '&e> &cShop: shop-example.com' + - '&e> &7Use &b/skin to put on a skin' + - '<0>' + - '&m=========================================&r' +# I would not change anything +File-Version: 4 -File-Version: 1 \ No newline at end of file +# |> This is the end of the configuration... [-_-] more things coming soon +# +# | Config File | +# | Version 1.8 | +# \ No newline at end of file diff --git a/bukkit/src/main/resources/groups.yml b/bukkit/src/main/resources/groups.yml new file mode 100644 index 0000000..d3d3657 --- /dev/null +++ b/bukkit/src/main/resources/groups.yml @@ -0,0 +1,128 @@ +default: + + HideOtherGroups: + + Enabled: true + + List: + - admin + + Welcome: + + Enabled: true + + Text: + - "" + + FirstJoin: + + Enabled: true + + Message: "" + + Join: + + Enabled: true + + JoinMessage: "[+] {player} {group}" + + HoverEvent: + + Enabled: true + + # + HoverText: + - "" + - "" + - "" + + # + ClickEvent: + + # + Enabled: true + + # + Actions: + - "[EXECUTE]: /cjm help" + - "[SUGGEST]: /cjm" + - "[OPEN_URL]: ---" + + Title: + + Enabled: true + + Title: "" + + SubTitle: "" + + FadeIn: 20 + + Stay: 80 + + FadeOut: 20 + + ActionBar: + + Enabled: true + + Message: "" + + Sound: + + Enabled: true + + SendToAll: true + + # This is the name of the sound you will hear when it is mentioned to you in chat. + Name: 'BLOCK_NOTE_BLOCK_PLING' + + # This is the pitch of the sound that you will hear when mentioned in the chat + Pitch: 1 + + # This is the volume of the sound that you will hear when the chat mentions it + Volume: 10 + + Quit: + + Enabled: true + + QuitMessage: "[-] {player} {group}" + + HoverEvent: + + Enabled: true + + # + HoverText: + - "" + - "" + - "" + + # + ClickEvent: + + # + Enabled: true + + # + Actions: + - "[EXECUTE]: /cjm help" + - "[SUGGEST]: /cjm" + - "[OPEN_URL]: ---" + + Sound: + + Enabled: true + + # When active, the sound will be sent to all players connected to the server + SendToAll: true + + # This is the name of the sound you will hear when it is mentioned to you in chat. + Name: 'BLOCK_NOTE_BLOCK_PLING' + + # This is the pitch of the sound that you will hear when mentioned in the chat + Pitch: 1 + + # This is the volume of the sound that you will hear when the chat mentions it + Volume: 10 \ No newline at end of file diff --git a/bukkit/src/main/resources/plugin.yml b/bukkit/src/main/resources/plugin.yml index c219a09..17b3e40 100644 --- a/bukkit/src/main/resources/plugin.yml +++ b/bukkit/src/main/resources/plugin.yml @@ -1,7 +1,40 @@ -name: CustomJoinAndQuitMessage +name: CustomJoinAndQuitMessages version: '${project.version}' main: jss.customjoinandquitmessage.CustomJoinAndQuitMessage api-version: 1.16 -prefix: CustomJoinAndQuitMessage +prefix: CustomJoinAndQuitMessages loadbefore: [ Essentials ] -softdepend: [ PlaceholderAPI, LuckPerms, DiscordSRV, Essentials, EssentialsDiscord ] +softdepend: [ + PlaceholderAPI, DiscordSRV, + LuckPerms, EssentialsDiscord, + Essentials, SuperVanish, + PremiumVanish +] + +commands: + customjoinandquitmessages: + description: the main command + aliases: + - cjm + +permissions: + cjm.admin: + description: give all permission of plugin + children: + cjm.update: true + cjm.command.reload: true + cjm.command.help: true + cjm.command.tabcomplete: true + default: op + cjm.update: + description: allows you to receive notifications of available updates + default: op + cjm.command.reload: + description: allows to use the reload command + default: op + cjm.command.help: + description: gives access to the plugin help command + default: op + cjm.command.tabcomplete: + description: allows you to see the list of available commands + default: op diff --git a/patches/Update_config.patch b/patches/Update_config.patch new file mode 100644 index 0000000..9ece5c4 --- /dev/null +++ b/patches/Update_config.patch @@ -0,0 +1,1807 @@ +Index: CustomJoinAndQuitMessagesOld/src/main/resources/config.yml +IDEA additional info: +Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +<+>UTF-8 +=================================================================== +diff --git a/CustomJoinAndQuitMessagesOld/src/main/resources/config.yml b/CustomJoinAndQuitMessagesOld/src/main/resources/config.yml +--- a/CustomJoinAndQuitMessagesOld/src/main/resources/config.yml (revision e3e6f528ca2c93af4251b9955aa457aff0fd3a62) ++++ b/CustomJoinAndQuitMessagesOld/src/main/resources/config.yml (revision 3ebdfb92a2bbde47af6d6a9c7eaa2d8195f92df5) +@@ -13,7 +13,7 @@ + # + Config: + +- # |Lang| you can use the available languages of the plugin, or you can add your own translations [ Default = en-US ] ++ # |Lang| you can use the available languages of the plugin, or you can add your own translations [ Default = en_US ] + Lang: en_US + + # |Update| This function lets you know if there is a plugin update [Does not disable console messages] +Index: patches/Removed_method_getType_of_the_GroupManager_class.patch +IDEA additional info: +Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +<+>UTF-8 +=================================================================== +diff --git a/patches/Removed_method_getType_of_the_GroupManager_class.patch b/patches/Removed_method_getType_of_the_GroupManager_class.patch +new file mode 100644 +--- /dev/null (revision 3ebdfb92a2bbde47af6d6a9c7eaa2d8195f92df5) ++++ b/patches/Removed_method_getType_of_the_GroupManager_class.patch (revision 3ebdfb92a2bbde47af6d6a9c7eaa2d8195f92df5) +@@ -0,0 +1,1780 @@ ++Index: CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/manager/GroupManager.java ++IDEA additional info: ++Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP ++<+>UTF-8 ++=================================================================== ++diff --git a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/manager/GroupManager.java b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/manager/GroupManager.java ++--- a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/manager/GroupManager.java (revision 6f51455f26ef7aad69f1b9446a2a31237d1f5040) +++++ b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/manager/GroupManager.java (revision e3e6f528ca2c93af4251b9955aa457aff0fd3a62) ++@@ -77,11 +77,11 @@ ++ } ++ ++ public boolean isClick(String group) { ++- boolean isclick = false; +++ boolean isClick = false; ++ if (existsGroup(group)) { ++- isclick = config.getBoolean(group + ".ClickEvent.Enabled"); +++ isClick = config.getBoolean(group + ".ClickEvent.Enabled"); ++ } ++- return isclick; +++ return isClick; ++ } ++ ++ public String getClickMode(String group) { ++@@ -112,12 +112,6 @@ ++ return null; ++ } ++ ++- public String getType(String group){ ++- if (existsGroup(group)) { ++- return config.getString(group + ".Type"); ++- } ++- return null; ++- } ++ ++ public boolean isTitle(String group){ ++ boolean istitle = false; ++Index: patches/Fixed_PlayerStorageData.patch ++IDEA additional info: ++Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP ++<+>UTF-8 ++=================================================================== ++diff --git a/patches/Fixed_PlayerStorageData.patch b/patches/Fixed_PlayerStorageData.patch ++new file mode 100644 ++--- /dev/null (revision e3e6f528ca2c93af4251b9955aa457aff0fd3a62) +++++ b/patches/Fixed_PlayerStorageData.patch (revision e3e6f528ca2c93af4251b9955aa457aff0fd3a62) ++@@ -0,0 +1,1734 @@ +++Index: CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/CustomJoinAndQuitMessages.java +++IDEA additional info: +++Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +++<+>UTF-8 +++=================================================================== +++diff --git a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/CustomJoinAndQuitMessages.java b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/CustomJoinAndQuitMessages.java +++--- a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/CustomJoinAndQuitMessages.java (revision 5436229cc153c4aec4cd6267d80f1e8301022990) ++++++ b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/CustomJoinAndQuitMessages.java (revision 6f51455f26ef7aad69f1b9446a2a31237d1f5040) +++@@ -28,7 +28,6 @@ +++ +++ private static CustomJoinAndQuitMessages plugin; +++ public Metrics metrics; +++- public boolean useLatestversion; +++ private final PluginDescriptionFile jss = getDescription(); +++ public String name = this.jss.getName(); +++ public String version = this.jss.getVersion(); +++@@ -46,7 +45,7 @@ +++ Util.sendLoadTitle(version); +++ inventoryViews = new ArrayList<>(); +++ +++- Util.createFolder(this,"Players"); ++++ //Util.createFolder(this,"Players"); +++ } +++ +++ public void onEnable() { +++Index: CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/listener/JoinListener.java +++IDEA additional info: +++Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +++<+>UTF-8 +++=================================================================== +++diff --git a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/listener/JoinListener.java b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/listener/JoinListener.java +++--- a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/listener/JoinListener.java (revision 5436229cc153c4aec4cd6267d80f1e8301022990) ++++++ b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/listener/JoinListener.java (revision 6f51455f26ef7aad69f1b9446a2a31237d1f5040) +++@@ -8,8 +8,6 @@ +++ import jss.customjoinandquitmessages.json.MessageBuilder; +++ import jss.customjoinandquitmessages.manager.HookManager; +++ import jss.customjoinandquitmessages.manager.PlayerManager; +++-import jss.customjoinandquitmessages.storage.PlayerData; +++-import jss.customjoinandquitmessages.storage.PlayerJsonStorage; +++ import jss.customjoinandquitmessages.update.UpdateChecker; +++ import jss.customjoinandquitmessages.utils.GroupHelper; +++ import jss.customjoinandquitmessages.utils.Logger; +++@@ -55,13 +53,6 @@ +++ tempGroup = "default"; +++ } +++ +++- PlayerJsonStorage playerJsonStorage = new PlayerJsonStorage(plugin); +++- PlayerData playerData = playerJsonStorage.loadPlayerData(p.getName()); +++- +++- if(playerData == null){ +++- playerJsonStorage.savePlayerData(new PlayerData(p.getName())); +++- } +++- +++ PlayerManager playerManager = new PlayerManager(); +++ playerManager.createPlayer(p, tempGroup); +++ +++@@ -245,7 +236,7 @@ +++ } +++ } +++ +++- @EventHandler ++++ @EventHandler(priority = EventPriority.HIGH) +++ public void onQuit(@NotNull PlayerQuitEvent e) { +++ FileConfiguration config = plugin.getConfigFile().getConfig(); +++ Player p = e.getPlayer(); +++Index: patches/Removed_types_normal_and_modify_of_Join_and_Quit_and_more_.patch +++IDEA additional info: +++Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +++<+>UTF-8 +++=================================================================== +++diff --git a/patches/Removed_types_normal_and_modify_of_Join_and_Quit_and_more_.patch b/patches/Removed_types_normal_and_modify_of_Join_and_Quit_and_more_.patch +++new file mode 100644 +++--- /dev/null (revision 6f51455f26ef7aad69f1b9446a2a31237d1f5040) ++++++ b/patches/Removed_types_normal_and_modify_of_Join_and_Quit_and_more_.patch (revision 6f51455f26ef7aad69f1b9446a2a31237d1f5040) +++@@ -0,0 +1,1659 @@ ++++Index: CustomJoinAndQuitMessagesOld/pom.xml ++++IDEA additional info: ++++Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP ++++<+>UTF-8 ++++=================================================================== ++++diff --git a/CustomJoinAndQuitMessagesOld/pom.xml b/CustomJoinAndQuitMessagesOld/pom.xml ++++--- a/CustomJoinAndQuitMessagesOld/pom.xml (revision 60d9051d52d70ed86db8e0fc1a50da61f395e55a) +++++++ b/CustomJoinAndQuitMessagesOld/pom.xml (revision 5436229cc153c4aec4cd6267d80f1e8301022990) ++++@@ -9,7 +9,7 @@ ++++ ++++ ++++ CustomJoinAndQuitMessagesOld ++++- 1.7.8-release +++++ 1.7.9-release ++++ ++++ ++++ 8 ++++Index: CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/commands/CustomJoinAndQuitCmd.java ++++IDEA additional info: ++++Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP ++++<+>UTF-8 ++++=================================================================== ++++diff --git a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/commands/CustomJoinAndQuitCmd.java b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/commands/CustomJoinAndQuitCmd.java ++++--- a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/commands/CustomJoinAndQuitCmd.java (revision 60d9051d52d70ed86db8e0fc1a50da61f395e55a) +++++++ b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/commands/CustomJoinAndQuitCmd.java (revision 5436229cc153c4aec4cd6267d80f1e8301022990) ++++@@ -58,7 +58,7 @@ ++++ if (args.length >= 1) { ++++ ++++ if (args[0].equalsIgnoreCase("help")) { ++++- if ((j.isOp()) || (j.hasPermission("Cjm.Help"))) { +++++ if ((j.isOp()) || (j.hasPermission("cjm.command.help"))) { ++++ Util.sendColorMessage(j, "&5-=-=-=-=-=-=-=-=-=-=-=&6[&d" + plugin.name + "&6]&5=-=-=-=-=-=-=-=-=-=-=-"); ++++ for (String text : plugin.Locale().help_1) { ++++ Util.sendColorMessage(j, text); ++++@@ -71,7 +71,7 @@ ++++ } ++++ ++++ if (args[0].equalsIgnoreCase("reload") || args[0].equalsIgnoreCase("rl")) { ++++- if ((j.isOp()) || (j.hasPermission("Cjm.Reload"))) { +++++ if ((j.isOp()) || (j.hasPermission(" cjm.command.reload"))) { ++++ plugin.reloadAllFiles(); ++++ Util.sendColorMessage(j, Util.getPrefix(false) + plugin.Locale().reload); ++++ } else { ++++Index: CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/config/utils/PreConfigLoader.java ++++IDEA additional info: ++++Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP ++++<+>UTF-8 ++++=================================================================== ++++diff --git a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/config/utils/PreConfigLoader.java b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/config/utils/PreConfigLoader.java ++++--- a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/config/utils/PreConfigLoader.java (revision 60d9051d52d70ed86db8e0fc1a50da61f395e55a) +++++++ b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/config/utils/PreConfigLoader.java (revision 5436229cc153c4aec4cd6267d80f1e8301022990) ++++@@ -32,7 +32,6 @@ ++++ //Join ++++ Settings.join = Objects.equals(config.getString("Join.Enabled"), "true"); ++++ Settings.join_message = config.getString("Join.Text"); ++++- Settings.join_type = config.getString("Join.Type"); ++++ ++++ Settings.firstjoin = Objects.equals(config.getString("Join.First-Join.Enabled"), "true"); ++++ Settings.join_message_first = config.getString("Join.First-Join.Text"); ++++@@ -43,9 +42,9 @@ ++++ Settings.join_message_title_title = config.getString("Join.Title.Title"); ++++ Settings.join_message_title_subtitle = config.getString("Join.Title.SubTitle"); ++++ ++++- Settings.join_title_fadein = config.getInt("Join.Title.FadeIn"); +++++ Settings.join_title_fadeIn = config.getInt("Join.Title.FadeIn"); ++++ Settings.join_title_stay = config.getInt("Join.Title.Stay"); ++++- Settings.join_title_fadeout = config.getInt("Join.Title.FadeOut"); +++++ Settings.join_title_fadeOut = config.getInt("Join.Title.FadeOut"); ++++ ++++ Settings.join_sound = Objects.equals(config.getString("Join.Sound.Enabled"), "true"); ++++ Settings.join_sound_name = config.getString("Join.Sound.Name"); ++++@@ -54,7 +53,6 @@ ++++ ++++ //Quit ++++ Settings.quit = Objects.equals(config.getString("Quit.Enabled"), "true"); ++++- Settings.quit_type = config.getString("Quit.Type"); ++++ Settings.quit_message = config.getString("Quit.Text"); ++++ ++++ //Welcome ++++@@ -62,11 +60,11 @@ ++++ Settings.list_welcome = config.getStringList("Welcome.Text"); ++++ ++++ //Hooks ++++- Settings.hook_discordsrv = Objects.equals(config.getString("Hooks.DiscordSRV.Enabled"), "true"); ++++- Settings.hook_discordsrv_channelid = config.getString("Hooks.DiscordSRV.Channel-ID"); +++++ Settings.hook_discordSrv = Objects.equals(config.getString("Hooks.DiscordSRV.Enabled"), "true"); +++++ Settings.hook_discordSrv_channelId = config.getString("Hooks.DiscordSRV.Channel-ID"); ++++ ++++ Settings.hook_essentialsDiscord = Objects.equals(config.getString("Hooks.EssentialsDiscord.Enabled"), "true"); ++++- Settings.hook_essentialsDiscord_channelid = config.getString("Hooks.EssentialsDiscord.Channel-ID"); +++++ Settings.hook_essentialsDiscord_channelId = config.getString("Hooks.EssentialsDiscord.Channel-ID"); ++++ Settings.hook_essentialsDiscord_use_default_channel = config.getBoolean("Hooks.EssentialsDiscord.Use-Default-Channel"); ++++ ++++ Settings.hook_luckperms = config.getBoolean("Hooks.LuckPerms.Enabled"); ++++@@ -74,7 +72,7 @@ ++++ Settings.hook_luckperms_autoUpdate_group_tick = config.getLong("Hooks.LuckPerms.AutoUpdateGroup.Tick"); ++++ ++++ Settings.hook_essentials = Objects.equals(config.getString("Hooks.Essentials.Enabled"), "true"); ++++- Settings.hook_essentials_hideplayervanish = config.getBoolean("Hooks.Essentials.HidePlayerIsVanish"); +++++ Settings.hook_essentials_hidePlayerVanish = config.getBoolean("Hooks.Essentials.HidePlayerIsVanish"); ++++ ++++ } catch (Exception e) { ++++ Logger.error("&cThere was an error loading the &b[PreConfigLoader]&7, please reload the plugin"); ++++Index: CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/hook/DiscordSRVHHook.java ++++IDEA additional info: ++++Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP ++++<+>UTF-8 ++++=================================================================== ++++diff --git a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/hook/DiscordSRVHHook.java b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/hook/DiscordSRVHHook.java ++++--- a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/hook/DiscordSRVHHook.java (revision 60d9051d52d70ed86db8e0fc1a50da61f395e55a) +++++++ b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/hook/DiscordSRVHHook.java (revision 5436229cc153c4aec4cd6267d80f1e8301022990) ++++@@ -1,6 +1,5 @@ ++++ package jss.customjoinandquitmessages.hook; ++++ ++++-import jss.customjoinandquitmessages.manager.HookManager; ++++ import jss.customjoinandquitmessages.utils.EventUtils; ++++ import jss.customjoinandquitmessages.utils.Logger; ++++ import jss.customjoinandquitmessages.utils.Settings; ++++@@ -10,13 +9,8 @@ ++++ ++++ public class DiscordSRVHHook implements IHook { ++++ ++++- private HookManager hookManager; ++++ private boolean isEnabled; ++++ ++++- public DiscordSRVHHook(HookManager hookManager) { ++++- this.hookManager = hookManager; ++++- } ++++- ++++ public void setup() { ++++ if (!Bukkit.getPluginManager().isPluginEnabled("DiscordSRV")) { ++++ Logger.warning("&eDiscordSRV not enabled! - Disable Features..."); ++++@@ -24,7 +18,7 @@ ++++ return; ++++ } ++++ ++++- if (!Settings.hook_discordsrv) { +++++ if (!Settings.hook_discordSrv) { ++++ this.isEnabled = false; ++++ Logger.warning("&eDiscordSRV not enabled! - Disable Features..."); ++++ return; ++++@@ -38,7 +32,4 @@ ++++ return isEnabled; ++++ } ++++ ++++- public HookManager getHookManager() { ++++- return hookManager; ++++- } ++++ } ++++Index: CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/hook/EssentialsXDiscordHook.java ++++IDEA additional info: ++++Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP ++++<+>UTF-8 ++++=================================================================== ++++diff --git a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/hook/EssentialsXDiscordHook.java b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/hook/EssentialsXDiscordHook.java ++++--- a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/hook/EssentialsXDiscordHook.java (revision 60d9051d52d70ed86db8e0fc1a50da61f395e55a) +++++++ b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/hook/EssentialsXDiscordHook.java (revision 5436229cc153c4aec4cd6267d80f1e8301022990) ++++@@ -1,6 +1,5 @@ ++++ package jss.customjoinandquitmessages.hook; ++++ ++++-import jss.customjoinandquitmessages.manager.HookManager; ++++ import jss.customjoinandquitmessages.utils.EventUtils; ++++ import jss.customjoinandquitmessages.utils.Logger; ++++ import jss.customjoinandquitmessages.utils.Settings; ++++@@ -12,14 +11,9 @@ ++++ ++++ public class EssentialsXDiscordHook implements IHook { ++++ ++++- private HookManager hookManager; ++++ private boolean isEnabled; ++++ private DiscordService service; ++++ ++++- public EssentialsXDiscordHook(HookManager hookManager) { ++++- this.hookManager = hookManager; ++++- } ++++- ++++ public void setup() { ++++ if (!Bukkit.getPluginManager().isPluginEnabled("EssentialsDiscord")) { ++++ Logger.warning("&eEssentialsDiscord not enabled! - Disable Features..."); ++++@@ -43,27 +37,22 @@ ++++ return isEnabled; ++++ } ++++ ++++- public DiscordService getService() { ++++- return service; ++++- } ++++- +++++ @SuppressWarnings("unused") ++++ public void sendJoinMessage(String channelId, String message) { ++++ if (Settings.hook_essentialsDiscord_use_default_channel) { ++++ service.sendMessage(MessageType.DefaultTypes.JOIN, message, false); ++++ } else { ++++- service.sendMessage(new MessageType(Settings.hook_essentialsDiscord_channelid), message, false); +++++ service.sendMessage(new MessageType(Settings.hook_essentialsDiscord_channelId), message, false); ++++ } ++++ } ++++ +++++ @SuppressWarnings("unused") ++++ public void sendQuitMessage(String channelId, String message) { ++++ if (Settings.hook_essentialsDiscord_use_default_channel) { ++++ service.sendMessage(MessageType.DefaultTypes.LEAVE, message, false); ++++ } else { ++++- service.sendMessage(new MessageType(Settings.hook_essentialsDiscord_channelid), message, false); +++++ service.sendMessage(new MessageType(Settings.hook_essentialsDiscord_channelId), message, false); ++++ } ++++ } ++++ ++++- public HookManager getHookManager() { ++++- return hookManager; ++++- } ++++ } ++++Index: CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/listener/JoinListener.java ++++IDEA additional info: ++++Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP ++++<+>UTF-8 ++++=================================================================== ++++diff --git a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/listener/JoinListener.java b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/listener/JoinListener.java ++++--- a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/listener/JoinListener.java (revision 60d9051d52d70ed86db8e0fc1a50da61f395e55a) +++++++ b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/listener/JoinListener.java (revision 5436229cc153c4aec4cd6267d80f1e8301022990) ++++@@ -103,7 +103,7 @@ ++++ } ++++ ++++ if (essentialsXHook.isEnabled()) { ++++- if (Settings.hook_essentials_hideplayervanish) { +++++ if (Settings.hook_essentials_hidePlayerVanish) { ++++ if (essentialsXHook.isVanish(p)) { ++++ e.setJoinMessage(null); ++++ return; ++++@@ -115,11 +115,10 @@ ++++ if (isNormal) { ++++ e.setJoinMessage(null); ++++ +++++ String text; ++++ String join = Settings.join_message; ++++ String firstjoin = Settings.join_message_first; ++++ ++++- String text; ++++- ++++ if (Settings.firstjoin) { ++++ if (!p.hasPlayedBefore()) { ++++ text = firstjoin; ++++@@ -130,161 +129,106 @@ ++++ text = join; ++++ } ++++ ++++- boolean isNormalType = Settings.join_type.equalsIgnoreCase("normal"); ++++- boolean isModifyType = Settings.join_type.equalsIgnoreCase("modify"); ++++- ++++ text = Util.color(Util.getVar(p, text)); ++++- ++++ MessageBuilder messageBuilder = new MessageBuilder(p, text); ++++ ++++- //Update Logger ++++ if (config.getBoolean("Config.Show-Chat-In-Console")) { ++++ Logger.info(messageBuilder.getText()); ++++ } ++++ ++++- if (isNormalType) { ++++- e.setJoinMessage(text); ++++- if (discordSRVHHook.isEnabled()) { ++++- ++++- if (Settings.hook_discordsrv_channelid.equalsIgnoreCase("none")) ++++- return; ++++- ++++- DiscordUtil.sendMessageBlocking( ++++- DiscordUtil.getTextChannelById(Settings.hook_discordsrv_channelid), ++++- Util.colorless(messageBuilder.getText())); ++++- } ++++- ++++- if (essentialsXDiscordHook.isEnabled()) { ++++- if (Settings.hook_essentialsDiscord_channelid.equalsIgnoreCase("none")) ++++- return; ++++- ++++- essentialsXDiscordHook.sendJoinMessage(Settings.hook_essentialsDiscord_channelid, ++++- Util.colorless(messageBuilder.getText())); ++++- } ++++- ++++- //Removed IsModifyType in 1.8.0 ++++- } else if (isModifyType) { ++++- boolean isHover = Objects.equals(config.getString("Join.HoverEvent.Enabled"), "true"); ++++- boolean isClick = Objects.equals(config.getString("Join.ClickEvent.Enabled"), "true"); ++++- boolean isTitle = Objects.equals(config.getString("Join.Title.Enabled"), "true"); ++++- boolean isSound = Objects.equals(config.getString("Join.Sound.Enabled"), "true"); ++++- boolean isActionBar = Objects.equals(config.getString("Join.ActionBar.Enabled"), "true"); ++++- boolean isSoundAll = Objects.equals(config.getString("Join.Sound.Send-To-All"), "true"); +++++ boolean isHover = config.getBoolean("Join.HoverEvent.Enabled"); +++++ boolean isClick = config.getBoolean("Join.ClickEvent.Enabled"); +++++ boolean isTitle = config.getBoolean("Join.Title.Enabled"); +++++ boolean isSound = config.getBoolean("Join.Sound.Enabled"); +++++ boolean isActionBar = config.getBoolean("Join.ActionBar.Enabled"); +++++ boolean isSoundAll = config.getBoolean("Join.Sound.Send-To-All"); ++++ ++++- List Hover_Text = config.getStringList("Join.HoverEvent.Hover"); +++++ List Hover_Text = config.getStringList("Join.HoverEvent.Hover"); ++++ ++++- String isClick_Mode = config.getString("Join.ClickEvent.Mode"); ++++- String Action_Command = config.getString("Join.ClickEvent.Actions.Command"); ++++- String Action_Url = config.getString("Join.ClickEvent.Actions.Url"); ++++- String Action_Suggest = config.getString("Join.ClickEvent.Actions.Suggest-Command"); ++++- ++++- //List Action_Dev = config.getStringList("Join.ClickEvent.DevActions"); ++++- ++++- String Title_Text = config.getString("Join.Title.Title"); ++++- String SubTitle_Text = config.getString("Join.Title.SubTitle"); ++++- String Actionbar_Text = config.getString("Join.ActionBar.Text"); ++++- String Sound_Name = config.getString("Join.Sound.Name"); +++++ String isClick_Mode = config.getString("Join.ClickEvent.Mode"); +++++ String Action_Command = config.getString("Join.ClickEvent.Actions.Command"); +++++ String Action_Url = config.getString("Join.ClickEvent.Actions.Url"); +++++ String Action_Suggest = config.getString("Join.ClickEvent.Actions.Suggest-Command"); +++++ String Title_Text = config.getString("Join.Title.Title"); +++++ String SubTitle_Text = config.getString("Join.Title.SubTitle"); +++++ String Actionbar_Text = config.getString("Join.ActionBar.Text"); +++++ String Sound_Name = config.getString("Join.Sound.Name"); ++++ ++++- int FadeIn = config.getInt("Join.Title.FadeIn"); ++++- int Stay = config.getInt("Join.Title.Stay"); ++++- int FadeOut = config.getInt("Join.Title.FadeOut"); ++++- int Sound_Volume = config.getInt("Join.Sound.Volume"); +++++ int FadeIn = config.getInt("Join.Title.FadeIn"); +++++ int Stay = config.getInt("Join.Title.Stay"); +++++ int FadeOut = config.getInt("Join.Title.FadeOut"); +++++ int Sound_Volume = config.getInt("Join.Sound.Volume"); ++++ ++++- float Sound_Pitch = Float.parseFloat(Objects.requireNonNull(config.getString("Join.Sound.Pitch"))); +++++ float Sound_Pitch = Float.parseFloat(Objects.requireNonNull(config.getString("Join.Sound.Pitch"))); ++++ ++++- if (isHover) { ++++- if (isClick) { ++++- assert isClick_Mode != null; ++++- if (isClick_Mode.equalsIgnoreCase("command")) { ++++- messageBuilder.setHover(Hover_Text).setExecuteCommand(Action_Command).sendToAll(); ++++- } else if (isClick_Mode.equalsIgnoreCase("url")) { ++++- messageBuilder.setHover(Hover_Text).setOpenURL(Action_Url).sendToAll(); ++++- } else if (isClick_Mode.equalsIgnoreCase("suggest")) { ++++- messageBuilder.setHover(Hover_Text).setSuggestCommand(Action_Suggest).sendToAll(); ++++- } ++++- } else { ++++- messageBuilder.setHover(Hover_Text).sendToAll(); ++++- } ++++- } else { +++++ if (isHover) { +++++ if (isClick) { +++++ assert isClick_Mode != null; +++++ if (isClick_Mode.equalsIgnoreCase("command")) { +++++ messageBuilder.setHover(Hover_Text).setExecuteCommand(Action_Command).sendToAll(); +++++ } else if (isClick_Mode.equalsIgnoreCase("url")) { +++++ messageBuilder.setHover(Hover_Text).setOpenURL(Action_Url).sendToAll(); +++++ } else if (isClick_Mode.equalsIgnoreCase("suggest")) { +++++ messageBuilder.setHover(Hover_Text).setSuggestCommand(Action_Suggest).sendToAll(); +++++ } +++++ } else { +++++ messageBuilder.setHover(Hover_Text).sendToAll(); +++++ } +++++ } else { ++++ ++++- if (isClick) { ++++- ++++- /*for(String action : Action_Dev){ ++++- ++++- String[] parts = action.split(":"); ++++- String type = parts[0].trim(); ++++- String value = parts[1].trim(); ++++- ++++- switch (type){ ++++- case "[Execute]": ++++- messageBuilder.setExecuteCommand(value); ++++- break; ++++- case "[Suggest]": ++++- messageBuilder.setSuggestCommand(value); ++++- break; ++++- case "[Open]": ++++- messageBuilder.setOpenURL(value); ++++- break; ++++- default: ++++- messageBuilder.sendToAll(); ++++- break; ++++- } ++++- } ++++- messageBuilder.sendToAll();*/ ++++- ++++- assert isClick_Mode != null; ++++- if (isClick_Mode.equalsIgnoreCase("command")) { ++++- messageBuilder.setExecuteCommand(Action_Command).sendToAll(); ++++- } else if (isClick_Mode.equalsIgnoreCase("url")) { ++++- messageBuilder.setOpenURL(Action_Url).sendToAll(); ++++- } else if (isClick_Mode.equalsIgnoreCase("suggest")) { ++++- messageBuilder.setSuggestCommand(Action_Suggest).sendToAll(); ++++- } ++++- ++++- ++++- } else { ++++- messageBuilder.sendToAll(); ++++- } ++++- } +++++ if (isClick) { +++++ assert isClick_Mode != null; +++++ if (isClick_Mode.equalsIgnoreCase("command")) { +++++ messageBuilder.setExecuteCommand(Action_Command).sendToAll(); +++++ } else if (isClick_Mode.equalsIgnoreCase("url")) { +++++ messageBuilder.setOpenURL(Action_Url).sendToAll(); +++++ } else if (isClick_Mode.equalsIgnoreCase("suggest")) { +++++ messageBuilder.setSuggestCommand(Action_Suggest).sendToAll(); +++++ } +++++ } else { +++++ messageBuilder.sendToAll(); +++++ } +++++ } ++++ ++++- if (discordSRVHHook.isEnabled()) { ++++- DiscordUtil.sendMessageBlocking( ++++- DiscordUtil.getTextChannelById(Settings.hook_discordsrv_channelid), ++++- Util.colorless(messageBuilder.getText())); ++++- } +++++ if (discordSRVHHook.isEnabled()) { +++++ DiscordUtil.sendMessageBlocking( +++++ DiscordUtil.getTextChannelById(Settings.hook_discordSrv_channelId), +++++ Util.colorless(messageBuilder.getText())); +++++ } ++++ ++++- if (isTitle) { ++++- Titles.sendTitle(p, FadeIn, Stay, FadeOut, Util.color(Util.getVar(p, Title_Text)), ++++- Util.color(Util.getVar(p, SubTitle_Text))); ++++- } +++++ if (isTitle) { +++++ Titles.sendTitle(p, FadeIn, Stay, FadeOut, Util.color(Util.getVar(p, Title_Text)), +++++ Util.color(Util.getVar(p, SubTitle_Text))); +++++ } ++++ ++++- if (isActionBar) { ++++- ActionBar.sendActionBar(p, Util.color(Util.getVar(p, Actionbar_Text))); ++++- } +++++ if (isActionBar) { +++++ ActionBar.sendActionBar(p, Util.color(Util.getVar(p, Actionbar_Text))); +++++ } ++++ ++++- try { ++++- if (isSound) { ++++- if (isSoundAll) { ++++- Location location = p.getLocation(); ++++- p.playSound(location, Sound.valueOf(Sound_Name), Sound_Volume, Sound_Pitch); ++++- } else { ++++- for (Player pp : Bukkit.getOnlinePlayers()) { ++++- Location location = p.getLocation(); ++++- pp.playSound(location, Sound.valueOf(Sound_Name), Sound_Volume, Sound_Pitch); ++++- } ++++- } ++++- } ++++- } catch (Exception ex) { ++++- Logger.warning("&eVerify that the sound name is correct or belongs to the version"); ++++- } +++++ try { +++++ if (isSound) { +++++ if (isSoundAll) { +++++ Location location = p.getLocation(); +++++ p.playSound(location, Sound.valueOf(Sound_Name), Sound_Volume, Sound_Pitch); +++++ } else { +++++ for (Player pp : Bukkit.getOnlinePlayers()) { +++++ Location location = p.getLocation(); +++++ pp.playSound(location, Sound.valueOf(Sound_Name), Sound_Volume, Sound_Pitch); +++++ } +++++ } +++++ } +++++ } catch (Exception ex) { +++++ Logger.warning("&eVerify that the sound name is correct or belongs to the version"); ++++ } +++++ +++++ ++++ } else if (isGroup) { ++++ e.setJoinMessage(null); ++++ GroupHelper groupHelper = new GroupHelper(); ++++ groupHelper.setGroup(playerManager.getGroup(p)); ++++ groupHelper.setDiscord(discordSRVHHook); ++++ groupHelper.setEssentials(essentialsXDiscordHook); ++++- groupHelper.onJoin(p, config, e); +++++ groupHelper.onJoin(p, config); ++++ } else if (isNone) { ++++ e.setJoinMessage(null); ++++ } ++++@@ -295,7 +239,7 @@ ++++ public void onUpdate(@NotNull PlayerJoinEvent e) { ++++ Player p = e.getPlayer(); ++++ if (Settings.update) { ++++- if ((p.isOp()) || (p.hasPermission("Cjm.Update.Notify"))) { +++++ if ((p.isOp()) || (p.hasPermission("cjm.update"))) { ++++ new UpdateChecker(CustomJoinAndQuitMessages.get()).sendSpigotUpdate(); ++++ } ++++ } ++++@@ -329,7 +273,7 @@ ++++ } ++++ ++++ if (essentialsXHook.isEnabled()) { ++++- if (Settings.hook_essentials_hideplayervanish) { +++++ if (Settings.hook_essentials_hidePlayerVanish) { ++++ if (essentialsXHook.isVanish(p)) { ++++ e.setQuitMessage(null); ++++ return; ++++@@ -341,9 +285,6 @@ ++++ if (isNormal) { ++++ e.setQuitMessage(null); ++++ ++++- boolean isNormalType = Objects.requireNonNull(config.getString("Quit.Type")).equalsIgnoreCase("normal"); ++++- boolean isModifyType = Objects.requireNonNull(config.getString("Quit.Type")).equalsIgnoreCase("modify"); ++++- ++++ String text = config.getString("Quit.Text"); ++++ ++++ text = Util.color(text); ++++@@ -355,102 +296,81 @@ ++++ Logger.info(messageBuilder.getText()); ++++ } ++++ ++++- if (isNormalType) { ++++- e.setQuitMessage(text); ++++- if (discordSRVHHook.isEnabled()) { ++++- if (Settings.hook_discordsrv_channelid.equalsIgnoreCase("none")) ++++- return; ++++- DiscordUtil.sendMessageBlocking( ++++- DiscordUtil.getTextChannelById(Settings.hook_discordsrv_channelid), ++++- Util.colorless(messageBuilder.getText())); ++++- } ++++- ++++- if (essentialsXDiscordHook.isEnabled()) { ++++- if (Settings.hook_essentialsDiscord_channelid.equalsIgnoreCase("none")) ++++- return; ++++- essentialsXDiscordHook.sendQuitMessage(Settings.hook_essentialsDiscord_channelid, ++++- Util.colorless(messageBuilder.getText())); ++++- } ++++- } else if (isModifyType) { ++++- ++++- boolean isHover = Objects.equals(config.getString("Quit.HoverEvent.Enabled"), "true"); ++++- boolean isClick = Objects.equals(config.getString("Quit.ClickEvent.Enabled"), "true"); ++++- boolean isSound = Objects.equals(config.getString("Quit.Sound.Enabled"), "true"); ++++- boolean isSoundAll = Objects.equals(config.getString("Quit.Sound.Send-To-All"), "true"); +++++ boolean isHover = config.getBoolean("Quit.HoverEvent.Enabled"); +++++ boolean isClick = config.getBoolean("Quit.ClickEvent.Enabled"); +++++ boolean isSound = config.getBoolean("Quit.Sound.Enabled"); +++++ boolean isSoundAll = config.getBoolean("Quit.Sound.Send-To-All"); ++++ ++++- List Hover_Text = config.getStringList("Quit.HoverEvent.Hover"); +++++ List Hover_Text = config.getStringList("Quit.HoverEvent.Hover"); ++++ ++++- String isClick_Mode = config.getString("Quit.ClickEvent.Mode"); ++++- String Action_Command = config.getString("Quit.ClickEvent.Actions.Command"); ++++- String Action_Url = config.getString("Quit.ClickEvent.Actions.Url"); ++++- String Action_Suggest = config.getString("Quit.ClickEvent.Actions.Suggest-Command"); ++++- String Sound_Name = config.getString("Quit.Sound.Name"); +++++ String isClick_Mode = config.getString("Quit.ClickEvent.Mode"); +++++ String Action_Command = config.getString("Quit.ClickEvent.Actions.Command"); +++++ String Action_Url = config.getString("Quit.ClickEvent.Actions.Url"); +++++ String Action_Suggest = config.getString("Quit.ClickEvent.Actions.Suggest-Command"); +++++ String Sound_Name = config.getString("Quit.Sound.Name"); ++++ ++++- int Sound_Volume = config.getInt("Quit.Sound.Volume"); ++++- float Sound_Pitch = Float.parseFloat(Objects.requireNonNull(config.getString("Quit.Sound.Pitch"))); +++++ int Sound_Volume = config.getInt("Quit.Sound.Volume"); +++++ float Sound_Pitch = Float.parseFloat(Objects.requireNonNull(config.getString("Quit.Sound.Pitch"))); ++++ ++++- if (isHover) { ++++- if (isClick) { ++++- assert isClick_Mode != null; ++++- if (isClick_Mode.equalsIgnoreCase("command")) { ++++- messageBuilder.setHover(Hover_Text).setExecuteCommand(Action_Command).sendToAll(); ++++- } else if (isClick_Mode.equalsIgnoreCase("url")) { ++++- messageBuilder.setHover(Hover_Text).setOpenURL(Action_Url).sendToAll(); ++++- } else if (isClick_Mode.equalsIgnoreCase("suggest")) { ++++- messageBuilder.setHover(Hover_Text).setSuggestCommand(Action_Suggest).sendToAll(); ++++- } ++++- } else { ++++- messageBuilder.setHover(Hover_Text).sendToAll(); ++++- } ++++- } else { ++++- if (isClick) { ++++- assert isClick_Mode != null; ++++- if (isClick_Mode.equalsIgnoreCase("command")) { ++++- messageBuilder.setExecuteCommand(Action_Command).sendToAll(); ++++- } else if (isClick_Mode.equalsIgnoreCase("url")) { ++++- messageBuilder.setOpenURL(Action_Url).sendToAll(); ++++- } else if (isClick_Mode.equalsIgnoreCase("suggest")) { ++++- messageBuilder.setSuggestCommand(Action_Suggest).sendToAll(); ++++- } ++++- } else { ++++- messageBuilder.sendToAll(); ++++- } ++++- } +++++ if (isHover) { +++++ if (isClick) { +++++ assert isClick_Mode != null; +++++ if (isClick_Mode.equalsIgnoreCase("command")) { +++++ messageBuilder.setHover(Hover_Text).setExecuteCommand(Action_Command).sendToAll(); +++++ } else if (isClick_Mode.equalsIgnoreCase("url")) { +++++ messageBuilder.setHover(Hover_Text).setOpenURL(Action_Url).sendToAll(); +++++ } else if (isClick_Mode.equalsIgnoreCase("suggest")) { +++++ messageBuilder.setHover(Hover_Text).setSuggestCommand(Action_Suggest).sendToAll(); +++++ } +++++ } else { +++++ messageBuilder.setHover(Hover_Text).sendToAll(); +++++ } +++++ } else { +++++ if (isClick) { +++++ assert isClick_Mode != null; +++++ if (isClick_Mode.equalsIgnoreCase("command")) { +++++ messageBuilder.setExecuteCommand(Action_Command).sendToAll(); +++++ } else if (isClick_Mode.equalsIgnoreCase("url")) { +++++ messageBuilder.setOpenURL(Action_Url).sendToAll(); +++++ } else if (isClick_Mode.equalsIgnoreCase("suggest")) { +++++ messageBuilder.setSuggestCommand(Action_Suggest).sendToAll(); +++++ } +++++ } else { +++++ messageBuilder.sendToAll(); +++++ } +++++ } ++++ ++++- if (discordSRVHHook.isEnabled()) { ++++- ++++- if (Settings.hook_discordsrv_channelid.equalsIgnoreCase("none")) ++++- return; +++++ if (discordSRVHHook.isEnabled()) { +++++ if (Settings.hook_discordSrv_channelId.equalsIgnoreCase("none")) +++++ return; ++++ ++++- DiscordUtil.sendMessageBlocking( ++++- DiscordUtil.getTextChannelById(Settings.hook_discordsrv_channelid), ++++- Util.colorless(messageBuilder.getText())); ++++- } +++++ DiscordUtil.sendMessageBlocking( +++++ DiscordUtil.getTextChannelById(Settings.hook_discordSrv_channelId), +++++ Util.colorless(messageBuilder.getText())); +++++ } ++++ ++++- if (essentialsXDiscordHook.isEnabled()) { ++++- ++++- if (Settings.hook_essentialsDiscord_channelid.equalsIgnoreCase("none")) ++++- return; +++++ if (essentialsXDiscordHook.isEnabled()) { +++++ if (Settings.hook_essentialsDiscord_channelId.equalsIgnoreCase("none")) +++++ return; ++++ ++++- essentialsXDiscordHook.sendQuitMessage(Settings.hook_essentialsDiscord_channelid, ++++- Util.colorless(messageBuilder.getText())); ++++- } +++++ essentialsXDiscordHook.sendQuitMessage(Settings.hook_essentialsDiscord_channelId, +++++ Util.colorless(messageBuilder.getText())); +++++ } ++++ ++++- try { ++++- if (isSound) { ++++- if (isSoundAll) { ++++- Location location = p.getLocation(); ++++- p.playSound(location, Sound.valueOf(Sound_Name), Sound_Volume, Sound_Pitch); ++++- } else { ++++- for (Player pp : Bukkit.getOnlinePlayers()) { ++++- Location location = p.getLocation(); ++++- pp.playSound(location, Sound.valueOf(Sound_Name), Sound_Volume, Sound_Pitch); ++++- } ++++- } ++++- } ++++- } catch (Exception ex) { ++++- Logger.warning("&eVerify that the sound name is correct or belongs to the version"); ++++- } +++++ try { +++++ if (isSound) { +++++ if (isSoundAll) { +++++ Location location = p.getLocation(); +++++ p.playSound(location, Sound.valueOf(Sound_Name), Sound_Volume, Sound_Pitch); +++++ } else { +++++ for (Player pp : Bukkit.getOnlinePlayers()) { +++++ Location location = p.getLocation(); +++++ pp.playSound(location, Sound.valueOf(Sound_Name), Sound_Volume, Sound_Pitch); +++++ } +++++ } +++++ } +++++ } catch (Exception ex) { +++++ Logger.warning("&eVerify that the sound name is correct or belongs to the version"); ++++ } ++++ } else if (isGroup) { ++++ e.setQuitMessage(null); ++++@@ -458,13 +378,11 @@ ++++ groupHelper.setGroup(playerManager.getGroup(p)); ++++ groupHelper.setDiscord(discordSRVHHook); ++++ groupHelper.setEssentials(essentialsXDiscordHook); ++++- groupHelper.onQuit(p, config, e); +++++ groupHelper.onQuit(p, config); ++++ } else if (isNone) { ++++ e.setQuitMessage(null); ++++ } ++++ } ++++ } ++++ ++++- ++++- ++++ } ++++Index: CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/manager/DisplayManager.java ++++IDEA additional info: ++++Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP ++++<+>UTF-8 ++++=================================================================== ++++diff --git a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/manager/DisplayManager.java b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/manager/DisplayManager.java ++++--- a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/manager/DisplayManager.java (revision 60d9051d52d70ed86db8e0fc1a50da61f395e55a) +++++++ b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/manager/DisplayManager.java (revision 5436229cc153c4aec4cd6267d80f1e8301022990) ++++@@ -12,6 +12,7 @@ ++++ ++++ import java.util.List; ++++ +++++@SuppressWarnings("all") ++++ public class DisplayManager { ++++ ++++ private final FileConfiguration config = CustomJoinAndQuitMessages.get().getConfigFile().getConfig(); ++++@@ -41,8 +42,6 @@ ++++ Logger.warning("&e[showFirstJoinMessage] &b-> &7This feature is disabled and you will not be able to see the preview"); ++++ ++++ String text; ++++- boolean isNormalType; ++++- boolean isModifyType; ++++ boolean isHover; ++++ boolean isClick; ++++ List Hover_Text; ++++@@ -53,8 +52,6 @@ ++++ ++++ if (Settings.is_Group_Display) { ++++ text = groups.getString(group + ".FirstJoin.Text"); ++++- isNormalType = groups.getString(group + ".Type").equalsIgnoreCase("normal"); ++++- isModifyType = groups.getString(group + ".Type").equalsIgnoreCase("modify"); ++++ isHover = groups.getString(group + ".HoverEvent.Enabled").equals("true"); ++++ isClick = groups.getString(group + ".ClickEvent.Enabled").equals("true"); ++++ Hover_Text = groups.getStringList(group + ".HoverEvent.Hover"); ++++@@ -64,8 +61,6 @@ ++++ Action_Suggest = groups.getString(group + ".ClickEvent.Actions.Suggest-Command"); ++++ } else { ++++ text = Settings.join_message_first; ++++- isNormalType = Settings.join_type.equalsIgnoreCase("normal"); ++++- isModifyType = Settings.join_type.equalsIgnoreCase("modify"); ++++ ++++ isHover = config.getString("Join.HoverEvent.Enabled").equals("true"); ++++ isClick = config.getString("Join.ClickEvent.Enabled").equals("true"); ++++@@ -78,34 +73,29 @@ ++++ ++++ MessageBuilder messageBuilder = new MessageBuilder(player, Util.color(Util.getVar(player, text))); ++++ ++++- if (isNormalType) { ++++- messageBuilder.send(); ++++- return; ++++- } else if (isModifyType) { ++++- if (isHover) { ++++- if (isClick) { ++++- if (isClick_Mode.equalsIgnoreCase("command")) { ++++- messageBuilder.setHover(Hover_Text).setExecuteCommand(Action_Command).send(); ++++- } else if (isClick_Mode.equalsIgnoreCase("url")) { ++++- messageBuilder.setHover(Hover_Text).setOpenURL(Action_Url).send(); ++++- } else if (isClick_Mode.equalsIgnoreCase("suggest")) { ++++- messageBuilder.setHover(Hover_Text).setSuggestCommand(Action_Suggest).send(); ++++- } ++++- } else { ++++- messageBuilder.setHover(Hover_Text).send(); ++++- } ++++- } else { ++++- if (isClick) { ++++- if (isClick_Mode.equalsIgnoreCase("command")) { ++++- messageBuilder.setExecuteCommand(Action_Command).send(); ++++- } else if (isClick_Mode.equalsIgnoreCase("url")) { ++++- messageBuilder.setOpenURL(Action_Url).send(); ++++- } else if (isClick_Mode.equalsIgnoreCase("suggest")) { ++++- messageBuilder.setSuggestCommand(Action_Suggest).send(); ++++- } ++++- } else { ++++- messageBuilder.send(); ++++- } +++++ if (isHover) { +++++ if (isClick) { +++++ if (isClick_Mode.equalsIgnoreCase("command")) { +++++ messageBuilder.setHover(Hover_Text).setExecuteCommand(Action_Command).send(); +++++ } else if (isClick_Mode.equalsIgnoreCase("url")) { +++++ messageBuilder.setHover(Hover_Text).setOpenURL(Action_Url).send(); +++++ } else if (isClick_Mode.equalsIgnoreCase("suggest")) { +++++ messageBuilder.setHover(Hover_Text).setSuggestCommand(Action_Suggest).send(); +++++ } +++++ } else { +++++ messageBuilder.setHover(Hover_Text).send(); +++++ } +++++ } else { +++++ if (isClick) { +++++ if (isClick_Mode.equalsIgnoreCase("command")) { +++++ messageBuilder.setExecuteCommand(Action_Command).send(); +++++ } else if (isClick_Mode.equalsIgnoreCase("url")) { +++++ messageBuilder.setOpenURL(Action_Url).send(); +++++ } else if (isClick_Mode.equalsIgnoreCase("suggest")) { +++++ messageBuilder.setSuggestCommand(Action_Suggest).send(); +++++ } +++++ } else { +++++ messageBuilder.send(); ++++ } ++++ } ++++ } ++++@@ -127,8 +117,6 @@ ++++ ++++ if (Settings.is_Group_Display) { ++++ text = groups.getString(group + ".Join-Text"); ++++- isNormalType = groups.getString(group + ".Type").equalsIgnoreCase("normal"); ++++- isModifyType = groups.getString(group + ".Type").equalsIgnoreCase("modify"); ++++ ++++ isHover = groups.getString(group + ".HoverEvent.Enabled").equals("true"); ++++ isClick = groups.getString(group + ".ClickEvent.Enabled").equals("true"); ++++@@ -141,8 +129,6 @@ ++++ Action_Suggest = groups.getString(group + ".ClickEvent.Actions.Suggest-Command"); ++++ } else { ++++ text = Settings.join_message; ++++- isNormalType = Settings.join_type.equalsIgnoreCase("normal"); ++++- isModifyType = Settings.join_type.equalsIgnoreCase("modify"); ++++ ++++ isHover = config.getString("Join.HoverEvent.Enabled").equals("true"); ++++ isClick = config.getString("Join.ClickEvent.Enabled").equals("true"); ++++@@ -157,34 +143,29 @@ ++++ ++++ MessageBuilder messageBuilder = new MessageBuilder(player, Util.color(Util.getVar(player, text))); ++++ ++++- if (isNormalType) { ++++- messageBuilder.send(); ++++- return; ++++- } else if (isModifyType) { ++++- if (isHover) { ++++- if (isClick) { ++++- if (isClick_Mode.equalsIgnoreCase("command")) { ++++- messageBuilder.setHover(Hover_Text).setExecuteCommand(Action_Command).send(); ++++- } else if (isClick_Mode.equalsIgnoreCase("url")) { ++++- messageBuilder.setHover(Hover_Text).setOpenURL(Action_Url).send(); ++++- } else if (isClick_Mode.equalsIgnoreCase("suggest")) { ++++- messageBuilder.setHover(Hover_Text).setSuggestCommand(Action_Suggest).send(); ++++- } ++++- } else { ++++- messageBuilder.setHover(Hover_Text).send(); ++++- } ++++- } else { ++++- if (isClick) { ++++- if (isClick_Mode.equalsIgnoreCase("command")) { ++++- messageBuilder.setExecuteCommand(Action_Command).send(); ++++- } else if (isClick_Mode.equalsIgnoreCase("url")) { ++++- messageBuilder.setOpenURL(Action_Url).send(); ++++- } else if (isClick_Mode.equalsIgnoreCase("suggest")) { ++++- messageBuilder.setSuggestCommand(Action_Suggest).send(); ++++- } ++++- } else { ++++- messageBuilder.send(); ++++- } +++++ if (isHover) { +++++ if (isClick) { +++++ if (isClick_Mode.equalsIgnoreCase("command")) { +++++ messageBuilder.setHover(Hover_Text).setExecuteCommand(Action_Command).send(); +++++ } else if (isClick_Mode.equalsIgnoreCase("url")) { +++++ messageBuilder.setHover(Hover_Text).setOpenURL(Action_Url).send(); +++++ } else if (isClick_Mode.equalsIgnoreCase("suggest")) { +++++ messageBuilder.setHover(Hover_Text).setSuggestCommand(Action_Suggest).send(); +++++ } +++++ } else { +++++ messageBuilder.setHover(Hover_Text).send(); +++++ } +++++ } else { +++++ if (isClick) { +++++ if (isClick_Mode.equalsIgnoreCase("command")) { +++++ messageBuilder.setExecuteCommand(Action_Command).send(); +++++ } else if (isClick_Mode.equalsIgnoreCase("url")) { +++++ messageBuilder.setOpenURL(Action_Url).send(); +++++ } else if (isClick_Mode.equalsIgnoreCase("suggest")) { +++++ messageBuilder.setSuggestCommand(Action_Suggest).send(); +++++ } +++++ } else { +++++ messageBuilder.send(); ++++ } ++++ } ++++ } ++++@@ -220,8 +201,6 @@ ++++ Action_Suggest = groups.getString(group + ".ClickEvent.Actions.Suggest-Command"); ++++ } else { ++++ text = Settings.quit_message; ++++- isNormalType = Settings.quit_type.equalsIgnoreCase("normal"); ++++- isModifyType = Settings.quit_type.equalsIgnoreCase("modify"); ++++ ++++ isHover = config.getString("Quit.HoverEvent.Enabled").equals("true"); ++++ isClick = config.getString("Quit.ClickEvent.Enabled").equals("true"); ++++@@ -236,36 +215,32 @@ ++++ ++++ MessageBuilder messageBuilder = new MessageBuilder(player, Util.color(Util.getVar(player, text))); ++++ ++++- if (isNormalType) { ++++- messageBuilder.send(); ++++- return; ++++- } else if (isModifyType) { ++++- if (isHover) { ++++- if (isClick) { ++++- if (isClick_Mode.equalsIgnoreCase("command")) { ++++- messageBuilder.setHover(Hover_Text).setExecuteCommand(Action_Command).send(); ++++- } else if (isClick_Mode.equalsIgnoreCase("url")) { ++++- messageBuilder.setHover(Hover_Text).setOpenURL(Action_Url).send(); ++++- } else if (isClick_Mode.equalsIgnoreCase("suggest")) { ++++- messageBuilder.setHover(Hover_Text).setSuggestCommand(Action_Suggest).send(); ++++- } ++++- } else { ++++- messageBuilder.setHover(Hover_Text).send(); ++++- } ++++- } else { ++++- if (isClick) { ++++- if (isClick_Mode.equalsIgnoreCase("command")) { ++++- messageBuilder.setExecuteCommand(Action_Command).send(); ++++- } else if (isClick_Mode.equalsIgnoreCase("url")) { ++++- messageBuilder.setOpenURL(Action_Url).send(); ++++- } else if (isClick_Mode.equalsIgnoreCase("suggest")) { ++++- messageBuilder.setSuggestCommand(Action_Suggest).send(); ++++- } ++++- } else { ++++- messageBuilder.send(); ++++- } +++++ if (isHover) { +++++ if (isClick) { +++++ if (isClick_Mode.equalsIgnoreCase("command")) { +++++ messageBuilder.setHover(Hover_Text).setExecuteCommand(Action_Command).send(); +++++ } else if (isClick_Mode.equalsIgnoreCase("url")) { +++++ messageBuilder.setHover(Hover_Text).setOpenURL(Action_Url).send(); +++++ } else if (isClick_Mode.equalsIgnoreCase("suggest")) { +++++ messageBuilder.setHover(Hover_Text).setSuggestCommand(Action_Suggest).send(); +++++ } +++++ } else { +++++ messageBuilder.setHover(Hover_Text).send(); +++++ } +++++ } else { +++++ if (isClick) { +++++ if (isClick_Mode.equalsIgnoreCase("command")) { +++++ messageBuilder.setExecuteCommand(Action_Command).send(); +++++ } else if (isClick_Mode.equalsIgnoreCase("url")) { +++++ messageBuilder.setOpenURL(Action_Url).send(); +++++ } else if (isClick_Mode.equalsIgnoreCase("suggest")) { +++++ messageBuilder.setSuggestCommand(Action_Suggest).send(); +++++ } +++++ } else { +++++ messageBuilder.send(); ++++ } ++++ } +++++ ++++ } ++++ ++++ public void showWelcomeMessage() { ++++@@ -281,7 +256,7 @@ ++++ if (!Settings.join_title) ++++ Logger.warning("&e[showTitleMessage] &b-> &7This feature is disabled and you will not be able to see the preview"); ++++ ++++- Titles.sendTitle(player, Settings.join_title_fadein, Settings.join_title_stay, Settings.join_title_fadeout, Settings.join_message_title_title, Settings.join_message_title_subtitle); +++++ Titles.sendTitle(player, Settings.join_title_fadeIn, Settings.join_title_stay, Settings.join_title_fadeOut, Settings.join_message_title_title, Settings.join_message_title_subtitle); ++++ } ++++ ++++ public void showActionbar() { ++++Index: CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/manager/HookManager.java ++++IDEA additional info: ++++Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP ++++<+>UTF-8 ++++=================================================================== ++++diff --git a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/manager/HookManager.java b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/manager/HookManager.java ++++--- a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/manager/HookManager.java (revision 60d9051d52d70ed86db8e0fc1a50da61f395e55a) +++++++ b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/manager/HookManager.java (revision 5436229cc153c4aec4cd6267d80f1e8301022990) ++++@@ -7,8 +7,8 @@ ++++ public class HookManager { ++++ ++++ private static HookManager instance; ++++- private final DiscordSRVHHook discordSRVHHook = new DiscordSRVHHook(this); ++++- private final EssentialsXDiscordHook essentialsXDiscordHook = new EssentialsXDiscordHook(this); +++++ private final DiscordSRVHHook discordSRVHHook = new DiscordSRVHHook(); +++++ private final EssentialsXDiscordHook essentialsXDiscordHook = new EssentialsXDiscordHook(); ++++ private final EssentialsXHook essentialsXHook = new EssentialsXHook(this); ++++ private final LuckPermsHook luckPermsHook = new LuckPermsHook(); ++++ private final SuperVanishHook superVanishHook = new SuperVanishHook(); ++++Index: CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/update/UpdateChecker.java ++++IDEA additional info: ++++Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP ++++<+>UTF-8 ++++=================================================================== ++++diff --git a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/update/UpdateChecker.java b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/update/UpdateChecker.java ++++--- a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/update/UpdateChecker.java (revision 60d9051d52d70ed86db8e0fc1a50da61f395e55a) +++++++ b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/update/UpdateChecker.java (revision 5436229cc153c4aec4cd6267d80f1e8301022990) ++++@@ -22,6 +22,7 @@ ++++ this.plugin = plugin; ++++ } ++++ +++++ @SuppressWarnings("unused") ++++ public void sendGithubUpdate(){ ++++ getVersion("github" ,version -> { ++++ if (plugin.getDescription().getVersion().equalsIgnoreCase(version)) { ++++@@ -60,7 +61,6 @@ ++++ break; ++++ case "github": ++++ url = UpdateSettings.API_UPDATE[1]; ++++- ++++ break; ++++ default: ++++ Logger.error("Invalid source for update check: " + source); ++++@@ -76,7 +76,7 @@ ++++ String latestRelease = scanner.next(); ++++ Gson gson = new Gson(); ++++ JsonObject json= gson.fromJson(latestRelease, JsonObject.class); ++++- String versionName = json.get("name").getAsString(); +++++ String versionName = json.get("tag_name").getAsString(); ++++ ++++ if(versionName.contains("Beta")){ ++++ Logger.info("The latest release is a beta version: " + versionName); ++++@@ -88,10 +88,7 @@ ++++ }else{ ++++ consumer.accept(scanner.next()); ++++ } ++++- ++++- ++++ } ++++- ++++ } catch (IOException e) { ++++ Logger.error("Could not check for updates: &c" + e.getMessage()); ++++ } ++++Index: CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/utils/GroupHelper.java ++++IDEA additional info: ++++Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP ++++<+>UTF-8 ++++=================================================================== ++++diff --git a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/utils/GroupHelper.java b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/utils/GroupHelper.java ++++--- a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/utils/GroupHelper.java (revision 60d9051d52d70ed86db8e0fc1a50da61f395e55a) +++++++ b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/utils/GroupHelper.java (revision 5436229cc153c4aec4cd6267d80f1e8301022990) ++++@@ -12,8 +12,6 @@ ++++ import org.bukkit.Sound; ++++ import org.bukkit.configuration.file.FileConfiguration; ++++ import org.bukkit.entity.Player; ++++-import org.bukkit.event.player.PlayerJoinEvent; ++++-import org.bukkit.event.player.PlayerQuitEvent; ++++ import org.jetbrains.annotations.Contract; ++++ import org.jetbrains.annotations.NotNull; ++++ ++++@@ -43,7 +41,7 @@ ++++ this.essentialsXDiscordHook = essentialsXDiscordHook; ++++ } ++++ ++++- public void onJoin(Player player, FileConfiguration config, PlayerJoinEvent playerJoinEvent) { +++++ public void onJoin(Player player, FileConfiguration config) { ++++ String temp = ""; ++++ ++++ String join = groupManager.getJoin(group); ++++@@ -59,126 +57,97 @@ ++++ ++++ temp = Util.color(Util.getVar(player, temp)); ++++ ++++- boolean isNormalType = groupManager.getType(group).equalsIgnoreCase("normal"); ++++- boolean isModifyType = groupManager.getType(group).equalsIgnoreCase("modify"); ++++- ++++ MessageBuilder messageBuilder = new MessageBuilder(player, temp); ++++ ++++ if (config.getBoolean("Config.Show-Chat-In-Console")) { ++++ Logger.info(messageBuilder.getText()); ++++ } ++++ ++++- if (isNormalType) { ++++- playerJoinEvent.setJoinMessage(temp); ++++- if (discordSRVHHook.isEnabled()) { ++++- ++++- if (Settings.hook_discordsrv_channelid.equalsIgnoreCase("none")) ++++- return; ++++- ++++- DiscordUtil.sendMessageBlocking( ++++- DiscordUtil.getTextChannelById(Settings.hook_discordsrv_channelid), ++++- Util.colorless(messageBuilder.getText())); ++++- } ++++- ++++- if (essentialsXDiscordHook.isEnabled()) { ++++- if (Settings.hook_essentialsDiscord_channelid.equalsIgnoreCase("none")) ++++- return; ++++- ++++- essentialsXDiscordHook.sendJoinMessage(Settings.hook_essentialsDiscord_channelid, ++++- Util.colorless(messageBuilder.getText())); ++++- } ++++- } else if (isModifyType) { ++++- ++++- boolean isHover = groupManager.isHover(group); ++++- boolean isClick = groupManager.isClick(group); ++++- boolean isTitle = groupManager.isTitle(group); ++++- boolean isSound = groupManager.isSound(group); ++++- boolean isActionBar = groupManager.isActionbar(group); ++++- boolean isSoundAll = groupManager.isSoundAll(group); +++++ boolean isHover = groupManager.isHover(group); +++++ boolean isClick = groupManager.isClick(group); +++++ boolean isTitle = groupManager.isTitle(group); +++++ boolean isSound = groupManager.isSound(group); +++++ boolean isActionBar = groupManager.isActionbar(group); +++++ boolean isSoundAll = groupManager.isSoundAll(group); ++++ ++++- List Hover_Text = groupManager.getHover(group); +++++ List Hover_Text = groupManager.getHover(group); ++++ ++++- String isClick_Mode = groupManager.getClickMode(group); ++++- String Action_Command = groupManager.getClickCommand(group); ++++- String Action_Url = groupManager.getClickUrl(group); ++++- String Action_Suggest = groupManager.getClickSuggestCommand(group); ++++- String Title_Text = groupManager.getTitle(group); ++++- String SubTitle_Text = groupManager.getSubTitle(group); ++++- String Actionbar_Text = groupManager.getActionbar(group); ++++- String Sound_Name = groupManager.getSound(group); +++++ String isClick_Mode = groupManager.getClickMode(group); +++++ String Action_Command = groupManager.getClickCommand(group); +++++ String Action_Url = groupManager.getClickUrl(group); +++++ String Action_Suggest = groupManager.getClickSuggestCommand(group); +++++ String Title_Text = groupManager.getTitle(group); +++++ String SubTitle_Text = groupManager.getSubTitle(group); +++++ String Actionbar_Text = groupManager.getActionbar(group); +++++ String Sound_Name = groupManager.getSound(group); ++++ ++++- int FadeIn = groupManager.getFadeIn(group); ++++- int Stay = groupManager.getStay(group); ++++- int FadeOut = groupManager.getFadeOut(group); ++++- int Sound_Volume = groupManager.getVolume(group); ++++- float Sound_Pitch = groupManager.getPitch(group); +++++ int FadeIn = groupManager.getFadeIn(group); +++++ int Stay = groupManager.getStay(group); +++++ int FadeOut = groupManager.getFadeOut(group); +++++ int Sound_Volume = groupManager.getVolume(group); +++++ float Sound_Pitch = groupManager.getPitch(group); ++++ ++++- if (isHover) { ++++- if (isClick) { ++++- if (isClick_Mode.equalsIgnoreCase("command")) { ++++- messageBuilder.setHover(Hover_Text).setExecuteCommand(Action_Command).sendToAll(); ++++- } else if (isClick_Mode.equalsIgnoreCase("url")) { ++++- messageBuilder.setHover(Hover_Text).setOpenURL(Action_Url).sendToAll(); ++++- } else if (isClick_Mode.equalsIgnoreCase("suggest")) { ++++- messageBuilder.setHover(Hover_Text).setSuggestCommand(Action_Suggest).sendToAll(); ++++- } ++++- } else { ++++- messageBuilder.setHover(Hover_Text).sendToAll(); ++++- } ++++- } else { ++++- if (isClick) { ++++- if (isClick_Mode.equalsIgnoreCase("command")) { ++++- messageBuilder.setExecuteCommand(Action_Command).sendToAll(); ++++- } else if (isClick_Mode.equalsIgnoreCase("url")) { ++++- messageBuilder.setOpenURL(Action_Url).sendToAll(); ++++- } else if (isClick_Mode.equalsIgnoreCase("suggest")) { ++++- messageBuilder.setSuggestCommand(Action_Suggest).sendToAll(); ++++- } ++++- } else { ++++- messageBuilder.sendToAll(); ++++- } ++++- } +++++ if (isHover) { +++++ if (isClick) { +++++ if (isClick_Mode.equalsIgnoreCase("command")) { +++++ messageBuilder.setHover(Hover_Text).setExecuteCommand(Action_Command).sendToAll(); +++++ } else if (isClick_Mode.equalsIgnoreCase("url")) { +++++ messageBuilder.setHover(Hover_Text).setOpenURL(Action_Url).sendToAll(); +++++ } else if (isClick_Mode.equalsIgnoreCase("suggest")) { +++++ messageBuilder.setHover(Hover_Text).setSuggestCommand(Action_Suggest).sendToAll(); +++++ } +++++ } else { +++++ messageBuilder.setHover(Hover_Text).sendToAll(); +++++ } +++++ } else { +++++ if (isClick) { +++++ if (isClick_Mode.equalsIgnoreCase("command")) { +++++ messageBuilder.setExecuteCommand(Action_Command).sendToAll(); +++++ } else if (isClick_Mode.equalsIgnoreCase("url")) { +++++ messageBuilder.setOpenURL(Action_Url).sendToAll(); +++++ } else if (isClick_Mode.equalsIgnoreCase("suggest")) { +++++ messageBuilder.setSuggestCommand(Action_Suggest).sendToAll(); +++++ } +++++ } else { +++++ messageBuilder.sendToAll(); +++++ } +++++ } ++++ ++++- if (discordSRVHHook.isEnabled()) { ++++- DiscordUtil.sendMessageBlocking( ++++- DiscordUtil.getTextChannelById(Settings.hook_discordsrv_channelid), ++++- Util.colorless(messageBuilder.getText())); ++++- } +++++ if (discordSRVHHook.isEnabled()) { +++++ DiscordUtil.sendMessageBlocking( +++++ DiscordUtil.getTextChannelById(Settings.hook_discordSrv_channelId), +++++ Util.colorless(messageBuilder.getText())); +++++ } ++++ ++++- if (isTitle) { ++++- Titles.sendTitle(player, FadeIn, Stay, FadeOut, Util.color(Util.getVar(player, Title_Text)), ++++- Util.color(Util.getVar(player, SubTitle_Text))); ++++- } +++++ if (isTitle) { +++++ Titles.sendTitle(player, FadeIn, Stay, FadeOut, Util.color(Util.getVar(player, Title_Text)), +++++ Util.color(Util.getVar(player, SubTitle_Text))); +++++ } ++++ ++++- if (isActionBar) { ++++- ActionBar.sendActionBar(player, Util.color(Util.getVar(player, Actionbar_Text))); ++++- } +++++ if (isActionBar) { +++++ ActionBar.sendActionBar(player, Util.color(Util.getVar(player, Actionbar_Text))); +++++ } ++++ ++++- try { ++++- if (isSound) { ++++- if (isSoundAll) { ++++- Location location = player.getLocation(); ++++- player.playSound(location, Sound.valueOf(Sound_Name), Sound_Volume, Sound_Pitch); ++++- } else { ++++- for (Player pp : Bukkit.getOnlinePlayers()) { ++++- Location location = player.getLocation(); ++++- pp.playSound(location, Sound.valueOf(Sound_Name), Sound_Volume, Sound_Pitch); ++++- } ++++- } ++++- } ++++- } catch (Exception ex) { ++++- Logger.warning("&eVerify that the sound name is correct or belongs to the version"); ++++- } +++++ try { +++++ if (isSound) { +++++ if (isSoundAll) { +++++ Location location = player.getLocation(); +++++ player.playSound(location, Sound.valueOf(Sound_Name), Sound_Volume, Sound_Pitch); +++++ } else { +++++ for (Player pp : Bukkit.getOnlinePlayers()) { +++++ Location location = player.getLocation(); +++++ pp.playSound(location, Sound.valueOf(Sound_Name), Sound_Volume, Sound_Pitch); +++++ } +++++ } +++++ } +++++ } catch (Exception ex) { +++++ Logger.warning("&eVerify that the sound name is correct or belongs to the version"); ++++ } ++++ } ++++ ++++- public void onQuit(Player player, @NotNull FileConfiguration config, PlayerQuitEvent playerQuitEvent) { +++++ public void onQuit(Player player, @NotNull FileConfiguration config) { ++++ String quit = groupManager.getQuit(group); ++++ ++++- ++++- boolean isNormalType = groupManager.getType(group).equalsIgnoreCase("normal"); ++++- boolean isModifyType = groupManager.getType(group).equalsIgnoreCase("modify"); ++++- ++++ quit = Util.color(Util.getVar(player, quit)); ++++ ++++ MessageBuilder messageBuilder = new MessageBuilder(player, quit); ++++@@ -186,102 +155,82 @@ ++++ Logger.info(messageBuilder.getText()); ++++ } ++++ ++++- if (isNormalType) { ++++- playerQuitEvent.setQuitMessage(quit); ++++- if (discordSRVHHook.isEnabled()) { ++++- if (Settings.hook_discordsrv_channelid.equalsIgnoreCase("none")) ++++- return; ++++- DiscordUtil.sendMessageBlocking( ++++- DiscordUtil.getTextChannelById(Settings.hook_discordsrv_channelid), ++++- Util.colorless(messageBuilder.getText())); ++++- } ++++- ++++- if (essentialsXDiscordHook.isEnabled()) { ++++- if (Settings.hook_essentialsDiscord_channelid.equalsIgnoreCase("none")) ++++- return; ++++- essentialsXDiscordHook.sendQuitMessage(Settings.hook_essentialsDiscord_channelid, ++++- Util.colorless(messageBuilder.getText())); ++++- } ++++- } else if (isModifyType) { ++++- ++++- boolean isHover = groupManager.isHover(group); ++++- boolean isClick = groupManager.isClick(group); ++++- boolean isSound = groupManager.isSound(group); ++++- boolean isSoundAll = groupManager.isSoundAll(group); +++++ boolean isHover = groupManager.isHover(group); +++++ boolean isClick = groupManager.isClick(group); +++++ boolean isSound = groupManager.isSound(group); +++++ boolean isSoundAll = groupManager.isSoundAll(group); ++++ ++++- List Hover_Text = groupManager.getHover(group); +++++ List Hover_Text = groupManager.getHover(group); ++++ ++++- String isClick_Mode = groupManager.getClickMode(group); ++++- String Action_Command = groupManager.getClickCommand(group); ++++- String Action_Url = groupManager.getClickUrl(group); ++++- String Action_Suggest = groupManager.getClickSuggestCommand(group); ++++- String Sound_Name = groupManager.getSound(group); +++++ String isClick_Mode = groupManager.getClickMode(group); +++++ String Action_Command = groupManager.getClickCommand(group); +++++ String Action_Url = groupManager.getClickUrl(group); +++++ String Action_Suggest = groupManager.getClickSuggestCommand(group); +++++ String Sound_Name = groupManager.getSound(group); ++++ ++++- int Sound_Volume = groupManager.getVolume(group); ++++- float Sound_Pitch = groupManager.getPitch(group); +++++ int Sound_Volume = groupManager.getVolume(group); +++++ float Sound_Pitch = groupManager.getPitch(group); ++++ ++++- if (isHover) { ++++- if (isClick) { ++++- if (isClick_Mode.equalsIgnoreCase("command")) { ++++- messageBuilder.setHover(Hover_Text).setExecuteCommand(Action_Command).sendToAll(); ++++- } else if (isClick_Mode.equalsIgnoreCase("url")) { ++++- messageBuilder.setHover(Hover_Text).setOpenURL(Action_Url).sendToAll(); ++++- } else if (isClick_Mode.equalsIgnoreCase("suggest")) { ++++- messageBuilder.setHover(Hover_Text).setSuggestCommand(Action_Suggest).sendToAll(); ++++- } ++++- } else { ++++- messageBuilder.setHover(Hover_Text).sendToAll(); ++++- } ++++- } else { ++++- if (isClick) { ++++- if (isClick_Mode.equalsIgnoreCase("command")) { ++++- messageBuilder.setExecuteCommand(Action_Command).sendToAll(); ++++- } else if (isClick_Mode.equalsIgnoreCase("url")) { ++++- messageBuilder.setOpenURL(Action_Url).sendToAll(); ++++- } else if (isClick_Mode.equalsIgnoreCase("suggest")) { ++++- messageBuilder.setSuggestCommand(Action_Suggest).sendToAll(); ++++- } ++++- } else { ++++- messageBuilder.sendToAll(); ++++- } ++++- } +++++ if (isHover) { +++++ if (isClick) { +++++ if (isClick_Mode.equalsIgnoreCase("command")) { +++++ messageBuilder.setHover(Hover_Text).setExecuteCommand(Action_Command).sendToAll(); +++++ } else if (isClick_Mode.equalsIgnoreCase("url")) { +++++ messageBuilder.setHover(Hover_Text).setOpenURL(Action_Url).sendToAll(); +++++ } else if (isClick_Mode.equalsIgnoreCase("suggest")) { +++++ messageBuilder.setHover(Hover_Text).setSuggestCommand(Action_Suggest).sendToAll(); +++++ } +++++ } else { +++++ messageBuilder.setHover(Hover_Text).sendToAll(); +++++ } +++++ } else { +++++ if (isClick) { +++++ if (isClick_Mode.equalsIgnoreCase("command")) { +++++ messageBuilder.setExecuteCommand(Action_Command).sendToAll(); +++++ } else if (isClick_Mode.equalsIgnoreCase("url")) { +++++ messageBuilder.setOpenURL(Action_Url).sendToAll(); +++++ } else if (isClick_Mode.equalsIgnoreCase("suggest")) { +++++ messageBuilder.setSuggestCommand(Action_Suggest).sendToAll(); +++++ } +++++ } else { +++++ messageBuilder.sendToAll(); +++++ } +++++ } ++++ ++++- if (discordSRVHHook.isEnabled()) { +++++ if (discordSRVHHook.isEnabled()) { ++++ ++++- if (Settings.hook_discordsrv_channelid.equalsIgnoreCase("none")) ++++- return; +++++ if (Settings.hook_discordSrv_channelId.equalsIgnoreCase("none")) +++++ return; ++++ ++++- DiscordUtil.sendMessageBlocking( ++++- DiscordUtil.getTextChannelById(Settings.hook_discordsrv_channelid), ++++- Util.colorless(messageBuilder.getText())); ++++- } +++++ DiscordUtil.sendMessageBlocking( +++++ DiscordUtil.getTextChannelById(Settings.hook_discordSrv_channelId), +++++ Util.colorless(messageBuilder.getText())); +++++ } ++++ ++++- if (essentialsXDiscordHook.isEnabled()) { +++++ if (essentialsXDiscordHook.isEnabled()) { ++++ ++++- if (Settings.hook_essentialsDiscord_channelid.equalsIgnoreCase("none")) ++++- return; +++++ if (Settings.hook_essentialsDiscord_channelId.equalsIgnoreCase("none")) +++++ return; ++++ ++++- essentialsXDiscordHook.sendQuitMessage(Settings.hook_essentialsDiscord_channelid, ++++- Util.colorless(messageBuilder.getText())); ++++- } +++++ essentialsXDiscordHook.sendQuitMessage(Settings.hook_essentialsDiscord_channelId, +++++ Util.colorless(messageBuilder.getText())); +++++ } ++++ ++++- try { ++++- if (isSound) { ++++- if (isSoundAll) { ++++- Location location = player.getLocation(); ++++- player.playSound(location, Sound.valueOf(Sound_Name), Sound_Volume, Sound_Pitch); ++++- } else { ++++- for (Player pp : Bukkit.getOnlinePlayers()) { ++++- Location location = player.getLocation(); ++++- pp.playSound(location, Sound.valueOf(Sound_Name), Sound_Volume, Sound_Pitch); ++++- } ++++- } ++++- } ++++- } catch (Exception ex) { ++++- Logger.warning("&eVerify that the sound name is correct or belongs to the version"); ++++- } ++++- } +++++ try { +++++ if (isSound) { +++++ if (isSoundAll) { +++++ Location location = player.getLocation(); +++++ player.playSound(location, Sound.valueOf(Sound_Name), Sound_Volume, Sound_Pitch); +++++ } else { +++++ for (Player pp : Bukkit.getOnlinePlayers()) { +++++ Location location = player.getLocation(); +++++ pp.playSound(location, Sound.valueOf(Sound_Name), Sound_Volume, Sound_Pitch); +++++ } +++++ } +++++ } +++++ } catch (Exception ex) { +++++ Logger.warning("&eVerify that the sound name is correct or belongs to the version"); +++++ } +++++ } ++++ ++++- } ++++- ++++ } ++++Index: CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/utils/Settings.java ++++IDEA additional info: ++++Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP ++++<+>UTF-8 ++++=================================================================== ++++diff --git a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/utils/Settings.java b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/utils/Settings.java ++++--- a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/utils/Settings.java (revision 60d9051d52d70ed86db8e0fc1a50da61f395e55a) +++++++ b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/utils/Settings.java (revision 5436229cc153c4aec4cd6267d80f1e8301022990) ++++@@ -14,7 +14,6 @@ ++++ public static boolean settings_debug; ++++ ++++ //Join section ++++- public static String join_type; ++++ ++++ public static boolean join; ++++ public static String join_message; ++++@@ -25,9 +24,9 @@ ++++ public static boolean join_title; ++++ public static String join_message_title_title; ++++ public static String join_message_title_subtitle; ++++- public static int join_title_fadein; +++++ public static int join_title_fadeIn; ++++ public static int join_title_stay; ++++- public static int join_title_fadeout; +++++ public static int join_title_fadeOut; ++++ ++++ public static boolean join_actionbar; ++++ public static String join_message_actionbar_text; ++++@@ -38,33 +37,23 @@ ++++ public static int join_sound_vol; ++++ ++++ //Quit section ++++- ++++- public static String quit_type; ++++- ++++ public static boolean quit; ++++ public static String quit_message; ++++ ++++- public static boolean quit_sound; ++++- public static String quit_sound_name; ++++- public static float quit_sound_pitch; ++++- public static int quit_sound_vol; ++++- ++++ //Welcome section ++++ public static boolean welcome; ++++ public static List list_welcome; ++++ ++++ //Hooks section ++++- public static boolean hook_discordsrv; ++++- public static boolean hook_discordsrv_use_message; ++++- public static String hook_discordsrv_channelid; +++++ public static boolean hook_discordSrv; +++++ public static String hook_discordSrv_channelId; ++++ ++++ public static boolean hook_essentials; ++++- public static boolean hook_essentials_hideplayervanish; +++++ public static boolean hook_essentials_hidePlayerVanish; ++++ ++++ public static boolean hook_essentialsDiscord; ++++ public static boolean hook_essentialsDiscord_use_default_channel; ++++- public static String hook_essentialsDiscord_channelid; +++++ public static String hook_essentialsDiscord_channelId; ++++ public static boolean hook_luckperms; ++++- public static boolean hook_luckperms_use_group; ++++ public static long hook_luckperms_autoUpdate_group_tick; ++++ } ++++Index: CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/utils/Util.java ++++IDEA additional info: ++++Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP ++++<+>UTF-8 ++++=================================================================== ++++diff --git a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/utils/Util.java b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/utils/Util.java ++++--- a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/utils/Util.java (revision 60d9051d52d70ed86db8e0fc1a50da61f395e55a) +++++++ b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/utils/Util.java (revision 5436229cc153c4aec4cd6267d80f1e8301022990) ++++@@ -67,10 +67,8 @@ ++++ return prefix; ++++ } ++++ ++++- ++++ public static @NotNull List setTabLimit(final @NotNull List options, final String lastArgs) { ++++ final List returned = new ArrayList<>(); ++++- ++++ for (String s : options) { ++++ if (s == null) { ++++ continue; ++++@@ -82,25 +80,11 @@ ++++ return returned; ++++ } ++++ ++++- @SuppressWarnings("unused") ++++- public static void sendTextComponentHover(@NotNull Player j, String action, String message, String subMessage, String color) { ++++- TextComponent msg = new TextComponent(color(message)); ++++- msg.setHoverEvent(new HoverEvent(HoverEvent.Action.valueOf(getActionHoverType(action)), new ComponentBuilder(subMessage).color(ChatColor.of(color)).create())); ++++- j.spigot().sendMessage(msg); ++++- } ++++- ++++ public static void sendTextComponent116Hover(@NotNull Player j, String action, String message, String subMessage) { ++++ TextComponent msg = new TextComponent(color(message)); ++++ msg.setHoverEvent(new HoverEvent(HoverEvent.Action.valueOf(getActionHoverType(action)), new ComponentBuilder(color(subMessage)).create())); ++++ j.spigot().sendMessage(msg); ++++ } ++++- ++++- @SuppressWarnings("unused") ++++- public static void sendTextComponentClick(@NotNull Player j, String action, String message, String arg0) { ++++- TextComponent msg = new TextComponent(color(message)); ++++- msg.setClickEvent(new ClickEvent(ClickEvent.Action.valueOf(getActionClickType(action)), arg0)); ++++- j.spigot().sendMessage(msg); ++++- } ++++ ++++ public static void sendAllPlayerBaseComponent(BaseComponent component) { ++++ for (Player p : Bukkit.getOnlinePlayers()) { ++++@@ -120,16 +104,6 @@ ++++ } ++++ return null; ++++ } ++++- ++++- public static @Nullable String getActionClickType(@NotNull String arg) { ++++- if (arg.equalsIgnoreCase("url")) { ++++- return "OPEN_URL"; ++++- } ++++- if (arg.equalsIgnoreCase("cmd")) { ++++- return "RUN_COMMAND"; ++++- } ++++- return null; ++++- } ++++ ++++ public static @NotNull String getVar(@NotNull Player player, String text) { ++++ text = text.replace("", player.getName()); ++++Index: CustomJoinAndQuitMessagesOld/src/main/resources/config.yml ++++IDEA additional info: ++++Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP ++++<+>UTF-8 ++++=================================================================== ++++diff --git a/CustomJoinAndQuitMessagesOld/src/main/resources/config.yml b/CustomJoinAndQuitMessagesOld/src/main/resources/config.yml ++++--- a/CustomJoinAndQuitMessagesOld/src/main/resources/config.yml (revision 60d9051d52d70ed86db8e0fc1a50da61f395e55a) +++++++ b/CustomJoinAndQuitMessagesOld/src/main/resources/config.yml (revision 5436229cc153c4aec4cd6267d80f1e8301022990) ++++@@ -105,9 +105,6 @@ ++++ # |Text| Here you can set the join message for the first time ++++ Text: '&6Welcome to server &a&6 for the first time' ++++ ++++- # |Type| Here you can find two types that are [ normal | modify ] ++++- Type: modify ++++- ++++ # |HoverEvent| This section allows you to modify the hover events in the chat ++++ HoverEvent: ++++ ++++@@ -129,12 +126,6 @@ ++++ # |Mode| there are three different modes which are [ command | suggest | url ] ++++ Mode: command ++++ ++++- # This feature is not available yet ++++- DevActions: ++++- - '[Suggest]: /help' ++++- - '[Execute]: /me hello test' ++++- - '[Open]: https://www.spigotmc.org/resources/custom-join-and-quit-message-1-7-x-1-17-x.57006/' ++++- ++++ # |Actions| This is where are the available events that you can use ++++ Actions: ++++ ++++@@ -205,9 +196,6 @@ ++++ # |Text| This is where Quit customizable message is located ++++ Text: '&b[<#:FF8E8E>-&b] <#:A157FF>' ++++ ++++- # |Type| Here you can find two types that are [ normal | modify ] ++++- Type: normal ++++- ++++ # |HoverEvent| This section allows you to modify the hover events in the chat ++++ HoverEvent: ++++ ++++@@ -280,7 +268,7 @@ ++++ - '&m=========================================&r' ++++ # ++++ # |File-Version|I would not change anything ++++-File-Version: 3 +++++File-Version: 4 ++++ # |> This is the end of the configuration ... [-_-] more things coming soon ++++ # ++++ # | Config File | ++++Index: CustomJoinAndQuitMessagesOld/src/main/resources/groups.yml ++++IDEA additional info: ++++Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP ++++<+>UTF-8 ++++=================================================================== ++++diff --git a/CustomJoinAndQuitMessagesOld/src/main/resources/groups.yml b/CustomJoinAndQuitMessagesOld/src/main/resources/groups.yml ++++--- a/CustomJoinAndQuitMessagesOld/src/main/resources/groups.yml (revision 60d9051d52d70ed86db8e0fc1a50da61f395e55a) +++++++ b/CustomJoinAndQuitMessagesOld/src/main/resources/groups.yml (revision 5436229cc153c4aec4cd6267d80f1e8301022990) ++++@@ -32,9 +32,6 @@ ++++ ++++ # |Text| Here you can set the join message for the first time ++++ Text: '&6Welcome to server &a&6 for the first time' ++++- ++++- # |Type| Here you can find two types that are [ normal | modify ] ++++- Type: modify ++++ ++++ # |HoverEvent| This section allows you to modify the hover events in the chat ++++ HoverEvent: ++++Index: bukkit/src/main/java/jss/customjoinandquitmessage/commands/subcommands/InfoCommand.java ++++IDEA additional info: ++++Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP ++++<+>UTF-8 ++++=================================================================== ++++diff --git a/bukkit/src/main/java/jss/customjoinandquitmessage/commands/subcommands/InfoCommand.java b/bukkit/src/main/java/jss/customjoinandquitmessage/commands/subcommands/InfoCommand.java ++++--- a/bukkit/src/main/java/jss/customjoinandquitmessage/commands/subcommands/InfoCommand.java (revision 60d9051d52d70ed86db8e0fc1a50da61f395e55a) +++++++ b/bukkit/src/main/java/jss/customjoinandquitmessage/commands/subcommands/InfoCommand.java (revision 5436229cc153c4aec4cd6267d80f1e8301022990) ++++@@ -9,6 +9,11 @@ ++++ return "info"; ++++ } ++++ +++++ @Override +++++ public String permission() { +++++ return null; +++++ } +++++ ++++ public void onCommand(CommandSender sender, String[] args) { ++++ ++++ } ++++Index: patches/Removed_debugging_messages_in_the_LuckPermsHook_class_.patch ++++IDEA additional info: ++++Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP ++++<+>UTF-8 ++++=================================================================== ++++diff --git a/patches/Removed_debugging_messages_in_the_LuckPermsHook_class_.patch b/patches/Removed_debugging_messages_in_the_LuckPermsHook_class_.patch ++++new file mode 100644 ++++--- /dev/null (revision 5436229cc153c4aec4cd6267d80f1e8301022990) +++++++ b/patches/Removed_debugging_messages_in_the_LuckPermsHook_class_.patch (revision 5436229cc153c4aec4cd6267d80f1e8301022990) ++++@@ -0,0 +1,29 @@ +++++Index: CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/hook/LuckPermsHook.java +++++IDEA additional info: +++++Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +++++<+>UTF-8 +++++=================================================================== +++++diff --git a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/hook/LuckPermsHook.java b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/hook/LuckPermsHook.java +++++--- a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/hook/LuckPermsHook.java (revision 52d1e6b32c970d5470b3f06b418c1d1ef9e3aeb1) ++++++++ b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/hook/LuckPermsHook.java (revision 60d9051d52d70ed86db8e0fc1a50da61f395e55a) +++++@@ -25,19 +25,16 @@ +++++ if (!Bukkit.getPluginManager().isPluginEnabled("LuckPerms")) { +++++ Logger.warning("&eLuckPerms not enabled! - Disable Features..."); +++++ this.isEnabled = false; +++++- System.out.println("Cjm Softdepend: Luckperms false - check plugin installed in plugin folder"); +++++ return; +++++ } +++++ +++++ if (!Settings.hook_luckperms) { +++++ this.isEnabled = false; +++++- System.out.println("Cjm Softdepend: Luckperms false - Hook Enabled in config"); +++++- Logger.warning("&eLuckPerms not enabled! - Disable Features..."); ++++++ System.out.println("Cjm Softdepend: Luckperms false - Hook disabled in config"); +++++ return; +++++ } +++++ +++++ this.isEnabled = true; +++++- System.out.println("Cjm Softdepend: Luckperms true - The plugin has successfully loaded the dependency"); +++++ Util.sendColorMessage(EventUtils.getStaticConsoleSender(), Util.getPrefix(true) + "&aLoading LuckPerms features..."); +++++ } +++++ From fbf02ea5bb82e73ac06e4c07579c2ed6d10d56ad Mon Sep 17 00:00:00 2001 From: SrJss <31166687+jonagamerpro1234@users.noreply.github.com> Date: Tue, 11 Apr 2023 13:48:12 -0400 Subject: [PATCH 22/27] Fixed color code detection in the quit message --- .../hook/PlaceholderApiHook.java | 8 +------- .../listener/chat/QuitListener.java | 3 +-- .../manager/HookManager.java | 2 +- .../utils/EventUtils.java | 1 - .../utils/Settings.java | 16 ++++++++++++---- 5 files changed, 15 insertions(+), 15 deletions(-) diff --git a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/hook/PlaceholderApiHook.java b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/hook/PlaceholderApiHook.java index 7ea947f..4d09b7e 100644 --- a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/hook/PlaceholderApiHook.java +++ b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/hook/PlaceholderApiHook.java @@ -1,21 +1,15 @@ package jss.customjoinandquitmessages.hook; -import jss.customjoinandquitmessages.manager.HookManager; import jss.customjoinandquitmessages.utils.EventUtils; -import jss.customjoinandquitmessages.utils.logger.Logger; import jss.customjoinandquitmessages.utils.Util; import jss.customjoinandquitmessages.utils.interfaces.IHook; +import jss.customjoinandquitmessages.utils.logger.Logger; import org.bukkit.Bukkit; public class PlaceholderApiHook implements IHook { - @SuppressWarnings("unused") - private final HookManager hooksManager; private boolean isEnabled; - public PlaceholderApiHook(HookManager hooksManager) { - this.hooksManager = hooksManager; - } public void setup() { if (!Bukkit.getPluginManager().isPluginEnabled("PlaceholderAPI")) { diff --git a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/listener/chat/QuitListener.java b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/listener/chat/QuitListener.java index 04afe1e..148488f 100644 --- a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/listener/chat/QuitListener.java +++ b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/listener/chat/QuitListener.java @@ -77,8 +77,7 @@ public void onQuit(@NotNull PlayerQuitEvent e) { String text = config.getString("Quit.Text"); - text = Util.color(text); - text = Util.getVar(p, text); + text = Util.color(Util.getVar(p, text)); MessageBuilder messageBuilder = new MessageBuilder(p, text); diff --git a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/manager/HookManager.java b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/manager/HookManager.java index ab3a328..58258db 100644 --- a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/manager/HookManager.java +++ b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/manager/HookManager.java @@ -26,7 +26,7 @@ public static HookManager get() { } public void load() { - initHooks(new PlaceholderApiHook(this), + initHooks(new PlaceholderApiHook(), discordSRVHHook, essentialsXDiscordHook, essentialsXHook, diff --git a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/utils/EventUtils.java b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/utils/EventUtils.java index e68d214..b56a07f 100644 --- a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/utils/EventUtils.java +++ b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/utils/EventUtils.java @@ -5,7 +5,6 @@ import org.jetbrains.annotations.NotNull; public class EventUtils { - public static @NotNull ConsoleCommandSender getStaticConsoleSender() { return Bukkit.getConsoleSender(); } diff --git a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/utils/Settings.java b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/utils/Settings.java index 7836891..9283a62 100644 --- a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/utils/Settings.java +++ b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/utils/Settings.java @@ -4,8 +4,9 @@ public class Settings { + //Message section public static String messages_prefix; - public static boolean hook_luckperms_autoUpdate_group; + //Others public static String settings_defaultLanguage; public static boolean is_Group_Display; @@ -13,13 +14,13 @@ public class Settings { public static String chatformat_type; public static boolean settings_debug; - //Join section + //Join section and more public static boolean join; public static String join_message; - public static boolean firstjoin; public static String join_message_first; + //Title and Subtitle join public static boolean join_title; public static String join_message_title_title; public static String join_message_title_subtitle; @@ -27,9 +28,11 @@ public class Settings { public static int join_title_stay; public static int join_title_fadeOut; + //Actionbar Join public static boolean join_actionbar; public static String join_message_actionbar_text; + //Sound Join public static boolean join_sound; public static String join_sound_name; public static float join_sound_pitch; @@ -43,16 +46,21 @@ public class Settings { public static boolean welcome; public static List list_welcome; - //Hooks section + //DiscordSRV Hook public static boolean hook_discordSrv; public static String hook_discordSrv_channelId; + //Essentials Hook public static boolean hook_essentials; public static boolean hook_essentials_hidePlayerVanish; + //EssentialsDiscord Hook public static boolean hook_essentialsDiscord; public static boolean hook_essentialsDiscord_use_default_channel; public static String hook_essentialsDiscord_channelId; + + //LuckPerms Hook public static boolean hook_luckperms; public static long hook_luckperms_autoUpdate_group_tick; + public static boolean hook_luckperms_autoUpdate_group; } From 100d76ad6152f38482591b1599d59a349cbdc933 Mon Sep 17 00:00:00 2001 From: SrJss <31166687+jonagamerpro1234@users.noreply.github.com> Date: Wed, 12 Apr 2023 15:52:57 -0400 Subject: [PATCH 23/27] Fixed lang folder --- .../hook/PlaceholderApiHook.java | 1 - .../utils/Settings.java | 4 + .../utils/logger/FileLogger.java | 3 +- .../utils/logger/LoggerFileUtils.java | 84 + .../utils/logger/LoggerTask.java | 20 + .../src/main/resources/config.yml | 21 +- .../src/main/resources/lang/de_DE.yml | 20 +- .../src/main/resources/lang/es_ES.yml | 26 +- .../src/main/resources/lang/fr_FR.yml | 20 +- .../src/main/resources/lang/ru_RU.yml | 24 +- .../src/main/resources/lang/zh_CN.yml | 20 +- .../src/main/resources/lang/zh_TW.yml | 20 +- .../Update_Logger_and_more_changes___.patch | 3706 +++++++++++++++++ 13 files changed, 3899 insertions(+), 70 deletions(-) create mode 100644 CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/utils/logger/LoggerFileUtils.java create mode 100644 CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/utils/logger/LoggerTask.java create mode 100644 patches/Update_Logger_and_more_changes___.patch diff --git a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/hook/PlaceholderApiHook.java b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/hook/PlaceholderApiHook.java index 4d09b7e..e2b9709 100644 --- a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/hook/PlaceholderApiHook.java +++ b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/hook/PlaceholderApiHook.java @@ -10,7 +10,6 @@ public class PlaceholderApiHook implements IHook { private boolean isEnabled; - public void setup() { if (!Bukkit.getPluginManager().isPluginEnabled("PlaceholderAPI")) { this.isEnabled = false; diff --git a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/utils/Settings.java b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/utils/Settings.java index 9283a62..25fc084 100644 --- a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/utils/Settings.java +++ b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/utils/Settings.java @@ -9,6 +9,10 @@ public class Settings { //Others public static String settings_defaultLanguage; + public static boolean compress_logs; + public static boolean compress_logs_on_shutdown; + public static boolean delete_compressed_logs; + public static int delete_compressed_logs_after_days; public static boolean is_Group_Display; public static boolean settings_update; public static String chatformat_type; diff --git a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/utils/logger/FileLogger.java b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/utils/logger/FileLogger.java index acc4953..efd67e7 100644 --- a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/utils/logger/FileLogger.java +++ b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/utils/logger/FileLogger.java @@ -12,10 +12,9 @@ public class FileLogger { private static final CustomJoinAndQuitMessages plugin = CustomJoinAndQuitMessages.get(); private static final DateTimeFormatter DATE_TIME_FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); - private static final String LOG_DIRECTORY = "plugins/CustomJoinAndQuitMessages/logs"; private static void log(String message, Throwable exception) { - String logFileName = LOG_DIRECTORY + "/" + getLogFileName(); + String logFileName = LoggerFileUtils.getLogFileName() + getLogFileName(); String logMessage = "[" + LocalDateTime.now().format(DATE_TIME_FORMATTER) + "] " + message + System.lineSeparator(); String stackTrace = ""; diff --git a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/utils/logger/LoggerFileUtils.java b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/utils/logger/LoggerFileUtils.java new file mode 100644 index 0000000..e22aacc --- /dev/null +++ b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/utils/logger/LoggerFileUtils.java @@ -0,0 +1,84 @@ +package jss.customjoinandquitmessages.utils.logger; + +import org.jetbrains.annotations.NotNull; + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.time.LocalDateTime; +import java.time.format.DateTimeFormatter; +import java.util.zip.GZIPOutputStream; + +public class LoggerFileUtils { + + private static final String LOGS_DIR = "plugins/CustomJoinAndQuitMessages/logs/"; + private static final String LOGS_COMPRESSED_DIR = "logs/"; + private static final int MAX_LOG_AGE_IN_DAYS = 30; + + public static void compressLogs() { + File logsDir = new File(LOGS_DIR); + if (!logsDir.exists()) { + logsDir.mkdir(); + } + + File compressedLogsDir = new File(LOGS_COMPRESSED_DIR); + if (!compressedLogsDir.exists()) { + compressedLogsDir.mkdir(); + } + + File[] logFiles = logsDir.listFiles((dir, name) -> name.endsWith(".log")); + if (logFiles != null) { + for (File logFile : logFiles) { + if (isFileOld(logFile)) { + try (FileInputStream fis = new FileInputStream(logFile); + FileOutputStream fos = new FileOutputStream(compressedLogsDir + "/" + logFile.getName() + ".zip"); + GZIPOutputStream gzos = new GZIPOutputStream(fos)) { + + byte[] buffer = new byte[1024]; + int len; + while ((len = fis.read(buffer)) > 0) { + gzos.write(buffer, 0, len); + } + + fis.close(); + gzos.finish(); + gzos.close(); + logFile.delete(); + } catch (IOException e) { + e.printStackTrace(); + } + } + } + } + } + + public static void deleteOldCompressedLogs() { + File compressedLogsDir = new File(LOGS_COMPRESSED_DIR); + if (!compressedLogsDir.exists()) { + compressedLogsDir.mkdir(); + } + + File[] compressedLogFiles = compressedLogsDir.listFiles((dir, name) -> name.endsWith(".zip")); + if (compressedLogFiles != null) { + for (File compressedLogFile : compressedLogFiles) { + if (isFileOld(compressedLogFile)) { + compressedLogFile.delete(); + } + } + } + } + + private static boolean isFileOld(@NotNull File file) { + long diffInMillis = System.currentTimeMillis() - file.lastModified(); + long daysDiff = diffInMillis / (24 * 60 * 60 * 1000); + return daysDiff > MAX_LOG_AGE_IN_DAYS; + } + + public static @NotNull String getLogFileName() { + DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyyMMdd_HHmmss"); + LocalDateTime dateTime = LocalDateTime.now(); + return LOGS_DIR + formatter.format(dateTime) + ".log"; + } + +} diff --git a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/utils/logger/LoggerTask.java b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/utils/logger/LoggerTask.java new file mode 100644 index 0000000..a0e7760 --- /dev/null +++ b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/utils/logger/LoggerTask.java @@ -0,0 +1,20 @@ +package jss.customjoinandquitmessages.utils.logger; + +import jss.customjoinandquitmessages.utils.Settings; +import org.bukkit.scheduler.BukkitRunnable; + +public class LoggerTask extends BukkitRunnable { + + + public void run() { + if(Settings.compress_logs){ + LoggerFileUtils.compressLogs(); + } + + if(Settings.delete_compressed_logs){ + LoggerFileUtils.deleteOldCompressedLogs(); + } + } + + +} diff --git a/CustomJoinAndQuitMessagesOld/src/main/resources/config.yml b/CustomJoinAndQuitMessagesOld/src/main/resources/config.yml index a5b9c19..8a2386f 100644 --- a/CustomJoinAndQuitMessagesOld/src/main/resources/config.yml +++ b/CustomJoinAndQuitMessagesOld/src/main/resources/config.yml @@ -36,6 +36,23 @@ Config: # |Show-Chat-In-Console| here you can enable or disable the chat to be seen in the console Show-Chat-In-Console: true + + # + Logger: + + # + Compress_logs: true + + # + Compress_logs_on_shutdown: true + + # + Delete_compressed_logs: true + + # + Delete_compressed_logs_after_days: 7 + + # # |Hooks| Hooks: @@ -254,7 +271,7 @@ Welcome: # |Enabled| Here you can enable or disable this feature Enabled: true - # + # [!] |Disabled| UsePerGroupWelcome: false # |Text| here you can set your own welcome message when entering @@ -268,7 +285,7 @@ Welcome: - '<0>' - '&m=========================================&r' # -# |File-Version|I would not change anything +# |File-Version| I would not change anything File-Version: 4 # |> This is the end of the configuration ... [-_-] more things coming soon # diff --git a/CustomJoinAndQuitMessagesOld/src/main/resources/lang/de_DE.yml b/CustomJoinAndQuitMessagesOld/src/main/resources/lang/de_DE.yml index a87cfb6..0b8ade1 100644 --- a/CustomJoinAndQuitMessagesOld/src/main/resources/lang/de_DE.yml +++ b/CustomJoinAndQuitMessagesOld/src/main/resources/lang/de_DE.yml @@ -1,16 +1,16 @@ CustomJoinAndQuitMessage: Prefix: '&e[&dCustomJoinAndQuitMessages&e]' Help-Msg: - - '&b/CustomJoinAndQuitMessage &8| &9/Cjm &7these are the variants of the main plugin command' - - '&b/Cjm &ehelp &7show this same message' - - '&b/Cjm &ereload &7reload the plugin files' - - '&b/Cjm &einfo &7shows information about the plugin' - Help-Cmd: '&7Use &b/Cjm &6help&7 for more information' - Reload: '&aReload Completed' - Error-Cmd: '&cUnknown Argument' - No-Permission: '&cYou dont have permission to do that!' - No-Permission-Label: 'Ask the server owner or an administrator for help for more information.' - Sound-Error: 'the sound does not belong to the current version or the name is wrong' + - '&b/CustomJoinAndQuitMessage &8| &9/Cjm &7Dies sind die Varianten des Haupt-Plugin-Befehls' + - '&b/Cjm &ehelp &7zeige die gleiche Nachricht' + - '&b/Cjm &ereload &7Laden Sie die Plugin-Dateien neu' + - '&b/Cjm &einfo &7zeigt Informationen zum Plugin an' + Help-Cmd: '&7Verwenden &b/Cjm &6help&7 für mehr Informationen' + Reload: '&aNachladen abgeschlossen' + Error-Cmd: '&cUnbekanntes Argument' + No-Permission: '&cSie haben keine Erlaubnis dazu!' + No-Permission-Label: 'Bitten Sie den Serverbesitzer oder einen Administrator um Hilfe, um weitere Informationen zu erhalten' + Sound-Error: 'Der Sound gehört nicht zur aktuellen Version oder der Name ist falsch' DisplayManager.Error: '&c|!| &cPlease set de option for execute featured' DisplayManager.Sound.Usage: '&7Please select one of these two options to execute the function &e' Groups.NotFoundGroup: '&cThe group could not be found' diff --git a/CustomJoinAndQuitMessagesOld/src/main/resources/lang/es_ES.yml b/CustomJoinAndQuitMessagesOld/src/main/resources/lang/es_ES.yml index a87cfb6..c83c15a 100644 --- a/CustomJoinAndQuitMessagesOld/src/main/resources/lang/es_ES.yml +++ b/CustomJoinAndQuitMessagesOld/src/main/resources/lang/es_ES.yml @@ -1,16 +1,16 @@ CustomJoinAndQuitMessage: Prefix: '&e[&dCustomJoinAndQuitMessages&e]' Help-Msg: - - '&b/CustomJoinAndQuitMessage &8| &9/Cjm &7these are the variants of the main plugin command' - - '&b/Cjm &ehelp &7show this same message' - - '&b/Cjm &ereload &7reload the plugin files' - - '&b/Cjm &einfo &7shows information about the plugin' - Help-Cmd: '&7Use &b/Cjm &6help&7 for more information' - Reload: '&aReload Completed' - Error-Cmd: '&cUnknown Argument' - No-Permission: '&cYou dont have permission to do that!' - No-Permission-Label: 'Ask the server owner or an administrator for help for more information.' - Sound-Error: 'the sound does not belong to the current version or the name is wrong' - DisplayManager.Error: '&c|!| &cPlease set de option for execute featured' - DisplayManager.Sound.Usage: '&7Please select one of these two options to execute the function &e' - Groups.NotFoundGroup: '&cThe group could not be found' + - '&b/CustomJoinAndQuitMessage &8| &9/Cjm &7Estas son las variantes del comando del plgin principal' + - '&b/Cjm &ehelp &7muestrar este mismo mensaje' + - '&b/Cjm &ereload &7recargar los archivos del plugin' + - '&b/Cjm &einfo &7muestra información sobre el plugin' + Help-Cmd: '&7Use &b/Cjm &6help&7 para más información' + Reload: '&aRecarga Completada' + Error-Cmd: '&cArgumento desconocido' + No-Permission: '&cNo tienes permiso para hacer eso!' + No-Permission-Label: 'Solicite ayuda al propietario del servidor o a un administrador para obtener más información.' + Sound-Error: 'El sonido no pertenece a la versión actual o el nombre está mal' + DisplayManager.Error: '&c|!| &cEstablezca la opción para ver la caracteristica' + DisplayManager.Sound.Usage: '&7Seleccione una de estas dos opciones para ejecutar la función &e' + Groups.NotFoundGroup: '&cNo se pudo encontrar el grupo.' diff --git a/CustomJoinAndQuitMessagesOld/src/main/resources/lang/fr_FR.yml b/CustomJoinAndQuitMessagesOld/src/main/resources/lang/fr_FR.yml index a87cfb6..0b8ade1 100644 --- a/CustomJoinAndQuitMessagesOld/src/main/resources/lang/fr_FR.yml +++ b/CustomJoinAndQuitMessagesOld/src/main/resources/lang/fr_FR.yml @@ -1,16 +1,16 @@ CustomJoinAndQuitMessage: Prefix: '&e[&dCustomJoinAndQuitMessages&e]' Help-Msg: - - '&b/CustomJoinAndQuitMessage &8| &9/Cjm &7these are the variants of the main plugin command' - - '&b/Cjm &ehelp &7show this same message' - - '&b/Cjm &ereload &7reload the plugin files' - - '&b/Cjm &einfo &7shows information about the plugin' - Help-Cmd: '&7Use &b/Cjm &6help&7 for more information' - Reload: '&aReload Completed' - Error-Cmd: '&cUnknown Argument' - No-Permission: '&cYou dont have permission to do that!' - No-Permission-Label: 'Ask the server owner or an administrator for help for more information.' - Sound-Error: 'the sound does not belong to the current version or the name is wrong' + - '&b/CustomJoinAndQuitMessage &8| &9/Cjm &7Dies sind die Varianten des Haupt-Plugin-Befehls' + - '&b/Cjm &ehelp &7zeige die gleiche Nachricht' + - '&b/Cjm &ereload &7Laden Sie die Plugin-Dateien neu' + - '&b/Cjm &einfo &7zeigt Informationen zum Plugin an' + Help-Cmd: '&7Verwenden &b/Cjm &6help&7 für mehr Informationen' + Reload: '&aNachladen abgeschlossen' + Error-Cmd: '&cUnbekanntes Argument' + No-Permission: '&cSie haben keine Erlaubnis dazu!' + No-Permission-Label: 'Bitten Sie den Serverbesitzer oder einen Administrator um Hilfe, um weitere Informationen zu erhalten' + Sound-Error: 'Der Sound gehört nicht zur aktuellen Version oder der Name ist falsch' DisplayManager.Error: '&c|!| &cPlease set de option for execute featured' DisplayManager.Sound.Usage: '&7Please select one of these two options to execute the function &e' Groups.NotFoundGroup: '&cThe group could not be found' diff --git a/CustomJoinAndQuitMessagesOld/src/main/resources/lang/ru_RU.yml b/CustomJoinAndQuitMessagesOld/src/main/resources/lang/ru_RU.yml index a87cfb6..a34e9bc 100644 --- a/CustomJoinAndQuitMessagesOld/src/main/resources/lang/ru_RU.yml +++ b/CustomJoinAndQuitMessagesOld/src/main/resources/lang/ru_RU.yml @@ -1,16 +1,16 @@ CustomJoinAndQuitMessage: Prefix: '&e[&dCustomJoinAndQuitMessages&e]' Help-Msg: - - '&b/CustomJoinAndQuitMessage &8| &9/Cjm &7these are the variants of the main plugin command' - - '&b/Cjm &ehelp &7show this same message' - - '&b/Cjm &ereload &7reload the plugin files' - - '&b/Cjm &einfo &7shows information about the plugin' - Help-Cmd: '&7Use &b/Cjm &6help&7 for more information' - Reload: '&aReload Completed' - Error-Cmd: '&cUnknown Argument' - No-Permission: '&cYou dont have permission to do that!' - No-Permission-Label: 'Ask the server owner or an administrator for help for more information.' - Sound-Error: 'the sound does not belong to the current version or the name is wrong' - DisplayManager.Error: '&c|!| &cPlease set de option for execute featured' - DisplayManager.Sound.Usage: '&7Please select one of these two options to execute the function &e' + - '&b/CustomJoinAndQuitMessage &8| &9/Cjm &7это варианты основной команды плагина' + - '&b/Cjm &ehelp &7показать это же сообщение' + - '&b/Cjm &ereload &7перезагрузить файлы плагина' + - '&b/Cjm &einfo &7показывает информацию о плагине' + Help-Cmd: '&7Используйте &b/Cjm &6help&7 для более подробной информации' + Reload: '&aПерезагрузка прошла успешно' + Error-Cmd: '&cНеизвестный аргумент' + No-Permission: '&cУ вас недостаточно прав для соверщения этого действия!' + No-Permission-Label: 'Обратитесь к владельцу сервера или администратору за помощью для получения дополнительной информации.' + Sound-Error: 'звук отсутствует в текущей версии или введено неверное название' + DisplayManager.Error: '&c|!| &cПожалуйста, установите опции для исполнения выбранного' + DisplayManager.Sound.Usage: '&7Пожалуйста, выберите одну из двух опций для выполнения функции &e' Groups.NotFoundGroup: '&cThe group could not be found' diff --git a/CustomJoinAndQuitMessagesOld/src/main/resources/lang/zh_CN.yml b/CustomJoinAndQuitMessagesOld/src/main/resources/lang/zh_CN.yml index a87cfb6..8922d81 100644 --- a/CustomJoinAndQuitMessagesOld/src/main/resources/lang/zh_CN.yml +++ b/CustomJoinAndQuitMessagesOld/src/main/resources/lang/zh_CN.yml @@ -1,16 +1,16 @@ CustomJoinAndQuitMessage: Prefix: '&e[&dCustomJoinAndQuitMessages&e]' Help-Msg: - - '&b/CustomJoinAndQuitMessage &8| &9/Cjm &7these are the variants of the main plugin command' - - '&b/Cjm &ehelp &7show this same message' - - '&b/Cjm &ereload &7reload the plugin files' - - '&b/Cjm &einfo &7shows information about the plugin' - Help-Cmd: '&7Use &b/Cjm &6help&7 for more information' - Reload: '&aReload Completed' - Error-Cmd: '&cUnknown Argument' - No-Permission: '&cYou dont have permission to do that!' - No-Permission-Label: 'Ask the server owner or an administrator for help for more information.' - Sound-Error: 'the sound does not belong to the current version or the name is wrong' + - '&b/CustomJoinAndQuitMessage &8| &9/Cjm &7这些是主要插件命令的变体' + - '&b/Cjm &ehelp &7显示相同的消息' + - '&b/Cjm &ereload &7重新加载插件文件' + - '&b/Cjm &einfo &7显示有关插件的信息' + Help-Cmd: '&7用 &b/Cjm &6help&7 想要查询更多的信息' + Reload: '&a重新加载完成' + Error-Cmd: '&c未知参数' + No-Permission: '&c您无权执行此操作!' + No-Permission-Label: '向服务器所有者或管理员寻求帮助以获取更多信息' + Sound-Error: '声音不属于当前版本或名称错误' DisplayManager.Error: '&c|!| &cPlease set de option for execute featured' DisplayManager.Sound.Usage: '&7Please select one of these two options to execute the function &e' Groups.NotFoundGroup: '&cThe group could not be found' diff --git a/CustomJoinAndQuitMessagesOld/src/main/resources/lang/zh_TW.yml b/CustomJoinAndQuitMessagesOld/src/main/resources/lang/zh_TW.yml index a87cfb6..711549b 100644 --- a/CustomJoinAndQuitMessagesOld/src/main/resources/lang/zh_TW.yml +++ b/CustomJoinAndQuitMessagesOld/src/main/resources/lang/zh_TW.yml @@ -1,16 +1,16 @@ CustomJoinAndQuitMessage: Prefix: '&e[&dCustomJoinAndQuitMessages&e]' Help-Msg: - - '&b/CustomJoinAndQuitMessage &8| &9/Cjm &7these are the variants of the main plugin command' - - '&b/Cjm &ehelp &7show this same message' - - '&b/Cjm &ereload &7reload the plugin files' - - '&b/Cjm &einfo &7shows information about the plugin' - Help-Cmd: '&7Use &b/Cjm &6help&7 for more information' - Reload: '&aReload Completed' - Error-Cmd: '&cUnknown Argument' - No-Permission: '&cYou dont have permission to do that!' - No-Permission-Label: 'Ask the server owner or an administrator for help for more information.' - Sound-Error: 'the sound does not belong to the current version or the name is wrong' + - '&b/CustomJoinAndQuitMessage &8| &9/Cjm &7這些是主插件命令的變體' + - '&b/Cjm &ehelp &7顯示相同的消息' + - '&b/Cjm &ereload &7重新加載插件文件' + - '&b/Cjm &einfo &7顯示有關插件的信息' + Help-Cmd: '&7Use &b/Cjm &6help&7想要查詢更多的信息' + Reload: '&a重新加載完成' + Error-Cmd: '&c未知參數' + No-Permission: '&c您無權執行此操作' + No-Permission-Label: '向服務器所有者或管理員尋求幫助以獲取更多信息' + Sound-Error: '聲音不屬於當前版本名稱錯誤' DisplayManager.Error: '&c|!| &cPlease set de option for execute featured' DisplayManager.Sound.Usage: '&7Please select one of these two options to execute the function &e' Groups.NotFoundGroup: '&cThe group could not be found' diff --git a/patches/Update_Logger_and_more_changes___.patch b/patches/Update_Logger_and_more_changes___.patch new file mode 100644 index 0000000..126f461 --- /dev/null +++ b/patches/Update_Logger_and_more_changes___.patch @@ -0,0 +1,3706 @@ +Index: CustomJoinAndQuitMessagesOld/pom.xml +IDEA additional info: +Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +<+>UTF-8 +=================================================================== +diff --git a/CustomJoinAndQuitMessagesOld/pom.xml b/CustomJoinAndQuitMessagesOld/pom.xml +--- a/CustomJoinAndQuitMessagesOld/pom.xml (revision 3ebdfb92a2bbde47af6d6a9c7eaa2d8195f92df5) ++++ b/CustomJoinAndQuitMessagesOld/pom.xml (revision d95eeb4f788d3a38a9488e0142510ed0a4a880ef) +@@ -9,7 +9,7 @@ + + + CustomJoinAndQuitMessagesOld +- 1.7.9-release ++ 1.7.10-beta + + + 8 +Index: CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/CustomJoinAndQuitMessages.java +IDEA additional info: +Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +<+>UTF-8 +=================================================================== +diff --git a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/CustomJoinAndQuitMessages.java b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/CustomJoinAndQuitMessages.java +--- a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/CustomJoinAndQuitMessages.java (revision 3ebdfb92a2bbde47af6d6a9c7eaa2d8195f92df5) ++++ b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/CustomJoinAndQuitMessages.java (revision d95eeb4f788d3a38a9488e0142510ed0a4a880ef) +@@ -6,12 +6,13 @@ + import jss.customjoinandquitmessages.config.Lang; + import jss.customjoinandquitmessages.config.PlayerFile; + import jss.customjoinandquitmessages.config.utils.PreConfigLoader; +-import jss.customjoinandquitmessages.listener.JoinListener; ++import jss.customjoinandquitmessages.listener.chat.JoinListener; + import jss.customjoinandquitmessages.listener.TaskLoader; ++import jss.customjoinandquitmessages.listener.chat.QuitListener; + import jss.customjoinandquitmessages.manager.HookManager; +-import jss.customjoinandquitmessages.manager.InventoryView; ++import jss.customjoinandquitmessages.utils.InventoryView; + import jss.customjoinandquitmessages.update.UpdateChecker; +-import jss.customjoinandquitmessages.utils.Logger; ++import jss.customjoinandquitmessages.utils.logger.Logger; + import jss.customjoinandquitmessages.utils.Settings; + import jss.customjoinandquitmessages.utils.Util; + import org.bstats.bukkit.Metrics; +@@ -20,6 +21,7 @@ + import org.bukkit.plugin.PluginDescriptionFile; + import org.bukkit.plugin.java.JavaPlugin; + ++import java.io.File; + import java.util.ArrayList; + import java.util.HashMap; + import java.util.Map; +@@ -35,6 +37,7 @@ + private final ConfigFile configFile = new ConfigFile(this, "config.yml"); + private final HookManager hooksManager = new HookManager(); + private final PreConfigLoader preConfigLoader = new PreConfigLoader(this); ++ @SuppressWarnings("unused") + private String updateVersion; + private boolean useLegacyConfig = false; + private ArrayList inventoryViews; +@@ -45,7 +48,11 @@ + Util.sendLoadTitle(version); + inventoryViews = new ArrayList<>(); + +- //Util.createFolder(this,"Players"); ++ File logDirectory = new File(getDataFolder(), "logs"); ++ if (!logDirectory.exists()) { ++ //noinspection ResultOfMethodCallIgnored ++ logDirectory.mkdirs(); ++ } + } + + public void onEnable() { +@@ -67,7 +74,7 @@ + String cfg = getConfigFile().getConfig().getString("File-Version"); + boolean old_cfg = getConfigFile().getConfig().contains("Config.Config-Version"); + assert cfg != null; +- if (!cfg.equals("3") || old_cfg) { ++ if (!cfg.equals("4") || old_cfg) { + useLegacyConfig = true; + } + +@@ -85,7 +92,6 @@ + + UpdateChecker updateChecker = new UpdateChecker(this); + updateChecker.sendSpigotUpdate(); +- //updateChecker.sendGithubUpdate(); + } + + public void onDisable() { +@@ -101,6 +107,7 @@ + + public void setupEvents() { + new JoinListener(); ++ new QuitListener(); + TaskLoader taskLoader = new TaskLoader(this); + taskLoader.onUpdateGroup(); + } +@@ -114,7 +121,7 @@ + } + + public Lang Locale() { +- return availableLangs.get(Settings.defaultLanguage); ++ return availableLangs.get(Settings.settings_defaultLanguage); + } + + public void setAvailableLocales(HashMap availableLangs) { +@@ -144,14 +151,6 @@ + } + } + +- @SuppressWarnings({"SuspiciousListRemoveInLoop", "unused"}) +- public void unregisterInventory(Player player) { +- for (int i = 0; i < inventoryViews.size(); i++) { +- if (inventoryViews.get(i).getPlayer().getName().equals(player.getName())) { +- inventoryViews.remove(i); +- } +- } +- } + + public InventoryView getInventoryView(Player player) { + for (InventoryView inventoryView : inventoryViews) { +Index: CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/config/Lang.java +IDEA additional info: +Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +<+>UTF-8 +=================================================================== +diff --git a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/config/Lang.java b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/config/Lang.java +--- a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/config/Lang.java (revision 3ebdfb92a2bbde47af6d6a9c7eaa2d8195f92df5) ++++ b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/config/Lang.java (revision d95eeb4f788d3a38a9488e0142510ed0a4a880ef) +@@ -1,7 +1,7 @@ + package jss.customjoinandquitmessages.config; + + import jss.customjoinandquitmessages.CustomJoinAndQuitMessages; +-import jss.customjoinandquitmessages.utils.Logger; ++import jss.customjoinandquitmessages.utils.logger.Logger; + import jss.customjoinandquitmessages.utils.Settings; + import org.bukkit.configuration.file.FileConfiguration; + import org.bukkit.configuration.file.YamlConfiguration; +@@ -10,6 +10,7 @@ + import java.util.List; + import java.util.Locale; + ++@SuppressWarnings("all") + public class Lang { + + public String No_Permission; +@@ -22,7 +23,7 @@ + public String Error_Sound; + public String error_null_group; + private final CustomJoinAndQuitMessages plugin; +- private FileConfiguration locale = null; ++ private FileConfiguration locale; + private File localeFile = null; + private final Locale localeObject; + private final String localeName; +@@ -70,7 +71,7 @@ + + private void loadLocale() { + String main = "CustomJoinAndQuitMessage"; +- Settings.messages_prefix = locale.getString(main + ".Prefix"); ++ Settings.messages_prefix = locale.getString(main + ".Prefix"); + Error_Cmd = locale.getString(main + ".Error-Cmd"); + Error_Console = locale.getString(main + ".Error-Console"); + Error_Sound = locale.getString(main + ".Sound-Error"); +@@ -82,26 +83,4 @@ + error_null_group = locale.getString(main + ".Groups.NotFoundGroup"); + } + +- public String getLocaleName() { +- return this.localeName; +- } +- +- public String getLanguageName() { +- if (localeObject == null) { +- return "unknown"; +- } +- return localeObject.getDisplayLanguage(localeObject); +- } +- +- public String getCountryName() { +- if (localeObject == null) { +- return "unknown"; +- } +- return localeObject.getDisplayCountry(localeObject); +- } +- +- public int getIndex() { +- return index; +- } +- + } +Index: CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/config/PlayerFile.java +IDEA additional info: +Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +<+>UTF-8 +=================================================================== +diff --git a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/config/PlayerFile.java b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/config/PlayerFile.java +--- a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/config/PlayerFile.java (revision 3ebdfb92a2bbde47af6d6a9c7eaa2d8195f92df5) ++++ b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/config/PlayerFile.java (revision d95eeb4f788d3a38a9488e0142510ed0a4a880ef) +@@ -9,7 +9,6 @@ + import java.nio.charset.StandardCharsets; + + public class PlayerFile extends FileManager { +- + private File file; + private FileConfiguration config; + private final String path; +Index: CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/config/utils/FileLister.java +IDEA additional info: +Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +<+>UTF-8 +=================================================================== +diff --git a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/config/utils/FileLister.java b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/config/utils/FileLister.java +--- a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/config/utils/FileLister.java (revision 3ebdfb92a2bbde47af6d6a9c7eaa2d8195f92df5) ++++ b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/config/utils/FileLister.java (revision d95eeb4f788d3a38a9488e0142510ed0a4a880ef) +@@ -1,7 +1,7 @@ + package jss.customjoinandquitmessages.config.utils; + + import jss.customjoinandquitmessages.CustomJoinAndQuitMessages; +-import jss.customjoinandquitmessages.utils.Logger; ++import jss.customjoinandquitmessages.utils.logger.Logger; + import org.bukkit.plugin.java.JavaPlugin; + + import java.io.File; +Index: CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/config/utils/PreConfigLoader.java +IDEA additional info: +Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +<+>UTF-8 +=================================================================== +diff --git a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/config/utils/PreConfigLoader.java b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/config/utils/PreConfigLoader.java +--- a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/config/utils/PreConfigLoader.java (revision 3ebdfb92a2bbde47af6d6a9c7eaa2d8195f92df5) ++++ b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/config/utils/PreConfigLoader.java (revision d95eeb4f788d3a38a9488e0142510ed0a4a880ef) +@@ -2,7 +2,7 @@ + + import jss.customjoinandquitmessages.CustomJoinAndQuitMessages; + import jss.customjoinandquitmessages.config.Lang; +-import jss.customjoinandquitmessages.utils.Logger; ++import jss.customjoinandquitmessages.utils.logger.Logger; + import jss.customjoinandquitmessages.utils.Settings; + import jss.customjoinandquitmessages.utils.Util; + import org.bukkit.configuration.file.FileConfiguration; +@@ -25,8 +25,8 @@ + + //Other + Settings.settings_debug = config.getBoolean("Config.Debug"); +- Settings.update = Objects.equals(config.getString("Config.Update.Enabled"), "true"); +- Settings.c_type = config.getString("Config.Type"); ++ Settings.settings_update = Objects.equals(config.getString("Config.Update.Enabled"), "true"); ++ Settings.chatformat_type = config.getString("Config.Type"); + Settings.is_Group_Display = Objects.requireNonNull(config.getString("Config.Type")).equalsIgnoreCase("group"); + + //Join +@@ -81,7 +81,7 @@ + } + + public boolean loadLangs() { +- Settings.defaultLanguage = plugin.getConfig().getString("Config.Lang", "en_US"); ++ Settings.settings_defaultLanguage = plugin.getConfig().getString("Config.Lang", "en_US"); + HashMap availableLocales = new HashMap<>(); + FileLister fl = new FileLister(); + try { +@@ -92,10 +92,10 @@ + } catch (IOException e1) { + plugin.getLogger().severe("Could not add locales!"); + } +- if (!availableLocales.containsKey(Settings.defaultLanguage)) { +- Logger.warning(Util.getPrefix(true) + "&eLoad File: " + Settings.defaultLanguage + ".yml' not found in /lang/ folder. Using /lang/en_US.yml"); +- Settings.defaultLanguage = "en_US"; +- availableLocales.put(Settings.defaultLanguage, new Lang(plugin, Settings.defaultLanguage, 0)); ++ if (!availableLocales.containsKey(Settings.settings_defaultLanguage)) { ++ Logger.warning(Util.getPrefix(true) + "&eLoad File: " + Settings.settings_defaultLanguage + ".yml' not found in /lang/ folder. Using /lang/en_US.yml"); ++ Settings.settings_defaultLanguage = "en_US"; ++ availableLocales.put(Settings.settings_defaultLanguage, new Lang(plugin, Settings.settings_defaultLanguage, 0)); + } + plugin.setAvailableLocales(availableLocales); + return true; +Index: CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/hook/DiscordSRVHHook.java +IDEA additional info: +Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +<+>UTF-8 +=================================================================== +diff --git a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/hook/DiscordSRVHHook.java b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/hook/DiscordSRVHHook.java +--- a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/hook/DiscordSRVHHook.java (revision 3ebdfb92a2bbde47af6d6a9c7eaa2d8195f92df5) ++++ b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/hook/DiscordSRVHHook.java (revision d95eeb4f788d3a38a9488e0142510ed0a4a880ef) +@@ -1,7 +1,7 @@ + package jss.customjoinandquitmessages.hook; + + import jss.customjoinandquitmessages.utils.EventUtils; +-import jss.customjoinandquitmessages.utils.Logger; ++import jss.customjoinandquitmessages.utils.logger.Logger; + import jss.customjoinandquitmessages.utils.Settings; + import jss.customjoinandquitmessages.utils.Util; + import jss.customjoinandquitmessages.utils.interfaces.IHook; +Index: CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/hook/EssentialsXDiscordHook.java +IDEA additional info: +Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +<+>UTF-8 +=================================================================== +diff --git a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/hook/EssentialsXDiscordHook.java b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/hook/EssentialsXDiscordHook.java +--- a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/hook/EssentialsXDiscordHook.java (revision 3ebdfb92a2bbde47af6d6a9c7eaa2d8195f92df5) ++++ b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/hook/EssentialsXDiscordHook.java (revision d95eeb4f788d3a38a9488e0142510ed0a4a880ef) +@@ -1,7 +1,7 @@ + package jss.customjoinandquitmessages.hook; + + import jss.customjoinandquitmessages.utils.EventUtils; +-import jss.customjoinandquitmessages.utils.Logger; ++import jss.customjoinandquitmessages.utils.logger.Logger; + import jss.customjoinandquitmessages.utils.Settings; + import jss.customjoinandquitmessages.utils.Util; + import jss.customjoinandquitmessages.utils.interfaces.IHook; +Index: CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/hook/EssentialsXHook.java +IDEA additional info: +Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +<+>UTF-8 +=================================================================== +diff --git a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/hook/EssentialsXHook.java b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/hook/EssentialsXHook.java +--- a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/hook/EssentialsXHook.java (revision 3ebdfb92a2bbde47af6d6a9c7eaa2d8195f92df5) ++++ b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/hook/EssentialsXHook.java (revision d95eeb4f788d3a38a9488e0142510ed0a4a880ef) +@@ -3,7 +3,7 @@ + import com.earth2me.essentials.Essentials; + import jss.customjoinandquitmessages.manager.HookManager; + import jss.customjoinandquitmessages.utils.EventUtils; +-import jss.customjoinandquitmessages.utils.Logger; ++import jss.customjoinandquitmessages.utils.logger.Logger; + import jss.customjoinandquitmessages.utils.Settings; + import jss.customjoinandquitmessages.utils.Util; + import jss.customjoinandquitmessages.utils.interfaces.IHook; +@@ -12,7 +12,7 @@ + + public class EssentialsXHook implements IHook { + +- private HookManager hookManager; ++ private final HookManager hookManager; + private boolean isEnabled; + private Essentials essentials; + +@@ -47,7 +47,4 @@ + return isEnabled; + } + +- public HookManager getHookManager() { +- return hookManager; +- } + } +Index: CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/hook/LuckPermsHook.java +IDEA additional info: +Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +<+>UTF-8 +=================================================================== +diff --git a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/hook/LuckPermsHook.java b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/hook/LuckPermsHook.java +--- a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/hook/LuckPermsHook.java (revision 3ebdfb92a2bbde47af6d6a9c7eaa2d8195f92df5) ++++ b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/hook/LuckPermsHook.java (revision d95eeb4f788d3a38a9488e0142510ed0a4a880ef) +@@ -1,7 +1,7 @@ + package jss.customjoinandquitmessages.hook; + + import jss.customjoinandquitmessages.utils.EventUtils; +-import jss.customjoinandquitmessages.utils.Logger; ++import jss.customjoinandquitmessages.utils.logger.Logger; + import jss.customjoinandquitmessages.utils.Settings; + import jss.customjoinandquitmessages.utils.Util; + import jss.customjoinandquitmessages.utils.interfaces.IHook; +Index: CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/hook/PlaceholderApiHook.java +IDEA additional info: +Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +<+>UTF-8 +=================================================================== +diff --git a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/hook/PlaceholderApiHook.java b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/hook/PlaceholderApiHook.java +--- a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/hook/PlaceholderApiHook.java (revision 3ebdfb92a2bbde47af6d6a9c7eaa2d8195f92df5) ++++ b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/hook/PlaceholderApiHook.java (revision d95eeb4f788d3a38a9488e0142510ed0a4a880ef) +@@ -2,14 +2,15 @@ + + import jss.customjoinandquitmessages.manager.HookManager; + import jss.customjoinandquitmessages.utils.EventUtils; +-import jss.customjoinandquitmessages.utils.Logger; ++import jss.customjoinandquitmessages.utils.logger.Logger; + import jss.customjoinandquitmessages.utils.Util; + import jss.customjoinandquitmessages.utils.interfaces.IHook; + import org.bukkit.Bukkit; + + public class PlaceholderApiHook implements IHook { + +- private HookManager hooksManager; ++ @SuppressWarnings("unused") ++ private final HookManager hooksManager; + private boolean isEnabled; + + public PlaceholderApiHook(HookManager hooksManager) { +@@ -31,8 +32,4 @@ + return this.isEnabled; + } + +- public HookManager getHooksManager() { +- return hooksManager; +- } +- + } +Index: CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/hook/SuperVanishHook.java +IDEA additional info: +Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +<+>UTF-8 +=================================================================== +diff --git a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/hook/SuperVanishHook.java b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/hook/SuperVanishHook.java +--- a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/hook/SuperVanishHook.java (revision 3ebdfb92a2bbde47af6d6a9c7eaa2d8195f92df5) ++++ b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/hook/SuperVanishHook.java (revision d95eeb4f788d3a38a9488e0142510ed0a4a880ef) +@@ -2,7 +2,7 @@ + + import de.myzelyam.api.vanish.VanishAPI; + import jss.customjoinandquitmessages.utils.EventUtils; +-import jss.customjoinandquitmessages.utils.Logger; ++import jss.customjoinandquitmessages.utils.logger.Logger; + import jss.customjoinandquitmessages.utils.Util; + import jss.customjoinandquitmessages.utils.interfaces.IHook; + import org.bukkit.Bukkit; +Index: CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/listener/InventoryListener.java +IDEA additional info: +Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +<+>UTF-8 +=================================================================== +diff --git a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/listener/InventoryListener.java b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/listener/InventoryListener.java +--- a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/listener/InventoryListener.java (revision 3ebdfb92a2bbde47af6d6a9c7eaa2d8195f92df5) ++++ b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/listener/InventoryListener.java (revision d95eeb4f788d3a38a9488e0142510ed0a4a880ef) +@@ -2,7 +2,7 @@ + + import jss.customjoinandquitmessages.CustomJoinAndQuitMessages; + import jss.customjoinandquitmessages.manager.DisplayManager; +-import jss.customjoinandquitmessages.manager.InventoryView; ++import jss.customjoinandquitmessages.utils.InventoryView; + import org.bukkit.Bukkit; + import org.bukkit.entity.Player; + import org.bukkit.event.Listener; +Index: CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/listener/TaskLoader.java +IDEA additional info: +Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +<+>UTF-8 +=================================================================== +diff --git a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/listener/TaskLoader.java b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/listener/TaskLoader.java +--- a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/listener/TaskLoader.java (revision 3ebdfb92a2bbde47af6d6a9c7eaa2d8195f92df5) ++++ b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/listener/TaskLoader.java (revision d95eeb4f788d3a38a9488e0142510ed0a4a880ef) +@@ -4,7 +4,7 @@ + import jss.customjoinandquitmessages.hook.LuckPermsHook; + import jss.customjoinandquitmessages.manager.HookManager; + import jss.customjoinandquitmessages.manager.PlayerManager; +-import jss.customjoinandquitmessages.utils.Logger; ++import jss.customjoinandquitmessages.utils.logger.Logger; + import jss.customjoinandquitmessages.utils.Settings; + import org.bukkit.Bukkit; + import org.bukkit.entity.Player; +@@ -26,7 +26,7 @@ + taskGroupId = scheduler.scheduleSyncRepeatingTask(plugin, () -> { + LuckPermsHook luckPermsHook = HookManager.get().getLuckPermsHook(); + +- if(Settings.c_type.equalsIgnoreCase("group")){ ++ if(Settings.chatformat_type.equalsIgnoreCase("group")){ + if (luckPermsHook.isEnabled() && Settings.hook_luckperms_autoUpdate_group) { + + for (Player p : Bukkit.getOnlinePlayers()) { +Index: CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/listener/JoinListener.java +IDEA additional info: +Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +<+>UTF-8 +=================================================================== +diff --git a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/listener/JoinListener.java b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/listener/chat/JoinListener.java +rename from CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/listener/JoinListener.java +rename to CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/listener/chat/JoinListener.java +--- a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/listener/JoinListener.java (revision 3ebdfb92a2bbde47af6d6a9c7eaa2d8195f92df5) ++++ b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/listener/chat/JoinListener.java (revision d95eeb4f788d3a38a9488e0142510ed0a4a880ef) +@@ -1,4 +1,4 @@ +-package jss.customjoinandquitmessages.listener; ++package jss.customjoinandquitmessages.listener.chat; + + import com.cryptomorin.xseries.messages.ActionBar; + import com.cryptomorin.xseries.messages.Titles; +@@ -10,7 +10,7 @@ + import jss.customjoinandquitmessages.manager.PlayerManager; + import jss.customjoinandquitmessages.update.UpdateChecker; + import jss.customjoinandquitmessages.utils.GroupHelper; +-import jss.customjoinandquitmessages.utils.Logger; ++import jss.customjoinandquitmessages.utils.logger.Logger; + import jss.customjoinandquitmessages.utils.Settings; + import jss.customjoinandquitmessages.utils.Util; + import org.bukkit.Bukkit; +@@ -22,7 +22,6 @@ + import org.bukkit.event.EventPriority; + import org.bukkit.event.Listener; + import org.bukkit.event.player.PlayerJoinEvent; +-import org.bukkit.event.player.PlayerQuitEvent; + import org.jetbrains.annotations.NotNull; + + import java.util.List; +@@ -60,7 +59,7 @@ + Logger.debug(" &eLuckPermHook is: " + luckPermsHook.isEnabled()); + } + +- if (Settings.c_type.equalsIgnoreCase("group")){ ++ if (Settings.chatformat_type.equalsIgnoreCase("group")){ + if (luckPermsHook.isEnabled()) { + if (!playerManager.getGroup(p).equalsIgnoreCase(Objects.requireNonNull(LuckPermsHook.getApi(). + getUserManager().getUser(p.getName())).getPrimaryGroup())) { +@@ -72,9 +71,9 @@ + } + } + +- boolean isNormal = Settings.c_type.equalsIgnoreCase("normal"); +- boolean isGroup = Settings.c_type.equalsIgnoreCase("group"); +- boolean isNone = Settings.c_type.equalsIgnoreCase("none"); ++ boolean isNormal = Settings.chatformat_type.equalsIgnoreCase("normal"); ++ boolean isGroup = Settings.chatformat_type.equalsIgnoreCase("group"); ++ boolean isNone = Settings.chatformat_type.equalsIgnoreCase("none"); + + if (Settings.welcome) { + for (String text : Settings.list_welcome) +@@ -229,151 +228,11 @@ + @EventHandler(priority = EventPriority.HIGH) + public void onUpdate(@NotNull PlayerJoinEvent e) { + Player p = e.getPlayer(); +- if (Settings.update) { ++ if (Settings.settings_update) { + if ((p.isOp()) || (p.hasPermission("cjm.update"))) { + new UpdateChecker(CustomJoinAndQuitMessages.get()).sendSpigotUpdate(); + } + } + } + +- @EventHandler(priority = EventPriority.HIGH) +- public void onQuit(@NotNull PlayerQuitEvent e) { +- FileConfiguration config = plugin.getConfigFile().getConfig(); +- Player p = e.getPlayer(); +- +- DiscordSRVHHook discordSRVHHook = HookManager.getInstance().getDiscordSRVHHook(); +- EssentialsXDiscordHook essentialsXDiscordHook = HookManager.getInstance().getEssentialsXDiscordHook(); +- EssentialsXHook essentialsXHook = HookManager.get().getEssentialsXHook(); +- SuperVanishHook superVanishHook = HookManager.get().getSuperVanishHook(); +- PlayerManager playerManager = new PlayerManager(); +- +- boolean isNormal = Settings.c_type.equalsIgnoreCase("normal"); +- boolean isGroup = Settings.c_type.equalsIgnoreCase("group"); +- boolean isNone = Settings.c_type.equalsIgnoreCase("none"); +- +- if(Util.isVanished(p)){ +- e.setQuitMessage(null); +- return; +- } +- +- if (superVanishHook.isEnabled()){ +- if (superVanishHook.isVanishPlayer(p)){ +- e.setQuitMessage(null); +- return; +- } +- } +- +- if (essentialsXHook.isEnabled()) { +- if (Settings.hook_essentials_hidePlayerVanish) { +- if (essentialsXHook.isVanish(p)) { +- e.setQuitMessage(null); +- return; +- } +- } +- } +- +- if (Settings.quit) { +- if (isNormal) { +- e.setQuitMessage(null); +- +- String text = config.getString("Quit.Text"); +- +- text = Util.color(text); +- text = Util.getVar(p, text); +- +- MessageBuilder messageBuilder = new MessageBuilder(p, text); +- +- if (config.getBoolean("Config.Show-Chat-In-Console")) { +- Logger.info(messageBuilder.getText()); +- } +- +- boolean isHover = config.getBoolean("Quit.HoverEvent.Enabled"); +- boolean isClick = config.getBoolean("Quit.ClickEvent.Enabled"); +- boolean isSound = config.getBoolean("Quit.Sound.Enabled"); +- boolean isSoundAll = config.getBoolean("Quit.Sound.Send-To-All"); +- +- List Hover_Text = config.getStringList("Quit.HoverEvent.Hover"); +- +- String isClick_Mode = config.getString("Quit.ClickEvent.Mode"); +- String Action_Command = config.getString("Quit.ClickEvent.Actions.Command"); +- String Action_Url = config.getString("Quit.ClickEvent.Actions.Url"); +- String Action_Suggest = config.getString("Quit.ClickEvent.Actions.Suggest-Command"); +- String Sound_Name = config.getString("Quit.Sound.Name"); +- +- int Sound_Volume = config.getInt("Quit.Sound.Volume"); +- float Sound_Pitch = Float.parseFloat(Objects.requireNonNull(config.getString("Quit.Sound.Pitch"))); +- +- if (isHover) { +- if (isClick) { +- assert isClick_Mode != null; +- if (isClick_Mode.equalsIgnoreCase("command")) { +- messageBuilder.setHover(Hover_Text).setExecuteCommand(Action_Command).sendToAll(); +- } else if (isClick_Mode.equalsIgnoreCase("url")) { +- messageBuilder.setHover(Hover_Text).setOpenURL(Action_Url).sendToAll(); +- } else if (isClick_Mode.equalsIgnoreCase("suggest")) { +- messageBuilder.setHover(Hover_Text).setSuggestCommand(Action_Suggest).sendToAll(); +- } +- } else { +- messageBuilder.setHover(Hover_Text).sendToAll(); +- } +- } else { +- if (isClick) { +- assert isClick_Mode != null; +- if (isClick_Mode.equalsIgnoreCase("command")) { +- messageBuilder.setExecuteCommand(Action_Command).sendToAll(); +- } else if (isClick_Mode.equalsIgnoreCase("url")) { +- messageBuilder.setOpenURL(Action_Url).sendToAll(); +- } else if (isClick_Mode.equalsIgnoreCase("suggest")) { +- messageBuilder.setSuggestCommand(Action_Suggest).sendToAll(); +- } +- } else { +- messageBuilder.sendToAll(); +- } +- } +- +- if (discordSRVHHook.isEnabled()) { +- if (Settings.hook_discordSrv_channelId.equalsIgnoreCase("none")) +- return; +- +- DiscordUtil.sendMessageBlocking( +- DiscordUtil.getTextChannelById(Settings.hook_discordSrv_channelId), +- Util.colorless(messageBuilder.getText())); +- } +- +- if (essentialsXDiscordHook.isEnabled()) { +- if (Settings.hook_essentialsDiscord_channelId.equalsIgnoreCase("none")) +- return; +- +- essentialsXDiscordHook.sendQuitMessage(Settings.hook_essentialsDiscord_channelId, +- Util.colorless(messageBuilder.getText())); +- } +- +- try { +- if (isSound) { +- if (isSoundAll) { +- Location location = p.getLocation(); +- p.playSound(location, Sound.valueOf(Sound_Name), Sound_Volume, Sound_Pitch); +- } else { +- for (Player pp : Bukkit.getOnlinePlayers()) { +- Location location = p.getLocation(); +- pp.playSound(location, Sound.valueOf(Sound_Name), Sound_Volume, Sound_Pitch); +- } +- } +- } +- } catch (Exception ex) { +- Logger.warning("&eVerify that the sound name is correct or belongs to the version"); +- } +- } else if (isGroup) { +- e.setQuitMessage(null); +- GroupHelper groupHelper = GroupHelper.get(); +- groupHelper.setGroup(playerManager.getGroup(p)); +- groupHelper.setDiscord(discordSRVHHook); +- groupHelper.setEssentials(essentialsXDiscordHook); +- groupHelper.onQuit(p, config); +- } else if (isNone) { +- e.setQuitMessage(null); +- } +- } +- } +- + } +Index: CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/listener/chat/QuitListener.java +IDEA additional info: +Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +<+>UTF-8 +=================================================================== +diff --git a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/listener/chat/QuitListener.java b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/listener/chat/QuitListener.java +new file mode 100644 +--- /dev/null (revision d95eeb4f788d3a38a9488e0142510ed0a4a880ef) ++++ b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/listener/chat/QuitListener.java (revision d95eeb4f788d3a38a9488e0142510ed0a4a880ef) +@@ -0,0 +1,178 @@ ++package jss.customjoinandquitmessages.listener.chat; ++ ++import github.scarsz.discordsrv.util.DiscordUtil; ++import jss.customjoinandquitmessages.CustomJoinAndQuitMessages; ++import jss.customjoinandquitmessages.hook.DiscordSRVHHook; ++import jss.customjoinandquitmessages.hook.EssentialsXDiscordHook; ++import jss.customjoinandquitmessages.hook.EssentialsXHook; ++import jss.customjoinandquitmessages.hook.SuperVanishHook; ++import jss.customjoinandquitmessages.json.MessageBuilder; ++import jss.customjoinandquitmessages.manager.HookManager; ++import jss.customjoinandquitmessages.manager.PlayerManager; ++import jss.customjoinandquitmessages.utils.GroupHelper; ++import jss.customjoinandquitmessages.utils.logger.Logger; ++import jss.customjoinandquitmessages.utils.Settings; ++import jss.customjoinandquitmessages.utils.Util; ++import org.bukkit.Bukkit; ++import org.bukkit.Location; ++import org.bukkit.Sound; ++import org.bukkit.configuration.file.FileConfiguration; ++import org.bukkit.entity.Player; ++import org.bukkit.event.EventHandler; ++import org.bukkit.event.EventPriority; ++import org.bukkit.event.Listener; ++import org.bukkit.event.player.PlayerQuitEvent; ++import org.jetbrains.annotations.NotNull; ++ ++import java.util.List; ++import java.util.Objects; ++ ++public class QuitListener implements Listener { ++ ++ private final CustomJoinAndQuitMessages plugin = CustomJoinAndQuitMessages.get(); ++ ++ public QuitListener() { ++ Bukkit.getPluginManager().registerEvents(this, plugin); ++ } ++ ++ @EventHandler(priority = EventPriority.HIGH) ++ public void onQuit(@NotNull PlayerQuitEvent e) { ++ FileConfiguration config = plugin.getConfigFile().getConfig(); ++ Player p = e.getPlayer(); ++ ++ DiscordSRVHHook discordSRVHHook = HookManager.getInstance().getDiscordSRVHHook(); ++ EssentialsXDiscordHook essentialsXDiscordHook = HookManager.getInstance().getEssentialsXDiscordHook(); ++ EssentialsXHook essentialsXHook = HookManager.get().getEssentialsXHook(); ++ SuperVanishHook superVanishHook = HookManager.get().getSuperVanishHook(); ++ PlayerManager playerManager = new PlayerManager(); ++ ++ boolean isNormal = Settings.chatformat_type.equalsIgnoreCase("normal"); ++ boolean isGroup = Settings.chatformat_type.equalsIgnoreCase("group"); ++ boolean isNone = Settings.chatformat_type.equalsIgnoreCase("none"); ++ ++ if(Util.isVanished(p)){ ++ e.setQuitMessage(null); ++ return; ++ } ++ ++ if (superVanishHook.isEnabled()){ ++ if (superVanishHook.isVanishPlayer(p)){ ++ e.setQuitMessage(null); ++ return; ++ } ++ } ++ ++ if (essentialsXHook.isEnabled()) { ++ if (Settings.hook_essentials_hidePlayerVanish) { ++ if (essentialsXHook.isVanish(p)) { ++ e.setQuitMessage(null); ++ return; ++ } ++ } ++ } ++ ++ if (Settings.quit) { ++ if (isNormal) { ++ e.setQuitMessage(null); ++ ++ String text = config.getString("Quit.Text"); ++ ++ text = Util.color(text); ++ text = Util.getVar(p, text); ++ ++ MessageBuilder messageBuilder = new MessageBuilder(p, text); ++ ++ if (config.getBoolean("Config.Show-Chat-In-Console")) { ++ Logger.info(messageBuilder.getText()); ++ } ++ ++ boolean isHover = config.getBoolean("Quit.HoverEvent.Enabled"); ++ boolean isClick = config.getBoolean("Quit.ClickEvent.Enabled"); ++ boolean isSound = config.getBoolean("Quit.Sound.Enabled"); ++ boolean isSoundAll = config.getBoolean("Quit.Sound.Send-To-All"); ++ ++ List Hover_Text = config.getStringList("Quit.HoverEvent.Hover"); ++ ++ String isClick_Mode = config.getString("Quit.ClickEvent.Mode"); ++ String Action_Command = config.getString("Quit.ClickEvent.Actions.Command"); ++ String Action_Url = config.getString("Quit.ClickEvent.Actions.Url"); ++ String Action_Suggest = config.getString("Quit.ClickEvent.Actions.Suggest-Command"); ++ String Sound_Name = config.getString("Quit.Sound.Name"); ++ ++ int Sound_Volume = config.getInt("Quit.Sound.Volume"); ++ float Sound_Pitch = Float.parseFloat(Objects.requireNonNull(config.getString("Quit.Sound.Pitch"))); ++ ++ if (isHover) { ++ if (isClick) { ++ assert isClick_Mode != null; ++ if (isClick_Mode.equalsIgnoreCase("command")) { ++ messageBuilder.setHover(Hover_Text).setExecuteCommand(Action_Command).sendToAll(); ++ } else if (isClick_Mode.equalsIgnoreCase("url")) { ++ messageBuilder.setHover(Hover_Text).setOpenURL(Action_Url).sendToAll(); ++ } else if (isClick_Mode.equalsIgnoreCase("suggest")) { ++ messageBuilder.setHover(Hover_Text).setSuggestCommand(Action_Suggest).sendToAll(); ++ } ++ } else { ++ messageBuilder.setHover(Hover_Text).sendToAll(); ++ } ++ } else { ++ if (isClick) { ++ assert isClick_Mode != null; ++ if (isClick_Mode.equalsIgnoreCase("command")) { ++ messageBuilder.setExecuteCommand(Action_Command).sendToAll(); ++ } else if (isClick_Mode.equalsIgnoreCase("url")) { ++ messageBuilder.setOpenURL(Action_Url).sendToAll(); ++ } else if (isClick_Mode.equalsIgnoreCase("suggest")) { ++ messageBuilder.setSuggestCommand(Action_Suggest).sendToAll(); ++ } ++ } else { ++ messageBuilder.sendToAll(); ++ } ++ } ++ ++ if (discordSRVHHook.isEnabled()) { ++ if (Settings.hook_discordSrv_channelId.equalsIgnoreCase("none")) ++ return; ++ ++ DiscordUtil.sendMessageBlocking( ++ DiscordUtil.getTextChannelById(Settings.hook_discordSrv_channelId), ++ Util.colorless(messageBuilder.getText())); ++ } ++ ++ if (essentialsXDiscordHook.isEnabled()) { ++ if (Settings.hook_essentialsDiscord_channelId.equalsIgnoreCase("none")) ++ return; ++ ++ essentialsXDiscordHook.sendQuitMessage(Settings.hook_essentialsDiscord_channelId, ++ Util.colorless(messageBuilder.getText())); ++ } ++ ++ try { ++ if (isSound) { ++ if (isSoundAll) { ++ Location location = p.getLocation(); ++ p.playSound(location, Sound.valueOf(Sound_Name), Sound_Volume, Sound_Pitch); ++ } else { ++ for (Player pp : Bukkit.getOnlinePlayers()) { ++ Location location = p.getLocation(); ++ pp.playSound(location, Sound.valueOf(Sound_Name), Sound_Volume, Sound_Pitch); ++ } ++ } ++ } ++ } catch (Exception ex) { ++ Logger.warning("&eVerify that the sound name is correct or belongs to the version"); ++ } ++ } else if (isGroup) { ++ e.setQuitMessage(null); ++ GroupHelper groupHelper = GroupHelper.get(); ++ groupHelper.setGroup(playerManager.getGroup(p)); ++ groupHelper.setDiscord(discordSRVHHook); ++ groupHelper.setEssentials(essentialsXDiscordHook); ++ groupHelper.onQuit(p, config); ++ } else if (isNone) { ++ e.setQuitMessage(null); ++ } ++ } ++ } ++ ++} +Index: CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/manager/DisplayManager.java +IDEA additional info: +Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +<+>UTF-8 +=================================================================== +diff --git a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/manager/DisplayManager.java b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/manager/DisplayManager.java +--- a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/manager/DisplayManager.java (revision 3ebdfb92a2bbde47af6d6a9c7eaa2d8195f92df5) ++++ b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/manager/DisplayManager.java (revision d95eeb4f788d3a38a9488e0142510ed0a4a880ef) +@@ -4,7 +4,7 @@ + import com.cryptomorin.xseries.messages.Titles; + import jss.customjoinandquitmessages.CustomJoinAndQuitMessages; + import jss.customjoinandquitmessages.json.MessageBuilder; +-import jss.customjoinandquitmessages.utils.Logger; ++import jss.customjoinandquitmessages.utils.logger.Logger; + import jss.customjoinandquitmessages.utils.Settings; + import jss.customjoinandquitmessages.utils.Util; + import org.bukkit.configuration.file.FileConfiguration; +Index: CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/manager/GroupManager.java +IDEA additional info: +Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +<+>UTF-8 +=================================================================== +diff --git a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/manager/GroupManager.java b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/manager/GroupManager.java +--- a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/manager/GroupManager.java (revision 3ebdfb92a2bbde47af6d6a9c7eaa2d8195f92df5) ++++ b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/manager/GroupManager.java (revision d95eeb4f788d3a38a9488e0142510ed0a4a880ef) +@@ -1,7 +1,6 @@ + package jss.customjoinandquitmessages.manager; + + import jss.customjoinandquitmessages.CustomJoinAndQuitMessages; +-import jss.customjoinandquitmessages.utils.Logger; + import org.bukkit.configuration.file.FileConfiguration; + import org.jetbrains.annotations.Contract; + import org.jetbrains.annotations.NotNull; +@@ -25,10 +24,6 @@ + } + + public boolean existsGroup(String group) { +- if(group != null){ +- Logger.error("&cGroup could not be found: &e" + group); +- return false; +- } + return getGroupList().contains(group); + } + +@@ -112,13 +107,12 @@ + return null; + } + +- + public boolean isTitle(String group){ +- boolean istitle = false; ++ boolean isTitle = false; + if (existsGroup(group)) { +- istitle = config.getBoolean(group + ".Title.Enabled"); ++ isTitle = config.getBoolean(group + ".Title.Enabled"); + } +- return istitle; ++ return isTitle; + } + + public String getTitle(String group){ +@@ -157,11 +151,11 @@ + } + + public boolean isActionbar(String group){ +- boolean isactionbar = false; ++ boolean isActionBar = false; + if(existsGroup(group)) { +- isactionbar = config.getBoolean(group + ".Actionbar.Enabled"); ++ isActionBar = config.getBoolean(group + ".Actionbar.Enabled"); + } +- return isactionbar; ++ return isActionBar; + } + + public String getActionbar(String group){ +@@ -172,19 +166,19 @@ + } + + public boolean isSound(String group) { +- boolean issound = false; ++ boolean isSound = false; + if(existsGroup(group)) { +- issound = config.getBoolean(group + "Sound.Enabled"); ++ isSound = config.getBoolean(group + "Sound.Enabled"); + } +- return issound; ++ return isSound; + } + + public boolean isSoundAll(String group){ +- boolean issoundall = false; ++ boolean isSoundAll = false; + if(existsGroup(group)){ +- issoundall = config.getBoolean(group + "Sound.Send-To-All"); ++ isSoundAll = config.getBoolean(group + "Sound.Send-To-All"); + } +- return issoundall; ++ return isSoundAll; + } + + public String getSound(String group){ +Index: CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/storage/PlayerJsonStorage.java +IDEA additional info: +Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +<+>UTF-8 +=================================================================== +diff --git a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/storage/PlayerJsonStorage.java b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/storage/PlayerJsonStorage.java +--- a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/storage/PlayerJsonStorage.java (revision 3ebdfb92a2bbde47af6d6a9c7eaa2d8195f92df5) ++++ b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/storage/PlayerJsonStorage.java (revision d95eeb4f788d3a38a9488e0142510ed0a4a880ef) +@@ -31,7 +31,7 @@ + e.printStackTrace(); + } + }else { +- System.out.println("archivo no existe, se procede a crearlo"); ++ + try{ + file.createNewFile(); + FileWriter writer = new FileWriter(file); +Index: CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/update/UpdateChecker.java +IDEA additional info: +Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +<+>UTF-8 +=================================================================== +diff --git a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/update/UpdateChecker.java b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/update/UpdateChecker.java +--- a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/update/UpdateChecker.java (revision 3ebdfb92a2bbde47af6d6a9c7eaa2d8195f92df5) ++++ b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/update/UpdateChecker.java (revision d95eeb4f788d3a38a9488e0142510ed0a4a880ef) +@@ -3,7 +3,7 @@ + import com.google.gson.Gson; + import com.google.gson.JsonObject; + import jss.customjoinandquitmessages.CustomJoinAndQuitMessages; +-import jss.customjoinandquitmessages.utils.Logger; ++import jss.customjoinandquitmessages.utils.logger.Logger; + import jss.customjoinandquitmessages.utils.Util; + import org.bukkit.Bukkit; + import org.jetbrains.annotations.NotNull; +@@ -28,12 +28,12 @@ + if (plugin.getDescription().getVersion().equalsIgnoreCase(version)) { + Logger.success("&a" + plugin.name + " is up to date!"); + } else { +- Logger.outLine("&5<||" + Util.setLine("&5")); ++ Logger.outLine("&5<||" + Util.setLine()); + Logger.warning("&5<||&b" + plugin.name + " is outdated!"); + Logger.warning("&5<||&bNewest version: &a" + version); + Logger.warning("&5<||&bYour version: &d" + UpdateSettings.VERSION); + Logger.warning("&5<||&bUpdate Here on Github: &e" + UpdateSettings.URL_PlUGIN[1]); +- Logger.outLine("&5<||" + Util.setLine("&5")); ++ Logger.outLine("&5<||" + Util.setLine()); + } + }); + } +@@ -43,12 +43,12 @@ + if (plugin.getDescription().getVersion().equalsIgnoreCase(version)) { + Logger.success("&a" + plugin.name + " is up to date!"); + } else { +- Logger.outLine("&5<||" + Util.setLine("&5")); ++ Logger.outLine("&5<||" + Util.setLine()); + Logger.warning("&5<||&b" + plugin.name + " is outdated!"); + Logger.warning("&5<||&bNewest version: &a" + version); + Logger.warning("&5<||&bYour version: &d" + UpdateSettings.VERSION); + Logger.warning("&5<||&bUpdate Here on Spigot: &e" + UpdateSettings.URL_PlUGIN[0]); +- Logger.outLine("&5<||" + Util.setLine("&5")); ++ Logger.outLine("&5<||" + Util.setLine()); + } + }); + } +Index: CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/utils/GroupHelper.java +IDEA additional info: +Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +<+>UTF-8 +=================================================================== +diff --git a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/utils/GroupHelper.java b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/utils/GroupHelper.java +--- a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/utils/GroupHelper.java (revision 3ebdfb92a2bbde47af6d6a9c7eaa2d8195f92df5) ++++ b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/utils/GroupHelper.java (revision d95eeb4f788d3a38a9488e0142510ed0a4a880ef) +@@ -7,6 +7,7 @@ + import jss.customjoinandquitmessages.hook.EssentialsXDiscordHook; + import jss.customjoinandquitmessages.json.MessageBuilder; + import jss.customjoinandquitmessages.manager.GroupManager; ++import jss.customjoinandquitmessages.utils.logger.Logger; + import org.bukkit.Bukkit; + import org.bukkit.Location; + import org.bukkit.Sound; +Index: CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/manager/InventoryView.java +IDEA additional info: +Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +<+>UTF-8 +=================================================================== +diff --git a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/manager/InventoryView.java b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/utils/InventoryView.java +rename from CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/manager/InventoryView.java +rename to CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/utils/InventoryView.java +--- a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/manager/InventoryView.java (revision 3ebdfb92a2bbde47af6d6a9c7eaa2d8195f92df5) ++++ b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/utils/InventoryView.java (revision d95eeb4f788d3a38a9488e0142510ed0a4a880ef) +@@ -1,4 +1,4 @@ +-package jss.customjoinandquitmessages.manager; ++package jss.customjoinandquitmessages.utils; + + import org.bukkit.entity.Player; + +Index: CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/utils/Logger.java +=================================================================== +diff --git a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/utils/Logger.java b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/utils/Logger.java +deleted file mode 100644 +--- a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/utils/Logger.java (revision 3ebdfb92a2bbde47af6d6a9c7eaa2d8195f92df5) ++++ /dev/null (revision 3ebdfb92a2bbde47af6d6a9c7eaa2d8195f92df5) +@@ -1,31 +0,0 @@ +-package jss.customjoinandquitmessages.utils; +- +-public class Logger { +- +- public static void error(String msg) { +- Util.sendColorConsoleMessage(EventUtils.getStaticConsoleSender(), Util.getPrefix(true) + "&8-> &e[&cERROR&e] &7" + msg); +- } +- +- public static void warning(String msg) { +- Util.sendColorConsoleMessage(EventUtils.getStaticConsoleSender(), Util.getPrefix(true) + "&8-> &e[&dWARNING&e] &7" + msg); +- } +- +- public static void info(String msg) { +- Util.sendColorConsoleMessage(EventUtils.getStaticConsoleSender(), Util.getPrefix(true) + "&8-> &e[&9INFO&e] &7" + msg); +- } +- +- public static void outLine(String msg) { +- Util.sendColorConsoleMessage(EventUtils.getStaticConsoleSender(), Util.getPrefix(true) + "&8-> &e[&bOUTLINE&e] &7" + msg); +- } +- +- public static void success(String msg) { +- Util.sendColorConsoleMessage(EventUtils.getStaticConsoleSender(), Util.getPrefix(true) + "&8-> &e[&aSUCCESS&e] &7" + msg); +- } +- +- public static void debug(String msg) { +- if(Settings.settings_debug) { +- Util.sendColorConsoleMessage(EventUtils.getStaticConsoleSender(), Util.getPrefix(true) + "&8-> &e[&dDEBUG&e] &7" + msg); +- } +- } +- +-} +Index: CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/utils/Settings.java +IDEA additional info: +Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +<+>UTF-8 +=================================================================== +diff --git a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/utils/Settings.java b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/utils/Settings.java +--- a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/utils/Settings.java (revision 3ebdfb92a2bbde47af6d6a9c7eaa2d8195f92df5) ++++ b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/utils/Settings.java (revision d95eeb4f788d3a38a9488e0142510ed0a4a880ef) +@@ -7,14 +7,13 @@ + public static String messages_prefix; + public static boolean hook_luckperms_autoUpdate_group; + //Others +- public static String defaultLanguage; ++ public static String settings_defaultLanguage; + public static boolean is_Group_Display; +- public static boolean update; +- public static String c_type; ++ public static boolean settings_update; ++ public static String chatformat_type; + public static boolean settings_debug; + + //Join section +- + public static boolean join; + public static String join_message; + +Index: CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/utils/Util.java +IDEA additional info: +Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +<+>UTF-8 +=================================================================== +diff --git a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/utils/Util.java b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/utils/Util.java +--- a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/utils/Util.java (revision 3ebdfb92a2bbde47af6d6a9c7eaa2d8195f92df5) ++++ b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/utils/Util.java (revision d95eeb4f788d3a38a9488e0142510ed0a4a880ef) +@@ -22,8 +22,8 @@ + private final static String prefix = getPrefix(true); + private static final String PERMISSION_PREFIX = "cjm."; + +- public static @NotNull String setLine(String color) { +- return color(color + "-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-"); ++ public static @NotNull String setLine() { ++ return color("-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-"); + } + + public static @NotNull String color(String text) { +Index: CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/utils/logger/FileLogger.java +IDEA additional info: +Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +<+>UTF-8 +=================================================================== +diff --git a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/utils/logger/FileLogger.java b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/utils/logger/FileLogger.java +new file mode 100644 +--- /dev/null (revision d95eeb4f788d3a38a9488e0142510ed0a4a880ef) ++++ b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/utils/logger/FileLogger.java (revision d95eeb4f788d3a38a9488e0142510ed0a4a880ef) +@@ -0,0 +1,83 @@ ++package jss.customjoinandquitmessages.utils.logger; ++ ++import jss.customjoinandquitmessages.CustomJoinAndQuitMessages; ++import org.bukkit.Bukkit; ++import org.jetbrains.annotations.NotNull; ++ ++import java.io.*; ++import java.time.LocalDateTime; ++import java.time.format.DateTimeFormatter; ++ ++public class FileLogger { ++ ++ private static final CustomJoinAndQuitMessages plugin = CustomJoinAndQuitMessages.get(); ++ private static final DateTimeFormatter DATE_TIME_FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); ++ private static final String LOG_DIRECTORY = "plugins/CustomJoinAndQuitMessages/logs"; ++ ++ private static void log(String message, Throwable exception) { ++ String logFileName = LOG_DIRECTORY + "/" + getLogFileName(); ++ String logMessage = "[" + LocalDateTime.now().format(DATE_TIME_FORMATTER) + "] " + message + System.lineSeparator(); ++ String stackTrace = ""; ++ ++ if (exception != null) { ++ StringWriter sw = new StringWriter(); ++ PrintWriter pw = new PrintWriter(sw); ++ exception.printStackTrace(pw); ++ stackTrace = sw.toString(); ++ } ++ ++ File logFile = new File(logFileName); ++ boolean fileExists = logFile.exists(); ++ ++ try (BufferedWriter writer = new BufferedWriter(new FileWriter(logFileName, true))) { ++ if (!fileExists) { ++ //noinspection ResultOfMethodCallIgnored ++ logFile.createNewFile(); ++ createHeadFile(writer); ++ } ++ ++ writer.write(logMessage.replaceAll("&[0-9a-fA-Fklmnor]", "")); ++ writer.write(stackTrace); ++ } catch (IOException e) { ++ e.printStackTrace(); ++ } ++ } ++ ++ public static void logError(String message, Exception e) { ++ log("[ERROR] " + message, e); ++ } ++ ++ public static void logWarning(String message) { ++ log("[WARNING] " + message, null); ++ } ++ ++ public static void logInfo(String message) { ++ log("[INFO] " + message, null); ++ } ++ ++ public static void logOutLine(String message) { ++ log("[OUTLINE] " + message, null); ++ } ++ ++ public static void logSuccess(String message) { ++ log("[SUCCESS] " + message, null); ++ } ++ ++ public static void logDebug(String message) { ++ log("[DEBUG] " + message, null); ++ } ++ ++ private static void createHeadFile(@NotNull BufferedWriter writer) throws IOException { ++ writer.write("Plugin version: " + plugin.version + System.lineSeparator()); ++ writer.write("Java version: " + System.getProperty("java.version") + System.lineSeparator()); ++ writer.write("Server software: " + Bukkit.getServer().getName() + " " + Bukkit.getServer().getVersion() + System.lineSeparator()); ++ writer.write("------------------------------" + System.lineSeparator()); ++ writer.write(System.lineSeparator()); ++ } ++ ++ private static @NotNull String getLogFileName() { ++ DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd"); ++ return LocalDateTime.now().format(formatter) + ".log"; ++ } ++ ++} +Index: CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/utils/logger/Logger.java +IDEA additional info: +Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +<+>UTF-8 +=================================================================== +diff --git a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/utils/logger/Logger.java b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/utils/logger/Logger.java +new file mode 100644 +--- /dev/null (revision d95eeb4f788d3a38a9488e0142510ed0a4a880ef) ++++ b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/utils/logger/Logger.java (revision d95eeb4f788d3a38a9488e0142510ed0a4a880ef) +@@ -0,0 +1,44 @@ ++package jss.customjoinandquitmessages.utils.logger; ++ ++import jss.customjoinandquitmessages.utils.EventUtils; ++import jss.customjoinandquitmessages.utils.Settings; ++import jss.customjoinandquitmessages.utils.Util; ++ ++public class Logger { ++ ++ public static void error(String msg) { ++ try{ ++ Util.sendColorConsoleMessage(EventUtils.getStaticConsoleSender(), Util.getPrefix(true) + "&8: &e[&cERROR&e] &7" + msg); ++ }catch (Exception e){ ++ FileLogger.logError(msg, e); ++ } ++ } ++ ++ public static void warning(String msg) { ++ Util.sendColorConsoleMessage(EventUtils.getStaticConsoleSender(), Util.getPrefix(true) + "&8: &e[&dWARNING&e] &7" + msg); ++ FileLogger.logWarning(msg); ++ } ++ ++ public static void info(String msg) { ++ Util.sendColorConsoleMessage(EventUtils.getStaticConsoleSender(), Util.getPrefix(true) + "&8: &e[&9INFO&e] &7" + msg); ++ FileLogger.logInfo(msg); ++ } ++ ++ public static void outLine(String msg) { ++ Util.sendColorConsoleMessage(EventUtils.getStaticConsoleSender(), Util.getPrefix(true) + "&8: &e[&bOUTLINE&e] &7" + msg); ++ FileLogger.logOutLine(msg); ++ } ++ ++ public static void success(String msg) { ++ Util.sendColorConsoleMessage(EventUtils.getStaticConsoleSender(), Util.getPrefix(true) + "&8: &e[&aSUCCESS&e] &7" + msg); ++ FileLogger.logSuccess(msg); ++ } ++ ++ public static void debug(String msg) { ++ if(Settings.settings_debug) { ++ Util.sendColorConsoleMessage(EventUtils.getStaticConsoleSender(), Util.getPrefix(true) + "&8: &e[&dDEBUG&e] &7" + msg); ++ FileLogger.logDebug(msg); ++ } ++ } ++ ++} +Index: CustomJoinAndQuitMessagesOld/src/main/resources/config.yml +IDEA additional info: +Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +<+>UTF-8 +=================================================================== +diff --git a/CustomJoinAndQuitMessagesOld/src/main/resources/config.yml b/CustomJoinAndQuitMessagesOld/src/main/resources/config.yml +--- a/CustomJoinAndQuitMessagesOld/src/main/resources/config.yml (revision 3ebdfb92a2bbde47af6d6a9c7eaa2d8195f92df5) ++++ b/CustomJoinAndQuitMessagesOld/src/main/resources/config.yml (revision d95eeb4f788d3a38a9488e0142510ed0a4a880ef) +@@ -64,7 +64,7 @@ + + # |Channel-ID| Here is the id of the channel that is used for the chat + Channel-ID: 'none' +- # ++ + # |Essentials| + Essentials: + +@@ -254,6 +254,7 @@ + # |Enabled| Here you can enable or disable this feature + Enabled: true + ++ # + UsePerGroupWelcome: false + + # |Text| here you can set your own welcome message when entering +Index: bukkit/src/main/java/jss/customjoinandquitmessage/commands/subcommands/DisplayCommand.java +IDEA additional info: +Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +<+>UTF-8 +=================================================================== +diff --git a/bukkit/src/main/java/jss/customjoinandquitmessage/commands/subcommands/DisplayCommand.java b/bukkit/src/main/java/jss/customjoinandquitmessage/commands/subcommands/DisplayCommand.java +--- a/bukkit/src/main/java/jss/customjoinandquitmessage/commands/subcommands/DisplayCommand.java (revision 3ebdfb92a2bbde47af6d6a9c7eaa2d8195f92df5) ++++ b/bukkit/src/main/java/jss/customjoinandquitmessage/commands/subcommands/DisplayCommand.java (revision d95eeb4f788d3a38a9488e0142510ed0a4a880ef) +@@ -3,12 +3,18 @@ + import jss.customjoinandquitmessage.commands.utils.SubCommand; + import org.bukkit.command.CommandSender; + ++@SuppressWarnings("unused") + public class DisplayCommand extends SubCommand { + + public String name() { + return "display"; + } + ++ @Override ++ public String permission() { ++ return null; ++ } ++ + + public void onCommand(CommandSender sender, String[] args) { + +Index: bukkit/src/main/java/jss/customjoinandquitmessage/commands/subcommands/ReloadCommand.java +IDEA additional info: +Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +<+>UTF-8 +=================================================================== +diff --git a/bukkit/src/main/java/jss/customjoinandquitmessage/commands/subcommands/ReloadCommand.java b/bukkit/src/main/java/jss/customjoinandquitmessage/commands/subcommands/ReloadCommand.java +--- a/bukkit/src/main/java/jss/customjoinandquitmessage/commands/subcommands/ReloadCommand.java (revision 3ebdfb92a2bbde47af6d6a9c7eaa2d8195f92df5) ++++ b/bukkit/src/main/java/jss/customjoinandquitmessage/commands/subcommands/ReloadCommand.java (revision d95eeb4f788d3a38a9488e0142510ed0a4a880ef) +@@ -9,6 +9,11 @@ + return "reload"; + } + ++ @Override ++ public String permission() { ++ return null; ++ } ++ + + public void onCommand(CommandSender sender, String[] args) { + +Index: bukkit/src/main/java/jss/customjoinandquitmessage/files/LangFile.java +IDEA additional info: +Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +<+>UTF-8 +=================================================================== +diff --git a/bukkit/src/main/java/jss/customjoinandquitmessage/files/LangFile.java b/bukkit/src/main/java/jss/customjoinandquitmessage/files/LangFile.java +--- a/bukkit/src/main/java/jss/customjoinandquitmessage/files/LangFile.java (revision 3ebdfb92a2bbde47af6d6a9c7eaa2d8195f92df5) ++++ b/bukkit/src/main/java/jss/customjoinandquitmessage/files/LangFile.java (revision d95eeb4f788d3a38a9488e0142510ed0a4a880ef) +@@ -8,16 +8,19 @@ + import java.io.File; + import java.util.Locale; + ++@SuppressWarnings("ALL") + public class LangFile { + +- private CustomJoinAndQuitMessage plugin; ++ private final CustomJoinAndQuitMessage plugin; + private FileConfiguration config; + private File file; ++ + private final Locale localeObj; + private final String localeName; +- private final int index; ++ private int index; + +- public LangFile(@NotNull String localeName, int index){ ++ public LangFile(CustomJoinAndQuitMessage plugin, @NotNull String localeName, int index){ ++ this.plugin = plugin; + this.index = index; + this.localeName = localeName; + getConfig(localeName); +@@ -25,7 +28,6 @@ + localeObj = new Locale(localeName.substring(0,2),localeName.substring(3,5)); + } + +- + public FileConfiguration getConfig(final String name) { + if(config == null){ + reload(name); +@@ -61,25 +63,4 @@ + + } + +- public String getLocaleName() { +- return this.localeName; +- } +- +- public String getLanguageName() { +- if (localeObj == null) { +- return "unknown"; +- } +- return localeObj.getDisplayLanguage(localeObj); +- } +- +- public String getCountryName() { +- if (localeObj == null) { +- return "unknown"; +- } +- return localeObj.getDisplayCountry(localeObj); +- } +- +- public int getIndex() { +- return index; +- } + } +Index: bukkit/src/main/java/jss/customjoinandquitmessage/files/utils/FileList.java +IDEA additional info: +Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +<+>UTF-8 +=================================================================== +diff --git a/bukkit/src/main/java/jss/customjoinandquitmessage/files/utils/FileList.java b/bukkit/src/main/java/jss/customjoinandquitmessage/files/utils/FileList.java +--- a/bukkit/src/main/java/jss/customjoinandquitmessage/files/utils/FileList.java (revision 3ebdfb92a2bbde47af6d6a9c7eaa2d8195f92df5) ++++ b/bukkit/src/main/java/jss/customjoinandquitmessage/files/utils/FileList.java (revision d95eeb4f788d3a38a9488e0142510ed0a4a880ef) +@@ -24,7 +24,7 @@ + + List result = new ArrayList<>(); + +- File dir = new File(plugin.getDataFolder(), "lang"); ++ File dir = new File(plugin.getDataFolder(), "langs"); + + if(dir.exists()){ + +Index: bukkit/src/main/java/jss/customjoinandquitmessage/files/utils/PreConfigLoader.java +IDEA additional info: +Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +<+>UTF-8 +=================================================================== +diff --git a/bukkit/src/main/java/jss/customjoinandquitmessage/files/utils/PreConfigLoader.java b/bukkit/src/main/java/jss/customjoinandquitmessage/files/utils/PreConfigLoader.java +--- a/bukkit/src/main/java/jss/customjoinandquitmessage/files/utils/PreConfigLoader.java (revision 3ebdfb92a2bbde47af6d6a9c7eaa2d8195f92df5) ++++ b/bukkit/src/main/java/jss/customjoinandquitmessage/files/utils/PreConfigLoader.java (revision d95eeb4f788d3a38a9488e0142510ed0a4a880ef) +@@ -1,5 +1,6 @@ + package jss.customjoinandquitmessage.files.utils; + ++import jss.customjoinandquitmessage.CustomJoinAndQuitMessage; + import jss.customjoinandquitmessage.files.LangFile; + + import java.io.IOException; +@@ -7,6 +8,9 @@ + + public class PreConfigLoader { + ++ private final CustomJoinAndQuitMessage plugin = CustomJoinAndQuitMessage.get(); ++ ++ @SuppressWarnings("unused") + public void loadConfigs(){ + Settings.config_Lang = "en_US"; + } +@@ -18,7 +22,7 @@ + + try { + for(String code : fileList.list()){ +- availableLangs.put(code, new LangFile(code, index++)); ++ availableLangs.put(code, new LangFile(plugin, code, index++)); + } + } catch (IOException e) { + throw new RuntimeException(e); +@@ -26,7 +30,7 @@ + + if(!availableLangs.containsKey(Settings.config_Lang)){ + Settings.config_Lang = "en_US"; +- availableLangs.put(Settings.config_Lang, new LangFile(Settings.config_Lang,0)); ++ availableLangs.put(Settings.config_Lang, new LangFile(plugin, Settings.config_Lang,0)); + } + return true; + } +Index: bukkit/src/main/java/jss/customjoinandquitmessage/listeners/chat/JoinListener.java +IDEA additional info: +Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +<+>UTF-8 +=================================================================== +diff --git a/bukkit/src/main/java/jss/customjoinandquitmessage/listeners/chat/JoinListener.java b/bukkit/src/main/java/jss/customjoinandquitmessage/listeners/chat/JoinListener.java +--- a/bukkit/src/main/java/jss/customjoinandquitmessage/listeners/chat/JoinListener.java (revision 3ebdfb92a2bbde47af6d6a9c7eaa2d8195f92df5) ++++ b/bukkit/src/main/java/jss/customjoinandquitmessage/listeners/chat/JoinListener.java (revision d95eeb4f788d3a38a9488e0142510ed0a4a880ef) +@@ -3,7 +3,6 @@ + import org.bukkit.event.EventHandler; + import org.bukkit.event.Listener; + import org.bukkit.event.player.PlayerJoinEvent; +-import org.bukkit.event.player.PlayerQuitEvent; + + public class JoinListener implements Listener { + +@@ -15,11 +14,7 @@ + } + + @EventHandler +- public void onQuit(PlayerQuitEvent e){ +- +- } +- +- private void onUpdate(){ ++ private void onUpdate(PlayerJoinEvent e){ + + } + +Index: bukkit/src/main/java/jss/customjoinandquitmessage/listeners/chat/QuitListener.java +IDEA additional info: +Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +<+>UTF-8 +=================================================================== +diff --git a/bukkit/src/main/java/jss/customjoinandquitmessage/listeners/chat/QuitListener.java b/bukkit/src/main/java/jss/customjoinandquitmessage/listeners/chat/QuitListener.java +new file mode 100644 +--- /dev/null (revision d95eeb4f788d3a38a9488e0142510ed0a4a880ef) ++++ b/bukkit/src/main/java/jss/customjoinandquitmessage/listeners/chat/QuitListener.java (revision d95eeb4f788d3a38a9488e0142510ed0a4a880ef) +@@ -0,0 +1,14 @@ ++package jss.customjoinandquitmessage.listeners.chat; ++ ++import org.bukkit.event.EventHandler; ++import org.bukkit.event.Listener; ++import org.bukkit.event.player.PlayerQuitEvent; ++ ++public class QuitListener implements Listener { ++ ++ @EventHandler ++ public void onQuit(PlayerQuitEvent e){ ++ ++ } ++ ++} +Index: bukkit/src/main/resources/config.yml +IDEA additional info: +Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +<+>UTF-8 +=================================================================== +diff --git a/bukkit/src/main/resources/config.yml b/bukkit/src/main/resources/config.yml +--- a/bukkit/src/main/resources/config.yml (revision 3ebdfb92a2bbde47af6d6a9c7eaa2d8195f92df5) ++++ b/bukkit/src/main/resources/config.yml (revision d95eeb4f788d3a38a9488e0142510ed0a4a880ef) +@@ -1,30 +1,153 @@ ++# ______ _____ ____ __ ___ ++# / ____/ / / | / __ \ / |/ / ++# / / __ / / /| |/ / / / / /|_/ / By jonagamerpro1234 ++# / /___/ /_/ / ___ / /_/ / / / / / Version ${project.version} ++# \____/\____/_/ |_\___\_\/_/ /_/ Thanks for using CustomJoinAndQuitMessage <3 ++# ++# ● A simple plugin for personalization of the join and quit messages and more... ++# ++# ● Spigot: https://www.spigotmc.org/resources/custom-join-and-quit-message-1-8-x-1-19-x.57006/ ++# ● Discord: https://discord.gg/c5GhQDQCK5 ++# ● Issue Tracker: https://github.com/jonagamerpro1234/CustomJoinAndQuitMessages/issues ++# ● Plugin Statistics: https://bstats.org/plugin/bukkit/CustomJoinAndQuitMessages/6318 ++ ++# | Settings | ++Settings: ++ ++ # Shows you important information about the plugin loading ++ Debug: true ++ ++ # You can use the available languages of the plugin, or you can add your own translations [ Default = en_US ] ++ Lang: en_US ++ ++ # This function lets you know if there is a plugin update [Does not disable console messages] ++ Update: ++ ++ # Here you can enable or disable this feature ++ Enabled: true ++ ++ # You will get the updates from [spigot | github] what is the difference, here below is the explanation of why ++ # |Spigot| Get only released updates, and you won't receive beta notifications ++ # |GitHub| Get only the released and beta updates, and you will be able to receive notifications of both versions ++ GetFromUpdate: spigot ++ ++# | Hooks | ++Hooks: ++ ++ # Here you can configure everything related to LuckPerms and or deactivate or activate functions ++ LuckPerms: ++ ++ # Here you can enable or disable this feature ++ Enabled: true ++ ++ # This function allows the plugin to detect if the player has changed rank in a period of time defined in the [Tick] section ++ AutoUpdateGroup: ++ ++ # Here you can enable or disable this feature ++ Enabled: true ++ ++ # Here you can define the time that the actions are automatically executed [Default = 600], 600 tick = 30 sec ++ Tick: 600 ++ ++ # Here you can define the discord channel where the messages from minecraft to discord are seen ++ DiscordSVR: ++ ++ # Here you can enable or disable this feature ++ Enabled: true ++ ++ # Here is the id of the channel that is used for the chat ++ Channel-Id: "none" ++ ++ # Aqui podras cambiar los ajustes de cada implementacion que funciona con EssentialsX ++ EssentialsX: + +-Lang: en-US ++ # This allows you to join or quit the server without the message being shown to other players. ++ HidePlayerIsVanish: true + ++ # Here you can define the discord channel where the messages from minecraft to discord are seen ++ # (!) Es necesario tener el plugin de [ EssentialsDiscord ] para que funcione bien todo ++ EssentialsDiscord: + ++ # Here you can enable or disable this feature ++ Enabled: true ++ ++ # Here is the id of the channel that is used for the chat ++ Channel-Id: "none" ++ ++ # Usara el canal que se encuentra definido en la configuracion del plugin EssentialsDiscord y ignorara el Channel-Id de CustomJoinAndMessages ++ UseDefaultChannel: false ++ ++ ++# | ChatFormat | ++# Aqui pordras personalizar los mensajes de entrada y salida del jugador y tambien podras personalizar los mensajes con diversas funciones ++# (!) Para personalizacion de grupos es necesario que cambie el tipo a [ group ] + ChatFormat: + + # Esta funcion desactiva el formato personalizado del plugin y usa el metodo setFormat de spigot, pero no funcionaran los eventos de Hover y Click + # [!] Esto permite tener una mejor compatibilidad con otros plugins pero deshabilita algunas funciones del plugin ++ # [!] Esta funcion es experimental, lo que significa que puede sufrir varios cambios o incluso puede ser eliminada definitivamente + UsaLegacyFormat: false + ++ # Here you can enable or disable the chat to be seen in the console ++ ShowChatInConsole: true ++ ++ # Aqui podras configurar el tipo del formato los cuales son ++ # |normal| Sirve para la personalizacion general de todos los jugadores de los mensajes de entrada y salida, esto no permite usar las funciones de grupo ++ # |group| Sirve para la personalizacion por gropu y desabilita la personalizacion general y permite una personalizacion mejor para cada grupo ++ # (!) Es necesario tener LuckPerms para usar la personalizacion de grupo ++ Type: normal ++ ++ # | Join | + Join: + ++ # Here you can enable or disable this feature + Enabled: true + +- Format: "" ++ # Aqui puedes definir el mensaje de entra ++ Format: "&e[&a+&e] &3{player} &7has joined the server" + ++ # | First Join | + First-Join: + ++ # Here you can enable or disable this feature + Enabled: true + +- Format: "" ++ Format: "&3Welcome to the server, we hope you enjoy your time here and have a good time" + ++ # | Quit | + Quit: + ++ # Here you can enable or disable this feature + Enabled: true + +- Format: ++ # Aqui puedes definir el mensaje de salida ++ Format: "&e[&c-&e] &3{player} &7has left the server" ++ ++# |Welcome| ++Welcome: ++ ++ # Here you can enable or disable this feature ++ Enabled: true ++ ++ # Permite usa un mensaje de bienvenida por grupo y desactiva el mensaje general de bienvenida ++ UsePerGroupWelcome: false + ++ # Here you can set your own welcome message when entering ++ Text: ++ - '&m=========================================&r' ++ - '<0>' ++ - '&e> &7Welcome To The Server &b' ++ - '<0>' ++ - '&e> &cShop: shop-example.com' ++ - '&e> &7Use &b/skin to put on a skin' ++ - '<0>' ++ - '&m=========================================&r' + +-File-Version: 1 +\ No newline at end of file ++# I would not change anything ++File-Version: 4 ++ ++# |> This is the end of the configuration... [-_-] more things coming soon ++# ++# | Config File | ++# | Version 1.8 | ++# +\ No newline at end of file +Index: bukkit/src/main/resources/groups.yml +IDEA additional info: +Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +<+>UTF-8 +=================================================================== +diff --git a/bukkit/src/main/resources/groups.yml b/bukkit/src/main/resources/groups.yml +new file mode 100644 +--- /dev/null (revision d95eeb4f788d3a38a9488e0142510ed0a4a880ef) ++++ b/bukkit/src/main/resources/groups.yml (revision d95eeb4f788d3a38a9488e0142510ed0a4a880ef) +@@ -0,0 +1,128 @@ ++default: ++ ++ HideOtherGroups: ++ ++ Enabled: true ++ ++ List: ++ - admin ++ ++ Welcome: ++ ++ Enabled: true ++ ++ Text: ++ - "" ++ ++ FirstJoin: ++ ++ Enabled: true ++ ++ Message: "" ++ ++ Join: ++ ++ Enabled: true ++ ++ JoinMessage: "[+] {player} {group}" ++ ++ HoverEvent: ++ ++ Enabled: true ++ ++ # ++ HoverText: ++ - "" ++ - "" ++ - "" ++ ++ # ++ ClickEvent: ++ ++ # ++ Enabled: true ++ ++ # ++ Actions: ++ - "[EXECUTE]: /cjm help" ++ - "[SUGGEST]: /cjm" ++ - "[OPEN_URL]: ---" ++ ++ Title: ++ ++ Enabled: true ++ ++ Title: "" ++ ++ SubTitle: "" ++ ++ FadeIn: 20 ++ ++ Stay: 80 ++ ++ FadeOut: 20 ++ ++ ActionBar: ++ ++ Enabled: true ++ ++ Message: "" ++ ++ Sound: ++ ++ Enabled: true ++ ++ SendToAll: true ++ ++ # This is the name of the sound you will hear when it is mentioned to you in chat. ++ Name: 'BLOCK_NOTE_BLOCK_PLING' ++ ++ # This is the pitch of the sound that you will hear when mentioned in the chat ++ Pitch: 1 ++ ++ # This is the volume of the sound that you will hear when the chat mentions it ++ Volume: 10 ++ ++ Quit: ++ ++ Enabled: true ++ ++ QuitMessage: "[-] {player} {group}" ++ ++ HoverEvent: ++ ++ Enabled: true ++ ++ # ++ HoverText: ++ - "" ++ - "" ++ - "" ++ ++ # ++ ClickEvent: ++ ++ # ++ Enabled: true ++ ++ # ++ Actions: ++ - "[EXECUTE]: /cjm help" ++ - "[SUGGEST]: /cjm" ++ - "[OPEN_URL]: ---" ++ ++ Sound: ++ ++ Enabled: true ++ ++ # When active, the sound will be sent to all players connected to the server ++ SendToAll: true ++ ++ # This is the name of the sound you will hear when it is mentioned to you in chat. ++ Name: 'BLOCK_NOTE_BLOCK_PLING' ++ ++ # This is the pitch of the sound that you will hear when mentioned in the chat ++ Pitch: 1 ++ ++ # This is the volume of the sound that you will hear when the chat mentions it ++ Volume: 10 +\ No newline at end of file +Index: bukkit/src/main/resources/plugin.yml +IDEA additional info: +Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +<+>UTF-8 +=================================================================== +diff --git a/bukkit/src/main/resources/plugin.yml b/bukkit/src/main/resources/plugin.yml +--- a/bukkit/src/main/resources/plugin.yml (revision 3ebdfb92a2bbde47af6d6a9c7eaa2d8195f92df5) ++++ b/bukkit/src/main/resources/plugin.yml (revision d95eeb4f788d3a38a9488e0142510ed0a4a880ef) +@@ -1,7 +1,40 @@ +-name: CustomJoinAndQuitMessage ++name: CustomJoinAndQuitMessages + version: '${project.version}' + main: jss.customjoinandquitmessage.CustomJoinAndQuitMessage + api-version: 1.16 +-prefix: CustomJoinAndQuitMessage ++prefix: CustomJoinAndQuitMessages + loadbefore: [ Essentials ] +-softdepend: [ PlaceholderAPI, LuckPerms, DiscordSRV, Essentials, EssentialsDiscord ] ++softdepend: [ ++ PlaceholderAPI, DiscordSRV, ++ LuckPerms, EssentialsDiscord, ++ Essentials, SuperVanish, ++ PremiumVanish ++] ++ ++commands: ++ customjoinandquitmessages: ++ description: the main command ++ aliases: ++ - cjm ++ ++permissions: ++ cjm.admin: ++ description: give all permission of plugin ++ children: ++ cjm.update: true ++ cjm.command.reload: true ++ cjm.command.help: true ++ cjm.command.tabcomplete: true ++ default: op ++ cjm.update: ++ description: allows you to receive notifications of available updates ++ default: op ++ cjm.command.reload: ++ description: allows to use the reload command ++ default: op ++ cjm.command.help: ++ description: gives access to the plugin help command ++ default: op ++ cjm.command.tabcomplete: ++ description: allows you to see the list of available commands ++ default: op +Index: patches/Update_config.patch +IDEA additional info: +Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +<+>UTF-8 +=================================================================== +diff --git a/patches/Update_config.patch b/patches/Update_config.patch +new file mode 100644 +--- /dev/null (revision d95eeb4f788d3a38a9488e0142510ed0a4a880ef) ++++ b/patches/Update_config.patch (revision d95eeb4f788d3a38a9488e0142510ed0a4a880ef) +@@ -0,0 +1,1807 @@ ++Index: CustomJoinAndQuitMessagesOld/src/main/resources/config.yml ++IDEA additional info: ++Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP ++<+>UTF-8 ++=================================================================== ++diff --git a/CustomJoinAndQuitMessagesOld/src/main/resources/config.yml b/CustomJoinAndQuitMessagesOld/src/main/resources/config.yml ++--- a/CustomJoinAndQuitMessagesOld/src/main/resources/config.yml (revision e3e6f528ca2c93af4251b9955aa457aff0fd3a62) +++++ b/CustomJoinAndQuitMessagesOld/src/main/resources/config.yml (revision 3ebdfb92a2bbde47af6d6a9c7eaa2d8195f92df5) ++@@ -13,7 +13,7 @@ ++ # ++ Config: ++ ++- # |Lang| you can use the available languages of the plugin, or you can add your own translations [ Default = en-US ] +++ # |Lang| you can use the available languages of the plugin, or you can add your own translations [ Default = en_US ] ++ Lang: en_US ++ ++ # |Update| This function lets you know if there is a plugin update [Does not disable console messages] ++Index: patches/Removed_method_getType_of_the_GroupManager_class.patch ++IDEA additional info: ++Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP ++<+>UTF-8 ++=================================================================== ++diff --git a/patches/Removed_method_getType_of_the_GroupManager_class.patch b/patches/Removed_method_getType_of_the_GroupManager_class.patch ++new file mode 100644 ++--- /dev/null (revision 3ebdfb92a2bbde47af6d6a9c7eaa2d8195f92df5) +++++ b/patches/Removed_method_getType_of_the_GroupManager_class.patch (revision 3ebdfb92a2bbde47af6d6a9c7eaa2d8195f92df5) ++@@ -0,0 +1,1780 @@ +++Index: CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/manager/GroupManager.java +++IDEA additional info: +++Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +++<+>UTF-8 +++=================================================================== +++diff --git a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/manager/GroupManager.java b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/manager/GroupManager.java +++--- a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/manager/GroupManager.java (revision 6f51455f26ef7aad69f1b9446a2a31237d1f5040) ++++++ b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/manager/GroupManager.java (revision e3e6f528ca2c93af4251b9955aa457aff0fd3a62) +++@@ -77,11 +77,11 @@ +++ } +++ +++ public boolean isClick(String group) { +++- boolean isclick = false; ++++ boolean isClick = false; +++ if (existsGroup(group)) { +++- isclick = config.getBoolean(group + ".ClickEvent.Enabled"); ++++ isClick = config.getBoolean(group + ".ClickEvent.Enabled"); +++ } +++- return isclick; ++++ return isClick; +++ } +++ +++ public String getClickMode(String group) { +++@@ -112,12 +112,6 @@ +++ return null; +++ } +++ +++- public String getType(String group){ +++- if (existsGroup(group)) { +++- return config.getString(group + ".Type"); +++- } +++- return null; +++- } +++ +++ public boolean isTitle(String group){ +++ boolean istitle = false; +++Index: patches/Fixed_PlayerStorageData.patch +++IDEA additional info: +++Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +++<+>UTF-8 +++=================================================================== +++diff --git a/patches/Fixed_PlayerStorageData.patch b/patches/Fixed_PlayerStorageData.patch +++new file mode 100644 +++--- /dev/null (revision e3e6f528ca2c93af4251b9955aa457aff0fd3a62) ++++++ b/patches/Fixed_PlayerStorageData.patch (revision e3e6f528ca2c93af4251b9955aa457aff0fd3a62) +++@@ -0,0 +1,1734 @@ ++++Index: CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/CustomJoinAndQuitMessages.java ++++IDEA additional info: ++++Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP ++++<+>UTF-8 ++++=================================================================== ++++diff --git a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/CustomJoinAndQuitMessages.java b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/CustomJoinAndQuitMessages.java ++++--- a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/CustomJoinAndQuitMessages.java (revision 5436229cc153c4aec4cd6267d80f1e8301022990) +++++++ b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/CustomJoinAndQuitMessages.java (revision 6f51455f26ef7aad69f1b9446a2a31237d1f5040) ++++@@ -28,7 +28,6 @@ ++++ ++++ private static CustomJoinAndQuitMessages plugin; ++++ public Metrics metrics; ++++- public boolean useLatestversion; ++++ private final PluginDescriptionFile jss = getDescription(); ++++ public String name = this.jss.getName(); ++++ public String version = this.jss.getVersion(); ++++@@ -46,7 +45,7 @@ ++++ Util.sendLoadTitle(version); ++++ inventoryViews = new ArrayList<>(); ++++ ++++- Util.createFolder(this,"Players"); +++++ //Util.createFolder(this,"Players"); ++++ } ++++ ++++ public void onEnable() { ++++Index: CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/listener/JoinListener.java ++++IDEA additional info: ++++Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP ++++<+>UTF-8 ++++=================================================================== ++++diff --git a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/listener/JoinListener.java b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/listener/JoinListener.java ++++--- a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/listener/JoinListener.java (revision 5436229cc153c4aec4cd6267d80f1e8301022990) +++++++ b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/listener/JoinListener.java (revision 6f51455f26ef7aad69f1b9446a2a31237d1f5040) ++++@@ -8,8 +8,6 @@ ++++ import jss.customjoinandquitmessages.json.MessageBuilder; ++++ import jss.customjoinandquitmessages.manager.HookManager; ++++ import jss.customjoinandquitmessages.manager.PlayerManager; ++++-import jss.customjoinandquitmessages.storage.PlayerData; ++++-import jss.customjoinandquitmessages.storage.PlayerJsonStorage; ++++ import jss.customjoinandquitmessages.update.UpdateChecker; ++++ import jss.customjoinandquitmessages.utils.GroupHelper; ++++ import jss.customjoinandquitmessages.utils.Logger; ++++@@ -55,13 +53,6 @@ ++++ tempGroup = "default"; ++++ } ++++ ++++- PlayerJsonStorage playerJsonStorage = new PlayerJsonStorage(plugin); ++++- PlayerData playerData = playerJsonStorage.loadPlayerData(p.getName()); ++++- ++++- if(playerData == null){ ++++- playerJsonStorage.savePlayerData(new PlayerData(p.getName())); ++++- } ++++- ++++ PlayerManager playerManager = new PlayerManager(); ++++ playerManager.createPlayer(p, tempGroup); ++++ ++++@@ -245,7 +236,7 @@ ++++ } ++++ } ++++ ++++- @EventHandler +++++ @EventHandler(priority = EventPriority.HIGH) ++++ public void onQuit(@NotNull PlayerQuitEvent e) { ++++ FileConfiguration config = plugin.getConfigFile().getConfig(); ++++ Player p = e.getPlayer(); ++++Index: patches/Removed_types_normal_and_modify_of_Join_and_Quit_and_more_.patch ++++IDEA additional info: ++++Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP ++++<+>UTF-8 ++++=================================================================== ++++diff --git a/patches/Removed_types_normal_and_modify_of_Join_and_Quit_and_more_.patch b/patches/Removed_types_normal_and_modify_of_Join_and_Quit_and_more_.patch ++++new file mode 100644 ++++--- /dev/null (revision 6f51455f26ef7aad69f1b9446a2a31237d1f5040) +++++++ b/patches/Removed_types_normal_and_modify_of_Join_and_Quit_and_more_.patch (revision 6f51455f26ef7aad69f1b9446a2a31237d1f5040) ++++@@ -0,0 +1,1659 @@ +++++Index: CustomJoinAndQuitMessagesOld/pom.xml +++++IDEA additional info: +++++Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +++++<+>UTF-8 +++++=================================================================== +++++diff --git a/CustomJoinAndQuitMessagesOld/pom.xml b/CustomJoinAndQuitMessagesOld/pom.xml +++++--- a/CustomJoinAndQuitMessagesOld/pom.xml (revision 60d9051d52d70ed86db8e0fc1a50da61f395e55a) ++++++++ b/CustomJoinAndQuitMessagesOld/pom.xml (revision 5436229cc153c4aec4cd6267d80f1e8301022990) +++++@@ -9,7 +9,7 @@ +++++ +++++ +++++ CustomJoinAndQuitMessagesOld +++++- 1.7.8-release ++++++ 1.7.9-release +++++ +++++ +++++ 8 +++++Index: CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/commands/CustomJoinAndQuitCmd.java +++++IDEA additional info: +++++Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +++++<+>UTF-8 +++++=================================================================== +++++diff --git a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/commands/CustomJoinAndQuitCmd.java b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/commands/CustomJoinAndQuitCmd.java +++++--- a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/commands/CustomJoinAndQuitCmd.java (revision 60d9051d52d70ed86db8e0fc1a50da61f395e55a) ++++++++ b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/commands/CustomJoinAndQuitCmd.java (revision 5436229cc153c4aec4cd6267d80f1e8301022990) +++++@@ -58,7 +58,7 @@ +++++ if (args.length >= 1) { +++++ +++++ if (args[0].equalsIgnoreCase("help")) { +++++- if ((j.isOp()) || (j.hasPermission("Cjm.Help"))) { ++++++ if ((j.isOp()) || (j.hasPermission("cjm.command.help"))) { +++++ Util.sendColorMessage(j, "&5-=-=-=-=-=-=-=-=-=-=-=&6[&d" + plugin.name + "&6]&5=-=-=-=-=-=-=-=-=-=-=-"); +++++ for (String text : plugin.Locale().help_1) { +++++ Util.sendColorMessage(j, text); +++++@@ -71,7 +71,7 @@ +++++ } +++++ +++++ if (args[0].equalsIgnoreCase("reload") || args[0].equalsIgnoreCase("rl")) { +++++- if ((j.isOp()) || (j.hasPermission("Cjm.Reload"))) { ++++++ if ((j.isOp()) || (j.hasPermission(" cjm.command.reload"))) { +++++ plugin.reloadAllFiles(); +++++ Util.sendColorMessage(j, Util.getPrefix(false) + plugin.Locale().reload); +++++ } else { +++++Index: CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/config/utils/PreConfigLoader.java +++++IDEA additional info: +++++Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +++++<+>UTF-8 +++++=================================================================== +++++diff --git a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/config/utils/PreConfigLoader.java b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/config/utils/PreConfigLoader.java +++++--- a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/config/utils/PreConfigLoader.java (revision 60d9051d52d70ed86db8e0fc1a50da61f395e55a) ++++++++ b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/config/utils/PreConfigLoader.java (revision 5436229cc153c4aec4cd6267d80f1e8301022990) +++++@@ -32,7 +32,6 @@ +++++ //Join +++++ Settings.join = Objects.equals(config.getString("Join.Enabled"), "true"); +++++ Settings.join_message = config.getString("Join.Text"); +++++- Settings.join_type = config.getString("Join.Type"); +++++ +++++ Settings.firstjoin = Objects.equals(config.getString("Join.First-Join.Enabled"), "true"); +++++ Settings.join_message_first = config.getString("Join.First-Join.Text"); +++++@@ -43,9 +42,9 @@ +++++ Settings.join_message_title_title = config.getString("Join.Title.Title"); +++++ Settings.join_message_title_subtitle = config.getString("Join.Title.SubTitle"); +++++ +++++- Settings.join_title_fadein = config.getInt("Join.Title.FadeIn"); ++++++ Settings.join_title_fadeIn = config.getInt("Join.Title.FadeIn"); +++++ Settings.join_title_stay = config.getInt("Join.Title.Stay"); +++++- Settings.join_title_fadeout = config.getInt("Join.Title.FadeOut"); ++++++ Settings.join_title_fadeOut = config.getInt("Join.Title.FadeOut"); +++++ +++++ Settings.join_sound = Objects.equals(config.getString("Join.Sound.Enabled"), "true"); +++++ Settings.join_sound_name = config.getString("Join.Sound.Name"); +++++@@ -54,7 +53,6 @@ +++++ +++++ //Quit +++++ Settings.quit = Objects.equals(config.getString("Quit.Enabled"), "true"); +++++- Settings.quit_type = config.getString("Quit.Type"); +++++ Settings.quit_message = config.getString("Quit.Text"); +++++ +++++ //Welcome +++++@@ -62,11 +60,11 @@ +++++ Settings.list_welcome = config.getStringList("Welcome.Text"); +++++ +++++ //Hooks +++++- Settings.hook_discordsrv = Objects.equals(config.getString("Hooks.DiscordSRV.Enabled"), "true"); +++++- Settings.hook_discordsrv_channelid = config.getString("Hooks.DiscordSRV.Channel-ID"); ++++++ Settings.hook_discordSrv = Objects.equals(config.getString("Hooks.DiscordSRV.Enabled"), "true"); ++++++ Settings.hook_discordSrv_channelId = config.getString("Hooks.DiscordSRV.Channel-ID"); +++++ +++++ Settings.hook_essentialsDiscord = Objects.equals(config.getString("Hooks.EssentialsDiscord.Enabled"), "true"); +++++- Settings.hook_essentialsDiscord_channelid = config.getString("Hooks.EssentialsDiscord.Channel-ID"); ++++++ Settings.hook_essentialsDiscord_channelId = config.getString("Hooks.EssentialsDiscord.Channel-ID"); +++++ Settings.hook_essentialsDiscord_use_default_channel = config.getBoolean("Hooks.EssentialsDiscord.Use-Default-Channel"); +++++ +++++ Settings.hook_luckperms = config.getBoolean("Hooks.LuckPerms.Enabled"); +++++@@ -74,7 +72,7 @@ +++++ Settings.hook_luckperms_autoUpdate_group_tick = config.getLong("Hooks.LuckPerms.AutoUpdateGroup.Tick"); +++++ +++++ Settings.hook_essentials = Objects.equals(config.getString("Hooks.Essentials.Enabled"), "true"); +++++- Settings.hook_essentials_hideplayervanish = config.getBoolean("Hooks.Essentials.HidePlayerIsVanish"); ++++++ Settings.hook_essentials_hidePlayerVanish = config.getBoolean("Hooks.Essentials.HidePlayerIsVanish"); +++++ +++++ } catch (Exception e) { +++++ Logger.error("&cThere was an error loading the &b[PreConfigLoader]&7, please reload the plugin"); +++++Index: CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/hook/DiscordSRVHHook.java +++++IDEA additional info: +++++Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +++++<+>UTF-8 +++++=================================================================== +++++diff --git a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/hook/DiscordSRVHHook.java b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/hook/DiscordSRVHHook.java +++++--- a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/hook/DiscordSRVHHook.java (revision 60d9051d52d70ed86db8e0fc1a50da61f395e55a) ++++++++ b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/hook/DiscordSRVHHook.java (revision 5436229cc153c4aec4cd6267d80f1e8301022990) +++++@@ -1,6 +1,5 @@ +++++ package jss.customjoinandquitmessages.hook; +++++ +++++-import jss.customjoinandquitmessages.manager.HookManager; +++++ import jss.customjoinandquitmessages.utils.EventUtils; +++++ import jss.customjoinandquitmessages.utils.Logger; +++++ import jss.customjoinandquitmessages.utils.Settings; +++++@@ -10,13 +9,8 @@ +++++ +++++ public class DiscordSRVHHook implements IHook { +++++ +++++- private HookManager hookManager; +++++ private boolean isEnabled; +++++ +++++- public DiscordSRVHHook(HookManager hookManager) { +++++- this.hookManager = hookManager; +++++- } +++++- +++++ public void setup() { +++++ if (!Bukkit.getPluginManager().isPluginEnabled("DiscordSRV")) { +++++ Logger.warning("&eDiscordSRV not enabled! - Disable Features..."); +++++@@ -24,7 +18,7 @@ +++++ return; +++++ } +++++ +++++- if (!Settings.hook_discordsrv) { ++++++ if (!Settings.hook_discordSrv) { +++++ this.isEnabled = false; +++++ Logger.warning("&eDiscordSRV not enabled! - Disable Features..."); +++++ return; +++++@@ -38,7 +32,4 @@ +++++ return isEnabled; +++++ } +++++ +++++- public HookManager getHookManager() { +++++- return hookManager; +++++- } +++++ } +++++Index: CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/hook/EssentialsXDiscordHook.java +++++IDEA additional info: +++++Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +++++<+>UTF-8 +++++=================================================================== +++++diff --git a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/hook/EssentialsXDiscordHook.java b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/hook/EssentialsXDiscordHook.java +++++--- a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/hook/EssentialsXDiscordHook.java (revision 60d9051d52d70ed86db8e0fc1a50da61f395e55a) ++++++++ b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/hook/EssentialsXDiscordHook.java (revision 5436229cc153c4aec4cd6267d80f1e8301022990) +++++@@ -1,6 +1,5 @@ +++++ package jss.customjoinandquitmessages.hook; +++++ +++++-import jss.customjoinandquitmessages.manager.HookManager; +++++ import jss.customjoinandquitmessages.utils.EventUtils; +++++ import jss.customjoinandquitmessages.utils.Logger; +++++ import jss.customjoinandquitmessages.utils.Settings; +++++@@ -12,14 +11,9 @@ +++++ +++++ public class EssentialsXDiscordHook implements IHook { +++++ +++++- private HookManager hookManager; +++++ private boolean isEnabled; +++++ private DiscordService service; +++++ +++++- public EssentialsXDiscordHook(HookManager hookManager) { +++++- this.hookManager = hookManager; +++++- } +++++- +++++ public void setup() { +++++ if (!Bukkit.getPluginManager().isPluginEnabled("EssentialsDiscord")) { +++++ Logger.warning("&eEssentialsDiscord not enabled! - Disable Features..."); +++++@@ -43,27 +37,22 @@ +++++ return isEnabled; +++++ } +++++ +++++- public DiscordService getService() { +++++- return service; +++++- } +++++- ++++++ @SuppressWarnings("unused") +++++ public void sendJoinMessage(String channelId, String message) { +++++ if (Settings.hook_essentialsDiscord_use_default_channel) { +++++ service.sendMessage(MessageType.DefaultTypes.JOIN, message, false); +++++ } else { +++++- service.sendMessage(new MessageType(Settings.hook_essentialsDiscord_channelid), message, false); ++++++ service.sendMessage(new MessageType(Settings.hook_essentialsDiscord_channelId), message, false); +++++ } +++++ } +++++ ++++++ @SuppressWarnings("unused") +++++ public void sendQuitMessage(String channelId, String message) { +++++ if (Settings.hook_essentialsDiscord_use_default_channel) { +++++ service.sendMessage(MessageType.DefaultTypes.LEAVE, message, false); +++++ } else { +++++- service.sendMessage(new MessageType(Settings.hook_essentialsDiscord_channelid), message, false); ++++++ service.sendMessage(new MessageType(Settings.hook_essentialsDiscord_channelId), message, false); +++++ } +++++ } +++++ +++++- public HookManager getHookManager() { +++++- return hookManager; +++++- } +++++ } +++++Index: CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/listener/JoinListener.java +++++IDEA additional info: +++++Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +++++<+>UTF-8 +++++=================================================================== +++++diff --git a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/listener/JoinListener.java b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/listener/JoinListener.java +++++--- a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/listener/JoinListener.java (revision 60d9051d52d70ed86db8e0fc1a50da61f395e55a) ++++++++ b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/listener/JoinListener.java (revision 5436229cc153c4aec4cd6267d80f1e8301022990) +++++@@ -103,7 +103,7 @@ +++++ } +++++ +++++ if (essentialsXHook.isEnabled()) { +++++- if (Settings.hook_essentials_hideplayervanish) { ++++++ if (Settings.hook_essentials_hidePlayerVanish) { +++++ if (essentialsXHook.isVanish(p)) { +++++ e.setJoinMessage(null); +++++ return; +++++@@ -115,11 +115,10 @@ +++++ if (isNormal) { +++++ e.setJoinMessage(null); +++++ ++++++ String text; +++++ String join = Settings.join_message; +++++ String firstjoin = Settings.join_message_first; +++++ +++++- String text; +++++- +++++ if (Settings.firstjoin) { +++++ if (!p.hasPlayedBefore()) { +++++ text = firstjoin; +++++@@ -130,161 +129,106 @@ +++++ text = join; +++++ } +++++ +++++- boolean isNormalType = Settings.join_type.equalsIgnoreCase("normal"); +++++- boolean isModifyType = Settings.join_type.equalsIgnoreCase("modify"); +++++- +++++ text = Util.color(Util.getVar(p, text)); +++++- +++++ MessageBuilder messageBuilder = new MessageBuilder(p, text); +++++ +++++- //Update Logger +++++ if (config.getBoolean("Config.Show-Chat-In-Console")) { +++++ Logger.info(messageBuilder.getText()); +++++ } +++++ +++++- if (isNormalType) { +++++- e.setJoinMessage(text); +++++- if (discordSRVHHook.isEnabled()) { +++++- +++++- if (Settings.hook_discordsrv_channelid.equalsIgnoreCase("none")) +++++- return; +++++- +++++- DiscordUtil.sendMessageBlocking( +++++- DiscordUtil.getTextChannelById(Settings.hook_discordsrv_channelid), +++++- Util.colorless(messageBuilder.getText())); +++++- } +++++- +++++- if (essentialsXDiscordHook.isEnabled()) { +++++- if (Settings.hook_essentialsDiscord_channelid.equalsIgnoreCase("none")) +++++- return; +++++- +++++- essentialsXDiscordHook.sendJoinMessage(Settings.hook_essentialsDiscord_channelid, +++++- Util.colorless(messageBuilder.getText())); +++++- } +++++- +++++- //Removed IsModifyType in 1.8.0 +++++- } else if (isModifyType) { +++++- boolean isHover = Objects.equals(config.getString("Join.HoverEvent.Enabled"), "true"); +++++- boolean isClick = Objects.equals(config.getString("Join.ClickEvent.Enabled"), "true"); +++++- boolean isTitle = Objects.equals(config.getString("Join.Title.Enabled"), "true"); +++++- boolean isSound = Objects.equals(config.getString("Join.Sound.Enabled"), "true"); +++++- boolean isActionBar = Objects.equals(config.getString("Join.ActionBar.Enabled"), "true"); +++++- boolean isSoundAll = Objects.equals(config.getString("Join.Sound.Send-To-All"), "true"); ++++++ boolean isHover = config.getBoolean("Join.HoverEvent.Enabled"); ++++++ boolean isClick = config.getBoolean("Join.ClickEvent.Enabled"); ++++++ boolean isTitle = config.getBoolean("Join.Title.Enabled"); ++++++ boolean isSound = config.getBoolean("Join.Sound.Enabled"); ++++++ boolean isActionBar = config.getBoolean("Join.ActionBar.Enabled"); ++++++ boolean isSoundAll = config.getBoolean("Join.Sound.Send-To-All"); +++++ +++++- List Hover_Text = config.getStringList("Join.HoverEvent.Hover"); ++++++ List Hover_Text = config.getStringList("Join.HoverEvent.Hover"); +++++ +++++- String isClick_Mode = config.getString("Join.ClickEvent.Mode"); +++++- String Action_Command = config.getString("Join.ClickEvent.Actions.Command"); +++++- String Action_Url = config.getString("Join.ClickEvent.Actions.Url"); +++++- String Action_Suggest = config.getString("Join.ClickEvent.Actions.Suggest-Command"); +++++- +++++- //List Action_Dev = config.getStringList("Join.ClickEvent.DevActions"); +++++- +++++- String Title_Text = config.getString("Join.Title.Title"); +++++- String SubTitle_Text = config.getString("Join.Title.SubTitle"); +++++- String Actionbar_Text = config.getString("Join.ActionBar.Text"); +++++- String Sound_Name = config.getString("Join.Sound.Name"); ++++++ String isClick_Mode = config.getString("Join.ClickEvent.Mode"); ++++++ String Action_Command = config.getString("Join.ClickEvent.Actions.Command"); ++++++ String Action_Url = config.getString("Join.ClickEvent.Actions.Url"); ++++++ String Action_Suggest = config.getString("Join.ClickEvent.Actions.Suggest-Command"); ++++++ String Title_Text = config.getString("Join.Title.Title"); ++++++ String SubTitle_Text = config.getString("Join.Title.SubTitle"); ++++++ String Actionbar_Text = config.getString("Join.ActionBar.Text"); ++++++ String Sound_Name = config.getString("Join.Sound.Name"); +++++ +++++- int FadeIn = config.getInt("Join.Title.FadeIn"); +++++- int Stay = config.getInt("Join.Title.Stay"); +++++- int FadeOut = config.getInt("Join.Title.FadeOut"); +++++- int Sound_Volume = config.getInt("Join.Sound.Volume"); ++++++ int FadeIn = config.getInt("Join.Title.FadeIn"); ++++++ int Stay = config.getInt("Join.Title.Stay"); ++++++ int FadeOut = config.getInt("Join.Title.FadeOut"); ++++++ int Sound_Volume = config.getInt("Join.Sound.Volume"); +++++ +++++- float Sound_Pitch = Float.parseFloat(Objects.requireNonNull(config.getString("Join.Sound.Pitch"))); ++++++ float Sound_Pitch = Float.parseFloat(Objects.requireNonNull(config.getString("Join.Sound.Pitch"))); +++++ +++++- if (isHover) { +++++- if (isClick) { +++++- assert isClick_Mode != null; +++++- if (isClick_Mode.equalsIgnoreCase("command")) { +++++- messageBuilder.setHover(Hover_Text).setExecuteCommand(Action_Command).sendToAll(); +++++- } else if (isClick_Mode.equalsIgnoreCase("url")) { +++++- messageBuilder.setHover(Hover_Text).setOpenURL(Action_Url).sendToAll(); +++++- } else if (isClick_Mode.equalsIgnoreCase("suggest")) { +++++- messageBuilder.setHover(Hover_Text).setSuggestCommand(Action_Suggest).sendToAll(); +++++- } +++++- } else { +++++- messageBuilder.setHover(Hover_Text).sendToAll(); +++++- } +++++- } else { ++++++ if (isHover) { ++++++ if (isClick) { ++++++ assert isClick_Mode != null; ++++++ if (isClick_Mode.equalsIgnoreCase("command")) { ++++++ messageBuilder.setHover(Hover_Text).setExecuteCommand(Action_Command).sendToAll(); ++++++ } else if (isClick_Mode.equalsIgnoreCase("url")) { ++++++ messageBuilder.setHover(Hover_Text).setOpenURL(Action_Url).sendToAll(); ++++++ } else if (isClick_Mode.equalsIgnoreCase("suggest")) { ++++++ messageBuilder.setHover(Hover_Text).setSuggestCommand(Action_Suggest).sendToAll(); ++++++ } ++++++ } else { ++++++ messageBuilder.setHover(Hover_Text).sendToAll(); ++++++ } ++++++ } else { +++++ +++++- if (isClick) { +++++- +++++- /*for(String action : Action_Dev){ +++++- +++++- String[] parts = action.split(":"); +++++- String type = parts[0].trim(); +++++- String value = parts[1].trim(); +++++- +++++- switch (type){ +++++- case "[Execute]": +++++- messageBuilder.setExecuteCommand(value); +++++- break; +++++- case "[Suggest]": +++++- messageBuilder.setSuggestCommand(value); +++++- break; +++++- case "[Open]": +++++- messageBuilder.setOpenURL(value); +++++- break; +++++- default: +++++- messageBuilder.sendToAll(); +++++- break; +++++- } +++++- } +++++- messageBuilder.sendToAll();*/ +++++- +++++- assert isClick_Mode != null; +++++- if (isClick_Mode.equalsIgnoreCase("command")) { +++++- messageBuilder.setExecuteCommand(Action_Command).sendToAll(); +++++- } else if (isClick_Mode.equalsIgnoreCase("url")) { +++++- messageBuilder.setOpenURL(Action_Url).sendToAll(); +++++- } else if (isClick_Mode.equalsIgnoreCase("suggest")) { +++++- messageBuilder.setSuggestCommand(Action_Suggest).sendToAll(); +++++- } +++++- +++++- +++++- } else { +++++- messageBuilder.sendToAll(); +++++- } +++++- } ++++++ if (isClick) { ++++++ assert isClick_Mode != null; ++++++ if (isClick_Mode.equalsIgnoreCase("command")) { ++++++ messageBuilder.setExecuteCommand(Action_Command).sendToAll(); ++++++ } else if (isClick_Mode.equalsIgnoreCase("url")) { ++++++ messageBuilder.setOpenURL(Action_Url).sendToAll(); ++++++ } else if (isClick_Mode.equalsIgnoreCase("suggest")) { ++++++ messageBuilder.setSuggestCommand(Action_Suggest).sendToAll(); ++++++ } ++++++ } else { ++++++ messageBuilder.sendToAll(); ++++++ } ++++++ } +++++ +++++- if (discordSRVHHook.isEnabled()) { +++++- DiscordUtil.sendMessageBlocking( +++++- DiscordUtil.getTextChannelById(Settings.hook_discordsrv_channelid), +++++- Util.colorless(messageBuilder.getText())); +++++- } ++++++ if (discordSRVHHook.isEnabled()) { ++++++ DiscordUtil.sendMessageBlocking( ++++++ DiscordUtil.getTextChannelById(Settings.hook_discordSrv_channelId), ++++++ Util.colorless(messageBuilder.getText())); ++++++ } +++++ +++++- if (isTitle) { +++++- Titles.sendTitle(p, FadeIn, Stay, FadeOut, Util.color(Util.getVar(p, Title_Text)), +++++- Util.color(Util.getVar(p, SubTitle_Text))); +++++- } ++++++ if (isTitle) { ++++++ Titles.sendTitle(p, FadeIn, Stay, FadeOut, Util.color(Util.getVar(p, Title_Text)), ++++++ Util.color(Util.getVar(p, SubTitle_Text))); ++++++ } +++++ +++++- if (isActionBar) { +++++- ActionBar.sendActionBar(p, Util.color(Util.getVar(p, Actionbar_Text))); +++++- } ++++++ if (isActionBar) { ++++++ ActionBar.sendActionBar(p, Util.color(Util.getVar(p, Actionbar_Text))); ++++++ } +++++ +++++- try { +++++- if (isSound) { +++++- if (isSoundAll) { +++++- Location location = p.getLocation(); +++++- p.playSound(location, Sound.valueOf(Sound_Name), Sound_Volume, Sound_Pitch); +++++- } else { +++++- for (Player pp : Bukkit.getOnlinePlayers()) { +++++- Location location = p.getLocation(); +++++- pp.playSound(location, Sound.valueOf(Sound_Name), Sound_Volume, Sound_Pitch); +++++- } +++++- } +++++- } +++++- } catch (Exception ex) { +++++- Logger.warning("&eVerify that the sound name is correct or belongs to the version"); +++++- } ++++++ try { ++++++ if (isSound) { ++++++ if (isSoundAll) { ++++++ Location location = p.getLocation(); ++++++ p.playSound(location, Sound.valueOf(Sound_Name), Sound_Volume, Sound_Pitch); ++++++ } else { ++++++ for (Player pp : Bukkit.getOnlinePlayers()) { ++++++ Location location = p.getLocation(); ++++++ pp.playSound(location, Sound.valueOf(Sound_Name), Sound_Volume, Sound_Pitch); ++++++ } ++++++ } ++++++ } ++++++ } catch (Exception ex) { ++++++ Logger.warning("&eVerify that the sound name is correct or belongs to the version"); +++++ } ++++++ ++++++ +++++ } else if (isGroup) { +++++ e.setJoinMessage(null); +++++ GroupHelper groupHelper = new GroupHelper(); +++++ groupHelper.setGroup(playerManager.getGroup(p)); +++++ groupHelper.setDiscord(discordSRVHHook); +++++ groupHelper.setEssentials(essentialsXDiscordHook); +++++- groupHelper.onJoin(p, config, e); ++++++ groupHelper.onJoin(p, config); +++++ } else if (isNone) { +++++ e.setJoinMessage(null); +++++ } +++++@@ -295,7 +239,7 @@ +++++ public void onUpdate(@NotNull PlayerJoinEvent e) { +++++ Player p = e.getPlayer(); +++++ if (Settings.update) { +++++- if ((p.isOp()) || (p.hasPermission("Cjm.Update.Notify"))) { ++++++ if ((p.isOp()) || (p.hasPermission("cjm.update"))) { +++++ new UpdateChecker(CustomJoinAndQuitMessages.get()).sendSpigotUpdate(); +++++ } +++++ } +++++@@ -329,7 +273,7 @@ +++++ } +++++ +++++ if (essentialsXHook.isEnabled()) { +++++- if (Settings.hook_essentials_hideplayervanish) { ++++++ if (Settings.hook_essentials_hidePlayerVanish) { +++++ if (essentialsXHook.isVanish(p)) { +++++ e.setQuitMessage(null); +++++ return; +++++@@ -341,9 +285,6 @@ +++++ if (isNormal) { +++++ e.setQuitMessage(null); +++++ +++++- boolean isNormalType = Objects.requireNonNull(config.getString("Quit.Type")).equalsIgnoreCase("normal"); +++++- boolean isModifyType = Objects.requireNonNull(config.getString("Quit.Type")).equalsIgnoreCase("modify"); +++++- +++++ String text = config.getString("Quit.Text"); +++++ +++++ text = Util.color(text); +++++@@ -355,102 +296,81 @@ +++++ Logger.info(messageBuilder.getText()); +++++ } +++++ +++++- if (isNormalType) { +++++- e.setQuitMessage(text); +++++- if (discordSRVHHook.isEnabled()) { +++++- if (Settings.hook_discordsrv_channelid.equalsIgnoreCase("none")) +++++- return; +++++- DiscordUtil.sendMessageBlocking( +++++- DiscordUtil.getTextChannelById(Settings.hook_discordsrv_channelid), +++++- Util.colorless(messageBuilder.getText())); +++++- } +++++- +++++- if (essentialsXDiscordHook.isEnabled()) { +++++- if (Settings.hook_essentialsDiscord_channelid.equalsIgnoreCase("none")) +++++- return; +++++- essentialsXDiscordHook.sendQuitMessage(Settings.hook_essentialsDiscord_channelid, +++++- Util.colorless(messageBuilder.getText())); +++++- } +++++- } else if (isModifyType) { +++++- +++++- boolean isHover = Objects.equals(config.getString("Quit.HoverEvent.Enabled"), "true"); +++++- boolean isClick = Objects.equals(config.getString("Quit.ClickEvent.Enabled"), "true"); +++++- boolean isSound = Objects.equals(config.getString("Quit.Sound.Enabled"), "true"); +++++- boolean isSoundAll = Objects.equals(config.getString("Quit.Sound.Send-To-All"), "true"); ++++++ boolean isHover = config.getBoolean("Quit.HoverEvent.Enabled"); ++++++ boolean isClick = config.getBoolean("Quit.ClickEvent.Enabled"); ++++++ boolean isSound = config.getBoolean("Quit.Sound.Enabled"); ++++++ boolean isSoundAll = config.getBoolean("Quit.Sound.Send-To-All"); +++++ +++++- List Hover_Text = config.getStringList("Quit.HoverEvent.Hover"); ++++++ List Hover_Text = config.getStringList("Quit.HoverEvent.Hover"); +++++ +++++- String isClick_Mode = config.getString("Quit.ClickEvent.Mode"); +++++- String Action_Command = config.getString("Quit.ClickEvent.Actions.Command"); +++++- String Action_Url = config.getString("Quit.ClickEvent.Actions.Url"); +++++- String Action_Suggest = config.getString("Quit.ClickEvent.Actions.Suggest-Command"); +++++- String Sound_Name = config.getString("Quit.Sound.Name"); ++++++ String isClick_Mode = config.getString("Quit.ClickEvent.Mode"); ++++++ String Action_Command = config.getString("Quit.ClickEvent.Actions.Command"); ++++++ String Action_Url = config.getString("Quit.ClickEvent.Actions.Url"); ++++++ String Action_Suggest = config.getString("Quit.ClickEvent.Actions.Suggest-Command"); ++++++ String Sound_Name = config.getString("Quit.Sound.Name"); +++++ +++++- int Sound_Volume = config.getInt("Quit.Sound.Volume"); +++++- float Sound_Pitch = Float.parseFloat(Objects.requireNonNull(config.getString("Quit.Sound.Pitch"))); ++++++ int Sound_Volume = config.getInt("Quit.Sound.Volume"); ++++++ float Sound_Pitch = Float.parseFloat(Objects.requireNonNull(config.getString("Quit.Sound.Pitch"))); +++++ +++++- if (isHover) { +++++- if (isClick) { +++++- assert isClick_Mode != null; +++++- if (isClick_Mode.equalsIgnoreCase("command")) { +++++- messageBuilder.setHover(Hover_Text).setExecuteCommand(Action_Command).sendToAll(); +++++- } else if (isClick_Mode.equalsIgnoreCase("url")) { +++++- messageBuilder.setHover(Hover_Text).setOpenURL(Action_Url).sendToAll(); +++++- } else if (isClick_Mode.equalsIgnoreCase("suggest")) { +++++- messageBuilder.setHover(Hover_Text).setSuggestCommand(Action_Suggest).sendToAll(); +++++- } +++++- } else { +++++- messageBuilder.setHover(Hover_Text).sendToAll(); +++++- } +++++- } else { +++++- if (isClick) { +++++- assert isClick_Mode != null; +++++- if (isClick_Mode.equalsIgnoreCase("command")) { +++++- messageBuilder.setExecuteCommand(Action_Command).sendToAll(); +++++- } else if (isClick_Mode.equalsIgnoreCase("url")) { +++++- messageBuilder.setOpenURL(Action_Url).sendToAll(); +++++- } else if (isClick_Mode.equalsIgnoreCase("suggest")) { +++++- messageBuilder.setSuggestCommand(Action_Suggest).sendToAll(); +++++- } +++++- } else { +++++- messageBuilder.sendToAll(); +++++- } +++++- } ++++++ if (isHover) { ++++++ if (isClick) { ++++++ assert isClick_Mode != null; ++++++ if (isClick_Mode.equalsIgnoreCase("command")) { ++++++ messageBuilder.setHover(Hover_Text).setExecuteCommand(Action_Command).sendToAll(); ++++++ } else if (isClick_Mode.equalsIgnoreCase("url")) { ++++++ messageBuilder.setHover(Hover_Text).setOpenURL(Action_Url).sendToAll(); ++++++ } else if (isClick_Mode.equalsIgnoreCase("suggest")) { ++++++ messageBuilder.setHover(Hover_Text).setSuggestCommand(Action_Suggest).sendToAll(); ++++++ } ++++++ } else { ++++++ messageBuilder.setHover(Hover_Text).sendToAll(); ++++++ } ++++++ } else { ++++++ if (isClick) { ++++++ assert isClick_Mode != null; ++++++ if (isClick_Mode.equalsIgnoreCase("command")) { ++++++ messageBuilder.setExecuteCommand(Action_Command).sendToAll(); ++++++ } else if (isClick_Mode.equalsIgnoreCase("url")) { ++++++ messageBuilder.setOpenURL(Action_Url).sendToAll(); ++++++ } else if (isClick_Mode.equalsIgnoreCase("suggest")) { ++++++ messageBuilder.setSuggestCommand(Action_Suggest).sendToAll(); ++++++ } ++++++ } else { ++++++ messageBuilder.sendToAll(); ++++++ } ++++++ } +++++ +++++- if (discordSRVHHook.isEnabled()) { +++++- +++++- if (Settings.hook_discordsrv_channelid.equalsIgnoreCase("none")) +++++- return; ++++++ if (discordSRVHHook.isEnabled()) { ++++++ if (Settings.hook_discordSrv_channelId.equalsIgnoreCase("none")) ++++++ return; +++++ +++++- DiscordUtil.sendMessageBlocking( +++++- DiscordUtil.getTextChannelById(Settings.hook_discordsrv_channelid), +++++- Util.colorless(messageBuilder.getText())); +++++- } ++++++ DiscordUtil.sendMessageBlocking( ++++++ DiscordUtil.getTextChannelById(Settings.hook_discordSrv_channelId), ++++++ Util.colorless(messageBuilder.getText())); ++++++ } +++++ +++++- if (essentialsXDiscordHook.isEnabled()) { +++++- +++++- if (Settings.hook_essentialsDiscord_channelid.equalsIgnoreCase("none")) +++++- return; ++++++ if (essentialsXDiscordHook.isEnabled()) { ++++++ if (Settings.hook_essentialsDiscord_channelId.equalsIgnoreCase("none")) ++++++ return; +++++ +++++- essentialsXDiscordHook.sendQuitMessage(Settings.hook_essentialsDiscord_channelid, +++++- Util.colorless(messageBuilder.getText())); +++++- } ++++++ essentialsXDiscordHook.sendQuitMessage(Settings.hook_essentialsDiscord_channelId, ++++++ Util.colorless(messageBuilder.getText())); ++++++ } +++++ +++++- try { +++++- if (isSound) { +++++- if (isSoundAll) { +++++- Location location = p.getLocation(); +++++- p.playSound(location, Sound.valueOf(Sound_Name), Sound_Volume, Sound_Pitch); +++++- } else { +++++- for (Player pp : Bukkit.getOnlinePlayers()) { +++++- Location location = p.getLocation(); +++++- pp.playSound(location, Sound.valueOf(Sound_Name), Sound_Volume, Sound_Pitch); +++++- } +++++- } +++++- } +++++- } catch (Exception ex) { +++++- Logger.warning("&eVerify that the sound name is correct or belongs to the version"); +++++- } ++++++ try { ++++++ if (isSound) { ++++++ if (isSoundAll) { ++++++ Location location = p.getLocation(); ++++++ p.playSound(location, Sound.valueOf(Sound_Name), Sound_Volume, Sound_Pitch); ++++++ } else { ++++++ for (Player pp : Bukkit.getOnlinePlayers()) { ++++++ Location location = p.getLocation(); ++++++ pp.playSound(location, Sound.valueOf(Sound_Name), Sound_Volume, Sound_Pitch); ++++++ } ++++++ } ++++++ } ++++++ } catch (Exception ex) { ++++++ Logger.warning("&eVerify that the sound name is correct or belongs to the version"); +++++ } +++++ } else if (isGroup) { +++++ e.setQuitMessage(null); +++++@@ -458,13 +378,11 @@ +++++ groupHelper.setGroup(playerManager.getGroup(p)); +++++ groupHelper.setDiscord(discordSRVHHook); +++++ groupHelper.setEssentials(essentialsXDiscordHook); +++++- groupHelper.onQuit(p, config, e); ++++++ groupHelper.onQuit(p, config); +++++ } else if (isNone) { +++++ e.setQuitMessage(null); +++++ } +++++ } +++++ } +++++ +++++- +++++- +++++ } +++++Index: CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/manager/DisplayManager.java +++++IDEA additional info: +++++Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +++++<+>UTF-8 +++++=================================================================== +++++diff --git a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/manager/DisplayManager.java b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/manager/DisplayManager.java +++++--- a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/manager/DisplayManager.java (revision 60d9051d52d70ed86db8e0fc1a50da61f395e55a) ++++++++ b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/manager/DisplayManager.java (revision 5436229cc153c4aec4cd6267d80f1e8301022990) +++++@@ -12,6 +12,7 @@ +++++ +++++ import java.util.List; +++++ ++++++@SuppressWarnings("all") +++++ public class DisplayManager { +++++ +++++ private final FileConfiguration config = CustomJoinAndQuitMessages.get().getConfigFile().getConfig(); +++++@@ -41,8 +42,6 @@ +++++ Logger.warning("&e[showFirstJoinMessage] &b-> &7This feature is disabled and you will not be able to see the preview"); +++++ +++++ String text; +++++- boolean isNormalType; +++++- boolean isModifyType; +++++ boolean isHover; +++++ boolean isClick; +++++ List Hover_Text; +++++@@ -53,8 +52,6 @@ +++++ +++++ if (Settings.is_Group_Display) { +++++ text = groups.getString(group + ".FirstJoin.Text"); +++++- isNormalType = groups.getString(group + ".Type").equalsIgnoreCase("normal"); +++++- isModifyType = groups.getString(group + ".Type").equalsIgnoreCase("modify"); +++++ isHover = groups.getString(group + ".HoverEvent.Enabled").equals("true"); +++++ isClick = groups.getString(group + ".ClickEvent.Enabled").equals("true"); +++++ Hover_Text = groups.getStringList(group + ".HoverEvent.Hover"); +++++@@ -64,8 +61,6 @@ +++++ Action_Suggest = groups.getString(group + ".ClickEvent.Actions.Suggest-Command"); +++++ } else { +++++ text = Settings.join_message_first; +++++- isNormalType = Settings.join_type.equalsIgnoreCase("normal"); +++++- isModifyType = Settings.join_type.equalsIgnoreCase("modify"); +++++ +++++ isHover = config.getString("Join.HoverEvent.Enabled").equals("true"); +++++ isClick = config.getString("Join.ClickEvent.Enabled").equals("true"); +++++@@ -78,34 +73,29 @@ +++++ +++++ MessageBuilder messageBuilder = new MessageBuilder(player, Util.color(Util.getVar(player, text))); +++++ +++++- if (isNormalType) { +++++- messageBuilder.send(); +++++- return; +++++- } else if (isModifyType) { +++++- if (isHover) { +++++- if (isClick) { +++++- if (isClick_Mode.equalsIgnoreCase("command")) { +++++- messageBuilder.setHover(Hover_Text).setExecuteCommand(Action_Command).send(); +++++- } else if (isClick_Mode.equalsIgnoreCase("url")) { +++++- messageBuilder.setHover(Hover_Text).setOpenURL(Action_Url).send(); +++++- } else if (isClick_Mode.equalsIgnoreCase("suggest")) { +++++- messageBuilder.setHover(Hover_Text).setSuggestCommand(Action_Suggest).send(); +++++- } +++++- } else { +++++- messageBuilder.setHover(Hover_Text).send(); +++++- } +++++- } else { +++++- if (isClick) { +++++- if (isClick_Mode.equalsIgnoreCase("command")) { +++++- messageBuilder.setExecuteCommand(Action_Command).send(); +++++- } else if (isClick_Mode.equalsIgnoreCase("url")) { +++++- messageBuilder.setOpenURL(Action_Url).send(); +++++- } else if (isClick_Mode.equalsIgnoreCase("suggest")) { +++++- messageBuilder.setSuggestCommand(Action_Suggest).send(); +++++- } +++++- } else { +++++- messageBuilder.send(); +++++- } ++++++ if (isHover) { ++++++ if (isClick) { ++++++ if (isClick_Mode.equalsIgnoreCase("command")) { ++++++ messageBuilder.setHover(Hover_Text).setExecuteCommand(Action_Command).send(); ++++++ } else if (isClick_Mode.equalsIgnoreCase("url")) { ++++++ messageBuilder.setHover(Hover_Text).setOpenURL(Action_Url).send(); ++++++ } else if (isClick_Mode.equalsIgnoreCase("suggest")) { ++++++ messageBuilder.setHover(Hover_Text).setSuggestCommand(Action_Suggest).send(); ++++++ } ++++++ } else { ++++++ messageBuilder.setHover(Hover_Text).send(); ++++++ } ++++++ } else { ++++++ if (isClick) { ++++++ if (isClick_Mode.equalsIgnoreCase("command")) { ++++++ messageBuilder.setExecuteCommand(Action_Command).send(); ++++++ } else if (isClick_Mode.equalsIgnoreCase("url")) { ++++++ messageBuilder.setOpenURL(Action_Url).send(); ++++++ } else if (isClick_Mode.equalsIgnoreCase("suggest")) { ++++++ messageBuilder.setSuggestCommand(Action_Suggest).send(); ++++++ } ++++++ } else { ++++++ messageBuilder.send(); +++++ } +++++ } +++++ } +++++@@ -127,8 +117,6 @@ +++++ +++++ if (Settings.is_Group_Display) { +++++ text = groups.getString(group + ".Join-Text"); +++++- isNormalType = groups.getString(group + ".Type").equalsIgnoreCase("normal"); +++++- isModifyType = groups.getString(group + ".Type").equalsIgnoreCase("modify"); +++++ +++++ isHover = groups.getString(group + ".HoverEvent.Enabled").equals("true"); +++++ isClick = groups.getString(group + ".ClickEvent.Enabled").equals("true"); +++++@@ -141,8 +129,6 @@ +++++ Action_Suggest = groups.getString(group + ".ClickEvent.Actions.Suggest-Command"); +++++ } else { +++++ text = Settings.join_message; +++++- isNormalType = Settings.join_type.equalsIgnoreCase("normal"); +++++- isModifyType = Settings.join_type.equalsIgnoreCase("modify"); +++++ +++++ isHover = config.getString("Join.HoverEvent.Enabled").equals("true"); +++++ isClick = config.getString("Join.ClickEvent.Enabled").equals("true"); +++++@@ -157,34 +143,29 @@ +++++ +++++ MessageBuilder messageBuilder = new MessageBuilder(player, Util.color(Util.getVar(player, text))); +++++ +++++- if (isNormalType) { +++++- messageBuilder.send(); +++++- return; +++++- } else if (isModifyType) { +++++- if (isHover) { +++++- if (isClick) { +++++- if (isClick_Mode.equalsIgnoreCase("command")) { +++++- messageBuilder.setHover(Hover_Text).setExecuteCommand(Action_Command).send(); +++++- } else if (isClick_Mode.equalsIgnoreCase("url")) { +++++- messageBuilder.setHover(Hover_Text).setOpenURL(Action_Url).send(); +++++- } else if (isClick_Mode.equalsIgnoreCase("suggest")) { +++++- messageBuilder.setHover(Hover_Text).setSuggestCommand(Action_Suggest).send(); +++++- } +++++- } else { +++++- messageBuilder.setHover(Hover_Text).send(); +++++- } +++++- } else { +++++- if (isClick) { +++++- if (isClick_Mode.equalsIgnoreCase("command")) { +++++- messageBuilder.setExecuteCommand(Action_Command).send(); +++++- } else if (isClick_Mode.equalsIgnoreCase("url")) { +++++- messageBuilder.setOpenURL(Action_Url).send(); +++++- } else if (isClick_Mode.equalsIgnoreCase("suggest")) { +++++- messageBuilder.setSuggestCommand(Action_Suggest).send(); +++++- } +++++- } else { +++++- messageBuilder.send(); +++++- } ++++++ if (isHover) { ++++++ if (isClick) { ++++++ if (isClick_Mode.equalsIgnoreCase("command")) { ++++++ messageBuilder.setHover(Hover_Text).setExecuteCommand(Action_Command).send(); ++++++ } else if (isClick_Mode.equalsIgnoreCase("url")) { ++++++ messageBuilder.setHover(Hover_Text).setOpenURL(Action_Url).send(); ++++++ } else if (isClick_Mode.equalsIgnoreCase("suggest")) { ++++++ messageBuilder.setHover(Hover_Text).setSuggestCommand(Action_Suggest).send(); ++++++ } ++++++ } else { ++++++ messageBuilder.setHover(Hover_Text).send(); ++++++ } ++++++ } else { ++++++ if (isClick) { ++++++ if (isClick_Mode.equalsIgnoreCase("command")) { ++++++ messageBuilder.setExecuteCommand(Action_Command).send(); ++++++ } else if (isClick_Mode.equalsIgnoreCase("url")) { ++++++ messageBuilder.setOpenURL(Action_Url).send(); ++++++ } else if (isClick_Mode.equalsIgnoreCase("suggest")) { ++++++ messageBuilder.setSuggestCommand(Action_Suggest).send(); ++++++ } ++++++ } else { ++++++ messageBuilder.send(); +++++ } +++++ } +++++ } +++++@@ -220,8 +201,6 @@ +++++ Action_Suggest = groups.getString(group + ".ClickEvent.Actions.Suggest-Command"); +++++ } else { +++++ text = Settings.quit_message; +++++- isNormalType = Settings.quit_type.equalsIgnoreCase("normal"); +++++- isModifyType = Settings.quit_type.equalsIgnoreCase("modify"); +++++ +++++ isHover = config.getString("Quit.HoverEvent.Enabled").equals("true"); +++++ isClick = config.getString("Quit.ClickEvent.Enabled").equals("true"); +++++@@ -236,36 +215,32 @@ +++++ +++++ MessageBuilder messageBuilder = new MessageBuilder(player, Util.color(Util.getVar(player, text))); +++++ +++++- if (isNormalType) { +++++- messageBuilder.send(); +++++- return; +++++- } else if (isModifyType) { +++++- if (isHover) { +++++- if (isClick) { +++++- if (isClick_Mode.equalsIgnoreCase("command")) { +++++- messageBuilder.setHover(Hover_Text).setExecuteCommand(Action_Command).send(); +++++- } else if (isClick_Mode.equalsIgnoreCase("url")) { +++++- messageBuilder.setHover(Hover_Text).setOpenURL(Action_Url).send(); +++++- } else if (isClick_Mode.equalsIgnoreCase("suggest")) { +++++- messageBuilder.setHover(Hover_Text).setSuggestCommand(Action_Suggest).send(); +++++- } +++++- } else { +++++- messageBuilder.setHover(Hover_Text).send(); +++++- } +++++- } else { +++++- if (isClick) { +++++- if (isClick_Mode.equalsIgnoreCase("command")) { +++++- messageBuilder.setExecuteCommand(Action_Command).send(); +++++- } else if (isClick_Mode.equalsIgnoreCase("url")) { +++++- messageBuilder.setOpenURL(Action_Url).send(); +++++- } else if (isClick_Mode.equalsIgnoreCase("suggest")) { +++++- messageBuilder.setSuggestCommand(Action_Suggest).send(); +++++- } +++++- } else { +++++- messageBuilder.send(); +++++- } ++++++ if (isHover) { ++++++ if (isClick) { ++++++ if (isClick_Mode.equalsIgnoreCase("command")) { ++++++ messageBuilder.setHover(Hover_Text).setExecuteCommand(Action_Command).send(); ++++++ } else if (isClick_Mode.equalsIgnoreCase("url")) { ++++++ messageBuilder.setHover(Hover_Text).setOpenURL(Action_Url).send(); ++++++ } else if (isClick_Mode.equalsIgnoreCase("suggest")) { ++++++ messageBuilder.setHover(Hover_Text).setSuggestCommand(Action_Suggest).send(); ++++++ } ++++++ } else { ++++++ messageBuilder.setHover(Hover_Text).send(); ++++++ } ++++++ } else { ++++++ if (isClick) { ++++++ if (isClick_Mode.equalsIgnoreCase("command")) { ++++++ messageBuilder.setExecuteCommand(Action_Command).send(); ++++++ } else if (isClick_Mode.equalsIgnoreCase("url")) { ++++++ messageBuilder.setOpenURL(Action_Url).send(); ++++++ } else if (isClick_Mode.equalsIgnoreCase("suggest")) { ++++++ messageBuilder.setSuggestCommand(Action_Suggest).send(); ++++++ } ++++++ } else { ++++++ messageBuilder.send(); +++++ } +++++ } ++++++ +++++ } +++++ +++++ public void showWelcomeMessage() { +++++@@ -281,7 +256,7 @@ +++++ if (!Settings.join_title) +++++ Logger.warning("&e[showTitleMessage] &b-> &7This feature is disabled and you will not be able to see the preview"); +++++ +++++- Titles.sendTitle(player, Settings.join_title_fadein, Settings.join_title_stay, Settings.join_title_fadeout, Settings.join_message_title_title, Settings.join_message_title_subtitle); ++++++ Titles.sendTitle(player, Settings.join_title_fadeIn, Settings.join_title_stay, Settings.join_title_fadeOut, Settings.join_message_title_title, Settings.join_message_title_subtitle); +++++ } +++++ +++++ public void showActionbar() { +++++Index: CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/manager/HookManager.java +++++IDEA additional info: +++++Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +++++<+>UTF-8 +++++=================================================================== +++++diff --git a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/manager/HookManager.java b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/manager/HookManager.java +++++--- a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/manager/HookManager.java (revision 60d9051d52d70ed86db8e0fc1a50da61f395e55a) ++++++++ b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/manager/HookManager.java (revision 5436229cc153c4aec4cd6267d80f1e8301022990) +++++@@ -7,8 +7,8 @@ +++++ public class HookManager { +++++ +++++ private static HookManager instance; +++++- private final DiscordSRVHHook discordSRVHHook = new DiscordSRVHHook(this); +++++- private final EssentialsXDiscordHook essentialsXDiscordHook = new EssentialsXDiscordHook(this); ++++++ private final DiscordSRVHHook discordSRVHHook = new DiscordSRVHHook(); ++++++ private final EssentialsXDiscordHook essentialsXDiscordHook = new EssentialsXDiscordHook(); +++++ private final EssentialsXHook essentialsXHook = new EssentialsXHook(this); +++++ private final LuckPermsHook luckPermsHook = new LuckPermsHook(); +++++ private final SuperVanishHook superVanishHook = new SuperVanishHook(); +++++Index: CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/update/UpdateChecker.java +++++IDEA additional info: +++++Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +++++<+>UTF-8 +++++=================================================================== +++++diff --git a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/update/UpdateChecker.java b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/update/UpdateChecker.java +++++--- a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/update/UpdateChecker.java (revision 60d9051d52d70ed86db8e0fc1a50da61f395e55a) ++++++++ b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/update/UpdateChecker.java (revision 5436229cc153c4aec4cd6267d80f1e8301022990) +++++@@ -22,6 +22,7 @@ +++++ this.plugin = plugin; +++++ } +++++ ++++++ @SuppressWarnings("unused") +++++ public void sendGithubUpdate(){ +++++ getVersion("github" ,version -> { +++++ if (plugin.getDescription().getVersion().equalsIgnoreCase(version)) { +++++@@ -60,7 +61,6 @@ +++++ break; +++++ case "github": +++++ url = UpdateSettings.API_UPDATE[1]; +++++- +++++ break; +++++ default: +++++ Logger.error("Invalid source for update check: " + source); +++++@@ -76,7 +76,7 @@ +++++ String latestRelease = scanner.next(); +++++ Gson gson = new Gson(); +++++ JsonObject json= gson.fromJson(latestRelease, JsonObject.class); +++++- String versionName = json.get("name").getAsString(); ++++++ String versionName = json.get("tag_name").getAsString(); +++++ +++++ if(versionName.contains("Beta")){ +++++ Logger.info("The latest release is a beta version: " + versionName); +++++@@ -88,10 +88,7 @@ +++++ }else{ +++++ consumer.accept(scanner.next()); +++++ } +++++- +++++- +++++ } +++++- +++++ } catch (IOException e) { +++++ Logger.error("Could not check for updates: &c" + e.getMessage()); +++++ } +++++Index: CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/utils/GroupHelper.java +++++IDEA additional info: +++++Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +++++<+>UTF-8 +++++=================================================================== +++++diff --git a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/utils/GroupHelper.java b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/utils/GroupHelper.java +++++--- a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/utils/GroupHelper.java (revision 60d9051d52d70ed86db8e0fc1a50da61f395e55a) ++++++++ b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/utils/GroupHelper.java (revision 5436229cc153c4aec4cd6267d80f1e8301022990) +++++@@ -12,8 +12,6 @@ +++++ import org.bukkit.Sound; +++++ import org.bukkit.configuration.file.FileConfiguration; +++++ import org.bukkit.entity.Player; +++++-import org.bukkit.event.player.PlayerJoinEvent; +++++-import org.bukkit.event.player.PlayerQuitEvent; +++++ import org.jetbrains.annotations.Contract; +++++ import org.jetbrains.annotations.NotNull; +++++ +++++@@ -43,7 +41,7 @@ +++++ this.essentialsXDiscordHook = essentialsXDiscordHook; +++++ } +++++ +++++- public void onJoin(Player player, FileConfiguration config, PlayerJoinEvent playerJoinEvent) { ++++++ public void onJoin(Player player, FileConfiguration config) { +++++ String temp = ""; +++++ +++++ String join = groupManager.getJoin(group); +++++@@ -59,126 +57,97 @@ +++++ +++++ temp = Util.color(Util.getVar(player, temp)); +++++ +++++- boolean isNormalType = groupManager.getType(group).equalsIgnoreCase("normal"); +++++- boolean isModifyType = groupManager.getType(group).equalsIgnoreCase("modify"); +++++- +++++ MessageBuilder messageBuilder = new MessageBuilder(player, temp); +++++ +++++ if (config.getBoolean("Config.Show-Chat-In-Console")) { +++++ Logger.info(messageBuilder.getText()); +++++ } +++++ +++++- if (isNormalType) { +++++- playerJoinEvent.setJoinMessage(temp); +++++- if (discordSRVHHook.isEnabled()) { +++++- +++++- if (Settings.hook_discordsrv_channelid.equalsIgnoreCase("none")) +++++- return; +++++- +++++- DiscordUtil.sendMessageBlocking( +++++- DiscordUtil.getTextChannelById(Settings.hook_discordsrv_channelid), +++++- Util.colorless(messageBuilder.getText())); +++++- } +++++- +++++- if (essentialsXDiscordHook.isEnabled()) { +++++- if (Settings.hook_essentialsDiscord_channelid.equalsIgnoreCase("none")) +++++- return; +++++- +++++- essentialsXDiscordHook.sendJoinMessage(Settings.hook_essentialsDiscord_channelid, +++++- Util.colorless(messageBuilder.getText())); +++++- } +++++- } else if (isModifyType) { +++++- +++++- boolean isHover = groupManager.isHover(group); +++++- boolean isClick = groupManager.isClick(group); +++++- boolean isTitle = groupManager.isTitle(group); +++++- boolean isSound = groupManager.isSound(group); +++++- boolean isActionBar = groupManager.isActionbar(group); +++++- boolean isSoundAll = groupManager.isSoundAll(group); ++++++ boolean isHover = groupManager.isHover(group); ++++++ boolean isClick = groupManager.isClick(group); ++++++ boolean isTitle = groupManager.isTitle(group); ++++++ boolean isSound = groupManager.isSound(group); ++++++ boolean isActionBar = groupManager.isActionbar(group); ++++++ boolean isSoundAll = groupManager.isSoundAll(group); +++++ +++++- List Hover_Text = groupManager.getHover(group); ++++++ List Hover_Text = groupManager.getHover(group); +++++ +++++- String isClick_Mode = groupManager.getClickMode(group); +++++- String Action_Command = groupManager.getClickCommand(group); +++++- String Action_Url = groupManager.getClickUrl(group); +++++- String Action_Suggest = groupManager.getClickSuggestCommand(group); +++++- String Title_Text = groupManager.getTitle(group); +++++- String SubTitle_Text = groupManager.getSubTitle(group); +++++- String Actionbar_Text = groupManager.getActionbar(group); +++++- String Sound_Name = groupManager.getSound(group); ++++++ String isClick_Mode = groupManager.getClickMode(group); ++++++ String Action_Command = groupManager.getClickCommand(group); ++++++ String Action_Url = groupManager.getClickUrl(group); ++++++ String Action_Suggest = groupManager.getClickSuggestCommand(group); ++++++ String Title_Text = groupManager.getTitle(group); ++++++ String SubTitle_Text = groupManager.getSubTitle(group); ++++++ String Actionbar_Text = groupManager.getActionbar(group); ++++++ String Sound_Name = groupManager.getSound(group); +++++ +++++- int FadeIn = groupManager.getFadeIn(group); +++++- int Stay = groupManager.getStay(group); +++++- int FadeOut = groupManager.getFadeOut(group); +++++- int Sound_Volume = groupManager.getVolume(group); +++++- float Sound_Pitch = groupManager.getPitch(group); ++++++ int FadeIn = groupManager.getFadeIn(group); ++++++ int Stay = groupManager.getStay(group); ++++++ int FadeOut = groupManager.getFadeOut(group); ++++++ int Sound_Volume = groupManager.getVolume(group); ++++++ float Sound_Pitch = groupManager.getPitch(group); +++++ +++++- if (isHover) { +++++- if (isClick) { +++++- if (isClick_Mode.equalsIgnoreCase("command")) { +++++- messageBuilder.setHover(Hover_Text).setExecuteCommand(Action_Command).sendToAll(); +++++- } else if (isClick_Mode.equalsIgnoreCase("url")) { +++++- messageBuilder.setHover(Hover_Text).setOpenURL(Action_Url).sendToAll(); +++++- } else if (isClick_Mode.equalsIgnoreCase("suggest")) { +++++- messageBuilder.setHover(Hover_Text).setSuggestCommand(Action_Suggest).sendToAll(); +++++- } +++++- } else { +++++- messageBuilder.setHover(Hover_Text).sendToAll(); +++++- } +++++- } else { +++++- if (isClick) { +++++- if (isClick_Mode.equalsIgnoreCase("command")) { +++++- messageBuilder.setExecuteCommand(Action_Command).sendToAll(); +++++- } else if (isClick_Mode.equalsIgnoreCase("url")) { +++++- messageBuilder.setOpenURL(Action_Url).sendToAll(); +++++- } else if (isClick_Mode.equalsIgnoreCase("suggest")) { +++++- messageBuilder.setSuggestCommand(Action_Suggest).sendToAll(); +++++- } +++++- } else { +++++- messageBuilder.sendToAll(); +++++- } +++++- } ++++++ if (isHover) { ++++++ if (isClick) { ++++++ if (isClick_Mode.equalsIgnoreCase("command")) { ++++++ messageBuilder.setHover(Hover_Text).setExecuteCommand(Action_Command).sendToAll(); ++++++ } else if (isClick_Mode.equalsIgnoreCase("url")) { ++++++ messageBuilder.setHover(Hover_Text).setOpenURL(Action_Url).sendToAll(); ++++++ } else if (isClick_Mode.equalsIgnoreCase("suggest")) { ++++++ messageBuilder.setHover(Hover_Text).setSuggestCommand(Action_Suggest).sendToAll(); ++++++ } ++++++ } else { ++++++ messageBuilder.setHover(Hover_Text).sendToAll(); ++++++ } ++++++ } else { ++++++ if (isClick) { ++++++ if (isClick_Mode.equalsIgnoreCase("command")) { ++++++ messageBuilder.setExecuteCommand(Action_Command).sendToAll(); ++++++ } else if (isClick_Mode.equalsIgnoreCase("url")) { ++++++ messageBuilder.setOpenURL(Action_Url).sendToAll(); ++++++ } else if (isClick_Mode.equalsIgnoreCase("suggest")) { ++++++ messageBuilder.setSuggestCommand(Action_Suggest).sendToAll(); ++++++ } ++++++ } else { ++++++ messageBuilder.sendToAll(); ++++++ } ++++++ } +++++ +++++- if (discordSRVHHook.isEnabled()) { +++++- DiscordUtil.sendMessageBlocking( +++++- DiscordUtil.getTextChannelById(Settings.hook_discordsrv_channelid), +++++- Util.colorless(messageBuilder.getText())); +++++- } ++++++ if (discordSRVHHook.isEnabled()) { ++++++ DiscordUtil.sendMessageBlocking( ++++++ DiscordUtil.getTextChannelById(Settings.hook_discordSrv_channelId), ++++++ Util.colorless(messageBuilder.getText())); ++++++ } +++++ +++++- if (isTitle) { +++++- Titles.sendTitle(player, FadeIn, Stay, FadeOut, Util.color(Util.getVar(player, Title_Text)), +++++- Util.color(Util.getVar(player, SubTitle_Text))); +++++- } ++++++ if (isTitle) { ++++++ Titles.sendTitle(player, FadeIn, Stay, FadeOut, Util.color(Util.getVar(player, Title_Text)), ++++++ Util.color(Util.getVar(player, SubTitle_Text))); ++++++ } +++++ +++++- if (isActionBar) { +++++- ActionBar.sendActionBar(player, Util.color(Util.getVar(player, Actionbar_Text))); +++++- } ++++++ if (isActionBar) { ++++++ ActionBar.sendActionBar(player, Util.color(Util.getVar(player, Actionbar_Text))); ++++++ } +++++ +++++- try { +++++- if (isSound) { +++++- if (isSoundAll) { +++++- Location location = player.getLocation(); +++++- player.playSound(location, Sound.valueOf(Sound_Name), Sound_Volume, Sound_Pitch); +++++- } else { +++++- for (Player pp : Bukkit.getOnlinePlayers()) { +++++- Location location = player.getLocation(); +++++- pp.playSound(location, Sound.valueOf(Sound_Name), Sound_Volume, Sound_Pitch); +++++- } +++++- } +++++- } +++++- } catch (Exception ex) { +++++- Logger.warning("&eVerify that the sound name is correct or belongs to the version"); +++++- } ++++++ try { ++++++ if (isSound) { ++++++ if (isSoundAll) { ++++++ Location location = player.getLocation(); ++++++ player.playSound(location, Sound.valueOf(Sound_Name), Sound_Volume, Sound_Pitch); ++++++ } else { ++++++ for (Player pp : Bukkit.getOnlinePlayers()) { ++++++ Location location = player.getLocation(); ++++++ pp.playSound(location, Sound.valueOf(Sound_Name), Sound_Volume, Sound_Pitch); ++++++ } ++++++ } ++++++ } ++++++ } catch (Exception ex) { ++++++ Logger.warning("&eVerify that the sound name is correct or belongs to the version"); +++++ } +++++ } +++++ +++++- public void onQuit(Player player, @NotNull FileConfiguration config, PlayerQuitEvent playerQuitEvent) { ++++++ public void onQuit(Player player, @NotNull FileConfiguration config) { +++++ String quit = groupManager.getQuit(group); +++++ +++++- +++++- boolean isNormalType = groupManager.getType(group).equalsIgnoreCase("normal"); +++++- boolean isModifyType = groupManager.getType(group).equalsIgnoreCase("modify"); +++++- +++++ quit = Util.color(Util.getVar(player, quit)); +++++ +++++ MessageBuilder messageBuilder = new MessageBuilder(player, quit); +++++@@ -186,102 +155,82 @@ +++++ Logger.info(messageBuilder.getText()); +++++ } +++++ +++++- if (isNormalType) { +++++- playerQuitEvent.setQuitMessage(quit); +++++- if (discordSRVHHook.isEnabled()) { +++++- if (Settings.hook_discordsrv_channelid.equalsIgnoreCase("none")) +++++- return; +++++- DiscordUtil.sendMessageBlocking( +++++- DiscordUtil.getTextChannelById(Settings.hook_discordsrv_channelid), +++++- Util.colorless(messageBuilder.getText())); +++++- } +++++- +++++- if (essentialsXDiscordHook.isEnabled()) { +++++- if (Settings.hook_essentialsDiscord_channelid.equalsIgnoreCase("none")) +++++- return; +++++- essentialsXDiscordHook.sendQuitMessage(Settings.hook_essentialsDiscord_channelid, +++++- Util.colorless(messageBuilder.getText())); +++++- } +++++- } else if (isModifyType) { +++++- +++++- boolean isHover = groupManager.isHover(group); +++++- boolean isClick = groupManager.isClick(group); +++++- boolean isSound = groupManager.isSound(group); +++++- boolean isSoundAll = groupManager.isSoundAll(group); ++++++ boolean isHover = groupManager.isHover(group); ++++++ boolean isClick = groupManager.isClick(group); ++++++ boolean isSound = groupManager.isSound(group); ++++++ boolean isSoundAll = groupManager.isSoundAll(group); +++++ +++++- List Hover_Text = groupManager.getHover(group); ++++++ List Hover_Text = groupManager.getHover(group); +++++ +++++- String isClick_Mode = groupManager.getClickMode(group); +++++- String Action_Command = groupManager.getClickCommand(group); +++++- String Action_Url = groupManager.getClickUrl(group); +++++- String Action_Suggest = groupManager.getClickSuggestCommand(group); +++++- String Sound_Name = groupManager.getSound(group); ++++++ String isClick_Mode = groupManager.getClickMode(group); ++++++ String Action_Command = groupManager.getClickCommand(group); ++++++ String Action_Url = groupManager.getClickUrl(group); ++++++ String Action_Suggest = groupManager.getClickSuggestCommand(group); ++++++ String Sound_Name = groupManager.getSound(group); +++++ +++++- int Sound_Volume = groupManager.getVolume(group); +++++- float Sound_Pitch = groupManager.getPitch(group); ++++++ int Sound_Volume = groupManager.getVolume(group); ++++++ float Sound_Pitch = groupManager.getPitch(group); +++++ +++++- if (isHover) { +++++- if (isClick) { +++++- if (isClick_Mode.equalsIgnoreCase("command")) { +++++- messageBuilder.setHover(Hover_Text).setExecuteCommand(Action_Command).sendToAll(); +++++- } else if (isClick_Mode.equalsIgnoreCase("url")) { +++++- messageBuilder.setHover(Hover_Text).setOpenURL(Action_Url).sendToAll(); +++++- } else if (isClick_Mode.equalsIgnoreCase("suggest")) { +++++- messageBuilder.setHover(Hover_Text).setSuggestCommand(Action_Suggest).sendToAll(); +++++- } +++++- } else { +++++- messageBuilder.setHover(Hover_Text).sendToAll(); +++++- } +++++- } else { +++++- if (isClick) { +++++- if (isClick_Mode.equalsIgnoreCase("command")) { +++++- messageBuilder.setExecuteCommand(Action_Command).sendToAll(); +++++- } else if (isClick_Mode.equalsIgnoreCase("url")) { +++++- messageBuilder.setOpenURL(Action_Url).sendToAll(); +++++- } else if (isClick_Mode.equalsIgnoreCase("suggest")) { +++++- messageBuilder.setSuggestCommand(Action_Suggest).sendToAll(); +++++- } +++++- } else { +++++- messageBuilder.sendToAll(); +++++- } +++++- } ++++++ if (isHover) { ++++++ if (isClick) { ++++++ if (isClick_Mode.equalsIgnoreCase("command")) { ++++++ messageBuilder.setHover(Hover_Text).setExecuteCommand(Action_Command).sendToAll(); ++++++ } else if (isClick_Mode.equalsIgnoreCase("url")) { ++++++ messageBuilder.setHover(Hover_Text).setOpenURL(Action_Url).sendToAll(); ++++++ } else if (isClick_Mode.equalsIgnoreCase("suggest")) { ++++++ messageBuilder.setHover(Hover_Text).setSuggestCommand(Action_Suggest).sendToAll(); ++++++ } ++++++ } else { ++++++ messageBuilder.setHover(Hover_Text).sendToAll(); ++++++ } ++++++ } else { ++++++ if (isClick) { ++++++ if (isClick_Mode.equalsIgnoreCase("command")) { ++++++ messageBuilder.setExecuteCommand(Action_Command).sendToAll(); ++++++ } else if (isClick_Mode.equalsIgnoreCase("url")) { ++++++ messageBuilder.setOpenURL(Action_Url).sendToAll(); ++++++ } else if (isClick_Mode.equalsIgnoreCase("suggest")) { ++++++ messageBuilder.setSuggestCommand(Action_Suggest).sendToAll(); ++++++ } ++++++ } else { ++++++ messageBuilder.sendToAll(); ++++++ } ++++++ } +++++ +++++- if (discordSRVHHook.isEnabled()) { ++++++ if (discordSRVHHook.isEnabled()) { +++++ +++++- if (Settings.hook_discordsrv_channelid.equalsIgnoreCase("none")) +++++- return; ++++++ if (Settings.hook_discordSrv_channelId.equalsIgnoreCase("none")) ++++++ return; +++++ +++++- DiscordUtil.sendMessageBlocking( +++++- DiscordUtil.getTextChannelById(Settings.hook_discordsrv_channelid), +++++- Util.colorless(messageBuilder.getText())); +++++- } ++++++ DiscordUtil.sendMessageBlocking( ++++++ DiscordUtil.getTextChannelById(Settings.hook_discordSrv_channelId), ++++++ Util.colorless(messageBuilder.getText())); ++++++ } +++++ +++++- if (essentialsXDiscordHook.isEnabled()) { ++++++ if (essentialsXDiscordHook.isEnabled()) { +++++ +++++- if (Settings.hook_essentialsDiscord_channelid.equalsIgnoreCase("none")) +++++- return; ++++++ if (Settings.hook_essentialsDiscord_channelId.equalsIgnoreCase("none")) ++++++ return; +++++ +++++- essentialsXDiscordHook.sendQuitMessage(Settings.hook_essentialsDiscord_channelid, +++++- Util.colorless(messageBuilder.getText())); +++++- } ++++++ essentialsXDiscordHook.sendQuitMessage(Settings.hook_essentialsDiscord_channelId, ++++++ Util.colorless(messageBuilder.getText())); ++++++ } +++++ +++++- try { +++++- if (isSound) { +++++- if (isSoundAll) { +++++- Location location = player.getLocation(); +++++- player.playSound(location, Sound.valueOf(Sound_Name), Sound_Volume, Sound_Pitch); +++++- } else { +++++- for (Player pp : Bukkit.getOnlinePlayers()) { +++++- Location location = player.getLocation(); +++++- pp.playSound(location, Sound.valueOf(Sound_Name), Sound_Volume, Sound_Pitch); +++++- } +++++- } +++++- } +++++- } catch (Exception ex) { +++++- Logger.warning("&eVerify that the sound name is correct or belongs to the version"); +++++- } +++++- } ++++++ try { ++++++ if (isSound) { ++++++ if (isSoundAll) { ++++++ Location location = player.getLocation(); ++++++ player.playSound(location, Sound.valueOf(Sound_Name), Sound_Volume, Sound_Pitch); ++++++ } else { ++++++ for (Player pp : Bukkit.getOnlinePlayers()) { ++++++ Location location = player.getLocation(); ++++++ pp.playSound(location, Sound.valueOf(Sound_Name), Sound_Volume, Sound_Pitch); ++++++ } ++++++ } ++++++ } ++++++ } catch (Exception ex) { ++++++ Logger.warning("&eVerify that the sound name is correct or belongs to the version"); ++++++ } ++++++ } +++++ +++++- } +++++- +++++ } +++++Index: CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/utils/Settings.java +++++IDEA additional info: +++++Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +++++<+>UTF-8 +++++=================================================================== +++++diff --git a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/utils/Settings.java b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/utils/Settings.java +++++--- a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/utils/Settings.java (revision 60d9051d52d70ed86db8e0fc1a50da61f395e55a) ++++++++ b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/utils/Settings.java (revision 5436229cc153c4aec4cd6267d80f1e8301022990) +++++@@ -14,7 +14,6 @@ +++++ public static boolean settings_debug; +++++ +++++ //Join section +++++- public static String join_type; +++++ +++++ public static boolean join; +++++ public static String join_message; +++++@@ -25,9 +24,9 @@ +++++ public static boolean join_title; +++++ public static String join_message_title_title; +++++ public static String join_message_title_subtitle; +++++- public static int join_title_fadein; ++++++ public static int join_title_fadeIn; +++++ public static int join_title_stay; +++++- public static int join_title_fadeout; ++++++ public static int join_title_fadeOut; +++++ +++++ public static boolean join_actionbar; +++++ public static String join_message_actionbar_text; +++++@@ -38,33 +37,23 @@ +++++ public static int join_sound_vol; +++++ +++++ //Quit section +++++- +++++- public static String quit_type; +++++- +++++ public static boolean quit; +++++ public static String quit_message; +++++ +++++- public static boolean quit_sound; +++++- public static String quit_sound_name; +++++- public static float quit_sound_pitch; +++++- public static int quit_sound_vol; +++++- +++++ //Welcome section +++++ public static boolean welcome; +++++ public static List list_welcome; +++++ +++++ //Hooks section +++++- public static boolean hook_discordsrv; +++++- public static boolean hook_discordsrv_use_message; +++++- public static String hook_discordsrv_channelid; ++++++ public static boolean hook_discordSrv; ++++++ public static String hook_discordSrv_channelId; +++++ +++++ public static boolean hook_essentials; +++++- public static boolean hook_essentials_hideplayervanish; ++++++ public static boolean hook_essentials_hidePlayerVanish; +++++ +++++ public static boolean hook_essentialsDiscord; +++++ public static boolean hook_essentialsDiscord_use_default_channel; +++++- public static String hook_essentialsDiscord_channelid; ++++++ public static String hook_essentialsDiscord_channelId; +++++ public static boolean hook_luckperms; +++++- public static boolean hook_luckperms_use_group; +++++ public static long hook_luckperms_autoUpdate_group_tick; +++++ } +++++Index: CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/utils/Util.java +++++IDEA additional info: +++++Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +++++<+>UTF-8 +++++=================================================================== +++++diff --git a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/utils/Util.java b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/utils/Util.java +++++--- a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/utils/Util.java (revision 60d9051d52d70ed86db8e0fc1a50da61f395e55a) ++++++++ b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/utils/Util.java (revision 5436229cc153c4aec4cd6267d80f1e8301022990) +++++@@ -67,10 +67,8 @@ +++++ return prefix; +++++ } +++++ +++++- +++++ public static @NotNull List setTabLimit(final @NotNull List options, final String lastArgs) { +++++ final List returned = new ArrayList<>(); +++++- +++++ for (String s : options) { +++++ if (s == null) { +++++ continue; +++++@@ -82,25 +80,11 @@ +++++ return returned; +++++ } +++++ +++++- @SuppressWarnings("unused") +++++- public static void sendTextComponentHover(@NotNull Player j, String action, String message, String subMessage, String color) { +++++- TextComponent msg = new TextComponent(color(message)); +++++- msg.setHoverEvent(new HoverEvent(HoverEvent.Action.valueOf(getActionHoverType(action)), new ComponentBuilder(subMessage).color(ChatColor.of(color)).create())); +++++- j.spigot().sendMessage(msg); +++++- } +++++- +++++ public static void sendTextComponent116Hover(@NotNull Player j, String action, String message, String subMessage) { +++++ TextComponent msg = new TextComponent(color(message)); +++++ msg.setHoverEvent(new HoverEvent(HoverEvent.Action.valueOf(getActionHoverType(action)), new ComponentBuilder(color(subMessage)).create())); +++++ j.spigot().sendMessage(msg); +++++ } +++++- +++++- @SuppressWarnings("unused") +++++- public static void sendTextComponentClick(@NotNull Player j, String action, String message, String arg0) { +++++- TextComponent msg = new TextComponent(color(message)); +++++- msg.setClickEvent(new ClickEvent(ClickEvent.Action.valueOf(getActionClickType(action)), arg0)); +++++- j.spigot().sendMessage(msg); +++++- } +++++ +++++ public static void sendAllPlayerBaseComponent(BaseComponent component) { +++++ for (Player p : Bukkit.getOnlinePlayers()) { +++++@@ -120,16 +104,6 @@ +++++ } +++++ return null; +++++ } +++++- +++++- public static @Nullable String getActionClickType(@NotNull String arg) { +++++- if (arg.equalsIgnoreCase("url")) { +++++- return "OPEN_URL"; +++++- } +++++- if (arg.equalsIgnoreCase("cmd")) { +++++- return "RUN_COMMAND"; +++++- } +++++- return null; +++++- } +++++ +++++ public static @NotNull String getVar(@NotNull Player player, String text) { +++++ text = text.replace("", player.getName()); +++++Index: CustomJoinAndQuitMessagesOld/src/main/resources/config.yml +++++IDEA additional info: +++++Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +++++<+>UTF-8 +++++=================================================================== +++++diff --git a/CustomJoinAndQuitMessagesOld/src/main/resources/config.yml b/CustomJoinAndQuitMessagesOld/src/main/resources/config.yml +++++--- a/CustomJoinAndQuitMessagesOld/src/main/resources/config.yml (revision 60d9051d52d70ed86db8e0fc1a50da61f395e55a) ++++++++ b/CustomJoinAndQuitMessagesOld/src/main/resources/config.yml (revision 5436229cc153c4aec4cd6267d80f1e8301022990) +++++@@ -105,9 +105,6 @@ +++++ # |Text| Here you can set the join message for the first time +++++ Text: '&6Welcome to server &a&6 for the first time' +++++ +++++- # |Type| Here you can find two types that are [ normal | modify ] +++++- Type: modify +++++- +++++ # |HoverEvent| This section allows you to modify the hover events in the chat +++++ HoverEvent: +++++ +++++@@ -129,12 +126,6 @@ +++++ # |Mode| there are three different modes which are [ command | suggest | url ] +++++ Mode: command +++++ +++++- # This feature is not available yet +++++- DevActions: +++++- - '[Suggest]: /help' +++++- - '[Execute]: /me hello test' +++++- - '[Open]: https://www.spigotmc.org/resources/custom-join-and-quit-message-1-7-x-1-17-x.57006/' +++++- +++++ # |Actions| This is where are the available events that you can use +++++ Actions: +++++ +++++@@ -205,9 +196,6 @@ +++++ # |Text| This is where Quit customizable message is located +++++ Text: '&b[<#:FF8E8E>-&b] <#:A157FF>' +++++ +++++- # |Type| Here you can find two types that are [ normal | modify ] +++++- Type: normal +++++- +++++ # |HoverEvent| This section allows you to modify the hover events in the chat +++++ HoverEvent: +++++ +++++@@ -280,7 +268,7 @@ +++++ - '&m=========================================&r' +++++ # +++++ # |File-Version|I would not change anything +++++-File-Version: 3 ++++++File-Version: 4 +++++ # |> This is the end of the configuration ... [-_-] more things coming soon +++++ # +++++ # | Config File | +++++Index: CustomJoinAndQuitMessagesOld/src/main/resources/groups.yml +++++IDEA additional info: +++++Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +++++<+>UTF-8 +++++=================================================================== +++++diff --git a/CustomJoinAndQuitMessagesOld/src/main/resources/groups.yml b/CustomJoinAndQuitMessagesOld/src/main/resources/groups.yml +++++--- a/CustomJoinAndQuitMessagesOld/src/main/resources/groups.yml (revision 60d9051d52d70ed86db8e0fc1a50da61f395e55a) ++++++++ b/CustomJoinAndQuitMessagesOld/src/main/resources/groups.yml (revision 5436229cc153c4aec4cd6267d80f1e8301022990) +++++@@ -32,9 +32,6 @@ +++++ +++++ # |Text| Here you can set the join message for the first time +++++ Text: '&6Welcome to server &a&6 for the first time' +++++- +++++- # |Type| Here you can find two types that are [ normal | modify ] +++++- Type: modify +++++ +++++ # |HoverEvent| This section allows you to modify the hover events in the chat +++++ HoverEvent: +++++Index: bukkit/src/main/java/jss/customjoinandquitmessage/commands/subcommands/InfoCommand.java +++++IDEA additional info: +++++Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +++++<+>UTF-8 +++++=================================================================== +++++diff --git a/bukkit/src/main/java/jss/customjoinandquitmessage/commands/subcommands/InfoCommand.java b/bukkit/src/main/java/jss/customjoinandquitmessage/commands/subcommands/InfoCommand.java +++++--- a/bukkit/src/main/java/jss/customjoinandquitmessage/commands/subcommands/InfoCommand.java (revision 60d9051d52d70ed86db8e0fc1a50da61f395e55a) ++++++++ b/bukkit/src/main/java/jss/customjoinandquitmessage/commands/subcommands/InfoCommand.java (revision 5436229cc153c4aec4cd6267d80f1e8301022990) +++++@@ -9,6 +9,11 @@ +++++ return "info"; +++++ } +++++ ++++++ @Override ++++++ public String permission() { ++++++ return null; ++++++ } ++++++ +++++ public void onCommand(CommandSender sender, String[] args) { +++++ +++++ } +++++Index: patches/Removed_debugging_messages_in_the_LuckPermsHook_class_.patch +++++IDEA additional info: +++++Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +++++<+>UTF-8 +++++=================================================================== +++++diff --git a/patches/Removed_debugging_messages_in_the_LuckPermsHook_class_.patch b/patches/Removed_debugging_messages_in_the_LuckPermsHook_class_.patch +++++new file mode 100644 +++++--- /dev/null (revision 5436229cc153c4aec4cd6267d80f1e8301022990) ++++++++ b/patches/Removed_debugging_messages_in_the_LuckPermsHook_class_.patch (revision 5436229cc153c4aec4cd6267d80f1e8301022990) +++++@@ -0,0 +1,29 @@ ++++++Index: CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/hook/LuckPermsHook.java ++++++IDEA additional info: ++++++Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP ++++++<+>UTF-8 ++++++=================================================================== ++++++diff --git a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/hook/LuckPermsHook.java b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/hook/LuckPermsHook.java ++++++--- a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/hook/LuckPermsHook.java (revision 52d1e6b32c970d5470b3f06b418c1d1ef9e3aeb1) +++++++++ b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/hook/LuckPermsHook.java (revision 60d9051d52d70ed86db8e0fc1a50da61f395e55a) ++++++@@ -25,19 +25,16 @@ ++++++ if (!Bukkit.getPluginManager().isPluginEnabled("LuckPerms")) { ++++++ Logger.warning("&eLuckPerms not enabled! - Disable Features..."); ++++++ this.isEnabled = false; ++++++- System.out.println("Cjm Softdepend: Luckperms false - check plugin installed in plugin folder"); ++++++ return; ++++++ } ++++++ ++++++ if (!Settings.hook_luckperms) { ++++++ this.isEnabled = false; ++++++- System.out.println("Cjm Softdepend: Luckperms false - Hook Enabled in config"); ++++++- Logger.warning("&eLuckPerms not enabled! - Disable Features..."); +++++++ System.out.println("Cjm Softdepend: Luckperms false - Hook disabled in config"); ++++++ return; ++++++ } ++++++ ++++++ this.isEnabled = true; ++++++- System.out.println("Cjm Softdepend: Luckperms true - The plugin has successfully loaded the dependency"); ++++++ Util.sendColorMessage(EventUtils.getStaticConsoleSender(), Util.getPrefix(true) + "&aLoading LuckPerms features..."); ++++++ } ++++++ From 858f7563cb44abf4dbe3063f8b267f4adef85e91 Mon Sep 17 00:00:00 2001 From: SrJss <31166687+jonagamerpro1234@users.noreply.github.com> Date: Wed, 12 Apr 2023 16:44:30 -0400 Subject: [PATCH 24/27] Create CONTRIBUTING.md --- CONTRIBUTING.md | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 CONTRIBUTING.md diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..7b041ab --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,35 @@ +# Contributing Guidelines + +Thank you for considering contributing to our project! Feel free to propose improvements, report issues, or add new features. To contribute, please follow these steps: + +1. Fork this repository. +2. Clone the fork to your local machine. +3. Create a new branch for your changes: `git checkout -b branch-name`. +4. Make the changes and commit them: `git add .` and `git commit -m "Description of the changes made"`. +5. Push the changes to your fork: `git push origin branch-name`. +6. Create a Pull Request towards the main branch of this repository. + +## How to contribute + +You can contribute in several ways, including: + +- Reporting issues or problems in the code. +- Adding new features. +- Correcting grammar or spelling errors in documentation files. +- Improving code efficiency. + +## How to report issues or suggest improvements + +If you find any errors or problems in the code, or if you have any suggestions for improving the project, you can inform us by opening an Issue. Please make sure to provide as much detail as possible about the problem or suggestion so that we can address it effectively. + +## Contribution guidelines + +Before making a contribution, please make sure to review and follow these guidelines: + +- All changes must be clearly documented. +- Code must follow existing style conventions. +- You must add tests for any new features you add. + +## License + +This project is licensed under the **GNU General Public License v3.0**. By contributing to this project, you agree that your contribution will be published under the same license. From 7835ee92ebb27c0116ab70f1ae8f63f031ec94c4 Mon Sep 17 00:00:00 2001 From: SrJss <31166687+jonagamerpro1234@users.noreply.github.com> Date: Thu, 13 Apr 2023 19:57:01 -0400 Subject: [PATCH 25/27] recode logger --- .../jss/customjoinandquitmessages/utils/logger/LoggerTask.java | 1 - 1 file changed, 1 deletion(-) diff --git a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/utils/logger/LoggerTask.java b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/utils/logger/LoggerTask.java index a0e7760..4bb400c 100644 --- a/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/utils/logger/LoggerTask.java +++ b/CustomJoinAndQuitMessagesOld/src/main/java/jss/customjoinandquitmessages/utils/logger/LoggerTask.java @@ -5,7 +5,6 @@ public class LoggerTask extends BukkitRunnable { - public void run() { if(Settings.compress_logs){ LoggerFileUtils.compressLogs(); From c2dee74bd0d89cfc9605ff265de35ed647fd0aa6 Mon Sep 17 00:00:00 2001 From: jhqwqmc <113768629+jhqwqmc@users.noreply.github.com> Date: Sat, 29 Apr 2023 00:16:57 +0800 Subject: [PATCH 26/27] Update zh_CN.yml Sinicization --- bukkit/src/main/resources/langs/zh_CN.yml | 36 +++++++++++------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/bukkit/src/main/resources/langs/zh_CN.yml b/bukkit/src/main/resources/langs/zh_CN.yml index 09d869c..125ca89 100644 --- a/bukkit/src/main/resources/langs/zh_CN.yml +++ b/bukkit/src/main/resources/langs/zh_CN.yml @@ -1,25 +1,25 @@ Prefix: "&e[&dCustomJoinAndQuitMessage&e]" -NoPermission: "&cYou don't have permissions!" -UsageMainCommand: "&7Use &9/Cjm &ehelp &7for more information" -UnknownArguments: "&cUnknown argument!" -ReloadCommand: "&aAll plugin files have been reloaded" -UsageDisplayCommand: "&7Usa &9/Cjm &edisplay &d &7to see a preview" -UnknownSound: "&eThe sound is not from this version or is misspelled!" -DisabledCommand: "&cThis command is disabled" +NoPermission: "&c你没有权限!" +UsageMainCommand: "&7使用 &9/Cjm &ehelp &7了解更多信息" +UnknownArguments: "&c未知参数!" +ReloadCommand: "&a已重新加载插件的所有配置文件" +UsageDisplayCommand: "&7使用 &9/Cjm &edisplay &d &7查看预览" +UnknownSound: "&e这个声音不支持此版本或在配置文件拼写错误!" +DisabledCommand: "&c此命令已禁用" UpdateAlert: Console: - "======================================-" - - " || The {version} is out of date" - - " || - Newest version: {newversion}" - - " || - Your version: {version}" - - " || - Update here on Spigot: {spigot}" - - " || - Update here on GitHub: {github}" + - " || {version} 已过期" + - " || - 最新版本:{newversion}" + - " || - 您的版本:{version}" + - " || - 在 Spigot 上更新:{spigot}" + - " || - 在 GitHub 上更新: {github}" - "======================================-" Player: - - "&aVersion &e{newversion} &ais now available for download" - - "&b&nClick &7here to go to the plugin page" + - "&a版本 &e{newversion} &a 现在可供下载" + - "&b&n点击&7这里进入插件页面" HelpCommand: - - " &6&l* &9/Cjm &ehelp &7shows this same message" - - " &6&l* &9/Cjm &ereload &7reload all plugin files" - - " &6&l* &9/Cjm &einfo &7shows plugin information like support links..." - - " &6&l* &9/Cjm &edisplay &7it is used to see the messages and functions of the plugin without having to leave the server" + - " &6&l* &9/Cjm &ehelp &7展示这条消息" + - " &6&l* &9/Cjm &ereload &7重新加载插件的所有配置文件" + - " &6&l* &9/Cjm &einfo &7展示插件信息,如赞助链接..." + - " &6&l* &9/Cjm &edisplay &7它用于在不离开服务器的情况下查看插件的消息和功能" From 9d66607836f39aafe8b80173c57875dba618c7a9 Mon Sep 17 00:00:00 2001 From: SrJss <31166687+jonagamerpro1234@users.noreply.github.com> Date: Sat, 20 May 2023 18:25:36 -0400 Subject: [PATCH 27/27] bug fix --- .../CustomJoinAndQuitMessagesOld.iml | 82 +------------------ .../src/main/resources/config.yml | 14 +++- bukkit/pom.xml | 8 ++ .../CustomJoinAndQuitMessage.java | 24 +++++- .../commands/CommandHandler.java | 34 +++++--- .../commands/subcommands/DisplayCommand.java | 10 +++ .../commands/subcommands/HelpCommand.java | 15 +++- .../commands/subcommands/InfoCommand.java | 11 ++- .../commands/subcommands/ReloadCommand.java | 7 ++ .../commands/utils/SubCommand.java | 4 + .../files/LangFile.java | 27 ++++-- .../files/utils/PreConfigLoader.java | 12 ++- .../files/utils/Settings.java | 22 +++++ .../libs/iridium/IridiumColorAPI.java | 1 - .../listeners/chat/JoinListener.java | 3 +- .../customjoinandquitmessage/utils/Utils.java | 5 ++ bukkit/src/main/resources/config.yml | 2 +- bukkit/src/main/resources/groups.yml | 5 ++ bukkit/src/main/resources/langs/de_DE.yml | 1 + bukkit/src/main/resources/langs/en_US.yml | 1 + bukkit/src/main/resources/langs/es_ES.yml | 1 + bukkit/src/main/resources/langs/fr_FR.yml | 1 + bukkit/src/main/resources/langs/messages.yml | 1 + bukkit/src/main/resources/langs/ru_RU.yml | 1 + bukkit/src/main/resources/langs/zh_CN.yml | 1 + bukkit/src/main/resources/langs/zh_TW.yml | 1 + 26 files changed, 182 insertions(+), 112 deletions(-) diff --git a/CustomJoinAndQuitMessagesOld/CustomJoinAndQuitMessagesOld.iml b/CustomJoinAndQuitMessagesOld/CustomJoinAndQuitMessagesOld.iml index 080334c..a57b9e4 100644 --- a/CustomJoinAndQuitMessagesOld/CustomJoinAndQuitMessagesOld.iml +++ b/CustomJoinAndQuitMessagesOld/CustomJoinAndQuitMessagesOld.iml @@ -1,5 +1,5 @@ - + @@ -11,84 +11,4 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/CustomJoinAndQuitMessagesOld/src/main/resources/config.yml b/CustomJoinAndQuitMessagesOld/src/main/resources/config.yml index 8a2386f..e37a1a6 100644 --- a/CustomJoinAndQuitMessagesOld/src/main/resources/config.yml +++ b/CustomJoinAndQuitMessagesOld/src/main/resources/config.yml @@ -129,10 +129,16 @@ Join: Enabled: true # |Hover| This section allows you to define the hover text - Hover: - - '&6> &aHello &b' - - '&6> &e%player_exp_to_level%' - - '&6> &dadd more lines like these' + Hovers: + 1: + - '&6> &aHello &b' + - '&6> &e%player_exp_to_level%' + - '&6> &dadd more lines like these' + 2: + - '&6> &aHello &b' + - '&6> &e%player_exp_to_level%' + - '&6> &dadd more lines like these' + # |ClickEvent| This section allows you to modify chat click events ClickEvent: diff --git a/bukkit/pom.xml b/bukkit/pom.xml index 29b2192..de10995 100644 --- a/bukkit/pom.xml +++ b/bukkit/pom.xml @@ -46,6 +46,14 @@ + + org.apache.maven.plugins + maven-jar-plugin + 3.2.0 + + C:\Users\Alumno\Documents\Server\1.8\plugins + + diff --git a/bukkit/src/main/java/jss/customjoinandquitmessage/CustomJoinAndQuitMessage.java b/bukkit/src/main/java/jss/customjoinandquitmessage/CustomJoinAndQuitMessage.java index 7876057..82d6e8e 100644 --- a/bukkit/src/main/java/jss/customjoinandquitmessage/CustomJoinAndQuitMessage.java +++ b/bukkit/src/main/java/jss/customjoinandquitmessage/CustomJoinAndQuitMessage.java @@ -2,9 +2,14 @@ import jss.customjoinandquitmessage.commands.CommandHandler; import jss.customjoinandquitmessage.files.utils.PreConfigLoader; +import jss.customjoinandquitmessage.listeners.chat.JoinListener; +import jss.customjoinandquitmessage.listeners.chat.QuitListener; import org.bukkit.Bukkit; +import org.bukkit.event.Listener; import org.bukkit.plugin.PluginDescriptionFile; +import org.bukkit.plugin.PluginManager; import org.bukkit.plugin.java.JavaPlugin; +import org.jetbrains.annotations.NotNull; public final class CustomJoinAndQuitMessage extends JavaPlugin { @@ -12,15 +17,25 @@ public final class CustomJoinAndQuitMessage extends JavaPlugin { private static CustomJoinAndQuitMessage instance; public final String version = jss.getVersion(); public String newestVersion; - private final PreConfigLoader preConfigLoader = new PreConfigLoader(); + private final PreConfigLoader preConfigLoader = new PreConfigLoader(this); - public void onEnable() { + public void onLoad() { instance = this; + } + + public void onEnable() { + + saveDefaultConfig(); if(!preConfigLoader.loadLangs()){ Bukkit.getPluginManager().disablePlugins(); } + registerListener( + new JoinListener(), + new QuitListener() + ); + CommandHandler commandHandler = new CommandHandler(); commandHandler.register(); @@ -34,6 +49,11 @@ public void reloadAllFiles(){ } + private void registerListener(Listener @NotNull ...listeners){ + for (Listener listener: listeners){ + Bukkit.getPluginManager().registerEvents(listener,this); + } + } public static CustomJoinAndQuitMessage get(){ return instance; diff --git a/bukkit/src/main/java/jss/customjoinandquitmessage/commands/CommandHandler.java b/bukkit/src/main/java/jss/customjoinandquitmessage/commands/CommandHandler.java index fa25c58..ae19f4c 100644 --- a/bukkit/src/main/java/jss/customjoinandquitmessage/commands/CommandHandler.java +++ b/bukkit/src/main/java/jss/customjoinandquitmessage/commands/CommandHandler.java @@ -5,6 +5,7 @@ import jss.customjoinandquitmessage.commands.subcommands.InfoCommand; import jss.customjoinandquitmessage.commands.subcommands.ReloadCommand; import jss.customjoinandquitmessage.commands.utils.SubCommand; +import jss.customjoinandquitmessage.files.utils.Settings; import jss.customjoinandquitmessage.utils.Utils; import org.bukkit.command.Command; import org.bukkit.command.CommandSender; @@ -23,7 +24,7 @@ public class CommandHandler implements TabExecutor { private final ArrayList subCommands = new ArrayList<>(); public void register(){ - PluginCommand pluginCommand = plugin.getCommand("CustomJoinAndQuitMessage"); + PluginCommand pluginCommand = plugin.getCommand("customjoinandquitmessages"); assert pluginCommand != null; pluginCommand.setExecutor(this); pluginCommand.setTabCompleter(this); @@ -33,29 +34,36 @@ public void register(){ @Override public boolean onCommand(@NotNull CommandSender sender, @NotNull Command cmd, @NotNull String label, String @NotNull [] args) { - Player player = (Player) sender; - if(args.length >= 1){ - // execute subcommand - getSubCommands().forEach( s -> { + for(SubCommand s : getSubCommands()){ if (args[0].equalsIgnoreCase(s.name())){ if (s.isEnabled()){ + + if (!s.allowConsole() && !(sender instanceof Player)) { + Utils.sendColorMessage(sender, Settings.lang_allowConsoleCommand); + return true; + } + + if (s.requiresPermission() && !sender.hasPermission(s.permission())) { + Utils.sendColorMessage(sender, Settings.lang_nopermission); + return true; + } + s.onCommand(sender, args); - }else{ - Utils.sendColorMessage(player, s.disabledMessage()); + return true; + } else { + Utils.sendColorMessage(sender, s.disabledMessage()); } + return true; } - }); + } - }else{ - // unknown argument - Utils.sendColorMessage(player, "&cArgumento desconosido!"); + Utils.sendColorMessage(sender, Settings.lang_unknownArguments); return true; } - //usage main command - Utils.sendColorMessage(player, "&7Usa &e/Cjm &9help &7para mas informacion"); + Utils.sendColorMessage(sender, Settings.lang_usageMainCommand); return true; } diff --git a/bukkit/src/main/java/jss/customjoinandquitmessage/commands/subcommands/DisplayCommand.java b/bukkit/src/main/java/jss/customjoinandquitmessage/commands/subcommands/DisplayCommand.java index 8144c1e..3913a5e 100644 --- a/bukkit/src/main/java/jss/customjoinandquitmessage/commands/subcommands/DisplayCommand.java +++ b/bukkit/src/main/java/jss/customjoinandquitmessage/commands/subcommands/DisplayCommand.java @@ -2,6 +2,7 @@ import jss.customjoinandquitmessage.commands.utils.SubCommand; import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; @SuppressWarnings("unused") public class DisplayCommand extends SubCommand { @@ -15,9 +16,18 @@ public String permission() { return null; } + public boolean requiresPermission() { + return true; + } public void onCommand(CommandSender sender, String[] args) { + if(!(sender instanceof Player)){ + + } + } + public boolean allowConsole() { + return false; } public boolean isEnabled() { diff --git a/bukkit/src/main/java/jss/customjoinandquitmessage/commands/subcommands/HelpCommand.java b/bukkit/src/main/java/jss/customjoinandquitmessage/commands/subcommands/HelpCommand.java index b342400..e2598e6 100644 --- a/bukkit/src/main/java/jss/customjoinandquitmessage/commands/subcommands/HelpCommand.java +++ b/bukkit/src/main/java/jss/customjoinandquitmessage/commands/subcommands/HelpCommand.java @@ -1,6 +1,8 @@ package jss.customjoinandquitmessage.commands.subcommands; import jss.customjoinandquitmessage.commands.utils.SubCommand; +import jss.customjoinandquitmessage.files.utils.Settings; +import jss.customjoinandquitmessage.utils.Utils; import org.bukkit.command.CommandSender; public class HelpCommand extends SubCommand { @@ -10,10 +12,21 @@ public String name() { } public String permission(){ - return ""; + return "command.help"; } + + public boolean requiresPermission() { + return true; + } + public void onCommand(CommandSender sender, String[] args) { + for (String s : Settings.lang_helpCommand) { + Utils.sendColorMessage(sender, s); + } + } + public boolean allowConsole() { + return true; } public boolean isEnabled() { diff --git a/bukkit/src/main/java/jss/customjoinandquitmessage/commands/subcommands/InfoCommand.java b/bukkit/src/main/java/jss/customjoinandquitmessage/commands/subcommands/InfoCommand.java index 67096d3..cd5c50e 100644 --- a/bukkit/src/main/java/jss/customjoinandquitmessage/commands/subcommands/InfoCommand.java +++ b/bukkit/src/main/java/jss/customjoinandquitmessage/commands/subcommands/InfoCommand.java @@ -1,6 +1,7 @@ package jss.customjoinandquitmessage.commands.subcommands; import jss.customjoinandquitmessage.commands.utils.SubCommand; +import jss.customjoinandquitmessage.files.utils.Settings; import org.bukkit.command.CommandSender; public class InfoCommand extends SubCommand { @@ -14,15 +15,23 @@ public String permission() { return null; } + public boolean requiresPermission() { + return false; + } + public void onCommand(CommandSender sender, String[] args) { } + public boolean allowConsole() { + return true; + } + public boolean isEnabled() { return true; } public String disabledMessage() { - return null; + return Settings.lang_disableCommand; } } diff --git a/bukkit/src/main/java/jss/customjoinandquitmessage/commands/subcommands/ReloadCommand.java b/bukkit/src/main/java/jss/customjoinandquitmessage/commands/subcommands/ReloadCommand.java index ac38f36..3fe505c 100644 --- a/bukkit/src/main/java/jss/customjoinandquitmessage/commands/subcommands/ReloadCommand.java +++ b/bukkit/src/main/java/jss/customjoinandquitmessage/commands/subcommands/ReloadCommand.java @@ -14,11 +14,18 @@ public String permission() { return null; } + public boolean requiresPermission() { + return true; + } public void onCommand(CommandSender sender, String[] args) { } + public boolean allowConsole() { + return true; + } + public boolean isEnabled() { return false; } diff --git a/bukkit/src/main/java/jss/customjoinandquitmessage/commands/utils/SubCommand.java b/bukkit/src/main/java/jss/customjoinandquitmessage/commands/utils/SubCommand.java index ceb30bf..f2af8cd 100644 --- a/bukkit/src/main/java/jss/customjoinandquitmessage/commands/utils/SubCommand.java +++ b/bukkit/src/main/java/jss/customjoinandquitmessage/commands/utils/SubCommand.java @@ -8,8 +8,12 @@ public abstract class SubCommand { public abstract String permission(); + public abstract boolean requiresPermission(); + public abstract void onCommand(CommandSender sender, String[] args); + public abstract boolean allowConsole(); + public abstract boolean isEnabled(); public abstract String disabledMessage(); diff --git a/bukkit/src/main/java/jss/customjoinandquitmessage/files/LangFile.java b/bukkit/src/main/java/jss/customjoinandquitmessage/files/LangFile.java index 0e92cac..25cfec0 100644 --- a/bukkit/src/main/java/jss/customjoinandquitmessage/files/LangFile.java +++ b/bukkit/src/main/java/jss/customjoinandquitmessage/files/LangFile.java @@ -1,6 +1,7 @@ package jss.customjoinandquitmessage.files; import jss.customjoinandquitmessage.CustomJoinAndQuitMessage; +import jss.customjoinandquitmessage.files.utils.Settings; import org.bukkit.configuration.file.FileConfiguration; import org.bukkit.configuration.file.YamlConfiguration; import org.jetbrains.annotations.NotNull; @@ -39,28 +40,44 @@ public void reload(final String name){ File dir = new File(plugin.getDataFolder(),"langs"); if(!dir.exists()){ - //noinspection ResultOfMethodCallIgnored - dir.mkdir(); + // Intentamos crear la carpeta + if(dir.mkdirs()) { + plugin.getLogger().info("Carpeta 'langs' creada correctamente"); + } else { + plugin.getLogger().warning("No se pudo crear la carpeta 'langs'"); + } } if(file == null){ file = new File(dir.getPath(), name + ".yml"); } - if(dir.exists()){ + if(file.exists()){ config = YamlConfiguration.loadConfiguration(file); }else{ if(plugin.getResource("langs/" + name + ".yml") != null){ - plugin.saveResource("langs" + name + ".yml", true); + plugin.saveResource("langs/" + name + ".yml", true); file = new File(plugin.getDataFolder() + File.separator + "langs", name + ".yml"); config = YamlConfiguration.loadConfiguration(file); } } } - private void loadMessages(){ + private void loadMessages(){ + Settings.lang_prefix = config.getString("Prefix"); + Settings.lang_nopermission = config.getString("NoPermission"); + Settings.lang_usageMainCommand = config.getString("UsageMainCommand"); + Settings.lang_allowConsoleCommand = config.getString("allowConsoleCommand"); + Settings.lang_unknownArguments = config.getString("UnknownArguments"); + Settings.lang_reloadCommand = config.getString("ReloadCommand"); + Settings.lang_usageDisplayCommand = config.getString("UsageDisplayCommand"); + Settings.lang_unknownSound = config.getString("UnknownSound"); + Settings.lang_disableCommand = config.getString("DisableCommand"); + Settings.lang_updateAlert_console = config.getStringList("UpdateAlert.Console"); + Settings.lang_updateAlert_player = config.getStringList("UpdateAlert.Player"); + Settings.lang_helpCommand = config.getStringList("HelpCommand"); } } diff --git a/bukkit/src/main/java/jss/customjoinandquitmessage/files/utils/PreConfigLoader.java b/bukkit/src/main/java/jss/customjoinandquitmessage/files/utils/PreConfigLoader.java index 3c658e2..2da5672 100644 --- a/bukkit/src/main/java/jss/customjoinandquitmessage/files/utils/PreConfigLoader.java +++ b/bukkit/src/main/java/jss/customjoinandquitmessage/files/utils/PreConfigLoader.java @@ -2,17 +2,25 @@ import jss.customjoinandquitmessage.CustomJoinAndQuitMessage; import jss.customjoinandquitmessage.files.LangFile; +import org.bukkit.configuration.file.FileConfiguration; import java.io.IOException; import java.util.HashMap; public class PreConfigLoader { - private final CustomJoinAndQuitMessage plugin = CustomJoinAndQuitMessage.get(); + private final CustomJoinAndQuitMessage plugin; + + public PreConfigLoader(CustomJoinAndQuitMessage plugin) { + this.plugin = plugin; + } @SuppressWarnings("unused") public void loadConfigs(){ - Settings.config_Lang = "en_US"; + FileConfiguration config = plugin.getConfig(); + Settings.config_Lang = config.getString("Settings.Lang"); + Settings.config_Debug = config.getBoolean("Settings.Debug"); + } public boolean loadLangs(){ diff --git a/bukkit/src/main/java/jss/customjoinandquitmessage/files/utils/Settings.java b/bukkit/src/main/java/jss/customjoinandquitmessage/files/utils/Settings.java index 5e25404..5913996 100644 --- a/bukkit/src/main/java/jss/customjoinandquitmessage/files/utils/Settings.java +++ b/bukkit/src/main/java/jss/customjoinandquitmessage/files/utils/Settings.java @@ -1,7 +1,29 @@ package jss.customjoinandquitmessage.files.utils; +import java.util.List; + public class Settings { + //config public static String config_Lang; + public static boolean config_Debug; + public static boolean config_enabledUpdate; + public static String config_getFromUpdate; + + + //langs + public static String lang_prefix; + public static String lang_nopermission; + public static String lang_usageMainCommand; + public static String lang_allowConsoleCommand; + public static String lang_unknownArguments; + public static String lang_reloadCommand; + public static String lang_usageDisplayCommand; + public static String lang_unknownSound; + public static String lang_disableCommand; + public static List lang_updateAlert_console; + public static List lang_updateAlert_player; + public static List lang_helpCommand; + } diff --git a/bukkit/src/main/java/jss/customjoinandquitmessage/libs/iridium/IridiumColorAPI.java b/bukkit/src/main/java/jss/customjoinandquitmessage/libs/iridium/IridiumColorAPI.java index 40cc589..a224e19 100644 --- a/bukkit/src/main/java/jss/customjoinandquitmessage/libs/iridium/IridiumColorAPI.java +++ b/bukkit/src/main/java/jss/customjoinandquitmessage/libs/iridium/IridiumColorAPI.java @@ -112,7 +112,6 @@ private static String withoutSpecialChar(@NotNull String source) { return workingString; } - private static ChatColor @NotNull [] createRainbow(int step, float saturation) { ChatColor[] colors = new ChatColor[step]; double colorStep = (1.00 / step); diff --git a/bukkit/src/main/java/jss/customjoinandquitmessage/listeners/chat/JoinListener.java b/bukkit/src/main/java/jss/customjoinandquitmessage/listeners/chat/JoinListener.java index 7ac28ef..5666bdc 100644 --- a/bukkit/src/main/java/jss/customjoinandquitmessage/listeners/chat/JoinListener.java +++ b/bukkit/src/main/java/jss/customjoinandquitmessage/listeners/chat/JoinListener.java @@ -1,12 +1,13 @@ package jss.customjoinandquitmessage.listeners.chat; +import jss.customjoinandquitmessage.CustomJoinAndQuitMessage; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; import org.bukkit.event.player.PlayerJoinEvent; public class JoinListener implements Listener { - + private static CustomJoinAndQuitMessage plugin = CustomJoinAndQuitMessage.get(); @EventHandler public void onJoin(PlayerJoinEvent e){ diff --git a/bukkit/src/main/java/jss/customjoinandquitmessage/utils/Utils.java b/bukkit/src/main/java/jss/customjoinandquitmessage/utils/Utils.java index 93ca534..fb7d2a4 100644 --- a/bukkit/src/main/java/jss/customjoinandquitmessage/utils/Utils.java +++ b/bukkit/src/main/java/jss/customjoinandquitmessage/utils/Utils.java @@ -45,6 +45,11 @@ public static String onPlaceholderAPI(Player player, String text){ return returned; } + public static boolean hasPerm(@NotNull CommandSender sender, String perm){ + if(perm == null) sendColorMessage(sender, "[Warning] permission could not be found or it is null, please check if it is not nullpermission could not be found"); + return sender.hasPermission("cjm." + perm); + } + public static void addDelayMessage(int delayTime){ } diff --git a/bukkit/src/main/resources/config.yml b/bukkit/src/main/resources/config.yml index 6086d79..cd02a95 100644 --- a/bukkit/src/main/resources/config.yml +++ b/bukkit/src/main/resources/config.yml @@ -65,7 +65,7 @@ Hooks: HidePlayerIsVanish: true # Here you can define the discord channel where the messages from minecraft to discord are seen - # (!) Es necesario tener el plugin de [ EssentialsDiscord ] para que funcione bien todo + # (!) Es necesario tener el plugin de [ EssentialsDiscord ] para que funcione EssentialsDiscord: # Here you can enable or disable this feature diff --git a/bukkit/src/main/resources/groups.yml b/bukkit/src/main/resources/groups.yml index d3d3657..fed37fd 100644 --- a/bukkit/src/main/resources/groups.yml +++ b/bukkit/src/main/resources/groups.yml @@ -1,5 +1,8 @@ default: + # [Experimental] esta funcion puede ser removida en cualquier momento si previo aviso + # y puede sufrir cambios repentinos + # Oculta los mensajes de los otros grupos si estan en la lista no se veran HideOtherGroups: Enabled: true @@ -7,10 +10,12 @@ default: List: - admin + # Permite la perzonalizacion de un mensaje de bienvenida que solo lo podran ver los miembros de este grupo Welcome: Enabled: true + # Aqui puedes perzonalisacion el mensaje de bienvenida que quieres que aparesca para este grupo Text: - "" diff --git a/bukkit/src/main/resources/langs/de_DE.yml b/bukkit/src/main/resources/langs/de_DE.yml index 09d869c..e4cfb98 100644 --- a/bukkit/src/main/resources/langs/de_DE.yml +++ b/bukkit/src/main/resources/langs/de_DE.yml @@ -1,6 +1,7 @@ Prefix: "&e[&dCustomJoinAndQuitMessage&e]" NoPermission: "&cYou don't have permissions!" UsageMainCommand: "&7Use &9/Cjm &ehelp &7for more information" +AllowConsoleCommand: "&cThis command can only be executed in game!" UnknownArguments: "&cUnknown argument!" ReloadCommand: "&aAll plugin files have been reloaded" UsageDisplayCommand: "&7Usa &9/Cjm &edisplay &d &7to see a preview" diff --git a/bukkit/src/main/resources/langs/en_US.yml b/bukkit/src/main/resources/langs/en_US.yml index ff2a0bc..9cc335c 100644 --- a/bukkit/src/main/resources/langs/en_US.yml +++ b/bukkit/src/main/resources/langs/en_US.yml @@ -1,6 +1,7 @@ Prefix: "&e[&dCustomJoinAndQuitMessage&e]" NoPermission: "&cYou don't have permissions!" UsageMainCommand: "&7Use &9/Cjm &ehelp &7for more information" +AllowConsoleCommand: "&cThis command can only be executed in game!" UnknownArguments: "&cUnknown argument!" ReloadCommand: "&aAll plugin files have been reloaded" UsageDisplayCommand: "&7Use &9/Cjm &edisplay &d &7to see a preview" diff --git a/bukkit/src/main/resources/langs/es_ES.yml b/bukkit/src/main/resources/langs/es_ES.yml index 375da8a..9d1dc39 100644 --- a/bukkit/src/main/resources/langs/es_ES.yml +++ b/bukkit/src/main/resources/langs/es_ES.yml @@ -1,6 +1,7 @@ Prefix: "&e[&dCustomJoinAndQuitMessage&e]" NoPermission: "&cNo tienes permisos!" UsageMainCommand: "&7Usa &9/Cjm &ehelp &7para más información" +AllowConsoleCommand: "&cEste comando solo se puede ejecutar dentro del juego!" UnknownArguments: "¡&cArgumento desconocido!" ReloadCommand: "&aSe han recargado todos los archivos del plugin" UsageDisplayCommand: "&7Usa &9/Cjm &edisplay &d &7para ver una previsualización" diff --git a/bukkit/src/main/resources/langs/fr_FR.yml b/bukkit/src/main/resources/langs/fr_FR.yml index 09d869c..e4cfb98 100644 --- a/bukkit/src/main/resources/langs/fr_FR.yml +++ b/bukkit/src/main/resources/langs/fr_FR.yml @@ -1,6 +1,7 @@ Prefix: "&e[&dCustomJoinAndQuitMessage&e]" NoPermission: "&cYou don't have permissions!" UsageMainCommand: "&7Use &9/Cjm &ehelp &7for more information" +AllowConsoleCommand: "&cThis command can only be executed in game!" UnknownArguments: "&cUnknown argument!" ReloadCommand: "&aAll plugin files have been reloaded" UsageDisplayCommand: "&7Usa &9/Cjm &edisplay &d &7to see a preview" diff --git a/bukkit/src/main/resources/langs/messages.yml b/bukkit/src/main/resources/langs/messages.yml index 09d869c..e4cfb98 100644 --- a/bukkit/src/main/resources/langs/messages.yml +++ b/bukkit/src/main/resources/langs/messages.yml @@ -1,6 +1,7 @@ Prefix: "&e[&dCustomJoinAndQuitMessage&e]" NoPermission: "&cYou don't have permissions!" UsageMainCommand: "&7Use &9/Cjm &ehelp &7for more information" +AllowConsoleCommand: "&cThis command can only be executed in game!" UnknownArguments: "&cUnknown argument!" ReloadCommand: "&aAll plugin files have been reloaded" UsageDisplayCommand: "&7Usa &9/Cjm &edisplay &d &7to see a preview" diff --git a/bukkit/src/main/resources/langs/ru_RU.yml b/bukkit/src/main/resources/langs/ru_RU.yml index 09d869c..e4cfb98 100644 --- a/bukkit/src/main/resources/langs/ru_RU.yml +++ b/bukkit/src/main/resources/langs/ru_RU.yml @@ -1,6 +1,7 @@ Prefix: "&e[&dCustomJoinAndQuitMessage&e]" NoPermission: "&cYou don't have permissions!" UsageMainCommand: "&7Use &9/Cjm &ehelp &7for more information" +AllowConsoleCommand: "&cThis command can only be executed in game!" UnknownArguments: "&cUnknown argument!" ReloadCommand: "&aAll plugin files have been reloaded" UsageDisplayCommand: "&7Usa &9/Cjm &edisplay &d &7to see a preview" diff --git a/bukkit/src/main/resources/langs/zh_CN.yml b/bukkit/src/main/resources/langs/zh_CN.yml index 125ca89..d72e1b4 100644 --- a/bukkit/src/main/resources/langs/zh_CN.yml +++ b/bukkit/src/main/resources/langs/zh_CN.yml @@ -1,6 +1,7 @@ Prefix: "&e[&dCustomJoinAndQuitMessage&e]" NoPermission: "&c你没有权限!" UsageMainCommand: "&7使用 &9/Cjm &ehelp &7了解更多信息" +AllowConsoleCommand: "&cThis command can only be executed in game!" UnknownArguments: "&c未知参数!" ReloadCommand: "&a已重新加载插件的所有配置文件" UsageDisplayCommand: "&7使用 &9/Cjm &edisplay &d &7查看预览" diff --git a/bukkit/src/main/resources/langs/zh_TW.yml b/bukkit/src/main/resources/langs/zh_TW.yml index 09d869c..e4cfb98 100644 --- a/bukkit/src/main/resources/langs/zh_TW.yml +++ b/bukkit/src/main/resources/langs/zh_TW.yml @@ -1,6 +1,7 @@ Prefix: "&e[&dCustomJoinAndQuitMessage&e]" NoPermission: "&cYou don't have permissions!" UsageMainCommand: "&7Use &9/Cjm &ehelp &7for more information" +AllowConsoleCommand: "&cThis command can only be executed in game!" UnknownArguments: "&cUnknown argument!" ReloadCommand: "&aAll plugin files have been reloaded" UsageDisplayCommand: "&7Usa &9/Cjm &edisplay &d &7to see a preview"