Created Working Behaviour

This commit is contained in:
alisolarflare 2016-10-21 22:26:57 -04:00
parent 5962a486cb
commit 09526c3820
4 changed files with 17 additions and 11 deletions

View file

@ -39,7 +39,7 @@ public class AliPresents extends JavaPlugin{
//alilinksubplugin.register(); //alilinksubplugin.register();
} }
public void registerCommands(){ public void registerCommands(){
getCommand("gPowerCommand").setExecutor(new gPowerCommand()); getCommand("gpowercommand").setExecutor(new gPowerCommand());
getCommand("flairme").setExecutor(new FlairMe()); getCommand("flairme").setExecutor(new FlairMe());
getCommand("alishulker").setExecutor(new AliShulker()); getCommand("alishulker").setExecutor(new AliShulker());
getCommand("setflairdoorcolour").setExecutor(new SetFlairDoorColour()); getCommand("setflairdoorcolour").setExecutor(new SetFlairDoorColour());

View file

@ -8,8 +8,10 @@ import org.bukkit.entity.Player;
import alisolarflare.AliPresents; import alisolarflare.AliPresents;
public class gPowerMemory { public class gPowerMemory{
@SuppressWarnings("unused")
private static AliPresents plugin; private static AliPresents plugin;
@SuppressWarnings("unused")
private static boolean debugMode = true; private static boolean debugMode = true;
public gPowerMemory(AliPresents plugin){ public gPowerMemory(AliPresents plugin){
gPowerMemory.plugin = plugin; gPowerMemory.plugin = plugin;
@ -19,7 +21,8 @@ public class gPowerMemory {
//POWER ACTIVATION //POWER ACTIVATION
public static void PowerUpPlayer(Player player, String colour){ public static void PowerUpPlayer(Player player, String colour){
debug("POWERRRED UP"); //debug("POWERRRED UP");
player.sendMessage("POWERRED UP!");
if (PlayerMap.containsKey(player.getUniqueId())){ if (PlayerMap.containsKey(player.getUniqueId())){
PlayerMap.get(player.getUniqueId()).playerPowersActivated = true; PlayerMap.get(player.getUniqueId()).playerPowersActivated = true;
}else{ }else{
@ -29,7 +32,7 @@ public class gPowerMemory {
//POWER DEACTIVATION //POWER DEACTIVATION
public static void PowerDownPlayer(Player player){ public static void PowerDownPlayer(Player player){
debug("POWERRRED DOWN"); //debug("POWERRRED DOWN");
if (PlayerMap.containsKey(player.getUniqueId())){ if (PlayerMap.containsKey(player.getUniqueId())){
PlayerMap.get(player.getUniqueId()).playerPowersActivated = false; PlayerMap.get(player.getUniqueId()).playerPowersActivated = false;
}else{ }else{
@ -38,7 +41,7 @@ public class gPowerMemory {
} }
public static void PowerDownPlayer(UUID UniqueID){ public static void PowerDownPlayer(UUID UniqueID){
debug("POWEERRED DOWN"); //debug("POWEERRED DOWN");
if (PlayerMap.containsKey(UniqueID)){ if (PlayerMap.containsKey(UniqueID)){
PlayerMap.get(UniqueID).playerPowersActivated = false; PlayerMap.get(UniqueID).playerPowersActivated = false;
}else{ }else{
@ -46,7 +49,7 @@ public class gPowerMemory {
} }
} }
public static boolean isPlayerPowered(UUID UniqueID){ public static boolean isPlayerPowered(UUID UniqueID){
debug("IS PLAYER POWERED?"); //debug("IS PLAYER POWERED?");
if (PlayerMap.containsKey(UniqueID)){ if (PlayerMap.containsKey(UniqueID)){
return PlayerMap.get(UniqueID).playerPowersActivated; return PlayerMap.get(UniqueID).playerPowersActivated;
}else{ }else{
@ -54,7 +57,7 @@ public class gPowerMemory {
} }
} }
public static boolean isPlayerPowered(Player player){ public static boolean isPlayerPowered(Player player){
debug("IS PLAYER POWERED?"); //debug("IS PLAYER POWERED?");
if (PlayerMap.containsKey(player.getUniqueId())){ if (PlayerMap.containsKey(player.getUniqueId())){
return PlayerMap.get(player.getUniqueId()).playerPowersActivated; return PlayerMap.get(player.getUniqueId()).playerPowersActivated;
}else{ }else{
@ -77,12 +80,12 @@ public class gPowerMemory {
} }
} }
//DEBUG /*DEBUG
@SuppressWarnings({ "deprecation" }) @SuppressWarnings({ "deprecation" })
public static void debug(String debugString){ public static void debug(String debugString){
if (plugin.getServer().getPlayer("alisolarflare").isOnline() && debugMode == true){ if (plugin.getServer().getPlayer("alisolarflare").isOnline() && debugMode == true){
plugin.getServer().getPlayer("alisolarflare").sendMessage("[gPowerTest]:"+debugString); plugin.getServer().getPlayer("alisolarflare").sendMessage("[gPowerTest]:"+debugString);
} }
} }*/
} }

View file

@ -21,6 +21,8 @@ public class gPowerApplyingTask extends BukkitRunnable{
@Override @Override
public void run() { public void run() {
for (Player player : plugin.getServer().getOnlinePlayers()){ for (Player player : plugin.getServer().getOnlinePlayers()){
player.sendMessage(player.getUniqueId().toString());
player.sendMessage(gPowerMemory.PlayerMap.toString());
if(gPowerMemory.PlayerMap.containsKey(player.getUniqueId())){ if(gPowerMemory.PlayerMap.containsKey(player.getUniqueId())){
activatePower(player, gPowerMemory.PlayerMap.get(player.getUniqueId()).colour); 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)); player.addPotionEffect(new PotionEffect(PotionEffectType.WATER_BREATHING, 100, 1, true, false, Color.GRAY));
}else if (colour.startsWith("p")){ }else if (colour.startsWith("p")){
player.addPotionEffect(new PotionEffect(PotionEffectType.HEALTH_BOOST, 100, 1, true, false, Color.GRAY)); player.addPotionEffect(new PotionEffect(PotionEffectType.HEALTH_BOOST, 100, 1, true, false, Color.GRAY));
} }else{
}
} }
} }

View file

@ -12,7 +12,7 @@ public class gPowerListener implements Listener{
public gPowerListener(AliPresents plugin){ public gPowerListener(AliPresents plugin){
this.plugin = plugin; this.plugin = plugin;
this.powerApplyingTask = new gPowerApplyingTask(this.plugin); this.powerApplyingTask = new gPowerApplyingTask(this.plugin);
bukkitTask = powerApplyingTask.runTaskTimer(plugin, 5, 5); bukkitTask = powerApplyingTask.runTaskTimer(plugin, 100, 100);
} }
} }