From a1ab6f286bb5075aa6c6435381c8e634b24c52a4 Mon Sep 17 00:00:00 2001 From: bm01 Date: Sun, 3 Feb 2013 12:45:19 +0100 Subject: [PATCH] Made xp sharing less ugly by reworking McMMOPlayer xp methods Notable consequence: checkXP and addLevel in ExperienceAPI are no longer needed and became deprecated --- .../com/gmail/nossr50/api/ExperienceAPI.java | 34 +++-- .../nossr50/commands/admin/AddxpCommand.java | 21 ++- .../gmail/nossr50/datatypes/McMMOPlayer.java | 121 +++++++++--------- .../com/gmail/nossr50/party/ShareHandler.java | 17 +-- .../skills/acrobatics/DodgeEventHandler.java | 2 +- .../skills/acrobatics/RollEventHandler.java | 2 +- .../skills/archery/ArcheryManager.java | 2 +- .../nossr50/skills/excavation/Excavation.java | 2 +- .../gmail/nossr50/skills/fishing/Fishing.java | 2 +- .../nossr50/skills/herbalism/Herbalism.java | 2 +- .../gmail/nossr50/skills/mining/Mining.java | 2 +- .../gmail/nossr50/skills/repair/Repair.java | 2 +- .../skills/runnables/CombatXpGiver.java | 2 +- .../smelting/SmeltResourceEventHandler.java | 4 +- .../nossr50/skills/taming/TamingManager.java | 4 +- .../skills/woodcutting/TreeFeller.java | 2 +- .../skills/woodcutting/Woodcutting.java | 2 +- 17 files changed, 110 insertions(+), 113 deletions(-) diff --git a/src/main/java/com/gmail/nossr50/api/ExperienceAPI.java b/src/main/java/com/gmail/nossr50/api/ExperienceAPI.java index bb73193eb..b0b97b4dd 100644 --- a/src/main/java/com/gmail/nossr50/api/ExperienceAPI.java +++ b/src/main/java/com/gmail/nossr50/api/ExperienceAPI.java @@ -2,6 +2,7 @@ package com.gmail.nossr50.api; import org.bukkit.entity.Player; +import com.gmail.nossr50.config.Config; import com.gmail.nossr50.skills.utilities.SkillTools; import com.gmail.nossr50.skills.utilities.SkillType; import com.gmail.nossr50.util.Users; @@ -14,6 +15,7 @@ public final class ExperienceAPI { * * @param player The player to check * @param skillType The skill to check + * @deprecated Calling this function is no longer needed and should be avoided */ private static void checkXP(Player player, SkillType skillType) { if (skillType.equals(SkillType.ALL)) { @@ -25,7 +27,7 @@ public final class ExperienceAPI { } /** - * Adds XP to the player, doesn't calculate for XP Rate or other modifiers. + * Adds raw XP to the player. *
* This function is designed for API usage. * @@ -34,12 +36,11 @@ public final class ExperienceAPI { * @param XP The amount of XP to add */ public static void addRawXP(Player player, SkillType skillType, int XP) { - Users.getPlayer(player).addXpOverride(skillType, XP); - checkXP(player, skillType); + Users.getPlayer(player).applyXpGain(skillType, XP); } /** - * Adds XP to the player, calculates for XP Rate but not skill modifiers. + * Adds XP to the player, calculates for XP Rate only. *
* This function is designed for API usage. * @@ -48,12 +49,11 @@ public final class ExperienceAPI { * @param XP The amount of XP to add */ public static void addMultipliedXP(Player player, SkillType skillType, int XP) { - Users.getPlayer(player).addXpOverrideBonus(skillType, XP); - checkXP(player, skillType); + Users.getPlayer(player).applyXpGain(skillType, (int) (XP * Config.getInstance().getExperienceGainsGlobalMultiplier())); } /** - * Adds XP to the player, calculates for XP Rate and skill modifiers. + * Adds XP to the player, calculates for XP Rate, skill modifiers and perks. May be shared with the party. *
* This function is designed for API usage. * @@ -62,8 +62,7 @@ public final class ExperienceAPI { * @param XP The amount of XP to add */ public static void addXP(Player player, SkillType skillType, int XP) { - Users.getPlayer(player).addXp(skillType, XP); - checkXP(player, skillType); + Users.getPlayer(player).beginXpGain(skillType, XP); } /** @@ -100,7 +99,8 @@ public final class ExperienceAPI { * @param player The player to add levels to * @param skillType Type of skill to add levels to * @param levels Number of levels to add - * @param notify True if this should fire a level up notification, false otherwise. + * @param notify Unused argument + * @deprecated Use addLevel(Player, SKillType, int) instead */ public static void addLevel(Player player, SkillType skillType, int levels, boolean notify) { Users.getProfile(player).addLevels(skillType, levels); @@ -110,6 +110,20 @@ public final class ExperienceAPI { } } + /** + * Add levels to a skill. + *
+ * 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 + * @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); + } + /** * Get the level a player has in a specific skill. *
diff --git a/src/main/java/com/gmail/nossr50/commands/admin/AddxpCommand.java b/src/main/java/com/gmail/nossr50/commands/admin/AddxpCommand.java index 1eeda1269..81a0b3255 100644 --- a/src/main/java/com/gmail/nossr50/commands/admin/AddxpCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/admin/AddxpCommand.java @@ -44,14 +44,17 @@ public class AddxpCommand implements CommandExecutor { mcMMOPlayer = Users.getPlayer(modifiedPlayer); profile = mcMMOPlayer.getProfile(); - mcMMOPlayer.addXpOverride(skill, xp); - if (skill.equals(SkillType.ALL)) { - SkillTools.xpCheckAll(modifiedPlayer, profile); + for (SkillType skillType : SkillType.values()) { + if (!skillType.isChildSkill()) { + mcMMOPlayer.applyXpGain(skill, xp); + } + } + sender.sendMessage(LocaleLoader.getString("Commands.addxp.AwardAll", xp)); } else { - SkillTools.xpCheckSkill(skill, modifiedPlayer, profile); + mcMMOPlayer.applyXpGain(skill, xp); sender.sendMessage(LocaleLoader.getString("Commands.addxp.AwardSkill", xp, Misc.getCapitalized(skill.toString()))); } @@ -85,7 +88,7 @@ public class AddxpCommand implements CommandExecutor { return true; } - // This is basically a copy of McMMOPlayer.addXpOverride(), this method should probably be moved to PlayerProfile to avoid that + // TODO: Currently the offline player doesn't level up automatically if (skill.equals(SkillType.ALL)) { for (SkillType type : SkillType.values()) { if (type.equals(SkillType.ALL) || type.isChildSkill()) { @@ -94,19 +97,15 @@ public class AddxpCommand implements CommandExecutor { profile.setSkillXpLevel(type, profile.getSkillXpLevel(type) + xp); } - // TODO: Find a way to make it work, it currently requires a valid Player - // SkillTools.xpCheckAll(modifiedPlayer, profile); } else { profile.setSkillXpLevel(skill, profile.getSkillXpLevel(skill) + xp); - // TODO: Find a way to make it work, it currently requires a valid Player - // SkillTools.xpCheckSkill(skill, modifiedPlayer, profile); } profile.save(); // Since this is a temporary profile, we save it here. } else { - mcMMOPlayer.addXpOverride(skill, xp); + mcMMOPlayer.applyXpGain(skill, xp); modifiedPlayer = mcMMOPlayer.getPlayer(); profile = mcMMOPlayer.getProfile(); @@ -114,11 +113,9 @@ public class AddxpCommand implements CommandExecutor { if (modifiedPlayer.isOnline()) { if (skill.equals(SkillType.ALL)) { modifiedPlayer.sendMessage(LocaleLoader.getString("Commands.addxp.AwardAll", xp)); - SkillTools.xpCheckAll(modifiedPlayer, profile); } else { modifiedPlayer.sendMessage(LocaleLoader.getString("Commands.addxp.AwardSkill", xp, Misc.getCapitalized(skill.toString()))); - SkillTools.xpCheckSkill(skill, modifiedPlayer, profile); } } } diff --git a/src/main/java/com/gmail/nossr50/datatypes/McMMOPlayer.java b/src/main/java/com/gmail/nossr50/datatypes/McMMOPlayer.java index c575c94c0..68ae4d321 100644 --- a/src/main/java/com/gmail/nossr50/datatypes/McMMOPlayer.java +++ b/src/main/java/com/gmail/nossr50/datatypes/McMMOPlayer.java @@ -53,65 +53,69 @@ public class McMMOPlayer { } /** - * Adds Xp to the player, doesn't calculate for Xp Rate + * Begins an experience gain. The amount will be affected by skill modifiers, global rate, perks, and may be shared with the party * - * @param skillType The skill to add Xp to - * @param xp The amount of Xp to add + * @param skillType Skill being used + * @param xp Experience amount to process */ - public void addXpOverride(SkillType skillType, int xp) { - if (skillType.equals(SkillType.ALL)) { - for (SkillType type : SkillType.values()) { - if (type.equals(SkillType.ALL) || type.isChildSkill()) { - continue; - } - - mcMMO.p.getServer().getPluginManager().callEvent(new McMMOPlayerXpGainEvent(player, type, xp)); - profile.setSkillXpLevel(type, profile.getSkillXpLevel(type) + xp); - } - } - else { - mcMMO.p.getServer().getPluginManager().callEvent(new McMMOPlayerXpGainEvent(player, skillType, xp)); - profile.setSkillXpLevel(skillType, profile.getSkillXpLevel(skillType) + xp); - - SpoutHud spoutHud = profile.getSpoutHud(); - - if (spoutHud != null) { - spoutHud.setLastGained(skillType); - } - } - } - - /** - * Adds Xp to the player, this ignores skill modifiers. - * - * @param skillType The skill to add Xp to - * @param xp The amount of Xp to add - */ - public void addXpOverrideBonus(SkillType skillType, int xp) { - int modifiedXp = (int) Math.floor(xp * Config.getInstance().getExperienceGainsGlobalMultiplier()); - addXpOverride(skillType, modifiedXp); - } - - /** - * Adds experience to the player, this is affected by skill modifiers, rate and permissions - * - * @param skillType The skill to add Xp to - * @param xp The amount of Xp to add - */ - public void addXp(SkillType skillType, int xp) { - if (player.getGameMode() == GameMode.CREATIVE) { + public void beginXpGain(SkillType skillType, int xp) { + // Return if the experience has been shared + if (party != null && ShareHandler.handleXpShare(xp, this, skillType)) { return; } - if (party != null && !ShareHandler.isRunning()) { - // Return if the Xp has been shared - if (ShareHandler.handleEqualXpShare(xp, this, skillType)) { - return; - } + beginUnsharedXpGain(skillType, xp); + } + + /** + * Begins an experience gain. The amount will be affected by skill modifiers, global rate and perks + * + * @param skillType Skill being used + * @param xp Experience amount to process + */ + public void beginUnsharedXpGain(SkillType skillType, int xp) { + xp = modifyXpGain(skillType, xp); + + if (xp == 0) { + return; + } + + applyXpGain(skillType, xp); + } + + /** + * Applies an experience gain + * + * @param skillType Skill being used + * @param xp Experience amount to add + */ + public void applyXpGain(SkillType skillType, int xp) { + mcMMO.p.getServer().getPluginManager().callEvent(new McMMOPlayerXpGainEvent(player, skillType, xp)); + profile.setSkillXpLevel(skillType, profile.getSkillXpLevel(skillType) + xp); + + SpoutHud spoutHud = profile.getSpoutHud(); + + if (spoutHud != null) { + spoutHud.setLastGained(skillType); + } + + SkillTools.xpCheckSkill(skillType, player, profile); + } + + /** + * Modifies an experience gain using skill modifiers, global rate and perks + * + * @param skillType Skill being used + * @param xp Experience amount to process + * @return Modified experience + */ + private int modifyXpGain(SkillType skillType, int xp) { + if (player.getGameMode() == GameMode.CREATIVE) { + return 0; } if ((skillType.getMaxLevel() < profile.getSkillLevel(skillType) + 1) || (Misc.getPowerLevelCap() < getPowerLevel() + 1)) { - return; + return 0; } xp = (int) (xp / skillType.getXpModifier() * Config.getInstance().getExperienceGainsGlobalMultiplier()); @@ -121,11 +125,11 @@ public class McMMOPlayer { CustomTool tool = ModChecks.getToolFromItemStack(item); if (tool != null) { - xp = (int) (xp * tool.getXpMultiplier()); + xp *= tool.getXpMultiplier(); } } - // TODO: find a better way to do this, if possible + // TODO: Too many permission checks here, is there no way to avoid that? if (Permissions.xpQuadruple(player)) { xp *= 4; } @@ -142,16 +146,7 @@ public class McMMOPlayer { xp *= 1.5; } - mcMMO.p.getServer().getPluginManager().callEvent(new McMMOPlayerXpGainEvent(player, skillType, xp)); - profile.setSkillXpLevel(skillType, profile.getSkillXpLevel(skillType) + xp); - - SpoutHud spoutHud = profile.getSpoutHud(); - - if (spoutHud != null) { - spoutHud.setLastGained(skillType); - } - - SkillTools.xpCheckSkill(skillType, player, profile); + return xp; } // Players & Profiles diff --git a/src/main/java/com/gmail/nossr50/party/ShareHandler.java b/src/main/java/com/gmail/nossr50/party/ShareHandler.java index 4316c31a4..79f50c43e 100644 --- a/src/main/java/com/gmail/nossr50/party/ShareHandler.java +++ b/src/main/java/com/gmail/nossr50/party/ShareHandler.java @@ -27,8 +27,6 @@ public final class ShareHandler { } }; - private static boolean running; // Used to prevent permanent sharing, McMMOPlayer.addXp() uses it - private ShareHandler() {} /** @@ -39,8 +37,7 @@ public final class ShareHandler { * @param skillType Skill being used * @return True is the xp has been shared */ - public static boolean handleEqualXpShare(int xp, McMMOPlayer mcMMOPlayer, SkillType skillType) { - running = true; + public static boolean handleXpShare(int xp, McMMOPlayer mcMMOPlayer, SkillType skillType) { Party party = mcMMOPlayer.getParty(); switch (party.getXpShareMode()) { @@ -49,7 +46,6 @@ public final class ShareHandler { List nearMembers = PartyManager.getNearMembers(player, party, Config.getInstance().getPartyShareRange()); if (nearMembers.isEmpty()) { - running = false; return false; } @@ -58,21 +54,16 @@ public final class ShareHandler { int roundedXp = (int) Math.ceil(splitXp); for (Player member : nearMembers) { - Users.getPlayer(member).addXp(skillType, roundedXp); + Users.getPlayer(member).beginUnsharedXpGain(skillType, roundedXp); } - mcMMOPlayer.addXp(skillType, roundedXp); + mcMMOPlayer.beginUnsharedXpGain(skillType, roundedXp); - running = false; return true; case NONE: default: - running = false; return false; } } +} - public static boolean isRunning() { - return running; - } -} \ No newline at end of file diff --git a/src/main/java/com/gmail/nossr50/skills/acrobatics/DodgeEventHandler.java b/src/main/java/com/gmail/nossr50/skills/acrobatics/DodgeEventHandler.java index 7313dac6f..a7d9ccf4c 100644 --- a/src/main/java/com/gmail/nossr50/skills/acrobatics/DodgeEventHandler.java +++ b/src/main/java/com/gmail/nossr50/skills/acrobatics/DodgeEventHandler.java @@ -46,7 +46,7 @@ public class DodgeEventHandler extends AcrobaticsEventHandler { McMMOPlayer mcMMOPlayer = manager.getMcMMOPlayer(); if (System.currentTimeMillis() >= mcMMOPlayer.getProfile().getRespawnATS() + Misc.PLAYER_RESPAWN_COOLDOWN_SECONDS) { - manager.getMcMMOPlayer().addXp(SkillType.ACROBATICS, xp); + manager.getMcMMOPlayer().beginXpGain(SkillType.ACROBATICS, xp); } } } diff --git a/src/main/java/com/gmail/nossr50/skills/acrobatics/RollEventHandler.java b/src/main/java/com/gmail/nossr50/skills/acrobatics/RollEventHandler.java index ec1ce7743..2ef4e2862 100644 --- a/src/main/java/com/gmail/nossr50/skills/acrobatics/RollEventHandler.java +++ b/src/main/java/com/gmail/nossr50/skills/acrobatics/RollEventHandler.java @@ -69,7 +69,7 @@ public class RollEventHandler extends AcrobaticsEventHandler { @Override protected void processXpGain(int xp) { - manager.getMcMMOPlayer().addXp(SkillType.ACROBATICS, xp); + manager.getMcMMOPlayer().beginXpGain(SkillType.ACROBATICS, xp); } /** diff --git a/src/main/java/com/gmail/nossr50/skills/archery/ArcheryManager.java b/src/main/java/com/gmail/nossr50/skills/archery/ArcheryManager.java index 8e71a5ec8..90b2dd0bd 100644 --- a/src/main/java/com/gmail/nossr50/skills/archery/ArcheryManager.java +++ b/src/main/java/com/gmail/nossr50/skills/archery/ArcheryManager.java @@ -34,7 +34,7 @@ public class ArcheryManager extends SkillManager { } int bonusXp = (int) (squaredDistance * Archery.distanceXpModifer); - mcMMOPlayer.addXp(SkillType.ARCHERY, bonusXp); + mcMMOPlayer.beginXpGain(SkillType.ARCHERY, bonusXp); } /** diff --git a/src/main/java/com/gmail/nossr50/skills/excavation/Excavation.java b/src/main/java/com/gmail/nossr50/skills/excavation/Excavation.java index 2412d721a..88d39edd8 100644 --- a/src/main/java/com/gmail/nossr50/skills/excavation/Excavation.java +++ b/src/main/java/com/gmail/nossr50/skills/excavation/Excavation.java @@ -119,7 +119,7 @@ public class Excavation { } } - mcMMOPlayer.addXp(SkillType.EXCAVATION, xp); + mcMMOPlayer.beginXpGain(SkillType.EXCAVATION, xp); } /** diff --git a/src/main/java/com/gmail/nossr50/skills/fishing/Fishing.java b/src/main/java/com/gmail/nossr50/skills/fishing/Fishing.java index ce9efbcfb..353e1b53a 100644 --- a/src/main/java/com/gmail/nossr50/skills/fishing/Fishing.java +++ b/src/main/java/com/gmail/nossr50/skills/fishing/Fishing.java @@ -128,7 +128,7 @@ public final class Fishing { caught.setItemStack(treasureDrop); } - mcMMOPlayer.addXp(SkillType.FISHING, Config.getInstance().getFishingBaseXP() + treasureXp); + mcMMOPlayer.beginXpGain(SkillType.FISHING, Config.getInstance().getFishingBaseXP() + treasureXp); event.setExpToDrop(event.getExpToDrop() * getVanillaXpMultiplier(skillLevel)); } diff --git a/src/main/java/com/gmail/nossr50/skills/herbalism/Herbalism.java b/src/main/java/com/gmail/nossr50/skills/herbalism/Herbalism.java index 5a99ef669..52bed7834 100644 --- a/src/main/java/com/gmail/nossr50/skills/herbalism/Herbalism.java +++ b/src/main/java/com/gmail/nossr50/skills/herbalism/Herbalism.java @@ -212,7 +212,7 @@ public class Herbalism { } } - mcMMOPlayer.addXp(SkillType.HERBALISM, xp); + mcMMOPlayer.beginXpGain(SkillType.HERBALISM, xp); } /** diff --git a/src/main/java/com/gmail/nossr50/skills/mining/Mining.java b/src/main/java/com/gmail/nossr50/skills/mining/Mining.java index b4d6de0ac..47991c0a8 100644 --- a/src/main/java/com/gmail/nossr50/skills/mining/Mining.java +++ b/src/main/java/com/gmail/nossr50/skills/mining/Mining.java @@ -104,7 +104,7 @@ public class Mining { break; } - mcMMOPlayer.addXp(SkillType.MINING, xp); + mcMMOPlayer.beginXpGain(SkillType.MINING, xp); } /** diff --git a/src/main/java/com/gmail/nossr50/skills/repair/Repair.java b/src/main/java/com/gmail/nossr50/skills/repair/Repair.java index 86bc3f29f..abff3a6cc 100644 --- a/src/main/java/com/gmail/nossr50/skills/repair/Repair.java +++ b/src/main/java/com/gmail/nossr50/skills/repair/Repair.java @@ -48,7 +48,7 @@ public class Repair { Player player = mcMMOPlayer.getPlayer(); player.playSound(player.getLocation(), Sound.ANVIL_USE, Misc.ANVIL_USE_VOLUME, Misc.ANVIL_USE_PITCH); - mcMMOPlayer.addXp(SkillType.REPAIR, dif * 10); + mcMMOPlayer.beginXpGain(SkillType.REPAIR, dif * 10); } /** diff --git a/src/main/java/com/gmail/nossr50/skills/runnables/CombatXpGiver.java b/src/main/java/com/gmail/nossr50/skills/runnables/CombatXpGiver.java index 311a52534..f28caaecd 100644 --- a/src/main/java/com/gmail/nossr50/skills/runnables/CombatXpGiver.java +++ b/src/main/java/com/gmail/nossr50/skills/runnables/CombatXpGiver.java @@ -35,6 +35,6 @@ public class CombatXpGiver implements Runnable { damage += health; } - mcMMOPlayer.addXp(skillType, (int) (damage * baseXp)); + mcMMOPlayer.beginXpGain(skillType, (int) (damage * baseXp)); } } diff --git a/src/main/java/com/gmail/nossr50/skills/smelting/SmeltResourceEventHandler.java b/src/main/java/com/gmail/nossr50/skills/smelting/SmeltResourceEventHandler.java index c4eff990d..5040b98d3 100644 --- a/src/main/java/com/gmail/nossr50/skills/smelting/SmeltResourceEventHandler.java +++ b/src/main/java/com/gmail/nossr50/skills/smelting/SmeltResourceEventHandler.java @@ -68,11 +68,11 @@ public class SmeltResourceEventHandler { Player player = mcMMOPlayer.getPlayer(); if (Permissions.mining(player)) { - mcMMOPlayer.addXp(SkillType.MINING, xp / 2); + mcMMOPlayer.beginXpGain(SkillType.MINING, xp / 2); } if (Permissions.repair(player)) { - mcMMOPlayer.addXp(SkillType.REPAIR, xp / 2); + mcMMOPlayer.beginXpGain(SkillType.REPAIR, xp / 2); } } diff --git a/src/main/java/com/gmail/nossr50/skills/taming/TamingManager.java b/src/main/java/com/gmail/nossr50/skills/taming/TamingManager.java index 263d4b6c8..3bd2651a7 100644 --- a/src/main/java/com/gmail/nossr50/skills/taming/TamingManager.java +++ b/src/main/java/com/gmail/nossr50/skills/taming/TamingManager.java @@ -33,11 +33,11 @@ public class TamingManager extends SkillManager { switch (event.getEntityType()) { case WOLF: - mcMMOPlayer.addXp(SkillType.TAMING, Taming.wolfXp); + mcMMOPlayer.beginXpGain(SkillType.TAMING, Taming.wolfXp); break; case OCELOT: - mcMMOPlayer.addXp(SkillType.TAMING, Taming.ocelotXp); + mcMMOPlayer.beginXpGain(SkillType.TAMING, Taming.ocelotXp); break; default: diff --git a/src/main/java/com/gmail/nossr50/skills/woodcutting/TreeFeller.java b/src/main/java/com/gmail/nossr50/skills/woodcutting/TreeFeller.java index af5cd4a8c..478237fc3 100644 --- a/src/main/java/com/gmail/nossr50/skills/woodcutting/TreeFeller.java +++ b/src/main/java/com/gmail/nossr50/skills/woodcutting/TreeFeller.java @@ -220,6 +220,6 @@ public final class TreeFeller { block.setType(Material.AIR); } - mcMMOPlayer.addXp(SkillType.WOODCUTTING, xp); + mcMMOPlayer.beginXpGain(SkillType.WOODCUTTING, xp); } } diff --git a/src/main/java/com/gmail/nossr50/skills/woodcutting/Woodcutting.java b/src/main/java/com/gmail/nossr50/skills/woodcutting/Woodcutting.java index 8c56569c2..b93acc2aa 100644 --- a/src/main/java/com/gmail/nossr50/skills/woodcutting/Woodcutting.java +++ b/src/main/java/com/gmail/nossr50/skills/woodcutting/Woodcutting.java @@ -80,7 +80,7 @@ public final class Woodcutting { checkForDoubleDrop(mcMMOPlayer, block); } - mcMMOPlayer.addXp(SkillType.WOODCUTTING, xp); + mcMMOPlayer.beginXpGain(SkillType.WOODCUTTING, xp); } /**