Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Project metadata
group=xyz.earthcow.networkjoinmessages
version=3.5.0
version=3.5.1
description=A plugin handling join, leave and swap messages for proxy servers.

# Plugin.yml metadata
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ public List<String> getTabCompletion(CoreCommandSender sender, String[] args) {
yield ImmutableList.of();
}
yield plugin.getAllPlayers().stream()
.filter(player -> !silenceChecker.isSilent(player, false))
.filter(player -> !silenceChecker.isSilent(player, false, false))
.map(CorePlayer::getName)
.collect(ImmutableList.toImmutableList());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ private void handleJoin(@NotNull CorePlayer player, @NotNull CoreBackendServer s
? messageFormatter.formatFirstJoinMessage(player)
: messageFormatter.formatJoinMessage(player);

boolean silent = silenceChecker.isSilent(player);
boolean silent = silenceChecker.isSilent(player, true, true);

if (silent && player.hasPermission("networkjoinmessages.spoof")) {
messageHandler.sendMessage(player, config.getSpoofJoinNotification());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,28 @@
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 {

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);
}
}
Expand All @@ -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);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public SilenceChecker(
}

public boolean isSilent(@NotNull CorePlayer player) {
return isSilent(player, true);
return isSilent(player, true, false);
}

/**
Expand All @@ -53,10 +53,10 @@ public boolean isSilent(@NotNull CorePlayer player) {
* or has the {@code pv.joinvanished} permission with TreatVanishedOnJoin enabled</li>
* </ul>
*/
public boolean isSilent(@NotNull CorePlayer player, boolean logDebug) {
public boolean isSilent(@NotNull CorePlayer player, boolean logDebug, boolean joining) {
if (logDebug) logDebugState(player);

if (config.isPVTreatVanishedOnJoin() && player.hasPermission(PV_JOIN_VANISHED_PERM)) {
if (joining && config.isPVTreatVanishedOnJoin() && player.hasPermission(PV_JOIN_VANISHED_PERM)) {
player.setPremiumVanishHidden(true);
}

Expand Down
Loading