ButtonArchives/src/alisolarflare/gpowers/gPowerMemory.java

102 lines
2.7 KiB
Java
Raw Normal View History

package alisolarflare.gpowers;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
import org.bukkit.entity.Player;
import alisolarflare.AliPresents;
2016-10-22 02:26:57 +00:00
public class gPowerMemory{
@SuppressWarnings("unused")
private static AliPresents plugin;
2016-10-22 02:26:57 +00:00
@SuppressWarnings("unused")
private static boolean debugMode = true;
public gPowerMemory(AliPresents plugin){
gPowerMemory.plugin = plugin;
}
//SHORT TERM MEMORY STORAGE
2016-10-22 01:20:36 +00:00
public static Map<UUID, poweredPlayer> PlayerMap = new HashMap<UUID, poweredPlayer>();
//POWER ACTIVATION
2016-10-22 01:38:22 +00:00
public static void PowerUpPlayer(Player player, String colour){
2016-10-22 02:26:57 +00:00
//debug("POWERRRED UP");
player.sendMessage("POWERRED UP!");
2016-10-22 02:36:31 +00:00
PlayerMap.put(player.getUniqueId(), new poweredPlayer(player.getUniqueId(), colour, true));
}
2016-10-22 19:25:37 +00:00
public static void PowerUpPlayer(Player player){
//debug("POWERRRED UP");
player.sendMessage("POWERRED UP!");
if(PlayerMap.containsKey(player.getUniqueId())){
PlayerMap.get(player.getUniqueId()).isPowersActive = true;
}else{
player.sendMessage("You must instantiate your power settings using /gpowercommand");
}
}
//POWER DEACTIVATION
2016-10-22 01:38:22 +00:00
public static void PowerDownPlayer(Player player){
2016-10-22 02:26:57 +00:00
//debug("POWERRRED DOWN");
if (PlayerMap.containsKey(player.getUniqueId())){
2016-10-22 19:25:37 +00:00
PlayerMap.get(player.getUniqueId()).isPowersActive = false;
}else{
return;
}
}
2016-10-22 01:38:22 +00:00
public static void PowerDownPlayer(UUID UniqueID){
2016-10-22 02:26:57 +00:00
//debug("POWEERRED DOWN");
if (PlayerMap.containsKey(UniqueID)){
2016-10-22 19:25:37 +00:00
PlayerMap.get(UniqueID).isPowersActive = false;
}else{
return;
}
}
2016-10-22 01:38:22 +00:00
public static boolean isPlayerPowered(UUID UniqueID){
2016-10-22 02:26:57 +00:00
//debug("IS PLAYER POWERED?");
if (PlayerMap.containsKey(UniqueID)){
2016-10-22 19:25:37 +00:00
return PlayerMap.get(UniqueID).isPowersActive;
}else{
return false;
}
}
2016-10-22 01:38:22 +00:00
public static boolean isPlayerPowered(Player player){
2016-10-22 02:26:57 +00:00
//debug("IS PLAYER POWERED?");
if (PlayerMap.containsKey(player.getUniqueId())){
2016-10-22 19:25:37 +00:00
return PlayerMap.get(player.getUniqueId()).isPowersActive;
}else{
return false;
}
}
//MEMORY UNIT
2016-10-22 01:38:22 +00:00
public static class poweredPlayer{
2016-10-22 19:25:37 +00:00
public static UUID uuid;
public String colour;
2016-10-22 19:25:37 +00:00
public Boolean isPowersActive;
2016-10-22 21:47:10 +00:00
@SuppressWarnings("static-access")
public poweredPlayer(UUID uuid, String colour, Boolean activated){
this.uuid = (uuid);
this.colour = (colour);
2016-10-22 19:25:37 +00:00
this.isPowersActive = (activated);
}
public String toString(){
2016-10-22 19:25:37 +00:00
return "[UUID: "+ uuid.toString() + ", Colour: "+ colour+", IsActivated: "+isPowersActive + "]";
}
}
2016-10-22 01:20:36 +00:00
2016-10-22 19:25:37 +00:00
public void saveMemoryState(){
Map<UUID, poweredPlayer> PlayerMap = new HashMap<UUID, poweredPlayer>();
2016-10-22 21:47:10 +00:00
//for (UUID uuidKey:PlayerMap.keySet()){
2016-10-22 19:25:37 +00:00
2016-10-22 21:47:10 +00:00
//UUID uuidToSave = poweredPlayer.uuid;
2016-10-22 19:25:37 +00:00
2016-10-22 21:47:10 +00:00
//}
2016-10-22 19:25:37 +00:00
}
public void loadMemoryState(){
}
}