From 09526c382044995d03875630cfdc1f8b6b1cedfa Mon Sep 17 00:00:00 2001 From: alisolarflare Date: Fri, 21 Oct 2016 22:26:57 -0400 Subject: [PATCH] Created Working Behaviour --- src/alisolarflare/AliPresents.java | 2 +- src/alisolarflare/gpowers/gPowerMemory.java | 19 +++++++++++-------- .../gpowers/listeners/gPowerApplyingTask.java | 5 ++++- .../gpowers/listeners/gPowerListener.java | 2 +- 4 files changed, 17 insertions(+), 11 deletions(-) diff --git a/src/alisolarflare/AliPresents.java b/src/alisolarflare/AliPresents.java index 50b1084..5a89570 100644 --- a/src/alisolarflare/AliPresents.java +++ b/src/alisolarflare/AliPresents.java @@ -39,7 +39,7 @@ public class AliPresents extends JavaPlugin{ //alilinksubplugin.register(); } public void registerCommands(){ - getCommand("gPowerCommand").setExecutor(new gPowerCommand()); + 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/gPowerMemory.java b/src/alisolarflare/gpowers/gPowerMemory.java index 437d4a4..61f461d 100644 --- a/src/alisolarflare/gpowers/gPowerMemory.java +++ b/src/alisolarflare/gpowers/gPowerMemory.java @@ -8,8 +8,10 @@ import org.bukkit.entity.Player; import alisolarflare.AliPresents; -public class gPowerMemory { +public class gPowerMemory{ + @SuppressWarnings("unused") private static AliPresents plugin; + @SuppressWarnings("unused") private static boolean debugMode = true; public gPowerMemory(AliPresents plugin){ gPowerMemory.plugin = plugin; @@ -19,7 +21,8 @@ public class gPowerMemory { //POWER ACTIVATION public static void PowerUpPlayer(Player player, String colour){ - debug("POWERRRED UP"); + //debug("POWERRRED UP"); + player.sendMessage("POWERRED UP!"); if (PlayerMap.containsKey(player.getUniqueId())){ PlayerMap.get(player.getUniqueId()).playerPowersActivated = true; }else{ @@ -29,7 +32,7 @@ public class gPowerMemory { //POWER DEACTIVATION public static void PowerDownPlayer(Player player){ - debug("POWERRRED DOWN"); + //debug("POWERRRED DOWN"); if (PlayerMap.containsKey(player.getUniqueId())){ PlayerMap.get(player.getUniqueId()).playerPowersActivated = false; }else{ @@ -38,7 +41,7 @@ public class gPowerMemory { } public static void PowerDownPlayer(UUID UniqueID){ - debug("POWEERRED DOWN"); + //debug("POWEERRED DOWN"); if (PlayerMap.containsKey(UniqueID)){ PlayerMap.get(UniqueID).playerPowersActivated = false; }else{ @@ -46,7 +49,7 @@ public class gPowerMemory { } } public static boolean isPlayerPowered(UUID UniqueID){ - debug("IS PLAYER POWERED?"); + //debug("IS PLAYER POWERED?"); if (PlayerMap.containsKey(UniqueID)){ return PlayerMap.get(UniqueID).playerPowersActivated; }else{ @@ -54,7 +57,7 @@ public class gPowerMemory { } } public static boolean isPlayerPowered(Player player){ - debug("IS PLAYER POWERED?"); + //debug("IS PLAYER POWERED?"); if (PlayerMap.containsKey(player.getUniqueId())){ return PlayerMap.get(player.getUniqueId()).playerPowersActivated; }else{ @@ -77,12 +80,12 @@ public class gPowerMemory { } } - //DEBUG + /*DEBUG @SuppressWarnings({ "deprecation" }) 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/listeners/gPowerApplyingTask.java b/src/alisolarflare/gpowers/listeners/gPowerApplyingTask.java index e281815..381d309 100644 --- a/src/alisolarflare/gpowers/listeners/gPowerApplyingTask.java +++ b/src/alisolarflare/gpowers/listeners/gPowerApplyingTask.java @@ -21,6 +21,8 @@ public class gPowerApplyingTask extends BukkitRunnable{ @Override public void run() { for (Player player : plugin.getServer().getOnlinePlayers()){ + player.sendMessage(player.getUniqueId().toString()); + player.sendMessage(gPowerMemory.PlayerMap.toString()); if(gPowerMemory.PlayerMap.containsKey(player.getUniqueId())){ activatePower(player, gPowerMemory.PlayerMap.get(player.getUniqueId()).colour); } @@ -46,7 +48,8 @@ public class gPowerApplyingTask extends BukkitRunnable{ player.addPotionEffect(new PotionEffect(PotionEffectType.WATER_BREATHING, 100, 1, true, false, Color.GRAY)); }else if (colour.startsWith("p")){ player.addPotionEffect(new PotionEffect(PotionEffectType.HEALTH_BOOST, 100, 1, true, false, Color.GRAY)); - } + }else{ + } } } diff --git a/src/alisolarflare/gpowers/listeners/gPowerListener.java b/src/alisolarflare/gpowers/listeners/gPowerListener.java index 94588b4..c2ea39d 100644 --- a/src/alisolarflare/gpowers/listeners/gPowerListener.java +++ b/src/alisolarflare/gpowers/listeners/gPowerListener.java @@ -12,7 +12,7 @@ public class gPowerListener implements Listener{ public gPowerListener(AliPresents plugin){ this.plugin = plugin; this.powerApplyingTask = new gPowerApplyingTask(this.plugin); - bukkitTask = powerApplyingTask.runTaskTimer(plugin, 5, 5); + bukkitTask = powerApplyingTask.runTaskTimer(plugin, 100, 100); } }