From ede758e2b5c1e443df50c8073d094a967b4e2a57 Mon Sep 17 00:00:00 2001 From: alisolarflare Date: Fri, 21 Oct 2016 21:38:22 -0400 Subject: [PATCH] Finished Testing Command --- src/alisolarflare/gpowers/gPowerCommand.java | 29 ++++++++++++++++++- src/alisolarflare/gpowers/gPowerMemory.java | 12 ++++---- .../gpowers/listeners/gPowerApplyingTask.java | 2 +- 3 files changed, 35 insertions(+), 8 deletions(-) diff --git a/src/alisolarflare/gpowers/gPowerCommand.java b/src/alisolarflare/gpowers/gPowerCommand.java index fc9ad00..1f4bb5c 100644 --- a/src/alisolarflare/gpowers/gPowerCommand.java +++ b/src/alisolarflare/gpowers/gPowerCommand.java @@ -19,7 +19,34 @@ public class gPowerCommand implements CommandExecutor{ player.sendMessage("/gpowertest [colour=red,orange,yellow,green,blue,purple] [active=true/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; } diff --git a/src/alisolarflare/gpowers/gPowerMemory.java b/src/alisolarflare/gpowers/gPowerMemory.java index 7d0ad73..63fa6a6 100644 --- a/src/alisolarflare/gpowers/gPowerMemory.java +++ b/src/alisolarflare/gpowers/gPowerMemory.java @@ -18,7 +18,7 @@ public class gPowerMemory { public static Map PlayerMap = new HashMap(); //POWER ACTIVATION - public void PowerUpPlayer(Player player, String colour){ + public static void PowerUpPlayer(Player player, String colour){ if (PlayerMap.containsKey(player.getUniqueId())){ PlayerMap.get(player.getUniqueId()).playerPowersActivated = true; }else{ @@ -27,7 +27,7 @@ public class gPowerMemory { } //POWER DEACTIVATION - public void PowerDownPlayer(Player player){ + public static void PowerDownPlayer(Player player){ if (PlayerMap.containsKey(player.getUniqueId())){ PlayerMap.get(player.getUniqueId()).playerPowersActivated = false; }else{ @@ -35,21 +35,21 @@ public class gPowerMemory { } } - public void PowerDownPlayer(UUID UniqueID){ + public static void PowerDownPlayer(UUID UniqueID){ if (PlayerMap.containsKey(UniqueID)){ PlayerMap.get(UniqueID).playerPowersActivated = false; }else{ return; } } - public boolean isPlayerPowered(UUID UniqueID){ + public static boolean isPlayerPowered(UUID UniqueID){ if (PlayerMap.containsKey(UniqueID)){ return PlayerMap.get(UniqueID).playerPowersActivated; }else{ return false; } } - public boolean isPlayerPowered(Player player){ + public static boolean isPlayerPowered(Player player){ if (PlayerMap.containsKey(player.getUniqueId())){ return PlayerMap.get(player.getUniqueId()).playerPowersActivated; }else{ @@ -57,7 +57,7 @@ public class gPowerMemory { } } //MEMORY UNIT - public class poweredPlayer{ + public static class poweredPlayer{ public UUID uuid; public String colour; public Boolean playerPowersActivated; diff --git a/src/alisolarflare/gpowers/listeners/gPowerApplyingTask.java b/src/alisolarflare/gpowers/listeners/gPowerApplyingTask.java index 2ca8aca..e281815 100644 --- a/src/alisolarflare/gpowers/listeners/gPowerApplyingTask.java +++ b/src/alisolarflare/gpowers/listeners/gPowerApplyingTask.java @@ -11,7 +11,7 @@ import alisolarflare.gpowers.gPowerMemory; public class gPowerApplyingTask extends BukkitRunnable{ - private AliPresents plugin;; + private AliPresents plugin; public gPowerApplyingTask(AliPresents plugin) { this.plugin = plugin;