Player collision with certain blocks

Discussion in 'Plugin Development' started by Nvblueboy, Aug 7, 2012.

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

    Nvblueboy

    I'm currently working on a plugin where I need to tell if a player collides with a certain type of block (Orange wool & nether brick). Is there a way to do this, like an event listener? I'm fairly new to Bukkit programming and haven't found a way to do this yet. Thanks in advance!
     
  2. Offline

    ZeusAllMighty11

    PlayerMoveEvent

    Check if the player's y (or block below) block = wool or netherbrick
     
  3. Offline

    Morthis

  4. Offline

    A5H73Y

    Make life easy for you.
    Code:
    @EventHandler
    public void onPlayerMove(PlayerMoveEvent event){
    Material material = Material.getMaterial(IDHERE);
    Block blockbelow = event.getPlayer().getLocation().getBlock().getRelative(BlockFace.DOWN);
       if (blockbelow.getTypeId() == material){
                                      (CODE)
       }
    
     
  5. Offline

    pzxc

    All of these answers are great if you are looking for the block you are standing on, but not so much if you are looking for a block that you collide with horizontally (or vertically by jumping into it from below).
     
Thread Status:
Not open for further replies.

Share This Page