mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-22 13:16: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)
|
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||||
public void onPlayerDeathMonitor(PlayerDeathEvent event) {
|
public void onPlayerDeathMonitor(PlayerDeathEvent event) {
|
||||||
if (!HardcoreManager.getHardcoreStatLossEnabled() && !HardcoreManager.getHardcoreVampirismEnabled()) {
|
boolean statLossEnabled = HardcoreManager.isStatLossEnabled();
|
||||||
|
boolean vampirismEnabled = HardcoreManager.isVampirismEnabled();
|
||||||
|
|
||||||
|
if (!statLossEnabled && !vampirismEnabled) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -136,11 +139,11 @@ public class PlayerListener implements Listener {
|
|||||||
|
|
||||||
Player killer = killedPlayer.getKiller();
|
Player killer = killedPlayer.getKiller();
|
||||||
|
|
||||||
if (killer != null && HardcoreManager.getHardcoreVampirismEnabled()) {
|
if (killer != null && vampirismEnabled) {
|
||||||
HardcoreManager.invokeVampirism(killer, killedPlayer);
|
HardcoreManager.invokeVampirism(killer, killedPlayer);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (HardcoreManager.getHardcoreStatLossEnabled()) {
|
if (statLossEnabled) {
|
||||||
HardcoreManager.invokeStatPenalty(killedPlayer);
|
HardcoreManager.invokeStatPenalty(killedPlayer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -94,7 +94,7 @@ public final class HardcoreManager {
|
|||||||
*
|
*
|
||||||
* @return true if Stat Loss is enabled for one or more skill types
|
* @return true if Stat Loss is enabled for one or more skill types
|
||||||
*/
|
*/
|
||||||
public static boolean getHardcoreStatLossEnabled() {
|
public static boolean isStatLossEnabled() {
|
||||||
boolean enabled = false;
|
boolean enabled = false;
|
||||||
|
|
||||||
for (SkillType skillType : SkillType.nonChildSkills()) {
|
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
|
* @return true if Vampirism is enabled for one or more skill types
|
||||||
*/
|
*/
|
||||||
public static boolean getHardcoreVampirismEnabled() {
|
public static boolean isVampirismEnabled() {
|
||||||
boolean enabled = false;
|
boolean enabled = false;
|
||||||
|
|
||||||
for (SkillType skillType : SkillType.nonChildSkills()) {
|
for (SkillType skillType : SkillType.nonChildSkills()) {
|
||||||
|
@ -43,8 +43,8 @@ public final class Motd {
|
|||||||
* @param player Target player
|
* @param player Target player
|
||||||
*/
|
*/
|
||||||
public static void displayHardcoreSettings(Player player) {
|
public static void displayHardcoreSettings(Player player) {
|
||||||
boolean deathStatLossEnabled = HardcoreManager.getHardcoreStatLossEnabled();
|
boolean deathStatLossEnabled = HardcoreManager.isStatLossEnabled();
|
||||||
boolean vampirismEnabled = HardcoreManager.getHardcoreVampirismEnabled();
|
boolean vampirismEnabled = HardcoreManager.isVampirismEnabled();
|
||||||
|
|
||||||
if (!deathStatLossEnabled && !vampirismEnabled) {
|
if (!deathStatLossEnabled && !vampirismEnabled) {
|
||||||
return;
|
return;
|
||||||
|
Loading…
Reference in New Issue
Block a user