Advertisement
Guest User

Untitled

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