package com.yaohun.demonskills.manage;

import com.yaohun.demonskills.data.PlayerData;

import java.util.HashMap;

public class PlayerManager {

    private HashMap<String, PlayerData> playerDataMap = new HashMap<>();

    public PlayerManager() {

    }

    public void SaveAllPlayerData() {
        for (PlayerData playerData : playerDataMap.values()) {
            playerData.SavePlayerData();
        }
    }

    public PlayerData getPlayerData(String playerName) {
        if(!playerDataMap.containsKey(playerName)) {
            this.playerDataMap.put(playerName, new PlayerData(playerName));
        }
        return playerDataMap.get(playerName);
    }
}
