Finished Testing Command

This commit is contained in:
alisolarflare 2016-10-21 21:38:22 -04:00
parent 587586bd90
commit ede758e2b5
3 changed files with 35 additions and 8 deletions

View file

@ -19,7 +19,34 @@ public class gPowerCommand implements CommandExecutor{
player.sendMessage("/gpowertest [colour=red,orange,yellow,green,blue,purple] [active=true/false]"); player.sendMessage("/gpowertest [colour=red,orange,yellow,green,blue,purple] [active=true/false]");
return false; return false;
} }
String colour;
if(args[0].startsWith("r") ||
args[0].startsWith("o")||
args[0].startsWith("y")||
args[0].startsWith("g")||
args[0].startsWith("b")||
args[0].startsWith("p")){
colour = args[0];
}else{
player.sendMessage("Proper Usage to test G-Powers:");
player.sendMessage("/gpowertest [colour=red,orange,yellow,green,blue,purple] [active=true/false]");
return false;
}
boolean isActive;
if(args[1].startsWith("t")){
isActive = true;
}else if (args[1].startsWith("f")){
isActive = false;
}else{
player.sendMessage("Proper Usage to test G-Powers:");
player.sendMessage("/gpowertest [colour=red,orange,yellow,green,blue,purple] [active=true/false]");
return false;
}
if(isActive){
gPowerMemory.PowerUpPlayer(player, colour);
}else{
gPowerMemory.PowerDownPlayer(player);
}
return false; return false;
} }

View file

@ -18,7 +18,7 @@ public class gPowerMemory {
public static Map<UUID, poweredPlayer> PlayerMap = new HashMap<UUID, poweredPlayer>(); public static Map<UUID, poweredPlayer> PlayerMap = new HashMap<UUID, poweredPlayer>();
//POWER ACTIVATION //POWER ACTIVATION
public void PowerUpPlayer(Player player, String colour){ public static void PowerUpPlayer(Player player, String colour){
if (PlayerMap.containsKey(player.getUniqueId())){ if (PlayerMap.containsKey(player.getUniqueId())){
PlayerMap.get(player.getUniqueId()).playerPowersActivated = true; PlayerMap.get(player.getUniqueId()).playerPowersActivated = true;
}else{ }else{
@ -27,7 +27,7 @@ public class gPowerMemory {
} }
//POWER DEACTIVATION //POWER DEACTIVATION
public void PowerDownPlayer(Player player){ public static void PowerDownPlayer(Player player){
if (PlayerMap.containsKey(player.getUniqueId())){ if (PlayerMap.containsKey(player.getUniqueId())){
PlayerMap.get(player.getUniqueId()).playerPowersActivated = false; PlayerMap.get(player.getUniqueId()).playerPowersActivated = false;
}else{ }else{
@ -35,21 +35,21 @@ public class gPowerMemory {
} }
} }
public void PowerDownPlayer(UUID UniqueID){ public static void PowerDownPlayer(UUID UniqueID){
if (PlayerMap.containsKey(UniqueID)){ if (PlayerMap.containsKey(UniqueID)){
PlayerMap.get(UniqueID).playerPowersActivated = false; PlayerMap.get(UniqueID).playerPowersActivated = false;
}else{ }else{
return; return;
} }
} }
public boolean isPlayerPowered(UUID UniqueID){ public static boolean isPlayerPowered(UUID UniqueID){
if (PlayerMap.containsKey(UniqueID)){ if (PlayerMap.containsKey(UniqueID)){
return PlayerMap.get(UniqueID).playerPowersActivated; return PlayerMap.get(UniqueID).playerPowersActivated;
}else{ }else{
return false; return false;
} }
} }
public boolean isPlayerPowered(Player player){ public static boolean isPlayerPowered(Player player){
if (PlayerMap.containsKey(player.getUniqueId())){ if (PlayerMap.containsKey(player.getUniqueId())){
return PlayerMap.get(player.getUniqueId()).playerPowersActivated; return PlayerMap.get(player.getUniqueId()).playerPowersActivated;
}else{ }else{
@ -57,7 +57,7 @@ public class gPowerMemory {
} }
} }
//MEMORY UNIT //MEMORY UNIT
public class poweredPlayer{ public static class poweredPlayer{
public UUID uuid; public UUID uuid;
public String colour; public String colour;
public Boolean playerPowersActivated; public Boolean playerPowersActivated;

View file

@ -11,7 +11,7 @@ import alisolarflare.gpowers.gPowerMemory;
public class gPowerApplyingTask extends BukkitRunnable{ public class gPowerApplyingTask extends BukkitRunnable{
private AliPresents plugin;; private AliPresents plugin;
public gPowerApplyingTask(AliPresents plugin) { public gPowerApplyingTask(AliPresents plugin) {
this.plugin = plugin; this.plugin = plugin;