Solved HELP block.setTypeIdAndData(); Not work, not Error

Discussion in 'Plugin Development' started by nyanneko0113, Oct 7, 2020.

  1. Offline

    nyanneko0113

  2. Online

    timtower Moderator Moderator

    @nyanneko0113 What part isn't working then?
    Why are you still using ID's?
     
  3. Offline

    nyanneko0113

    not working

    Code:
          public Double arena(Player p) {
              FileConfiguration config = instance.getConfig();
                  for (Double a = config.getDouble("spawn.arena1.x"); a < config.getDouble("spawn.arena2.x"); a++) {
                  for (Double a1 = config.getDouble("spawn.arena2.x"); a < config.getDouble("spawn.arena1.x"); a++) {
                  for (Double i = config.getDouble("spawn.arena1.y"); a < config.getDouble("spawn.arena2.y"); a++) {
                  for (Double i1 = config.getDouble("spawn.arena2.y"); a < config.getDouble("spawn.arena1.y"); a++) {
                  for (Double u = config.getDouble("spawn.arena1.z"); a < config.getDouble("spawn.arena2.z"); a++) {
                      Block block = p.getWorld().getBlockAt(new Location(p.getWorld(), a, i, u));
                      block.setTypeIdAndData(35, (byte) 4, true);
                  for (Double u1 = config.getDouble("spawn.arena2.z"); a < config.getDouble("spawn.arena1.z"); a++) {
                      Block block1 = p.getWorld().getBlockAt(new Location(p.getWorld(), a1, i1, u1));
                      block1.setTypeIdAndData(35, (byte) 4, true);
                  }
          }
    }
    }
    }
    }
              return null;
          }
     
  4. Offline

    ryanopily

    What specifically isn't working? Do you have an error log?

    Sent from my SM-G970U using Tapatalk
     
  5. Offline

    nyanneko0113

    specifically not work:
    Min Max Loop Get Location → setblock wool

    Code:
    Code:
          public Double arena(Player p) {
              FileConfiguration config = instance.getConfig();
                  for (Double a = config.getDouble("spawn.arena1.x"); a < config.getDouble("spawn.arena2.x"); a++) {
                  for (Double a1 = config.getDouble("spawn.arena2.x"); a < config.getDouble("spawn.arena1.x"); a++) {
                  for (Double i = config.getDouble("spawn.arena1.y"); a < config.getDouble("spawn.arena2.y"); a++) {
                  for (Double i1 = config.getDouble("spawn.arena2.y"); a < config.getDouble("spawn.arena1.y"); a++) {
                  for (Double u = config.getDouble("spawn.arena1.z"); a < config.getDouble("spawn.arena2.z"); a++) {
                      Block block = p.getWorld().getBlockAt(new Location(p.getWorld(), a, i, u));
                      block.setTypeIdAndData(35, (byte) 4, true);
                  for (Double u1 = config.getDouble("spawn.arena2.z"); a < config.getDouble("spawn.arena1.z"); a++) {
                      Block block1 = p.getWorld().getBlockAt(new Location(p.getWorld(), a1, i1, u1));
                      block1.setTypeIdAndData(35, (byte) 4, true);
                  }
          }
    }
    }
    }
    }
              return null;
          }
     
  6. Offline

    nyanneko0113

    Code edited now.
    not working....

    Result: Error (Server stop error) https://pastebin.com/BLYY2D5v

    Code:
    Code:
          public void arena(Player p) {
              FileConfiguration config = instance.getConfig();
              p.sendMessage("あいうえお");
    
              int arena1x = config.getInt("spawn.arena1.x");
              int arena1y = config.getInt("spawn.arena1.y");
              int arena1z = config.getInt("spawn.arena1.z");
              int arena2x = config.getInt("spawn.arena2.x");
              int arena2y = config.getInt("spawn.arena2.y");
              int arena2z = config.getInt("spawn.arena2.z");
    
              for(int a = arena1x; a >= arena2x;) {
                  if (String.valueOf(a).contains("-")) {
                      a--;
                  }
                  else if (String.valueOf(a).contains("+")) {
                      a++;
                  }
              for (int a1 = arena1x; a <= arena2x;) {
                  if (String.valueOf(a).contains("-")) {
                      a--;
                  }
                  else if (String.valueOf(a).contains("+")) {
                      a++;
                  }
              for(int i = arena1y; a >= arena2y;) {
                  if (String.valueOf(i).contains("-")) {
                      a--;
                  }
                  else if (String.valueOf(i).contains("+")) {
                      a++;
                  }
              for (int i1 = arena1y; a <= arena2y;) {
                  if (String.valueOf(i1).contains("-")) {
                      a--;
                  }
                  else if (String.valueOf(i1).contains("+")) {
                      a++;
                  }
              for(int u = arena1z; a >= arena2z;) {
                  if (String.valueOf(u).contains("-")) {
                      System.out.print(a);
                      System.out.print(i);
                      System.out.print(u);
                      Block block = p.getWorld().getBlockAt(a, i, u);
                      block.setType(Material.WOOL);
                      a--;
                  }
                  else if (String.valueOf(u).contains("+")) {
                      System.out.print(a);
                      System.out.print(i);
                      System.out.print(u);
                      Block block = p.getWorld().getBlockAt(a, i, u);
                      block.setType(Material.WOOL);
                      a++;
                  }
              }
              for (int u1 = arena1z; a <= arena2z;) {
                  if (String.valueOf(u1).contains("-")) {
                      System.out.print(a1);
                      System.out.print(i1);
                      System.out.print(u1);
                      Block block = p.getWorld().getBlockAt(a1, i1, u1);
                      block.setType(Material.WOOL);
                      a--;
                  }
                  else if (String.valueOf(u1).contains("+")) {
                      System.out.print(a1);
                      System.out.print(i1);
                      System.out.print(u1);
                      Block block = p.getWorld().getBlockAt(a1, i1, u1);
                      block.setType(Material.WOOL);
                      a++;
                  }
              }
              }
              }
              }
              }
          }
     

Share This Page