From a3360edc9a2483c358a284ff9656b32804fd8ed8 Mon Sep 17 00:00:00 2001 From: Chip Wolf Date: Fri, 26 Feb 2021 20:25:55 +0000 Subject: [PATCH] feat: add silence leave for premiumvanish (fixes #167) --- .../main/java/xyz/olivermartin/multichat/bungee/Events.java | 5 +++++ .../java/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 + 5 files changed, 10 insertions(+) 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