Player Trigger Tripwire

Discussion in 'Spigot Plugin Development' started by iHaq, May 7, 2017.

  1. Hey I am having trouble with the player triggering a trip wire, am I doing something wrong?

    Code (Text):
        @EventHandler(priority = EventPriority.HIGHEST)
        public void onPlayerInteract(PlayerInteractEvent e) {
            Player p = e.getPlayer();
            if (e.getAction() == Action.PHYSICAL) {
                if (e.getClickedBlock().getType() == Material.TRIPWIRE) {
                    p.sendMessage("you hit a trap!");
                }
            }
        }
     
  2. You know, the player is interacting with the hook and not the wire, do you? ;)
     
  3. I tried "Material.TRIPWIRE_HOOK" and still got no result.
     
  4. You registered your listener? (I know, its a dumb question, but your code seems correct to me)
     
    • Agree Agree x 1
  5. Make a debug message just to make sure the code is firing
     
  6. Actually that's exactly what I forgot to do. Lets just say this thread never existed. Thank you :)