mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-12-02 09:56:45 +01:00
Don't set negative xp values
This commit is contained in:
parent
5e3383dbf4
commit
44770cf13b
@ -60,7 +60,12 @@ public class SelfListener implements Listener {
|
|||||||
// System.out.println("Adjusted XP " + (event.getRawXpGained() - (event.getRawXpGained() * difference)));
|
// System.out.println("Adjusted XP " + (event.getRawXpGained() - (event.getRawXpGained() * difference)));
|
||||||
float newValue = event.getRawXpGained() - (event.getRawXpGained() * difference);
|
float newValue = event.getRawXpGained() - (event.getRawXpGained() * difference);
|
||||||
|
|
||||||
event.setRawXpGained(newValue);
|
if (newValue > 0) {
|
||||||
|
event.setRawXpGained(newValue);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
event.setCancelled(true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
mcMMOPlayer.getProfile().registeredXpGain(skillType, event.getRawXpGained());
|
mcMMOPlayer.getProfile().registeredXpGain(skillType, event.getRawXpGained());
|
||||||
|
Loading…
Reference in New Issue
Block a user