diff --git a/src/main/java/com/gmail/nossr50/api/ExperienceAPI.java b/src/main/java/com/gmail/nossr50/api/ExperienceAPI.java index 304f7e117..2d429e01f 100644 --- a/src/main/java/com/gmail/nossr50/api/ExperienceAPI.java +++ b/src/main/java/com/gmail/nossr50/api/ExperienceAPI.java @@ -61,7 +61,7 @@ public class ExperienceAPI { * @param XP The amount of XP to add */ public void addXP(Player player, SkillType skillType, int XP) { - Users.getProfile(player).addXP(skillType, XP); + Users.getProfile(player).addXP(player, skillType, XP); checkXP(player, skillType); } diff --git a/src/main/java/com/gmail/nossr50/datatypes/PlayerProfile.java b/src/main/java/com/gmail/nossr50/datatypes/PlayerProfile.java index 5b38c7aa1..2a0415efc 100644 --- a/src/main/java/com/gmail/nossr50/datatypes/PlayerProfile.java +++ b/src/main/java/com/gmail/nossr50/datatypes/PlayerProfile.java @@ -1000,13 +1000,11 @@ public class PlayerProfile { /** * Adds XP to the player, this is affected by skill modifiers and XP Rate * + * @param player The player to add XP to * @param skillType The skill to add XP to * @param newvalue The amount of XP to add - * @param player The player to add XP to */ - public void addXP(SkillType skillType, int newValue) { - Player player = mcMMO.p.getServer().getPlayer(playerName); - + public void addXP(Player player, SkillType skillType, int newValue) { if (System.currentTimeMillis() < ((xpGainATS * 1000) + 250) || player.getGameMode().equals(GameMode.CREATIVE)) { return; } diff --git a/src/main/java/com/gmail/nossr50/listeners/EntityListener.java b/src/main/java/com/gmail/nossr50/listeners/EntityListener.java index f173c9cc2..67ee722e0 100644 --- a/src/main/java/com/gmail/nossr50/listeners/EntityListener.java +++ b/src/main/java/com/gmail/nossr50/listeners/EntityListener.java @@ -306,7 +306,7 @@ public class EntityListener implements Listener { break; } - PP.addXP(SkillType.TAMING, xp); + PP.addXP(player, SkillType.TAMING, xp); Skills.XpCheckSkill(SkillType.TAMING, player); } } diff --git a/src/main/java/com/gmail/nossr50/runnables/GainXp.java b/src/main/java/com/gmail/nossr50/runnables/GainXp.java index 293d729e1..c061bf7ce 100644 --- a/src/main/java/com/gmail/nossr50/runnables/GainXp.java +++ b/src/main/java/com/gmail/nossr50/runnables/GainXp.java @@ -39,7 +39,7 @@ public class GainXp implements Runnable { damage += health; } - PP.addXP(skillType, (int) (damage * baseXp)); + PP.addXP(player, skillType, (int) (damage * baseXp)); Skills.XpCheckSkill(skillType, player); } } diff --git a/src/main/java/com/gmail/nossr50/skills/gathering/Excavation.java b/src/main/java/com/gmail/nossr50/skills/gathering/Excavation.java index 7e322f6f4..2150069b3 100644 --- a/src/main/java/com/gmail/nossr50/skills/gathering/Excavation.java +++ b/src/main/java/com/gmail/nossr50/skills/gathering/Excavation.java @@ -99,7 +99,7 @@ public class Excavation { } //Handle XP related tasks - PP.addXP(SkillType.EXCAVATION, xp); + PP.addXP(player, SkillType.EXCAVATION, xp); Skills.XpCheckSkill(SkillType.EXCAVATION, player); } diff --git a/src/main/java/com/gmail/nossr50/skills/gathering/Fishing.java b/src/main/java/com/gmail/nossr50/skills/gathering/Fishing.java index bbc441960..dc2a5746c 100644 --- a/src/main/java/com/gmail/nossr50/skills/gathering/Fishing.java +++ b/src/main/java/com/gmail/nossr50/skills/gathering/Fishing.java @@ -103,7 +103,7 @@ public class Fishing { FishingTreasure treasure = rewards.get(random.nextInt(rewards.size())); if (random.nextDouble() * 100 <= treasure.getDropChance()) { - Users.getProfile(player).addXP(SkillType.FISHING, treasure.getXp()); + Users.getProfile(player).addXP(player, SkillType.FISHING, treasure.getXp()); theCatch.setItemStack(treasure.getDrop()); } } @@ -117,7 +117,7 @@ public class Fishing { theCatch.getItemStack().setDurability((short) (random.nextInt(maxDurability))); //Change durability to random value } - PP.addXP(SkillType.FISHING, Config.getInstance().getFishingBaseXP()); + PP.addXP(player, SkillType.FISHING, Config.getInstance().getFishingBaseXP()); Skills.XpCheckSkill(SkillType.FISHING, player); } diff --git a/src/main/java/com/gmail/nossr50/skills/gathering/Herbalism.java b/src/main/java/com/gmail/nossr50/skills/gathering/Herbalism.java index 982b856cd..8a779ccd4 100644 --- a/src/main/java/com/gmail/nossr50/skills/gathering/Herbalism.java +++ b/src/main/java/com/gmail/nossr50/skills/gathering/Herbalism.java @@ -269,7 +269,7 @@ public class Herbalism { } } - PP.addXP(SkillType.HERBALISM, xp); + PP.addXP(player, SkillType.HERBALISM, xp); Skills.XpCheckSkill(SkillType.HERBALISM, player); } diff --git a/src/main/java/com/gmail/nossr50/skills/gathering/Mining.java b/src/main/java/com/gmail/nossr50/skills/gathering/Mining.java index ff7e35c46..7e7dc6c05 100644 --- a/src/main/java/com/gmail/nossr50/skills/gathering/Mining.java +++ b/src/main/java/com/gmail/nossr50/skills/gathering/Mining.java @@ -201,7 +201,7 @@ public class Mining { break; } - PP.addXP(SkillType.MINING, xp); + PP.addXP(player, SkillType.MINING, xp); Skills.XpCheckSkill(SkillType.MINING, player); } diff --git a/src/main/java/com/gmail/nossr50/skills/gathering/WoodCutting.java b/src/main/java/com/gmail/nossr50/skills/gathering/WoodCutting.java index b05f797a2..ca2c52e23 100644 --- a/src/main/java/com/gmail/nossr50/skills/gathering/WoodCutting.java +++ b/src/main/java/com/gmail/nossr50/skills/gathering/WoodCutting.java @@ -160,7 +160,7 @@ public class WoodCutting { } if (Permissions.getInstance().woodcutting(player)) { - PP.addXP(SkillType.WOODCUTTING, xp); //Tree Feller gives nerf'd XP + PP.addXP(player, SkillType.WOODCUTTING, xp); //Tree Feller gives nerf'd XP Skills.XpCheckSkill(SkillType.WOODCUTTING, player); } } @@ -322,7 +322,7 @@ public class WoodCutting { } WoodCutting.woodCuttingProcCheck(player, block); - PP.addXP(SkillType.WOODCUTTING, xp); + PP.addXP(player, SkillType.WOODCUTTING, xp); Skills.XpCheckSkill(SkillType.WOODCUTTING, player); } diff --git a/src/main/java/com/gmail/nossr50/skills/misc/Acrobatics.java b/src/main/java/com/gmail/nossr50/skills/misc/Acrobatics.java index 917fb0f49..59672ad39 100644 --- a/src/main/java/com/gmail/nossr50/skills/misc/Acrobatics.java +++ b/src/main/java/com/gmail/nossr50/skills/misc/Acrobatics.java @@ -59,7 +59,7 @@ public class Acrobatics { /* Check for death */ if (health - damage >= 1) { - PP.addXP(SkillType.ACROBATICS, damage * ROLL_XP_MODIFIER); + PP.addXP(player, SkillType.ACROBATICS, damage * ROLL_XP_MODIFIER); Skills.XpCheckSkill(SkillType.ACROBATICS, player); event.setDamage(newDamage); @@ -77,7 +77,7 @@ public class Acrobatics { } } else if (health - damage >= 1) { - PP.addXP(SkillType.ACROBATICS, event.getDamage() * FALL_XP_MODIFIER); + PP.addXP(player, SkillType.ACROBATICS, event.getDamage() * FALL_XP_MODIFIER); Skills.XpCheckSkill(SkillType.ACROBATICS, player); } } @@ -112,7 +112,7 @@ public class Acrobatics { defender.sendMessage(LocaleLoader.getString("Acrobatics.Combat.Proc")); if (System.currentTimeMillis() >= (5000 + PPd.getRespawnATS()) && defender.getHealth() >= 1) { - PPd.addXP(SkillType.ACROBATICS, damage * DODGE_MODIFIER); + PPd.addXP(defender, SkillType.ACROBATICS, damage * DODGE_MODIFIER); Skills.XpCheckSkill(SkillType.ACROBATICS, defender); } diff --git a/src/main/java/com/gmail/nossr50/skills/misc/Repair.java b/src/main/java/com/gmail/nossr50/skills/misc/Repair.java index 395a546a7..131069a9c 100644 --- a/src/main/java/com/gmail/nossr50/skills/misc/Repair.java +++ b/src/main/java/com/gmail/nossr50/skills/misc/Repair.java @@ -139,7 +139,7 @@ public class Repair { dif = (short) (dif / 2); } - PP.addXP(SkillType.REPAIR, dif * 10); + PP.addXP(player, SkillType.REPAIR, dif * 10); Skills.XpCheckSkill(SkillType.REPAIR, player); //CLANG CLANG