I need help [URGENT]

Discussion in 'Plugin Development' started by NewMasterBR, May 8, 2014.

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

    NewMasterBR

    Well, my code is everything "right" is not giving error in eclipse, or the console, all API'S are installed, and the event that I created does not work .. could you help me? Have asked for help to several of my friends and none knows the error.

    Well, the usefulness of the plugin works when the player steps into the emerald block and he wins an unbeaten record (against falls, hits, etc.) for 30 seconds


    Code:
    @EventHandler
    public void onDamageEvent(EntityDamageEvent event) {
            if(!(event.getEntity() instanceof Player)) return;
            Player p = (Player) event.getEntity();
            if (plugin.invi.contains(p.getName())) {
              event.setCancelled(true);
              return;
          }
        }
     
    @EventHandler
    public void cu(PlayerMoveEvent event) {
      final Player player = event.getPlayer();
     
      if (!event.getFrom().getBlock().getLocation()
        .equals(event.getTo().getBlock().getLocation()))
        return;
      Block block = player.getLocation().getBlock()
        .getRelative(BlockFace.DOWN);
      if ((block.getType() == Material.EMERALD_BLOCK) &&
        (!plugin.invi.contains(player.getName()))) {
        plugin.invic.add(player.getName());
        player.getPlayer().playSound(player.getLocation(), Sound.ENDERMAN_TELEPORT, 10.0F, 0.0F);
        Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() {
            public void run() {
              plugin.invic.remove(player.getName());
              player.sendMessage("§6§lVocê perdeu sua Invencibilidade!");
            }
        }
      , 800L);
      }
    }
    }
     
  2. Offline

    rfsantos1996

    Code:java
    1. new BukkitRunnable() {
    2. public void run() {
    3. // method here - metodo run aqui
    4. }
    5. }.runTaskLater(plugin, 800);


    Vai ser mais eficiente que getScheduler().schedule
     
  3. Offline

    RainoBoy97

    Code:
    if (!event.getFrom().getBlock().getLocation() .equals(event.getTo().getBlock().getLocation())) return;
    Is your error, it will "return;" if the from location is not the same as the to location. Remove the ! and it should work.
     
Thread Status:
Not open for further replies.

Share This Page