Updated powerapplyingtask
This commit is contained in:
parent
91aa02494b
commit
f37d1ad2c4
2 changed files with 18 additions and 13 deletions
|
@ -51,3 +51,7 @@ commands:
|
||||||
description: Admin command that activates gpowers on a uhc
|
description: Admin command that activates gpowers on a uhc
|
||||||
setworldborders:
|
setworldborders:
|
||||||
description: sets the worldborders to a uhc match
|
description: sets the worldborders to a uhc match
|
||||||
|
startuhc:
|
||||||
|
description: starts an ultrahardcore match
|
||||||
|
starttimer:
|
||||||
|
description: starts an ultrahardcore timer
|
|
@ -13,7 +13,7 @@ import org.bukkit.scheduler.BukkitRunnable;
|
||||||
import alisolarflare.easyuhc.gpowers.GPowerMemory.poweredPlayer;
|
import alisolarflare.easyuhc.gpowers.GPowerMemory.poweredPlayer;
|
||||||
|
|
||||||
public class gPowerApplyingTask extends BukkitRunnable{
|
public class gPowerApplyingTask extends BukkitRunnable{
|
||||||
|
private int powerLength = 200;
|
||||||
private Server server;
|
private Server server;
|
||||||
private Map<UUID, poweredPlayer> poweredPlayerList;
|
private Map<UUID, poweredPlayer> poweredPlayerList;
|
||||||
|
|
||||||
|
@ -25,8 +25,9 @@ public class gPowerApplyingTask extends BukkitRunnable{
|
||||||
//REPEATS EVERY 5 SECONDS
|
//REPEATS EVERY 5 SECONDS
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
|
server.broadcastMessage("ping!");
|
||||||
for (Player player : server.getOnlinePlayers()){
|
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);
|
activatePower(player, poweredPlayerList.get(player.getUniqueId()).colour);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -35,29 +36,29 @@ public class gPowerApplyingTask extends BukkitRunnable{
|
||||||
private void activatePower(Player player, String colour) {
|
private void activatePower(Player player, String colour) {
|
||||||
//GREY
|
//GREY
|
||||||
if ((colour.startsWith("grey") || colour.startsWith("gra")) && (player.getWorld().getTime() > 12575 && player.getWorld().getTime() < 22925)){
|
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.REGENERATION, powerLength, 0, true, false, Color.GRAY), true);
|
||||||
player.addPotionEffect(new PotionEffect(PotionEffectType.NIGHT_VISION, 300, 0, true, false, Color.GRAY));
|
player.addPotionEffect(new PotionEffect(PotionEffectType.NIGHT_VISION, powerLength+100, 0, true, false, Color.GRAY), true);
|
||||||
//RED
|
//RED
|
||||||
}else if (colour.startsWith("r")){
|
}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
|
//ORANGE
|
||||||
}else if (colour.startsWith("o")){
|
}else if (colour.startsWith("o")){
|
||||||
player.addPotionEffect(new PotionEffect(PotionEffectType.FIRE_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, 200, 0, true, false, Color.ORANGE));
|
player.addPotionEffect(new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE, powerLength, 0, true, false, Color.ORANGE), true);
|
||||||
//YELLOW
|
//YELLOW
|
||||||
}else if (colour.startsWith("y") && player.getLocation().getBlock().getLightFromSky() == 15 && player.getLocation().getBlock().getLightFromBlocks() == 15){
|
}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
|
//GREEN
|
||||||
}else if (colour.startsWith("g") && !colour.startsWith("gra") && !colour.startsWith("grey")){
|
}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.LUCK, powerLength, 1, true, false, Color.GREEN), true);
|
||||||
player.addPotionEffect(new PotionEffect(PotionEffectType.FAST_DIGGING, 200, 0, true, false, Color.GREEN));
|
player.addPotionEffect(new PotionEffect(PotionEffectType.FAST_DIGGING, powerLength, 0, true, false, Color.GREEN), true);
|
||||||
//BLUE
|
//BLUE
|
||||||
}else if (colour.startsWith("b")){
|
}else if (colour.startsWith("b")){
|
||||||
player.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, 200, 1, true, false, Color.BLUE));
|
player.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, powerLength, 1, true, false, Color.BLUE), true);
|
||||||
player.addPotionEffect(new PotionEffect(PotionEffectType.WATER_BREATHING, 200, 0, true, false, Color.BLUE));
|
player.addPotionEffect(new PotionEffect(PotionEffectType.WATER_BREATHING, powerLength, 0, true, false, Color.BLUE), true);
|
||||||
//PURPLE
|
//PURPLE
|
||||||
}else if (colour.startsWith("p")){
|
}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
|
//NULL
|
||||||
}else{
|
}else{
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue