Code not work! What's wrong?

Discussion in 'Plugin Development' started by zDubsCrazy, May 3, 2014.

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

    zDubsCrazy

    This Code:
    Code:java
    1. @EventHandler
    2. public void FallMessages(EntityDamageEvent event) {
    3.  
    4. final Player p = (Player) event.getEntity();
    5.  
    6. if(p.getWorld().getName().equals("d1")) {
    7. if(event.getCause().equals(DamageCause.FALL) && p.isDead()) {
    8. new BukkitRunnable() {
    9. public void run() {
    10. World w = Bukkit.getServer().getWorld(settings.getData().getString("descida.arena1.world"));
    11. double x = settings.getData().getDouble("descida.arena1.x");
    12. double y = settings.getData().getDouble("descida.arena1.y");
    13. double z = settings.getData().getDouble("descida.arena1.z");
    14. p.teleport(new Location(w,x,y,z));
    15. }
    16. }.runTaskLater(this, 1);
    17. }
    18. for(Player all : getServer().getWorld("d1").getPlayers()) {
    19. all.sendMessage("§c" + p.getName() + " §ecaiu e morreu.");
    20. }
    21. }
    22. }

    not work... I do not know what is wrong! It no causes errors! Please help!
     
  2. Offline

    GaaTavares

    No stacktrackes? Is the event being fired? The only thing that could cause an exception is the strings/doubles that you get from the config, which could return NullPointerException if they're null.
     
  3. Offline

    zDubsCrazy

    GaaTavares
    Pode explicar melhor? (em português kk)
     
  4. Offline

    GaaTavares

    Ok. Aparece algum erro no console? O evento está sendo registrado? A unica coisa que eu posso ver que talvez cause um erro é as doubles/strings que vc pega da sua config, que podiam retornar NullPointerException se null.
    (como sabe que eu falo português ._.)
     
  5. Offline

    zDubsCrazy

    Não causa erro. Os eventos estão registrados. Não tem nenhum double null.
    Desconfiava do nome, ai fui em teu perfil ums dias atras e vi sua conversa com o Zeus. PS: Um br sempre reconhece um br :p
     
  6. Offline

    GaaTavares

    lol, ok.
    tenta adicionar uma mensagem de debug no evento pra ver se ele está sendo "fired".
     
  7. Offline

    zDubsCrazy

    Não acontece nada. Vou tentar recriar este evento!

    GaaTavares
    Descobri o que era, com a ajuda do rfsantos1996 ... Vlw! :)

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 8, 2016
Thread Status:
Not open for further replies.

Share This Page