1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980 |
- package com.gmail.nossr50.skills;
- import com.gmail.nossr50.datatypes.experience.XPGainReason;
- import com.gmail.nossr50.datatypes.experience.XPGainSource;
- import com.gmail.nossr50.datatypes.player.McMMOPlayer;
- import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
- import com.gmail.nossr50.mcMMO;
- import org.bukkit.entity.Entity;
- import org.bukkit.entity.LivingEntity;
- import org.bukkit.entity.Player;
- public abstract class SkillManager {
- protected McMMOPlayer mcMMOPlayer;
- protected PrimarySkillType skill;
- protected final mcMMO pluginRef;
- public SkillManager(mcMMO pluginRef, McMMOPlayer mcMMOPlayer, PrimarySkillType skill) {
- this.pluginRef = pluginRef;
- this.mcMMOPlayer = mcMMOPlayer;
- this.skill = skill;
- }
- public Player getPlayer() {
- return mcMMOPlayer.getPlayer();
- }
- public int getSkillLevel() {
- return mcMMOPlayer.getSkillLevel(skill);
- }
- /**
- * Applies XP to a player, provides SELF as an XpGainSource source
- *
- * @param xp amount of XP to apply
- * @param xpGainReason the reason for the XP gain
- * @deprecated use applyXpGain(float, XPGainReason, XPGainSource)
- */
- @Deprecated
- public void applyXpGain(double xp, XPGainReason xpGainReason) {
- mcMMOPlayer.beginXpGain(skill, xp, xpGainReason, XPGainSource.SELF);
- }
- /**
- * Applies XP to a player, provides SELF as an XpGainSource source
- *
- * @param xp amount of XP to apply
- * @param xpGainReason the reason for the XP gain
- * @deprecated use applyXpGain(float, XPGainReason, XPGainSource)
- */
- @Deprecated
- public void applyXpGain(float xp, XPGainReason xpGainReason) {
- mcMMOPlayer.beginXpGain(skill, xp, xpGainReason, XPGainSource.SELF);
- }
- /**
- * Applies XP to a player
- *
- * @param xp amount of XP to apply
- * @param xpGainReason the reason for the XP gain
- * @param xpGainSource the source of the XP
- */
- public void applyXpGain(float xp, XPGainReason xpGainReason, XPGainSource xpGainSource) {
- mcMMOPlayer.beginXpGain(skill, xp, xpGainReason, xpGainSource);
- }
- /**
- * Applies XP to a player
- *
- * @param xp amount of XP to apply
- * @param xpGainReason the reason for the XP gain
- * @param xpGainSource the source of the XP
- */
- public void applyXpGain(double xp, XPGainReason xpGainReason, XPGainSource xpGainSource) {
- mcMMOPlayer.beginXpGain(skill, xp, xpGainReason, xpGainSource);
- }
- public XPGainReason getXPGainReason(LivingEntity target, Entity damager) {
- return (damager instanceof Player && target instanceof Player) ? XPGainReason.PVP : XPGainReason.PVE;
- }
- }
|