Placing a wall around a player

Discussion in 'Plugin Development' started by ImminentFate, Apr 20, 2012.

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

    ImminentFate

    I don't know what to do, really, even though this should be a straightforward thing:
    I need to have it so when a player types a command, a wall (doesnt matter the material) gets placed around them. One block in front of them, one behind, to the left and right. No corners.
    I have:
    PHP:
    Player player = (Playersender;
                
    Material block Material.STONE;
                    if (
    args.length == 1){
                        
    Location plocation player.getLocation();        
                        
    Location blockLocationX plocation.add(1,0,-1);
                        
    Location bLocationY plocation.add(001);
                        
    bLocationY.
                        
    blockLocationX.getBlock().setType(block);
    Now I know this isn't complete, but when I try to run this, it combines the two locations (bLocationX and Y) and places only one block. I don't know why.
     
  2. Offline

    SirTyler

    I think that your adding the cords to the location, THEN setting its location to the blockLocationX, it then merges into bLocationY because plocation still contains the values given when used in blockLocationX.
     
  3. Offline

    ImminentFate

    So any idea how I could rectify the issue?
     
  4. Offline

    SirTyler

    Code:java
    1.  
    2. Location bLocationX = player.getLocation();
    3. bLocationX.add(1,0,-1);
    4. Location bLocatuonY = player.getLocation();
    5. bLocationY.add(0,0,1);
    6.  

    That should work
     
  5. Offline

    BloodShura

    Or, in alternative of what SirTyler said above, use your code but add 'clone()' after the location.
     
  6. Offline

    ImminentFate

    thanks guys

    Argh new issue. How do i make a command sequence loop twice?
    For example,
    place a block, remove it, then place it again, remove it and stop
    That is, it places the block, then removes it, twice

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 25, 2016
  7. Offline

    dillyg10

    Might wanna checkout task stuff.

    http://wiki.bukkit.org/Scheduler_Programming
     
Thread Status:
Not open for further replies.

Share This Page