mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2026-06-18 14:50:57 +00:00
/iris create now registers to bukkit.yml
This commit is contained in:
@@ -38,8 +38,11 @@ import org.bukkit.GameRule;
|
|||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import org.bukkit.WorldCreator;
|
import org.bukkit.WorldCreator;
|
||||||
|
import org.bukkit.configuration.ConfigurationSection;
|
||||||
|
import org.bukkit.configuration.file.YamlConfiguration;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
import java.io.IOException;
|
||||||
import java.util.concurrent.CompletableFuture;
|
import java.util.concurrent.CompletableFuture;
|
||||||
import java.util.concurrent.atomic.AtomicBoolean;
|
import java.util.concurrent.atomic.AtomicBoolean;
|
||||||
import java.util.concurrent.atomic.AtomicReference;
|
import java.util.concurrent.atomic.AtomicReference;
|
||||||
@@ -174,7 +177,8 @@ public class IrisCreator {
|
|||||||
world.get().setTime(6000);
|
world.get().setTime(6000);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
} else
|
||||||
|
addToBukkitYml();
|
||||||
|
|
||||||
if(pregen != null) {
|
if(pregen != null) {
|
||||||
CompletableFuture<Boolean> ff = new CompletableFuture<>();
|
CompletableFuture<Boolean> ff = new CompletableFuture<>();
|
||||||
@@ -204,7 +208,24 @@ public class IrisCreator {
|
|||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return world.get();
|
return world.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static final File BUKKIT_YML = new File(Bukkit.getServer().getWorldContainer(), "bukkit.yml");
|
||||||
|
|
||||||
|
private void addToBukkitYml() {
|
||||||
|
YamlConfiguration yml = YamlConfiguration.loadConfiguration(BUKKIT_YML);
|
||||||
|
String gen = "Iris:" + dimension;
|
||||||
|
ConfigurationSection section = yml.contains("worlds") ? yml.getConfigurationSection("worlds") : yml.createSection("worlds");
|
||||||
|
if(!section.contains(name)) {
|
||||||
|
section.createSection(name).set("generator", gen);
|
||||||
|
try {
|
||||||
|
yml.save(BUKKIT_YML);
|
||||||
|
Iris.info("Registered \"" + name + "\" in bukkit.yml");
|
||||||
|
} catch(IOException e) {
|
||||||
|
Iris.error("Failed to update bukkit.yml!");
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ name: ${name}
|
|||||||
version: ${version}
|
version: ${version}
|
||||||
main: ${main}
|
main: ${main}
|
||||||
load: STARTUP
|
load: STARTUP
|
||||||
authors: [ cyberpwn, NextdoorPsycho ]
|
authors: [ cyberpwn, NextdoorPsycho. Vatuu ]
|
||||||
website: volmit.com
|
website: volmit.com
|
||||||
description: More than a Dimension!
|
description: More than a Dimension!
|
||||||
libraries:
|
libraries:
|
||||||
@@ -22,4 +22,4 @@ commands:
|
|||||||
aliases: [ ir, irs ]
|
aliases: [ ir, irs ]
|
||||||
api-version: ${apiversion}
|
api-version: ${apiversion}
|
||||||
hotload-dependencies: false
|
hotload-dependencies: false
|
||||||
softdepend: [ "Oraxen", "ItemsAdder", "IrisFeller", "WorldEdit"]
|
softdepend: [ "Oraxen", "ItemsAdder", "IrisFeller", "WorldEdit", "PlaceholderAPI"]
|
||||||
Reference in New Issue
Block a user