<commit_before>package net.wayward_realms.waywardmoderation.vanish;

import net.wayward_realms.waywardmoderation.WaywardModeration;
import org.bukkit.entity.Player;

import java.util.HashSet;
import java.util.Set;

public class VanishManager {

    private WaywardModeration plugin;
    private Set<String> vanished = new HashSet<>();

    public VanishManager(WaywardModeration plugin) {
        this.plugin = plugin;
    }

    public boolean isVanished(Player player) {
        return vanished.contains(player.getName());
    }

    public void setVanished(Player player, boolean vanished) {
        if (vanished) {
            this.vanished.add(player.getName());
            for (Player player1 : plugin.getServer().getOnlinePlayers()) {
                if (!canSee(player1, player)) player1.hidePlayer(player);
            }
        } else {
            this.vanished.remove(player.getName());
            for (Player player1 : plugin.getServer().getOnlinePlayers()) {
                player1.showPlayer(player);
            }
        }
    }

    public Set<Player> getVanishedPlayers() {
        Set<Player> vanishedPlayers = new HashSet<>();
        for (String playerName : vanished) {
            if (plugin.getServer().getOfflinePlayer(playerName).isOnline()) {
                vanishedPlayers.add(plugin.getServer().getPlayer(playerName));
            }
        }
        return vanishedPlayers;
    }

    public boolean canSee(Player player, Player target) {
        if (!vanished.contains(target.getName())) return true;
        int playerTier = 4, targetTier = 4;
        if (player.hasPermission("wayward.moderation.vanish.see.tier3")) {
            playerTier = 3;
        }
        if (target.hasPermission("wayward.moderation.vanish.see.tier3")) {
            targetTier = 3;
        }
        if (player.hasPermission("wayward.moderation.vanish.see.tier2")) {
            playerTier = 2;
        }
        if (target.hasPermission("wayward.moderation.vanish.see.tier2")) {
            targetTier = 2;
        }
        if (player.hasPermission("wayward.moderation.vanish.see.tier1")) {
            playerTier = 1;
        }
        if (target.hasPermission("wayward.moderation.vanish.see.tier1")) {
            targetTier = 1;
        }
        return playerTier <= targetTier;
    }

}<commit_msg>Convert vanished to UUIDs, #94<commit_after>package net.wayward_realms.waywardmoderation.vanish;

import net.wayward_realms.waywardmoderation.WaywardModeration;
import org.bukkit.entity.Player;

import java.util.HashSet;
import java.util.Set;
import java.util.UUID;

public class VanishManager {

    private WaywardModeration plugin;
    private Set<UUID> vanished = new HashSet<>();

    public VanishManager(WaywardModeration plugin) {
        this.plugin = plugin;
    }

    public boolean isVanished(Player player) {
        return vanished.contains(player.getUniqueId());
    }

    public void setVanished(Player player, boolean vanished) {
        if (vanished) {
            this.vanished.add(player.getUniqueId());
            for (Player player1 : plugin.getServer().getOnlinePlayers()) {
                if (!canSee(player1, player)) player1.hidePlayer(player);
            }
        } else {
            this.vanished.remove(player.getUniqueId());
            for (Player player1 : plugin.getServer().getOnlinePlayers()) {
                player1.showPlayer(player);
            }
        }
    }

    public Set<Player> getVanishedPlayers() {
        Set<Player> vanishedPlayers = new HashSet<>();
        for (UUID uuid : vanished) {
            if (plugin.getServer().getOfflinePlayer(uuid).isOnline()) {
                vanishedPlayers.add(plugin.getServer().getPlayer(uuid));
            }
        }
        return vanishedPlayers;
    }

    public boolean canSee(Player player, Player target) {
        if (!vanished.contains(target.getUniqueId())) return true;
        int playerTier = 4, targetTier = 4;
        if (player.hasPermission("wayward.moderation.vanish.see.tier3")) {
            playerTier = 3;
        }
        if (target.hasPermission("wayward.moderation.vanish.see.tier3")) {
            targetTier = 3;
        }
        if (player.hasPermission("wayward.moderation.vanish.see.tier2")) {
            playerTier = 2;
        }
        if (target.hasPermission("wayward.moderation.vanish.see.tier2")) {
            targetTier = 2;
        }
        if (player.hasPermission("wayward.moderation.vanish.see.tier1")) {
            playerTier = 1;
        }
        if (target.hasPermission("wayward.moderation.vanish.see.tier1")) {
            targetTier = 1;
        }
        return playerTier <= targetTier;
    }

}
{'fraction_non_alphanumeric': 0.1157466837826273, 'fraction_numerical': 0.008557980316645272, 'mean_word_length': 2.3369022127052106, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7594813', 'n_tokens_mistral': 1423, 'n_tokens_neox': 1328, 'n_words': 234}