From 3badc2680658d39ab9ea035eafd26cfc58e31330 Mon Sep 17 00:00:00 2001 From: nossr50 Date: Wed, 16 Sep 2020 20:09:59 -0700 Subject: [PATCH] Hardcore mode won't bring players below level threshold anymore --- Changelog.txt | 4 ++++ pom.xml | 2 +- src/main/java/com/gmail/nossr50/util/EventUtils.java | 4 +++- src/main/java/com/gmail/nossr50/util/HardcoreManager.java | 2 +- 4 files changed, 9 insertions(+), 3 deletions(-) diff --git a/Changelog.txt b/Changelog.txt index f93ac739b..4ee9b23ce 100644 --- a/Changelog.txt +++ b/Changelog.txt @@ -1,3 +1,7 @@ +Version 2.1.146 + Players no longer lose levels below the level threshold in hardcore mode + Hardcore now only applies penalties to levels above threshold + Version 2.1.145 Reverted 'Changed one of the PlayerInteractEvent listeners to ignore cancelled events' from 2.1.144 diff --git a/pom.xml b/pom.xml index c312d11c5..bd4447210 100755 --- a/pom.xml +++ b/pom.xml @@ -2,7 +2,7 @@ 4.0.0 com.gmail.nossr50.mcMMO mcMMO - 2.1.145 + 2.1.146-SNAPSHOT mcMMO https://github.com/mcMMO-Dev/mcMMO diff --git a/src/main/java/com/gmail/nossr50/util/EventUtils.java b/src/main/java/com/gmail/nossr50/util/EventUtils.java index 2793a446e..3065bc5cb 100644 --- a/src/main/java/com/gmail/nossr50/util/EventUtils.java +++ b/src/main/java/com/gmail/nossr50/util/EventUtils.java @@ -1,5 +1,7 @@ package com.gmail.nossr50.util; +import com.gmail.nossr50.config.AdvancedConfig; +import com.gmail.nossr50.config.Config; import com.gmail.nossr50.datatypes.experience.XPGainReason; import com.gmail.nossr50.datatypes.experience.XPGainSource; import com.gmail.nossr50.datatypes.party.Party; @@ -330,7 +332,7 @@ public class EventUtils { String skillName = primarySkillType.toString(); int playerSkillLevel = playerProfile.getSkillLevel(primarySkillType); - playerProfile.modifySkill(primarySkillType, playerSkillLevel - levelChanged.get(skillName)); + playerProfile.modifySkill(primarySkillType, Math.max(Config.getInstance().getHardcoreDeathStatPenaltyLevelThreshold(), playerSkillLevel - levelChanged.get(skillName))); playerProfile.removeXp(primarySkillType, experienceChanged.get(skillName)); if (playerProfile.getSkillXpLevel(primarySkillType) < 0) { diff --git a/src/main/java/com/gmail/nossr50/util/HardcoreManager.java b/src/main/java/com/gmail/nossr50/util/HardcoreManager.java index 9956a614d..11b7e01c4 100644 --- a/src/main/java/com/gmail/nossr50/util/HardcoreManager.java +++ b/src/main/java/com/gmail/nossr50/util/HardcoreManager.java @@ -50,7 +50,7 @@ public final class HardcoreManager { continue; } - double statsLost = playerSkillLevel * (statLossPercentage * 0.01D); + double statsLost = Math.max(0, (playerSkillLevel - levelThreshold)) * (statLossPercentage * 0.01D); int levelsLost = (int) statsLost; int xpLost = (int) Math.floor(playerSkillXpLevel * (statsLost - levelsLost)); levelChanged.put(primarySkillType.toString(), levelsLost);