Dont do diminishing returns on command caused xp gains Fixes #3312

This commit is contained in:
t00thpick1 2017-10-27 20:30:45 -04:00
parent eb4960f307
commit 307d483323

View File

@ -1,5 +1,6 @@
package com.gmail.nossr50.listeners; package com.gmail.nossr50.listeners;
import com.gmail.nossr50.datatypes.skills.XPGainReason;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority; import org.bukkit.event.EventPriority;
@ -44,9 +45,10 @@ public class SelfListener implements Listener {
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true) @EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void onPlayerXpGain(McMMOPlayerXpGainEvent event) { public void onPlayerXpGain(McMMOPlayerXpGainEvent event) {
if (event.getXpGainReason() == XPGainReason.COMMAND)
return;
SkillType skillType = event.getSkill(); SkillType skillType = event.getSkill();
int threshold = ExperienceConfig.getInstance().getDiminishedReturnsThreshold(skillType); int threshold = ExperienceConfig.getInstance().getDiminishedReturnsThreshold(skillType);
if (threshold <= 0 || !ExperienceConfig.getInstance().getDiminishedReturnsEnabled()) { if (threshold <= 0 || !ExperienceConfig.getInstance().getDiminishedReturnsEnabled()) {
// Diminished returns is turned off // Diminished returns is turned off
return; return;