Added API to XP events to get XP gain reason

This commit is contained in:
TfT_02
2014-04-18 21:56:03 +02:00
parent 03c2282c3f
commit 9f53426511
31 changed files with 276 additions and 58 deletions

View File

@ -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);
}
}