mirror of
https://github.com/trainerlord/WorldSystem.git
synced 2025-03-01 03:21:32 +01:00
Worlds on all server statistics + WorldGenerator settings added to
config.yml
This commit is contained in:
parent
3ba7bf841f
commit
4934e1b68b
@ -41,6 +41,18 @@ lagsystem:
|
||||
garbagecollector:
|
||||
use: false
|
||||
period_in_minutes: 5
|
||||
|
||||
# Options for random world generation
|
||||
worldgeneration:
|
||||
# A seed for worldgeneration
|
||||
# Set it to 0 for no seed-useage
|
||||
seed: 0
|
||||
# Environment for the world
|
||||
# Valid inputs are 'NORMAL', 'NETHER' and 'THE_END'
|
||||
environment: NORMAL
|
||||
# Type of the world eg. flat, amplified, ...
|
||||
# Valid types are 'NORMAL', 'VERSION_1_1', 'FLAT', 'AMPLIFIED', 'CUSTOMIZED' or 'LARGE_BIOMES'
|
||||
type: NORMAL
|
||||
|
||||
# Location where you will be teleported when you leave you world
|
||||
spawn:
|
||||
|
@ -1,5 +1,5 @@
|
||||
name: WorldSystem
|
||||
version: 2.0.1
|
||||
version: 2.0.2
|
||||
author: Butzlabben
|
||||
main: de.butzlabben.world.WorldSystem
|
||||
|
||||
|
@ -41,6 +41,18 @@ lagsystem:
|
||||
garbagecollector:
|
||||
use: false
|
||||
period_in_minutes: 5
|
||||
|
||||
# Options for random world generation
|
||||
worldgeneration:
|
||||
# A seed for worldgeneration
|
||||
# Set it to 0 for no seed-useage
|
||||
seed: 0
|
||||
# Environment for the world
|
||||
# Valid inputs are 'NORMAL', 'NETHER' and 'THE_END'
|
||||
environment: NORMAL
|
||||
# Type of the world eg. flat, amplified, ...
|
||||
# Valid types are 'NORMAL', 'VERSION_1_1', 'FLAT', 'AMPLIFIED', 'CUSTOMIZED' or 'LARGE_BIOMES'
|
||||
type: NORMAL
|
||||
|
||||
# Location where you will be teleported when you leave you world
|
||||
spawn:
|
||||
|
@ -29,6 +29,7 @@ import de.butzlabben.world.command.WSToggleBuildCommand;
|
||||
import de.butzlabben.world.command.WSToggleGMCommand;
|
||||
import de.butzlabben.world.command.WSToggleTPCommand;
|
||||
import de.butzlabben.world.config.DependenceConfig;
|
||||
import de.butzlabben.world.config.Entry;
|
||||
import de.butzlabben.world.config.GuiConfig;
|
||||
import de.butzlabben.world.config.MessageConfig;
|
||||
import de.butzlabben.world.config.PluginConfig;
|
||||
@ -125,11 +126,12 @@ public class WorldSystem extends JavaPlugin {
|
||||
getCommand("ws delete").setExecutor(new WSDeleteCommand());
|
||||
|
||||
getCommand("ws gui").setExecutor(new GuiCommand());
|
||||
|
||||
|
||||
mainGUI = new WorldSystemGUI();
|
||||
|
||||
|
||||
System.setProperty("bstats.relocatecheck", "false");
|
||||
Metrics m = new Metrics(this);
|
||||
m.addCustomChart(new Metrics.SingleLineChart("worlds", Entry::entrys));
|
||||
m.getPluginData();
|
||||
|
||||
Bukkit.getConsoleSender().sendMessage(PluginConfig.getPrefix() + "Succesfully enabled WorldSystem v" + version);
|
||||
|
@ -0,0 +1,12 @@
|
||||
package de.butzlabben.world.command;
|
||||
|
||||
/**
|
||||
* @author Butzlabben
|
||||
* @since 01.05.2018
|
||||
*/
|
||||
public class TabCompleter {
|
||||
|
||||
private TabCompleter() {
|
||||
|
||||
}
|
||||
}
|
@ -12,6 +12,8 @@ import org.bukkit.Bukkit;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.World.Environment;
|
||||
import org.bukkit.WorldType;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
@ -36,6 +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.isLong("worldgeneration.seed") || cfg.isInt("worldgeneration.seed")) &&
|
||||
|
||||
cfg.isString("spawn.spawnpoint.world") && cfg.isInt("spawn.gamemode")
|
||||
&& (cfg.isDouble("spawn.spawnpoint.x") || cfg.isInt("spawn.spawnpoint.x"))
|
||||
@ -141,6 +146,34 @@ public class PluginConfig {
|
||||
return getLocation(cfg, "spawn.spawnpoint", Bukkit.getWorld(cfg.getString("spawn.spawnpoint.world", "world")));
|
||||
}
|
||||
|
||||
public static long getSeed() {
|
||||
return getConfig().getLong("worldgeneration.seed");
|
||||
}
|
||||
|
||||
public static Environment getEnvironment() {
|
||||
YamlConfiguration cfg = getConfig();
|
||||
String t = cfg.getString("worldgeneration.environment");
|
||||
Environment e = Environment.NORMAL;
|
||||
try {
|
||||
e = Environment.valueOf(t.toUpperCase());
|
||||
} catch (Exception ex) {
|
||||
System.out.println("'" + t + "' is not a valid environment");
|
||||
}
|
||||
return e;
|
||||
}
|
||||
|
||||
public static WorldType getWorldType() {
|
||||
YamlConfiguration cfg = getConfig();
|
||||
String t = cfg.getString("worldgeneration.type");
|
||||
WorldType wt = WorldType.NORMAL;
|
||||
try {
|
||||
wt = WorldType.valueOf(t.toUpperCase());
|
||||
} catch (Exception e) {
|
||||
System.out.println("'" + t + "' is not a valid worldtype");
|
||||
}
|
||||
return wt;
|
||||
}
|
||||
|
||||
public static int getRequestExpire() {
|
||||
return getConfig().getInt("request_expires", 20);
|
||||
}
|
||||
|
@ -2,6 +2,7 @@ package de.butzlabben.world.wrapper;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.bukkit.Bukkit;
|
||||
@ -33,6 +34,8 @@ public class SystemWorld {
|
||||
private World w;
|
||||
private String worldname;
|
||||
private boolean unloading = false;
|
||||
|
||||
private static HashMap<String, SystemWorld> cached = new HashMap<>();
|
||||
|
||||
/**
|
||||
* This method is the online way to get a system world instance
|
||||
@ -45,9 +48,13 @@ public class SystemWorld {
|
||||
*/
|
||||
public static SystemWorld getSystemWorld(String worldname) {
|
||||
Preconditions.checkNotNull(worldname, "worldname must not be null");
|
||||
if(cached.containsKey(worldname))
|
||||
return cached.get(worldname);
|
||||
SystemWorld sw = new SystemWorld(worldname);
|
||||
if (sw.exists())
|
||||
if(sw != null && sw.exists()) {
|
||||
cached.put(worldname, sw);
|
||||
return sw;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@ -201,6 +208,7 @@ public class SystemWorld {
|
||||
worldname = myName.toString();
|
||||
}
|
||||
// Teleport the Player
|
||||
|
||||
World worldinserver = Bukkit.createWorld(new WorldCreator(worldname));
|
||||
Bukkit.getServer().getWorlds().add(worldinserver);
|
||||
w = worldinserver;
|
||||
@ -251,8 +259,8 @@ public class SystemWorld {
|
||||
System.err.println("Couldn't create world for " + p.getName());
|
||||
e.printStackTrace();
|
||||
}
|
||||
WorldConfig2 wc = new WorldConfig2();
|
||||
wc.createConfig(p);
|
||||
WorldConfig2 wc2 = new WorldConfig2();
|
||||
wc2.createConfig(p);
|
||||
if (PluginConfig.getExampleWorldName() == null || PluginConfig.getExampleWorldName().equals("")
|
||||
|| !exampleworld.exists()) {
|
||||
// Move World into Server dir
|
||||
@ -275,7 +283,15 @@ public class SystemWorld {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
World worldinserver = Bukkit.createWorld(new WorldCreator(worldname));
|
||||
WorldCreator wc = new WorldCreator(worldname);
|
||||
System.out.println(PluginConfig.getEnvironment().name());
|
||||
wc.environment(PluginConfig.getEnvironment());
|
||||
System.out.println(PluginConfig.getWorldType().name());
|
||||
wc.type(PluginConfig.getWorldType());
|
||||
long seed = PluginConfig.getSeed();
|
||||
if(seed != 0)
|
||||
wc.seed(seed);
|
||||
World worldinserver = Bukkit.createWorld(wc);
|
||||
Bukkit.getServer().getWorlds().add(worldinserver);
|
||||
}
|
||||
return true;
|
||||
|
@ -1,5 +1,5 @@
|
||||
name: WorldSystem
|
||||
version: 2.0.1
|
||||
version: 2.0.2
|
||||
author: Butzlabben
|
||||
main: de.butzlabben.world.WorldSystem
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user