Fixed Call of The Wild & RIGHT_CLICK_AIR tool activation not working.

Apparently we can't use ignoreCancelled=true on PlayerInteractEvent...
This commit is contained in:
GJ 2012-02-28 09:27:14 -05:00
parent e5922bf3e7
commit 26e3403ff4

View File

@ -193,14 +193,13 @@ public class mcPlayerListener implements Listener
player.sendMessage(ChatColor.GOLD+"mcMMO is currently in an XP rate event! XP rate is "+LoadProperties.xpGainMultiplier+"x!"); player.sendMessage(ChatColor.GOLD+"mcMMO is currently in an XP rate event! XP rate is "+LoadProperties.xpGainMultiplier+"x!");
} }
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) @EventHandler(priority = EventPriority.MONITOR)
public void onPlayerInteract(PlayerInteractEvent event) public void onPlayerInteract(PlayerInteractEvent event)
{ {
Player player = event.getPlayer(); Player player = event.getPlayer();
PlayerProfile PP = Users.getProfile(player); PlayerProfile PP = Users.getProfile(player);
Action action = event.getAction(); Action action = event.getAction();
Block block = event.getClickedBlock(); Block block = event.getClickedBlock();
Material mat = block.getType();
ItemStack is = player.getItemInHand(); ItemStack is = player.getItemInHand();
/* /*
@ -208,6 +207,7 @@ public class mcPlayerListener implements Listener
*/ */
if(action == Action.RIGHT_CLICK_BLOCK) if(action == Action.RIGHT_CLICK_BLOCK)
{ {
Material mat = block.getType();
if(LoadProperties.enableMySpawn && block != null) if(LoadProperties.enableMySpawn && block != null)
{ {
if(mat.equals(Material.BED_BLOCK) && mcPermissions.getInstance().setMySpawn(player)) if(mat.equals(Material.BED_BLOCK) && mcPermissions.getInstance().setMySpawn(player))
@ -224,7 +224,7 @@ public class mcPlayerListener implements Listener
player.updateInventory(); player.updateInventory();
} }
if(LoadProperties.enableAbilities && (m.abilityBlockCheck(block) || block.getType().equals(Material.AIR))) if(LoadProperties.enableAbilities && m.abilityBlockCheck(block))
{ {
if(block != null && m.isHoe(is) && !mat.equals(Material.DIRT) && !mat.equals(Material.GRASS) && !mat.equals(Material.SOIL)) if(block != null && m.isHoe(is) && !mat.equals(Material.DIRT) && !mat.equals(Material.GRASS) && !mat.equals(Material.SOIL))
Skills.activationCheck(player, SkillType.HERBALISM); Skills.activationCheck(player, SkillType.HERBALISM);
@ -299,7 +299,7 @@ public class mcPlayerListener implements Listener
if(player.isSneaking() && mcPermissions.getInstance().taming(player) && (action == Action.RIGHT_CLICK_AIR || action == Action.RIGHT_CLICK_BLOCK)) if(player.isSneaking() && mcPermissions.getInstance().taming(player) && (action == Action.RIGHT_CLICK_AIR || action == Action.RIGHT_CLICK_BLOCK))
{ {
if(mat.equals(Material.BONE) && is.getAmount() >= LoadProperties.bonesConsumedByCOTW) if(is.getType().equals(Material.BONE) && is.getAmount() >= LoadProperties.bonesConsumedByCOTW)
{ {
for(Entity x : player.getNearbyEntities(40, 40, 40)) for(Entity x : player.getNearbyEntities(40, 40, 40))
{ {