Advertisement
Guest User

Untitled

a guest
May 9th, 2014
231
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.81 KB | None | 0 0
  1. import java.io.File;
  2. import java.io.IOException;
  3.  
  4. import me.assist.playerrealms.DefaultWorldGenerator;
  5.  
  6. import org.bukkit.Bukkit;
  7. import org.bukkit.World;
  8.  
  9. import com.google.common.io.Files;
  10.  
  11. public class RealmCreator {
  12.  
  13.     String worldName = "null";
  14.  
  15.     public RealmCreator(String worldName) {
  16.         this.worldName = worldName;
  17.     }
  18.  
  19.     public void generateRealm() {
  20.         File dir = new File(".").getAbsoluteFile();
  21.         World defWorld = Bukkit.getWorld("prDefWorld");
  22.  
  23.         if (defWorld != null) {
  24.             File def = defWorld.getWorldFolder();
  25.  
  26.             try {
  27.                 Files.copy(def, new File(dir.getPath(), worldName));
  28.             } catch (IOException e) {
  29.                 e.printStackTrace();
  30.             }
  31.  
  32.         } else {
  33.             new DefaultWorldGenerator().tryCreate();
  34.             Bukkit.getLogger().info("Default world generated.");
  35.            
  36.             generateRealm();
  37.         }
  38.     }
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement