Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void rollBack() {
- for (ArenaVote votes : arenaVotes) {
- votes.clear();
- }
- final String name = this.world.getName();
- final Iterator<Player> iterator = Bukkit.getWorld(name).getPlayers().iterator();
- while (iterator.hasNext()) {
- ((Entity) iterator.next()).teleport(Bukkit.getWorlds().get(0).getSpawnLocation());
- }
- Bukkit.unloadWorld(name, false);
- this.countdownTask.cancel();
- this.countdownTask = null;
- final File file = new File(name);
- final File file2 = new File("plugins/ComuWars/maps/" + name);
- try {
- Utils.emptyFolder(file);
- }
- catch (Exception ex) {
- ex.printStackTrace();
- Logger.warn("§4§l>> §cError al vaciar arena " + name);
- return;
- }
- try {
- Bukkit.getScheduler().runTaskLater(Main.getPlugin(), () -> Utils.copyDirectory(file2, file), 2);
- }
- catch (Exception ex) {
- ex.printStackTrace();
- Logger.warn("§4§l>> §cError al copiar arena " + name);
- return;
- }
- try {
- Bukkit.getScheduler().runTaskLater(Main.getPlugin(), () -> {
- Logger.info("§e§l>> §fCargando mundo §b§n"+name.toString()+"§f §8[§4ASYNC§8]");
- final WorldCreator worldCreator = new WorldCreator(name);
- worldCreator.generateStructures(false);
- final World world = worldCreator.createWorld();
- Utils.applyRules(world);
- chests.clear();
- new BukkitRunnable() {
- public void run() {
- for (final String s : Arena.this.config.getStringList("chests")) {
- if (s.split(" : ").length > 5) {
- Arena.this.chests.put(Utils.unserializeLocation(s), (Chest.getChest(s.split(" : ")[6]) == null) ? Chest.getChest("normal") : Chest.getChest(s.split(" : ")[6]));
- }
- }
- Arena.access$19(Arena.this, world);
- Arena.access$6(Arena.this, Enums.State.WAITING);
- Arena.this.blocks.clear();
- if (Arena.this.mode != Enums.Mode.SOLO && Arena.this.config.contains("schematic")) {
- Arena.access$21(Arena.this, Utils.unserializeLocation(Arena.this.config.getString("schematic")));
- Bukkit.getScheduler().runTaskLater((Plugin)Main.getPlugin(), (Runnable)new Runnable() {
- @Override
- public void run() {
- Schematic.generateAsync(Arena.this.schematic, Arena.this.blocks);
- }
- }, 1L);
- }
- }
- }.runTaskLaterAsynchronously((Plugin)Main.getPlugin(), 20L);
- }, 3);
- } catch (Exception ex2) {
- Logger.warn("§4§l>> §cError al generar arena " + name);
- ex2.printStackTrace();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement