From 462bc6088d1723f17077570aaefb21adca35c595 Mon Sep 17 00:00:00 2001 From: Vastitas Date: Tue, 27 Oct 2015 10:09:17 +0000 Subject: [PATCH] Adding ability to show health as percentage --- config.yml | 2 ++ pom.xml | 2 +- .../mc/citadel/CitadelConfigManager.java | 4 ++++ .../reinforcement/PlayerReinforcement.java | 19 ++++++++++++------- 4 files changed, 19 insertions(+), 8 deletions(-) diff --git a/config.yml b/config.yml index c9a7c21b..50023e5c 100644 --- a/config.yml +++ b/config.yml @@ -101,3 +101,5 @@ mysql: dbname: "bukkit" username: "bukkit" password: "" +# Shows reinforcement information as percentile value +show_health_as_percent: false diff --git a/pom.xml b/pom.xml index cecb76a9..eac452ac 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ vg.civcraft.mc.citadel Citadel jar - 3.4.44 + 3.4.45 Citadel https://github.com/Civcraft/Citadel diff --git a/src/vg/civcraft/mc/citadel/CitadelConfigManager.java b/src/vg/civcraft/mc/citadel/CitadelConfigManager.java index 57bc440b..1855ab92 100644 --- a/src/vg/civcraft/mc/citadel/CitadelConfigManager.java +++ b/src/vg/civcraft/mc/citadel/CitadelConfigManager.java @@ -156,4 +156,8 @@ public static boolean shouldLogBreaks() { public static boolean shouldLogReinforcement() { return config.getBoolean("reinf_logging", false); } + + public static boolean showHealthAsPercent(){ + return config.getBoolean("show_health_as_percent", false); + } } diff --git a/src/vg/civcraft/mc/citadel/reinforcement/PlayerReinforcement.java b/src/vg/civcraft/mc/citadel/reinforcement/PlayerReinforcement.java index 9a85095e..9c433e83 100644 --- a/src/vg/civcraft/mc/citadel/reinforcement/PlayerReinforcement.java +++ b/src/vg/civcraft/mc/citadel/reinforcement/PlayerReinforcement.java @@ -14,6 +14,7 @@ import vg.civcraft.mc.citadel.Citadel; import vg.civcraft.mc.citadel.ReinforcementManager; +import vg.civcraft.mc.citadel.CitadelConfigManager; import vg.civcraft.mc.citadel.Utility; import vg.civcraft.mc.citadel.reinforcementtypes.ReinforcementType; import vg.civcraft.mc.namelayer.GroupManager; @@ -131,14 +132,18 @@ public double getHealth() { */ public String getHealthText() { double health = getHealth(); - if (health > 0.75) { - return "excellently"; - } else if (health > 0.50) { - return "well"; - } else if (health > 0.25) { - return "decently"; + if (CitadelConfigManager.showHealthAsPercent()) { + return health * 100 + "%"; } else { - return "poorly"; + if (health > 0.75) { + return "excellently"; + } else if (health > 0.50) { + return "well"; + } else if (health > 0.25) { + return "decently"; + } else { + return "poorly"; + } } } /**