Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- final Timer delaytimer= new Timer();
- TimerTask delaytask = new TimerTask(){
- public void run(){
- String worldstring = Arenas.getString(arena + ".arena.world");
- final World world = Bukkit.getServer().getWorld(worldstring);
- double X1 = Arenas.getInt(arena + ".corner.x");
- double Y1 = Arenas.getInt(arena + ".corner.y");
- double Z1 = Arenas.getInt(arena + ".corner.z");
- double X2 = Arenas.getInt(arena + ".corner2.x");
- double Y2 = Arenas.getInt(arena + ".corner2.y");
- double Z2 = Arenas.getInt(arena + ".corner2.z");
- Location loc1 = new Location(Bukkit.getWorld(Arenas.getString(arena + ".arena.world")), X1, Y1, Z1);
- Location loc2 = new Location(Bukkit.getWorld(Arenas.getString(arena + ".arena.world")), X2, Y2, Z2);
- int minX = Math.min(loc1.getBlockX(), loc2.getBlockX());
- int minY = Math.min(loc1.getBlockY(), loc2.getBlockY());
- int minZ = Math.min(loc1.getBlockZ(), loc2.getBlockZ());
- int maxX = Math.max(loc1.getBlockX(), loc2.getBlockX());
- int maxY = Math.max(loc1.getBlockY(), loc2.getBlockY());
- int maxZ = Math.max(loc1.getBlockZ(), loc2.getBlockZ());
- for(int x = minX; x <= maxX; x++){
- for(int y = minY; y <= maxY; y++){
- for(int z = minZ; z <= maxZ; z++){
- byte data = world.getBlockAt(x, y, z).getData();
- if (data != random) {
- Block blockk = world.getBlockAt(x, y, z); // odstranuje bloky
- blockk.setType(Material.AIR);
- }
- }
- }
- }
- final Timer generatetimer= new Timer(); //generuje hrací plochu
- TimerTask generatetask = new TimerTask(){
- public void run(){
- statuss = Temp.getString(arena + ".status");
- int i = 0;
- int n = 0;
- double X = Arenas.getDouble(arena + ".corner.x");
- int X2 = (int) X;
- double Y = Arenas.getDouble(arena + ".corner.y");
- int Y2 = (int) Y;
- double Z = Arenas.getDouble(arena + ".corner.z");
- int Z2 = (int) Z;
- int size = Arenas.getInt(arena + ".size");
- for (i = 0; i <= size*size-1; i++) {
- int random = 0 + (int)(Math.random()*14);
- double zbytek = i % size;
- if (zbytek == 0) {n = (i / size) * 3;}
- Block block = world.getBlockAt(X2+1+i*3-n*size, Y2, Z2+1+n);
- block.setType(Material.WOOL);
- block.setData((byte) random);
- Block block21 = world.getBlockAt(X2+2+i*3-n*size, Y2, Z2+1+n);
- block21.setType(Material.WOOL);
- block21.setData((byte) random);
- Block block31 = world.getBlockAt(X2+3+i*3-n*size, Y2, Z2+1+n);
- block31.setType(Material.WOOL);
- block31.setData((byte) random);
- Block block12 = world.getBlockAt(X2+1+i*3-n*size, Y2, Z2+2+n);
- block12.setType(Material.WOOL);
- block12.setData((byte) random);
- Block block22 = world.getBlockAt(X2+2+i*3-n*size, Y2, Z2+2+n);
- block22.setType(Material.WOOL);
- block22.setData((byte) random);
- Block block32 = world.getBlockAt(X2+3+i*3-n*size, Y2, Z2+2+n);
- block32.setType(Material.WOOL);
- block32.setData((byte) random);
- Block block13 = world.getBlockAt(X2+1+i*3-n*size, Y2, Z2+3+n);
- block13.setType(Material.WOOL);
- block13.setData((byte) random);
- Block block23 = world.getBlockAt(X2+2+i*3-n*size, Y2, Z2+3+n);
- block23.setType(Material.WOOL);
- block23.setData((byte) random);
- Block block33 = world.getBlockAt(X2+3+i*3-n*size, Y2, Z2+3+n);
- block33.setType(Material.WOOL);
- block33.setData((byte) random);
- }
- //calcelnuti pokud hra zkončila
- if (statuss.equals("lobby")) {
- generatetimer.cancel();
- }
- }
- };
- generatetimer.schedule(generatetask, 4000);
- }
- };
- delaytimer.schedule(delaytask, runtime*1000+1000);
- if (statuss.equals("lobby")) {
- delaytimer.cancel();
- }
- //calcelnuti pokud hra zkončila
- if (statuss.equals("lobby")) {
- progresstimer.cancel();
- }
- }
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement