Getting ALL blocks a player is standing on

Discussion in 'Spigot Plugin Development' started by HeyAwesomePeople, May 5, 2015.

  1. Hello!

    I am creating a TNTRun type game where I am trying to implement a system to automatically break the blocks you are standing on if you stand still for too long.

    For this so far I have tried to just use the cords to attempt to get all blocks a player is standing on but it seems long and not very efficient. So what I am asking is, how would I get all the blocks a player is standing on?

    I don't mean the one block directly below the player, I mean like the blocks a player is technically standing on. For example, if there is four blocks placed, you could stand in the middle of those four and any 3 could be destroyed and you would still be standing. If you were between two blocks and one was destroyed, you would still be standing.

    So yeah, how would I get all blocks a player is standing on? I have and will continue my clunky way but someone has had to have come up with a good solution before me.

    Thanks,
    HeyAwesomePeople
     
  2. Hi,

    I think if you do like a 3x3 that musst be all blocks, he possibly can stand on.
     
  3. 2x2 should be enough?
     
  4. You could just do player.getLocation().getBlock().getRelative(BlockFace.DOWN) then from that block, check his location x and z to see which 2x2 blocks to select and remove.
     
    • Like Like x 2