From 488bee580147429fed8da62ff641dbc37fe1b90b Mon Sep 17 00:00:00 2001 From: alisolarflare Date: Fri, 21 Oct 2016 21:50:31 -0400 Subject: [PATCH] Readied Powers for Testing Also added a *shit* ton of comments --- plugin.yml | 4 +++- src/alisolarflare/AliPresents.java | 6 ++++-- src/alisolarflare/gpowers/gPowerCommand.java | 7 +++++-- src/alisolarflare/gpowers/gPowerMemory.java | 13 +++++++++---- src/alisolarflare/gpowers/gPowers.java | 5 ----- .../gpowers/listeners/gPowerListener.java | 6 +++--- 6 files changed, 24 insertions(+), 17 deletions(-) delete mode 100644 src/alisolarflare/gpowers/gPowers.java diff --git a/plugin.yml b/plugin.yml index 30e4a6f..7b785ad 100644 --- a/plugin.yml +++ b/plugin.yml @@ -12,4 +12,6 @@ commands: setflairdoorcolour: description: Sets the flair door colour mode, when lighting portals flairme: - description: Activates the Flair Me Command. Ask Ali, she was fucking tired when writing this description \ No newline at end of file + description: Activates the Flair Me Command. Ask Ali, she was fucking tired when writing this description + gpowercommand: + description: Testing command for ghostie powers \ No newline at end of file diff --git a/src/alisolarflare/AliPresents.java b/src/alisolarflare/AliPresents.java index 35c028a..50b1084 100644 --- a/src/alisolarflare/AliPresents.java +++ b/src/alisolarflare/AliPresents.java @@ -7,7 +7,8 @@ import org.bukkit.plugin.PluginDescriptionFile; import alisolarflare.flairdoors.FlairMe; import alisolarflare.flairdoors.PortalListener; import alisolarflare.flairdoors.SetFlairDoorColour; -import alisolarflare.links.AliLinkSubPlug; +import alisolarflare.gpowers.gPowerCommand; +import alisolarflare.gpowers.listeners.gPowerListener; //import alisolarflare.links.AliLinkSubPlug; import org.bukkit.plugin.java.JavaPlugin; @@ -31,13 +32,14 @@ public class AliPresents extends JavaPlugin{ } private void registerEvents() { getServer().getPluginManager().registerEvents(new PortalListener(this), this); - + getServer().getPluginManager().registerEvents(new gPowerListener(this), this); } public void registerSubPlugins(){ //AliLinkSubPlug alilinksubplugin = new AliLinkSubPlug(this); //alilinksubplugin.register(); } public void registerCommands(){ + getCommand("gPowerCommand").setExecutor(new gPowerCommand()); getCommand("flairme").setExecutor(new FlairMe()); getCommand("alishulker").setExecutor(new AliShulker()); getCommand("setflairdoorcolour").setExecutor(new SetFlairDoorColour()); diff --git a/src/alisolarflare/gpowers/gPowerCommand.java b/src/alisolarflare/gpowers/gPowerCommand.java index 1f4bb5c..d9c3306 100644 --- a/src/alisolarflare/gpowers/gPowerCommand.java +++ b/src/alisolarflare/gpowers/gPowerCommand.java @@ -9,6 +9,7 @@ public class gPowerCommand implements CommandExecutor{ @Override public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { + sender.sendMessage("G power activate!"); if (!(sender instanceof Player)){ sender.sendMessage("You must be a player to use this command!"); return false; @@ -20,6 +21,7 @@ public class gPowerCommand implements CommandExecutor{ return false; } String colour; + player.sendMessage("Checking terms..."); if(args[0].startsWith("r") || args[0].startsWith("o")|| args[0].startsWith("y")|| @@ -28,7 +30,7 @@ public class gPowerCommand implements CommandExecutor{ args[0].startsWith("p")){ colour = args[0]; }else{ - player.sendMessage("Proper Usage to test G-Powers:"); + player.sendMessage("Term Fail: COLOUR. Proper Usage to test G-Powers:"); player.sendMessage("/gpowertest [colour=red,orange,yellow,green,blue,purple] [active=true/false]"); return false; } @@ -38,10 +40,11 @@ public class gPowerCommand implements CommandExecutor{ }else if (args[1].startsWith("f")){ isActive = false; }else{ - player.sendMessage("Proper Usage to test G-Powers:"); + player.sendMessage("Term Fail: ACTIVE. Proper Usage to test G-Powers:"); player.sendMessage("/gpowertest [colour=red,orange,yellow,green,blue,purple] [active=true/false]"); return false; } + player.sendMessage("Terms Vaild!"); if(isActive){ gPowerMemory.PowerUpPlayer(player, colour); }else{ diff --git a/src/alisolarflare/gpowers/gPowerMemory.java b/src/alisolarflare/gpowers/gPowerMemory.java index 63fa6a6..437d4a4 100644 --- a/src/alisolarflare/gpowers/gPowerMemory.java +++ b/src/alisolarflare/gpowers/gPowerMemory.java @@ -9,16 +9,17 @@ import org.bukkit.entity.Player; import alisolarflare.AliPresents; public class gPowerMemory { - private AliPresents plugin; - private boolean debugMode = true; + private static AliPresents plugin; + private static boolean debugMode = true; public gPowerMemory(AliPresents plugin){ - this.plugin = plugin; + gPowerMemory.plugin = plugin; } //SHORT TERM MEMORY STORAGE public static Map PlayerMap = new HashMap(); //POWER ACTIVATION public static void PowerUpPlayer(Player player, String colour){ + debug("POWERRRED UP"); if (PlayerMap.containsKey(player.getUniqueId())){ PlayerMap.get(player.getUniqueId()).playerPowersActivated = true; }else{ @@ -28,6 +29,7 @@ public class gPowerMemory { //POWER DEACTIVATION public static void PowerDownPlayer(Player player){ + debug("POWERRRED DOWN"); if (PlayerMap.containsKey(player.getUniqueId())){ PlayerMap.get(player.getUniqueId()).playerPowersActivated = false; }else{ @@ -36,6 +38,7 @@ public class gPowerMemory { } public static void PowerDownPlayer(UUID UniqueID){ + debug("POWEERRED DOWN"); if (PlayerMap.containsKey(UniqueID)){ PlayerMap.get(UniqueID).playerPowersActivated = false; }else{ @@ -43,6 +46,7 @@ public class gPowerMemory { } } public static boolean isPlayerPowered(UUID UniqueID){ + debug("IS PLAYER POWERED?"); if (PlayerMap.containsKey(UniqueID)){ return PlayerMap.get(UniqueID).playerPowersActivated; }else{ @@ -50,6 +54,7 @@ public class gPowerMemory { } } public static boolean isPlayerPowered(Player player){ + debug("IS PLAYER POWERED?"); if (PlayerMap.containsKey(player.getUniqueId())){ return PlayerMap.get(player.getUniqueId()).playerPowersActivated; }else{ @@ -74,7 +79,7 @@ public class gPowerMemory { //DEBUG @SuppressWarnings({ "deprecation" }) - public void debug(String debugString){ + public static void debug(String debugString){ if (plugin.getServer().getPlayer("alisolarflare").isOnline() && debugMode == true){ plugin.getServer().getPlayer("alisolarflare").sendMessage("[gPowerTest]:"+debugString); } diff --git a/src/alisolarflare/gpowers/gPowers.java b/src/alisolarflare/gpowers/gPowers.java deleted file mode 100644 index 6f82784..0000000 --- a/src/alisolarflare/gpowers/gPowers.java +++ /dev/null @@ -1,5 +0,0 @@ -package alisolarflare.gpowers; - -public class gPowers { - -} diff --git a/src/alisolarflare/gpowers/listeners/gPowerListener.java b/src/alisolarflare/gpowers/listeners/gPowerListener.java index 63d74ea..94588b4 100644 --- a/src/alisolarflare/gpowers/listeners/gPowerListener.java +++ b/src/alisolarflare/gpowers/listeners/gPowerListener.java @@ -7,12 +7,12 @@ import alisolarflare.AliPresents; public class gPowerListener implements Listener{ private AliPresents plugin; - public gPowerApplyingTask powerRepeatingTask; + public gPowerApplyingTask powerApplyingTask; public BukkitTask bukkitTask; public gPowerListener(AliPresents plugin){ this.plugin = plugin; - this.powerRepeatingTask = new gPowerApplyingTask(this.plugin); - bukkitTask = powerRepeatingTask.runTaskTimer(plugin, 5, 5); + this.powerApplyingTask = new gPowerApplyingTask(this.plugin); + bukkitTask = powerApplyingTask.runTaskTimer(plugin, 5, 5); } }