-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPlayerDataManager.java
More file actions
41 lines (32 loc) · 1.15 KB
/
PlayerDataManager.java
File metadata and controls
41 lines (32 loc) · 1.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
package com.imdrops.xhg;
import com.imdrops.xhg.kits.Kit;
import org.bukkit.entity.Player;
import java.util.HashMap;
import java.util.UUID;
public class PlayerDataManager {
private HashMap<UUID, PlayerData> allPlayerData = new HashMap<>();
public void addPlayer(Player p){
if (isPlayerAdded((p))){
System.out.println("Error! The Plugin tried to add a player that is already existing");
return;
}
allPlayerData.put(p.getUniqueId(), new PlayerData(p.getUniqueId()));
}
public boolean isPlayerAdded(Player p){
if (allPlayerData.get(p.getUniqueId()) == null){
return false;
}
return true;
}
public void registerKit(Player p, Kit k){
// if a old kit is selected
if (this.allPlayerData.get(p.getUniqueId()).getKit() != null) {
this.allPlayerData.get(p.getUniqueId()).getKit().onRemovePick();
}
this.allPlayerData.get(p.getUniqueId()).setKit(k);
k.onPick();
}
public Kit getKit(Player p){
return this.allPlayerData.get(p.getUniqueId()).getKit();
}
}