From e6c8ccfb092f182904565807f50444e0d04c9b12 Mon Sep 17 00:00:00 2001 From: EarthCow <56940983+EarthCow@users.noreply.github.com> Date: Fri, 17 Apr 2026 17:04:16 -0400 Subject: [PATCH] Prevents auto PV spoof when NJM silent Added PlayerStateStore variable to CorePremiumVanishListener --- .../xyz/earthcow/networkjoinmessages/common/Core.java | 2 +- .../common/listeners/CorePremiumVanishListener.java | 9 ++++++--- 2 files changed, 7 insertions(+), 4 deletions(-) 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); } }