[Solved] Player Interact Event

Discussion in 'Spigot Plugin Development' started by dyenxunit, May 24, 2015.

  1. I have no clue why this is not working so what im trying to do is when a player is clicked it will send the guy that clicked the player a message but currently when i click the player its not working and there is no error too.

    Code (Text):
        @EventHandler(priority=EventPriority.HIGH)
          public void eventClickOnEntity(PlayerInteractEntityEvent e) {
            Entity target = e.getRightClicked();
            if(!(Test.size() == 0)){
                return;
            }
            else if((target instanceof Player) && Bukkit.getServer().getOnlinePlayers().contains(target.getName())){
                  Player targetPlayer = (Player)target;
                  e.getPlayer().sendMessage("Test");
            }
        }
     
  2. Have You [Registers events in on enable
     
  3. yes this is inside of my onEnable class
     
  4. i think that e.getRightClicked is a block and not a player! use e.getWhoClicked() or e.getPlayer()
     
  5. This is interactentityevent
     
  6. It still doesnt work
     
  7. Oh Ya Hes Right Change it to PlayerInteractEvent
     
  8. I already fix this i figured out why it wasent working
     
  9. I'm guessing it's doing the following
    Code (Text):
    if(!(false))
        return;