Question Event not working?

Discussion in 'Bukkit Help' started by The10D, Feb 4, 2016.

Thread Status:
Not open for further replies.
  1. Offline

    The10D

    So I have been making a plugin that allows you to fall onto hay bale without taking damage and "John Cena" people but they are not working. There are no errors.
    Code:
    @EventHandler
        public void onFallonWheat(EntityDamageByEntityEvent e){
            if(e.getEntity() instanceof Player && e.getCause() == DamageCause.FALL){
              
            Player p = (Player) e.getEntity();
            Location location = p.getLocation();
            int x = location.getBlockX();
            int y = location.getBlockY()-1;
            int z = location.getBlockZ();
            Location loc = new Location(p.getWorld(), x, y, z);
            if(loc.getBlock().getType() == Material.HAY_BLOCK){
                e.setCancelled(true);
                p.setFallDistance(0.0F);
            }
        }
        }
    Code:
    @EventHandler
        public void onJohnCena(PlayerInteractAtEntityEvent e){
            Player p = e.getPlayer();
            if(p.getItemInHand() == null && e.getRightClicked().isOnGround() == false && e.getRightClicked() instanceof LivingEntity){
                Entity r = e.getRightClicked();
                r.setFallDistance(15.0f);
                r.getWorld().playEffect(r.getLocation(), Effect.STEP_SOUND, 1, 1);      
            }
        }
     
    Last edited: Feb 4, 2016
Thread Status:
Not open for further replies.

Share This Page