Fixed /mmocore admine exp take ... bug

This commit is contained in:
Ka0rX 2022-12-20 18:40:47 +01:00
parent 88a3cc4282
commit 2085e61af6
2 changed files with 6 additions and 2 deletions

View File

@ -787,8 +787,10 @@ public class PlayerData extends OfflinePlayerData implements Closable, Experienc
* @param splitExp Should the exp be split among party members
*/
public void giveExperience(double value, EXPSource source, @Nullable Location hologramLocation, boolean splitExp) {
if (value <= 0)
if (value <= 0) {
experience = Math.max(0, experience + value);
return;
}
// Splitting exp through party members
AbstractParty party;

View File

@ -170,8 +170,10 @@ public class PlayerProfessions {
public void giveExperience(Profession profession, double value, EXPSource source, @Nullable Location hologramLocation, boolean splitExp) {
Validate.isTrue(playerData.isOnline(), "Cannot give experience to offline player");
if (value <= 0)
if (value <= 0) {
exp.put(profession.getId(), Math.max(0, exp.get(profession.getId() + value)));
return;
}
if (hasReachedMaxLevel(profession)) {
setExperience(profession, 0);