Check if a player is standing on dirt?

Discussion in 'Plugin Development' started by lbjdaking23, Aug 17, 2011.

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

    lbjdaking23

    How can I check if a player is standing on dirt?
     
  2. Offline

    Crash

    if(player.getLocation().getBlock().getRelative(BlockFace.DOWN).getType().equals(Material.DIRT)){


    }
     
  3. Offline

    moose517

    if (player.getLocation().getBlock().getType() == Material.DIRT) {
    // standing on dirt
    }

    slightly abbreviated i think but based on the java docs i think that would work.

    haha i was sooo close.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 18, 2016
  4. Offline

    lbjdaking23

    Ok now I got that on player move and another code how do I make onplayermove activate and deactivate by a command?
     
  5. Offline

    ben657

    Make a HashSet or a List of Player's, make the command put a player in or out depending if it already has that player, then check if the player is in it before you check the block :)
     
Thread Status:
Not open for further replies.

Share This Page