Advertisement
Guest User

Untitled

a guest
Sep 7th, 2018
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.35 KB | None | 0 0
  1. public void rollBack() {
  2.  
  3. for (ArenaVote votes : arenaVotes) {
  4. votes.clear();
  5. }
  6.  
  7. final String name = this.world.getName();
  8. final Iterator<Player> iterator = Bukkit.getWorld(name).getPlayers().iterator();
  9. while (iterator.hasNext()) {
  10. ((Entity) iterator.next()).teleport(Bukkit.getWorlds().get(0).getSpawnLocation());
  11. }
  12.  
  13. Bukkit.unloadWorld(name, false);
  14.  
  15. this.countdownTask.cancel();
  16. this.countdownTask = null;
  17.  
  18. final File file = new File(name);
  19. final File file2 = new File("plugins/ComuWars/maps/" + name);
  20.  
  21. try {
  22. Utils.emptyFolder(file);
  23. }
  24. catch (Exception ex) {
  25. ex.printStackTrace();
  26. Logger.warn("§4§l>> §cError al vaciar arena " + name);
  27. return;
  28. }
  29. try {
  30. Bukkit.getScheduler().runTaskLater(Main.getPlugin(), () -> Utils.copyDirectory(file2, file), 2);
  31. }
  32. catch (Exception ex) {
  33. ex.printStackTrace();
  34. Logger.warn("§4§l>> §cError al copiar arena " + name);
  35. return;
  36. }
  37.  
  38. try {
  39.  
  40. Bukkit.getScheduler().runTaskLater(Main.getPlugin(), () -> {
  41.  
  42. Logger.info("§e§l>> §fCargando mundo §b§n"+name.toString()+"§f §8[§4ASYNC§8]");
  43.  
  44. final WorldCreator worldCreator = new WorldCreator(name);
  45. worldCreator.generateStructures(false);
  46. final World world = worldCreator.createWorld();
  47. Utils.applyRules(world);
  48. chests.clear();
  49.  
  50. new BukkitRunnable() {
  51. public void run() {
  52.  
  53. for (final String s : Arena.this.config.getStringList("chests")) {
  54. if (s.split(" : ").length > 5) {
  55. Arena.this.chests.put(Utils.unserializeLocation(s), (Chest.getChest(s.split(" : ")[6]) == null) ? Chest.getChest("normal") : Chest.getChest(s.split(" : ")[6]));
  56. }
  57. }
  58. Arena.access$19(Arena.this, world);
  59. Arena.access$6(Arena.this, Enums.State.WAITING);
  60. Arena.this.blocks.clear();
  61. if (Arena.this.mode != Enums.Mode.SOLO && Arena.this.config.contains("schematic")) {
  62. Arena.access$21(Arena.this, Utils.unserializeLocation(Arena.this.config.getString("schematic")));
  63. Bukkit.getScheduler().runTaskLater((Plugin)Main.getPlugin(), (Runnable)new Runnable() {
  64. @Override
  65. public void run() {
  66. Schematic.generateAsync(Arena.this.schematic, Arena.this.blocks);
  67. }
  68. }, 1L);
  69. }
  70. }
  71.  
  72. }.runTaskLaterAsynchronously((Plugin)Main.getPlugin(), 20L);
  73.  
  74. }, 3);
  75.  
  76. } catch (Exception ex2) {
  77. Logger.warn("§4§l>> §cError al generar arena " + name);
  78. ex2.printStackTrace();
  79. }
  80. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement