All Downloads are FREE. Search and download functionalities are using the official Maven repository.

de.epsdev.bungeeautoserver.api.PlayerManager Maven / Gradle / Ivy

The newest version!
package de.epsdev.bungeeautoserver.api;

import de.epsdev.bungeeautoserver.api.interfaces.PlayerStatusEmitter;

import java.util.HashMap;

public class PlayerManager {

    public static HashMap players = new HashMap<>();
    public static PlayerStatusEmitter playerStatusEmitter;

    public static void changePlayerServer(String server, String playername){
        if(players.containsKey(playername)){
            ServerManager.removeFromServer(playername, players.get(playername));
            players.replace(playername, server);
        }else {
            players.put(playername, server);
        }

        playerStatusEmitter.onPlayerServerChange(playername, server);
    }

    public static void onPlayerDisconnect(String playername){
        ServerManager.removeFromServer(playername, players.get(playername));
        players.remove(playername);
    }


}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy