diff --git a/Changelog.txt b/Changelog.txt index 1b2d65213..34ababb8a 100644 --- a/Changelog.txt +++ b/Changelog.txt @@ -1,7 +1,7 @@ Changelog: #Versions without changelogs probably had very small misc fixes, like tweaks to the source code -Version 1.2.10 +Version 2.0-dev Version 1.2.09 - Fixed issue with Repair Mastery (Issue #47) diff --git a/src/main/java/com/gmail/nossr50/listeners/mcBlockListener.java b/src/main/java/com/gmail/nossr50/listeners/mcBlockListener.java index 9c3b712d8..46c6dc86b 100644 --- a/src/main/java/com/gmail/nossr50/listeners/mcBlockListener.java +++ b/src/main/java/com/gmail/nossr50/listeners/mcBlockListener.java @@ -157,6 +157,7 @@ public class mcBlockListener implements Listener /* * MINING */ + if(mcPermissions.getInstance().mining(player)) { if(LoadProperties.miningrequirespickaxe) @@ -170,47 +171,24 @@ public class mcBlockListener implements Listener Mining.miningBlockCheck(player, block, plugin); } } + + /* * WOOD CUTTING */ - if(player != null && block.getTypeId() == 17 && mcPermissions.getInstance().woodcutting(player)) + if(mcPermissions.getInstance().woodcutting(player)) { if(LoadProperties.woodcuttingrequiresaxe) { if(m.isAxes(inhand)) { - if(!plugin.misc.blockWatchList.contains(block)) - { - WoodCutting.woodCuttingProcCheck(player, block); - //Default - if(block.getData() == (byte)0) - PP.addXP(SkillType.WOODCUTTING, LoadProperties.mpine, player); - //Spruce - if(block.getData() == (byte)1) - PP.addXP(SkillType.WOODCUTTING, LoadProperties.mspruce, player); - //Birch - if(block.getData() == (byte)2) - PP.addXP(SkillType.WOODCUTTING, LoadProperties.mbirch, player); - } + WoodCutting.woodcuttingBlockCheck(player, block, plugin); } } else { - if(!plugin.misc.blockWatchList.contains(block)) - { - WoodCutting.woodCuttingProcCheck(player, block); - //Default - if(block.getData() == (byte)0) - PP.addXP(SkillType.WOODCUTTING, LoadProperties.mpine, player); - //Spruce - if(block.getData() == (byte)1) - PP.addXP(SkillType.WOODCUTTING, LoadProperties.mspruce, player); - //Birch - if(block.getData() == (byte)2) - PP.addXP(SkillType.WOODCUTTING, LoadProperties.mbirch, player); - } + WoodCutting.woodcuttingBlockCheck(player, block, plugin); } - Skills.XpCheckSkill(SkillType.WOODCUTTING, player); /* * IF PLAYER IS USING TREEFELLER diff --git a/src/main/java/com/gmail/nossr50/skills/WoodCutting.java b/src/main/java/com/gmail/nossr50/skills/WoodCutting.java index 38e7db0eb..7de7cafe3 100644 --- a/src/main/java/com/gmail/nossr50/skills/WoodCutting.java +++ b/src/main/java/com/gmail/nossr50/skills/WoodCutting.java @@ -166,4 +166,34 @@ public class WoodCutting isdone = false; } } + + public static void woodcuttingBlockCheck(Player player, Block block, mcMMO plugin) + { + PlayerProfile PP = Users.getProfile(player); + int xp = 0; + byte data = block.getData(); + + if(plugin.misc.blockWatchList.contains(block)) + return; + + switch(data) + { + case 0: + xp += LoadProperties.mpine; + break; + case 1: + xp += LoadProperties.mspruce; + break; + case 2: + xp += LoadProperties.mbirch; + break; + } + + if(block.getTypeId() == 17) + WoodCutting.woodCuttingProcCheck(player, block); + + PP.addXP(SkillType.WOODCUTTING, xp, player); + Skills.XpCheckSkill(SkillType.WOODCUTTING, player); + } + } }