<commit_before>package com.ttaylorr.uhc.pvp.services.core;

import com.ttaylorr.uhc.pvp.Feature;
import com.ttaylorr.uhc.pvp.PVPManagerPlugin;
import com.ttaylorr.uhc.pvp.services.LobbyManager;
import com.ttaylorr.uhc.pvp.services.PVPManager;
import com.ttaylorr.uhc.pvp.services.UserManager;
import com.ttaylorr.uhc.pvp.services.core.usermanager.Listeners;
import com.ttaylorr.uhc.pvp.services.util.PlayerDataManager;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;

public class UHCUserManager extends UHCServiceBase implements UserManager, Feature {
    private final PlayerDataManager dataManager;
    private PVPManager pvpManager;
    private LobbyManager lobbyManager;

    private Listeners listener;

    public UHCUserManager(PVPManagerPlugin plugin) {
        super(plugin);
        dataManager = getPlugin().getDataManager();
    }

    @Override
    public boolean onEnable() {
        pvpManager = (PVPManager) Bukkit.getServicesManager().getRegistration(PVPManager.class);
        lobbyManager = (LobbyManager) Bukkit.getServicesManager().getRegistration(LobbyManager.class);

        listener = new Listeners(this);
        Bukkit.getPluginManager().registerEvents(listener, getPlugin());
        return true;
    }

    public void onDisable() {
        // TODO Auto-generated method stub
    }

    public void subscribe(Player player) {
        getUserData(player).subscribed = true;
    }

    public void unsubscribe(Player player) {
        getUserData(player).subscribed = false;
    }

    private UserData getUserData(Player player) {
        return dataManager.get(player, UserData.class);
    }

    static class UserData {
        public boolean subscribed;
    }
}<commit_msg>Added a gamemode variable to the UHCUserManager.UserData, and made sure to exit/leave properly.<commit_after>package com.ttaylorr.uhc.pvp.services.core;

import com.ttaylorr.uhc.pvp.Feature;
import com.ttaylorr.uhc.pvp.PVPManagerPlugin;
import com.ttaylorr.uhc.pvp.services.GameMode;
import com.ttaylorr.uhc.pvp.services.LobbyManager;
import com.ttaylorr.uhc.pvp.services.PVPManager;
import com.ttaylorr.uhc.pvp.services.UserManager;
import com.ttaylorr.uhc.pvp.services.core.usermanager.Listeners;
import com.ttaylorr.uhc.pvp.services.util.PlayerDataManager;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;

public class UHCUserManager extends UHCServiceBase implements UserManager, Feature {
    private final PlayerDataManager dataManager;
    private PVPManager pvpManager;
    private LobbyManager lobbyManager;

    private Listeners listener;

    public UHCUserManager(PVPManagerPlugin plugin) {
        super(plugin);
        dataManager = getPlugin().getDataManager();
    }

    @Override
    public boolean onEnable() {
        pvpManager = (PVPManager) Bukkit.getServicesManager().getRegistration(PVPManager.class);
        lobbyManager = (LobbyManager) Bukkit.getServicesManager().getRegistration(LobbyManager.class);

        listener = new Listeners(this);
        Bukkit.getPluginManager().registerEvents(listener, getPlugin());
        return true;
    }

    public void onDisable() {

    }

    public void subscribe(Player player) {
        lobbyManager.enter(player);
        getUserData(player).gameMode = lobbyManager;
    }

    public void unsubscribe(Player player) {
        UserData userData = getUserData(player);
        userData.gameMode.exit(player);
    }

    private UserData getUserData(Player player) {
        return dataManager.get(player, UserData.class);
    }

    static class UserData {
        public GameMode gameMode;

        public boolean isSubscribed() {
            return gameMode != null;
        }
    }
}
{'fraction_non_alphanumeric': 0.09270805096232042, 'fraction_numerical': 0.0, 'mean_word_length': 3.6532156368221944, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '982587', 'n_tokens_mistral': 1128, 'n_tokens_neox': 1092, 'n_words': 211}