Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void CreateIsland(Player player) {
- File islandData = new File(plugin.islandData.getPath() + File.pathSeparator + player.getName() + ".yml");
- FileConfiguration islandConfig = YamlConfiguration.loadConfiguration(islandData);
- islandConfig.createSection("Stats");
- islandConfig.set("Stats.OwnerID", player.getUniqueId());
- islandConfig.set("Stats.Currency", 100);
- boolean Place = false;
- while(!Place) {
- Random r = new Random();
- Dimension tempD = new Dimension(r.nextInt(100), r.nextInt(100));
- if(TakenCoords.size() > 0) {
- for(Dimension d : TakenCoords) {
- if(!tempD.equals(d)) {
- Place = true;
- TakenCoords.add(tempD);
- break;
- }
- }
- } else {
- Place = true;
- TakenCoords.add(tempD);
- }
- if(Place) {
- islandConfig.set("Stats.Location", new Location(plugin.world, tempD.height, 60, tempD.width));
- }
- }
- islandData.mkdir();
- player.teleport(islandConfig.getLocation("Stats.Location"));
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement