mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2025-01-19 08:55:26 +01:00
Deprecated most functions in ExperienceAPI, replaced them with identical
versions that use a String for the SkillName rather than the SkillType enum values
This commit is contained in:
parent
a13d28a6ec
commit
215bd0f4a2
@ -66,6 +66,7 @@ Version 1.4.00-dev
|
|||||||
! Changed the way party teleportation works. When using /ptp, the target player needs to confirm the teleport before it takes place. (Configurable)
|
! Changed the way party teleportation works. When using /ptp, the target player needs to confirm the teleport before it takes place. (Configurable)
|
||||||
! Changed BeastLore: Now also displays offline player names
|
! Changed BeastLore: Now also displays offline player names
|
||||||
! Changed backup task to include ALL config files
|
! Changed backup task to include ALL config files
|
||||||
|
! Deprecated most functions in ExperienceAPI, replaced them with identical versions that use a String for the SkillName rather than the SkillType enum values
|
||||||
- Removed Party "master/apprentice" system. Replaced with the new party XP share feature.
|
- Removed Party "master/apprentice" system. Replaced with the new party XP share feature.
|
||||||
- Removed unused "healthbar" files from the resources
|
- Removed unused "healthbar" files from the resources
|
||||||
- Removed config options for disabling commands from the config.yml. This should instead be done through permissions.
|
- Removed config options for disabling commands from the config.yml. This should instead be done through permissions.
|
||||||
|
@ -17,6 +17,7 @@ public final class ExperienceAPI {
|
|||||||
* @param skillType The skill to check
|
* @param skillType The skill to check
|
||||||
* @deprecated Calling this function is no longer needed and should be avoided
|
* @deprecated Calling this function is no longer needed and should be avoided
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
private static void checkXP(Player player, SkillType skillType) {
|
private static void checkXP(Player player, SkillType skillType) {
|
||||||
SkillTools.xpCheckSkill(skillType, player, Users.getProfile(player));
|
SkillTools.xpCheckSkill(skillType, player, Users.getProfile(player));
|
||||||
}
|
}
|
||||||
@ -29,11 +30,41 @@ public final class ExperienceAPI {
|
|||||||
* @param player The player to add XP to
|
* @param player The player to add XP to
|
||||||
* @param skillType The skill to add XP to
|
* @param skillType The skill to add XP to
|
||||||
* @param XP The amount of XP to add
|
* @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) {
|
public static void addRawXP(Player player, SkillType skillType, int XP) {
|
||||||
Users.getPlayer(player).applyXpGain(skillType, XP);
|
Users.getPlayer(player).applyXpGain(skillType, XP);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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
|
||||||
|
*/
|
||||||
|
public static void addRawXP(Player player, String skillType, int XP) {
|
||||||
|
Users.getPlayer(player).applyXpGain(SkillType.getSkill(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) {
|
||||||
|
Users.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>
|
||||||
@ -43,8 +74,23 @@ public final class ExperienceAPI {
|
|||||||
* @param skillType The skill to add XP to
|
* @param skillType The skill to add XP to
|
||||||
* @param XP The amount of XP to add
|
* @param XP The amount of XP to add
|
||||||
*/
|
*/
|
||||||
public static void addMultipliedXP(Player player, SkillType skillType, int XP) {
|
public static void addMultipliedXP(Player player, String skillType, int XP) {
|
||||||
Users.getPlayer(player).applyXpGain(skillType, (int) (XP * Config.getInstance().getExperienceGainsGlobalMultiplier()));
|
Users.getPlayer(player).applyXpGain(SkillType.getSkill(skillType), (int) (XP * 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) {
|
||||||
|
Users.getPlayer(player).beginXpGain(skillType, XP);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -56,8 +102,23 @@ public final class ExperienceAPI {
|
|||||||
* @param skillType The skill to add XP to
|
* @param skillType The skill to add XP to
|
||||||
* @param XP The amount of XP to add
|
* @param XP The amount of XP to add
|
||||||
*/
|
*/
|
||||||
public static void addXP(Player player, SkillType skillType, int XP) {
|
public static void addXP(Player player, String skillType, int XP) {
|
||||||
Users.getPlayer(player).beginXpGain(skillType, XP);
|
Users.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 Users.getPlayer(player).getProfile().getSkillXpLevel(skillType);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -69,8 +130,23 @@ public final class ExperienceAPI {
|
|||||||
* @param skillType The skill to get XP for
|
* @param skillType The skill to get XP for
|
||||||
* @return the amount of XP in a given skill
|
* @return the amount of XP in a given skill
|
||||||
*/
|
*/
|
||||||
public static int getXP(Player player, SkillType skillType) {
|
public static int getXP(Player player, String skillType) {
|
||||||
return Users.getPlayer(player).getProfile().getSkillXpLevel(skillType);
|
return Users.getPlayer(player).getProfile().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 Users.getPlayer(player).getProfile().getXpToLevel(skillType);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -82,8 +158,8 @@ public final class ExperienceAPI {
|
|||||||
* @param skillType The skill 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
|
* @return the amount of XP left before leveling up a specifc skill
|
||||||
*/
|
*/
|
||||||
public static int getXPToNextLevel(Player player, SkillType skillType) {
|
public static int getXPToNextLevel(Player player, String skillType) {
|
||||||
return Users.getPlayer(player).getProfile().getXpToLevel(skillType);
|
return Users.getPlayer(player).getProfile().getXpToLevel(SkillType.getSkill(skillType));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -113,12 +189,41 @@ public final class ExperienceAPI {
|
|||||||
* @param player The player to add levels to
|
* @param player The player to add levels to
|
||||||
* @param skillType Type of skill to add levels to
|
* @param skillType Type of skill to add levels to
|
||||||
* @param levels Number of levels to add
|
* @param levels Number of levels to add
|
||||||
* @param notify True if this should fire a level up notification, false otherwise.
|
* @deprecated Use {@link #addLevel(Player, String, int)} instead
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
public static void addLevel(Player player, SkillType skillType, int levels) {
|
public static void addLevel(Player player, SkillType skillType, int levels) {
|
||||||
Users.getPlayer(player).getProfile().addLevels(skillType, levels);
|
Users.getPlayer(player).getProfile().addLevels(skillType, levels);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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
|
||||||
|
*/
|
||||||
|
public static void addLevel(Player player, String skillType, int levels) {
|
||||||
|
Users.getPlayer(player).getProfile().addLevels(SkillType.getSkill(skillType), levels);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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 Users.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>
|
||||||
@ -128,8 +233,8 @@ public final class ExperienceAPI {
|
|||||||
* @param skillType The skill to get the level for
|
* @param skillType The skill to get the level for
|
||||||
* @return the level of a given skill
|
* @return the level of a given skill
|
||||||
*/
|
*/
|
||||||
public static int getLevel(Player player, SkillType skillType) {
|
public static int getLevel(Player player, String skillType) {
|
||||||
return Users.getPlayer(player).getProfile().getSkillLevel(skillType);
|
return Users.getPlayer(player).getProfile().getSkillLevel(SkillType.getSkill(skillType));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -152,11 +257,41 @@ public final class ExperienceAPI {
|
|||||||
* @param player The player to set the level of
|
* @param player The player to set the level of
|
||||||
* @param skillType The skill to set the level for
|
* @param skillType The skill to set the level for
|
||||||
* @param skillLevel The value to set the level to
|
* @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) {
|
public static void setLevel(Player player, SkillType skillType, int skillLevel) {
|
||||||
Users.getPlayer(player).getProfile().modifySkill(skillType, skillLevel);
|
Users.getPlayer(player).getProfile().modifySkill(skillType, skillLevel);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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
|
||||||
|
*/
|
||||||
|
public static void setLevel(Player player, String skillType, int skillLevel) {
|
||||||
|
Users.getPlayer(player).getProfile().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) {
|
||||||
|
Users.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>
|
||||||
@ -166,8 +301,23 @@ public final class ExperienceAPI {
|
|||||||
* @param skillType The skill to set the XP for
|
* @param skillType The skill to set the XP for
|
||||||
* @param newValue The value to set the XP to
|
* @param newValue The value to set the XP to
|
||||||
*/
|
*/
|
||||||
public static void setXP(Player player, SkillType skillType, int newValue) {
|
public static void setXP(Player player, String skillType, int newValue) {
|
||||||
Users.getPlayer(player).getProfile().setSkillXpLevel(skillType, newValue);
|
Users.getPlayer(player).getProfile().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) {
|
||||||
|
Users.getPlayer(player).getProfile().removeXp(skillType, xp);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -179,7 +329,7 @@ public final class ExperienceAPI {
|
|||||||
* @param skillType The skill to change the XP for
|
* @param skillType The skill to change the XP for
|
||||||
* @param xp The amount of XP to remove
|
* @param xp The amount of XP to remove
|
||||||
*/
|
*/
|
||||||
public static void removeXP(Player player, SkillType skillType, int xp) {
|
public static void removeXP(Player player, String skillType, int xp) {
|
||||||
Users.getPlayer(player).getProfile().removeXp(skillType, xp);
|
Users.getPlayer(player).getProfile().removeXp(SkillType.getSkill(skillType), xp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user