Solved check if player walked on a string (the item, not the class)

Discussion in 'Plugin Development' started by Kyorax, Sep 4, 2015.

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

    Kyorax

    Hi everyone,
    is there an event that is triggered by a player triggering a string?
    I mean the ones that you obtain by killing spiders or destroying webs, not the java class.
    What ways are there to detect that behaviour?

    Thanks a lot in advance.
     
  2. Offline

    RoboticPlayer

    I think you could use the PlayerMoveEvent, and when it is called check the block that their feet are at. If it is string, then do your code.
     
  3. Offline

    Kyorax

    @henderry2019 Yes, but that would cost a whole lot of performance. Isn't there a better way?
     
  4. Offline

    Keubix

    Code:
    @EventHandler
    public void onWalkOnString(PlayerMoveEvent e) {
    Player player = e.getPlayer();
    Location loc = player.getLocation();
    loc.setY(loc.getY() - 1);
    if (loc.getBlock().getType() == Material.STRING) {
    //Do Whatever You Wanted To Do
    }
    }
    
     
  5. Offline

    mythbusterma

    @Kyorax

    No, it's not. No, there isn't.
     
Thread Status:
Not open for further replies.

Share This Page