diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilText.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilText.java index 7c1fc6c3a..5c289d176 100644 --- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilText.java +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilText.java @@ -6,6 +6,7 @@ import java.io.InputStream; import java.util.ArrayList; import java.util.Collection; import java.util.HashMap; +import java.util.Map; import javax.imageio.ImageIO; @@ -696,6 +697,20 @@ public class UtilText } return possesiveNoun.endsWith("s") ? possesiveNoun + "' " + noun : possesiveNoun + "'s " + noun; + } + + public static String colorPercentage(int percentage) + { + Map colors = new HashMap<>(); + + colors.put(Integer.valueOf(100), C.cGreen); + colors.put(Integer.valueOf(80), C.cDGreen); + colors.put(Integer.valueOf(60), C.cYellow); + colors.put(Integer.valueOf(40), C.cGold); + colors.put(Integer.valueOf(20), C.cRed); + colors.put(Integer.valueOf(0), C.cDRed); + + return colors.get(Integer.valueOf(percentage / colors.size())); } } \ No newline at end of file diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/siege/outpost/Outpost.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/siege/outpost/Outpost.java index c6b29be13..514153dbb 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/siege/outpost/Outpost.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/siege/outpost/Outpost.java @@ -49,6 +49,7 @@ import mineplex.core.common.util.UtilParticle.ViewDist; import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilText; +import mineplex.core.common.util.UtilTextBottom; import mineplex.core.common.util.UtilTextMiddle; import mineplex.core.common.util.UtilTime; import mineplex.core.hologram.Hologram; @@ -311,6 +312,16 @@ public class Outpost implements Listener protected void update() { + if (_against != null && getPrepTimeLeft() > 0) + { + _against.getOnlinePlayers().forEach(this::informTimeToSiege); + _owner.getOnlinePlayers().forEach(this::informTimeToSiege); + } + else if (_against != null) + { + UtilTextBottom.display("Enemy Outpost Health: " + UtilText.colorPercentage(getHealthPercentage()) + "%", _against.getOnlinePlayersArray()); + } + if (_state == OutpostState.AWAITING) { if (getLifetime() > 60000) @@ -608,6 +619,11 @@ public class Outpost implements Listener // Health Management + public final int getHealthPercentage() + { + return ((int) ((_health / _maxHealth) * 100.d)); + } + public final double getHealth() { return _health; @@ -669,6 +685,11 @@ public class Outpost implements Listener } } + public void informTimeToSiege(Player player) + { + UtilTextBottom.display("Time to Siege: " + F.time(UtilTime.MakeStr(getPrepTimeLeft())), player); + } + public long getPrepBegin() { return _prepBegin;