From 1ddeb283ce195c4f8c1ad3c0a1509a4d56024a52 Mon Sep 17 00:00:00 2001 From: Chip Wolf Date: Fri, 26 Feb 2021 20:25:55 +0000 Subject: [PATCH] fix: add silence leave for premiumvanish (fixes #167) --- multichat/dependency-reduced-pom.xml | 9 ++++----- multichat/pom.xml | 10 +++++----- .../java/xyz/olivermartin/multichat/bungee/Events.java | 5 +++++ .../xyz/olivermartin/multichat/bungee/MultiChat.java | 2 ++ .../multichat/bungee/commands/MultiChatCommand.java | 1 + multichat/src/main/resources/config.yml | 1 + multichat/src/main/resources/config_fr.yml | 1 + 7 files changed, 19 insertions(+), 10 deletions(-) diff --git a/multichat/dependency-reduced-pom.xml b/multichat/dependency-reduced-pom.xml index b582160f..d53c3b91 100644 --- a/multichat/dependency-reduced-pom.xml +++ b/multichat/dependency-reduced-pom.xml @@ -3,7 +3,7 @@ 4.0.0 xyz.olivermartin.multichat multichat - 1.9.6 + 1.9.7 @@ -47,7 +47,7 @@ sponge - http://repo.spongepowered.org/maven + https://repo.spongepowered.org/maven bungeecord-repo @@ -59,11 +59,11 @@ vault-repo - http://nexus.hc.to/content/repositories/pub_releases + https://ci.ender.zone/plugin/repository/everything placeholderapi - http://repo.extendedclip.com/content/repositories/placeholderapi/ + https://repo.extendedclip.com/content/repositories/placeholderapi/ jitpack.io @@ -294,4 +294,3 @@ - diff --git a/multichat/pom.xml b/multichat/pom.xml index bb84ef96..0366e7fa 100644 --- a/multichat/pom.xml +++ b/multichat/pom.xml @@ -5,7 +5,7 @@ xyz.olivermartin.multichat multichat - 1.9.6 + 1.9.7 @@ -16,7 +16,7 @@ sponge - http://repo.spongepowered.org/maven + https://repo.spongepowered.org/maven @@ -31,12 +31,12 @@ vault-repo - http://nexus.hc.to/content/repositories/pub_releases + https://ci.ender.zone/plugin/repository/everything placeholderapi - http://repo.extendedclip.com/content/repositories/placeholderapi/ + https://repo.extendedclip.com/content/repositories/placeholderapi/ @@ -167,4 +167,4 @@ - \ No newline at end of file + diff --git a/multichat/src/main/java/xyz/olivermartin/multichat/bungee/Events.java b/multichat/src/main/java/xyz/olivermartin/multichat/bungee/Events.java index f88aa543..aa7abc09 100644 --- a/multichat/src/main/java/xyz/olivermartin/multichat/bungee/Events.java +++ b/multichat/src/main/java/xyz/olivermartin/multichat/bungee/Events.java @@ -605,6 +605,11 @@ public void onLogout(PlayerDisconnectEvent event) { if ( ConfigManager.getInstance().getHandler("joinmessages.yml").getConfig().getBoolean("showquit") == true ) { + // PremiumVanish support, return as early as possible to avoid loading unnecessary resources + if (MultiChat.premiumVanish && MultiChat.hideVanishedStaffInLeave && BungeeVanishAPI.isInvisible(player)) { + return; + } + String joinformat = ConfigManager.getInstance().getHandler("joinmessages.yml").getConfig().getString("networkquit"); String silentformat = ConfigManager.getInstance().getHandler("joinmessages.yml").getConfig().getString("silentquit"); diff --git a/multichat/src/main/java/xyz/olivermartin/multichat/bungee/MultiChat.java b/multichat/src/main/java/xyz/olivermartin/multichat/bungee/MultiChat.java index 5d649a96..10597d6e 100644 --- a/multichat/src/main/java/xyz/olivermartin/multichat/bungee/MultiChat.java +++ b/multichat/src/main/java/xyz/olivermartin/multichat/bungee/MultiChat.java @@ -101,6 +101,7 @@ public class MultiChat extends Plugin implements Listener { public static boolean hideVanishedStaffInMsg = true; public static boolean hideVanishedStaffInStaffList = true; public static boolean hideVanishedStaffInJoin = true; + public static boolean hideVanishedStaffInLeave = true; public static List legacyServers = new ArrayList(); @@ -383,6 +384,7 @@ public void onEnable() { hideVanishedStaffInMsg = configYML.getBoolean("premium_vanish.prevent_message"); hideVanishedStaffInStaffList = configYML.getBoolean("premium_vanish.prevent_staff_list"); hideVanishedStaffInJoin = configYML.getBoolean("premium_vanish.silence_join"); + hideVanishedStaffInLeave = configYML.getBoolean("premium_vanish.silence_leave"); } } diff --git a/multichat/src/main/java/xyz/olivermartin/multichat/bungee/commands/MultiChatCommand.java b/multichat/src/main/java/xyz/olivermartin/multichat/bungee/commands/MultiChatCommand.java index f60fe8f3..d88519a3 100644 --- a/multichat/src/main/java/xyz/olivermartin/multichat/bungee/commands/MultiChatCommand.java +++ b/multichat/src/main/java/xyz/olivermartin/multichat/bungee/commands/MultiChatCommand.java @@ -157,6 +157,7 @@ public void execute(CommandSender sender, String[] args) { MultiChat.hideVanishedStaffInMsg = ConfigManager.getInstance().getHandler("config.yml").getConfig().getSection("premium_vanish").getBoolean("prevent_message"); MultiChat.hideVanishedStaffInStaffList = ConfigManager.getInstance().getHandler("config.yml").getConfig().getSection("premium_vanish").getBoolean("prevent_staff_list"); MultiChat.hideVanishedStaffInJoin = ConfigManager.getInstance().getHandler("config.yml").getConfig().getSection("premium_vanish").getBoolean("silence_join"); + MultiChat.hideVanishedStaffInLeave = ConfigManager.getInstance().getHandler("config.yml").getConfig().getSection("premium_vanish").getBoolean("silence_leave"); } } else { diff --git a/multichat/src/main/resources/config.yml b/multichat/src/main/resources/config.yml index 6958a3b1..59a2dc0e 100644 --- a/multichat/src/main/resources/config.yml +++ b/multichat/src/main/resources/config.yml @@ -271,6 +271,7 @@ premium_vanish: prevent_message: true # Prevent players being able to /msg vanished staff prevent_staff_list: true # Prevent vanished staff showing up in /staff silence_join: true # Prevent vanished players sending a join message + silence_leave: true # Prevent vanished players sending a leave message # Legacy (PRE-1.16) Servers # Listing servers here will mark them as 'LEGACY' servers diff --git a/multichat/src/main/resources/config_fr.yml b/multichat/src/main/resources/config_fr.yml index 0082390e..30b5f5a7 100644 --- a/multichat/src/main/resources/config_fr.yml +++ b/multichat/src/main/resources/config_fr.yml @@ -276,6 +276,7 @@ premium_vanish: prevent_message: true # Bloquer l'utilisation de la commande /msg prevent_staff_list: true # Masquer de la liste /staff silence_join: true # Prevent vanished players sending a join message + silence_leave: true # Prevent vanished players sending a leave message # Legacy (PRE-1.16) Servers # Listing servers here will mark them as 'LEGACY' servers