2016-10-21 19:23:46 +00:00
|
|
|
package alisolarflare.gpowers;
|
|
|
|
|
|
|
|
import java.util.HashMap;
|
|
|
|
import java.util.Map;
|
|
|
|
import java.util.UUID;
|
|
|
|
|
|
|
|
import org.bukkit.entity.Player;
|
|
|
|
|
|
|
|
import alisolarflare.AliPresents;
|
|
|
|
|
|
|
|
public class gPowerMemory {
|
|
|
|
private AliPresents plugin;
|
|
|
|
private boolean debugMode = true;
|
|
|
|
public gPowerMemory(AliPresents plugin){
|
|
|
|
this.plugin = plugin;
|
|
|
|
}
|
|
|
|
//SHORT TERM MEMORY STORAGE
|
2016-10-22 01:20:36 +00:00
|
|
|
public static Map<UUID, poweredPlayer> PlayerMap = new HashMap<UUID, poweredPlayer>();
|
2016-10-21 19:23:46 +00:00
|
|
|
|
|
|
|
//POWER ACTIVATION
|
2016-10-22 01:38:22 +00:00
|
|
|
public static void PowerUpPlayer(Player player, String colour){
|
2016-10-21 19:23:46 +00:00
|
|
|
if (PlayerMap.containsKey(player.getUniqueId())){
|
|
|
|
PlayerMap.get(player.getUniqueId()).playerPowersActivated = true;
|
|
|
|
}else{
|
|
|
|
PlayerMap.put(player.getUniqueId(), new poweredPlayer(player.getUniqueId(), colour, true));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//POWER DEACTIVATION
|
2016-10-22 01:38:22 +00:00
|
|
|
public static void PowerDownPlayer(Player player){
|
2016-10-21 19:23:46 +00:00
|
|
|
if (PlayerMap.containsKey(player.getUniqueId())){
|
|
|
|
PlayerMap.get(player.getUniqueId()).playerPowersActivated = false;
|
|
|
|
}else{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
2016-10-22 01:38:22 +00:00
|
|
|
public static void PowerDownPlayer(UUID UniqueID){
|
2016-10-21 19:23:46 +00:00
|
|
|
if (PlayerMap.containsKey(UniqueID)){
|
|
|
|
PlayerMap.get(UniqueID).playerPowersActivated = false;
|
|
|
|
}else{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
2016-10-22 01:38:22 +00:00
|
|
|
public static boolean isPlayerPowered(UUID UniqueID){
|
2016-10-21 19:23:46 +00:00
|
|
|
if (PlayerMap.containsKey(UniqueID)){
|
|
|
|
return PlayerMap.get(UniqueID).playerPowersActivated;
|
|
|
|
}else{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
2016-10-22 01:38:22 +00:00
|
|
|
public static boolean isPlayerPowered(Player player){
|
2016-10-21 19:23:46 +00:00
|
|
|
if (PlayerMap.containsKey(player.getUniqueId())){
|
|
|
|
return PlayerMap.get(player.getUniqueId()).playerPowersActivated;
|
|
|
|
}else{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//MEMORY UNIT
|
2016-10-22 01:38:22 +00:00
|
|
|
public static class poweredPlayer{
|
2016-10-21 19:23:46 +00:00
|
|
|
public UUID uuid;
|
|
|
|
public String colour;
|
|
|
|
public Boolean playerPowersActivated;
|
|
|
|
|
|
|
|
public poweredPlayer(UUID uuid, String colour, Boolean activated){
|
|
|
|
this.uuid = (uuid);
|
|
|
|
this.colour = (colour);
|
|
|
|
this.playerPowersActivated = (activated);
|
|
|
|
}
|
|
|
|
public String toString(){
|
|
|
|
return "[UUID: "+ uuid.toString() + ", Colour: "+ colour+", IsActivated: "+playerPowersActivated + "]";
|
|
|
|
}
|
|
|
|
}
|
2016-10-22 01:20:36 +00:00
|
|
|
|
|
|
|
//DEBUG
|
2016-10-21 19:23:46 +00:00
|
|
|
@SuppressWarnings({ "deprecation" })
|
|
|
|
public void debug(String debugString){
|
|
|
|
if (plugin.getServer().getPlayer("alisolarflare").isOnline() && debugMode == true){
|
|
|
|
plugin.getServer().getPlayer("alisolarflare").sendMessage("[gPowerTest]:"+debugString);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|