Setting block at location

Discussion in 'Plugin Development' started by Irantwomiles, Apr 29, 2015.

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

    Irantwomiles

    I'm trying to use a command to set a player inside a glass box. So far this is what I've tried. I tried getting the players location and its X, Y, Z and adding or subtracting it based on what I needed, I used double's to do that. I'm not sure how to set the block at those locations. Here is the code I've tried.

    Code:
        public void freeze(Player player) {
            Location location;
            double xpos = player.getLocation().getX() + 1.0;
            double xneg = player.getLocation().getX() - 1.0;
            double y = player.getLocation().getY() + 3;
            double zpos = player.getLocation().getZ() + 1.0;
            double zneg = player.getLocation().getZ() - 1.0;
        }
    now I dont know how to use what I have to spawn the blocks. Any help, thread, pseudo code or even actual code snippets would be appreciated (But dont spoon feed me, I actually want to learn this for future reference). Thanks in advance!
     
  2. Offline

    SuperOriginal

    World#getBlockAt(Location).setType(Material);
     
Thread Status:
Not open for further replies.

Share This Page