Advertisement
JusticeKingCayden

Untitled

Mar 30th, 2020
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.99 KB | None | 0 0
  1. public void CreateIsland(Player player) {
  2.         File islandData = new File(plugin.islandData.getPath() + File.pathSeparator + player.getName() + ".yml");
  3.         FileConfiguration islandConfig = YamlConfiguration.loadConfiguration(islandData);
  4.         islandConfig.createSection("Stats");
  5.         islandConfig.set("Stats.OwnerID", player.getUniqueId());
  6.         islandConfig.set("Stats.Currency", 100);
  7.        
  8.        
  9.         boolean Place = false;
  10.        
  11.         while(!Place) {
  12.             Random r = new Random();
  13.             Dimension tempD = new Dimension(r.nextInt(100), r.nextInt(100));
  14.             if(TakenCoords.size() > 0) {
  15.                 for(Dimension d : TakenCoords) {
  16.                     if(!tempD.equals(d)) {
  17.                         Place = true;
  18.                         TakenCoords.add(tempD);
  19.                         break;
  20.                     }
  21.                 }
  22.             } else {
  23.                 Place = true;
  24.                 TakenCoords.add(tempD);
  25.             }
  26.            
  27.             if(Place) {
  28.                 islandConfig.set("Stats.Location", new Location(plugin.world, tempD.height, 60, tempD.width));
  29.             }
  30.         }
  31.        
  32.         islandData.mkdir();
  33.         player.teleport(islandConfig.getLocation("Stats.Location"));
  34.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement