Get rid of all the deprecated instances of Users.getProfile()

This commit is contained in:
GJ 2013-02-04 08:09:24 -05:00
parent 74c367c069
commit 44b862c0bb
19 changed files with 34 additions and 35 deletions

View File

@ -38,7 +38,7 @@ public class SkillResetCommand implements CommandExecutor {
}
modifiedPlayer = (Player) sender;
profile = Users.getProfile(modifiedPlayer);
profile = Users.getPlayer((Player) sender).getProfile();
profile.modifySkill(skill, 0);
if (skill == SkillType.ALL) {
@ -56,7 +56,7 @@ public class SkillResetCommand implements CommandExecutor {
case 2:
modifiedPlayer = mcMMO.p.getServer().getOfflinePlayer(args[0]);
profile = Users.getProfile(modifiedPlayer);
profile = Users.getPlayer(args[0]).getProfile();
// TODO:Not sure if we actually need a null check here
if (profile == null || !profile.isLoaded()) {

View File

@ -24,7 +24,7 @@ public class McabilityCommand implements CommandExecutor {
return true;
}
profile = Users.getProfile((Player) sender);
profile = Users.getPlayer((Player) sender).getProfile();
if (profile.getAbilityUse()) {
sender.sendMessage(LocaleLoader.getString("Commands.Ability.Off"));
@ -42,7 +42,7 @@ public class McabilityCommand implements CommandExecutor {
}
OfflinePlayer modifiedPlayer = mcMMO.p.getServer().getOfflinePlayer(args[0]);
profile = Users.getProfile(modifiedPlayer);
profile = Users.getPlayer(args[0]).getProfile();
// TODO:Not sure if we actually need a null check here
if (profile == null || !profile.isLoaded()) {

View File

@ -374,7 +374,7 @@ public class mcMMO extends JavaPlugin {
* @return the PlayerProfile object
*/
public PlayerProfile getPlayerProfile(String playerName) {
return Users.getProfile(playerName);
return Users.getPlayer(playerName).getProfile();
}
/**
@ -386,7 +386,7 @@ public class mcMMO extends JavaPlugin {
* @return the PlayerProfile object
*/
public PlayerProfile getPlayerProfile(OfflinePlayer player) {
return Users.getProfile(player);
return Users.getPlayer(player.getName()).getProfile();
}
/**

View File

@ -41,7 +41,7 @@ public abstract class SkillCommand implements CommandExecutor {
}
player = (Player) sender;
profile = Users.getProfile(player);
profile = Users.getPlayer(player).getProfile();
if (profile == null) {
sender.sendMessage(LocaleLoader.getString("Commands.DoesNotExist"));

View File

@ -153,7 +153,7 @@ public class Herbalism {
return;
}
PlayerProfile profile = Users.getProfile(player);
PlayerProfile profile = mcMMOPlayer.getProfile();
int herbLevel = profile.getSkillLevel(SkillType.HERBALISM);
Material blockType = block.getType();
@ -224,7 +224,7 @@ public class Herbalism {
* @param plugin mcMMO plugin instance
*/
private static void greenThumbWheat(Block block, Player player, BlockBreakEvent event, mcMMO plugin) {
PlayerProfile profile = Users.getProfile(player);
PlayerProfile profile = Users.getPlayer(player).getProfile();
int herbLevel = profile.getSkillLevel(SkillType.HERBALISM);
PlayerInventory inventory = player.getInventory();
boolean hasSeeds = false;
@ -320,7 +320,7 @@ public class Herbalism {
* @param block The block being used in the ability
*/
public static void greenThumbBlocks(ItemStack is, Player player, Block block) {
PlayerProfile profile = Users.getProfile(player);
PlayerProfile profile = Users.getPlayer(player).getProfile();
int skillLevel = profile.getSkillLevel(SkillType.HERBALISM);
int seeds = is.getAmount();
@ -340,7 +340,7 @@ public class Herbalism {
}
public static void hylianLuck(Block block, Player player, BlockBreakEvent event) {
int skillLevel = Users.getProfile(player).getSkillLevel(SkillType.HERBALISM);
int skillLevel = Users.getPlayer(player).getProfile().getSkillLevel(SkillType.HERBALISM);
double chance = (hylianLuckMaxChance / hylianLuckMaxLevel) * Misc.skillCheck(skillLevel, hylianLuckMaxLevel);
int activationChance = Misc.calculateActivationChance(Permissions.luckyHerbalism(player));

View File

@ -94,7 +94,7 @@ public class Repair {
return;
}
int rank = getArcaneForgingRank(Users.getProfile(player));
int rank = getArcaneForgingRank(Users.getPlayer(player).getProfile());
if (rank == 0 || !Permissions.arcaneForging(player)) {
for (Enchantment x : enchants.keySet()) {
@ -231,7 +231,7 @@ public class Repair {
* @return true if bonus granted, false otherwise
*/
public static boolean checkPlayerProcRepair(Player player) {
int skillLevel = Users.getProfile(player).getSkillLevel(SkillType.REPAIR);
int skillLevel = Users.getPlayer(player).getProfile().getSkillLevel(SkillType.REPAIR);
int chance = (int) ((SUPER_REPAIR_CHANCE_MAX / SUPER_REPAIR_MAX_BONUS_LEVEL) * skillLevel);
if (skillLevel >= SUPER_REPAIR_MAX_BONUS_LEVEL) chance = (int) SUPER_REPAIR_CHANCE_MAX;
@ -252,7 +252,7 @@ public class Repair {
* @param anvilID The item ID of the anvil block
*/
public static void placedAnvilCheck(Player player, int anvilID) {
PlayerProfile profile = Users.getProfile(player);
PlayerProfile profile = Users.getPlayer(player).getProfile();
if (!profile.getPlacedAnvil()) {
if (mcMMO.spoutEnabled) {

View File

@ -29,8 +29,7 @@ public class Salvage {
}
if (player.getGameMode() == GameMode.SURVIVAL) {
final PlayerProfile profile = Users.getProfile(player);
final int skillLevel = profile.getSkillLevel(SkillType.REPAIR);
final int skillLevel = Users.getPlayer(player).getProfile().getSkillLevel(SkillType.REPAIR);
final int unlockLevel = configInstance.getSalvageUnlockLevel();
if (skillLevel >= unlockLevel) {
@ -64,7 +63,7 @@ public class Salvage {
* @param anvilID The item ID of the anvil block
*/
public static void placedAnvilCheck(final Player player, final int anvilID) {
final PlayerProfile profile = Users.getProfile(player);
final PlayerProfile profile = Users.getPlayer(player).getProfile();
if (!profile.getPlacedSalvageAnvil()) {
if (mcMMO.spoutEnabled) {

View File

@ -15,7 +15,7 @@ public class SkillMonitor implements Runnable {
long curTime = System.currentTimeMillis();
for (Player player : mcMMO.p.getServer().getOnlinePlayers()) {
PlayerProfile profile = Users.getProfile(player);
PlayerProfile profile = Users.getPlayer(player).getProfile();
/*
* MONITOR SKILLS

View File

@ -20,7 +20,7 @@ public class IronGripEventHandler {
}
protected void calculateSkillModifier() {
this.skillModifier = Misc.skillCheck(Users.getProfile(defender).getSkillLevel(SkillType.UNARMED), Unarmed.ironGripMaxBonusLevel);
this.skillModifier = Misc.skillCheck(Users.getPlayer(defender).getProfile().getSkillLevel(SkillType.UNARMED), Unarmed.ironGripMaxBonusLevel);
}
protected void sendAbilityMessages() {

View File

@ -453,7 +453,7 @@ public final class CombatTools {
Player defender = (Player) target;
if (System.currentTimeMillis() >= Users.getProfile(defender).getRespawnATS() + 5) {
if (System.currentTimeMillis() >= Users.getPlayer(defender).getProfile().getRespawnATS() + 5) {
baseXP = 20 * configInstance.getPlayerVersusPlayerXP();
}
}
@ -569,7 +569,7 @@ public final class CombatTools {
if (entity instanceof Player) {
Player defender = (Player) entity;
if (!defender.getWorld().getPVP() || defender == player || PartyManager.inSameParty(player, defender) || Users.getProfile(defender).getGodMode()) {
if (!defender.getWorld().getPVP() || defender == player || PartyManager.inSameParty(player, defender) || Users.getPlayer(defender).getProfile().getGodMode()) {
return false;
}

View File

@ -27,7 +27,7 @@ public class SkillTools {
public static boolean abilitiesEnabled = Config.getInstance().getAbilitiesEnabled();
public static void handleFoodSkills(Player player, SkillType skill, FoodLevelChangeEvent event, int baseLevel, int maxLevel, int rankChange) {
int skillLevel = Users.getProfile(player).getSkillLevel(skill);
int skillLevel = Users.getPlayer(player).getProfile().getSkillLevel(skill);
int currentFoodLevel = player.getFoodLevel();
int newFoodLevel = event.getFoodLevel();
int foodChange = newFoodLevel - currentFoodLevel;
@ -130,7 +130,7 @@ public class SkillTools {
return;
}
PlayerProfile profile = Users.getProfile(player);
PlayerProfile profile = Users.getPlayer(player).getProfile();
AbilityType ability = skill.getAbility();
ToolType tool = skill.getTool();
ItemStack inHand = player.getItemInHand();
@ -421,7 +421,7 @@ public class SkillTools {
* @param type The skill the ability is based on
*/
public static void abilityCheck(Player player, SkillType type) {
PlayerProfile profile = Users.getProfile(player);
PlayerProfile profile = Users.getPlayer(player).getProfile();
ToolType tool = type.getTool();
AbilityType ability = type.getAbility();

View File

@ -141,7 +141,7 @@ public enum SkillType {
* @return the player's skill level
*/
public int getSkillLevel(Player player) {
return Users.getProfile(player).getSkillLevel(this);
return Users.getPlayer(player).getProfile().getSkillLevel(this);
}
// TODO: This is a little "hacky", we probably need to add something to distinguish child skills in the enum, or to use another enum for them

View File

@ -131,7 +131,7 @@ public final class Woodcutting {
Player player = mcMMOPlayer.getPlayer();
double configDoubleDropChance = ADVANCED_CONFIG.getWoodcuttingDoubleDropChance();
int configDoubleDropMaxLevel = ADVANCED_CONFIG.getWoodcuttingDoubleDropMaxLevel();
int probability = (int) ((configDoubleDropChance / configDoubleDropMaxLevel) * Users.getProfile(player).getSkillLevel(SkillType.WOODCUTTING));
int probability = (int) ((configDoubleDropChance / configDoubleDropMaxLevel) * Users.getPlayer(player).getProfile().getSkillLevel(SkillType.WOODCUTTING));
int activationChance = Misc.calculateActivationChance(Permissions.luckyWoodcutting(player));
if (probability > configDoubleDropChance) {

View File

@ -64,7 +64,7 @@ public class SpoutListener implements Listener {
if (event.getScreen() instanceof Menu) {
SpoutPlayer spoutPlayer = event.getPlayer();
Users.getProfile(spoutPlayer).getSpoutHud().onMenuClose();
Users.getPlayer(spoutPlayer).getProfile().getSpoutHud().onMenuClose();
spoutPlayer.getMainScreen().setDirty(true);
}
}
@ -83,7 +83,7 @@ public class SpoutListener implements Listener {
}
if (event.getKey() == SpoutTools.menuKey) {
SpoutHud spoutHud = Users.getProfile(spoutPlayer).getSpoutHud();
SpoutHud spoutHud = Users.getPlayer(spoutPlayer).getProfile().getSpoutHud();
if (!spoutHud.isMenuOpened()) {
spoutHud.openMenu();

View File

@ -236,7 +236,7 @@ public class SpoutTools {
* @param spoutPlayer The player that leveled up
*/
public static void levelUpNotification(SkillType skillType, SpoutPlayer spoutPlayer) {
PlayerProfile profile = Users.getProfile(spoutPlayer);
PlayerProfile profile = Users.getPlayer(spoutPlayer).getProfile();
int notificationTier = getNotificationTier(profile.getSkillLevel(skillType));
Material mat = null;

View File

@ -30,7 +30,7 @@ public class MchudCommand implements CommandExecutor {
}
Player player = (Player) sender;
PlayerProfile playerProfile = Users.getProfile(player);
PlayerProfile playerProfile = Users.getPlayer(player).getProfile();
SpoutHud spoutHud = playerProfile.getSpoutHud();
if (spoutHud == null) {

View File

@ -32,7 +32,7 @@ public class XplockCommand implements CommandExecutor {
}
Player player = (Player) sender;
PlayerProfile playerProfile = Users.getProfile(player);
PlayerProfile playerProfile = Users.getPlayer(player).getProfile();
SpoutHud spoutHud = playerProfile.getSpoutHud();
if (spoutHud == null) {

View File

@ -25,7 +25,7 @@ public final class ChimaeraWing {
return;
}
PlayerProfile profile = Users.getProfile(player);
PlayerProfile profile = Users.getPlayer(player).getProfile();
Block block = player.getLocation().getBlock();
int amount = inHand.getAmount();
long recentlyHurt = profile.getRecentlyHurt();

View File

@ -20,7 +20,7 @@ public final class Hardcore {
return;
}
PlayerProfile playerProfile = Users.getProfile(player);
PlayerProfile playerProfile = Users.getPlayer(player).getProfile();
int totalLost = 0;
for (SkillType skillType : SkillType.values()) {
@ -49,8 +49,8 @@ public final class Hardcore {
return;
}
PlayerProfile killerProfile = Users.getProfile(killer);
PlayerProfile victimProfile = Users.getProfile(victim);
PlayerProfile killerProfile = Users.getPlayer(killer).getProfile();
PlayerProfile victimProfile = Users.getPlayer(victim).getProfile();
int totalStolen = 0;
for (SkillType skillType : SkillType.values()) {