mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2025-06-29 12:14:43 +02:00
Added API to XP events to get XP gain reason
This commit is contained in:
@ -5,19 +5,22 @@ import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||
import com.gmail.nossr50.datatypes.skills.XPGainReason;
|
||||
|
||||
public class AwardCombatXpTask extends BukkitRunnable {
|
||||
private McMMOPlayer mcMMOPlayer;
|
||||
private double baseXp;
|
||||
private SkillType skillType;
|
||||
private LivingEntity target;
|
||||
private XPGainReason xpGainReason;
|
||||
private double baseHealth;
|
||||
|
||||
public AwardCombatXpTask(McMMOPlayer mcMMOPlayer, SkillType skillType, double baseXp, LivingEntity target) {
|
||||
public AwardCombatXpTask(McMMOPlayer mcMMOPlayer, SkillType skillType, double baseXp, LivingEntity target, XPGainReason xpGainReason) {
|
||||
this.mcMMOPlayer = mcMMOPlayer;
|
||||
this.skillType = skillType;
|
||||
this.baseXp = baseXp;
|
||||
this.target = target;
|
||||
this.xpGainReason = xpGainReason;
|
||||
baseHealth = target.getHealth();
|
||||
}
|
||||
|
||||
@ -36,6 +39,6 @@ public class AwardCombatXpTask extends BukkitRunnable {
|
||||
damage += health;
|
||||
}
|
||||
|
||||
mcMMOPlayer.beginXpGain(skillType, (int) (damage * baseXp));
|
||||
mcMMOPlayer.beginXpGain(skillType, (int) (damage * baseXp), xpGainReason);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user