diff --git a/src/main/java/xyz/earthcow/networkjoinmessages/common/Core.java b/src/main/java/xyz/earthcow/networkjoinmessages/common/Core.java index 46ccfa0..860b302 100644 --- a/src/main/java/xyz/earthcow/networkjoinmessages/common/Core.java +++ b/src/main/java/xyz/earthcow/networkjoinmessages/common/Core.java @@ -112,6 +112,6 @@ public Core(CorePlugin plugin, PremiumVanish premiumVanish) { this.coreToggleJoinCommand = new CoreToggleJoinCommand(config, stateStore, messageHandler, plugin, silenceChecker, playerDataStore); this.corePremiumVanishListener = premiumVanish == null ? null - : new CorePremiumVanishListener(plugin.getCoreLogger(), config, spoofManager); + : new CorePremiumVanishListener(plugin.getCoreLogger(), config, spoofManager, stateStore); } } \ No newline at end of file diff --git a/src/main/java/xyz/earthcow/networkjoinmessages/common/listeners/CorePremiumVanishListener.java b/src/main/java/xyz/earthcow/networkjoinmessages/common/listeners/CorePremiumVanishListener.java index edc372a..71d241b 100644 --- a/src/main/java/xyz/earthcow/networkjoinmessages/common/listeners/CorePremiumVanishListener.java +++ b/src/main/java/xyz/earthcow/networkjoinmessages/common/listeners/CorePremiumVanishListener.java @@ -4,6 +4,7 @@ import xyz.earthcow.networkjoinmessages.common.abstraction.CoreLogger; import xyz.earthcow.networkjoinmessages.common.abstraction.CorePlayer; import xyz.earthcow.networkjoinmessages.common.config.PluginConfig; +import xyz.earthcow.networkjoinmessages.common.player.PlayerStateStore; import xyz.earthcow.networkjoinmessages.common.util.SpoofManager; public class CorePremiumVanishListener { @@ -11,18 +12,20 @@ public class CorePremiumVanishListener { private final CoreLogger logger; private final PluginConfig config; private final SpoofManager spoofManager; + private final PlayerStateStore stateStore; - public CorePremiumVanishListener(@NotNull CoreLogger logger, @NotNull PluginConfig config, @NotNull SpoofManager spoofManager) { + public CorePremiumVanishListener(@NotNull CoreLogger logger, @NotNull PluginConfig config, @NotNull SpoofManager spoofManager, @NotNull PlayerStateStore stateStore) { this.logger = logger; this.config = config; this.spoofManager = spoofManager; + this.stateStore = stateStore; } public void handlePremiumVanishShow(@NotNull CorePlayer player) { if (!player.getPremiumVanishHidden()) return; logger.debug("Setting PremiumVanishHidden to FALSE for " + player.getName()); player.setPremiumVanishHidden(false); - if (config.isPVSpoofJoinMessageOnShow()) { + if (config.isPVSpoofJoinMessageOnShow() && !stateStore.getSilentState(player)) { spoofManager.spoofJoin(player); } } @@ -31,7 +34,7 @@ public void handlePremiumVanishHide(@NotNull CorePlayer player) { if (player.getPremiumVanishHidden()) return; logger.debug("Setting PremiumVanishHidden to TRUE for " + player.getName()); player.setPremiumVanishHidden(true); - if (config.isPVSpoofLeaveMessageOnHide()) { + if (config.isPVSpoofLeaveMessageOnHide() && !stateStore.getSilentState(player)) { spoofManager.spoofLeave(player); } }