From f37d1ad2c4a12cdc7aa105ee4e07704433c59faa Mon Sep 17 00:00:00 2001 From: alisolarflare Date: Fri, 11 Nov 2016 14:44:55 -0500 Subject: [PATCH] Updated powerapplyingtask --- plugin.yml | 4 +++ .../gpowers/listeners/gPowerApplyingTask.java | 27 ++++++++++--------- 2 files changed, 18 insertions(+), 13 deletions(-) diff --git a/plugin.yml b/plugin.yml index d6c5a19..4b18371 100644 --- a/plugin.yml +++ b/plugin.yml @@ -51,3 +51,7 @@ commands: description: Admin command that activates gpowers on a uhc setworldborders: description: sets the worldborders to a uhc match + startuhc: + description: starts an ultrahardcore match + starttimer: + description: starts an ultrahardcore timer \ No newline at end of file diff --git a/src/alisolarflare/easyuhc/gpowers/listeners/gPowerApplyingTask.java b/src/alisolarflare/easyuhc/gpowers/listeners/gPowerApplyingTask.java index a537565..04d7369 100644 --- a/src/alisolarflare/easyuhc/gpowers/listeners/gPowerApplyingTask.java +++ b/src/alisolarflare/easyuhc/gpowers/listeners/gPowerApplyingTask.java @@ -13,7 +13,7 @@ import org.bukkit.scheduler.BukkitRunnable; import alisolarflare.easyuhc.gpowers.GPowerMemory.poweredPlayer; public class gPowerApplyingTask extends BukkitRunnable{ - + private int powerLength = 200; private Server server; private Map poweredPlayerList; @@ -25,8 +25,9 @@ public class gPowerApplyingTask extends BukkitRunnable{ //REPEATS EVERY 5 SECONDS @Override public void run() { + server.broadcastMessage("ping!"); for (Player player : server.getOnlinePlayers()){ - if(poweredPlayerList.containsKey(player.getUniqueId())){ + if(poweredPlayerList.containsKey(player.getUniqueId()) && poweredPlayerList.get(player.getUniqueId()).isPowersActive){ activatePower(player, poweredPlayerList.get(player.getUniqueId()).colour); } } @@ -35,29 +36,29 @@ public class gPowerApplyingTask extends BukkitRunnable{ private void activatePower(Player player, String colour) { //GREY if ((colour.startsWith("grey") || colour.startsWith("gra")) && (player.getWorld().getTime() > 12575 && player.getWorld().getTime() < 22925)){ - player.addPotionEffect(new PotionEffect(PotionEffectType.REGENERATION, 200, 0, true, false, Color.GRAY)); - player.addPotionEffect(new PotionEffect(PotionEffectType.NIGHT_VISION, 300, 0, true, false, Color.GRAY)); + player.addPotionEffect(new PotionEffect(PotionEffectType.REGENERATION, powerLength, 0, true, false, Color.GRAY), true); + player.addPotionEffect(new PotionEffect(PotionEffectType.NIGHT_VISION, powerLength+100, 0, true, false, Color.GRAY), true); //RED }else if (colour.startsWith("r")){ - player.addPotionEffect(new PotionEffect(PotionEffectType.INCREASE_DAMAGE, 200, 0, true, false, Color.RED)); + player.addPotionEffect(new PotionEffect(PotionEffectType.INCREASE_DAMAGE, powerLength, 0, true, false, Color.RED), true); //ORANGE }else if (colour.startsWith("o")){ - player.addPotionEffect(new PotionEffect(PotionEffectType.FIRE_RESISTANCE, 200, 0, true, false, Color.ORANGE)); - player.addPotionEffect(new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE, 200, 0, true, false, Color.ORANGE)); + player.addPotionEffect(new PotionEffect(PotionEffectType.FIRE_RESISTANCE, powerLength, 0, true, false, Color.ORANGE), true); + player.addPotionEffect(new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE, powerLength, 0, true, false, Color.ORANGE), true); //YELLOW }else if (colour.startsWith("y") && player.getLocation().getBlock().getLightFromSky() == 15 && player.getLocation().getBlock().getLightFromBlocks() == 15){ - player.addPotionEffect(new PotionEffect(PotionEffectType.REGENERATION, 200, 0, true, false, Color.YELLOW)); + player.addPotionEffect(new PotionEffect(PotionEffectType.REGENERATION, powerLength, 0, true, false, Color.YELLOW), true); //GREEN }else if (colour.startsWith("g") && !colour.startsWith("gra") && !colour.startsWith("grey")){ - player.addPotionEffect(new PotionEffect(PotionEffectType.LUCK, 200, 1, true, false, Color.GREEN)); - player.addPotionEffect(new PotionEffect(PotionEffectType.FAST_DIGGING, 200, 0, true, false, Color.GREEN)); + player.addPotionEffect(new PotionEffect(PotionEffectType.LUCK, powerLength, 1, true, false, Color.GREEN), true); + player.addPotionEffect(new PotionEffect(PotionEffectType.FAST_DIGGING, powerLength, 0, true, false, Color.GREEN), true); //BLUE }else if (colour.startsWith("b")){ - player.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, 200, 1, true, false, Color.BLUE)); - player.addPotionEffect(new PotionEffect(PotionEffectType.WATER_BREATHING, 200, 0, true, false, Color.BLUE)); + player.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, powerLength, 1, true, false, Color.BLUE), true); + player.addPotionEffect(new PotionEffect(PotionEffectType.WATER_BREATHING, powerLength, 0, true, false, Color.BLUE), true); //PURPLE }else if (colour.startsWith("p")){ - player.addPotionEffect(new PotionEffect(PotionEffectType.HEALTH_BOOST, 200, 0, true, false, Color.PURPLE)); + player.addPotionEffect(new PotionEffect(PotionEffectType.HEALTH_BOOST, powerLength, 0, true, false, Color.PURPLE), true); //NULL }else{ }