Refactor, plus store these values rather than checking them twice.

This commit is contained in:
GJ 2013-09-10 08:38:06 -04:00
parent c5c231920d
commit b42f2d4073
3 changed files with 10 additions and 7 deletions

View File

@ -124,7 +124,10 @@ public class PlayerListener implements Listener {
*/
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onPlayerDeathMonitor(PlayerDeathEvent event) {
if (!HardcoreManager.getHardcoreStatLossEnabled() && !HardcoreManager.getHardcoreVampirismEnabled()) {
boolean statLossEnabled = HardcoreManager.isStatLossEnabled();
boolean vampirismEnabled = HardcoreManager.isVampirismEnabled();
if (!statLossEnabled && !vampirismEnabled) {
return;
}
@ -136,11 +139,11 @@ public class PlayerListener implements Listener {
Player killer = killedPlayer.getKiller();
if (killer != null && HardcoreManager.getHardcoreVampirismEnabled()) {
if (killer != null && vampirismEnabled) {
HardcoreManager.invokeVampirism(killer, killedPlayer);
}
if (HardcoreManager.getHardcoreStatLossEnabled()) {
if (statLossEnabled) {
HardcoreManager.invokeStatPenalty(killedPlayer);
}
}

View File

@ -94,7 +94,7 @@ public final class HardcoreManager {
*
* @return true if Stat Loss is enabled for one or more skill types
*/
public static boolean getHardcoreStatLossEnabled() {
public static boolean isStatLossEnabled() {
boolean enabled = false;
for (SkillType skillType : SkillType.nonChildSkills()) {
@ -112,7 +112,7 @@ public final class HardcoreManager {
*
* @return true if Vampirism is enabled for one or more skill types
*/
public static boolean getHardcoreVampirismEnabled() {
public static boolean isVampirismEnabled() {
boolean enabled = false;
for (SkillType skillType : SkillType.nonChildSkills()) {

View File

@ -43,8 +43,8 @@ public final class Motd {
* @param player Target player
*/
public static void displayHardcoreSettings(Player player) {
boolean deathStatLossEnabled = HardcoreManager.getHardcoreStatLossEnabled();
boolean vampirismEnabled = HardcoreManager.getHardcoreVampirismEnabled();
boolean deathStatLossEnabled = HardcoreManager.isStatLossEnabled();
boolean vampirismEnabled = HardcoreManager.isVampirismEnabled();
if (!deathStatLossEnabled && !vampirismEnabled) {
return;