I can't work out how to place a sign on a block. It sets the block at the given location to a sign, but theres a big gap, almost like it sets it on to an air block, I'm assuming it has something to do with the facing of the sign? How do I set the sign with the correct facing? Code: Vector vec = player.getLocation().toVector(); // get player's location vector Vector dir = player.getLocation().getDirection(); // get player's facing vec = vec.add(dir.multiply(1)); // add player's direction * 1 to the location (getting ~1 block in front of player) Location location = vec.setY(vec.getY()+1).toLocation(player.getWorld()); // convert back to location // Set the pressure plate location.getBlock().setType(Material.STONE_PLATE); // Set the block above location.add(0,3, 0); location.getBlock().setType(Material.GOLD_BLOCK); // Set the sign on to the gold block // Need help here Location signLoc = ... ? signLoc.getBlock().setType(Material.WALL_SIGN);
Sign.setFacingDirection() could probably solve the facing direction problem. And you should create a new Block to safe the location of the current Block in. You could get it with getBlockAt(location).
Solved. Thanks! For those interested, this topic was also of great help: http://forums.bukkit.org/threads/solved-player-direction.72789/