Because PP is an awful variable name.

This commit is contained in:
GJ
2012-07-03 10:04:04 -04:00
parent 96e70aa4d2
commit caf9c07ba3
29 changed files with 214 additions and 214 deletions

View File

@ -61,7 +61,7 @@ public class Combat {
case PLAYER:
Player attacker = (Player) event.getDamager();
ItemStack itemInHand = attacker.getItemInHand();
PlayerProfile PPa = Users.getProfile(attacker);
PlayerProfile attackerProfile = Users.getProfile(attacker);
if (ItemChecks.isSword(itemInHand)) {
if (targetIsPlayer || targetIsTamedPet) {
@ -79,11 +79,11 @@ public class Combat {
swordsManager.bleedCheck(target);
if (PPa.getAbilityMode(AbilityType.SERRATED_STRIKES)) {
if (attackerProfile.getAbilityMode(AbilityType.SERRATED_STRIKES)) {
swordsManager.serratedStrikes(target, event.getDamage());
}
startGainXp(attacker, PPa, target, SkillType.SWORDS);
startGainXp(attacker, attackerProfile, target, SkillType.SWORDS);
}
else if (ItemChecks.isAxe(itemInHand) && permInstance.axes(attacker)) {
if (targetIsPlayer || targetIsTamedPet) {
@ -109,11 +109,11 @@ public class Combat {
Axes.impact(attacker, target, event);
}
if (PPa.getAbilityMode(AbilityType.SKULL_SPLIITER) && permInstance.skullSplitter(attacker)) {
if (attackerProfile.getAbilityMode(AbilityType.SKULL_SPLIITER) && permInstance.skullSplitter(attacker)) {
applyAbilityAoE(attacker, target, event.getDamage() / 2, SkillType.AXES);
}
startGainXp(attacker, PPa, target, SkillType.AXES);
startGainXp(attacker, attackerProfile, target, SkillType.AXES);
}
else if (itemInHand.getType() == Material.AIR && permInstance.unarmed(attacker)) {
if (targetIsPlayer || targetIsTamedPet) {
@ -131,7 +131,7 @@ public class Combat {
unarmedManager.bonusDamage(event);
if (PPa.getAbilityMode(AbilityType.BERSERK) && permInstance.berserk(attacker)) {
if (attackerProfile.getAbilityMode(AbilityType.BERSERK) && permInstance.berserk(attacker)) {
event.setDamage((int) (event.getDamage() * 1.5));
}
@ -139,7 +139,7 @@ public class Combat {
unarmedManager.disarmCheck((Player) target);
}
startGainXp(attacker, PPa, target, SkillType.UNARMED);
startGainXp(attacker, attackerProfile, target, SkillType.UNARMED);
}
else if (itemInHand.getType() == Material.BONE && target instanceof Tameable) {
TamingManager tamingManager = new TamingManager(attacker);
@ -257,8 +257,8 @@ public class Combat {
}
if (target != shooter) {
PlayerProfile PP = Users.getProfile(shooter);
startGainXp(shooter, PP, target, SkillType.ARCHERY);
PlayerProfile profile = Users.getProfile(shooter);
startGainXp(shooter, profile, target, SkillType.ARCHERY);
}
}
@ -380,11 +380,11 @@ public class Combat {
* Start the task that gives combat XP.
*
* @param attacker The attacking player
* @param PP The player's PlayerProfile
* @param profile The player's PlayerProfile
* @param target The defending entity
* @param skillType The skill being used
*/
public static void startGainXp(Player attacker, PlayerProfile PP, LivingEntity target, SkillType skillType) {
public static void startGainXp(Player attacker, PlayerProfile profile, LivingEntity target, SkillType skillType) {
double baseXP = 0;
if (target instanceof Player) {
@ -474,7 +474,7 @@ public class Combat {
}
if (baseXP != 0) {
mcMMO.p.getServer().getScheduler().scheduleSyncDelayedTask(mcMMO.p, new GainXp(attacker, PP, skillType, baseXP, target), 0);
mcMMO.p.getServer().getScheduler().scheduleSyncDelayedTask(mcMMO.p, new GainXp(attacker, profile, skillType, baseXP, target), 0);
}
}

View File

@ -26,13 +26,13 @@ public class Item {
}
private static void chimaeraWing(Player player) {
PlayerProfile PP = Users.getProfile(player);
PlayerProfile profile = Users.getProfile(player);
ItemStack inHand = player.getItemInHand();
Block block = player.getLocation().getBlock();
int amount = inHand.getAmount();
if (Permissions.getInstance().chimaeraWing(player) && inHand.getTypeId() == Config.getInstance().getChimaeraItemId()) {
if (Skills.cooldownOver(PP.getRecentlyHurt(), 60, player) && amount >= Config.getInstance().getChimaeraCost()) {
if (Skills.cooldownOver(profile.getRecentlyHurt(), 60, player) && amount >= Config.getInstance().getChimaeraCost()) {
player.setItemInHand(new ItemStack(Config.getInstance().getChimaeraItemId(), amount - Config.getInstance().getChimaeraCost()));
for (int y = 1; block.getY() + y < player.getWorld().getMaxHeight(); y++) {
@ -52,8 +52,8 @@ public class Item {
player.sendMessage(LocaleLoader.getString("Item.ChimaeraWing.Pass"));
}
else if (!Skills.cooldownOver(PP.getRecentlyHurt(), 60, player) && amount >= Config.getInstance().getChimaeraCost()) {
player.sendMessage(LocaleLoader.getString("Item.Injured.Wait", new Object[] {Skills.calculateTimeLeft(PP.getRecentlyHurt(), 60)}));
else if (!Skills.cooldownOver(profile.getRecentlyHurt(), 60, player) && amount >= Config.getInstance().getChimaeraCost()) {
player.sendMessage(LocaleLoader.getString("Item.Injured.Wait", new Object[] {Skills.calculateTimeLeft(profile.getRecentlyHurt(), 60)}));
}
else if (amount <= Config.getInstance().getChimaeraCost()) {
player.sendMessage(LocaleLoader.getString("Skills.NeedMore")+ " " + ChatColor.GRAY + Misc.prettyItemString(Config.getInstance().getChimaeraItemId()));

View File

@ -75,12 +75,12 @@ public class Skills {
* Sends a message to the player when the cooldown expires.
*
* @param player The player to send a message to
* @param PP The profile of the player
* @param profile The profile of the player
* @param ability The ability to watch cooldowns for
*/
public static void watchCooldown(Player player, PlayerProfile PP, AbilityType ability) {
if (!PP.getAbilityInformed(ability) && cooldownOver(PP.getSkillDATS(ability) * TIME_CONVERSION_FACTOR, ability.getCooldown(), player)) {
PP.setAbilityInformed(ability, true);
public static void watchCooldown(Player player, PlayerProfile profile, AbilityType ability) {
if (!profile.getAbilityInformed(ability) && cooldownOver(profile.getSkillDATS(ability) * TIME_CONVERSION_FACTOR, ability.getCooldown(), player)) {
profile.setAbilityInformed(ability, true);
player.sendMessage(ability.getAbilityRefresh());
}
}
@ -96,7 +96,7 @@ public class Skills {
return;
}
PlayerProfile PP = Users.getProfile(player);
PlayerProfile profile = Users.getProfile(player);
AbilityType ability = skill.getAbility();
ToolType tool = skill.getTool();
ItemStack inHand = player.getItemInHand();
@ -106,12 +106,12 @@ public class Skills {
}
/* Check if any abilities are active */
if (!PP.getAbilityUse()) {
if (!profile.getAbilityUse()) {
return;
}
for (AbilityType x : AbilityType.values()) {
if (PP.getAbilityMode(x)) {
if (profile.getAbilityMode(x)) {
return;
}
}
@ -119,10 +119,10 @@ public class Skills {
/* Woodcutting & Axes need to be treated differently.
* Basically the tool always needs to ready and we check to see if the cooldown is over when the user takes action
*/
if (ability.getPermissions(player) && tool.inHand(inHand) && !PP.getToolPreparationMode(tool)) {
if (ability.getPermissions(player) && tool.inHand(inHand) && !profile.getToolPreparationMode(tool)) {
if (skill != SkillType.WOODCUTTING && skill != SkillType.AXES) {
if (!PP.getAbilityMode(ability) && !cooldownOver(PP.getSkillDATS(ability) * TIME_CONVERSION_FACTOR, ability.getCooldown(), player)) {
player.sendMessage(LocaleLoader.getString("Skills.TooTired") + ChatColor.YELLOW + " (" + calculateTimeLeft(PP.getSkillDATS(ability) * TIME_CONVERSION_FACTOR, ability.getCooldown()) + "s)");
if (!profile.getAbilityMode(ability) && !cooldownOver(profile.getSkillDATS(ability) * TIME_CONVERSION_FACTOR, ability.getCooldown(), player)) {
player.sendMessage(LocaleLoader.getString("Skills.TooTired") + ChatColor.YELLOW + " (" + calculateTimeLeft(profile.getSkillDATS(ability) * TIME_CONVERSION_FACTOR, ability.getCooldown()) + "s)");
return;
}
}
@ -131,8 +131,8 @@ public class Skills {
player.sendMessage(tool.getRaiseTool());
}
PP.setToolPreparationATS(tool, System.currentTimeMillis());
PP.setToolPreparationMode(tool, true);
profile.setToolPreparationATS(tool, System.currentTimeMillis());
profile.setToolPreparationMode(tool, true);
}
}
@ -140,18 +140,18 @@ public class Skills {
* Monitors various things relating to skill abilities.
*
* @param player The player using the skill
* @param PP The profile of the player
* @param profile The profile of the player
* @param curTime The current system time
* @param skill The skill being monitored
*/
public static void monitorSkill(Player player, PlayerProfile PP, long curTime, SkillType skill) {
public static void monitorSkill(Player player, PlayerProfile profile, long curTime, SkillType skill) {
final int FOUR_SECONDS = 4000;
ToolType tool = skill.getTool();
AbilityType ability = skill.getAbility();
if (PP.getToolPreparationMode(tool) && curTime - (PP.getToolPreparationATS(tool) * TIME_CONVERSION_FACTOR) >= FOUR_SECONDS) {
PP.setToolPreparationMode(tool, false);
if (profile.getToolPreparationMode(tool) && curTime - (profile.getToolPreparationATS(tool) * TIME_CONVERSION_FACTOR) >= FOUR_SECONDS) {
profile.setToolPreparationMode(tool, false);
if (Config.getInstance().getAbilityMessagesEnabled()) {
player.sendMessage(tool.getLowerTool());
@ -159,9 +159,9 @@ public class Skills {
}
if (ability.getPermissions(player)) {
if (PP.getAbilityMode(ability) && (PP.getSkillDATS(ability) * TIME_CONVERSION_FACTOR) <= curTime) {
PP.setAbilityMode(ability, false);
PP.setAbilityInformed(ability, false);
if (profile.getAbilityMode(ability) && (profile.getSkillDATS(ability) * TIME_CONVERSION_FACTOR) <= curTime) {
profile.setAbilityMode(ability, false);
profile.setAbilityInformed(ability, false);
player.sendMessage(ability.getAbilityOff());
for (Player nearbyPlayer : player.getWorld().getPlayers()) {
@ -180,14 +180,14 @@ public class Skills {
* @param player The player whose skill to update
*/
public static void processLeaderboardUpdate(SkillType skillType, Player player) {
PlayerProfile PP = Users.getProfile(player);
PlayerProfile profile = Users.getProfile(player);
PlayerStat ps = new PlayerStat();
if (skillType != SkillType.ALL) {
ps.statVal = PP.getSkillLevel(skillType);
ps.statVal = profile.getSkillLevel(skillType);
}
else {
ps.statVal = PP.getPowerLevel();
ps.statVal = profile.getPowerLevel();
}
ps.name = player.getName();
@ -389,14 +389,14 @@ public class Skills {
* @param type The skill the ability is based on
*/
public static void abilityCheck(Player player, SkillType type) {
PlayerProfile PP = Users.getProfile(player);
PlayerProfile profile = Users.getProfile(player);
ToolType tool = type.getTool();
if (!PP.getToolPreparationMode(tool)) {
if (!profile.getToolPreparationMode(tool)) {
return;
}
PP.setToolPreparationMode(tool, false);
profile.setToolPreparationMode(tool, false);
AbilityType ability = type.getAbility();
@ -404,13 +404,13 @@ public class Skills {
* We show them the too tired message when they take action.
*/
if (type == SkillType.WOODCUTTING || type == SkillType.AXES) {
if (!PP.getAbilityMode(ability) && !cooldownOver(PP.getSkillDATS(ability) * TIME_CONVERSION_FACTOR, ability.getCooldown(), player)) {
player.sendMessage(LocaleLoader.getString("Skills.TooTired") + ChatColor.YELLOW + " (" + calculateTimeLeft(PP.getSkillDATS(ability) * TIME_CONVERSION_FACTOR, ability.getCooldown()) + "s)");
if (!profile.getAbilityMode(ability) && !cooldownOver(profile.getSkillDATS(ability) * TIME_CONVERSION_FACTOR, ability.getCooldown(), player)) {
player.sendMessage(LocaleLoader.getString("Skills.TooTired") + ChatColor.YELLOW + " (" + calculateTimeLeft(profile.getSkillDATS(ability) * TIME_CONVERSION_FACTOR, ability.getCooldown()) + "s)");
return;
}
}
int ticks = 2 + (PP.getSkillLevel(type) / 50);
int ticks = 2 + (profile.getSkillLevel(type) / 50);
if (player.hasPermission("mcmmo.perks.activationtime.twelveseconds")) {
ticks = ticks + 12;
@ -428,7 +428,7 @@ public class Skills {
ticks = maxTicks;
}
if (!PP.getAbilityMode(ability) && cooldownOver(PP.getSkillDATS(ability), ability.getCooldown(), player)) {
if (!profile.getAbilityMode(ability) && cooldownOver(profile.getSkillDATS(ability), ability.getCooldown(), player)) {
player.sendMessage(ability.getAbilityOn());
for (Player y : player.getWorld().getPlayers()) {
@ -437,8 +437,8 @@ public class Skills {
}
}
PP.setSkillDATS(ability, System.currentTimeMillis() + (ticks * TIME_CONVERSION_FACTOR));
PP.setAbilityMode(ability, true);
profile.setSkillDATS(ability, System.currentTimeMillis() + (ticks * TIME_CONVERSION_FACTOR));
profile.setAbilityMode(ability, true);
}
}