EntityInteraction don't work?

Discussion in 'Spigot Plugin Development' started by Drank, Jun 27, 2015.

  1. My interaction event:

    Code (Text):
        public void onInteractEntity(PlayerInteractEntityEvent e){
            System.out.println("CLICKED ANY MOB");
            Player p = (Player) e.getPlayer();
            Entity ent = e.getRightClicked();
            if (ent instanceof Villager){
                p.sendMessage("Yeah its right, you clicked a freaking villager, OMG MASHALLAH");
  2. First of all
    Player p = e.getPlayer();
    You don't need cast the variable becouse getPlayer return a player. Secondly, what dont work? The if sentence? All the event dont launch?
    Have you register the event?
  3. Fixed it myself, no probs.
  4. Write the solution, possible someone wict the same problem can fix it.
  5. I don't know how I fixed it. I made an other Event to know if the events are registered, and at that time it worked, so I don't freaking know ;)
  6. Guessing you're a starting out dev?
  7. Yes, I am making sort of an VillagerShopMenu :p
    I live in Norway.
  8. Cool :) Dont give up :D