Solved spleef

Discussion in 'Plugin Development' started by Sicka_gp, Jan 24, 2013.

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

    Sicka_gp

    Hi, I'm the spleef arena plugin and I have a problem with setting negative coordinates. He told me someone would please how? Here is my code
    Code:
    public class CountdownCommandExecutor2 implements CommandExecutor {
       
       
        public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args) {
            final Player player = (Player)sender;
            if(cmd.getName().equalsIgnoreCase("podkopsnow") && sender instanceof Player) {
                for(int x = 100; x<110; x++) {
                    for(int y = 100; y<110; y++) {
                        for(int z = 100; z<110; z++) {
                            Location location = new Location(player.getWorld(), x, y, z);
                            location.getBlock().setType(Material.SNOW_BLOCK);
                           
                            }                   
                    }
                }
               
               
               
            }
     
            return true;
        }
       
       
    }    
    I would like to set negative x coordinate and do not know how to do it.
     
  2. Offline

    chasechocolate

    for(int i = -50; i < 110; i++)?
     
  3. Offline

    Sicka_gp

    I need to coordinate both were negatively
    for(int x = -100; x<-110; x++) and this does not work
    for or example
    first position is x: -100, y: 100, z:100
    the second position is -110, y 100, z:110
     
  4. Offline

    chasechocolate

    Code:java
    1. for(int x = -100; x < 110; x++){
    2. for(int y = 100; y < 100; y++){ //however this isn't needed because the y is always 100 (from what you said above)
    3. for(int z = 100; z < 110; z++){
    4. //set the block with coords x, y, z.
    5. }
    6. }
    7. }
     
  5. Offline

    Sicka_gp

    I need this to have negative coordinates. When I enter the code you wrote to me so I create a single point in the negative and the other positive ..
    for(int x =-100; x <110; x++){
    x<110 I need to put in a negative
    x<-110 this does not work
    I need to make a square for which you will have both coordinates x in the negative
    sorry for the English, I am from Czech Republic
     
  6. Offline

    chasechocolate

    Sicka_gp maybe surround it in parentheses? x < (-110)? Although for the loop to function the int has to be anything below -110.
     
  7. Offline

    Sicka_gp

    Code:
     for(int x = -100; x<(-110); x++) {
                    for(int y = 100; y<110; y++) {
                        for(int z = 100; z<110; z++) {
                            Location location = new Location(player.getWorld(), x, y, z);
                            location.getBlock().setType(Material.SNOW_BLOCK);
                            }                    
    does not work :(
    I enter the command and nothing happens
     
  8. Offline

    1qaz0okm

    for(int x = -100; x<-110; x++) {

    x is already less than -110

    for(int x = -100; x>-110; x--) {
     
  9. Offline

    Sicka_gp

    super thank you all for your help :):)
     
Thread Status:
Not open for further replies.

Share This Page