Compare commits

...

7 Commits

Author SHA1 Message Date
Daniel 2c9f8dd51a Added Config Getters
because the tests wont run cause the plugin is complaining
2022-09-16 18:56:03 -04:00
Daniel f8126979f1 Merge remote-tracking branch 'origin/master' 2022-09-16 17:55:42 -04:00
Daniel b9f54ca6ed Created new ConfigSystem
Note this Config Merges Settings & Config together to prevent people getting confused *Mostly Me*
2022-09-16 17:55:34 -04:00
Daniel caf5521f9a Created new ConfigSystem
Note this Config Merges Settings & Config together to prevent people getting confused
2022-09-16 17:55:18 -04:00
trainerlord 6f922651da
Delete src\TestFiles\ExistingPopulatedFileInit.json 2022-09-16 16:09:04 -04:00
Daniel 2905e4fb1f Added Comments to the New Tests and Object Files 2022-09-16 12:41:42 -04:00
Daniel 6db97df7b8 Added Tests For the data objects
Along with fixing some bugs in them Woo!
2022-09-16 12:28:17 -04:00
129 changed files with 972 additions and 688 deletions

0
TestFiles/TestConfig.yml Normal file
View File

View File

@ -0,0 +1 @@
{"players":{}}

View File

@ -30,12 +30,13 @@ import java.io.IOException;
public class WorldSystem extends JavaPlugin {
private static boolean is1_13Plus = false;
final private String version = this.getDescription().getVersion();
private static File configFile;
private CreatorAdapter creator;
public static void createConfigs() {
File folder = getInstance().getDataFolder();
File dir = new File(folder + "/worldsources");
File config = new File(folder, "config.yml");
configFile = new File(folder, "config.yml");
File dconfig = new File(folder, "dependence.yml");
File languages = new File(folder + "/languages");
File gui = new File(folder, "gui.yml");
@ -213,4 +214,6 @@ public class WorldSystem extends JavaPlugin {
return creator;
}
public static File getConfigFile() { return configFile; }
}

View File

@ -1,53 +0,0 @@
package de.butzlabben.world.autoupdater;
import java.io.FileOutputStream;
import java.io.IOException;
import java.net.URL;
import java.nio.channels.Channels;
import java.nio.channels.FileChannel;
import java.nio.channels.ReadableByteChannel;
/**
* @author Butzlabben
* @since 02.05.2018
*/
public class AutoUpdate implements Runnable {
private final UpdateInformations ui;
private final String jar;
protected AutoUpdate(UpdateInformations ui, String jar) {
this.ui = ui;
this.jar = jar;
}
@Override
public void run() {
FileChannel out = null;
FileOutputStream outStream = null;
try {
ReadableByteChannel in = Channels
.newChannel(new URL(ui.getURL()).openStream());
outStream = new FileOutputStream(jar);
out = outStream.getChannel();
out.transferFrom(in, 0, Long.MAX_VALUE);
} catch (Exception e) {
e.printStackTrace();
} finally {
if (out != null)
try {
out.close();
} catch (IOException e) {
e.printStackTrace();
}
if (outStream != null) {
try {
outStream.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
}
}

View File

@ -1,126 +0,0 @@
package de.butzlabben.world.autoupdater;
import de.butzlabben.world.config.PluginConfig;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.HandlerList;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.java.JavaPlugin;
import java.io.File;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
/**
* @author Butzlabben
* @since 01.05.2018
*/
public class AutoUpdater implements Listener {
private static AutoUpdater instance;
private boolean confirmed;
private boolean confirmNeed;
private AutoUpdate au;
private AutoUpdater() {
confirmNeed = PluginConfig.confirmNeed();
UpdateInformations ui = UpdateInformations.getInformations();
if (ui == null) {
Bukkit.getConsoleSender().sendMessage(PluginConfig.getPrefix() + "§cCouldn't contact autoupdate server");
return;
}
Plugin plugin = Bukkit.getPluginManager().getPlugin(ui.getPlugin());
if (plugin == null)
return;
String v = plugin.getDescription().getVersion();
if (!ui.getVersion().equals(plugin.getDescription().getVersion())) {
if (!ui.isSilent()) {
Bukkit.getConsoleSender().sendMessage(PluginConfig.getPrefix() + "Found new version. Current: " + v
+ ", Available: " + ui.getVersion());
}
// Get jar file
Method getFileMethod;
try {
getFileMethod = JavaPlugin.class.getDeclaredMethod("getFile");
} catch (NoSuchMethodException | SecurityException e1) {
e1.printStackTrace();
return;
}
getFileMethod.setAccessible(true);
File file;
try {
file = (File) getFileMethod.invoke(plugin);
} catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) {
e.printStackTrace();
return;
}
getFileMethod.setAccessible(false);
String jar = file.getAbsolutePath();
au = new AutoUpdate(ui, jar);
if (ui.isSilent() || !confirmNeed) {
Runtime.getRuntime().addShutdownHook(new Thread(au));
if (!ui.isSilent())
Bukkit.getConsoleSender().sendMessage(
PluginConfig.getPrefix() + "§aAutoupdate confirmed, §crestart §ato apply changes");
confirmed = true;
} else {
Bukkit.getPluginManager().registerEvents(this, plugin);
for (Player p : Bukkit.getOnlinePlayers()) {
p.sendMessage(
PluginConfig.getPrefix() + "§aFound new update. Confirm autoupdate with §c/ws confirm");
p.sendMessage(PluginConfig.getPrefix() + "§aRead changelogs: https://www.spigotmc.org/resources/49756/updates");
}
Bukkit.getConsoleSender().sendMessage(
PluginConfig.getPrefix() + "§aFound new update. Confirm autoupdate with §c/ws confirm");
Bukkit.getConsoleSender().sendMessage(PluginConfig.getPrefix() + "§aRead changelogs: https://www.spigotmc.org/resources/49756/updates");
}
} else {
confirmNeed = false;
}
}
public static void startAsync() {
Thread t = new Thread(() -> {
getInstance();
});
t.setName("update-thread-worldsystem");
t.start();
}
public static synchronized AutoUpdater getInstance() {
if (instance == null)
instance = new AutoUpdater();
return instance;
}
@EventHandler
public void on(PlayerJoinEvent e) {
if (e.getPlayer().hasPermission("ws.confirm")) {
e.getPlayer().sendMessage(
PluginConfig.getPrefix() + "§aFound new update. Confirm autoupdate with §c/ws confirm");
e.getPlayer().sendMessage(PluginConfig.getPrefix() + "§aRead changelogs: https://www.spigotmc.org/resources/49756/updates");
}
}
public boolean confirm() {
if (confirmNeed && !confirmed) {
Runtime.getRuntime().addShutdownHook(new Thread(au));
confirmed = true;
HandlerList.unregisterAll(this);
return true;
}
return false;
}
public boolean confirmed() {
return confirmed;
}
}

View File

@ -1,83 +0,0 @@
package de.butzlabben.world.autoupdater;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import de.butzlabben.WorldSystem;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.URL;
import java.net.URLConnection;
import java.nio.charset.Charset;
/**
* @author Butzlabben
* @since 02.05.2018
*/
public class UpdateInformations {
private final String version, url, plugin;
private final boolean silent;
public UpdateInformations(String version, String url, String plugin, boolean silent) {
this.version = version;
this.url = url;
this.plugin = plugin;
this.silent = silent;
}
protected static synchronized UpdateInformations getInformations() {
String json = callURL("https://zendilu.net/butzlabben/worldsystem/info.php?version=" + WorldSystem.getInstance().getDescription().getVersion());
Gson gson = new GsonBuilder().create();
return gson.fromJson(json, UpdateInformations.class);
}
public static String callURL(String URL) {
StringBuilder sb = new StringBuilder();
URLConnection urlConn;
InputStreamReader in = null;
try {
URL url = new URL(URL);
urlConn = url.openConnection();
urlConn.setRequestProperty("User-Agent", "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.4; en-US; rv:1.9.2.2) Gecko/20100316 Firefox/3.6.2");
if (urlConn != null)
urlConn.setReadTimeout(60 * 1000);
if (urlConn != null && urlConn.getInputStream() != null) {
in = new InputStreamReader(urlConn.getInputStream(), Charset.defaultCharset());
BufferedReader bufferedReader = new BufferedReader(in);
if (bufferedReader != null) {
int cp;
while ((cp = bufferedReader.read()) != -1) {
sb.append((char) cp);
}
bufferedReader.close();
}
}
in.close();
} catch (Exception e) {
e.printStackTrace();
}
return sb.toString();
}
public String getVersion() {
return version;
}
public String getURL() {
return url;
}
public String getPlugin() {
return plugin;
}
public boolean isSilent() {
return silent;
}
}

View File

@ -28,12 +28,6 @@ public class CommandRegistry implements CommandExecutor {
return ws.getCommand(sender, command, label, args);
case "gui":
return ws.guiCommand(sender, command, label, args);
case "confirm":
if (sender.hasPermission("ws.confirm")) {
return ws.confirmCommand(sender, command, label, args);
} else {
return false;
}
case "home":
return ws.homeCommand(sender, command, label, args);
case "info":

View File

@ -1,7 +1,6 @@
package de.butzlabben.world.command.commands;
import de.butzlabben.WorldSystem;
import de.butzlabben.world.autoupdater.AutoUpdater;
import de.butzlabben.world.config.DependenceConfig;
import de.butzlabben.world.config.MessageConfig;
import de.butzlabben.world.config.PluginConfig;
@ -58,18 +57,6 @@ public class WSCommands {
}
}
public boolean confirmCommand(CommandSender sender, Command command, String label, String[] args) {
CommandSender cs = sender;
if (AutoUpdater.getInstance().confirmed()) {
cs.sendMessage(PluginConfig.getPrefix() + "§cAlready confirmed or no confirm needed");
return false;
}
AutoUpdater.getInstance().confirm();
cs.sendMessage(PluginConfig.getPrefix() + "§aAutoupdate confirmed, §crestart §ato apply changes");
return true;
}
public boolean getCommand(CommandSender sender, Command command, String label, String[] args) {
if (sender instanceof Player) {

View File

@ -1,6 +1,7 @@
package de.butzlabben.world.config;
import de.butzlabben.WorldSystem;
import de.butzlabben.world.exceptions.InvalidConfigFormatException;
import de.butzlabben.world.util.PlayerPositions;
import net.md_5.bungee.api.ChatColor;
import org.bukkit.Bukkit;
@ -20,86 +21,174 @@ import java.util.Date;
public class PluginConfig {
private final static GameMode[] gameModes = new GameMode[]{GameMode.SURVIVAL, GameMode.CREATIVE,
GameMode.ADVENTURE, GameMode.SPECTATOR};
private static File file;
//New Config
private YamlConfiguration config;
private File configFile;
private PluginConfig() {
}
public static void checkConfig(File f) {
file = f;
if (file.exists()) {
YamlConfiguration cfg = getConfig();
if (!(cfg.isString("worldfolder") && cfg.isInt("unloadingtime")
&& cfg.isBoolean("survival") && cfg.isString("language") && cfg.isString("prefix")
&& cfg.isInt("request_expires") && cfg.isBoolean("need_confirm")
&& cfg.isBoolean("contact_authserver") && cfg.isBoolean("spawn_teleportation")
&& cfg.isInt("delete_after") && cfg.isBoolean("worldtemplates.multi_choose")
&& cfg.isString("worldtemplates.default") && cfg.isBoolean("load_worlds_async") &&
// Database stuff
cfg.isString("database.type") && cfg.isString("database.worlds_table_name") && cfg.isString("database.players_table_name")
&& cfg.isString("database.mysql_settings.host") && cfg.isInt("database.mysql_settings.port")
&& cfg.isString("database.mysql_settings.username") && cfg.isString("database.mysql_settings.password")
&& cfg.isString("database.mysql_settings.database") && cfg.isString("database.sqlite_settings.file") &&
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("spawn.spawnpoint.world") && cfg.isInt("spawn.gamemode")
&& cfg.isBoolean("spawn.spawnpoint.use_last_location")
&& (cfg.isDouble("spawn.spawnpoint.x") || cfg.isInt("spawn.spawnpoint.x"))
&& (cfg.isDouble("spawn.spawnpoint.y") || cfg.isInt("spawn.spawnpoint.y"))
&& (cfg.isDouble("spawn.spawnpoint.z") || cfg.isInt("spawn.spawnpoint.z"))
&& (cfg.isDouble("spawn.spawnpoint.yaw") || cfg.isInt("spawn.spawnpoint.yaw"))
&& (cfg.isDouble("spawn.spawnpoint.pitch") || cfg.isInt("spawn.spawnpoint.pitch")) &&
cfg.isBoolean("worldspawn.use") && cfg.isBoolean("worldspawn.use_last_location")
&& (cfg.isDouble("worldspawn.spawnpoint.x") || cfg.isInt("worldspawn.spawnpoint.x"))
&& (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")))) {
try {
Files.copy(file.toPath(),
new File(file.getParentFile(), "config-broken-"
+ new SimpleDateFormat("dd-MM-yyyy-HH-mm-ss").format(new Date()) + ".yml").toPath(),
StandardCopyOption.REPLACE_EXISTING);
Files.delete(file.toPath());
System.err.println("[WorldSystem] Config is broken, creating a new one!");
checkConfig(f);
} catch (IOException e) {
e.printStackTrace();
}
}
} else {
try {
InputStream in = JavaPlugin.getPlugin(WorldSystem.class).getResource("config.yml");
Files.copy(in, file.toPath());
} catch (IOException e) {
System.err.println("Wasn't able to create Config");
e.printStackTrace();
}
}
// Should fix #2
if (getSpawn(null).getWorld() == null) {
Bukkit.getConsoleSender().sendMessage(getPrefix() + "§cWorld is null in spawn.world!");
}
}
public static YamlConfiguration getConfig() {
//TODO Document
public PluginConfig(File configFile) throws FileNotFoundException {
this.configFile = configFile;
try {
return YamlConfiguration
.loadConfiguration(new InputStreamReader(new FileInputStream(file), StandardCharsets.UTF_8));
config = YamlConfiguration.loadConfiguration(
new InputStreamReader(new FileInputStream(configFile), StandardCharsets.UTF_8));
} catch (FileNotFoundException e) {
e.printStackTrace();
throw new FileNotFoundException("Cannot access config file");
}
throw new IllegalStateException("Cannot access config file");
try {
verifyConfigFormating();
} catch (InvalidConfigFormatException e) {
try {
Files.copy(configFile.toPath(),
new File(configFile.getParentFile(), "config-broken-"
+ new SimpleDateFormat("dd-MM-yyyy-HH-mm-ss").format(new Date()) + ".yml").toPath(),
StandardCopyOption.REPLACE_EXISTING);
Files.delete(configFile.toPath());
System.err.println("[WorldSystem] Config is broken, creating a new one!");
} catch (IOException ex) {
//Somthing Really Bad Happened
//TODO Log it
ex.printStackTrace();
}
try {
verifyConfigFormating();
} catch (InvalidConfigFormatException ex) {
//Should Never Run
throw new RuntimeException(ex);
}
}
}
private void verifyConfigFormating() throws InvalidConfigFormatException {
//Verify General
if (!(config.isString("playerWorldsDir") &&
config.isInt("unloadTime") &&
config.isString("prefix") &&
config.isInt("deleteAfterDays") &&
config.isString("worldDifficulty"))) {
throw new InvalidConfigFormatException("Invaild Config Format in General Settings");
}
//Verify World Creation Settings
if (!(config.isBoolean("multiChoose") &&
config.isString("defaultGenerator") &&
config.isString("worldGenTemplates") &&
config.isInt("worldBorderDefaultSize") &&
config.isInt("worldBorderCenter.x") &&
config.isInt("worldBorderCenter.z")
)) {
throw new InvalidConfigFormatException("Invaild Config Format in World Creation Settings");
}
if (!(config.isString("serverSpawn.serverGamemode") &&
config.isString("serverSpawn.serverSpawnPoint.worldName") &&
config.isInt("serverSpawn.serverSpawnPoint.x") &&
config.isInt("serverSpawn.serverSpawnPoint.y") &&
config.isInt("serverSpawn.serverSpawnPoint.z") &&
config.isString("wsWorldSpawn.worldGameMode") &&
config.isBoolean("wsWorldSpawn.useLastLocation") &&
config.isString("wsWorldSpawn.defaultWorldSpawnPoint.worldName") &&
config.isInt("wsWorldSpawn.defaultWorldSpawnPoint.x") &&
config.isInt("wsWorldSpawn.defaultWorldSpawnPoint.y") &&
config.isInt("wsWorldSpawn.defaultWorldSpawnPoint.z"))) {
throw new InvalidConfigFormatException("Invaild Config Format in World Entering/Exiting");
}
if (!(config.isBoolean("announceAdvancements") &&
config.isBoolean("commandBlockOutput") &&
config.isBoolean("disableElytraMovementCheck") &&
config.isBoolean("doDaylightCycle") &&
config.isBoolean("doEntityDrops") &&
config.isBoolean("doFireTick") &&
config.isBoolean("doLimitedCrafting") &&
config.isBoolean("doMobLoot") &&
config.isBoolean("doMobSpawning") &&
config.isBoolean("doTileDrops") &&
config.isBoolean("doWeatherCycle") &&
config.isBoolean("gameLoopFunction") &&
config.isBoolean("keepInventory") &&
config.isBoolean("logAdminCommands") &&
config.isInt("maxCommandChainLength") &&
config.isInt("maxEntityCramming") &&
config.isBoolean("mobGriefing") &&
config.isBoolean("naturalRegeneration") &&
config.isInt("randomTickSpeed") &&
config.isBoolean("reducedDebugInfo") &&
config.isBoolean("sendCommandFeedback") &&
config.isBoolean("showDeathMessages") &&
config.isInt("spawnRadius") &&
config.isBoolean("spectatorsGenerateChunks"))) {
throw new InvalidConfigFormatException("Invaild Config Format in Gamerules ");
}
}
public String getWorldDir() {
return config.getString("playerWorldsDir", "plugins/WorldSystem/Worlds") + "/";
}
public boolean useWorldSpawn() {
return config.getBoolean("wsWorldSpawn.useLastLocation", true);
}
public GameMode getWorldSystemGamemode() {
return stringToGamemode(config.getString("wsWorldSpawn.worldGameMode", "Survival"));
}
public GameMode getServerGamemode() {
return stringToGamemode(config.getString("serverSpawn.serverGamemode", "Survival"));
}
public int getUnloadingTime() {
return config.getInt("unloadTime", 20);
}
public boolean isMultiChoose() {
return config.getBoolean("multiChoose", false);
}
public String getDefaultWorldGenerator() {
return config.getString("defaultGenerator", "Vanilla");
}
public String getLanguage() {
return config.getString("language", "en");
}
public String getPrefix() {
return ChatColor.translateAlternateColorCodes('&', config.getString("prefix", "§8[§3WorldSystem§8] §6"));
}
public Location getWorldSpawn(World w) {
return getLocation(config, "wsWorldSpawn.defaultWorldSpawnPoint", w);
}
public Location getSpawn(Player player) {
Location location = getLocation(config, "wsWorldSpawn.defaultWorldSpawnPoint", Bukkit.getWorld(config.getString("wsWorldSpawn.defaultWorldSpawnPoint.worldName", "world")));
//TODO Player Positions with PlayerWorldData;
return PlayerPositions.instance.injectPlayersLocation(player, location);
}
private GameMode stringToGamemode(String gamemode) {
switch (gamemode.toLowerCase()) {
case "Creative":
return GameMode.CREATIVE;
case "Adventure":
return GameMode.ADVENTURE;
default:
return GameMode.SURVIVAL;
}
}
private static Location getLocation(YamlConfiguration cfg, String path, World world) {
return new Location(world, cfg.getDouble(path + ".x", 0), cfg.getDouble(path + ".y", 20),
cfg.getDouble(path + ".z", 0));
}
/*
public static int getGCPeriod() {
return getConfig().getInt("lagsystem.garbagecollector.period_in_minutes", 5);
}
@ -116,45 +205,7 @@ public class PluginConfig {
return getConfig().getInt("lagsystem.period_in_seconds", 10);
}
public static boolean useWorldSpawn() {
return getConfig().getBoolean("worldspawn.use", true);
}
public static boolean isSurvival() {
return getConfig().getBoolean("survival", false);
}
public static int getUnloadingTime() {
return getConfig().getInt("unloadingtime", 20);
}
public static GameMode getSpawnGamemode() {
return gameModes[getConfig().getInt("spawn.gamemode", 2)];
}
public static String getWorlddir() {
return getConfig().getString("worldfolder", "plugins/WorldSystem/Worlds") + "/";
}
public static boolean isMultiChoose() {
return getConfig().getBoolean("worldtemplates.multi_choose", false);
}
public static String getDefaultWorldTemplate() {
return getConfig().getString("worldtemplates.default", "");
}
public static String getLanguage() {
return getConfig().getString("language", "en");
}
public static String getPrefix() {
return ChatColor.translateAlternateColorCodes('&', getConfig().getString("prefix", "§8[§3WorldSystem§8] §6"));
}
public static Location getWorldSpawn(World w) {
return getLocation(getConfig(), "worldspawn.spawnpoint", w);
}
/////////////////////////////////////
public static Location getSpawn(Player player) {
YamlConfiguration cfg = getConfig();
@ -166,12 +217,6 @@ public class PluginConfig {
return getConfig().getInt("request_expires", 20);
}
private static Location getLocation(YamlConfiguration cfg, String path, World world) {
return new Location(world, cfg.getDouble(path + ".x", 0), cfg.getDouble(path + ".y", 20),
cfg.getDouble(path + ".z", 0), (float) cfg.getDouble(path + ".yaw", 0),
(float) cfg.getDouble(path + ".pitch", 0));
}
public static boolean confirmNeed() {
return getConfig().getBoolean("need_confirm", true);
}
@ -244,5 +289,5 @@ public class PluginConfig {
public static boolean loadWorldsASync() {
return getConfig().getBoolean("load_worlds_async");
}
}*/
}

View File

@ -6,21 +6,36 @@ import java.util.List;
public class PlayerData {
//TODO Write Tests
public List<PlayerWorld> playerWorlds;
private List<PlayerWorld> playerWorlds;
/**
* Inits a new Player Object
*/
public PlayerData() {
playerWorlds = new ArrayList<PlayerWorld>();
}
/**
* adds a world to the playerWorlds Array
* @param world the world data object to be added
*/
public void addWorld(PlayerWorld world) {
playerWorlds.add(world);
}
/**
* gets the current count of worlds that the player owns
* @return
*/
public int getWorldCount() {
return playerWorlds.size();
}
/**
* returns the world at a certain index
* @param index index of the world you want
* @return the World Data Object
*/
public PlayerWorld getWorldAt(int index) {
return playerWorlds.get(index);
}

View File

@ -1,11 +1,25 @@
package de.butzlabben.world.data.objects;
public class PlayerWorld {
public int worldNumber;
public long lastLoaded;
private int worldNumber;
private long lastLoaded;
public PlayerWorld(String OWNER, String OWNERname, int worldNumber) {
/**
* Creates an new Player World Data Structure if the worldNumber given
* @param worldNumber the index of the world held by the player
*/
public PlayerWorld(int worldNumber) {
this.worldNumber = worldNumber;
this.lastLoaded = 0;
this.lastLoaded = -1;
}
/**
* gets the world player index
* (player index = the index of the world in the player's
* world array)
* @return the world number
*/
public int getWorldNumber() {
return worldNumber;
}
}

View File

@ -13,10 +13,21 @@ import java.util.Map;
public class WorldSystemData {
public Map<String, PlayerData> players;
/**
* Creates the WorldSystemData objects
* and creates a blank map to hold player data
* with the uuid is the key
*/
public WorldSystemData() {
players = new HashMap<String, PlayerData>();
}
/**
* Adds a Player to the data record
* @param uuid the UUID of the player to be added
* @return returns whether the player was added successfully or not
*/
public Boolean addplayer(String uuid) {
if (players.get(uuid) == null) {
players.put(uuid, new PlayerData());
@ -25,16 +36,34 @@ public class WorldSystemData {
return false;
}
/**
* adds a world Object to the player specified
* @param uuid the UUID of the player
* @param world the World Object to be added
*/
public void addWorldToPlayer(String uuid, PlayerWorld world) {
if (players.get(uuid) != null) {
players.get(uuid).addWorld(world);
}
}
/**
* Gets the Amount of playerdata stored by WorldSystem
* @return player count
*/
public int getPlayers() {
return players.size();
}
/**
* returns the player data of the specifed uuid
* @param uuid the UUID of the player you want
* @return returns the player data object
*/
public PlayerData getPlayer(String uuid) {
return players.get(uuid);
}
}

View File

@ -0,0 +1,8 @@
package de.butzlabben.world.exceptions;
public class InvalidConfigFormatException extends Exception {
public InvalidConfigFormatException(String message) {
super(message);
}
}

View File

@ -1,6 +1,7 @@
package de.butzlabben.world.wrapper;
import com.google.common.base.Preconditions;
import de.butzlabben.WorldSystem;
import de.butzlabben.world.config.PluginConfig;
import de.butzlabben.world.config.WorldConfig;
import org.bukkit.Bukkit;
@ -9,6 +10,7 @@ import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.entity.Player;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
/**
@ -176,7 +178,11 @@ public class WorldPlayer {
public boolean isOnSystemWorld() {
File worldconfig = new File(Bukkit.getWorldContainer(), worldname + "/worldconfig.yml");
if (!worldconfig.exists()) {
worldconfig = new File(PluginConfig.getWorlddir() + worldname + "/worldconfig.yml");
try {
worldconfig = new File(new PluginConfig(WorldSystem.getConfigFile()).getWorlddir() + worldname + "/worldconfig.yml");
} catch (FileNotFoundException e) {
throw new RuntimeException(e);
}
}
if (worldconfig.exists()) {
YamlConfiguration cfg = YamlConfiguration.loadConfiguration(worldconfig);

View File

@ -279,7 +279,7 @@ worldchoose:
rows: 4
# The key must be named exactly as in the config.yml
# The key must be named exactly as in the configOLD.yml
template_default:
enabled: true
slot:

View File

@ -279,7 +279,7 @@ worldchoose:
rows: 4
# The key must be named exactly as in the config.yml
# The key must be named exactly as in the configOLD.yml
template_default:
enabled: true
slot:

View File

@ -1,133 +1,123 @@
# Path where the worlds will be saved
worldfolder: 'plugins/WorldSystem/Worlds'
worldtemplates:
# Whether players can decide on different templates
multi_choose: false
# If multi_choose is disabled, which template should be choosen
default: 'template_default'
templates:
# The "1" can be any key
1:
# Name of directory in plugins/WorldSystem/worldsources
# e.g. this would be plugins/WorldSystem/worldsources/template_default
name: 'template_default'
# Just remove the permission field if everybody should be able to use this template
2:
name: 'another_template'
# Only players with this exact permission can use and see this template
# ws.* will not work with this
permission: ws.template.another_template
# If this config option is given, 100 is needed to create a world
# This amount will then with withdrawn from the player
cost: 100
# Options for random world generation
# Here you can configure the world generator of a template
generator:
# 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
# Put in here the name of a generator
# If you have one from one plugin
generator: ''
# If a confirm is needed before auto-update
need_confirm: true
# When nobody is on a world time until it get unloaded
unloadingtime: 20
# If true nobody can teleport or change their gamemode a WorldSystem world
# Except for players with the permissions: ws.gamemode | ws.tp.*
survival: false
# If WorldSystem should load the worlds async if possible (FAWE installed)
load_worlds_async: true
# Options for the database saving player positions
database:
# Which type should be choosen:
# 'mysql' or 'sqlite'
# You need a working mysql database in order to use this option
type: sqlite
# How the table with the saved player positions on the playerworlds should be named
worlds_table_name: worlds_positions
# How the table with the saved player positions on the normal worlds should be named
players_table_name: player_positions
# how should the uuid cache be stored
players_uuids: players_uuids
# Configure here your mysql connection
mysql_settings:
host: 127.0.0.1
port: 3306
username: root
password: YOUR_PASSWORD_HERE
database: database
sqlite_settings:
# Where the database file should be located
file: 'plugins/WorldSystem/repository.db'
# If true players will teleported to the spawn on join
spawn_teleportation: true
# Time in seconds until a request expires
request_expires: 20
# Name of the languagefile in plugins/WorldSystem/languages/
language: en
# Prefix which will be shown before each message
prefix: '&8[&3WorldSystem&8] &6'
# Time in days after a not used world will be deleted
# Set to -1 to disable
delete_after: -1
# Whether WorldSystem should contact the Mojang authserver
# If not, some unknown playernames will not be displayed
# eg. in the gui or in /ws info
contact_authserver: true
# Options for the LagSystem:
# period_in_seconds - how often will be checked for entities in seconds
# entities_per_world - maximal allowed entities per world
# garbagecollector - how often will be unused ram be cleared
lagsystem:
period_in_seconds: 10
entities_per_world: 350
garbagecollector:
use: false
period_in_minutes: 5
# Location where you will be teleported when you leave you world
spawn:
gamemode: 2
spawnpoint:
use_last_location: true
world: world
x: 0
y: 20
z: 0
yaw: 0
pitch: 0
# Location where you spawn when you join a world
worldspawn:
use_last_location: true
use: false
spawnpoint:
x: 0
y: 20
z: 0
yaw: 0
pitch: 0
##########################################################################
### __ __ __ _______ __ ###
### \ \ / / / / / / ___/ / / ###
### \ \ __ / /___ ___/ /___/ / /____ ______/ /______________ ###
### \ \ / \ / / __ \/ _/ / __ /__ / / / / __/ __/ ___/ _ _ / ###
### \ \/ /\ \/ / /_/ / // / /_/ /__/ / /_/ /_ / /_/ ___/ // // / ###
### \__/ \__/\____/_//_/\__,_/____/\__, /___/\__/\___/_//_//_/ ###
### ___/ / ###
### \___/ ###
##########################################################################
####################
# General Settings #
####################
# The Language to plugin should run in
language: "en"
#The Path that the Worlds of players will be stored when not in use.
playerWorldsDir: 'plugins/WorldSystem/Worlds'
#The time that a world should take till it unloads from no use
unloadTime: 20
#Prefix on Messages sent by the plugin
prefix: '&8[&3WorldSystem&8] &6'
#Delete the world after set amount of days
#-1 to disable
deleteAfterDays: -1
#World Difficulty
#Options: PEACEFUL, EASY, NORMAL, HARD
worldDifficulty: 'EASY'
##########################
# World Creation Setting #
##########################
#Allow Players to Choose the Template they want
multiChoose: false
#The Default Generation File
#Warning: "do not add the .json"
defaultGenerator: 'Vanilla'
#World Generation Folder
worldGenTemplates: 'plugins/WorldSystem/Generators'
#World Borders
#The Default World Border Size for everyone
worldBorderDefaultSize: 500
#!Note: Dynamic World Borders Will Added back in a Future Update
#World Border Center
worldBorderCenter:
x: 0
z: 0
##########################
# World Entering/Exiting #
##########################
#This is the Settings you need to adjust to your server
serverSpawn:
#The Gamemode the Main server uses
#Options: Survival, Creative, Adventure
#Warning: Spectator is not a Valid Input
#Warning: Spelling Matters, Capitalization Does not
serverGamemode: 'Survival'
#The point the player should be placed when leaving a WS World
serverSpawnPoint:
worldName: 'world'
x: 0
y: 60
z: 0
#This is the Settings you need to adjust to your server
wsWorldSpawn:
#The Gamemode the Main server uses
#World Gamemode
#Options: Survival, Creative, Adventure
#Warning: Spectator is not a Valid Input
#Warning: Spelling Matters, Capitalization Does not
worldGameMode: 'Survival'
# places the player at their last known location in the world
useLastLocation: false;
#The point the player should be placed when entering a WS World
#for the first Time
defaultWorldSpawnPoint:
worldName: 'world'
x: 0
y: 60
z: 0
###################
# World Gamerules #
###################
#!DevTODO create a class to handle this to make it cleaner
#Also Document this part of the config
announceAdvancements: true
commandBlockOutput: false
disableElytraMovementCheck: false
doDaylightCycle: true
doEntityDrops: true
doFireTick: true
doLimitedCrafting: false
doMobLoot: true
doMobSpawning: true
doTileDrops: true
doWeatherCycle: false
gameLoopFunction: false
keepInventory: true
logAdminCommands: true
maxCommandChainLength: 65536
maxEntityCramming: 24
mobGriefing: true
naturalRegeneration: true
randomTickSpeed: 3
reducedDebugInfo: false
sendCommandFeedback: true
showDeathMessages: true
spawnRadius: 10
spectatorsGenerateChunks: true

View File

@ -0,0 +1,133 @@
# Path where the worlds will be saved
worldfolder: 'plugins/WorldSystem/Worlds'
worldtemplates:
# Whether players can decide on different templates
multi_choose: false
# If multi_choose is disabled, which template should be choosen
default: 'template_default'
templates:
# The "1" can be any key
1:
# Name of directory in plugins/WorldSystem/worldsources
# e.g. this would be plugins/WorldSystem/worldsources/template_default
name: 'template_default'
# Just remove the permission field if everybody should be able to use this template
2:
name: 'another_template'
# Only players with this exact permission can use and see this template
# ws.* will not work with this
permission: ws.template.another_template
# If this config option is given, 100 is needed to create a world
# This amount will then with withdrawn from the player
cost: 100
# Options for random world generation
# Here you can configure the world generator of a template
generator:
# 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
# Put in here the name of a generator
# If you have one from one plugin
generator: ''
# If a confirm is needed before auto-update
need_confirm: true
# When nobody is on a world time until it get unloaded
unloadingtime: 20
# If true nobody can teleport or change their gamemode a WorldSystem world
# Except for players with the permissions: ws.gamemode | ws.tp.*
survival: false
# If WorldSystem should load the worlds async if possible (FAWE installed)
load_worlds_async: true
# Options for the database saving player positions
database:
# Which type should be choosen:
# 'mysql' or 'sqlite'
# You need a working mysql database in order to use this option
type: sqlite
# How the table with the saved player positions on the playerworlds should be named
worlds_table_name: worlds_positions
# How the table with the saved player positions on the normal worlds should be named
players_table_name: player_positions
# how should the uuid cache be stored
players_uuids: players_uuids
# Configure here your mysql connection
mysql_settings:
host: 127.0.0.1
port: 3306
username: root
password: YOUR_PASSWORD_HERE
database: database
sqlite_settings:
# Where the database file should be located
file: 'plugins/WorldSystem/repository.db'
# If true players will teleported to the spawn on join
spawn_teleportation: true
# Time in seconds until a request expires
request_expires: 20
# Name of the languagefile in plugins/WorldSystem/languages/
language: en
# Prefix which will be shown before each message
prefix: '&8[&3WorldSystem&8] &6'
# Time in days after a not used world will be deleted
# Set to -1 to disable
delete_after: -1
# Whether WorldSystem should contact the Mojang authserver
# If not, some unknown playernames will not be displayed
# eg. in the gui or in /ws info
contact_authserver: true
# Options for the LagSystem:
# period_in_seconds - how often will be checked for entities in seconds
# entities_per_world - maximal allowed entities per world
# garbagecollector - how often will be unused ram be cleared
lagsystem:
period_in_seconds: 10
entities_per_world: 350
garbagecollector:
use: false
period_in_minutes: 5
# Location where you will be teleported when you leave you world
spawn:
gamemode: 2
spawnpoint:
use_last_location: true
world: world
x: 0
y: 20
z: 0
yaw: 0
pitch: 0
# Location where you spawn when you join a world
worldspawn:
use_last_location: true
use: false
spawnpoint:
x: 0
y: 20
z: 0
yaw: 0
pitch: 0

View File

@ -284,7 +284,7 @@ worldchoose:
rows: 4
# The key must be named exactly as in the config.yml
# The key must be named exactly as in the configOLD.yml
template_default:
enabled: true
slot:

View File

@ -0,0 +1,14 @@
package de.butzlabben.world.config;
import org.junit.jupiter.api.Test;
import java.io.File;
import java.io.FileNotFoundException;
public class TestPluginConfig {
@Test
public void testPluginConfigInit() throws FileNotFoundException {
File cfgFile = new File("TestFiles/workingDir/TestConfig.yml");
PluginConfig cfg = new PluginConfig(cfgFile);
}
}

View File

@ -1,10 +1,13 @@
package de.butzlabben.world.data;
import org.apache.commons.io.FileUtils;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.nio.file.Path;
import java.util.Scanner;
import static org.junit.jupiter.api.Assertions.*;
@ -17,11 +20,8 @@ public class TestWorldDatabase {
* but then allows us to run the tests Fresh.
*/
@BeforeAll
static void CleanLastTest() {
File workingDir = new File("src\\TestFiles\\workingDir\\");
for (File file : workingDir.listFiles()) {
file.delete();
}
static void CleanLastTest() throws IOException {
FileUtils.cleanDirectory(new File("TestFiles/workingDir/"));
}
/**
@ -29,7 +29,7 @@ public class TestWorldDatabase {
*/
@Test
public void testDatabaseInitalizationFromNoFile() {
final String path = "src\\TestFiles\\workingDir\\dataBaseInitTestFromNoFile.json";
final String path = "TestFiles/workingDir/dataBaseInitTestFromNoFile.json";
WorldDatabase wb = new WorldDatabase(path);
assertEquals(0, wb.getPlayerCount());
@ -41,7 +41,7 @@ public class TestWorldDatabase {
*/
@Test
public void testDatabaseInitalizationCreateValidFile() throws FileNotFoundException {
final String path = "src\\TestFiles\\workingDir\\dataBaseInitTestCreateValidFile.json";
final String path = "TestFiles/workingDir/dataBaseInitTestCreateValidFile.json";
WorldDatabase wb = new WorldDatabase(path);
wb.addPlayer("BlankUUID");
@ -57,7 +57,7 @@ public class TestWorldDatabase {
*/
@Test
public void testDatabaseInitalizationWithExistingEmptyFile() {
final String path = "src\\TestFiles\\ExistingEmptyFileInit.json";
final String path = "TestFiles/workingDir/ExistingEmptyFileInit.json";
WorldDatabase wb = new WorldDatabase(path);
assertEquals(0, wb.getPlayerCount());

View File

@ -0,0 +1,56 @@
package de.butzlabben.world.data.objects;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertTrue;
public class TestPlayerData {
/**
* Tests the Basic Initalization of a PlayerData Object
*/
@Test
public void testPlayerDataInit() {
PlayerData pd = new PlayerData();
assertEquals(0, pd.getWorldCount());
}
/**
* Tests adding one world to the player
*/
@Test
public void testAddWorld() {
PlayerData pd = new PlayerData();
pd.addWorld(new PlayerWorld(pd.getWorldCount()));
assertEquals(1, pd.getWorldCount());
}
/**
* Tests adding multiple worlds to the player
*/
@Test
public void testAddMultipleWorlds() {
PlayerData pd = new PlayerData();
for (int i = 0; i < 5; i++) {
pd.addWorld(new PlayerWorld(pd.getWorldCount()));
}
assertEquals(5, pd.getWorldCount());
}
/**
* Tests geting a world at a specified index
*/
@Test
public void testGetWorldAtIndex() {
PlayerData pd = new PlayerData();
pd.addWorld(new PlayerWorld(pd.getWorldCount()));
assertEquals(1, pd.getWorldCount());
assertEquals(0, pd.getWorldAt(0).getWorldNumber());
}
}

View File

@ -0,0 +1,26 @@
package de.butzlabben.world.data.objects;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertEquals;
public class TestPlayerWorld {
/**
* Tests the basic initiazlization of a new World with an id of 0
*/
@Test
public void testPlayerWorldInit() {
PlayerWorld pw = new PlayerWorld(0);
assertEquals(0,pw.getWorldNumber());
}
/**
* Test the initiazlization of a world with a index other than 0
*/
@Test
public void testPlayerWorldInit2() {
PlayerWorld pw = new PlayerWorld(6);
assertEquals(6,pw.getWorldNumber());
}
}

View File

@ -0,0 +1,97 @@
package de.butzlabben.world.data.objects;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertEquals;
public class TestWorldSystemData {
/**
* Test the base initiaztaion of the WorldSystemData Object
*/
@Test
public void testWorldSystemDataInit() {
WorldSystemData wsd = new WorldSystemData();
assertEquals(0, wsd.getPlayers());
}
/**
* Tests adding a basic player
*/
@Test
public void testAddPlayer() {
WorldSystemData wsd = new WorldSystemData();
assertEquals(0, wsd.getPlayers());
wsd.addplayer("Blank_UUID");
assertEquals(1, wsd.getPlayers());
}
/**
* Test adding multiple Players
*/
@Test
public void testAddMultiplePlayers() {
WorldSystemData wsd = new WorldSystemData();
assertEquals(0, wsd.getPlayers());
wsd.addplayer("Blank_UUID");
assertEquals(1, wsd.getPlayers());
for (int i = 0; i < 5; i++) {
wsd.addplayer("Blank_UUID" + i);
}
assertEquals(6, wsd.getPlayers());
}
/**
* Tests adding Duplicate PLayers
*/
@Test
public void testAddDulpicatePlayer() {
WorldSystemData wsd = new WorldSystemData();
assertEquals(0, wsd.getPlayers());
wsd.addplayer("Blank_UUID");
assertEquals(1, wsd.getPlayers());
wsd.addplayer("Blank_UUID");
assertEquals(1, wsd.getPlayers());
}
/**
* Tests adding a world to a player
*/
@Test
public void testAddWorldToPlayer() {
WorldSystemData wsd = new WorldSystemData();
assertEquals(0, wsd.getPlayers());
wsd.addplayer("Blank_UUID");
wsd.addWorldToPlayer("Blank_UUID", new PlayerWorld(wsd.getPlayer("Blank_UUID").getWorldCount()));
assertEquals(1, wsd.getPlayer("Blank_UUID").getWorldCount());
}
/**
* Tests adding mulitple worlds a player
*/
@Test
public void testAddMultipleWorldsToPlayer() {
WorldSystemData wsd = new WorldSystemData();
wsd.addplayer("Blank_UUID");
assertEquals(1, wsd.getPlayers());
wsd.addWorldToPlayer("Blank_UUID", new PlayerWorld(wsd.getPlayer("Blank_UUID").getWorldCount()));
assertEquals(1, wsd.getPlayer("Blank_UUID").getWorldCount());
for (int i = 0; i < 5; i++) {
wsd.addWorldToPlayer("Blank_UUID", new PlayerWorld(wsd.getPlayer("Blank_UUID").getWorldCount()));
}
assertEquals(6, wsd.getPlayer("Blank_UUID").getWorldCount());
}
}

View File

@ -279,7 +279,7 @@ worldchoose:
rows: 4
# The key must be named exactly as in the config.yml
# The key must be named exactly as in the configOLD.yml
template_default:
enabled: true
slot:

View File

@ -279,7 +279,7 @@ worldchoose:
rows: 4
# The key must be named exactly as in the config.yml
# The key must be named exactly as in the configOLD.yml
template_default:
enabled: true
slot:

View File

@ -1,133 +1,121 @@
# Path where the worlds will be saved
worldfolder: 'plugins/WorldSystem/Worlds'
worldtemplates:
# Whether players can decide on different templates
multi_choose: false
# If multi_choose is disabled, which template should be choosen
default: 'template_default'
templates:
# The "1" can be any key
1:
# Name of directory in plugins/WorldSystem/worldsources
# e.g. this would be plugins/WorldSystem/worldsources/template_default
name: 'template_default'
# Just remove the permission field if everybody should be able to use this template
2:
name: 'another_template'
# Only players with this exact permission can use and see this template
# ws.* will not work with this
permission: ws.template.another_template
# If this config option is given, 100 is needed to create a world
# This amount will then with withdrawn from the player
cost: 100
# Options for random world generation
# Here you can configure the world generator of a template
generator:
# 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
# Put in here the name of a generator
# If you have one from one plugin
generator: ''
# If a confirm is needed before auto-update
need_confirm: true
# When nobody is on a world time until it get unloaded
unloadingtime: 20
# If true nobody can teleport or change their gamemode a WorldSystem world
# Except for players with the permissions: ws.gamemode | ws.tp.*
survival: false
# If WorldSystem should load the worlds async if possible (FAWE installed)
load_worlds_async: true
# Options for the database saving player positions
database:
# Which type should be choosen:
# 'mysql' or 'sqlite'
# You need a working mysql database in order to use this option
type: sqlite
# How the table with the saved player positions on the playerworlds should be named
worlds_table_name: worlds_positions
# How the table with the saved player positions on the normal worlds should be named
players_table_name: player_positions
# how should the uuid cache be stored
players_uuids: players_uuids
# Configure here your mysql connection
mysql_settings:
host: 127.0.0.1
port: 3306
username: root
password: YOUR_PASSWORD_HERE
database: database
sqlite_settings:
# Where the database file should be located
file: 'plugins/WorldSystem/repository.db'
# If true players will teleported to the spawn on join
spawn_teleportation: true
# Time in seconds until a request expires
request_expires: 20
# Name of the languagefile in plugins/WorldSystem/languages/
language: en
# Prefix which will be shown before each message
prefix: '&8[&3WorldSystem&8] &6'
# Time in days after a not used world will be deleted
# Set to -1 to disable
delete_after: -1
# Whether WorldSystem should contact the Mojang authserver
# If not, some unknown playernames will not be displayed
# eg. in the gui or in /ws info
contact_authserver: true
# Options for the LagSystem:
# period_in_seconds - how often will be checked for entities in seconds
# entities_per_world - maximal allowed entities per world
# garbagecollector - how often will be unused ram be cleared
lagsystem:
period_in_seconds: 10
entities_per_world: 350
garbagecollector:
use: false
period_in_minutes: 5
# Location where you will be teleported when you leave you world
spawn:
gamemode: 2
spawnpoint:
use_last_location: true
world: world
x: 0
y: 20
z: 0
yaw: 0
pitch: 0
# Location where you spawn when you join a world
worldspawn:
use_last_location: true
use: false
spawnpoint:
x: 0
y: 20
z: 0
yaw: 0
pitch: 0
##########################################################################
### __ __ __ _______ __ ###
### \ \ / / / / / / ___/ / / ###
### \ \ __ / /___ ___/ /___/ / /____ ______/ /______________ ###
### \ \ / \ / / __ \/ _/ / __ /__ / / / / __/ __/ ___/ _ _ / ###
### \ \/ /\ \/ / /_/ / // / /_/ /__/ / /_/ /_ / /_/ ___/ // // / ###
### \__/ \__/\____/_//_/\__,_/____/\__, /___/\__/\___/_//_//_/ ###
### ___/ / ###
### \___/ ###
##########################################################################
####################
# General Settings #
####################
#The Path that the Worlds of players will be stored when not in use.
playerWorldsDir: 'plugins/WorldSystem/Worlds'
#The time that a world should take till it unloads from no use
unloadTime: 20
#Prefix on Messages sent by the plugin
prefix: '&8[&3WorldSystem&8] &6'
#Delete the world after set amount of days
#-1 to disable
deleteAfterDays: -1
#World Difficulty
#Options: PEACEFUL, EASY, NORMAL, HARD
worldDifficulty: 'EASY'
##########################
# World Creation Setting #
##########################
#Allow Players to Choose the Template they want
multiChoose: false
#The Default Generation File
#Warning: "do not add the .json"
defaultGenerator: 'Vanilla'
#World Generation Folder
worldGenTemplates: 'plugins/WorldSystem/Generators'
#World Borders
#The Default World Border Size for everyone
worldBorderDefaultSize: 500
#!Note: Dynamic World Borders Will Added back in a Future Update
#World Border Center
worldBorderCenter:
x: 0
z: 0
##########################
# World Entering/Exiting #
##########################
#This is the Settings you need to adjust to your server
serverSpawn:
#The Gamemode the Main server uses
#Options: Survival, Creative, Adventure
#Warning: Spectator is not a Valid Input
#Warning: Spelling Matters, Capitalization Does not
serverGamemode: 'Survival'
#The point the player should be placed when leaving a WS World
serverSpawnPoint:
worldName: 'world'
x: 0
y: 60
z: 0
#This is the Settings you need to adjust to your server
wsWorldSpawn:
#The Gamemode the Main server uses
#World Gamemode
#Options: Survival, Creative, Adventure
#Warning: Spectator is not a Valid Input
#Warning: Spelling Matters, Capitalization Does not
worldGameMode: 'Survival'
# places the player at their last known location in the world
useLastLocation: true;
#The point the player should be placed when entering a WS World
#for the first Time
defaultWorldSpawnPoint:
worldName: 'world'
x: 0
y: 60
z: 0
###################
# World Gamerules #
###################
#!DevTODO create a class to handle this to make it cleaner
#Also Document this part of the config
announceAdvancements: true
commandBlockOutput: false
disableElytraMovementCheck: false
doDaylightCycle: true
doEntityDrops: true
doFireTick: true
doLimitedCrafting: false
doMobLoot: true
doMobSpawning: true
doTileDrops: true
doWeatherCycle: false
gameLoopFunction: false
keepInventory: true
logAdminCommands: true
maxCommandChainLength: 65536
maxEntityCramming: 24
mobGriefing: true
naturalRegeneration: true
randomTickSpeed: 3
reducedDebugInfo: false
sendCommandFeedback: true
showDeathMessages: true
spawnRadius: 10
spectatorsGenerateChunks: true

View File

@ -0,0 +1,133 @@
# Path where the worlds will be saved
worldfolder: 'plugins/WorldSystem/Worlds'
worldtemplates:
# Whether players can decide on different templates
multi_choose: false
# If multi_choose is disabled, which template should be choosen
default: 'template_default'
templates:
# The "1" can be any key
1:
# Name of directory in plugins/WorldSystem/worldsources
# e.g. this would be plugins/WorldSystem/worldsources/template_default
name: 'template_default'
# Just remove the permission field if everybody should be able to use this template
2:
name: 'another_template'
# Only players with this exact permission can use and see this template
# ws.* will not work with this
permission: ws.template.another_template
# If this config option is given, 100 is needed to create a world
# This amount will then with withdrawn from the player
cost: 100
# Options for random world generation
# Here you can configure the world generator of a template
generator:
# 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
# Put in here the name of a generator
# If you have one from one plugin
generator: ''
# If a confirm is needed before auto-update
need_confirm: true
# When nobody is on a world time until it get unloaded
unloadingtime: 20
# If true nobody can teleport or change their gamemode a WorldSystem world
# Except for players with the permissions: ws.gamemode | ws.tp.*
survival: false
# If WorldSystem should load the worlds async if possible (FAWE installed)
load_worlds_async: true
# Options for the database saving player positions
database:
# Which type should be choosen:
# 'mysql' or 'sqlite'
# You need a working mysql database in order to use this option
type: sqlite
# How the table with the saved player positions on the playerworlds should be named
worlds_table_name: worlds_positions
# How the table with the saved player positions on the normal worlds should be named
players_table_name: player_positions
# how should the uuid cache be stored
players_uuids: players_uuids
# Configure here your mysql connection
mysql_settings:
host: 127.0.0.1
port: 3306
username: root
password: YOUR_PASSWORD_HERE
database: database
sqlite_settings:
# Where the database file should be located
file: 'plugins/WorldSystem/repository.db'
# If true players will teleported to the spawn on join
spawn_teleportation: true
# Time in seconds until a request expires
request_expires: 20
# Name of the languagefile in plugins/WorldSystem/languages/
language: en
# Prefix which will be shown before each message
prefix: '&8[&3WorldSystem&8] &6'
# Time in days after a not used world will be deleted
# Set to -1 to disable
delete_after: -1
# Whether WorldSystem should contact the Mojang authserver
# If not, some unknown playernames will not be displayed
# eg. in the gui or in /ws info
contact_authserver: true
# Options for the LagSystem:
# period_in_seconds - how often will be checked for entities in seconds
# entities_per_world - maximal allowed entities per world
# garbagecollector - how often will be unused ram be cleared
lagsystem:
period_in_seconds: 10
entities_per_world: 350
garbagecollector:
use: false
period_in_minutes: 5
# Location where you will be teleported when you leave you world
spawn:
gamemode: 2
spawnpoint:
use_last_location: true
world: world
x: 0
y: 20
z: 0
yaw: 0
pitch: 0
# Location where you spawn when you join a world
worldspawn:
use_last_location: true
use: false
spawnpoint:
x: 0
y: 20
z: 0
yaw: 0
pitch: 0

Some files were not shown because too many files have changed in this diff Show More