mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-29 16:46:46 +01:00
Don't calculate diminshed returns when subtracting XP
Any penalty XP that goes through the event after diminished returns has activated would be cancelled by this listener. This bails out early if the event is subtracting.
This commit is contained in:
parent
18138b289a
commit
9a852b1baf
@ -39,7 +39,12 @@ public class SelfListener implements Listener {
|
||||
int threshold = Config.getInstance().getExperienceDeminishedReturnsThreshold();
|
||||
|
||||
if (threshold <= 0) {
|
||||
return;
|
||||
return; // Dim. returns is turned off
|
||||
}
|
||||
|
||||
final int rawXp = event.getRawXpGained();
|
||||
if (rawXp < 0) {
|
||||
return; // Don't calculate for XP subtraction
|
||||
}
|
||||
|
||||
Player player = event.getPlayer();
|
||||
@ -58,7 +63,7 @@ public class SelfListener implements Listener {
|
||||
// System.out.println(difference * 100 + "% over the threshold!");
|
||||
// System.out.println("Previous: " + event.getRawXpGained());
|
||||
// System.out.println("Adjusted XP " + (event.getRawXpGained() - (event.getRawXpGained() * difference)));
|
||||
float newValue = event.getRawXpGained() - (event.getRawXpGained() * difference);
|
||||
float newValue = rawXp - (rawXp * difference);
|
||||
|
||||
if (newValue > 0) {
|
||||
event.setRawXpGained(newValue);
|
||||
|
Loading…
Reference in New Issue
Block a user