mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-25 22:56:45 +01:00
Refactor, plus store these values rather than checking them twice.
This commit is contained in:
parent
c5c231920d
commit
b42f2d4073
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -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()) {
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user