forked from Upstream/mmocore
Fixed /mmocore admine exp take ... bug
This commit is contained in:
parent
88a3cc4282
commit
2085e61af6
@ -787,8 +787,10 @@ public class PlayerData extends OfflinePlayerData implements Closable, Experienc
|
|||||||
* @param splitExp Should the exp be split among party members
|
* @param splitExp Should the exp be split among party members
|
||||||
*/
|
*/
|
||||||
public void giveExperience(double value, EXPSource source, @Nullable Location hologramLocation, boolean splitExp) {
|
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;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Splitting exp through party members
|
// Splitting exp through party members
|
||||||
AbstractParty party;
|
AbstractParty party;
|
||||||
|
@ -170,8 +170,10 @@ public class PlayerProfessions {
|
|||||||
|
|
||||||
public void giveExperience(Profession profession, double value, EXPSource source, @Nullable Location hologramLocation, boolean splitExp) {
|
public void giveExperience(Profession profession, double value, EXPSource source, @Nullable Location hologramLocation, boolean splitExp) {
|
||||||
Validate.isTrue(playerData.isOnline(), "Cannot give experience to offline player");
|
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;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (hasReachedMaxLevel(profession)) {
|
if (hasReachedMaxLevel(profession)) {
|
||||||
setExperience(profession, 0);
|
setExperience(profession, 0);
|
||||||
|
Loading…
Reference in New Issue
Block a user