Advertisement
Guest User

Untitled

a guest
Oct 16th, 2019
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.66 KB | None | 0 0
  1. public void setPuzzle() {
  2.         FileConfiguration con =  fm.getConfig(new File(getDataFolder(),"areas.yml")).getFileConfiguration();
  3.  
  4.         World world = getServer().getWorld("puzzle-1");
  5.         Location from = new Location(world, 14, 99, 17);
  6.         Location to = new Location(world, 46, 116, -17);
  7.         List<Block> b = new ArrayList<>();
  8.         List<Block> r = new ArrayList<>();
  9.         List<Block> y = new ArrayList<>();
  10.         List<Block> g = new ArrayList<>();
  11.         int a = 0;
  12.         int bl = 0;
  13.         int yl = 0;
  14.         int gr = 0;
  15.         while (from.getBlockY() <= to.getBlockY()) {
  16.             int level = from.getBlockY() - 99;
  17.  
  18.             while(from.getBlockX() <= to.getBlockX()) {
  19.  
  20.                 while (from.getBlockZ() >= to.getBlockZ()) {
  21.  
  22.  
  23.                     if (from.getBlock().getType() == Material.BLUE_CONCRETE_POWDER) {
  24.                         con.set("blue."+level+".blocks."+a+".x",from.getBlockX());
  25.                         con.set("blue."+level+".blocks."+a+".y",from.getBlockY());
  26.                         con.set("blue."+level+".blocks."+a+".z",from.getBlockZ());
  27.                         a++;
  28.                     }
  29.                     if (from.getBlock().getType() == Material.RED_CONCRETE_POWDER) {
  30.                         con.set("red."+level+".blocks."+bl+".x",from.getBlockX());
  31.                         con.set("red."+level+".blocks."+bl+".y",from.getBlockY());
  32.                         con.set("red."+level+".blocks."+bl+".z",from.getBlockZ());
  33.                         bl++;
  34.                     }
  35.                     if (from.getBlock().getType() == Material.YELLOW_CONCRETE_POWDER) {
  36.                         con.set("yellow."+level+".blocks."+yl+".x",from.getBlockX());
  37.                         con.set("yellow."+level+".blocks."+yl+".y",from.getBlockY());
  38.                         con.set("yellow."+level+".blocks."+yl+".z",from.getBlockZ());
  39.                         yl++;
  40.                     }
  41.                     if (from.getBlock().getType() == Material.GREEN_CONCRETE_POWDER) {
  42.                         con.set("green."+level+".blocks."+gr+".x",from.getBlockX());
  43.                         con.set("green."+level+".blocks."+gr+".y",from.getBlockY());
  44.                         con.set("green."+level+".blocks."+gr+".z",from.getBlockZ());
  45.                         gr++;
  46.                     }
  47.                     a++;
  48.                     from.setZ(from.getZ()-1);
  49.                 }
  50.                 a++;
  51.                 from.setX(from.getX()+1);
  52.             }
  53.             a++;
  54.             from.setY(from.getY()+1);
  55.         }
  56.         try {con.save(new File(getDataFolder(),"areas.yml"));} catch (IOException e){}
  57.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement