Block Detection

Discussion in 'Plugin Development' started by someguyonthestreet, Mar 18, 2015.

Thread Status:
Not open for further replies.
  1. How would I detect if a player as walked over or jumped over a specific block, redstone block if possible. I'm trying methods like checking the block location and the player location but it just doesn't work.
     
  2. Offline

    Funergy

    @someguyonthestreet
    p.getLocation().add(0,-1,0).getBlock().getType() == Material.REDSTONE_BLOCK
     
  3. Offline

    SuchSwegMuchWow

    @Funergy Why add -1 when you can do .subtract(0, 1, p)
     
    Neonix and CraftCreeper6 like this.
  4. Offline

    Funergy

  5. Offline

    teej107

    @SuchSwegMuchWow Why use addition or subtraction when you can just get a location relative to a block's face?
    There are plenty of ways to obtain a Location.
     
  6. Offline

    Zombie_Striker

    @someguyonthestreet
    Code:
    // Change -1 to -2 for if a player jumps
    if(p.getLocation().subtract(0,-1,0).getblock().getType().equals(Materials.REDSTONE_BLOCK)
     
Thread Status:
Not open for further replies.

Share This Page