mirror of
https://github.com/trainerlord/WorldSystem.git
synced 2025-03-01 03:21:32 +01:00
Fixed #2 and added generation setting and changed config defaults
This commit is contained in:
parent
3e9140be89
commit
ee8d79e159
@ -27,7 +27,15 @@ public class WSLeaveCommand implements CommandExecutor {
|
||||
}
|
||||
String worldname = p.getWorld().getName();
|
||||
WorldPlayer wp = new WorldPlayer(p, worldname);
|
||||
|
||||
if (wp.isOnSystemWorld()) {
|
||||
// Extra safety for #2
|
||||
if (PluginConfig.getSpawn().getWorld() == null) {
|
||||
Bukkit.getConsoleSender().sendMessage(PluginConfig.getPrefix() + "§cThe spawn is not properly set");
|
||||
cs.sendMessage(PluginConfig.getPrefix() + "§cThe spawn is not properly set");
|
||||
return true;
|
||||
}
|
||||
|
||||
p.teleport(PluginConfig.getSpawn());
|
||||
p.setGameMode(PluginConfig.getSpawnGamemode());
|
||||
World w = Bukkit.getWorld(p.getWorld().getName());
|
||||
|
@ -38,8 +38,9 @@ public class PluginConfig {
|
||||
cfg.isInt("lagsystem.period_in_seconds") && cfg.isInt("lagsystem.entities_per_world")
|
||||
&& cfg.isBoolean("lagsystem.garbagecollector.use")
|
||||
&& cfg.isInt("lagsystem.garbagecollector.period_in_minutes") &&
|
||||
|
||||
|
||||
cfg.isString("worldgeneration.type") && cfg.isString("worldgeneration.environment")
|
||||
&& cfg.isString("worldgeneration.generation")
|
||||
&& (cfg.isLong("worldgeneration.seed") || cfg.isInt("worldgeneration.seed")) &&
|
||||
|
||||
cfg.isString("spawn.spawnpoint.world") && cfg.isInt("spawn.gamemode")
|
||||
@ -54,7 +55,10 @@ public class PluginConfig {
|
||||
&& (cfg.isDouble("worldspawn.spawnpoint.y") || cfg.isInt("worldspawn.spawnpoint.y"))
|
||||
&& (cfg.isDouble("worldspawn.spawnpoint.z") || cfg.isInt("worldspawn.spawnpoint.z"))
|
||||
&& (cfg.isDouble("worldspawn.spawnpoint.yaw") || cfg.isInt("worldspawn.spawnpoint.yaw"))
|
||||
&& (cfg.isDouble("worldspawn.spawnpoint.pitch") || cfg.isInt("worldspawn.spawnpoint.pitch")))) {
|
||||
&& (cfg.isDouble("worldspawn.spawnpoint.pitch") || cfg.isInt("worldspawn.spawnpoint.pitch"))
|
||||
|
||||
//Should fix #2
|
||||
&& getSpawn().getWorld() != null)) {
|
||||
try {
|
||||
Files.copy(file.toPath(),
|
||||
new File(file.getParentFile(), "config-broken-"
|
||||
@ -162,6 +166,10 @@ public class PluginConfig {
|
||||
return e;
|
||||
}
|
||||
|
||||
public static String getGenerator() {
|
||||
return getConfig().getString("worldgeneration.generator");
|
||||
}
|
||||
|
||||
public static WorldType getWorldType() {
|
||||
YamlConfiguration cfg = getConfig();
|
||||
String t = cfg.getString("worldgeneration.type");
|
||||
@ -187,4 +195,5 @@ public class PluginConfig {
|
||||
public static boolean confirmNeed() {
|
||||
return getConfig().getBoolean("need_confirm", true);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -251,6 +251,9 @@ public class SystemWorld {
|
||||
creator.seed(seed);
|
||||
creator.type(type);
|
||||
creator.environment(env);
|
||||
String generator = PluginConfig.getGenerator();
|
||||
if(!generator.trim().isEmpty())
|
||||
creator.generator(generator);
|
||||
|
||||
WorldCreateEvent event = new WorldCreateEvent(p, creator);
|
||||
Bukkit.getPluginManager().callEvent(event);
|
||||
|
Loading…
Reference in New Issue
Block a user