diff --git a/Changelog.txt b/Changelog.txt index 34ababb8a..33e1efa99 100644 --- a/Changelog.txt +++ b/Changelog.txt @@ -2,6 +2,14 @@ Changelog: #Versions without changelogs probably had very small misc fixes, like tweaks to the source code Version 2.0-dev + - Fixed issue with receiving Woodcutting XP for all blocks broken (Issue #103) + - Fixed issue with Spout images & sounds not working (Issue #93) + - Fixed typo with repairing Leather Armor & Bows + - Fixed issue with Silk Touch & Double/Triple drops not working properly + - Fixed conflict with NoCheat plugin & Super Breaker/Giga Drill Breaker/Berserk/Leaf Blower (Issue #104) + - Fixed counter-attacking non-LivingEntity (Issue #100 & Issue #107) + - Added Monitor & ignoreCancelledEvents to onBlockPlace + - Made Anvil ID configurable 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 5f160295b..2d1799cd4 100644 --- a/src/main/java/com/gmail/nossr50/listeners/mcBlockListener.java +++ b/src/main/java/com/gmail/nossr50/listeners/mcBlockListener.java @@ -25,6 +25,7 @@ import com.gmail.nossr50.spout.SpoutStuff; import com.gmail.nossr50.datatypes.PlayerProfile; import com.gmail.nossr50.datatypes.SkillType; +import org.bukkit.Bukkit; import org.bukkit.Material; import org.bukkit.Statistic; import org.bukkit.block.Block; @@ -36,6 +37,7 @@ import org.bukkit.event.block.BlockBreakEvent; import org.bukkit.event.block.BlockDamageEvent; import org.bukkit.event.block.BlockFromToEvent; import org.bukkit.event.block.BlockPlaceEvent; +import org.bukkit.event.player.PlayerAnimationEvent; import org.bukkit.inventory.ItemStack; import org.getspout.spoutapi.SpoutManager; import org.getspout.spoutapi.player.SpoutPlayer; @@ -58,7 +60,7 @@ public class mcBlockListener implements Listener @EventHandler(priority = EventPriority.MONITOR) public void onBlockPlace(BlockPlaceEvent event) - { + { if(event.isCancelled()) return; //Setup some basic vars @@ -340,6 +342,9 @@ public class mcBlockListener implements Listener && mcPermissions.getInstance().unarmedAbility(player)) { event.setInstaBreak(true); + PlayerAnimationEvent armswing = new PlayerAnimationEvent(player); + Bukkit.getPluginManager().callEvent(armswing); + if(LoadProperties.spoutEnabled) SpoutStuff.playSoundForPlayer(SoundEffect.POP, player, block.getLocation()); } diff --git a/src/main/java/com/gmail/nossr50/skills/Excavation.java b/src/main/java/com/gmail/nossr50/skills/Excavation.java index 8dc9256f0..74ad407e6 100644 --- a/src/main/java/com/gmail/nossr50/skills/Excavation.java +++ b/src/main/java/com/gmail/nossr50/skills/Excavation.java @@ -17,12 +17,16 @@ package com.gmail.nossr50.skills; import java.util.ArrayList; + +import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.block.Block; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; import org.bukkit.enchantments.Enchantment; +import org.bukkit.event.player.PlayerAnimationEvent; + import com.gmail.nossr50.locale.mcLocale; import com.gmail.nossr50.spout.SpoutStuff; import com.gmail.nossr50.Users; @@ -266,6 +270,8 @@ public class Excavation if(block.getData() != (byte)5) { + PlayerAnimationEvent armswing = new PlayerAnimationEvent(player); + Bukkit.getPluginManager().callEvent(armswing); Excavation.excavationProcCheck(block.getType(), block.getLocation(), player); Excavation.excavationProcCheck(block.getType(), block.getLocation(), player); Excavation.excavationProcCheck(block.getType(), block.getLocation(), player); diff --git a/src/main/java/com/gmail/nossr50/skills/Mining.java b/src/main/java/com/gmail/nossr50/skills/Mining.java index 5ebd5f7ef..fe6d85390 100644 --- a/src/main/java/com/gmail/nossr50/skills/Mining.java +++ b/src/main/java/com/gmail/nossr50/skills/Mining.java @@ -16,6 +16,7 @@ */ package com.gmail.nossr50.skills; +import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.Statistic; @@ -24,6 +25,7 @@ import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; import org.getspout.spoutapi.sound.SoundEffect; import org.bukkit.enchantments.Enchantment; +import org.bukkit.event.player.PlayerAnimationEvent; import com.gmail.nossr50.Users; import com.gmail.nossr50.m; @@ -277,10 +279,12 @@ public class Mining //Pre-processing int id = block.getTypeId(); int xp = 0; + PlayerAnimationEvent armswing = new PlayerAnimationEvent(player); //STONE if(id == 1 && block.getData() != (byte) 5) { + Bukkit.getPluginManager().callEvent(armswing); xp += LoadProperties.mstone; blockProcCheck(block, player); blockProcCheck(block, player); @@ -288,6 +292,7 @@ public class Mining //SANDSTONE else if(id == 24 && block.getData() != (byte) 5) { + Bukkit.getPluginManager().callEvent(armswing); xp += LoadProperties.msandstone; blockProcCheck(block, player); blockProcCheck(block, player); @@ -295,6 +300,7 @@ public class Mining //NETHERRACK else if(id == 87 && block.getData() != (byte) 5) { + Bukkit.getPluginManager().callEvent(armswing); xp += LoadProperties.mnetherrack; blockProcCheck(block, player); blockProcCheck(block, player); @@ -302,6 +308,7 @@ public class Mining //GLOWSTONE else if(id == 89 && block.getData() != (byte) 5) { + Bukkit.getPluginManager().callEvent(armswing); xp += LoadProperties.mglowstone; blockProcCheck(block, player); blockProcCheck(block, player); @@ -309,6 +316,7 @@ public class Mining //COAL else if(id == 16 && block.getData() != (byte) 5) { + Bukkit.getPluginManager().callEvent(armswing); xp += LoadProperties.mcoal; blockProcCheck(block, player); blockProcCheck(block, player); @@ -316,6 +324,7 @@ public class Mining //GOLD else if(id == 14 && m.getTier(player) >= 3 && block.getData() != (byte) 5) { + Bukkit.getPluginManager().callEvent(armswing); xp += LoadProperties.mgold; blockProcCheck(block, player); blockProcCheck(block, player); @@ -323,6 +332,7 @@ public class Mining //OBSIDIAN else if(id == 49 && m.getTier(player) >= 4 && block.getData() != (byte) 5) { + Bukkit.getPluginManager().callEvent(armswing); xp += LoadProperties.mobsidian; blockProcCheck(block, player); blockProcCheck(block, player); @@ -330,6 +340,7 @@ public class Mining //DIAMOND else if(id == 56 && m.getTier(player) >= 3 && block.getData() != (byte) 5) { + Bukkit.getPluginManager().callEvent(armswing); xp += LoadProperties.mdiamond; blockProcCheck(block, player); blockProcCheck(block, player); @@ -337,6 +348,7 @@ public class Mining //IRON else if(id == 15 && m.getTier(player) >= 2 && block.getData() != (byte) 5) { + Bukkit.getPluginManager().callEvent(armswing); xp += LoadProperties.miron; blockProcCheck(block, player); blockProcCheck(block, player); @@ -344,6 +356,7 @@ public class Mining //REDSTONE else if((id == 73 || id == 74) && m.getTier(player) >= 3 && !plugin.misc.blockWatchList.contains(block)) { + Bukkit.getPluginManager().callEvent(armswing); xp += LoadProperties.mredstone; blockProcCheck(block, player); blockProcCheck(block, player); @@ -351,6 +364,7 @@ public class Mining //LAPIS else if(id == 21 && m.getTier(player) >= 3 && block.getData() != (byte) 5) { + Bukkit.getPluginManager().callEvent(armswing); xp += LoadProperties.mlapis; blockProcCheck(block, player); blockProcCheck(block, player); @@ -358,6 +372,7 @@ public class Mining //NETHER BRICK else if(id == 112 && block.getData() != (byte) 5) { + Bukkit.getPluginManager().callEvent(armswing); xp += LoadProperties.mnetherbrick; blockProcCheck(block, player); blockProcCheck(block, player); @@ -365,18 +380,23 @@ public class Mining //END STONE else if(id == 121 && block.getData() != (byte) 5) { + Bukkit.getPluginManager().callEvent(armswing); xp += LoadProperties.mendstone; blockProcCheck(block, player); blockProcCheck(block, player); } //MOSS STONE - else if(id == 48 && block.getData() != (byte) 5){ + else if(id == 48 && block.getData() != (byte) 5) + { + Bukkit.getPluginManager().callEvent(armswing); xp += LoadProperties.mmossstone; blockProcCheck(block, player); blockProcCheck(block, player); } //STONE BRICK - else if(id == 98 && !plugin.misc.blockWatchList.contains(block)){ + else if(id == 98 && !plugin.misc.blockWatchList.contains(block)) + { + Bukkit.getPluginManager().callEvent(armswing); xp += LoadProperties.mstonebrick; blockProcCheck(block, player); blockProcCheck(block, player); diff --git a/src/main/java/com/gmail/nossr50/skills/WoodCutting.java b/src/main/java/com/gmail/nossr50/skills/WoodCutting.java index fe0c6a87b..dd2f238e4 100644 --- a/src/main/java/com/gmail/nossr50/skills/WoodCutting.java +++ b/src/main/java/com/gmail/nossr50/skills/WoodCutting.java @@ -25,6 +25,8 @@ import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; import org.bukkit.Statistic; import org.bukkit.enchantments.Enchantment; +import org.bukkit.event.player.PlayerAnimationEvent; +import org.bukkit.Bukkit; import com.gmail.nossr50.Users; import com.gmail.nossr50.m; import com.gmail.nossr50.mcMMO; @@ -201,7 +203,11 @@ public class WoodCutting } public static void leafBlower(Player player, Block block){ - if(LoadProperties.toolsLoseDurabilityFromAbilities) + + PlayerAnimationEvent armswing = new PlayerAnimationEvent(player); + Bukkit.getPluginManager().callEvent(armswing); + + if(LoadProperties.toolsLoseDurabilityFromAbilities) { if(!player.getItemInHand().containsEnchantment(Enchantment.DURABILITY)) m.damageTool(player, (short) LoadProperties.abilityDurabilityLoss);