mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-26 15:16:45 +01:00
Remove deprecated functions from ExperienceAPI
This commit is contained in:
parent
c2fea660e7
commit
050f97e088
@ -14,6 +14,7 @@ Version 1.4.04-dev
|
|||||||
= Fixed bug where Mining wasn't awarding double drops
|
= Fixed bug where Mining wasn't awarding double drops
|
||||||
= Fixed bug where Shake wouldn't damage mobs whose max health was less than 4
|
= Fixed bug where Shake wouldn't damage mobs whose max health was less than 4
|
||||||
= Fixed bug where the API would fail if the name of a player's current party is requested when the player isn't in one (Thanks @dualspiral!)
|
= Fixed bug where the API would fail if the name of a player's current party is requested when the player isn't in one (Thanks @dualspiral!)
|
||||||
|
- Removed deprecated functions from ExperienceAPI
|
||||||
|
|
||||||
Version 1.4.03
|
Version 1.4.03
|
||||||
+ Added option to advanced.yml to determine the # of enchant levels used when buffing Super Breaker & Giga Drill Breaker
|
+ Added option to advanced.yml to determine the # of enchant levels used when buffing Super Breaker & Giga Drill Breaker
|
||||||
|
@ -9,26 +9,10 @@ import com.gmail.nossr50.datatypes.player.PlayerProfile;
|
|||||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||||
import com.gmail.nossr50.skills.child.FamilyTree;
|
import com.gmail.nossr50.skills.child.FamilyTree;
|
||||||
import com.gmail.nossr50.util.player.UserManager;
|
import com.gmail.nossr50.util.player.UserManager;
|
||||||
import com.gmail.nossr50.util.skills.SkillUtils;
|
|
||||||
|
|
||||||
public final class ExperienceAPI {
|
public final class ExperienceAPI {
|
||||||
private ExperienceAPI() {}
|
private ExperienceAPI() {}
|
||||||
|
|
||||||
/**
|
|
||||||
* Adds raw XP to the player.
|
|
||||||
* </br>
|
|
||||||
* This function is designed for API usage.
|
|
||||||
*
|
|
||||||
* @param player The player to add XP to
|
|
||||||
* @param skillType The skill to add XP to
|
|
||||||
* @param XP The amount of XP to add
|
|
||||||
* @deprecated Use {@link #addRawXP(Player, String, int)} instead
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
public static void addRawXP(Player player, SkillType skillType, int XP) {
|
|
||||||
UserManager.getPlayer(player).applyXpGain(skillType, XP);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds raw XP to the player.
|
* Adds raw XP to the player.
|
||||||
* </br>
|
* </br>
|
||||||
@ -57,21 +41,6 @@ public final class ExperienceAPI {
|
|||||||
addOfflineXP(playerName, skillType, XP);
|
addOfflineXP(playerName, skillType, XP);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Adds XP to the player, calculates for XP Rate only.
|
|
||||||
* </br>
|
|
||||||
* This function is designed for API usage.
|
|
||||||
*
|
|
||||||
* @param player The player to add XP to
|
|
||||||
* @param skillType The skill to add XP to
|
|
||||||
* @param XP The amount of XP to add
|
|
||||||
* @deprecated Use {@link #addMultipliedXP(Player, String, int)} instead
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
public static void addMultipliedXP(Player player, SkillType skillType, int XP) {
|
|
||||||
UserManager.getPlayer(player).applyXpGain(skillType, (int) (XP * Config.getInstance().getExperienceGainsGlobalMultiplier()));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds XP to the player, calculates for XP Rate only.
|
* Adds XP to the player, calculates for XP Rate only.
|
||||||
* </br>
|
* </br>
|
||||||
@ -130,21 +99,6 @@ public final class ExperienceAPI {
|
|||||||
addOfflineXP(playerName, skillType, (int) (XP / SkillType.getSkill(skillType).getXpModifier() * Config.getInstance().getExperienceGainsGlobalMultiplier()));
|
addOfflineXP(playerName, skillType, (int) (XP / SkillType.getSkill(skillType).getXpModifier() * Config.getInstance().getExperienceGainsGlobalMultiplier()));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Adds XP to the player, calculates for XP Rate, skill modifiers and perks. May be shared with the party.
|
|
||||||
* </br>
|
|
||||||
* This function is designed for API usage.
|
|
||||||
*
|
|
||||||
* @param player The player to add XP to
|
|
||||||
* @param skillType The skill to add XP to
|
|
||||||
* @param XP The amount of XP to add
|
|
||||||
* @deprecated Use {@link #addXP(Player, String, int)} instead
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
public static void addXP(Player player, SkillType skillType, int XP) {
|
|
||||||
UserManager.getPlayer(player).beginXpGain(skillType, XP);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds XP to the player, calculates for XP Rate, skill modifiers and perks. May be shared with the party.
|
* Adds XP to the player, calculates for XP Rate, skill modifiers and perks. May be shared with the party.
|
||||||
* </br>
|
* </br>
|
||||||
@ -158,21 +112,6 @@ public final class ExperienceAPI {
|
|||||||
UserManager.getPlayer(player).beginXpGain(SkillType.getSkill(skillType), XP);
|
UserManager.getPlayer(player).beginXpGain(SkillType.getSkill(skillType), XP);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the amount of XP a player has in a specific skill.
|
|
||||||
* </br>
|
|
||||||
* This function is designed for API usage.
|
|
||||||
*
|
|
||||||
* @param player The player to get XP for
|
|
||||||
* @param skillType The skill to get XP for
|
|
||||||
* @return the amount of XP in a given skill
|
|
||||||
* @deprecated Use {@link #getXP(Player, String)} instead
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
public static int getXP(Player player, SkillType skillType) {
|
|
||||||
return UserManager.getPlayer(player).getProfile().getSkillXpLevel(skillType);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the amount of XP a player has in a specific skill.
|
* Get the amount of XP a player has in a specific skill.
|
||||||
* </br>
|
* </br>
|
||||||
@ -200,21 +139,6 @@ public final class ExperienceAPI {
|
|||||||
return getOfflineProfile(playerName).getSkillXpLevel(SkillType.getSkill(skillType));
|
return getOfflineProfile(playerName).getSkillXpLevel(SkillType.getSkill(skillType));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the amount of XP left before leveling up.
|
|
||||||
* </br>
|
|
||||||
* This function is designed for API usage.
|
|
||||||
*
|
|
||||||
* @param player The player to get the XP amount for
|
|
||||||
* @param skillType The skill to get the XP amount for
|
|
||||||
* @return the amount of XP left before leveling up a specifc skill
|
|
||||||
* @deprecated Use {@link #getXPToNextLevel(Player, String)} instead
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
public static int getXPToNextLevel(Player player, SkillType skillType) {
|
|
||||||
return UserManager.getPlayer(player).getProfile().getXpToLevel(skillType);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the amount of XP left before leveling up.
|
* Get the amount of XP left before leveling up.
|
||||||
* </br>
|
* </br>
|
||||||
@ -242,40 +166,6 @@ public final class ExperienceAPI {
|
|||||||
return getOfflineProfile(playerName).getXpToLevel(SkillType.getSkill(skillType));
|
return getOfflineProfile(playerName).getXpToLevel(SkillType.getSkill(skillType));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Add levels to a skill.
|
|
||||||
* </br>
|
|
||||||
* This function is designed for API usage.
|
|
||||||
*
|
|
||||||
* @param player The player to add levels to
|
|
||||||
* @param skillType Type of skill to add levels to
|
|
||||||
* @param levels Number of levels to add
|
|
||||||
* @param notify Unused argument
|
|
||||||
* @deprecated Use addLevel(Player, SKillType, int) instead
|
|
||||||
*/
|
|
||||||
public static void addLevel(Player player, SkillType skillType, int levels, boolean notify) {
|
|
||||||
UserManager.getProfile(player).addLevels(skillType, levels);
|
|
||||||
|
|
||||||
if (notify) {
|
|
||||||
checkXP(player, skillType);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Add levels to a skill.
|
|
||||||
* </br>
|
|
||||||
* This function is designed for API usage.
|
|
||||||
*
|
|
||||||
* @param player The player to add levels to
|
|
||||||
* @param skillType Type of skill to add levels to
|
|
||||||
* @param levels Number of levels to add
|
|
||||||
* @deprecated Use {@link #addLevel(Player, String, int)} instead
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
public static void addLevel(Player player, SkillType skillType, int levels) {
|
|
||||||
UserManager.getPlayer(player).getProfile().addLevels(skillType, levels);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add levels to a skill.
|
* Add levels to a skill.
|
||||||
* </br>
|
* </br>
|
||||||
@ -320,21 +210,6 @@ public final class ExperienceAPI {
|
|||||||
profile.save();
|
profile.save();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the level a player has in a specific skill.
|
|
||||||
* </br>
|
|
||||||
* This function is designed for API usage.
|
|
||||||
*
|
|
||||||
* @param player The player to get the level for
|
|
||||||
* @param skillType The skill to get the level for
|
|
||||||
* @return the level of a given skill
|
|
||||||
* @deprecated Use {@link #getLevel(Player, String)} instead
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
public static int getLevel(Player player, SkillType skillType) {
|
|
||||||
return UserManager.getPlayer(player).getProfile().getSkillLevel(skillType);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the level a player has in a specific skill.
|
* Get the level a player has in a specific skill.
|
||||||
* </br>
|
* </br>
|
||||||
@ -421,21 +296,6 @@ public final class ExperienceAPI {
|
|||||||
return Config.getInstance().getPowerLevelCap();
|
return Config.getInstance().getPowerLevelCap();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets the level of a player in a specific skill type.
|
|
||||||
* </br>
|
|
||||||
* This function is designed for API usage.
|
|
||||||
*
|
|
||||||
* @param player The player to set the level of
|
|
||||||
* @param skillType The skill to set the level for
|
|
||||||
* @param skillLevel The value to set the level to
|
|
||||||
* @deprecated Use {@link #setLevel(Player, String, int)} instead
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
public static void setLevel(Player player, SkillType skillType, int skillLevel) {
|
|
||||||
UserManager.getPlayer(player).getProfile().modifySkill(skillType, skillLevel);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the level of a player in a specific skill type.
|
* Sets the level of a player in a specific skill type.
|
||||||
* </br>
|
* </br>
|
||||||
@ -464,21 +324,6 @@ public final class ExperienceAPI {
|
|||||||
getOfflineProfile(playerName).modifySkill(SkillType.getSkill(skillType), skillLevel);
|
getOfflineProfile(playerName).modifySkill(SkillType.getSkill(skillType), skillLevel);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets the XP of a player in a specific skill type.
|
|
||||||
* </br>
|
|
||||||
* This function is designed for API usage.
|
|
||||||
*
|
|
||||||
* @param player The player to set the XP of
|
|
||||||
* @param skillType The skill to set the XP for
|
|
||||||
* @param newValue The value to set the XP to
|
|
||||||
* @deprecated Use {@link #setXP(Player, String, int)} instead
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
public static void setXP(Player player, SkillType skillType, int newValue) {
|
|
||||||
UserManager.getPlayer(player).getProfile().setSkillXpLevel(skillType, newValue);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the XP of a player in a specific skill type.
|
* Sets the XP of a player in a specific skill type.
|
||||||
* </br>
|
* </br>
|
||||||
@ -507,21 +352,6 @@ public final class ExperienceAPI {
|
|||||||
getOfflineProfile(playerName).setSkillXpLevel(SkillType.getSkill(skillType), newValue);
|
getOfflineProfile(playerName).setSkillXpLevel(SkillType.getSkill(skillType), newValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Removes XP from a player in a specific skill type.
|
|
||||||
* </br>
|
|
||||||
* This function is designed for API usage.
|
|
||||||
*
|
|
||||||
* @param player The player to change the XP of
|
|
||||||
* @param skillType The skill to change the XP for
|
|
||||||
* @param xp The amount of XP to remove
|
|
||||||
* @deprecated Use {@link #removeXP(Player, String, int)} instead
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
public static void removeXP(Player player, SkillType skillType, int xp) {
|
|
||||||
UserManager.getPlayer(player).getProfile().removeXp(skillType, xp);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Removes XP from a player in a specific skill type.
|
* Removes XP from a player in a specific skill type.
|
||||||
* </br>
|
* </br>
|
||||||
@ -550,18 +380,6 @@ public final class ExperienceAPI {
|
|||||||
getOfflineProfile(playerName).removeXp(SkillType.getSkill(skillType), xp);
|
getOfflineProfile(playerName).removeXp(SkillType.getSkill(skillType), xp);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Check the XP of a player. This should be called after giving XP to process level-ups.
|
|
||||||
*
|
|
||||||
* @param player The player to check
|
|
||||||
* @param skillType The skill to check
|
|
||||||
* @deprecated Calling this function is no longer needed and should be avoided
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
private static void checkXP(Player player, SkillType skillType) {
|
|
||||||
SkillUtils.xpCheckSkill(skillType, player, UserManager.getProfile(player));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add XP to an offline player.
|
* Add XP to an offline player.
|
||||||
*
|
*
|
||||||
|
Loading…
Reference in New Issue
Block a user