mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-26 15:16:45 +01:00
Replaced deprecated calls to Users.getProfile in our APIs
This commit is contained in:
parent
a1ab6f286b
commit
97d47c19b7
@ -2,6 +2,7 @@ package com.gmail.nossr50.api;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.gmail.nossr50.datatypes.PlayerProfile;
|
||||
import com.gmail.nossr50.skills.utilities.AbilityType;
|
||||
import com.gmail.nossr50.util.Users;
|
||||
|
||||
@ -9,36 +10,38 @@ public final class AbilityAPI {
|
||||
private AbilityAPI() {}
|
||||
|
||||
public static boolean berserkEnabled(Player player) {
|
||||
return Users.getProfile(player).getAbilityMode(AbilityType.BERSERK);
|
||||
return Users.getPlayer(player).getProfile().getAbilityMode(AbilityType.BERSERK);
|
||||
}
|
||||
|
||||
public static boolean gigaDrillBreakerEnabled(Player player) {
|
||||
return Users.getProfile(player).getAbilityMode(AbilityType.GIGA_DRILL_BREAKER);
|
||||
return Users.getPlayer(player).getProfile().getAbilityMode(AbilityType.GIGA_DRILL_BREAKER);
|
||||
}
|
||||
|
||||
public static boolean greenTerraEnabled(Player player) {
|
||||
return Users.getProfile(player).getAbilityMode(AbilityType.GREEN_TERRA);
|
||||
return Users.getPlayer(player).getProfile().getAbilityMode(AbilityType.GREEN_TERRA);
|
||||
}
|
||||
|
||||
public static boolean serratedStrikesEnabled(Player player) {
|
||||
return Users.getProfile(player).getAbilityMode(AbilityType.SERRATED_STRIKES);
|
||||
return Users.getPlayer(player).getProfile().getAbilityMode(AbilityType.SERRATED_STRIKES);
|
||||
}
|
||||
|
||||
public static boolean skullSplitterEnabled(Player player) {
|
||||
return Users.getProfile(player).getAbilityMode(AbilityType.SKULL_SPLIITER);
|
||||
return Users.getPlayer(player).getProfile().getAbilityMode(AbilityType.SKULL_SPLIITER);
|
||||
}
|
||||
|
||||
public static boolean superBreakerEnabled(Player player) {
|
||||
return Users.getProfile(player).getAbilityMode(AbilityType.SUPER_BREAKER);
|
||||
return Users.getPlayer(player).getProfile().getAbilityMode(AbilityType.SUPER_BREAKER);
|
||||
}
|
||||
|
||||
public static boolean treeFellerEnabled(Player player) {
|
||||
return Users.getProfile(player).getAbilityMode(AbilityType.TREE_FELLER);
|
||||
return Users.getPlayer(player).getProfile().getAbilityMode(AbilityType.TREE_FELLER);
|
||||
}
|
||||
|
||||
public static boolean isAnyAbilityEnabled(Player player) {
|
||||
PlayerProfile profile = Users.getPlayer(player).getProfile();
|
||||
|
||||
for (AbilityType ability : AbilityType.values()) {
|
||||
if (Users.getProfile(player).getAbilityMode(ability)) {
|
||||
if (profile.getAbilityMode(ability)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -75,7 +75,7 @@ public final class ExperienceAPI {
|
||||
* @return the amount of XP in a given skill
|
||||
*/
|
||||
public static int getXP(Player player, SkillType skillType) {
|
||||
return Users.getProfile(player).getSkillXpLevel(skillType);
|
||||
return Users.getPlayer(player).getProfile().getSkillXpLevel(skillType);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -88,7 +88,7 @@ public final class ExperienceAPI {
|
||||
* @return the amount of XP left before leveling up a specifc skill
|
||||
*/
|
||||
public static int getXPToNextLevel(Player player, SkillType skillType) {
|
||||
return Users.getProfile(player).getXpToLevel(skillType);
|
||||
return Users.getPlayer(player).getProfile().getXpToLevel(skillType);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -121,7 +121,7 @@ public final class ExperienceAPI {
|
||||
* @param notify True if this should fire a level up notification, false otherwise.
|
||||
*/
|
||||
public static void addLevel(Player player, SkillType skillType, int levels) {
|
||||
Users.getProfile(player).addLevels(skillType, levels);
|
||||
Users.getPlayer(player).getProfile().addLevels(skillType, levels);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -134,7 +134,7 @@ public final class ExperienceAPI {
|
||||
* @return the level of a given skill
|
||||
*/
|
||||
public static int getLevel(Player player, SkillType skillType) {
|
||||
return Users.getProfile(player).getSkillLevel(skillType);
|
||||
return Users.getPlayer(player).getProfile().getSkillLevel(skillType);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -159,7 +159,7 @@ public final class ExperienceAPI {
|
||||
* @param skillLevel The value to set the level to
|
||||
*/
|
||||
public static void setLevel(Player player, SkillType skillType, int skillLevel) {
|
||||
Users.getProfile(player).modifySkill(skillType, skillLevel);
|
||||
Users.getPlayer(player).getProfile().modifySkill(skillType, skillLevel);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -172,7 +172,7 @@ public final class ExperienceAPI {
|
||||
* @param newValue The value to set the XP to
|
||||
*/
|
||||
public static void setXP(Player player, SkillType skillType, int newValue) {
|
||||
Users.getProfile(player).setSkillXpLevel(skillType, newValue);
|
||||
Users.getPlayer(player).getProfile().setSkillXpLevel(skillType, newValue);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -185,6 +185,6 @@ public final class ExperienceAPI {
|
||||
* @param xp The amount of XP to remove
|
||||
*/
|
||||
public static void removeXP(Player player, SkillType skillType, int xp) {
|
||||
Users.getProfile(player).removeXp(skillType, xp);
|
||||
Users.getPlayer(player).getProfile().removeXp(skillType, xp);
|
||||
}
|
||||
}
|
||||
|
@ -20,7 +20,7 @@ public final class PartyAPI {
|
||||
* @return the name of the player's party
|
||||
*/
|
||||
public static String getPartyName(Player player) {
|
||||
return Users.getProfile(player).getParty().getName();
|
||||
return Users.getPlayer(player).getProfile().getParty().getName();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -32,7 +32,7 @@ public final class PartyAPI {
|
||||
* @return true if the player is in a party, false otherwise
|
||||
*/
|
||||
public static boolean inParty(Player player) {
|
||||
return Users.getProfile(player).inParty();
|
||||
return Users.getPlayer(player).getProfile().inParty();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -77,7 +77,7 @@ public final class PartyAPI {
|
||||
party.setLeader(playerName);
|
||||
}
|
||||
|
||||
PartyManager.addToParty(playerName, Users.getProfile(player), party);
|
||||
PartyManager.addToParty(playerName, Users.getPlayer(player).getProfile(), party);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -88,7 +88,7 @@ public final class PartyAPI {
|
||||
* @param player The player to remove
|
||||
*/
|
||||
public static void removeFromParty(Player player) {
|
||||
PartyManager.removeFromParty(player.getName(), Users.getProfile(player).getParty());
|
||||
PartyManager.removeFromParty(player.getName(), Users.getPlayer(player).getProfile().getParty());
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user