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 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/ComuSkywars/maps/" + name);
- try {
- Utils.copyDirectory(file2, file);
- }
- catch (Exception ex) {
- ex.printStackTrace();
- Logger.warn("Failed to copy world to arena '" + name + "'");
- return;
- }
- try {
- final WorldCreator worldCreator = new WorldCreator(name);
- worldCreator.generateStructures(false);
- final World world = worldCreator.createWorld();
- world.setAutoSave(false);
- world.setKeepSpawnInMemory(false);
- world.setAnimalSpawnLimit(0);
- world.setGameRuleValue("doMobSpawning", "false");
- world.setGameRuleValue("doDaylightCycle", "false");
- world.setGameRuleValue("mobGriefing", "false");
- world.setTime(0L);
- world.setStorm(false);
- world.setThundering(false);
- this.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.config.contains("schematic") && Arena.this.mode != Enums.Mode.SOLO) {
- 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);
- Logger.info("§e§l>> §fMundo §b§n"+name.toString()+"§f cargado correctamente §8[§4ASYNC§8]");
- }
- catch (Exception ex2) {
- Logger.warn("Failed to generate world to arena '" + name + "'");
- ex2.printStackTrace();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement