diff --git a/src/main/java/com/gmail/nossr50/skills/mining/BlastMining.java b/src/main/java/com/gmail/nossr50/skills/mining/BlastMining.java index 008020a56..232dd4cf6 100644 --- a/src/main/java/com/gmail/nossr50/skills/mining/BlastMining.java +++ b/src/main/java/com/gmail/nossr50/skills/mining/BlastMining.java @@ -178,7 +178,7 @@ public class BlastMining { for (Block block : xp) { if (!mcMMO.placeStore.isTrue(block)) { - Mining.miningXP(player, block); + Mining.miningXP(player, Users.getProfile(player), block, block.getType()); } } } 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 e8f431a57..16743c9ff 100644 --- a/src/main/java/com/gmail/nossr50/skills/mining/Mining.java +++ b/src/main/java/com/gmail/nossr50/skills/mining/Mining.java @@ -38,10 +38,7 @@ public class Mining { * @param player The player to award XP to * @param block The block to award XP for */ - public static void miningXP(Player player, Block block) { - PlayerProfile profile = Users.getProfile(player); - Material type = block.getType(); - + protected static void miningXP(Player player, PlayerProfile profile, Block block, Material type) { int xp = 0; switch (type) { diff --git a/src/main/java/com/gmail/nossr50/skills/mining/MiningBlockEventHandler.java b/src/main/java/com/gmail/nossr50/skills/mining/MiningBlockEventHandler.java index 13152bde0..dedd33da6 100644 --- a/src/main/java/com/gmail/nossr50/skills/mining/MiningBlockEventHandler.java +++ b/src/main/java/com/gmail/nossr50/skills/mining/MiningBlockEventHandler.java @@ -44,4 +44,8 @@ public class MiningBlockEventHandler { Mining.miningDrops(block, blockLocation, blockType); } } + + protected void processXP() { + Mining.miningXP(manager.getPlayer(), manager.getProfile(), block, blockType); + } } diff --git a/src/main/java/com/gmail/nossr50/skills/mining/MiningManager.java b/src/main/java/com/gmail/nossr50/skills/mining/MiningManager.java index daae9d75c..ae4166552 100644 --- a/src/main/java/com/gmail/nossr50/skills/mining/MiningManager.java +++ b/src/main/java/com/gmail/nossr50/skills/mining/MiningManager.java @@ -32,14 +32,14 @@ public class MiningManager { return; } - Mining.miningXP(player, block); + MiningBlockEventHandler eventHandler = new MiningBlockEventHandler(this, block); + + eventHandler.processXP(); if (!Permissions.miningDoubleDrops(player)) { return; } - MiningBlockEventHandler eventHandler = new MiningBlockEventHandler(this, block); - int randomChance = 100; if (Permissions.luckyMining(player)) { randomChance = (int) (randomChance * 0.75); @@ -63,4 +63,8 @@ public class MiningManager { protected Player getPlayer() { return player; } + + protected PlayerProfile getProfile() { + return profile; + } }