From 1141dce696965abd34d0fda0af679fe51129f0c1 Mon Sep 17 00:00:00 2001 From: Olof Larsson Date: Fri, 3 Oct 2014 13:22:35 +0200 Subject: [PATCH] Dodge DBZ. Fixes #573. --- .../com/massivecraft/factions/cmd/CmdFactionsPlayer.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdFactionsPlayer.java b/src/main/java/com/massivecraft/factions/cmd/CmdFactionsPlayer.java index 33abd840..c793b35b 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdFactionsPlayer.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdFactionsPlayer.java @@ -44,7 +44,13 @@ public class CmdFactionsPlayer extends FactionsCommand msg(Txt.titleize("Player " + mplayer.describeTo(msender))); // INFO: Power (as progress bar) - double progressbarQuota = mplayer.getPower() / mplayer.getPowerMax(); + double progressbarQuota = 0; + double playerPowerMax = mplayer.getPowerMax(); + if (playerPowerMax != 0) + { + progressbarQuota = mplayer.getPower() / playerPowerMax; + } + int progressbarWidth = (int) Math.round(mplayer.getPowerMax() / mplayer.getPowerMaxUniversal() * 100); msg("Power: %s", Progressbar.HEALTHBAR_CLASSIC.withQuota(progressbarQuota).withWidth(progressbarWidth).render());