Unreachable statement

Discussion in 'Spigot Plugin Development' started by zozidalom, May 16, 2016.

Thread Status:
Not open for further replies.
  1. I am trying to make a simple NoFall plugin but un event-setCancelled(true) I get the error Unreachable statement. Any ideas? Please help me.http://pastebin.com/Ak4mBTHg
     
  2. remove the "return;" halfway through the code - this immediately terminates the method at that position.
     
    • Agree Agree x 1
  3. @EventHandler
    public void onEntityDamage(final EntityDamageEvent event)
    {
    if (!(event.getEntity() instanceof Player)) {

    return;


    }
    Player player = (Player) event.getEntity();
    World w = player.getWorld();
    if (w.getName().equalsIgnoreCase("hub")) {
    if ((event.getCause().equals(EntityDamageEvent.DamageCause.FALL))) {
    event.setCancelled(true);
    }
    }
     
  4. Thank you!
     
    • Friendly Friendly x 1
  5. did you tried my code?
     
  6. Soloved
     
Thread Status:
Not open for further replies.