diff --git a/.idea/vcs.xml b/.idea/vcs.xml
new file mode 100644
index 0000000..35eb1dd
--- /dev/null
+++ b/.idea/vcs.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/WorldSystem/WorldSystem.iml b/WorldSystem/WorldSystem.iml
deleted file mode 100644
index a943b57..0000000
--- a/WorldSystem/WorldSystem.iml
+++ /dev/null
@@ -1,29 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/WorldSystem/pom.xml b/WorldSystem/pom.xml
index fcc39dc..702e5fb 100644
--- a/WorldSystem/pom.xml
+++ b/WorldSystem/pom.xml
@@ -1,101 +1,122 @@
-
- 4.0.0
- de.butzlabben.world
- WorldSystem
- 2.4.0.3
-
- UTF-8
- -
- ${project.version}
- Build:${project.build.number}
-
-
-
- package
- src/main/java
-
-
- src/main/resources
- true
- LICENSE.txt
-
-
-
-
- maven-compiler-plugin
- 3.3
-
-
- 1.8
-
-
-
-
-
-
-
- spigot-repo
- https://hub.spigotmc.org/nexus/content/repositories/snapshots/
-
-
- fawe-repo
- http://ci.athion.net/job/FastAsyncWorldEdit/ws/mvn/
-
-
- we-repo
- >http://maven.sk89q.com/repo/
-
-
-
-
- mojang
- Mojang's Repository
- https://libraries.minecraft.net/
-
-
-
-
-
-
- org.spigotmc
- spigot-api
- 1.13-R0.1-SNAPSHOT
- provided
-
-
-
- com.mojang
- authlib
- 1.5.21
-
-
-
-
-
-
-
- com.sk98q.worldedit
- FastAsnycWorldEdit
- system
- 1.0
- C:/FastAsyncWorldEdit.jar
-
-
-
- com.sk89q
- worldedit
- 6.0.0-SNAPSHOT
- provided
-
-
+
+ 4.0.0
+ de.butzlabben.world
+ WorldSystem
+ 2.4.1
+
+ UTF-8
+ -
+ ${project.version}
+ Build:${project.build.number}
+
+
+
+ package
+ src/main/java
+
+
+ src/main/resources
+ true
+ LICENSE.txt
+
+
+
+
+ maven-compiler-plugin
+ 3.3
+
+
+ 1.8
+
+
+
+ org.apache.maven.plugins
+ maven-shade-plugin
+ 3.1.0
+
+
+ package
+
+ shade
+
+
+
+
+
+
+
+
+
+ spigot-repo
+ https://hub.spigotmc.org/nexus/content/repositories/snapshots/
+
+
+ fawe-repo
+ http://ci.athion.net/job/FastAsyncWorldEdit/ws/mvn/
+
+
+ we-repo
+ >http://maven.sk89q.com/repo/
+
+
+
+
+ mojang
+ Mojang's Repository
+ https://libraries.minecraft.net/
+
+
+
+
+
+
+ org.spigotmc
+ spigot-api
+ 1.13-R0.1-SNAPSHOT
+ provided
+
+
+
+ com.mojang
+ authlib
+ 1.5.21
+ provided
+
+
+
+
+
+
+
+ com.sk98q.worldedit
+ FastAsnycWorldEdit
+ system
+ 1.0
+ C:/FastAsyncWorldEdit.jar
+
+
+
+ com.sk89q
+ worldedit
+ 6.0.0-SNAPSHOT
+ provided
+
+
+
+ net.myplayplanet
+ CommandFramework
+ 2.0.0-SNAPSHOT
+ compile
+
+
\ No newline at end of file
diff --git a/WorldSystem/src/main/java/de/butzlabben/world/WorldSystem.java b/WorldSystem/src/main/java/de/butzlabben/world/WorldSystem.java
index 1f714bb..3c1644e 100644
--- a/WorldSystem/src/main/java/de/butzlabben/world/WorldSystem.java
+++ b/WorldSystem/src/main/java/de/butzlabben/world/WorldSystem.java
@@ -1,221 +1,186 @@
-package de.butzlabben.world;
-
-import java.io.File;
-import java.io.IOException;
-
-import org.bstats.bukkit.Metrics;
-import org.bukkit.Bukkit;
-import org.bukkit.World;
-import org.bukkit.configuration.file.YamlConfiguration;
-import org.bukkit.plugin.PluginManager;
-import org.bukkit.plugin.java.JavaPlugin;
-
-import de.butzlabben.autoupdater.AutoUpdater;
-import de.butzlabben.world.command.WSAddmemberCommand;
-import de.butzlabben.world.command.WSCommand;
-import de.butzlabben.world.command.WSConfirmCommand;
-import de.butzlabben.world.command.WSDeleteCommand;
-import de.butzlabben.world.command.WSDelmemberCommand;
-import de.butzlabben.world.command.WSFireCommand;
-import de.butzlabben.world.command.WSGetCommand;
-import de.butzlabben.world.command.WSHomeCommand;
-import de.butzlabben.world.command.WSInfoCommand;
-import de.butzlabben.world.command.WSLeaveCommand;
-import de.butzlabben.world.command.WSResetCommand;
-import de.butzlabben.world.command.WSSethomeCommand;
-import de.butzlabben.world.command.WSTPCommand;
-import de.butzlabben.world.command.WSTnTCommand;
-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.GuiConfig;
-import de.butzlabben.world.config.MessageConfig;
-import de.butzlabben.world.config.PluginConfig;
-import de.butzlabben.world.config.SettingsConfig;
-import de.butzlabben.world.gui.GuiCommand;
-import de.butzlabben.world.listener.BlockListener;
-import de.butzlabben.world.listener.CommandListener;
-import de.butzlabben.world.listener.PlayerDeathListener;
-import de.butzlabben.world.listener.PlayerListener;
-import de.butzlabben.world.wrapper.AsyncCreatorAdapter;
-import de.butzlabben.world.wrapper.CreatorAdapter;
-import de.butzlabben.world.wrapper.SystemWorld;
-
-/**
- * @author Butzlabben
- * @author Jubeki
- * @since 10.07.2017
- * @version 2.2.0.1
- */
-public class WorldSystem extends JavaPlugin {
-
- final private String version = this.getDescription().getVersion();
-
- private CreatorAdapter creator;
-
- private static boolean is1_13 = false;
-
- @Override
- public void onEnable() {
- //Set right version
- if(Bukkit.getVersion().contains("1.13") || Bukkit.getVersion().contains("1_13") )
- is1_13 = true;
-
- createConfigs();
-
- PluginManager pm = Bukkit.getPluginManager();
- pm.registerEvents(new PlayerListener(), this);
- pm.registerEvents(new BlockListener(), this);
- pm.registerEvents(new PlayerDeathListener(), this);
- pm.registerEvents(new CommandListener(), this);
-
- Bukkit.getScheduler().scheduleSyncRepeatingTask(this, new WorldCheckerRunnable(), 20 * 5,
- 20 * PluginConfig.getLagCheckPeriod());
-
- if (PluginConfig.useGC()) {
- Bukkit.getScheduler().scheduleSyncRepeatingTask(this, new GCRunnable(), 20 * 5,
- 20 * PluginConfig.getGCPeriod());
- }
-
- Bukkit.getScheduler().scheduleSyncRepeatingTask(this, () -> {
- for (World w : Bukkit.getWorlds()) {
- SystemWorld sw = SystemWorld.getSystemWorld(w.getName());
- if (sw != null && sw.isLoaded())
- SettingsConfig.editWorld(w);
-
- }
- }, 20, 20 * 10);
-
- Bukkit.getScheduler().scheduleSyncRepeatingTask(this, new Runnable() {
- @Override
- public void run() {
- for (World w : Bukkit.getWorlds()) {
- SystemWorld.tryUnloadLater(w);
- }
- }
- }, 20 * 60 * 2, 20 * 60 * 2);
-
- // COMMANDS
- getCommand("ws").setExecutor(new WSCommand());
- getCommand("ws get").setExecutor(new WSGetCommand());
- getCommand("ws addmember").setExecutor(new WSAddmemberCommand());
- getCommand("ws delmember").setExecutor(new WSDelmemberCommand());
- getCommand("ws home").setExecutor(new WSHomeCommand());
- // Here we go for #20 and #22
- getCommand("ws sethome").setExecutor(new WSSethomeCommand());
- getCommand("ws leave").setExecutor(new WSLeaveCommand());
- getCommand("ws fire").setExecutor(new WSFireCommand());
- getCommand("ws info").setExecutor(new WSInfoCommand());
- getCommand("ws tnt").setExecutor(new WSTnTCommand());
- getCommand("ws tp").setExecutor(new WSTPCommand());
- getCommand("ws reset").setExecutor(new WSResetCommand());
- getCommand("ws toggletp").setExecutor(new WSToggleTPCommand());
- getCommand("ws togglegm").setExecutor(new WSToggleGMCommand());
- getCommand("ws togglebuild").setExecutor(new WSToggleBuildCommand());
- getCommand("ws delete").setExecutor(new WSDeleteCommand());
-
- getCommand("ws confirm").setExecutor(new WSConfirmCommand());
-
- getCommand("ws gui").setExecutor(new GuiCommand());
-
- System.setProperty("bstats.relocatecheck", "false");
- Metrics m = new Metrics(this);
- m.addCustomChart(new Metrics.SingleLineChart("worlds", DependenceConfig::getHighestID));
-
- AutoUpdater.startAsync();
-
- // Choose right creatoradapter for #16
- if (Bukkit.getPluginManager().getPlugin("FastAsyncWorldEdit") != null
- && Bukkit.getPluginManager().getPlugin("WorldEdit") != null) {
- creator = new AsyncCreatorAdapter();
- Bukkit.getConsoleSender()
- .sendMessage(PluginConfig.getPrefix() + "Found FAWE! Try now to create worlds async");
- } else {
- creator = (c, sw, r) -> {
- Bukkit.getWorlds().add(c.createWorld());
- if (sw != null)
- sw.setCreating(false);
- r.run();
- };
- }
-
- // Starting for #28
- if (PluginConfig.shouldDelete()) {
- Bukkit.getConsoleSender().sendMessage(PluginConfig.getPrefix()
- + "Searching for old worlds to delete if not loaded for " + PluginConfig.deleteAfter() + " days");
- DependenceConfig.checkWorlds();
- }
-
- Bukkit.getConsoleSender().sendMessage(PluginConfig.getPrefix() + "Succesfully enabled WorldSystem v" + version);
- }
-
- @Override
- public void onDisable() {
- for (World w : Bukkit.getWorlds()) {
- SystemWorld sw = SystemWorld.getSystemWorld(w.getName());
- if (sw != null && sw.isLoaded()) {
- sw.directUnload(w);
- }
- }
-
- Bukkit.getConsoleSender()
- .sendMessage(PluginConfig.getPrefix() + "Succesfully disabled WorldSystem v" + version);
- }
-
- public static void createConfigs() {
- File dir = new File(JavaPlugin.getPlugin(WorldSystem.class).getDataFolder() + "/worldsources");
- File config = new File(JavaPlugin.getPlugin(WorldSystem.class).getDataFolder(), "config.yml");
- File dconfig = new File(JavaPlugin.getPlugin(WorldSystem.class).getDataFolder(), "dependence.yml");
- File languages = new File(JavaPlugin.getPlugin(WorldSystem.class).getDataFolder() + "/languages");
- File gui = new File(JavaPlugin.getPlugin(WorldSystem.class).getDataFolder(), "gui.yml");
- if (!dir.exists()) {
- dir.mkdirs();
- }
- if (languages.exists() == false)
- languages.mkdirs();
- PluginConfig.checkConfig(config);
- // Done with #6
- MessageConfig.checkConfig(new File(languages, "en.yml"));
-
- MessageConfig.checkConfig(new File(languages, "de.yml"));
- MessageConfig.checkConfig(new File(languages, "hu.yml"));
- MessageConfig.checkConfig(new File(languages, "nl.yml"));
- MessageConfig.checkConfig(new File(languages, "pl.yml"));
- MessageConfig.checkConfig(new File(languages, "es.yml"));
- MessageConfig.checkConfig(new File(languages, "ru.yml"));
- MessageConfig.checkConfig(new File(languages, "fi.yml"));
- // Here we are for #5
- MessageConfig.checkConfig(new File(languages, "zh.yml"));
- MessageConfig.checkConfig(new File(languages, "fr.yml"));
- MessageConfig.checkConfig(new File(languages, PluginConfig.getLanguage() + ".yml"));
- if (!dconfig.exists()) {
- try {
- dconfig.createNewFile();
- } catch (IOException e) {
- System.err.println("Wasn't able to create DependenceConfig");
- e.printStackTrace();
- }
- new DependenceConfig();
- }
- YamlConfiguration cfg = YamlConfiguration.loadConfiguration(config);
- SettingsConfig.checkConfig();
- File worlddir = new File(cfg.getString("worldfolder"));
- if (!worlddir.exists()) {
- worlddir.mkdirs();
- }
- GuiConfig.checkConfig(gui);
- }
-
- public static WorldSystem getInstance() {
- return JavaPlugin.getPlugin(WorldSystem.class);
- }
-
- public CreatorAdapter getAdapter() {
- return creator;
- }
-
- public static boolean is1_13() {
- return is1_13;
- }
-}
+package de.butzlabben.world;
+
+import de.butzlabben.autoupdater.AutoUpdater;
+import de.butzlabben.world.command.*;
+import de.butzlabben.world.config.*;
+import de.butzlabben.world.gui.GuiCommand;
+import de.butzlabben.world.listener.*;
+import de.butzlabben.world.wrapper.AsyncCreatorAdapter;
+import de.butzlabben.world.wrapper.CreatorAdapter;
+import de.butzlabben.world.wrapper.SystemWorld;
+import net.myplayplanet.commandframework.CommandFramework;
+import org.bstats.bukkit.Metrics;
+import org.bukkit.Bukkit;
+import org.bukkit.World;
+import org.bukkit.configuration.file.YamlConfiguration;
+import org.bukkit.plugin.PluginManager;
+import org.bukkit.plugin.java.JavaPlugin;
+
+import java.io.File;
+import java.io.IOException;
+
+/**
+ * @author Butzlabben
+ * @author Jubeki
+ * @version 2.2.0.1
+ * @since 10.07.2017
+ */
+public class WorldSystem extends JavaPlugin {
+
+ final private String version = this.getDescription().getVersion();
+
+ private CreatorAdapter creator;
+ private CommandFramework framework;
+
+ private static boolean is1_13 = false;
+
+ @Override
+ public void onEnable() {
+ //Set right version
+ if (Bukkit.getVersion().contains("1.13") || Bukkit.getVersion().contains("1_13"))
+ is1_13 = true;
+
+ createConfigs();
+
+ PluginManager pm = Bukkit.getPluginManager();
+ pm.registerEvents(new PlayerListener(), this);
+ pm.registerEvents(new BlockListener(), this);
+ pm.registerEvents(new PlayerDeathListener(), this);
+ pm.registerEvents(new CommandListener(), this);
+ if (pm.getPlugin("WorldEdit") != null)
+ pm.registerEvents(new WorldEditListener(), this);
+
+
+ Bukkit.getScheduler().scheduleSyncRepeatingTask(this, new WorldCheckerRunnable(), 20 * 5,
+ 20 * PluginConfig.getLagCheckPeriod());
+
+ if (PluginConfig.useGC()) {
+ Bukkit.getScheduler().scheduleSyncRepeatingTask(this, new GCRunnable(), 20 * 5,
+ 20 * PluginConfig.getGCPeriod());
+ }
+
+ Bukkit.getScheduler().scheduleSyncRepeatingTask(this, () -> {
+ for (World w : Bukkit.getWorlds()) {
+ SystemWorld sw = SystemWorld.getSystemWorld(w.getName());
+ if (sw != null && sw.isLoaded())
+ SettingsConfig.editWorld(w);
+
+ }
+ }, 20, 20 * 10);
+
+ Bukkit.getScheduler().scheduleSyncRepeatingTask(this, new Runnable() {
+ @Override
+ public void run() {
+ for (World w : Bukkit.getWorlds()) {
+ SystemWorld.tryUnloadLater(w);
+ }
+ }
+ }, 20 * 60 * 2, 20 * 60 * 2);
+
+ //COMMANDS
+ framework = new CommandFramework(this);
+ framework.registerCommands(new WSCommand());
+ framework.registerCommands(new WorldSettingsCommands());
+ framework.registerCommands(new WorldAdministrateCommand());
+
+
+ System.setProperty("bstats.relocatecheck", "false");
+ Metrics m = new Metrics(this);
+ m.addCustomChart(new Metrics.SingleLineChart("worlds", DependenceConfig::getHighestID));
+
+ AutoUpdater.startAsync();
+
+ // Choose right creatoradapter for #16
+ if (Bukkit.getPluginManager().getPlugin("FastAsyncWorldEdit") != null
+ && Bukkit.getPluginManager().getPlugin("WorldEdit") != null) {
+ creator = new AsyncCreatorAdapter();
+ Bukkit.getConsoleSender()
+ .sendMessage(PluginConfig.getPrefix() + "Found FAWE! Try now to create worlds async");
+ } else {
+ creator = (c, sw, r) -> {
+ Bukkit.getWorlds().add(c.createWorld());
+ if (sw != null)
+ sw.setCreating(false);
+ r.run();
+ };
+ }
+
+ // Starting for #28
+ if (PluginConfig.shouldDelete()) {
+ Bukkit.getConsoleSender().sendMessage(PluginConfig.getPrefix()
+ + "Searching for old worlds to delete if not loaded for " + PluginConfig.deleteAfter() + " days");
+ DependenceConfig.checkWorlds();
+ }
+
+ Bukkit.getConsoleSender().sendMessage(PluginConfig.getPrefix() + "Succesfully enabled WorldSystem v" + version);
+ }
+
+ @Override
+ public void onDisable() {
+ for (World w : Bukkit.getWorlds()) {
+ SystemWorld sw = SystemWorld.getSystemWorld(w.getName());
+ if (sw != null && sw.isLoaded()) {
+ sw.directUnload(w);
+ }
+ }
+
+ Bukkit.getConsoleSender()
+ .sendMessage(PluginConfig.getPrefix() + "Succesfully disabled WorldSystem v" + version);
+ }
+
+ public static void createConfigs() {
+ File dir = new File(JavaPlugin.getPlugin(WorldSystem.class).getDataFolder() + "/worldsources");
+ File config = new File(JavaPlugin.getPlugin(WorldSystem.class).getDataFolder(), "config.yml");
+ File dconfig = new File(JavaPlugin.getPlugin(WorldSystem.class).getDataFolder(), "dependence.yml");
+ File languages = new File(JavaPlugin.getPlugin(WorldSystem.class).getDataFolder() + "/languages");
+ File gui = new File(JavaPlugin.getPlugin(WorldSystem.class).getDataFolder(), "gui.yml");
+ if (!dir.exists()) {
+ dir.mkdirs();
+ }
+ if (languages.exists() == false)
+ languages.mkdirs();
+ PluginConfig.checkConfig(config);
+ // Done with #6
+ MessageConfig.checkConfig(new File(languages, "en.yml"));
+
+ MessageConfig.checkConfig(new File(languages, "de.yml"));
+ MessageConfig.checkConfig(new File(languages, "hu.yml"));
+ MessageConfig.checkConfig(new File(languages, "nl.yml"));
+ MessageConfig.checkConfig(new File(languages, "pl.yml"));
+ MessageConfig.checkConfig(new File(languages, "es.yml"));
+ MessageConfig.checkConfig(new File(languages, "ru.yml"));
+ MessageConfig.checkConfig(new File(languages, "fi.yml"));
+ // Here we are for #5
+ MessageConfig.checkConfig(new File(languages, "zh.yml"));
+ MessageConfig.checkConfig(new File(languages, "fr.yml"));
+ MessageConfig.checkConfig(new File(languages, PluginConfig.getLanguage() + ".yml"));
+ if (!dconfig.exists()) {
+ try {
+ dconfig.createNewFile();
+ } catch (IOException e) {
+ System.err.println("Wasn't able to create DependenceConfig");
+ e.printStackTrace();
+ }
+ new DependenceConfig();
+ }
+ YamlConfiguration cfg = YamlConfiguration.loadConfiguration(config);
+ SettingsConfig.checkConfig();
+ File worlddir = new File(cfg.getString("worldfolder"));
+ if (!worlddir.exists()) {
+ worlddir.mkdirs();
+ }
+ GuiConfig.checkConfig(gui);
+ }
+
+ public static WorldSystem getInstance() {
+ return JavaPlugin.getPlugin(WorldSystem.class);
+ }
+
+ public CreatorAdapter getAdapter() {
+ return creator;
+ }
+
+ public static boolean is1_13() {
+ return is1_13;
+ }
+}
diff --git a/WorldSystem/src/main/java/de/butzlabben/world/command/WSCommand.java b/WorldSystem/src/main/java/de/butzlabben/world/command/WSCommand.java
index d60edff..16c88c7 100644
--- a/WorldSystem/src/main/java/de/butzlabben/world/command/WSCommand.java
+++ b/WorldSystem/src/main/java/de/butzlabben/world/command/WSCommand.java
@@ -1,147 +1,235 @@
-package de.butzlabben.world.command;
-
-import java.util.LinkedList;
-import java.util.List;
-
-import org.bukkit.Bukkit;
-import org.bukkit.command.Command;
-import org.bukkit.command.CommandExecutor;
-import org.bukkit.command.CommandSender;
-import org.bukkit.command.ConsoleCommandSender;
-import org.bukkit.command.TabCompleter;
-import org.bukkit.entity.Player;
-
-import de.butzlabben.world.WorldSystem;
-import de.butzlabben.world.config.MessageConfig;
-import de.butzlabben.world.config.PluginConfig;
-
-public class WSCommand implements CommandExecutor, TabCompleter {
-
- @Override
- public List onTabComplete(CommandSender cs, Command cmd, String label, String[] args) {
- List list = new LinkedList<>();
- if (args.length == 1) {
- list.add("addmember");
- list.add("delete");
- list.add("delmember");
- list.add("fire");
- list.add("get");
- list.add("gui");
- list.add("home");
- list.add("info");
- list.add("leave");
- list.add("reset");
- list.add("sethome");
- list.add("tnt");
- list.add("togglegm");
- list.add("toggletp");
- list.add("togglebuild");
- list.add("tp");
- } else if (args.length == 2) {
- switch (args[0].toLowerCase()) {
- case "reset":
- list.add("confirm");
- break;
- case "addmember":
- case "delete":
- case "togglebuild":
- case "togglegm":
- case "toggletp":
- case "tp":
- case "delmember":
- Bukkit.getOnlinePlayers().forEach((p) -> {
- if (cs instanceof Player == false || ((Player) cs).canSee(p))
- list.add(p.getName());
- });
- break;
- }
- }
- return list;
- }
-
- @Override
- public boolean onCommand(CommandSender cs, Command cmd, String label, String[] args) {
- if (args.length > 0) {
- String subcommand = args[0].toLowerCase();
- if (subcommand.equals("get")) {
- if (!(cs instanceof Player))
- return true;
- WorldSystem.getInstance().getCommand("ws get").execute(cs, label, args);
- } else if (subcommand.equals("addmember")) {
- if (!(cs instanceof Player))
- return true;
- WorldSystem.getInstance().getCommand("ws addmember").execute(cs, label, args);
- } else if (subcommand.equals("delmember")) {
- if (!(cs instanceof Player))
- return true;
- WorldSystem.getInstance().getCommand("ws delmember").execute(cs, label, args);
- } else if (subcommand.equals("fire")) {
- if (!(cs instanceof Player))
- return true;
- WorldSystem.getInstance().getCommand("ws fire").execute(cs, label, args);
- } else if (subcommand.equals("home")) {
- if (!(cs instanceof Player))
- return true;
- WorldSystem.getInstance().getCommand("ws home").execute(cs, label, args);
- } else if (subcommand.equals("sethome")) {
- if (!(cs instanceof Player))
- return true;
- WorldSystem.getInstance().getCommand("ws sethome").execute(cs, label, args);
- } else if (subcommand.equals("leave")) {
- WorldSystem.getInstance().getCommand("ws leave").execute(cs, label, args);
- } else if (subcommand.equals("info")) {
- if (!(cs instanceof Player))
- return true;
- WorldSystem.getInstance().getCommand("ws info").execute(cs, label, args);
- } else if (subcommand.equals("tnt")) {
- if (!(cs instanceof Player))
- return true;
- WorldSystem.getInstance().getCommand("ws tnt").execute(cs, label, args);
- } else if (subcommand.equals("tp")) {
- if (!(cs instanceof Player))
- return true;
- WorldSystem.getInstance().getCommand("ws tp").execute(cs, label, args);
- } else if (subcommand.equals("reset")) {
- if (!(cs instanceof Player))
- return true;
- WorldSystem.getInstance().getCommand("ws reset").execute(cs, label, args);
- } else if (subcommand.equals("toggletp")) {
- if (!(cs instanceof Player))
- return true;
- WorldSystem.getInstance().getCommand("ws toggletp").execute(cs, label, args);
- } else if (subcommand.equals("togglegm")) {
- if (!(cs instanceof Player))
- return true;
- WorldSystem.getInstance().getCommand("ws togglegm").execute(cs, label, args);
- } else if (subcommand.equals("togglebuild")) {
- if (!(cs instanceof Player))
- return true;
- WorldSystem.getInstance().getCommand("ws togglebuild").execute(cs, label, args);
- } else if (subcommand.equals("delete")) {
- WorldSystem.getInstance().getCommand("ws delete").execute(cs, label, args);
- } else if (subcommand.equals("gui")) {
- WorldSystem.getInstance().getCommand("ws gui").execute(cs, label, args);
- } else if (subcommand.equals("confirm")) {
- WorldSystem.getInstance().getCommand("ws confirm").execute(cs, label, args);
- } else {
- if (cs instanceof Player) {
- Player p = (Player) cs;
- p.chat("/ws");
- } else if (cs instanceof ConsoleCommandSender) {
- Bukkit.dispatchCommand(Bukkit.getConsoleSender(), "ws");
- }
- }
- return true;
- }
- String prefix = PluginConfig.getPrefix();
- cs.sendMessage(
- prefix + "WorldSystem by Butzlabben v" + WorldSystem.getInstance().getDescription().getVersion());
- cs.sendMessage(prefix + "Contributor: Jubeki");
- List cmdHelp = MessageConfig.getCommandHelp();
- cmdHelp.forEach(s -> cs.sendMessage(prefix + s));
- if (cs.hasPermission("ws.delete"))
- cs.sendMessage(MessageConfig.getDeleteCommandHelp());
- return true;
- }
-
-}
+package de.butzlabben.world.command;
+
+import de.butzlabben.autoupdater.AutoUpdater;
+import de.butzlabben.world.WorldSystem;
+import de.butzlabben.world.config.DependenceConfig;
+import de.butzlabben.world.config.MessageConfig;
+import de.butzlabben.world.config.PluginConfig;
+import de.butzlabben.world.config.WorldConfig;
+import de.butzlabben.world.gui.WorldChooseGUI;
+import de.butzlabben.world.gui.WorldSystemGUI;
+import de.butzlabben.world.wrapper.SystemWorld;
+import de.butzlabben.world.wrapper.WorldPlayer;
+import de.butzlabben.world.wrapper.WorldTemplate;
+import de.butzlabben.world.wrapper.WorldTemplateProvider;
+import net.myplayplanet.commandframework.CommandArgs;
+import net.myplayplanet.commandframework.api.Command;
+import org.bukkit.Bukkit;
+import org.bukkit.World;
+import org.bukkit.command.CommandSender;
+import org.bukkit.entity.Player;
+
+import java.util.Iterator;
+import java.util.List;
+
+public class WSCommand {
+
+ @Command(name = "ws")
+ public void mainCommand(CommandArgs args) {
+ CommandSender cs = args.getSender(CommandSender.class);
+
+ String prefix = PluginConfig.getPrefix();
+ cs.sendMessage(
+ prefix + "WorldSystem by Butzlabben v" + WorldSystem.getInstance().getDescription().getVersion());
+ cs.sendMessage(prefix + "Contributor: Jubeki");
+ List cmdHelp = MessageConfig.getCommandHelp();
+ cmdHelp.forEach(s -> cs.sendMessage(prefix + s));
+ if (cs.hasPermission("ws.delete"))
+ cs.sendMessage(MessageConfig.getDeleteCommandHelp());
+ }
+
+ @Command(name ="ws.gui", inGameOnly = true)
+ public void guiCommand(CommandArgs args) {
+ Player p = args.getSender(Player.class);
+
+ WorldPlayer wp = new WorldPlayer(p);
+ if (!wp.isOnSystemWorld()) {
+ p.sendMessage(MessageConfig.getNotOnWorld());
+ return;
+ }
+ if (!wp.isOwnerofWorld()) {
+ p.sendMessage(MessageConfig.getNoPermission());
+ return;
+ }
+ p.openInventory(new WorldSystemGUI().getInventory(p));
+ }
+
+ @Command(name = "ws.confirm", permission = "ws.confirm")
+ public void confirmCommand(CommandArgs args) {
+ CommandSender cs = args.getSender(Player.class);
+
+ if (AutoUpdater.getInstance().confirmed()) {
+ cs.sendMessage(PluginConfig.getPrefix() + "§cAlready confirmed or no confirm needed");
+ return;
+ }
+ AutoUpdater.getInstance().confirm();
+ cs.sendMessage(PluginConfig.getPrefix() + "§aAutoupdate confirmed, §crestart §ato apply changes");
+ }
+
+ @Command(name = "ws.get", inGameOnly = true)
+ public void getCommand(CommandArgs args) {
+ Player p = args.getSender(Player.class);
+ // create New Entry
+ DependenceConfig dc = new DependenceConfig(p);
+ if (dc.hasWorld()) {
+ p.sendMessage(MessageConfig.getWorldAlreadyExists());
+ return;
+ }
+
+ if (PluginConfig.isMultiChoose()) {
+ if (args.length() > 0) {
+ String key = args.getArgument(0);
+ WorldTemplate template = WorldTemplateProvider.getInstace().getTemplate(key);
+ if (template != null) {
+ create(p, template);
+ return;
+ }
+ }
+ p.openInventory(new WorldChooseGUI().getInventory(p));
+ } else {
+ WorldTemplate template = WorldTemplateProvider.getInstace()
+ .getTemplate(PluginConfig.getDefaultWorldTemplate());
+ if (template != null)
+ create(p, template);
+ else {
+ p.sendMessage(PluginConfig.getPrefix() + "§cError in config at \"worldtemplates.default\"");
+ p.sendMessage(PluginConfig.getPrefix() + "§cPlease contact an administrator");
+ }
+ }
+ }
+
+ @Command(name = "ws.home", inGameOnly = true)
+ public void homeCommand(CommandArgs args) {
+ Player p = args.getSender(Player.class);
+
+ String worldname = p.getWorld().getName();
+ DependenceConfig dc = new DependenceConfig(p);
+ if (!dc.hasWorld()) {
+ p.sendMessage(MessageConfig.getNoWorldOwn());
+ return;
+ }
+ WorldPlayer wp = new WorldPlayer(p, worldname);
+ if (wp.isOnSystemWorld()) {
+ SystemWorld.tryUnloadLater(Bukkit.getWorld(worldname));
+ }
+ SystemWorld sw = SystemWorld.getSystemWorld(dc.getWorldname());
+ if(sw == null) {
+ p.sendMessage(MessageConfig.getNoWorldOwn());
+ return;
+ }
+ if (sw.isLoaded()) {
+ sw.teleportToWorldSpawn(p);
+ } else {
+ sw.load(p);
+ }
+ }
+
+ @Command(name = "ws.info", inGameOnly = true)
+ public void infoComannd(CommandArgs args) {
+ Player p = args.getSender(Player.class);
+
+ WorldPlayer wp = new WorldPlayer(p, p.getWorld().getName());
+ if (!wp.isOnSystemWorld()) {
+ p.sendMessage(MessageConfig.getNotOnWorld());
+ return;
+ }
+
+ WorldConfig wc = WorldConfig.getWorldConfig(p.getWorld().getName());
+ int id = wc.getId();
+ String owner = wc.getOwnerName();
+ boolean fire = wc.isFire();
+ boolean tnt = wc.isTnt();
+
+ p.sendMessage(MessageConfig.getInfoOwner().replaceAll("%data", owner));
+ p.sendMessage(MessageConfig.getInfoId().replaceAll("%data", "" + id));
+ p.sendMessage(MessageConfig.getInfoTnt().replaceAll("%data",
+ tnt ? MessageConfig.getInfoEnabled() : MessageConfig.getInfoDisabled()));
+ p.sendMessage(MessageConfig.getInfoFire().replaceAll("%data",
+ fire ? MessageConfig.getInfoEnabled() : MessageConfig.getInfoDisabled()));
+ StringBuilder sb = new StringBuilder();
+ Iterator it = wc.getMembersWithNames().values().iterator();
+ while (it.hasNext()) {
+ sb.append(it.next());
+ if(it.hasNext())
+ sb.append(" ");
+ }
+ p.sendMessage(MessageConfig.getInfoMember().replaceAll("%data", sb.toString().trim()));
+ }
+
+ @Command(name = "ws.leave", inGameOnly = true)
+ public void leaveCommand(CommandArgs args) {
+ Player p = args.getSender(Player.class);
+
+ 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");
+ p.sendMessage(PluginConfig.getPrefix() + "§cThe spawn is not properly set");
+ return;
+ }
+
+ p.teleport(PluginConfig.getSpawn());
+ p.setGameMode(PluginConfig.getSpawnGamemode());
+ World w = Bukkit.getWorld(p.getWorld().getName());
+ SystemWorld.tryUnloadLater(w);
+ } else {
+ p.sendMessage(MessageConfig.getNotOnWorld());
+ }
+ }
+
+ @Command(name = "ws.tp", inGameOnly = true)
+ public void tpCommand(CommandArgs args) {
+ Player p = args.getSender(Player.class);
+
+ if (args.length() < 1) {
+ p.sendMessage(MessageConfig.getWrongUsage().replaceAll("%usage", "/ws tp "));
+ return;
+ }
+
+ if(args.getArgument(0).equalsIgnoreCase(p.getName()) || args.getArgument(0).equalsIgnoreCase(p.getUniqueId().toString())) {
+ p.chat("/ws home");
+ return;
+ }
+
+
+ DependenceConfig dc = new DependenceConfig(args.getArgument(0));
+ String worldname = dc.getWorldNamebyOfflinePlayer();
+ if (!dc.hasWorld()) {
+ p.sendMessage(MessageConfig.getNoWorldOther());
+ return;
+ }
+ SystemWorld sw = SystemWorld.getSystemWorld(worldname);
+ WorldPlayer wp1 = new WorldPlayer(p, p.getWorld().getName());
+ WorldPlayer wp = new WorldPlayer(p, worldname);
+ if (p.getWorld().getName().equals(worldname)) {
+ sw.teleportToWorldSpawn(p);
+ return;
+ }
+ if (!p.hasPermission("ws.tp.world")) {
+ if (!wp.isMemberofWorld(worldname) && !wp.isOwnerofWorld()) {
+ p.sendMessage(MessageConfig.getNoMemberOther());
+ return;
+ }
+ }
+ if (wp1.isOnSystemWorld()) {
+ World w = p.getWorld();
+ SystemWorld.tryUnloadLater(w);
+ }
+ if (sw != null)
+ if (!sw.isLoaded()) {
+ sw.load(p);
+ } else {
+ sw.teleportToWorldSpawn(p);
+ }
+ }
+
+ private void create(Player p, WorldTemplate template) {
+ Bukkit.getScheduler().runTask(WorldSystem.getInstance(), () -> {
+ if (SystemWorld.create(p, template))
+ p.sendMessage(MessageConfig.getSettingUpWorld());
+ });
+ }
+}
\ No newline at end of file
diff --git a/WorldSystem/src/main/java/de/butzlabben/world/command/WorldAdministrateCommand.java b/WorldSystem/src/main/java/de/butzlabben/world/command/WorldAdministrateCommand.java
new file mode 100644
index 0000000..8fcc938
--- /dev/null
+++ b/WorldSystem/src/main/java/de/butzlabben/world/command/WorldAdministrateCommand.java
@@ -0,0 +1,302 @@
+package de.butzlabben.world.command;
+
+import de.butzlabben.world.WorldSystem;
+import de.butzlabben.world.config.DependenceConfig;
+import de.butzlabben.world.config.MessageConfig;
+import de.butzlabben.world.config.PluginConfig;
+import de.butzlabben.world.config.WorldConfig;
+import de.butzlabben.world.event.WorldAddmemberEvent;
+import de.butzlabben.world.event.WorldDeleteEvent;
+import de.butzlabben.world.event.WorldRemovememberEvent;
+import de.butzlabben.world.wrapper.SystemWorld;
+import de.butzlabben.world.wrapper.WorldPlayer;
+import net.myplayplanet.commandframework.CommandArgs;
+import net.myplayplanet.commandframework.api.Command;
+import org.apache.commons.io.FileUtils;
+import org.bukkit.Bukkit;
+import org.bukkit.OfflinePlayer;
+import org.bukkit.command.CommandSender;
+import org.bukkit.configuration.file.YamlConfiguration;
+import org.bukkit.entity.Player;
+
+import java.io.File;
+import java.io.IOException;
+
+public class WorldAdministrateCommand {
+
+ @Command(name = "ws.delmember", inGameOnly = true, usage = "/ws delmember ")
+ public void delMemberCommand(CommandArgs args) {
+ Player p = args.getSender(Player.class);
+
+ if (args.length() < 1) {
+ p.sendMessage(MessageConfig.getWrongUsage().replaceAll("%usage", "/ws delmember "));
+ return;
+ }
+
+ DependenceConfig dc = new DependenceConfig(p);
+ if (!dc.hasWorld()) {
+ p.sendMessage(MessageConfig.getNoWorldOwn());
+ return;
+ }
+
+ @SuppressWarnings("deprecation")
+ OfflinePlayer a = Bukkit.getOfflinePlayer(args.getArgument(0));
+ WorldConfig wc = WorldConfig.getWorldConfig(dc.getWorldname());
+ if (a == null) {
+ p.sendMessage(MessageConfig.getNotRegistered().replaceAll("%player", args.getArgument(0)));
+ return;
+ } else if (!wc.isMember(a.getUniqueId())) {
+ p.sendMessage(MessageConfig.getNoMemberOwn());
+ return;
+ }
+ WorldRemovememberEvent event = new WorldRemovememberEvent(a.getUniqueId(), dc.getWorldname(), p);
+ Bukkit.getPluginManager().callEvent(event);
+ if (event.isCancelled())
+ return;
+
+ wc.removeMember(a.getUniqueId());
+ if (a.isOnline()) {
+ Player t = (Player) a;
+ if (t.getWorld().getName().equals(new DependenceConfig(p).getWorldname())) {
+ t.teleport(PluginConfig.getSpawn());
+ t.setGameMode(PluginConfig.getSpawnGamemode());
+ }
+ }
+ try {
+ wc.save();
+ } catch (IOException e) {
+ p.sendMessage(MessageConfig.getUnknownError());
+ e.printStackTrace();
+ }
+ p.sendMessage(MessageConfig.getMemberRemoved().replaceAll("%player", a.getName()));
+ }
+
+ @Command(name = "ws.delete", permission = "ws.delete", usage = "/ws delete ")
+ public void deleteCommand(CommandArgs args) {
+ CommandSender cs = args.getSender(CommandSender.class);
+
+ if (args.length() < 1) {
+ cs.sendMessage(MessageConfig.getWrongUsage().replaceAll("%usage", "/ws delete "));
+ return;
+ }
+
+ DependenceConfig dc = new DependenceConfig(args.getArgument(0));
+ if (!dc.hasWorld()) {
+ cs.sendMessage(MessageConfig.getNoWorldOther());
+ return;
+ }
+
+ String worldname = dc.getWorldname();
+ SystemWorld sw = SystemWorld.getSystemWorld(worldname);
+ WorldDeleteEvent event = new WorldDeleteEvent(cs, sw);
+ Bukkit.getPluginManager().callEvent(event);
+ if (event.isCancelled())
+ return;
+
+ if (sw != null && sw.isLoaded())
+ sw.directUnload(Bukkit.getWorld(worldname));
+ Bukkit.getScheduler().runTaskLater(WorldSystem.getInstance(), () -> {
+ OfflinePlayer op = dc.getOwner();
+
+ String uuid = op.getUniqueId().toString();
+ File dir = new File(PluginConfig.getWorlddir() + "/" + worldname);
+ if(!dir.exists())
+ dir = new File(Bukkit.getWorldContainer(), worldname);
+ if (dir.exists())
+ try {
+ FileUtils.deleteDirectory(dir);
+ } catch (Exception e) {
+ cs.sendMessage(MessageConfig.getUnknownError());
+ e.printStackTrace();
+ }
+ File dconfig = new File("plugins//WorldSystem//dependence.yml");
+ YamlConfiguration cfg = YamlConfiguration.loadConfiguration(dconfig);
+ cfg.set("Dependences." + uuid + ".ID", null);
+ cfg.set("Dependences." + uuid + ".ActualName", null);
+ cfg.set("Dependences." + uuid, null);
+ try {
+ cfg.save(dconfig);
+ } catch (Exception e) {
+ cs.sendMessage(MessageConfig.getUnknownError());
+ e.printStackTrace();
+ }
+ cs.sendMessage(MessageConfig.getDeleteWorldOther().replaceAll("%player", op.getName()));
+ if (op.isOnline()) {
+ Player p1 = Bukkit.getPlayer(op.getUniqueId());
+ p1.sendMessage(MessageConfig.getDeleteWorldOwn());
+ }
+ }, 10);
+ }
+
+ @Command(name = "ws.addmember", inGameOnly = true, usage = "/ws addmember ")
+ public void addMemberCommand(CommandArgs args) {
+ Player p = args.getSender(Player.class);
+
+ if (args.length() < 1) {
+ p.sendMessage(MessageConfig.getWrongUsage().replaceAll("%usage", "/ws addmember "));
+ return;
+ }
+
+ DependenceConfig dc = new DependenceConfig(p);
+ if (!dc.hasWorld()) {
+ p.sendMessage(MessageConfig.getNoWorldOwn());
+ return;
+ }
+ @SuppressWarnings("deprecation")
+ OfflinePlayer a = Bukkit.getOfflinePlayer(args.getArgument(0));
+ WorldConfig wc = WorldConfig.getWorldConfig(dc.getWorldname());
+ if (a == null) {
+ p.sendMessage(MessageConfig.getNotRegistered().replaceAll("%player", args.getArgument(0)));
+ return;
+ } else if (wc.isMember(a.getUniqueId())) {
+ p.sendMessage(MessageConfig.getAlreadyMember());
+ return;
+ }
+
+ WorldAddmemberEvent event = new WorldAddmemberEvent(a.getUniqueId(), dc.getWorldname(), p);
+ Bukkit.getPluginManager().callEvent(event);
+ if (event.isCancelled())
+ return;
+
+ wc.addMember(a.getUniqueId());
+ try {
+ wc.save();
+ } catch (IOException e) {
+ p.sendMessage(MessageConfig.getUnknownError());
+ e.printStackTrace();
+ }
+ p.sendMessage(MessageConfig.getMemberAdded().replaceAll("%player", a.getName()));
+ }
+
+ @Command(name = "ws.toggletp", inGameOnly = true, usage = "/ws toggletp ")
+ public void toggleTeleportCommand(CommandArgs args) {
+ Player p = args.getSender(Player.class);
+
+ if (args.length() < 1) {
+ p.sendMessage(MessageConfig.getWrongUsage().replaceAll("%usage", "/ws toggletp "));
+ return;
+ }
+
+ DependenceConfig dc = new DependenceConfig(p);
+ if (!dc.hasWorld()) {
+ p.sendMessage(MessageConfig.getNoWorldOwn());
+ return;
+ }
+ @SuppressWarnings("deprecation")
+ OfflinePlayer a = Bukkit.getOfflinePlayer(args.getArgument(0));
+ WorldConfig wc = WorldConfig.getWorldConfig(dc.getWorldname());
+ if (!wc.isMember(a.getUniqueId())) {
+ p.sendMessage(MessageConfig.getNoMemberOwn());
+ return;
+ }
+ WorldPlayer wp = new WorldPlayer(a, dc.getWorldname());
+ if (wp.isOwnerofWorld()) {
+ p.sendMessage(PluginConfig.getPrefix() + "§cYou are the owner");
+ return;
+ }
+ if (wp.toggleTeleport()) {
+ p.sendMessage(MessageConfig.getToggleTeleportEnabled().replaceAll("%player", a.getName()));
+ } else {
+ p.sendMessage(MessageConfig.getToggleTeleportDisabled().replaceAll("%player", a.getName()));
+ }
+ }
+
+ @Command(name = "ws.togglegm", inGameOnly = true, usage = "/ws togglegm ")
+ public void toggleGamemodeCommand(CommandArgs args) {
+ Player p = args.getSender(Player.class);
+
+ if (args.length() < 1) {
+ p.sendMessage(MessageConfig.getWrongUsage().replaceAll("%usage", "/ws togglegm "));
+ return;
+ }
+
+ DependenceConfig dc = new DependenceConfig(p);
+ if (!dc.hasWorld()) {
+ p.sendMessage(MessageConfig.getNoWorldOwn());
+ return;
+ }
+ @SuppressWarnings("deprecation")
+ OfflinePlayer a = Bukkit.getOfflinePlayer(args.getArgument(0));
+ WorldConfig wc = WorldConfig.getWorldConfig(dc.getWorldname());
+ if (!wc.isMember(a.getUniqueId())) {
+ p.sendMessage(MessageConfig.getNoMemberOwn());
+ return;
+ }
+ WorldPlayer wp = new WorldPlayer(a, dc.getWorldname());
+ if (wp.isOwnerofWorld()) {
+ p.sendMessage(PluginConfig.getPrefix() + "§cYou are the owner");
+ return;
+ }
+ if (wp.toggleGamemode()) {
+ p.sendMessage(MessageConfig.getToggleGameModeEnabled().replaceAll("%player", a.getName()));
+ } else {
+ p.sendMessage(MessageConfig.getToggleGameModeDisabled().replaceAll("%player", a.getName()));
+ }
+ }
+
+ @Command(name = "ws.togglewe", inGameOnly = true, usage = "/ws togglewe ")
+ public void toggleWorldeditCommand(CommandArgs args) {
+ Player p = args.getSender(Player.class);
+
+ if (args.length() < 1) {
+ p.sendMessage(MessageConfig.getWrongUsage().replaceAll("%usage", "/ws togglewe "));
+ return;
+ }
+
+ DependenceConfig dc = new DependenceConfig(p);
+ if (!dc.hasWorld()) {
+ p.sendMessage(MessageConfig.getNoWorldOwn());
+ return;
+ }
+ @SuppressWarnings("deprecation")
+ OfflinePlayer a = Bukkit.getOfflinePlayer(args.getArgument(0));
+ WorldConfig wc = WorldConfig.getWorldConfig(dc.getWorldname());
+ if (!wc.isMember(a.getUniqueId())) {
+ p.sendMessage(MessageConfig.getNoMemberOwn());
+ return;
+ }
+ WorldPlayer wp = new WorldPlayer(a, dc.getWorldname());
+ if (wp.isOwnerofWorld()) {
+ p.sendMessage(PluginConfig.getPrefix() + "§cYou are the owner");
+ return;
+ }
+ if (wp.toggleWorldEdit()) {
+ p.sendMessage(MessageConfig.getToggleWorldeditEnabled().replaceAll("%player", a.getName()));
+ } else {
+ p.sendMessage(MessageConfig.getToggleWorldeditDisabled().replaceAll("%player", a.getName()));
+ }
+ }
+
+ @Command(name = "ws.togglebuild", inGameOnly = true, usage = "/ws togglebuild ")
+ public void toggleBuildCommand(CommandArgs args) {
+ Player p = args.getSender(Player.class);
+
+ if (args.length() < 1) {
+ p.sendMessage(MessageConfig.getWrongUsage().replaceAll("%usage", "/ws togglebuild "));
+ return;
+ }
+
+ DependenceConfig dc = new DependenceConfig(p);
+ if (!dc.hasWorld()) {
+ p.sendMessage(MessageConfig.getNoWorldOwn());
+ return;
+ }
+ @SuppressWarnings("deprecation")
+ OfflinePlayer a = Bukkit.getOfflinePlayer(args.getArgument(0));
+ WorldConfig wc = WorldConfig.getWorldConfig(dc.getWorldname());
+ if (!wc.isMember(a.getUniqueId())) {
+ p.sendMessage(MessageConfig.getNoMemberOwn());
+ return;
+ }
+ WorldPlayer wp = new WorldPlayer(a, dc.getWorldname());
+ if (wp.isOwnerofWorld()) {
+ p.sendMessage(PluginConfig.getPrefix() + "§cYou are the owner");
+ return;
+ }
+ if (wp.toggleBuild()) {
+ p.sendMessage(MessageConfig.getToggleBuildEnabled().replaceAll("%player", a.getName()));
+ } else {
+ p.sendMessage(MessageConfig.getToggleBuildDisabled().replaceAll("%player", a.getName()));
+ }
+ }
+}
diff --git a/WorldSystem/src/main/java/de/butzlabben/world/command/WorldSettingsCommands.java b/WorldSystem/src/main/java/de/butzlabben/world/command/WorldSettingsCommands.java
new file mode 100644
index 0000000..81bccfa
--- /dev/null
+++ b/WorldSystem/src/main/java/de/butzlabben/world/command/WorldSettingsCommands.java
@@ -0,0 +1,236 @@
+package de.butzlabben.world.command;
+
+import de.butzlabben.world.WorldSystem;
+import de.butzlabben.world.config.DependenceConfig;
+import de.butzlabben.world.config.MessageConfig;
+import de.butzlabben.world.config.PluginConfig;
+import de.butzlabben.world.config.WorldConfig;
+import de.butzlabben.world.event.WorldResetEvent;
+import de.butzlabben.world.event.WorldToggleFireEvent;
+import de.butzlabben.world.event.WorldToggleTntEvent;
+import de.butzlabben.world.gui.WorldChooseGUI;
+import de.butzlabben.world.wrapper.SystemWorld;
+import de.butzlabben.world.wrapper.WorldPlayer;
+import de.butzlabben.world.wrapper.WorldTemplate;
+import de.butzlabben.world.wrapper.WorldTemplateProvider;
+import net.myplayplanet.commandframework.CommandArgs;
+import net.myplayplanet.commandframework.api.Command;
+import org.apache.commons.io.FileUtils;
+import org.bukkit.Bukkit;
+import org.bukkit.World;
+import org.bukkit.WorldCreator;
+import org.bukkit.WorldType;
+import org.bukkit.entity.Player;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+
+public class WorldSettingsCommands {
+
+ private ArrayList toConfirm = new ArrayList<>();
+
+ @Command(name="ws.reset", inGameOnly = true, usage = "/ws reset [confirm]")
+ public void resetCommand(CommandArgs args) {
+ Player p = args.getSender(Player.class);
+
+ DependenceConfig dc = new DependenceConfig(p);
+ String worldname = dc.getWorldname();
+ SystemWorld sw = SystemWorld.getSystemWorld(worldname);
+ if (!dc.hasWorld()) {
+ p.sendMessage(MessageConfig.getNoWorldOwn());
+ return;
+ }
+ if (args.length() > 0) {
+ if (args.getArgument(0).equalsIgnoreCase("confirm")) {
+ if (sw.isLoaded())
+ sw.directUnload(Bukkit.getWorld(worldname));
+
+ if (!toConfirm.contains(p)) {
+ p.sendMessage(MessageConfig.getNoRequestSend());
+ return;
+ }
+ WorldResetEvent event = new WorldResetEvent(p, sw);
+ Bukkit.getPluginManager().callEvent(event);
+ if (event.isCancelled())
+ return;
+
+ if (sw.isLoaded()) {
+ p.sendMessage(MessageConfig.getWorldStillLoaded());
+ return;
+ }
+ File f = new File(PluginConfig.getWorlddir() + "/" + worldname);
+
+ if (!PluginConfig.isMultiChoose()) {
+ WorldTemplate template = WorldTemplateProvider.getInstace()
+ .getTemplate(PluginConfig.getDefaultWorldTemplate());
+ if (template != null)
+ createWorld(p, worldname, f, new File(template.getPath()), sw);
+ else {
+ p.sendMessage(PluginConfig.getPrefix() + "§cError in config at \"worldtemplates.default\"");
+ p.sendMessage(PluginConfig.getPrefix() + "§cPlease contact an administrator");
+ }
+ } else {
+ WorldChooseGUI.letChoose(p, (template) -> {
+ if (template != null)
+ createWorld(p, worldname, f, new File(template.getPath()), sw);
+ else {
+ p.sendMessage(PluginConfig.getPrefix() + "§cError in config at \"worldtemplates.default\"");
+ p.sendMessage(PluginConfig.getPrefix() + "§cPlease contact an administrator");
+ }
+ });
+ }
+
+ } else {
+ p.sendMessage(MessageConfig.getInvalidInput().replaceAll("input", args.getArgument(0)));
+ return;
+ }
+ } else {
+ if (sw.isLoaded())
+ sw.directUnload(Bukkit.getWorld(worldname));
+
+ if (toConfirm.contains(p)) {
+ p.sendMessage(MessageConfig.getRequestAlreadySent());
+ return;
+ }
+
+ int time = PluginConfig.getRequestExpire();
+ p.sendMessage(MessageConfig.getConfirmRequest().replaceAll("%command", "/ws reset confirm"));
+ p.sendMessage(MessageConfig.getTimeUntilExpires().replaceAll("%time", String.valueOf(time)));
+ toConfirm.add(p);
+ Bukkit.getScheduler().runTaskLater(WorldSystem.getInstance(), () -> {
+ if (toConfirm.contains(p)) {
+ p.sendMessage(MessageConfig.getRequestExpired());
+ toConfirm.remove(p);
+ }
+ }, time * 20L);
+ }
+ }
+
+ @Command(name = "ws.sethome", inGameOnly = true, usage = "/ws sethome")
+ public void setHomeCommand(CommandArgs args) {
+ Player p = args.getSender(Player.class);
+
+ WorldPlayer wp = new WorldPlayer(p);
+ if (!wp.isOnSystemWorld()) {
+ p.sendMessage(MessageConfig.getNotOnWorld());
+ return;
+ }
+ if (!wp.isOwnerofWorld()) {
+ p.sendMessage(MessageConfig.getNoPermission());
+ return;
+ }
+ WorldConfig config = WorldConfig.getWorldConfig(p.getWorld().getName());
+ config.setHome(p.getLocation());
+ try {
+ config.save();
+ p.sendMessage(MessageConfig.getHomeSet());
+ } catch (IOException e) {
+ p.sendMessage(MessageConfig.getUnknownError() + ": " + e.getMessage());
+ e.printStackTrace();
+ }
+ }
+
+ @Command(name = "ws.tnt", inGameOnly = true, usage = "/ws tnt")
+ public void tntCommand(CommandArgs args) {
+ Player p = args.getSender(Player.class);
+
+ DependenceConfig dc = new DependenceConfig(p);
+ WorldConfig wc = WorldConfig.getWorldConfig(dc.getWorldname());
+ boolean tnt = wc.isTnt();
+ WorldToggleTntEvent event = new WorldToggleTntEvent(p, SystemWorld.getSystemWorld(dc.getWorldname()), tnt);
+ Bukkit.getPluginManager().callEvent(event);
+ if (event.isCancelled())
+ return;
+
+ wc.setTnt(p.getUniqueId(), !tnt);
+ try {
+ wc.save();
+ } catch (IOException e) {
+ p.sendMessage(PluginConfig.getPrefix() + "§cSomething went wrong");
+ e.printStackTrace();
+ }
+ tnt = wc.isTnt();
+ if (tnt) {
+ p.sendMessage(MessageConfig.getToggleTntEnabled());
+ } else {
+ p.sendMessage(MessageConfig.getToggleTntDisabled());
+ }
+ }
+
+ @Command(name = "ws.fire", inGameOnly = true, usage = "/ws fire")
+ public void fireCommand(CommandArgs args) {
+ Player p = args.getSender(Player.class);
+
+ DependenceConfig dc = new DependenceConfig(p);
+ WorldConfig wc = WorldConfig.getWorldConfig(dc.getWorldname());
+ boolean fire = wc.isFire();
+ WorldToggleFireEvent event = new WorldToggleFireEvent(p, SystemWorld.getSystemWorld(dc.getWorldname()), fire);
+ Bukkit.getPluginManager().callEvent(event);
+ if (event.isCancelled())
+ return;
+
+ wc.setFire(p.getUniqueId(), !fire);
+ try {
+ wc.save();
+ } catch (IOException e) {
+ p.sendMessage(PluginConfig.getPrefix() + "§cSomething went wrong");
+ e.printStackTrace();
+ }
+ fire = wc.isFire();
+ if (fire) {
+ p.sendMessage(MessageConfig.getToggleFireEnabled());
+ } else {
+ p.sendMessage(MessageConfig.getToggleFireDisabled());
+ }
+ }
+
+ private void createWorld(Player p, String worldname, File f, File exampleworld, SystemWorld sw) {
+
+ File[] files = f.listFiles();
+ for (File file : files) {
+ if (file.getName().equals("worldconfig.yml"))
+ continue;
+ FileUtils.deleteQuietly(file);
+ }
+
+ try {
+ if (exampleworld.isDirectory())
+ FileUtils.copyDirectory(exampleworld, f);
+ toConfirm.remove(p);
+
+ FileUtils.moveDirectoryToDirectory(f, Bukkit.getWorldContainer(), false);
+
+ WorldConfig config = WorldConfig.getWorldConfig(worldname);
+ config.setHome(null);
+ config.save();
+
+ p.sendMessage(MessageConfig.getWorldReseted());
+
+ // For fast worldcreating after reset
+ WorldCreator creator = new WorldCreator(worldname);
+ long seed = PluginConfig.getSeed();
+ World.Environment env = PluginConfig.getEnvironment();
+ WorldType type = PluginConfig.getWorldType();
+ if (seed != 0)
+ creator.seed(seed);
+ creator.type(type);
+ creator.environment(env);
+ String generator = PluginConfig.getGenerator();
+ if (!generator.trim().isEmpty())
+ creator.generator(generator);
+
+ sw.setCreating(true);
+ // For #16
+ WorldSystem.getInstance().getAdapter().create(creator, sw, () -> {
+ if (p != null && p.isOnline())
+ p.sendMessage(MessageConfig.getWorldCreated());
+ });
+
+ } catch (IOException e) {
+ e.printStackTrace();
+ p.sendMessage(MessageConfig.getUnknownError());
+ System.err.println("Couldn't reset world of " + p.getName());
+ }
+ }
+}
diff --git a/WorldSystem/src/main/java/de/butzlabben/world/config/MessageConfig.java b/WorldSystem/src/main/java/de/butzlabben/world/config/MessageConfig.java
index 24fd4d1..06690e3 100644
--- a/WorldSystem/src/main/java/de/butzlabben/world/config/MessageConfig.java
+++ b/WorldSystem/src/main/java/de/butzlabben/world/config/MessageConfig.java
@@ -1,279 +1,288 @@
-package de.butzlabben.world.config;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.nio.charset.Charset;
-import java.nio.file.Files;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.stream.Collectors;
-
-import org.bukkit.configuration.file.YamlConfiguration;
-import org.bukkit.plugin.java.JavaPlugin;
-
-import de.butzlabben.world.WorldSystem;
-import net.md_5.bungee.api.ChatColor;
-
-public class MessageConfig {
-
- private MessageConfig() {
- }
-
- private static List defaultCmdHelp = new ArrayList<>(20);
- {
- defaultCmdHelp.add("/ws get §8- §7Will give you a World");
- defaultCmdHelp.add("/ws home §8- §7Teleports you on your World");
- defaultCmdHelp.add("/ws sethome §8- §7Sets a specific home");
- defaultCmdHelp.add("/ws tp §8- §7Teleports you on a specific World");
- defaultCmdHelp.add("/ws addmember §8- §7Adds a player to your World");
- defaultCmdHelp.add("/ws delmember§8 - §7Removes a player from your World");
- defaultCmdHelp.add("/ws tnt §8- §7Allows/Denys TNT on your World");
- defaultCmdHelp.add("/ws fire §8- §7Allows/Denys Fire on your World");
- defaultCmdHelp.add("/ws togglechgm §8- §7Allows/Denys a player changing gamemode");
- defaultCmdHelp.add("/ws togglebuild §8- §7Allows/Denys a player building");
- defaultCmdHelp.add("/ws toggletp §8- §7Allows/Denys a player teleporting");
- defaultCmdHelp.add("/ws info §8- §7Shows information about the World");
- defaultCmdHelp.add("/ws reset §8- §7Will reset your World");
- }
-
- private static File file;
- // private static HashMap languages = new HashMap<>();
-
- public static void checkConfig(File f) {
- file = f;
- if (file.exists() == false) {
- try {
- InputStream in = JavaPlugin.getPlugin(WorldSystem.class).getResource(f.getName());
-
- if (in == null) {
- in = JavaPlugin.getPlugin(WorldSystem.class).getResource("custom.yml");
- }
- Files.copy(in, file.toPath());
- } catch (IOException e) {
- System.err.println("Wasn't able to create Config");
- e.printStackTrace();
- }
- }
- }
-
- private static YamlConfiguration getConfig() {
- try {
- return YamlConfiguration.loadConfiguration(new InputStreamReader(new FileInputStream(file), Charset.forName("UTF-8")));
- } catch (FileNotFoundException e) {
- e.printStackTrace();
- }
- return null;
- }
-
- private static String getRawMessage(String path, String alt) {
- return ChatColor.translateAlternateColorCodes('&', getConfig().getString(path, alt));
- }
-
- private static String getMessage(String path, String alt) {
- return PluginConfig.getPrefix() + getRawMessage(path, alt);
- }
-
- public static String getNoPermission() {
- return getMessage("nopermission", "§cYou don't have permissions!");
- }
-
- public static String getSettingUpWorld() {
- return getMessage("world.setting_up", "§aSetting up world...");
- }
-
- public static String getPlayerList() {
- return getMessage("world.playerlist", "Player in this world: %player");
- }
-
- public static String getLagDetection() {
- return getMessage("lagdetection", "Lagdetection in world from: §c%world");
- }
-
- public static String getWrongUsage() {
- return getMessage("wrong_usage", "§c%usage");
- }
-
- public static String getNoWorldOwn() {
- return getMessage("world.does_not_exists.own", "§cYou don't have a world!");
- }
-
- public static String getNoWorldOther() {
- return getMessage("world.does_not_exists.other", "§cThis player doesn't has a world!");
- }
-
- public static String getNotRegistered() {
- return getMessage("not_registered", "§cThis player hasn't joined yet!");
- }
-
- public static String getAlreadyMember() {
- return getMessage("member.already_added", "§cThis player is already a member!");
- }
-
- public static String getMemberAdded() {
- return getMessage("member.added", "You have added &c%player&6 to your World!");
- }
-
- public static String getUnknownError() {
- return getMessage("unknown_error", "§cSomething went wrong...");
- }
-
- public static String getDeleteWorldOwn() {
- return getMessage("world.delete.own", "§cYour world was deleted!");
- }
-
- public static String getDeleteWorldOther() {
- return getMessage("world.delete.other", "You deleted the world of §c%player§6!");
- }
-
- public static String getNoMemberOwn() {
- return getMessage("member.not_added.own", "§cThis player isn't a member!");
- }
-
- public static String getMemberRemoved() {
- return getMessage("member.removed", "You removed §c%player§6 from your world!");
- }
-
- public static String getNoMemberAdded() {
- return getMessage("member.no_one_added", "§cThere are no members added");
- }
-
- public static String getWorldAlreadyExists() {
- return getMessage("world.already_exists", "§cYou already have a world!");
- }
-
- public static String getWorldCreated() {
- return getMessage("world.created", "Your world is now ready. Get there with §a/ws home");
- }
-
- public static String getWorldStillCreating() {
- return getMessage("world.still_creating", "§cWorld is still creating");
- }
-
- public static String getNotOnWorld() {
- return getMessage("world.not_on", "§cYou are not on a world!");
- }
-
- public static String getWorldStillLoaded() {
- return getMessage("world.still_loaded", "§cYour world is still loaded!");
- }
-
- public static String getNoRequestSend() {
- return getMessage("request.not_sent", "§cYou didn't send a request!");
- }
-
- public static String getWorldReseted() {
- return getMessage("world.reseted", "Your world was reseted!");
- }
-
- public static String getInvalidInput() {
- return getMessage("request.invalid_input", "§c%input is not a valid input!");
- }
-
- public static String getRequestAlreadySent() {
- return getMessage("request.already_sent", "§cYou already sent a request!");
- }
-
- public static String getRequestExpired() {
- return getMessage("request.expired", "§cYou request is expired!");
- }
-
- public static String getTimeUntilExpires() {
- return getMessage("request.until_expire", "§cYour request expires in %time seconds!");
- }
-
- public static String getConfirmRequest() {
- return getMessage("request.confirm", "§cPlease confirm reset of your world: %command");
- }
-
- public static String getNoMemberOther() {
- return getMessage("member.not_added.other", "§cYou are not added to this world!");
- }
-
- public static String getInfoOwner() {
- return getMessage("info.owner", "Owner: %data");
- }
-
- public static String getInfoId() {
- return getMessage("info.id", "ID: %data");
- }
-
- public static String getInfoMember() {
- return getMessage("info.member", "Member: %data");
- }
-
- public static String getInfoTnt() {
- return getMessage("info.tnt", "TNT: %data");
- }
-
- public static String getInfoFire() {
- return getMessage("info.fire", "Fire: %data");
- }
-
- public static String getInfoEnabled() {
- return getRawMessage("info.enabled", "§aOn");
- }
-
- public static String getInfoDisabled() {
- return getRawMessage("info.disabled", "§cOff");
- }
-
- public static String getToggleGameModeEnabled() {
- return getMessage("toggle.gamemode.enabled", "§a%player§6 can now change his gamemode!");
- }
-
- public static String getToggleGameModeDisabled() {
- return getMessage("toggle.gamemode.disabled", "§c%player§6 can no longer change his gamemode!");
- }
-
- public static String getToggleTeleportEnabled() {
- return getMessage("toggle.teleport.enabled", "§a%player§6 can now teleport!");
- }
-
- public static String getToggleTeleportDisabled() {
- return getMessage("toggle.teleport.disabled", "§c%player§6 can no longer teleport!");
- }
-
- public static String getToggleBuildEnabled() {
- return getMessage("toggle.build.enabled", "§a%player§6 can now build!");
- }
-
- public static String getToggleBuildDisabled() {
- return getMessage("toggle.build.disabled", "§c%player§6 can no longer build!");
- }
-
- public static String getToggleFireEnabled() {
- return getMessage("toggle.fire.enabled", "§aYou activated fire!");
- }
-
- public static String getToggleFireDisabled() {
- return getMessage("toggle.fire.disabled", "§cYou deactivated fire!");
- }
-
- public static String getToggleTntEnabled() {
- return getMessage("toggle.tnt.enabled", "§aYou activated TNT-Damage!");
- }
-
- public static String getToggleTntDisabled() {
- return getMessage("toggle.tnt.disabled", "§cYou deactivated TNT-Damage!");
- }
-
- public static String getDeleteCommandHelp() {
- return getMessage("command_help.delete_command", "/ws delete §8- §7Will delete a World");
- }
-
- public static List getCommandHelp() {
- List list = getConfig().getStringList("command_help.list");
- if (list == null)
- list = defaultCmdHelp;
- list = list.stream().map(s -> ChatColor.translateAlternateColorCodes('&', s)).collect(Collectors.toList());
- return list;
- }
-
- public static String getHomeSet() {
- return getMessage("world.set_home", "You set the home");
- }
-}
+package de.butzlabben.world.config;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.nio.charset.Charset;
+import java.nio.file.Files;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.stream.Collectors;
+
+import org.bukkit.configuration.file.YamlConfiguration;
+import org.bukkit.plugin.java.JavaPlugin;
+
+import de.butzlabben.world.WorldSystem;
+import net.md_5.bungee.api.ChatColor;
+
+public class MessageConfig {
+
+ private MessageConfig() {
+ }
+
+ private static List defaultCmdHelp = new ArrayList<>(20);
+ {
+ defaultCmdHelp.add("/ws get §8- §7Will give you a World");
+ defaultCmdHelp.add("/ws home §8- §7Teleports you on your World");
+ defaultCmdHelp.add("/ws sethome §8- §7Sets a specific home");
+ defaultCmdHelp.add("/ws tp §8- §7Teleports you on a specific World");
+ defaultCmdHelp.add("/ws addmember §8- §7Adds a player to your World");
+ defaultCmdHelp.add("/ws delmember§8 - §7Removes a player from your World");
+ defaultCmdHelp.add("/ws tnt §8- §7Allows/Denys TNT on your World");
+ defaultCmdHelp.add("/ws fire §8- §7Allows/Denys Fire on your World");
+ defaultCmdHelp.add("/ws togglechgm §8- §7Allows/Denys a player changing gamemode");
+ defaultCmdHelp.add("/ws togglebuild §8- §7Allows/Denys a player building");
+ defaultCmdHelp.add("/ws toggletp §8- §7Allows/Denys a player teleporting");
+ defaultCmdHelp.add("/ws info §8- §7Shows information about the World");
+ defaultCmdHelp.add("/ws reset §8- §7Will reset your World");
+ }
+
+ private static File file;
+ // private static HashMap languages = new HashMap<>();
+
+ public static void checkConfig(File f) {
+ file = f;
+ if (file.exists() == false) {
+ try {
+ InputStream in = JavaPlugin.getPlugin(WorldSystem.class).getResource(f.getName());
+
+ if (in == null) {
+ in = JavaPlugin.getPlugin(WorldSystem.class).getResource("custom.yml");
+ }
+ Files.copy(in, file.toPath());
+ } catch (IOException e) {
+ System.err.println("Wasn't able to create Config");
+ e.printStackTrace();
+ }
+ }
+ }
+
+ private static YamlConfiguration getConfig() {
+ try {
+ return YamlConfiguration.loadConfiguration(new InputStreamReader(new FileInputStream(file), Charset.forName("UTF-8")));
+ } catch (FileNotFoundException e) {
+ e.printStackTrace();
+ }
+ return null;
+ }
+
+ private static String getRawMessage(String path, String alt) {
+ return ChatColor.translateAlternateColorCodes('&', getConfig().getString(path, alt));
+ }
+
+ private static String getMessage(String path, String alt) {
+ return PluginConfig.getPrefix() + getRawMessage(path, alt);
+ }
+
+ public static String getNoPermission() {
+ return getMessage("nopermission", "§cYou don't have permissions!");
+ }
+
+ public static String getSettingUpWorld() {
+ return getMessage("world.setting_up", "§aSetting up world...");
+ }
+
+ public static String getPlayerList() {
+ return getMessage("world.playerlist", "Player in this world: %player");
+ }
+
+ public static String getLagDetection() {
+ return getMessage("lagdetection", "Lagdetection in world from: §c%world");
+ }
+
+ public static String getWrongUsage() {
+ return getMessage("wrong_usage", "§c%usage");
+ }
+
+ public static String getNoWorldOwn() {
+ return getMessage("world.does_not_exists.own", "§cYou don't have a world!");
+ }
+
+ public static String getNoWorldOther() {
+ return getMessage("world.does_not_exists.other", "§cThis player doesn't has a world!");
+ }
+
+ public static String getNotRegistered() {
+ return getMessage("not_registered", "§cThis player hasn't joined yet!");
+ }
+
+ public static String getAlreadyMember() {
+ return getMessage("member.already_added", "§cThis player is already a member!");
+ }
+
+ public static String getMemberAdded() {
+ return getMessage("member.added", "You have added &c%player&6 to your World!");
+ }
+
+ public static String getUnknownError() {
+ return getMessage("unknown_error", "§cSomething went wrong...");
+ }
+
+ public static String getDeleteWorldOwn() {
+ return getMessage("world.delete.own", "§cYour world was deleted!");
+ }
+
+ public static String getDeleteWorldOther() {
+ return getMessage("world.delete.other", "You deleted the world of §c%player§6!");
+ }
+
+ public static String getNoMemberOwn() {
+ return getMessage("member.not_added.own", "§cThis player isn't a member!");
+ }
+
+ public static String getMemberRemoved() {
+ return getMessage("member.removed", "You removed §c%player§6 from your world!");
+ }
+
+ public static String getNoMemberAdded() {
+ return getMessage("member.no_one_added", "§cThere are no members added");
+ }
+
+ public static String getWorldAlreadyExists() {
+ return getMessage("world.already_exists", "§cYou already have a world!");
+ }
+
+ public static String getWorldCreated() {
+ return getMessage("world.created", "Your world is now ready. Get there with §a/ws home");
+ }
+
+ public static String getWorldStillCreating() {
+ return getMessage("world.still_creating", "§cWorld is still creating");
+ }
+
+ public static String getNotOnWorld() {
+ return getMessage("world.not_on", "§cYou are not on a world!");
+ }
+
+ public static String getWorldStillLoaded() {
+ return getMessage("world.still_loaded", "§cYour world is still loaded!");
+ }
+
+ public static String getNoRequestSend() {
+ return getMessage("request.not_sent", "§cYou didn't send a request!");
+ }
+
+ public static String getWorldReseted() {
+ return getMessage("world.reseted", "Your world was reseted!");
+ }
+
+ public static String getInvalidInput() {
+ return getMessage("request.invalid_input", "§c%input is not a valid input!");
+ }
+
+ public static String getRequestAlreadySent() {
+ return getMessage("request.already_sent", "§cYou already sent a request!");
+ }
+
+ public static String getRequestExpired() {
+ return getMessage("request.expired", "§cYou request is expired!");
+ }
+
+ public static String getTimeUntilExpires() {
+ return getMessage("request.until_expire", "§cYour request expires in %time seconds!");
+ }
+
+ public static String getConfirmRequest() {
+ return getMessage("request.confirm", "§cPlease confirm reset of your world: %command");
+ }
+
+ public static String getNoMemberOther() {
+ return getMessage("member.not_added.other", "§cYou are not added to this world!");
+ }
+
+ public static String getInfoOwner() {
+ return getMessage("info.owner", "Owner: %data");
+ }
+
+ public static String getInfoId() {
+ return getMessage("info.id", "ID: %data");
+ }
+
+ public static String getInfoMember() {
+ return getMessage("info.member", "Member: %data");
+ }
+
+ public static String getInfoTnt() {
+ return getMessage("info.tnt", "TNT: %data");
+ }
+
+ public static String getInfoFire() {
+ return getMessage("info.fire", "Fire: %data");
+ }
+
+ public static String getInfoEnabled() {
+ return getRawMessage("info.enabled", "§aOn");
+ }
+
+ public static String getInfoDisabled() {
+ return getRawMessage("info.disabled", "§cOff");
+ }
+
+ public static String getToggleGameModeEnabled() {
+ return getMessage("toggle.gamemode.enabled", "§a%player§6 can now change his gamemode!");
+ }
+
+ public static String getToggleGameModeDisabled() {
+ return getMessage("toggle.gamemode.disabled", "§c%player§6 can no longer change his gamemode!");
+ }
+
+ public static String getToggleTeleportEnabled() {
+ return getMessage("toggle.teleport.enabled", "§a%player§6 can now teleport!");
+ }
+
+ public static String getToggleTeleportDisabled() {
+ return getMessage("toggle.teleport.disabled", "§c%player§6 can no longer teleport!");
+ }
+
+ public static String getToggleBuildEnabled() {
+ return getMessage("toggle.build.enabled", "§a%player§6 can now build!");
+ }
+
+ public static String getToggleBuildDisabled() {
+ return getMessage("toggle.build.disabled", "§c%player§6 can no longer build!");
+ }
+
+ public static String getToggleWorldeditEnabled() {
+ return getMessage("toggle.worldedit.enabled", "§a%player§6 can now use WorldEdit!");
+ }
+
+ public static String getToggleWorldeditDisabled() {
+ return getMessage("toggle.worldedit.disabled", "§c%player§6 can no longer use WorldEdit!");
+ }
+
+
+ public static String getToggleFireEnabled() {
+ return getMessage("toggle.fire.enabled", "§aYou activated fire!");
+ }
+
+ public static String getToggleFireDisabled() {
+ return getMessage("toggle.fire.disabled", "§cYou deactivated fire!");
+ }
+
+ public static String getToggleTntEnabled() {
+ return getMessage("toggle.tnt.enabled", "§aYou activated TNT-Damage!");
+ }
+
+ public static String getToggleTntDisabled() {
+ return getMessage("toggle.tnt.disabled", "§cYou deactivated TNT-Damage!");
+ }
+
+ public static String getDeleteCommandHelp() {
+ return getMessage("command_help.delete_command", "/ws delete §8- §7Will delete a World");
+ }
+
+ public static List getCommandHelp() {
+ List list = getConfig().getStringList("command_help.list");
+ if (list == null)
+ list = defaultCmdHelp;
+ list = list.stream().map(s -> ChatColor.translateAlternateColorCodes('&', s)).collect(Collectors.toList());
+ return list;
+ }
+
+ public static String getHomeSet() {
+ return getMessage("world.set_home", "You set the home");
+ }
+}
diff --git a/WorldSystem/src/main/java/de/butzlabben/world/config/WorldConfig.java b/WorldSystem/src/main/java/de/butzlabben/world/config/WorldConfig.java
index e143dd9..9bea1d2 100644
--- a/WorldSystem/src/main/java/de/butzlabben/world/config/WorldConfig.java
+++ b/WorldSystem/src/main/java/de/butzlabben/world/config/WorldConfig.java
@@ -1,603 +1,583 @@
-package de.butzlabben.world.config;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.UUID;
-
-import org.bukkit.Bukkit;
-import org.bukkit.Location;
-import org.bukkit.OfflinePlayer;
-import org.bukkit.configuration.ConfigurationSection;
-import org.bukkit.configuration.file.YamlConfiguration;
-import org.bukkit.entity.Player;
-
-import com.google.common.collect.Sets;
-import com.mojang.authlib.GameProfile;
-
-import de.butzlabben.world.GameProfileBuilder;
-
-/**
- * This class represents a worldconfig.yml file Here you can edit and read all
- * things Get an instance via WorldConfig.getWorldConfig()
- *
- * @since 01.05.2018
- */
-public class WorldConfig {
-
- public static File getWorldFile(String worldname) {
- File worldconfig = new File(Bukkit.getWorldContainer(), worldname + "/worldconfig.yml");
- if (!worldconfig.exists()) {
- worldconfig = new File(PluginConfig.getWorlddir() + "/" + worldname + "/worldconfig.yml");
- }
- if (!worldconfig.exists()) {
- worldconfig = new File(worldname + "/worldconfig.yml");
- }
- return worldconfig;
- }
-
- /**
- * Returns wether a worldconfig exists for this worldname
- *
- * @param worldname
- * name of the world
- * @return Wether this world has a worldconfig
- */
- public static boolean exists(String worldname) {
- return getWorldFile(worldname).exists();
- }
-
- private static HashMap instances = new HashMap<>();
-
- /**
- * Gets the worldconfig for a specific worldname or creates a new one of no
- * exists
- *
- * @param worldname
- * of the world
- * @return WorldConfig of the world
- */
- public static WorldConfig getWorldConfig(String worldname) {
- if (!instances.containsKey(worldname))
- instances.put(worldname, new WorldConfig(worldname));
- return instances.get(worldname).load();
- }
-
- private final UUID owner;
- private final int id;
-
- private final HashMap> permissions = new HashMap<>();
-
- private String ownerName;
- private boolean fire, tnt;
-
- private Location home = null;
-
- private WorldConfig(String worldname) {
- if (exists(worldname) == false)
- throw new IllegalArgumentException("WorldConfig doesn't exist");
- owner = UUID.fromString(worldname.substring(worldname.length() - 36));
- id = Integer.parseInt(worldname.split("-")[0].substring(2));
- }
-
- public static void create(Player p) {
- DependenceConfig dc = new DependenceConfig(p);
- String worldname = dc.getWorldname();
- File file = new File(PluginConfig.getWorlddir() + worldname + "/worldconfig.yml");
- try {
- file.createNewFile();
- } catch (IOException e1) {
- e1.printStackTrace();
- System.err.println("Error while creating worldconfig for " + p.getUniqueId().toString());
- }
- YamlConfiguration cfg = YamlConfiguration.loadConfiguration(file);
- cfg.set("Informations.ID", dc.getID());
- cfg.set("Informations.Owner.PlayerUUID", p.getUniqueId().toString());
- cfg.set("Informations.Owner.Actualname", p.getName());
- cfg.set("Settings.TNTDamage", false);
- cfg.set("Settings.Fire", false);
- cfg.set("Members", null);
- try {
- cfg.save(file);
- } catch (IOException e) {
- e.printStackTrace();
- System.err.println("Error while saving worldconfig for " + p.getUniqueId().toString());
- }
- }
-
- /**
- * Add a permission to a player of this world
- *
- * @param player
- * who is edited
- * @param perm
- * which permission will be added
- * @return true if the permission was added, false if he already has the
- * permission
- */
- public boolean addPermission(UUID player, WorldPerm perm) {
- if (owner.equals(player))
- throw new IllegalArgumentException("Permissions of the owner cannot change");
- HashSet perms = permissions.get(player);
- if (perms == null) {
- perms = new HashSet<>();
- permissions.put(player, perms);
- }
- return perms.add(perm);
- }
-
- /**
- * Remove a permission from a player of this world
- *
- * @param player
- * who is edited
- * @param perm
- * which permission will be removed
- * @return true if the permission was removed, false if he doesn't have the
- * permission
- */
- public boolean removePermission(UUID player, WorldPerm perm) {
- if (owner.equals(player))
- throw new IllegalArgumentException("Permissions of the owner cannot change");
- HashSet perms = permissions.get(player);
- if (perms == null) {
- return false;
- }
- return perms.remove(perm);
- }
-
- /**
- * Remove all permissions from a player of this world
- *
- * @param player
- * who is edited
- * @return true if a permission was removed false otherwise
- */
- public boolean removeAllPermissions(UUID player) {
- if (owner.equals(player))
- throw new IllegalArgumentException("Permissions of the owner cannot change");
- HashSet perms = permissions.remove(player);
- return perms != null && perms.size() != 0;
- }
-
- /**
- * Add all permissions to a player of this world
- *
- * @param player
- * who is edited
- * @return true if the permissions of the player changed, false otherwiste
- */
- public boolean addAllPermissions(UUID player) {
- if (owner.equals(player))
- throw new IllegalArgumentException("Permissions of the owner cannot change");
- HashSet perms = permissions.get(player);
- if (perms == null) {
- perms = new HashSet<>();
- permissions.put(player, perms);
- }
- return perms.addAll(Sets.newHashSet(WorldPerm.values()));
- }
-
- /**
- * Checks the permission of a player
- *
- * @param player
- * who gets their permission checked
- * @param perm
- * to check
- * @return true if the player has the permission, false otherwise
- */
- public boolean hasPermission(UUID player, WorldPerm perm) {
- if (owner.equals(player))
- return true;
- HashSet perms = permissions.get(player);
- return perms != null && perms.contains(perm);
- }
-
- /**
- * Get all permissions of a player
- *
- * @param player
- * from who to get the permissions
- * @return all permissions for this player
- */
- public HashSet getPermissions(UUID player) {
- if (owner == player) {
- return Sets.newHashSet(WorldPerm.values());
- }
- HashSet perms = permissions.get(player);
- if (perms == null) {
- return Sets.newHashSet();
- }
- return Sets.newHashSet(perms);
- }
-
- /**
- * Adds a player to the world
- *
- * @param player
- * who gets added
- * @return true if the player was no member
- */
- public boolean addMember(UUID player) {
- return addPermission(player, WorldPerm.MEMBER);
- }
-
- /**
- * Try to add a player to the world
- *
- * @param player
- * who's permission gets checked
- * @param target
- * to add to the world
- * @return true if the player was successfully added
- */
- public boolean addMember(UUID player, UUID target) {
- if (hasPermission(player, WorldPerm.EDITMEMBERS)) {
- return addMember(target);
- }
- return false;
- }
-
- /**
- * @return the owner of this world
- */
- public UUID getOwner() {
- return owner;
- }
-
- /**
- * Is the player a member of this world
- *
- * @param player
- * to check
- * @return if the player is a member of this world
- */
- public boolean isMember(UUID player) {
- return hasPermission(player, WorldPerm.MEMBER);
- }
-
- /**
- * Removes a Member from this world
- *
- * @param player
- * to remove
- * @return if the player was a member of this world
- */
- public boolean removeMember(UUID player) {
- return removeAllPermissions(player);
- }
-
- /**
- * Try to remove a Member from this world
- *
- * @param player
- * who gets his permissions checked
- * @param target
- * to remove
- * @return if the player was a member of this world
- */
- public boolean removeMember(UUID player, UUID target) {
- if (hasPermission(player, WorldPerm.EDITMEMBERS) && hasPermission(player, WorldPerm.EDITMEMBERS) == false) {
- return removeMember(target);
- }
- return false;
- }
-
- /**
- * Checks wheater a player can build or not
- *
- * @param player
- * to check
- * @return if the can build or not
- */
- public boolean canBuild(UUID player) {
- return hasPermission(player, WorldPerm.BUILD);
- }
-
- /**
- * Allow or disallow a player to build on this world
- *
- * @param player
- * to edit
- * @param allowed
- * if he is allowed to build
- */
- public void setBuild(UUID player, boolean allowed) {
- if (allowed) {
- addPermission(player, WorldPerm.BUILD);
- } else {
- removePermission(player, WorldPerm.BUILD);
- }
- }
-
- /**
- * Allow or disallow a player to build with the permissions of a spefic
- * player
- *
- * @param player
- * who gets his permission checked
- * @param target
- * to allow or disallow
- * @param allowed
- * if he is allowed to build
- * @return if the player has the permissions
- */
- public boolean setBuild(UUID player, UUID target, boolean allowed) {
- if (isAllowedToAdministrateMember(player, target) == false)
- return false;
- setBuild(target, allowed);
- return true;
- }
-
- private boolean isAllowedToAdministrateMember(UUID player, UUID target) {
- return target != owner && player != target && hasPermission(player, WorldPerm.ADMINISTRATEMEMBERS)
- && hasPermission(player, WorldPerm.ADMINISTRATEMEMBERS);
- }
-
- /**
- * Checks wheater a player can build on this world or not
- *
- * @param player
- * to check
- * @return if the player can build
- */
- public boolean canGamemode(UUID player) {
- return hasPermission(player, WorldPerm.GAMEMODE);
- }
-
- /**
- * Allow or disallow a player to change his gamemode
- *
- * @param player
- * to allow or disallow
- * @param allowed
- * if he is allowed to change his gamemode or not
- */
- public void setGamemode(UUID player, boolean allowed) {
- if (allowed) {
- addPermission(player, WorldPerm.GAMEMODE);
- } else {
- removePermission(player, WorldPerm.GAMEMODE);
- }
- }
-
- public boolean setGamemode(UUID player, UUID target, boolean allowed) {
- if (isAllowedToAdministrateMember(player, target) == false)
- return false;
- setGamemode(target, allowed);
- return true;
- }
-
- public boolean canTeleport(UUID player) {
- return hasPermission(player, WorldPerm.TELEPORT);
- }
-
- /**
- * Allow or disallow a player to teleport
- *
- * @param player
- * to allow or disallow
- * @param allowed
- * if he is allowed to teleport or not
- */
- public void setTeleport(UUID player, boolean allowed) {
- if (allowed) {
- addPermission(player, WorldPerm.TELEPORT);
- } else {
- removePermission(player, WorldPerm.TELEPORT);
- }
- }
-
- public boolean setTeleport(UUID player, UUID target, boolean allowed) {
- if (isAllowedToAdministrateMember(player, target) == false)
- return false;
- setTeleport(target, allowed);
- return true;
- }
-
- public HashSet getMembers() {
- return Sets.newHashSet(permissions.keySet());
- }
-
- public HashMap getMembersWithNames() {
- HashMap map = new HashMap<>();
- for (UUID uuid : permissions.keySet()) {
- OfflinePlayer op = Bukkit.getOfflinePlayer(uuid);
- if (op == null || op.getName() == null) {
- if (PluginConfig.contactAuth()) {
- try {
- GameProfile prof = GameProfileBuilder.fetch(uuid);
- map.put(uuid, prof.getName());
- } catch (IOException e) {
- e.printStackTrace();
- }
- }
- } else
- map.put(uuid, op.getName());
- }
- return map;
- }
-
- public WorldConfig save() throws IOException {
- File file = getWorldFile(getWorldName());
- YamlConfiguration cfg = YamlConfiguration.loadConfiguration(file);
-
- cfg.set("Informations.ID", id);
- cfg.set("Informations.Owner.Actualname", ownerName);
- cfg.set("Informations.Owner.PlayerUUID", owner.toString());
- cfg.set("Settings.TNTDamage", tnt);
- cfg.set("Settings.Fire", fire);
-
- if (home != null) {
- cfg.set("Settings.home.x", home.getX());
- cfg.set("Settings.home.y", home.getY());
- cfg.set("Settings.home.z", home.getZ());
- cfg.set("Settings.home.yaw", home.getYaw());
- cfg.set("Settings.home.pitch", home.getPitch());
- } else {
- cfg.set("Settings.home", null);
- }
-
- cfg.set("Members", null);
-
- for (java.util.Map.Entry> entry : permissions.entrySet()) {
- ArrayList array = new ArrayList<>(entry.getValue().size());
- for (WorldPerm perm : entry.getValue()) {
- array.add(perm.name());
- }
- cfg.set("Members." + entry.getKey(), array);
- }
-
- cfg.save(file);
- return this;
- }
-
- private String getWorldName() {
- return "ID" + id + "-" + owner;
- }
-
- public WorldConfig load() {
- File file = getWorldFile(getWorldName());
- permissions.clear();
-
- YamlConfiguration cfg = YamlConfiguration.loadConfiguration(file);
- ownerName = cfg.getString("Informations.Owner.Actualname", "Unknown Playername");
- tnt = cfg.getBoolean("Settings.TNTDamage", true);
- fire = cfg.getBoolean("Settings.Fire", true);
-
- if (cfg.isSet("Settings.home")) {
- home = new Location(null, cfg.getDouble("Settings.home.x"), cfg.getDouble("Settings.home.y"),
- cfg.getDouble("Settings.home.z"), (float) cfg.getDouble("Settings.home.yaw"),
- (float) cfg.getDouble("Settings.home.pitch"));
- }
-
- if (membersOldFormatted(cfg)) {
- for (String s : cfg.getConfigurationSection("Members").getKeys(false)) {
- HashSet perms = new HashSet<>();
- perms.add(WorldPerm.MEMBER);
- if (cfg.getBoolean("Members." + s + ".Permissions.CanBuild"))
- perms.add(WorldPerm.BUILD);
- if (cfg.getBoolean("Members." + s + ".Permissions.CanTP"))
- perms.add(WorldPerm.TELEPORT);
- if (cfg.getBoolean("Members." + s + ".Permissions.CanBuild"))
- perms.add(WorldPerm.GAMEMODE);
- permissions.put(UUID.fromString(s), perms);
- }
- try {
- save();
- } catch (IOException e) {
- e.printStackTrace();
- }
- } else {
- ConfigurationSection section = cfg.getConfigurationSection("Members");
- if (section != null) {
- for (String suuid : section.getKeys(false)) {
- UUID uuid = UUID.fromString(suuid);
- List list = section.getStringList(suuid);
- HashSet perms = new HashSet<>(list.size());
- for (String perm : list) {
- perms.add(WorldPerm.valueOf(perm));
- }
- permissions.put(uuid, perms);
- }
- }
- }
- return this;
- }
-
- private boolean membersOldFormatted(YamlConfiguration cfg) {
- if (cfg.getConfigurationSection("Members") == null)
- return false;
- String name = cfg.getString(
- "Members." + cfg.getConfigurationSection("Members").getKeys(false).iterator().next() + ".Actualname");
- return name != null;
- }
-
- /**
- * @param loc the new home of the world
- */
- public void setHome(Location loc) {
- home = loc;
- }
-
- /**
- * @return the home of the world. If not set returns null
- */
- public Location getHome() {
- if (home == null)
- return null;
- return new Location(Bukkit.getWorld(getWorldName()), home.getX(), home.getY(), home.getZ(), home.getYaw(),
- home.getPitch());
- }
-
- public String getOwnerName() {
- return ownerName;
- }
-
- public void setOwnerName(String ownerName) {
- this.ownerName = ownerName;
- }
-
- public boolean isFire() {
- return fire;
- }
-
- public void setFire(boolean fire) {
- this.fire = fire;
- }
-
- /**
- * Allow or Disallow Fire Damage on this world
- *
- * @param player
- * the player which toggles fire
- * @param fire
- * if fire is enabled
- * @return if the player has the permissions to change the value
- */
- public boolean setFire(UUID player, boolean fire) {
- if (hasPermission(player, WorldPerm.ADMINISTRATEWORLD) == false)
- return false;
- setFire(fire);
- return true;
- }
-
- public boolean isTnt() {
- return tnt;
- }
-
- public void setTnt(boolean tnt) {
- this.tnt = tnt;
- }
-
- /**
- * Allow or Disallow TNT Damage on this world
- *
- * @param player
- * which toggles tnt
- * @param tnt
- * if tnt is enabled
- * @return if the player has the permissions to change the value
- */
- public boolean setTnt(UUID player, boolean tnt) {
- if (hasPermission(player, WorldPerm.ADMINISTRATEWORLD) == false)
- return false;
- setTnt(tnt);
- return true;
- }
-
- /**
- * Get the id of this world. The id is written in the filename at the xx
- * position: 'IDxx-uuid.yml'
- *
- * @return id of this world
- */
- public int getId() {
- return id;
- }
-
-}
+package de.butzlabben.world.config;
+
+import com.google.common.collect.Sets;
+import com.mojang.authlib.GameProfile;
+import de.butzlabben.world.GameProfileBuilder;
+import org.bukkit.Bukkit;
+import org.bukkit.Location;
+import org.bukkit.OfflinePlayer;
+import org.bukkit.configuration.ConfigurationSection;
+import org.bukkit.configuration.file.YamlConfiguration;
+import org.bukkit.entity.Player;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.*;
+
+/**
+ * This class represents a worldconfig.yml file Here you can edit and read all
+ * things Get an instance via WorldConfig.getWorldConfig()
+ *
+ * @since 01.05.2018
+ */
+public class WorldConfig {
+
+ public static File getWorldFile(String worldname) {
+ File worldconfig = new File(Bukkit.getWorldContainer(), worldname + "/worldconfig.yml");
+ if (!worldconfig.exists()) {
+ worldconfig = new File(PluginConfig.getWorlddir() + "/" + worldname + "/worldconfig.yml");
+ }
+ if (!worldconfig.exists()) {
+ worldconfig = new File(worldname + "/worldconfig.yml");
+ }
+ return worldconfig;
+ }
+
+ /**
+ * Returns wether a worldconfig exists for this worldname
+ *
+ * @param worldname name of the world
+ * @return Wether this world has a worldconfig
+ */
+ public static boolean exists(String worldname) {
+ return getWorldFile(worldname).exists();
+ }
+
+ private static HashMap instances = new HashMap<>();
+
+ /**
+ * Gets the worldconfig for a specific worldname or creates a new one of no
+ * exists
+ *
+ * @param worldname of the world
+ * @return WorldConfig of the world
+ */
+ public static WorldConfig getWorldConfig(String worldname) {
+ if (!instances.containsKey(worldname))
+ instances.put(worldname, new WorldConfig(worldname));
+ return instances.get(worldname).load();
+ }
+
+ private final UUID owner;
+ private final int id;
+
+ private final HashMap> permissions = new HashMap<>();
+
+ private String ownerName;
+ private boolean fire, tnt;
+
+ private Location home = null;
+
+ private WorldConfig(String worldname) {
+ if (exists(worldname) == false)
+ throw new IllegalArgumentException("WorldConfig doesn't exist");
+ owner = UUID.fromString(worldname.substring(worldname.length() - 36));
+ id = Integer.parseInt(worldname.split("-")[0].substring(2));
+ }
+
+ public static void create(Player p) {
+ DependenceConfig dc = new DependenceConfig(p);
+ String worldname = dc.getWorldname();
+ File file = new File(PluginConfig.getWorlddir() + worldname + "/worldconfig.yml");
+ try {
+ file.createNewFile();
+ } catch (IOException e1) {
+ e1.printStackTrace();
+ System.err.println("Error while creating worldconfig for " + p.getUniqueId().toString());
+ }
+ YamlConfiguration cfg = YamlConfiguration.loadConfiguration(file);
+ cfg.set("Informations.ID", dc.getID());
+ cfg.set("Informations.Owner.PlayerUUID", p.getUniqueId().toString());
+ cfg.set("Informations.Owner.Actualname", p.getName());
+ cfg.set("Settings.TNTDamage", false);
+ cfg.set("Settings.Fire", false);
+ cfg.set("Members", null);
+ try {
+ cfg.save(file);
+ } catch (IOException e) {
+ e.printStackTrace();
+ System.err.println("Error while saving worldconfig for " + p.getUniqueId().toString());
+ }
+ }
+
+ /**
+ * Add a permission to a player of this world
+ *
+ * @param player who is edited
+ * @param perm which permission will be added
+ * @return true if the permission was added, false if he already has the
+ * permission
+ */
+ public boolean addPermission(UUID player, WorldPerm perm) {
+ if (owner.equals(player))
+ throw new IllegalArgumentException("Permissions of the owner cannot change");
+ HashSet perms = permissions.get(player);
+ if (perms == null) {
+ perms = new HashSet<>();
+ permissions.put(player, perms);
+ }
+ return perms.add(perm);
+ }
+
+ /**
+ * Remove a permission from a player of this world
+ *
+ * @param player who is edited
+ * @param perm which permission will be removed
+ * @return true if the permission was removed, false if he doesn't have the
+ * permission
+ */
+ public boolean removePermission(UUID player, WorldPerm perm) {
+ if (owner.equals(player))
+ throw new IllegalArgumentException("Permissions of the owner cannot change");
+ HashSet perms = permissions.get(player);
+ if (perms == null) {
+ return false;
+ }
+ return perms.remove(perm);
+ }
+
+ /**
+ * Remove all permissions from a player of this world
+ *
+ * @param player who is edited
+ * @return true if a permission was removed false otherwise
+ */
+ public boolean removeAllPermissions(UUID player) {
+ if (owner.equals(player))
+ throw new IllegalArgumentException("Permissions of the owner cannot change");
+ HashSet perms = permissions.remove(player);
+ return perms != null && perms.size() != 0;
+ }
+
+ /**
+ * Add all permissions to a player of this world
+ *
+ * @param player who is edited
+ * @return true if the permissions of the player changed, false otherwiste
+ */
+ public boolean addAllPermissions(UUID player) {
+ if (owner.equals(player))
+ throw new IllegalArgumentException("Permissions of the owner cannot change");
+ HashSet perms = permissions.get(player);
+ if (perms == null) {
+ perms = new HashSet<>();
+ permissions.put(player, perms);
+ }
+ return perms.addAll(Sets.newHashSet(WorldPerm.values()));
+ }
+
+ /**
+ * Checks the permission of a player
+ *
+ * @param player who gets their permission checked
+ * @param perm to check
+ * @return true if the player has the permission, false otherwise
+ */
+ public boolean hasPermission(UUID player, WorldPerm perm) {
+ if (owner.equals(player))
+ return true;
+ HashSet perms = permissions.get(player);
+ return perms != null && perms.contains(perm);
+ }
+
+ /**
+ * Get all permissions of a player
+ *
+ * @param player from who to get the permissions
+ * @return all permissions for this player
+ */
+ public HashSet getPermissions(UUID player) {
+ if (owner == player) {
+ return Sets.newHashSet(WorldPerm.values());
+ }
+ HashSet perms = permissions.get(player);
+ if (perms == null) {
+ return Sets.newHashSet();
+ }
+ return Sets.newHashSet(perms);
+ }
+
+ /**
+ * Adds a player to the world
+ *
+ * @param player who gets added
+ * @return true if the player was no member
+ */
+ public boolean addMember(UUID player) {
+ return addPermission(player, WorldPerm.MEMBER);
+ }
+
+ /**
+ * Try to add a player to the world
+ *
+ * @param player who's permission gets checked
+ * @param target to add to the world
+ * @return true if the player was successfully added
+ */
+ public boolean addMember(UUID player, UUID target) {
+ if (hasPermission(player, WorldPerm.EDITMEMBERS)) {
+ return addMember(target);
+ }
+ return false;
+ }
+
+ /**
+ * @return the owner of this world
+ */
+ public UUID getOwner() {
+ return owner;
+ }
+
+ /**
+ * Is the player a member of this world
+ *
+ * @param player to check
+ * @return if the player is a member of this world
+ */
+ public boolean isMember(UUID player) {
+ return hasPermission(player, WorldPerm.MEMBER);
+ }
+
+ /**
+ * Removes a Member from this world
+ *
+ * @param player to remove
+ * @return if the player was a member of this world
+ */
+ public boolean removeMember(UUID player) {
+ return removeAllPermissions(player);
+ }
+
+ /**
+ * Try to remove a Member from this world
+ *
+ * @param player who gets his permissions checked
+ * @param target to remove
+ * @return if the player was a member of this world
+ */
+ public boolean removeMember(UUID player, UUID target) {
+ if (hasPermission(player, WorldPerm.EDITMEMBERS) && hasPermission(player, WorldPerm.EDITMEMBERS) == false) {
+ return removeMember(target);
+ }
+ return false;
+ }
+
+ /**
+ * Checks wheater a player can build or not
+ *
+ * @param player to check
+ * @return if the can build or not
+ */
+ public boolean canBuild(UUID player) {
+ return hasPermission(player, WorldPerm.BUILD);
+ }
+
+ /**
+ * Allow or disallow a player to build on this world
+ *
+ * @param player to edit
+ * @param allowed if he is allowed to build
+ */
+ public void setBuild(UUID player, boolean allowed) {
+ if (allowed) {
+ addPermission(player, WorldPerm.BUILD);
+ } else {
+ removePermission(player, WorldPerm.BUILD);
+ }
+ }
+
+ /**
+ * Allow or disallow a player to build with the permissions of a spefic
+ * player
+ *
+ * @param player who gets his permission checked
+ * @param target to allow or disallow
+ * @param allowed if he is allowed to build
+ * @return if the player has the permissions
+ */
+ public boolean setBuild(UUID player, UUID target, boolean allowed) {
+ if (isAllowedToAdministrateMember(player, target) == false)
+ return false;
+ setBuild(target, allowed);
+ return true;
+ }
+
+ private boolean isAllowedToAdministrateMember(UUID player, UUID target) {
+ return target != owner && player != target && hasPermission(player, WorldPerm.ADMINISTRATEMEMBERS)
+ && hasPermission(player, WorldPerm.ADMINISTRATEMEMBERS);
+ }
+
+ /**
+ * Checks wheater a player can build on this world or not
+ *
+ * @param player to check
+ * @return if the player can build
+ */
+ public boolean canGamemode(UUID player) {
+ return hasPermission(player, WorldPerm.GAMEMODE);
+ }
+
+ /**
+ * Allow or disallow a player to change his gamemode
+ *
+ * @param player to allow or disallow
+ * @param allowed if he is allowed to change his gamemode or not
+ */
+ public void setGamemode(UUID player, boolean allowed) {
+ if (allowed) {
+ addPermission(player, WorldPerm.GAMEMODE);
+ } else {
+ removePermission(player, WorldPerm.GAMEMODE);
+ }
+ }
+
+ public boolean setGamemode(UUID player, UUID target, boolean allowed) {
+ if (isAllowedToAdministrateMember(player, target) == false)
+ return false;
+ setGamemode(target, allowed);
+ return true;
+ }
+
+ public boolean canTeleport(UUID player) {
+ return hasPermission(player, WorldPerm.TELEPORT);
+ }
+
+ /**
+ * Allow or disallow a player to teleport
+ *
+ * @param player to allow or disallow
+ * @param allowed if he is allowed to teleport or not
+ */
+ public void setTeleport(UUID player, boolean allowed) {
+ if (allowed) {
+ addPermission(player, WorldPerm.TELEPORT);
+ } else {
+ removePermission(player, WorldPerm.TELEPORT);
+ }
+ }
+
+ public boolean setTeleport(UUID player, UUID target, boolean allowed) {
+ if (isAllowedToAdministrateMember(player, target) == false)
+ return false;
+ setTeleport(target, allowed);
+ return true;
+ }
+
+ public HashSet getMembers() {
+ return Sets.newHashSet(permissions.keySet());
+ }
+
+ public HashMap getMembersWithNames() {
+ HashMap map = new HashMap<>();
+ for (UUID uuid : permissions.keySet()) {
+ OfflinePlayer op = Bukkit.getOfflinePlayer(uuid);
+ if (op == null || op.getName() == null) {
+ if (PluginConfig.contactAuth()) {
+ try {
+ GameProfile prof = GameProfileBuilder.fetch(uuid);
+ map.put(uuid, prof.getName());
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+ } else
+ map.put(uuid, op.getName());
+ }
+ return map;
+ }
+
+ public WorldConfig save() throws IOException {
+ File file = getWorldFile(getWorldName());
+ YamlConfiguration cfg = YamlConfiguration.loadConfiguration(file);
+
+ cfg.set("Informations.ID", id);
+ cfg.set("Informations.Owner.Actualname", ownerName);
+ cfg.set("Informations.Owner.PlayerUUID", owner.toString());
+ cfg.set("Settings.TNTDamage", tnt);
+ cfg.set("Settings.Fire", fire);
+
+ if (home != null) {
+ cfg.set("Settings.home.x", home.getX());
+ cfg.set("Settings.home.y", home.getY());
+ cfg.set("Settings.home.z", home.getZ());
+ cfg.set("Settings.home.yaw", home.getYaw());
+ cfg.set("Settings.home.pitch", home.getPitch());
+ } else {
+ cfg.set("Settings.home", null);
+ }
+
+ cfg.set("Members", null);
+
+ for (java.util.Map.Entry> entry : permissions.entrySet()) {
+ ArrayList array = new ArrayList<>(entry.getValue().size());
+ for (WorldPerm perm : entry.getValue()) {
+ array.add(perm.name());
+ }
+ cfg.set("Members." + entry.getKey(), array);
+ }
+
+ cfg.save(file);
+ return this;
+ }
+
+ private String getWorldName() {
+ return "ID" + id + "-" + owner;
+ }
+
+ public WorldConfig load() {
+ File file = getWorldFile(getWorldName());
+ permissions.clear();
+
+ YamlConfiguration cfg = YamlConfiguration.loadConfiguration(file);
+ ownerName = cfg.getString("Informations.Owner.Actualname", "Unknown Playername");
+ tnt = cfg.getBoolean("Settings.TNTDamage", true);
+ fire = cfg.getBoolean("Settings.Fire", true);
+
+ if (cfg.isSet("Settings.home")) {
+ home = new Location(null, cfg.getDouble("Settings.home.x"), cfg.getDouble("Settings.home.y"),
+ cfg.getDouble("Settings.home.z"), (float) cfg.getDouble("Settings.home.yaw"),
+ (float) cfg.getDouble("Settings.home.pitch"));
+ }
+
+ if (membersOldFormatted(cfg)) {
+ for (String s : cfg.getConfigurationSection("Members").getKeys(false)) {
+ HashSet perms = new HashSet<>();
+ perms.add(WorldPerm.MEMBER);
+ if (cfg.getBoolean("Members." + s + ".Permissions.CanBuild"))
+ perms.add(WorldPerm.BUILD);
+ if (cfg.getBoolean("Members." + s + ".Permissions.CanTP"))
+ perms.add(WorldPerm.TELEPORT);
+ if (cfg.getBoolean("Members." + s + ".Permissions.CanBuild"))
+ perms.add(WorldPerm.GAMEMODE);
+ permissions.put(UUID.fromString(s), perms);
+ }
+ try {
+ save();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ } else {
+ ConfigurationSection section = cfg.getConfigurationSection("Members");
+ if (section != null) {
+ for (String suuid : section.getKeys(false)) {
+ UUID uuid = UUID.fromString(suuid);
+ List list = section.getStringList(suuid);
+ HashSet perms = new HashSet<>(list.size());
+ for (String perm : list) {
+ perms.add(WorldPerm.valueOf(perm));
+ }
+ permissions.put(uuid, perms);
+ }
+ }
+ }
+ return this;
+ }
+
+ private boolean membersOldFormatted(YamlConfiguration cfg) {
+ if (cfg.getConfigurationSection("Members") == null)
+ return false;
+ String name = cfg.getString(
+ "Members." + cfg.getConfigurationSection("Members").getKeys(false).iterator().next() + ".Actualname");
+ return name != null;
+ }
+
+ /**
+ * @param loc the new home of the world
+ */
+ public void setHome(Location loc) {
+ home = loc;
+ }
+
+ /**
+ * @return the home of the world. If not set returns null
+ */
+ public Location getHome() {
+ if (home == null)
+ return null;
+ return new Location(Bukkit.getWorld(getWorldName()), home.getX(), home.getY(), home.getZ(), home.getYaw(),
+ home.getPitch());
+ }
+
+ public String getOwnerName() {
+ return ownerName;
+ }
+
+ public void setOwnerName(String ownerName) {
+ this.ownerName = ownerName;
+ }
+
+ public boolean isFire() {
+ return fire;
+ }
+
+ public void setFire(boolean fire) {
+ this.fire = fire;
+ }
+
+ /**
+ * Allow or Disallow Fire Damage on this world
+ *
+ * @param player the player which toggles fire
+ * @param fire if fire is enabled
+ * @return if the player has the permissions to change the value
+ */
+ public boolean setFire(UUID player, boolean fire) {
+ if (hasPermission(player, WorldPerm.ADMINISTRATEWORLD) == false)
+ return false;
+ setFire(fire);
+ return true;
+ }
+
+ public boolean isTnt() {
+ return tnt;
+ }
+
+ public void setTnt(boolean tnt) {
+ this.tnt = tnt;
+ }
+
+ /**
+ * Allow or Disallow TNT Damage on this world
+ *
+ * @param player which toggles tnt
+ * @param tnt if tnt is enabled
+ * @return if the player has the permissions to change the value
+ */
+ public boolean setTnt(UUID player, boolean tnt) {
+ if (hasPermission(player, WorldPerm.ADMINISTRATEWORLD) == false)
+ return false;
+ setTnt(tnt);
+ return true;
+ }
+
+ /**
+ * Get the id of this world. The id is written in the filename at the xx
+ * position: 'IDxx-uuid.yml'
+ *
+ * @return id of this world
+ */
+ public int getId() {
+ return id;
+ }
+
+ public void setWorldEdit(UUID player, boolean allowed) {
+ if (allowed) {
+ addPermission(player, WorldPerm.WORLDEDIT);
+ } else {
+ removePermission(player, WorldPerm.WORLDEDIT);
+ }
+ }
+
+ public boolean setWorldEdit(UUID player, UUID target, boolean allowed) {
+ if (!isAllowedToAdministrateMember(player, target)) {
+ return false;
+ }
+ setWorldEdit(target, allowed);
+ return true;
+ }
+
+ public boolean canWorldEdit(UUID player) {
+ return hasPermission(player, WorldPerm.WORLDEDIT);
+ }
+}
diff --git a/WorldSystem/src/main/java/de/butzlabben/world/config/WorldPerm.java b/WorldSystem/src/main/java/de/butzlabben/world/config/WorldPerm.java
index 5c0369f..cd17722 100644
--- a/WorldSystem/src/main/java/de/butzlabben/world/config/WorldPerm.java
+++ b/WorldSystem/src/main/java/de/butzlabben/world/config/WorldPerm.java
@@ -1,23 +1,23 @@
-package de.butzlabben.world.config;
-
-public enum WorldPerm {
-
- MEMBER("ws.member"),
- GAMEMODE("ws.gamemode"), BUILD("ws.build"), TELEPORT("ws.teleport"),
- EDITMEMBERS("ws.edit"), ADMINISTRATEMEMBERS, ADMINISTRATEWORLD;
-
- private final String opPerm;
-
- WorldPerm() {
- this("ws.*");
- }
-
- WorldPerm(String opPerm) {
- this.opPerm = opPerm;
- }
-
- public String getOpPerm() {
- return opPerm;
- }
-
-}
+package de.butzlabben.world.config;
+
+public enum WorldPerm {
+
+ MEMBER("ws.member"),
+ GAMEMODE("ws.gamemode"), BUILD("ws.build"), TELEPORT("ws.teleport"),
+ EDITMEMBERS("ws.edit"), ADMINISTRATEMEMBERS, ADMINISTRATEWORLD, WORLDEDIT("ws.worldedit");
+
+ private final String opPerm;
+
+ WorldPerm() {
+ this("ws.*");
+ }
+
+ WorldPerm(String opPerm) {
+ this.opPerm = opPerm;
+ }
+
+ public String getOpPerm() {
+ return opPerm;
+ }
+
+}
diff --git a/WorldSystem/src/main/java/de/butzlabben/world/gui/PlayerOptionsGUI.java b/WorldSystem/src/main/java/de/butzlabben/world/gui/PlayerOptionsGUI.java
index 491c3a1..9eb797e 100644
--- a/WorldSystem/src/main/java/de/butzlabben/world/gui/PlayerOptionsGUI.java
+++ b/WorldSystem/src/main/java/de/butzlabben/world/gui/PlayerOptionsGUI.java
@@ -1,71 +1,73 @@
-package de.butzlabben.world.gui;
-
-import java.util.UUID;
-
-import org.bukkit.Bukkit;
-import org.bukkit.entity.Player;
-
-import de.butzlabben.inventory.DependListener;
-import de.butzlabben.inventory.OrcInventory;
-import de.butzlabben.inventory.OrcItem;
-import de.butzlabben.world.config.GuiConfig;
-import de.butzlabben.world.gui.clicklistener.ComingSoonClickListener;
-import de.butzlabben.world.gui.clicklistener.CommandExecutorClickListener;
-import de.butzlabben.world.gui.playeroption.BuildStatus;
-import de.butzlabben.world.gui.playeroption.GamemodeStatus;
-import de.butzlabben.world.gui.playeroption.TeleportStatus;
-import de.butzlabben.world.wrapper.WorldPlayer;
-
-public class PlayerOptionsGUI extends OrcInventory {
-
- private final static String path = "options.player.";
-
- public PlayerOptionsGUI(Player loader, String otherPlayer, UUID other) {
- super(GuiConfig.getTitle(GuiConfig.getConfig(), "options.player").replace("%player", otherPlayer), GuiConfig.getRows("options.player"), GuiConfig.isFill("options.player"));
- WorldPlayer wp = new WorldPlayer(Bukkit.getOfflinePlayer(other), loader.getWorld().getName());
- loadItem("build", "/ws togglebuild " + otherPlayer, new BuildStatus(wp));
- loadItem("gamemode", "/ws togglegm " + otherPlayer, new GamemodeStatus(wp));
- loadItem("teleport", "/ws toggletp " + otherPlayer, new TeleportStatus(wp));
- loadItem("time");
- loadItem("addmember");
- loadItem("delmember");
- loadItem("setpermissions");
- loadItem("administrateworld");
-
- if (GuiConfig.isEnabled(path + "back")) {
- OrcItem back = OrcItem.back.clone();
- back.setOnClick((p, inv, i) -> {
- p.closeInventory();
- PlayersPageGUI.openGUI(p);
- });
- addItem(GuiConfig.getSlot(path + "back"), back);
- }
- }
-
- public void loadItem(String subpath, String message, DependListener depend) {
- if (GuiConfig.isEnabled(path + subpath) == false)
- return;
- OrcItem item = GuiConfig.getItem(path + subpath);
- if (item != null) {
- if (message == null) {
- item.setOnClick(new ComingSoonClickListener());
- } else {
- item.setOnClick(new CommandExecutorClickListener(message));
- }
- addItem(GuiConfig.getSlot(path + subpath), item);
- if (depend == null) {
- addItem(GuiConfig.getState(path + subpath), OrcItem.coming_soon.clone());
- } else {
- addItem(GuiConfig.getState(path + subpath), OrcItem.disabled.clone().setDepend(depend));
- }
- }
- }
-
- public void loadItem(String subpath, String message) {
- loadItem(subpath, message, null);
- }
-
- public void loadItem(String subpath) {
- loadItem(subpath, null);
- }
-}
+package de.butzlabben.world.gui;
+
+import java.util.UUID;
+
+import de.butzlabben.world.gui.playeroption.WorldEditStatus;
+import org.bukkit.Bukkit;
+import org.bukkit.entity.Player;
+
+import de.butzlabben.inventory.DependListener;
+import de.butzlabben.inventory.OrcInventory;
+import de.butzlabben.inventory.OrcItem;
+import de.butzlabben.world.config.GuiConfig;
+import de.butzlabben.world.gui.clicklistener.ComingSoonClickListener;
+import de.butzlabben.world.gui.clicklistener.CommandExecutorClickListener;
+import de.butzlabben.world.gui.playeroption.BuildStatus;
+import de.butzlabben.world.gui.playeroption.GamemodeStatus;
+import de.butzlabben.world.gui.playeroption.TeleportStatus;
+import de.butzlabben.world.wrapper.WorldPlayer;
+
+public class PlayerOptionsGUI extends OrcInventory {
+
+ private final static String path = "options.player.";
+
+ public PlayerOptionsGUI(Player loader, String otherPlayer, UUID other) {
+ super(GuiConfig.getTitle(GuiConfig.getConfig(), "options.player").replace("%player", otherPlayer), GuiConfig.getRows("options.player"), GuiConfig.isFill("options.player"));
+ WorldPlayer wp = new WorldPlayer(Bukkit.getOfflinePlayer(other), loader.getWorld().getName());
+ loadItem("build", "/ws togglebuild " + otherPlayer, new BuildStatus(wp));
+ loadItem("gamemode", "/ws togglegm " + otherPlayer, new GamemodeStatus(wp));
+ loadItem("teleport", "/ws toggletp " + otherPlayer, new TeleportStatus(wp));
+ loadItem("worldedit", "/ws togglewe " + otherPlayer, new WorldEditStatus(wp));
+ loadItem("time");
+ loadItem("addmember");
+ loadItem("delmember");
+ loadItem("setpermissions");
+ loadItem("administrateworld");
+
+ if (GuiConfig.isEnabled(path + "back")) {
+ OrcItem back = OrcItem.back.clone();
+ back.setOnClick((p, inv, i) -> {
+ p.closeInventory();
+ PlayersPageGUI.openGUI(p);
+ });
+ addItem(GuiConfig.getSlot(path + "back"), back);
+ }
+ }
+
+ public void loadItem(String subpath, String message, DependListener depend) {
+ if (GuiConfig.isEnabled(path + subpath) == false)
+ return;
+ OrcItem item = GuiConfig.getItem(path + subpath);
+ if (item != null) {
+ if (message == null) {
+ item.setOnClick(new ComingSoonClickListener());
+ } else {
+ item.setOnClick(new CommandExecutorClickListener(message));
+ }
+ addItem(GuiConfig.getSlot(path + subpath), item);
+ if (depend == null) {
+ addItem(GuiConfig.getState(path + subpath), OrcItem.coming_soon.clone());
+ } else {
+ addItem(GuiConfig.getState(path + subpath), OrcItem.disabled.clone().setDepend(depend));
+ }
+ }
+ }
+
+ public void loadItem(String subpath, String message) {
+ loadItem(subpath, message, null);
+ }
+
+ public void loadItem(String subpath) {
+ loadItem(subpath, null);
+ }
+}
diff --git a/WorldSystem/src/main/java/de/butzlabben/world/gui/playeroption/WorldEditStatus.java b/WorldSystem/src/main/java/de/butzlabben/world/gui/playeroption/WorldEditStatus.java
new file mode 100644
index 0000000..a6e42ed
--- /dev/null
+++ b/WorldSystem/src/main/java/de/butzlabben/world/gui/playeroption/WorldEditStatus.java
@@ -0,0 +1,20 @@
+package de.butzlabben.world.gui.playeroption;
+
+import de.butzlabben.inventory.DependListener;
+import de.butzlabben.inventory.OrcItem;
+import de.butzlabben.world.wrapper.WorldPlayer;
+import org.bukkit.entity.Player;
+import org.bukkit.inventory.ItemStack;
+
+public class WorldEditStatus
+ implements DependListener {
+ private final WorldPlayer wp;
+
+ public WorldEditStatus(WorldPlayer wp) {
+ this.wp = wp;
+ }
+
+ public ItemStack getItemStack(Player p, WorldPlayer player) {
+ return this.wp.canWorldedit() ? OrcItem.enabled.getItemStack(p, this.wp) : OrcItem.disabled.getItemStack(p, this.wp);
+ }
+}
diff --git a/WorldSystem/src/main/java/de/butzlabben/world/listener/WorldEditListener.java b/WorldSystem/src/main/java/de/butzlabben/world/listener/WorldEditListener.java
new file mode 100644
index 0000000..2dd11b1
--- /dev/null
+++ b/WorldSystem/src/main/java/de/butzlabben/world/listener/WorldEditListener.java
@@ -0,0 +1,43 @@
+package de.butzlabben.world.listener;
+
+import com.sk89q.worldedit.bukkit.WorldEditPlugin;
+import de.butzlabben.world.config.MessageConfig;
+import de.butzlabben.world.config.WorldConfig;
+import de.butzlabben.world.config.WorldPerm;
+import de.butzlabben.world.wrapper.WorldPlayer;
+import org.bukkit.Bukkit;
+import org.bukkit.entity.Player;
+import org.bukkit.event.EventHandler;
+import org.bukkit.event.Listener;
+import org.bukkit.event.player.PlayerCommandPreprocessEvent;
+
+public class WorldEditListener implements Listener {
+
+ @EventHandler
+ public void playerCommandHandler(PlayerCommandPreprocessEvent event) {
+ String command = event.getMessage().split(" ")[0];
+ if (!isWorldEditCommand(command)) {
+ return;
+ }
+ Player p = event.getPlayer();
+ String worldname = p.getWorld().getName();
+ WorldPlayer wp = new WorldPlayer(p, worldname);
+ if ((wp.isOnSystemWorld()) &&
+ (!wp.isOwnerofWorld()) && (!p.hasPermission(WorldPerm.WORLDEDIT.getOpPerm()))) {
+ WorldConfig wc = WorldConfig.getWorldConfig(p.getWorld().getName());
+ if (!wc.hasPermission(p.getUniqueId(), WorldPerm.WORLDEDIT)) {
+ p.sendMessage(MessageConfig.getNoPermission());
+ event.setCancelled(true);
+ }
+ }
+ }
+
+ private boolean isWorldEditCommand(String command) {
+ if (command.startsWith("/")) {
+ command = command.replaceFirst("/", "");
+ }
+ command = command.toLowerCase();
+ return ((WorldEditPlugin) Bukkit.getPluginManager().getPlugin("WorldEdit")).getWorldEdit().getPlatformManager()
+ .getCommandManager().getDispatcher().get(command) != null;
+ }
+}
diff --git a/WorldSystem/src/main/java/de/butzlabben/world/wrapper/WorldPlayer.java b/WorldSystem/src/main/java/de/butzlabben/world/wrapper/WorldPlayer.java
index 85abbd8..199eab5 100644
--- a/WorldSystem/src/main/java/de/butzlabben/world/wrapper/WorldPlayer.java
+++ b/WorldSystem/src/main/java/de/butzlabben/world/wrapper/WorldPlayer.java
@@ -1,196 +1,218 @@
-package de.butzlabben.world.wrapper;
-
-import java.io.File;
-import java.io.IOException;
-
-import org.bukkit.Bukkit;
-import org.bukkit.OfflinePlayer;
-import org.bukkit.configuration.file.YamlConfiguration;
-import org.bukkit.entity.Player;
-
-import com.google.common.base.Preconditions;
-
-import de.butzlabben.world.config.PluginConfig;
-import de.butzlabben.world.config.WorldConfig;
-
-/**
- * This class represents a player, on a systemworld or not but be carefull when
- * accesing some methods when the player is not on a systemworld like
- * toggleBuild()
- *
- * @author Butzlabben
- * @since 15.03.2018
- */
-public class WorldPlayer {
-
- private OfflinePlayer p;
- private String worldname;
-
- /**
- * @return the worldname, where the worldplayer object was created for
- */
- public String getWorldname() {
- return worldname;
- }
-
- /**
- * toggles building for this player
- *
- * @return whether can build or not
- */
- public boolean toggleBuild() {
- Preconditions.checkArgument(isOnSystemWorld(), "player must be for this on a systemworld");
-
- WorldConfig wc = WorldConfig.getWorldConfig(worldname);
- if (!wc.isMember(p.getUniqueId()))
- return false;
-
- boolean build = wc.canBuild(p.getUniqueId());
- build = !build;
- wc.setBuild(p.getUniqueId(), build);
- try {
- wc.save();
- } catch (IOException e) {
- e.printStackTrace();
- }
- return build;
- }
-
- /**
- * @return whether can build or not
- */
- public boolean canBuild() {
- Preconditions.checkArgument(isOnSystemWorld(), "player must be for this on a systemworld");
- WorldConfig wc = WorldConfig.getWorldConfig(worldname);
- return wc.canBuild(p.getUniqueId());
- }
-
- /**
- * toggles teleporting for this player
- *
- * @return whether can teleport or not
- */
- public boolean toggleTeleport() {
- Preconditions.checkArgument(isOnSystemWorld(), "player must be for this on a systemworld");
-
- WorldConfig wc = WorldConfig.getWorldConfig(worldname);
- if (!wc.isMember(p.getUniqueId()))
- return false;
-
- boolean teleport = wc.canTeleport(p.getUniqueId());
- teleport = !teleport;
- wc.setTeleport(p.getUniqueId(), teleport);
- try {
- wc.save();
- } catch (IOException e) {
- e.printStackTrace();
- }
- return teleport;
- }
-
- /**
- * @return whether can teleport or not
- */
- public boolean canTeleport() {
- Preconditions.checkArgument(isOnSystemWorld(), "player must be for this on a systemworld");
- WorldConfig wc = WorldConfig.getWorldConfig(worldname);
- return wc.canTeleport(p.getUniqueId());
- }
-
- /**
- * toggles gamemode changing for this player
- *
- * @return whether can change his gamemode or not
- */
- public boolean toggleGamemode() {
- Preconditions.checkArgument(isOnSystemWorld(), "player must be for this on a systemworld");
-
- WorldConfig wc = WorldConfig.getWorldConfig(worldname);
- if (!wc.isMember(p.getUniqueId()))
- return false;
-
- boolean changeGamemode = wc.canGamemode(p.getUniqueId());
- changeGamemode = !changeGamemode;
- wc.setGamemode(p.getUniqueId(), changeGamemode);
- try {
- wc.save();
- } catch (IOException e) {
- e.printStackTrace();
- }
- return changeGamemode;
- }
-
- /**
- * @return whether can change his gamemode or not
- */
- public boolean canChangeGamemode() {
- Preconditions.checkArgument(isOnSystemWorld(), "player must be for this on a systemworld");
- WorldConfig wc = WorldConfig.getWorldConfig(worldname);
- return wc.canGamemode(p.getUniqueId());
- }
-
- /**
- * @return if he is a member
- */
- public boolean isMember() {
- Preconditions.checkArgument(isOnSystemWorld(), "player must be for this on a systemworld");
-
- WorldConfig wc = WorldConfig.getWorldConfig(worldname);
- return wc.isMember(p.getUniqueId());
- }
-
- public WorldPlayer(OfflinePlayer p, String worldname) {
- this.p = p;
- this.worldname = worldname;
- }
-
- public WorldPlayer(Player p) {
- this(p, p.getWorld().getName());
- }
-
- /**
- * @return if he is on a systemworld or not
- */
- public boolean isOnSystemWorld() {
- File worldconfig = new File(Bukkit.getWorldContainer(), worldname + "/worldconfig.yml");
- if (!worldconfig.exists()) {
- worldconfig = new File(PluginConfig.getWorlddir() + worldname + "/worldconfig.yml");
- }
- if (worldconfig.exists()) {
- YamlConfiguration cfg = YamlConfiguration.loadConfiguration(worldconfig);
- if (cfg.getString("Informations.Owner.PlayerUUID") == null) {
- return false;
- }
- return true;
- }
- return false;
- }
-
- /**
- * @return the given player
- */
- public OfflinePlayer getPlayer() {
- return p;
- }
-
- /**
- * @return if he ist the owner
- */
- public boolean isOwnerofWorld() {
- if (!isOnSystemWorld())
- return false;
- WorldConfig wc = WorldConfig.getWorldConfig(worldname);
- return wc.getOwner().equals(p.getUniqueId());
- }
-
- /**
- * @param worldname
- * of the world to be tested
- * @return worldname if he is the owner of the specified world
- */
- public boolean isMemberofWorld(String worldname) {
- WorldConfig wc = WorldConfig.getWorldConfig(worldname);
- return wc.isMember(p.getUniqueId());
- }
-
-}
+package de.butzlabben.world.wrapper;
+
+import com.google.common.base.Preconditions;
+import de.butzlabben.world.config.PluginConfig;
+import de.butzlabben.world.config.WorldConfig;
+import org.bukkit.Bukkit;
+import org.bukkit.OfflinePlayer;
+import org.bukkit.configuration.file.YamlConfiguration;
+import org.bukkit.entity.Player;
+
+import java.io.File;
+import java.io.IOException;
+
+/**
+ * This class represents a player, on a systemworld or not but be carefull when
+ * accesing some methods when the player is not on a systemworld like
+ * toggleBuild()
+ *
+ * @author Butzlabben
+ * @since 15.03.2018
+ */
+public class WorldPlayer {
+
+ private OfflinePlayer p;
+ private String worldname;
+
+ /**
+ * @return the worldname, where the worldplayer object was created for
+ */
+ public String getWorldname() {
+ return worldname;
+ }
+
+ /**
+ * toggles building for this player
+ *
+ * @return whether can build or not
+ */
+ public boolean toggleBuild() {
+ Preconditions.checkArgument(isOnSystemWorld(), "player must be for this on a systemworld");
+
+ WorldConfig wc = WorldConfig.getWorldConfig(worldname);
+ if (!wc.isMember(p.getUniqueId()))
+ return false;
+
+ boolean build = wc.canBuild(p.getUniqueId());
+ build = !build;
+ wc.setBuild(p.getUniqueId(), build);
+ try {
+ wc.save();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ return build;
+ }
+
+ /**
+ * @return whether can build or not
+ */
+ public boolean canBuild() {
+ Preconditions.checkArgument(isOnSystemWorld(), "player must be for this on a systemworld");
+ WorldConfig wc = WorldConfig.getWorldConfig(worldname);
+ return wc.canBuild(p.getUniqueId());
+ }
+
+ public boolean toggleWorldEdit() {
+ Preconditions.checkArgument(isOnSystemWorld(), "player must be for this on a systemworld");
+
+ WorldConfig wc = WorldConfig.getWorldConfig(this.worldname);
+ if (!wc.isMember(this.p.getUniqueId())) {
+ return false;
+ }
+ boolean build = wc.canWorldEdit(this.p.getUniqueId());
+ build = !build;
+ wc.setWorldEdit(this.p.getUniqueId(), build);
+ try {
+ wc.save();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ return build;
+ }
+
+ public boolean canWorldedit() {
+ Preconditions.checkArgument(isOnSystemWorld(), "player must be for this on a systemworld");
+ WorldConfig wc = WorldConfig.getWorldConfig(this.worldname);
+ return wc.canWorldEdit(this.p.getUniqueId());
+ }
+
+
+ /**
+ * toggles teleporting for this player
+ *
+ * @return whether can teleport or not
+ */
+ public boolean toggleTeleport() {
+ Preconditions.checkArgument(isOnSystemWorld(), "player must be for this on a systemworld");
+
+ WorldConfig wc = WorldConfig.getWorldConfig(worldname);
+ if (!wc.isMember(p.getUniqueId()))
+ return false;
+
+ boolean teleport = wc.canTeleport(p.getUniqueId());
+ teleport = !teleport;
+ wc.setTeleport(p.getUniqueId(), teleport);
+ try {
+ wc.save();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ return teleport;
+ }
+
+ /**
+ * @return whether can teleport or not
+ */
+ public boolean canTeleport() {
+ Preconditions.checkArgument(isOnSystemWorld(), "player must be for this on a systemworld");
+ WorldConfig wc = WorldConfig.getWorldConfig(worldname);
+ return wc.canTeleport(p.getUniqueId());
+ }
+
+ /**
+ * toggles gamemode changing for this player
+ *
+ * @return whether can change his gamemode or not
+ */
+ public boolean toggleGamemode() {
+ Preconditions.checkArgument(isOnSystemWorld(), "player must be for this on a systemworld");
+
+ WorldConfig wc = WorldConfig.getWorldConfig(worldname);
+ if (!wc.isMember(p.getUniqueId()))
+ return false;
+
+ boolean changeGamemode = wc.canGamemode(p.getUniqueId());
+ changeGamemode = !changeGamemode;
+ wc.setGamemode(p.getUniqueId(), changeGamemode);
+ try {
+ wc.save();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ return changeGamemode;
+ }
+
+ /**
+ * @return whether can change his gamemode or not
+ */
+ public boolean canChangeGamemode() {
+ Preconditions.checkArgument(isOnSystemWorld(), "player must be for this on a systemworld");
+ WorldConfig wc = WorldConfig.getWorldConfig(worldname);
+ return wc.canGamemode(p.getUniqueId());
+ }
+
+ /**
+ * @return if he is a member
+ */
+ public boolean isMember() {
+ Preconditions.checkArgument(isOnSystemWorld(), "player must be for this on a systemworld");
+
+ WorldConfig wc = WorldConfig.getWorldConfig(worldname);
+ return wc.isMember(p.getUniqueId());
+ }
+
+ public WorldPlayer(OfflinePlayer p, String worldname) {
+ this.p = p;
+ this.worldname = worldname;
+ }
+
+ public WorldPlayer(Player p) {
+ this(p, p.getWorld().getName());
+ }
+
+ /**
+ * @return if he is on a systemworld or not
+ */
+ public boolean isOnSystemWorld() {
+ File worldconfig = new File(Bukkit.getWorldContainer(), worldname + "/worldconfig.yml");
+ if (!worldconfig.exists()) {
+ worldconfig = new File(PluginConfig.getWorlddir() + worldname + "/worldconfig.yml");
+ }
+ if (worldconfig.exists()) {
+ YamlConfiguration cfg = YamlConfiguration.loadConfiguration(worldconfig);
+ if (cfg.getString("Informations.Owner.PlayerUUID") == null) {
+ return false;
+ }
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * @return the given player
+ */
+ public OfflinePlayer getPlayer() {
+ return p;
+ }
+
+ /**
+ * @return if he ist the owner
+ */
+ public boolean isOwnerofWorld() {
+ if (!isOnSystemWorld())
+ return false;
+ WorldConfig wc = WorldConfig.getWorldConfig(worldname);
+ return wc.getOwner().equals(p.getUniqueId());
+ }
+
+ /**
+ * @param worldname of the world to be tested
+ * @return worldname if he is the owner of the specified world
+ */
+ public boolean isMemberofWorld(String worldname) {
+ WorldConfig wc = WorldConfig.getWorldConfig(worldname);
+ return wc.isMember(p.getUniqueId());
+ }
+
+}
diff --git a/WorldSystem/src/main/resources/1_13_gui.yml b/WorldSystem/src/main/resources/1_13_gui.yml
index 7489770..2cdee84 100644
--- a/WorldSystem/src/main/resources/1_13_gui.yml
+++ b/WorldSystem/src/main/resources/1_13_gui.yml
@@ -1,306 +1,300 @@
-#
-# Config for the GUI "/gui"
-# Counting for rows and columns starts always at 1
-#
-
-options:
- # How the enabled item should look like
- enabled:
- # Material name in the Material enum
- material: LIME_DYE
- # Displayname
- display: '&aEnabled'
-
- # How the disabled item should look like
- disabled:
- material: ROSE_RED
- display: '&cDisabled'
-
- # How the comming-soon item should look like
- coming_soon:
- material: ORANGE_DYE
- display: '&6Coming soon...'
-
- # How the back item should look like
- back:
- material: BARRIER
- display: '&cBack'
-
- # When filling of an inventory is true, how the item should look like
- fill:
- material: GRAY_STAINED_GLASS_PANE
- display: ''
-
- # WorldoptionsGUI
- world:
- fill: false
- # What the title of the Inv should be
- title: 'World Options'
-
- # Rows
- rows: 3
-
- # Where the back item should be
- back:
- enabled: true
- slot:
- row: 3
- col: 5
-
- # Reset button
- reset:
- # If feature should be enabled or not
- enabled: true
- slot:
- row: 1
- col: 8
- material: DIAMOND_HOE
- data: 0
- display: '&eReset World'
-
- # Fire button
- fire:
- enabled: true
- slot:
- row: 1
- col: 2
- # Where the state item should be
- state:
- row: 2
- col: 2
- material: FLINT_AND_STEEL
- display: '&eToggle Fire'
-
- # TNT button
- tnt:
- enabled: true
- slot:
- row: 1
- col: 5
- state:
- row: 2
- col: 5
- material: TNT
- display: '&eToggle TNT-Explosion'
-
- back:
- enabled: true
- slot:
- row: 3
- col: 5
-
- players:
- title: 'Players added to this world'
-
- back:
- enabled: true
- slot:
- row: 6
- col: 6
-
- rows: 6
-
- nextpage:
- enabled: true
- slot:
- row: 6
- col: 8
- material: PAPER
- display: '&eNext Page'
- pagebefore:
- enabled: true
- slot:
- row: 6
- col: 2
- material: PAPER
- display: '&ePage before'
- currentpage:
- enabled: true
- slot:
- row: 6
- col: 4
- material: SUNFLOWER
- display: '&eCurrent page: &a%page'
-
- playerhead:
- material: PLAYER_HEAD
- display: '&e%player'
-
- # PlayerGUI for managing one player on a world
- player:
- fill: false
- title: 'Player options for %player'
-
- back:
- slot:
- enabled: true
- row: 3
- col: 5
-
- rows: 3
-
- build:
- enabled: true
- slot:
- row: 1
- col: 1
- state:
- row: 2
- col: 1
- material: GOLDEN_AXE
- display: '&eToggle Build-Permission'
- lore:
- - '&7Toggles the permission for a player'
- - '&7To build on this world'
- gamemode:
- enabled: true
- slot:
- row: 1
- col: 2
- state:
- row: 2
- col: 2
- material: END_CRYSTAL
- display: '&eToggle GameMode-Permission'
- lore:
- - '&7Toggles the permission for a player'
- - '&7To change the GameMode on this world'
- teleport:
- enabled: true
- slot:
- row: 1
- col: 3
- state:
- row: 2
- col: 3
- material: COMPASS
- display: '&eToggle Teleport-Permission'
- lore:
- - '&7Toggles the permission for a player'
- - '&7To teleport on this world'
- time:
- enabled: false
- slot:
- row: 1
- col: 4
- state:
- row: 2
- col: 4
- material: 347
- display: '&eToggle Time-Permission'
- lore:
- - '&7Toggles the permission for a player'
- - '&7To change the time on this world'
- addmember:
- enabled: false
- slot:
- row: 1
- col: 6
- state:
- row: 2
- col: 6
- material: 399
- display: '&eToggle Addmember-Permission'
- lore:
- - '&7Toggles the permission for a player'
- - '&7To add a member to this world'
- delmember:
- enabled: false
- slot:
- row: 1
- col: 6
- state:
- row: 2
- col: 6
- material: 286
- display: '&eToggle Delmember-Permission'
- lore:
- - '&7Toggles the permission for a player'
- - '&7To remove a member from this world'
- setpermissions:
- enabled: false
- slot:
- row: 1
- col: 8
- state:
- row: 2
- col: 8
- material: 331
- display: '&eToggle Setpermissions-Permission'
- lore:
- - '&7Toggles the permission for a player'
- - '&7To set permissions for a member of this world'
- administrateworld:
- enabled: false
- slot:
- row: 1
- col: 9
- state:
- row: 2
- col: 9
- material: 421
- display: '&eToggle Addmember-Permission'
- lore:
- - '&7Toggles the permission for a player'
- - '&7To adminstrate this world'
-
-# WorldsystemGUI
-worldsystem:
- fill: false
- title: 'WorldSystem'
-
- rows: 1
-
- back:
- slot:
- enabled: true
- row: 1
- col: 5
-
- playeroptions:
- enabled: true
- slot:
- row: 1
- col: 1
- material: LEATHER_HELMET
- display: '&ePlayer Options'
- worldoptions:
- enabled: true
- slot:
- row: 1
- col: 9
- material: GRASS_BLOCK
- display: '&eWorld Options'
-
-# GUI for choosing world template
-worldchoose:
- fill: false
- title: 'Choose world template'
-
- back:
- enabled: true
- slot:
- row: 4
- col: 5
-
- rows: 4
-
- # The key must be named exactly as in the config.yml
- template_default:
- enabled: true
- slot:
- row: 2
- col: 3
- material: GRASS_BLOCK
- display: '&aDefault template'
-
- another_template:
- enabled: true
- slot:
- row: 2
- col: 7
- material: STONE_BLOCK
- display: '&aAnother template'
-
-
+#
+# Config for the GUI "/gui"
+# Counting for rows and columns starts always at 1
+#
+
+options:
+ # How the enabled item should look like
+ enabled:
+ # Material name in the Material enum
+ material: LIME_DYE
+ # Displayname
+ display: '&aEnabled'
+
+ # How the disabled item should look like
+ disabled:
+ material: ROSE_RED
+ display: '&cDisabled'
+
+ # How the comming-soon item should look like
+ coming_soon:
+ material: ORANGE_DYE
+ display: '&6Coming soon...'
+
+ # How the back item should look like
+ back:
+ material: BARRIER
+ display: '&cBack'
+
+ # When filling of an inventory is true, how the item should look like
+ fill:
+ material: GRAY_STAINED_GLASS_PANE
+ display: ''
+
+ # WorldoptionsGUI
+ world:
+ fill: false
+ # What the title of the Inv should be
+ title: 'World Options'
+
+ # Rows
+ rows: 3
+
+ # Where the back item should be
+ back:
+ enabled: true
+ slot:
+ row: 3
+ col: 5
+
+ # Reset button
+ reset:
+ # If feature should be enabled or not
+ enabled: true
+ slot:
+ row: 1
+ col: 8
+ material: DIAMOND_HOE
+ data: 0
+ display: '&eReset World'
+
+ # Fire button
+ fire:
+ enabled: true
+ slot:
+ row: 1
+ col: 2
+ # Where the state item should be
+ state:
+ row: 2
+ col: 2
+ material: FLINT_AND_STEEL
+ display: '&eToggle Fire'
+
+ # TNT button
+ tnt:
+ enabled: true
+ slot:
+ row: 1
+ col: 5
+ state:
+ row: 2
+ col: 5
+ material: TNT
+ display: '&eToggle TNT-Explosion'
+
+ players:
+ title: 'Players added to this world'
+
+ back:
+ enabled: true
+ slot:
+ row: 6
+ col: 6
+
+ rows: 6
+
+ nextpage:
+ enabled: true
+ slot:
+ row: 6
+ col: 8
+ material: PAPER
+ display: '&eNext Page'
+ pagebefore:
+ enabled: true
+ slot:
+ row: 6
+ col: 2
+ material: PAPER
+ display: '&ePage before'
+ currentpage:
+ enabled: true
+ slot:
+ row: 6
+ col: 4
+ material: SUNFLOWER
+ display: '&eCurrent page: &a%page'
+
+ playerhead:
+ material: PLAYER_HEAD
+ display: '&e%player'
+
+ # PlayerGUI for managing one player on a world
+ player:
+ fill: false
+ title: 'Player options for %player'
+
+ back:
+ slot:
+ enabled: true
+ row: 3
+ col: 5
+
+ rows: 3
+
+ build:
+ enabled: true
+ slot:
+ row: 1
+ col: 1
+ state:
+ row: 2
+ col: 1
+ material: GOLDEN_AXE
+ display: '&eToggle Build-Permission'
+ lore:
+ - '&7Toggles the permission for a player'
+ - '&7To build on this world'
+ gamemode:
+ enabled: true
+ slot:
+ row: 1
+ col: 2
+ state:
+ row: 2
+ col: 2
+ material: END_CRYSTAL
+ display: '&eToggle GameMode-Permission'
+ lore:
+ - '&7Toggles the permission for a player'
+ - '&7To change the GameMode on this world'
+ teleport:
+ enabled: true
+ slot:
+ row: 1
+ col: 3
+ state:
+ row: 2
+ col: 3
+ material: COMPASS
+ display: '&eToggle Teleport-Permission'
+ lore:
+ - '&7Toggles the permission for a player'
+ - '&7To teleport on this world'
+ worldedit:
+ enabled: true
+ slot:
+ row: 1
+ col: 4
+ state:
+ row: 2
+ col: 4
+ material: WOODEN_AXE
+ display: '&eToggle WorldEdit-Permission'
+ lore:
+ - '&7Toggles the permission for a player'
+ - '&7To use WorldEdit on this world'
+ addmember:
+ enabled: false
+ slot:
+ row: 1
+ col: 6
+ state:
+ row: 2
+ col: 6
+ material: 399
+ display: '&eToggle Addmember-Permission'
+ lore:
+ - '&7Toggles the permission for a player'
+ - '&7To add a member to this world'
+ delmember:
+ enabled: false
+ slot:
+ row: 1
+ col: 6
+ state:
+ row: 2
+ col: 6
+ material: 286
+ display: '&eToggle Delmember-Permission'
+ lore:
+ - '&7Toggles the permission for a player'
+ - '&7To remove a member from this world'
+ setpermissions:
+ enabled: false
+ slot:
+ row: 1
+ col: 8
+ state:
+ row: 2
+ col: 8
+ material: 331
+ display: '&eToggle Setpermissions-Permission'
+ lore:
+ - '&7Toggles the permission for a player'
+ - '&7To set permissions for a member of this world'
+ administrateworld:
+ enabled: false
+ slot:
+ row: 1
+ col: 9
+ state:
+ row: 2
+ col: 9
+ material: 421
+ display: '&eToggle Addmember-Permission'
+ lore:
+ - '&7Toggles the permission for a player'
+ - '&7To adminstrate this world'
+
+# WorldsystemGUI
+worldsystem:
+ fill: false
+ title: 'WorldSystem'
+
+ rows: 1
+
+ back:
+ slot:
+ enabled: true
+ row: 1
+ col: 5
+
+ playeroptions:
+ enabled: true
+ slot:
+ row: 1
+ col: 1
+ material: LEATHER_HELMET
+ display: '&ePlayer Options'
+ worldoptions:
+ enabled: true
+ slot:
+ row: 1
+ col: 9
+ material: GRASS_BLOCK
+ display: '&eWorld Options'
+
+# GUI for choosing world template
+worldchoose:
+ fill: false
+ title: 'Choose world template'
+
+ back:
+ enabled: true
+ slot:
+ row: 4
+ col: 5
+
+ rows: 4
+
+ # The key must be named exactly as in the config.yml
+ template_default:
+ enabled: true
+ slot:
+ row: 2
+ col: 3
+ material: GRASS_BLOCK
+ display: '&aDefault template'
+
+ another_template:
+ enabled: true
+ slot:
+ row: 2
+ col: 7
+ material: STONE_BLOCK
+ display: '&aAnother template'
+
+
\ No newline at end of file
diff --git a/WorldSystem/src/main/resources/de.yml b/WorldSystem/src/main/resources/de.yml
index fa282b9..79bc911 100644
--- a/WorldSystem/src/main/resources/de.yml
+++ b/WorldSystem/src/main/resources/de.yml
@@ -1,83 +1,87 @@
-nopermission: "&cDu besitzt keine Berechtigungen!"
-unknown_error: "&cEtwas lief schief..."
-lagdetection: "Lags in Welt: &c%world"
-wrong_usage: "&c%usage"
-not_registered: "&cDieser Spieler war noch nie auf dem Server"
-
-world:
- reseted: "Deine Welt wurde zur\u00fcckgesetzt!"
- still_loaded: "&cDeine Welt ist noch geladen!"
- not_on: "&cDu bist auf keiner Welt!"
- created: "Deine Welt ist nun bereit. Nutze &a/ws home"
- already_exists: "&cDu besitzt bereits eine Welt!"
- delete:
- own: "&cDeine Welt wurde entfernt!"
- other: "Die Welt von &c%player&6 wurde entfernt!"
- does_not_exists:
- own: "&cDu besitzt keine Welt!"
- other: "&cDieser Spieler besitzt keine Welt!"
- setting_up: "&aBereite Welt vor..."
- playerlist: "Spieler in der Welt: %players"
- still_creating: "&cWelt wird noch erstellt..."
- set_home: "Du hast das Home gesetzt"
-
-member:
- removed: "Du hast &c%player&6 von deiner Welt entfernt!"
- added: "Du hast &c%player&6 zu deiner Welt hinzugef\u00fcgt!"
- already_added: "&cDer Spieler ist bereits Mitglied deiner Welt!"
- not_added:
- own: "&cDer Spieler ist kein Mitglied deiner Welt!"
- other: "&cDu bist nicht zu der Welt hinzugef\u00fcgt!"
- no_one_added: "&cEs sind keine Mitglieder hinzugefügt"
-
-request:
- expired: "&cDeine Anfrage ist ausgelaufen!"
- confirm: "&cBitte bestätige das Zur\u00fccksetzen: %command"
- until_expire: "&cDeine Anfrage l\u00e4uft in %time Sekunden aus!"
- already_sent: "&cDu hast bereits eine Anfrage gesendet!"
- not_sent: "&cDu hast keine Anfrage gesendet!"
- invalid_input: "&c%input ist eine ung\u00fcltige Eingabe!"
-
-toggle:
- gamemode:
- enabled: "&a%player&6 kann nun seinen Spielmodus \u00e4ndern!"
- disabled: "&c%player&6 kann seinen Spielmodus nicht mehr \u00e4ndern!"
- teleport:
- enabled: "&a%player&6 kann sich nun teleportieren!"
- disabled: "&c%player&6 kann sich nicht l\u00e4nger teleportieren!"
- build:
- enabled: "&a%player&6 kann nun bauen!"
- disabled: "&c%player&6 kann nicht mehr bauen!"
- fire:
- enabled: "&aFeuer aktiviert!"
- disabled: "&cFeuer deaktiviert!"
- tnt:
- enabled: "&aTNT-Schaden aktiviert!"
- disabled: "&cTNT-Schaden deaktiviert!"
-
-info:
- owner: "Eigent\u00fcmer: %data"
- id: "ID: %data"
- member: "Mitglieder: %data"
- tnt: "TNT: %data"
- fire: "Feuer: %data"
- enabled: "&aAn"
- disabled: "&cAus"
-
-command_help:
- list:
- - "/ws get &8- &7Gibt dir eine Welt"
- - "/ws home &8- &7Teleportiert dich auf deine Welt"
- - "/ws sethome &8- &7Setzt ein bestimmtes Home"
- - "/ws gui &8- &7\u00f6ffnets das GUI-Menu wenn du der Weltenbesitzer bist"
- - "/ws tp &8- &7Teleportiert dich auf eine bestimmte Welt"
- - "/ws addmember &8- &7F\u00fcgt jemanden zu deiner Welt hinzu"
- - "/ws delmember&8 - &7Entfernt jemanden von deiner Welt"
- - "/ws tnt &8- &7Erlaubt/Verbietet TNT auf deiner Welt"
- - "/ws fire &8- &7Erlaubt/Verbietet Feuer auf deiner Welt"
- - "/ws togglegm &8- &7Erlaubt/Verbietet einem Spieler den Spielmodus zu wechseln"
- - "/ws togglebuild &8- &7Erlaubt/Verbietet einem Spieler zu bauen"
- - "/ws toggletp &8- &7Erlaubt/Verbietet einem Spieler sich zu teleportieren"
- - "/ws info &8- &7Zeigt Informationen \u00fcber die Welt"
- - "/ws reset &8- &7Setzt deine Welt zur\u00fcck"
+nopermission: "&cDu besitzt keine Berechtigungen!"
+unknown_error: "&cEtwas lief schief..."
+lagdetection: "Lags in Welt: &c%world"
+wrong_usage: "&c%usage"
+not_registered: "&cDieser Spieler war noch nie auf dem Server"
+
+world:
+ reseted: "Deine Welt wurde zur\u00fcckgesetzt!"
+ still_loaded: "&cDeine Welt ist noch geladen!"
+ not_on: "&cDu bist auf keiner Welt!"
+ created: "Deine Welt ist nun bereit. Nutze &a/ws home"
+ already_exists: "&cDu besitzt bereits eine Welt!"
+ delete:
+ own: "&cDeine Welt wurde entfernt!"
+ other: "Die Welt von &c%player&6 wurde entfernt!"
+ does_not_exists:
+ own: "&cDu besitzt keine Welt!"
+ other: "&cDieser Spieler besitzt keine Welt!"
+ setting_up: "&aBereite Welt vor..."
+ playerlist: "Spieler in der Welt: %players"
+ still_creating: "&cWelt wird noch erstellt..."
+ set_home: "Du hast das Home gesetzt"
+
+member:
+ removed: "Du hast &c%player&6 von deiner Welt entfernt!"
+ added: "Du hast &c%player&6 zu deiner Welt hinzugef\u00fcgt!"
+ already_added: "&cDer Spieler ist bereits Mitglied deiner Welt!"
+ not_added:
+ own: "&cDer Spieler ist kein Mitglied deiner Welt!"
+ other: "&cDu bist nicht zu der Welt hinzugef\u00fcgt!"
+ no_one_added: "&cEs sind keine Mitglieder hinzugefügt"
+
+request:
+ expired: "&cDeine Anfrage ist ausgelaufen!"
+ confirm: "&cBitte bestätige das Zur\u00fccksetzen: %command"
+ until_expire: "&cDeine Anfrage l\u00e4uft in %time Sekunden aus!"
+ already_sent: "&cDu hast bereits eine Anfrage gesendet!"
+ not_sent: "&cDu hast keine Anfrage gesendet!"
+ invalid_input: "&c%input ist eine ung\u00fcltige Eingabe!"
+
+toggle:
+ gamemode:
+ enabled: "&a%player&6 kann nun seinen Spielmodus \u00e4ndern!"
+ disabled: "&c%player&6 kann seinen Spielmodus nicht mehr \u00e4ndern!"
+ teleport:
+ enabled: "&a%player&6 kann sich nun teleportieren!"
+ disabled: "&c%player&6 kann sich nicht l\u00e4nger teleportieren!"
+ build:
+ enabled: "&a%player&6 kann nun bauen!"
+ disabled: "&c%player&6 kann nicht mehr bauen!"
+ worldedit:
+ enabled: "&a%player&6 can now use WorldEdit!"
+ disabled: "&c%player&6 can no longer use WorldEdit!"
+ fire:
+ enabled: "&aFeuer aktiviert!"
+ disabled: "&cFeuer deaktiviert!"
+ tnt:
+ enabled: "&aTNT-Schaden aktiviert!"
+ disabled: "&cTNT-Schaden deaktiviert!"
+
+info:
+ owner: "Eigent\u00fcmer: %data"
+ id: "ID: %data"
+ member: "Mitglieder: %data"
+ tnt: "TNT: %data"
+ fire: "Feuer: %data"
+ enabled: "&aAn"
+ disabled: "&cAus"
+
+command_help:
+ list:
+ - "/ws get &8- &7Gibt dir eine Welt"
+ - "/ws home &8- &7Teleportiert dich auf deine Welt"
+ - "/ws sethome &8- &7Setzt ein bestimmtes Home"
+ - "/ws gui &8- &7\u00f6ffnets das GUI-Menu wenn du der Weltenbesitzer bist"
+ - "/ws tp &8- &7Teleportiert dich auf eine bestimmte Welt"
+ - "/ws addmember &8- &7F\u00fcgt jemanden zu deiner Welt hinzu"
+ - "/ws delmember&8 - &7Entfernt jemanden von deiner Welt"
+ - "/ws tnt &8- &7Erlaubt/Verbietet TNT auf deiner Welt"
+ - "/ws fire &8- &7Erlaubt/Verbietet Feuer auf deiner Welt"
+ - "/ws togglegm &8- &7Erlaubt/Verbietet einem Spieler den Spielmodus zu wechseln"
+ - "/ws togglebuild &8- &7Erlaubt/Verbietet einem Spieler zu bauen"
+ - "/ws toggletp &8- &7Erlaubt/Verbietet einem Spieler sich zu teleportieren"
+ - "/ws togglewe §8- §7Erlaubt/Verbietet einem Spieler WorldEdit zu nutzen"
+ - "/ws info &8- &7Zeigt Informationen \u00fcber die Welt"
+ - "/ws reset &8- &7Setzt deine Welt zur\u00fcck"
delete_command: "/ws delete &8- &7L\u00f6scht eine Welt"
\ No newline at end of file
diff --git a/WorldSystem/src/main/resources/en.yml b/WorldSystem/src/main/resources/en.yml
index 2391716..0228fad 100644
--- a/WorldSystem/src/main/resources/en.yml
+++ b/WorldSystem/src/main/resources/en.yml
@@ -1,84 +1,88 @@
-nopermission: "&cYou do not have permission to that command!"
-unknown_error: "&cSomething went wrong..."
-lagdetection: "Lagdetection in world: &c%world"
-wrong_usage: "&c%usage"
-not_registered: "&cThis player hasn't joined yet!"
-
-world:
- reseted: "You would was reset!"
- still_loaded: "&cYour world is still loaded!"
- not_on: "&cYou are not on a world!"
- created: "Your world is now ready. Get there with &a/ws home"
- already_exists: "&cYou already have a world!"
- delete:
- own: "&cYour world was deleted!"
- other: "You deleted the world of &c%player&6!"
- does_not_exists:
- own: "&cYou don't have a world!"
- other: "&cThis player doesn't has a world!"
- setting_up: "&aLoading world..."
- playerlist: "Players in this world: %players"
- still_creating: "&cWorld is still creating"
- set_home: "You set the home"
-
-member:
- removed: "You removed &c%player&6 from your world!"
- added: "You have added &c%player&6 to your world!"
- already_added: "&cThis player is already a member!"
- not_added:
- own: "&cThis player isn't a member!"
- other: "&cYou have not been added to this world!"
- no_one_added: "&cThere are no members added"
-
-request:
- expired: "&cYour request has expired!"
- confirm: "WARNING - Please confirm reset of your world: %command"
- until_expire: "&cYour request expires in %time seconds!"
- already_sent: "&cYou already sent a request!"
- not_sent: "&cYou have not sent a request!"
- invalid_input: "&c%input is not a valid request!"
-
-toggle:
- gamemode:
- enabled: "&a%player&6 can now change their gamemode!"
- disabled: "&c%player&6 can no longer change their gamemode!"
- teleport:
- enabled: "&a%player&6 can now teleport!"
- disabled: "&c%player&6 can no longer teleport!"
- build:
- enabled: "&a%player&6 can now build!"
- disabled: "&c%player&6 can no longer build!"
- fire:
- enabled: "&aYou activated fire!"
- disabled: "&cYou deactivated fire!"
- tnt:
- enabled: "&aYou activated TNT-Damage!"
- disabled: "&cYou deactivated TNT-Damage!"
-
-info:
- owner: "Owner: %data"
- id: "ID: %data"
- member: "Member: %data"
- tnt: "TNT: %data"
- fire: "Fire: %data"
- enabled: "&aOn"
- disabled: "&cOff"
-
-command_help:
- list:
- - "/ws get &8- &7Will give you a world"
- - "/ws home &8- &7Teleports you on your world"
- - "/ws sethome &8- &7Sets a specific home"
- - "/ws gui &8- &7Opens the GUI menu if you are the world owner"
- - "/ws tp &8- &7Teleports you on a specific world"
- - "/ws addmember &8- &7Adds a player to your world"
- - "/ws delmember &8- &7Removes a player from your world"
- - "/ws leave &8- &7Leave a world"
- - "/ws tnt &8- &7Allows/Denies TNT on your world"
- - "/ws fire &8- &7Allows/Denies Fire on your world"
- - "/ws togglegm &8- &7Allows/Denies a player changing gamemode"
- - "/ws togglebuild &8- &7Allows/Denies a player building on your world"
- - "/ws toggletp &8- &7Allows/Denies a player teleporting on your world"
- - "/ws info &8- &7Shows information about the world"
- - "/ws reset &8- &7Will reset your world"
+nopermission: "&cYou do not have permission to that command!"
+unknown_error: "&cSomething went wrong..."
+lagdetection: "Lagdetection in world: &c%world"
+wrong_usage: "&c%usage"
+not_registered: "&cThis player hasn't joined yet!"
+
+world:
+ reseted: "You would was reset!"
+ still_loaded: "&cYour world is still loaded!"
+ not_on: "&cYou are not on a world!"
+ created: "Your world is now ready. Get there with &a/ws home"
+ already_exists: "&cYou already have a world!"
+ delete:
+ own: "&cYour world was deleted!"
+ other: "You deleted the world of &c%player&6!"
+ does_not_exists:
+ own: "&cYou don't have a world!"
+ other: "&cThis player doesn't has a world!"
+ setting_up: "&aLoading world..."
+ playerlist: "Players in this world: %players"
+ still_creating: "&cWorld is still creating"
+ set_home: "You set the home"
+
+member:
+ removed: "You removed &c%player&6 from your world!"
+ added: "You have added &c%player&6 to your world!"
+ already_added: "&cThis player is already a member!"
+ not_added:
+ own: "&cThis player isn't a member!"
+ other: "&cYou have not been added to this world!"
+ no_one_added: "&cThere are no members added"
+
+request:
+ expired: "&cYour request has expired!"
+ confirm: "WARNING - Please confirm reset of your world: %command"
+ until_expire: "&cYour request expires in %time seconds!"
+ already_sent: "&cYou already sent a request!"
+ not_sent: "&cYou have not sent a request!"
+ invalid_input: "&c%input is not a valid request!"
+
+toggle:
+ gamemode:
+ enabled: "&a%player&6 can now change their gamemode!"
+ disabled: "&c%player&6 can no longer change their gamemode!"
+ teleport:
+ enabled: "&a%player&6 can now teleport!"
+ disabled: "&c%player&6 can no longer teleport!"
+ build:
+ enabled: "&a%player&6 can now build!"
+ disabled: "&c%player&6 can no longer build!"
+ worldedit:
+ enabled: "&a%player&6 can now use WorldEdit!"
+ disabled: "&c%player&6 can no longer use WorldEdit!"
+ fire:
+ enabled: "&aYou activated fire!"
+ disabled: "&cYou deactivated fire!"
+ tnt:
+ enabled: "&aYou activated TNT-Damage!"
+ disabled: "&cYou deactivated TNT-Damage!"
+
+info:
+ owner: "Owner: %data"
+ id: "ID: %data"
+ member: "Member: %data"
+ tnt: "TNT: %data"
+ fire: "Fire: %data"
+ enabled: "&aOn"
+ disabled: "&cOff"
+
+command_help:
+ list:
+ - "/ws get &8- &7Will give you a world"
+ - "/ws home &8- &7Teleports you on your world"
+ - "/ws sethome &8- &7Sets a specific home"
+ - "/ws gui &8- &7Opens the GUI menu if you are the world owner"
+ - "/ws tp &8- &7Teleports you on a specific world"
+ - "/ws addmember &8- &7Adds a player to your world"
+ - "/ws delmember &8- &7Removes a player from your world"
+ - "/ws leave &8- &7Leave a world"
+ - "/ws tnt &8- &7Allows/Denies TNT on your world"
+ - "/ws fire &8- &7Allows/Denies Fire on your world"
+ - "/ws togglegm &8- &7Allows/Denies a player changing gamemode"
+ - "/ws togglebuild &8- &7Allows/Denies a player building on your world"
+ - "/ws toggletp &8- &7Allows/Denies a player teleporting on your world"
+ - "/ws togglewe ยง8- ยง7Allows/Denys a player using WorldEdit"
+ - "/ws info &8- &7Shows information about the world"
+ - "/ws reset &8- &7Will reset your world"
delete_command: "/ws delete &8- &7Will delete a world"
\ No newline at end of file
diff --git a/WorldSystem/src/main/resources/fr.yml b/WorldSystem/src/main/resources/fr.yml
index ce9c020..3cfa6ab 100644
--- a/WorldSystem/src/main/resources/fr.yml
+++ b/WorldSystem/src/main/resources/fr.yml
@@ -1,84 +1,88 @@
-nopermission: "&cVous n'avez pas la permission de le faire!"
-unknown_error: "&cQuelque chose s'est mal passé ..."
-lagdetection: "Décalage Détection dans le monde: &c%world"
-wrong_usage: "&c%usage"
-not_registered: "&cCe joueur n'a pas encore rejoint!!"
-
-world:
- reseted: "Vous auriez été réinitialisé!"
- still_loaded: "&cVotre monde est toujours chargé!"
- not_on: "&cVous n'êtes pas sur un monde!"
- created: "Votre monde est maintenant prêt. Allez-y avec &a/ws home"
- already_exists: "&cVous avez déjà un monde!"
- delete:
- own: "&cVotre monde a été supprimé!"
- other: "Vous avez supprimé le monde du &c%player&6!"
- does_not_exists:
- own: "&cTu n'as pas de monde!"
- other: "&cCe joueur n'a pas de monde!"
- setting_up: "&aChargement du monde ..."
- playerlist: "Joueurs dans ce monde: %players"
- still_creating: "&cWorld is still creating"
- set_home: "You set the home"
-
-member:
- removed: "Vous avez supprimé &c%player&6 de votre monde!"
- added: "Vous avez ajouté un &c%player&6 à votre monde!"
- already_added: "&cCe joueur est déjà membre!"
- not_added:
- own: "&cCe joueur n'est pas membre!"
- other: "&cVous n'avez pas été ajouté à ce monde!"
- no_one_added: "&cThere are no members added"
-
-request:
- expired: "&cVotre demande a expiré!"
- confirm: "AVERTISSEMENT - Veuillez confirmer la réinitialisation de votre monde: %command"
- until_expire: "&cVotre demande expire dans %time secondes!"
- already_sent: "&cVous avez déjà envoyé une demande!"
- not_sent: "&cVous n'avez pas envoyé de demande!"
- invalid_input: "&c%input n'est pas une demande valide!"
-
-toggle:
- gamemode:
- enabled: "&a%player&6 peut maintenant changer leur mode de jeu!"
- disabled: "&c%player&6 ne peut maintenant changer leur mode de jeu!"
- teleport:
- enabled: "&a%player&6 peut maintenant téléporter!"
- disabled: "&c%player&6 ne peut maintenant téléporter!"
- build:
- enabled: "&a%player&6 peut maintenant construire!"
- disabled: "&c%player&6 ne peut maintenant construire!"
- fire:
- enabled: "&aVous avez activé le feu!"
- disabled: "&cVous avez désactivé le feu!"
- tnt:
- enabled: "&aVous avez activé les TNT dégâts!"
- disabled: "&cVous avez désactivé les TNT dégâts!"
-
-info:
- owner: "Propriétaire: %data"
- id: "ID: %data"
- member: "Membre: %data"
- tnt: "TNT: %data"
- fire: "Feu: %data"
- enabled: "&aAllumer"
- disabled: "&cÉteindre"
-
-command_help:
- list:
- - "/ws get &8- &7Je vais vous donner un monde"
- - "/ws home &8- &7Vous téléporte sur votre monde"
- - "/ws sethome &8- &7Sets a specific home"
- - "/ws gui &8- &7Ouvre le menu de l'interface graphique si vous êtes le propriétaire mondial"
- - "/ws tp &8- &7Vous téléporte sur un monde spécifique"
- - "/ws addmember &8- &7Ajoute un joueur à ton monde"
- - "/ws delmember &8- &7Supprime un joueur de votre monde"
- - "/ws leave &8- &7Laissez un monde"
- - "/ws tnt &8- &7Permet / Refuse TNT sur votre monde"
- - "/ws fire &8- &7Permet / Refuse le feu sur votre monde"
- - "/ws togglegm &8- &7Permet / Refuse à un joueur de changer de mode de jeu"
- - "/ws togglebuild &8- &7Permet / Refuse à un joueur de construire sur votre monde"
- - "/ws toggletp &8- &7Permet / Refuse à un joueur de se téléporter sur votre monde"
- - "/ws info &8- &7Affiche des informations sur le monde"
- - "/ws reset &8- &7Réinitialisera votre monde"
- delete_command: "/ws delete &8- &7Va supprimer un monde"
\ No newline at end of file
+nopermission: "&cVous n'avez pas la permission!"
+unknown_error: "&cQuelque chose s'est mal passé ..."
+lagdetection: "Lag détecté sur le monde: &c%world"
+wrong_usage: "&c%usage"
+not_registered: "&cCe joueur n'a pas encore rejoint!!"
+
+world:
+ reseted: "Votre monde a été réinitialisé!"
+ still_loaded: "&cVotre monde est toujours chargé!"
+ not_on: "&cVous n'êtes pas sur un monde!"
+ created: "Votre monde est maintenant prêt. Allez-y avec &a/ws home"
+ already_exists: "&cVous avez déjà un monde!"
+ delete:
+ own: "&cVotre monde a été supprimé!"
+ other: "Vous avez supprimé le monde de &c%player&6!"
+ does_not_exists:
+ own: "&cVous n'avez pas de monde!"
+ other: "&cCe joueur n'a pas de monde!"
+ setting_up: "&aChargement du monde..."
+ playerlist: "Joueurs dans ce monde: %players"
+ still_creating: "&cLe monde est encore en train de se créer"
+ set_home: "Vous avez placé le home"
+
+member:
+ removed: "Vous avez retiré &c%player&6 de votre monde!"
+ added: "Vous avez ajouté &c%player&6 à votre monde!"
+ already_added: "&cCe joueur est déjà membre!"
+ not_added:
+ own: "&cCe joueur n'est pas membre!"
+ other: "&cVous n'avez pas été ajouté à ce monde!"
+ no_one_added: "&cIl n'y a aucun membre d'ajouté"
+
+request:
+ expired: "&cVotre demande a expiré!"
+ confirm: "AVERTISSEMENT - Veuillez confirmer la réinitialisation de votre monde: %command"
+ until_expire: "&cVotre demande expire dans %time secondes!"
+ already_sent: "&cVous avez déjà envoyé une demande!"
+ not_sent: "&cVous n'avez pas envoyé de demande!"
+ invalid_input: "&c%input n'est pas une demande valide!"
+
+toggle:
+ gamemode:
+ enabled: "&a%player&6 peut désormais changer son mode de jeu!"
+ disabled: "&c%player&6 ne peut désormais plus changer son mode de jeu!"
+ teleport:
+ enabled: "&a%player&6 peut désormais se téléporter!"
+ disabled: "&c%player&6 ne peut désormais plus se téléporter!"
+ build:
+ enabled: "&a%player&6 peut désormais construire!"
+ disabled: "&c%player&6 ne peut désormais plus construire!"
+ worldedit:
+ enabled: "&a%player&6 peut désormais utiliser WorldEdit!"
+ disabled: "&c%player&6 ne peut désormais plus utiliser WorldEdit!"
+ fire:
+ enabled: "&aVous avez activé le feu!"
+ disabled: "&cVous avez désactivé le feu!"
+ tnt:
+ enabled: "&aVous avez activé la TNT!"
+ disabled: "&cVous avez désactivé la TNT!"
+
+info:
+ owner: "Propriétaire: %data"
+ id: "ID: %data"
+ member: "Membre: %data"
+ tnt: "TNT: %data"
+ fire: "Feu: %data"
+ enabled: "&aActivé"
+ disabled: "&cDésactivé"
+
+command_help:
+ list:
+ - "/ws get &8- &7Vous donne un monde"
+ - "/ws home &8- &7Vous téléporte sur votre monde"
+ - "/ws sethome &8- &7Définit un home spécifique"
+ - "/ws gui &8- &7Ouvre le menu de votre monde"
+ - "/ws tp &8- &7Vous téléporte sur un monde spécifique"
+ - "/ws addmember &8- &7Ajoute un joueur à votre monde"
+ - "/ws delmember &8- &7Retire un joueur de votre monde"
+ - "/ws leave &8- &7Quitter un monde"
+ - "/ws tnt &8- &7Active / Désactive la TNT sur votre monde"
+ - "/ws fire &8- &7Active / Désactive le feu sur votre monde"
+ - "/ws togglegm &8- &7Autorise / Interdit à un joueur de changer de mode de jeu"
+ - "/ws togglebuild &8- &7Autorise / Interdit à un joueur de construire sur votre monde"
+ - "/ws toggletp &8- &7Autorise / Interdit à un joueur de se téléporter sur votre monde"
+ - "/ws togglewe &8- &7Autorise / Interdit à un joueur d'utiliser WorldEdit"
+ - "/ws info &8- &7Affiche les informations relatives à un monde"
+ - "/ws reset &8- &7Réinitialiser votre monde"
+ delete_command: "/ws delete &8- &7Supprimer votre monde"
\ No newline at end of file
diff --git a/WorldSystem/src/main/resources/old_gui.yml b/WorldSystem/src/main/resources/old_gui.yml
index 8266e19..d3784c9 100644
--- a/WorldSystem/src/main/resources/old_gui.yml
+++ b/WorldSystem/src/main/resources/old_gui.yml
@@ -1,302 +1,302 @@
-#
-# Config for the GUI "/gui"
-# Counting for rows and columns starts always at 1
-#
-
-options:
- # How the enabled item should look like
- enabled:
- # Material name in the Material enum
- material: INK_SACK
- # Data, how it should look like eg. blue, red, green
- data: 10
- # Displayname
- display: '&aEnabled'
-
- # How the disabled item should look like
- disabled:
- material: INK_SACK
- data: 1
- display: '&cDisabled'
-
- # How the comming-soon item should look like
- coming_soon:
- material: INK_SACK
- data: 14
- display: '&6Coming soon...'
-
- # How the back item should look like
- back:
- material: BARRIER
- display: '&cBack'
-
- # When filling of an inventory is true, how the item should look like
- fill:
- material: STAINED_GLASS_PANE
- data: 7
- display: ''
-
- # WorldoptionsGUI
- world:
- fill: false
- # What the title of the Inv should be
- title: 'World Options'
-
- # Rows
- rows: 3
-
- # Where the back item should be
- back:
- enabled: true
- slot:
- row: 3
- col: 5
-
- # Reset button
- reset:
- # If feature should be enabled or not
- enabled: true
- slot:
- row: 1
- col: 8
- material: DIAMOND_HOE
- data: 0
- display: '&eReset World'
-
- # Fire button
- fire:
- enabled: true
- slot:
- row: 1
- col: 2
- # Where the state item should be
- state:
- row: 2
- col: 2
- material: FLINT_AND_STEEL
- display: '&eToggle Fire'
-
- # TNT button
- tnt:
- enabled: true
- slot:
- row: 1
- col: 5
- state:
- row: 2
- col: 5
- material: TNT
- display: '&eToggle TNT-Explosion'
-
- players:
- title: 'Players added to this world'
-
- back:
- enabled: true
- slot:
- row: 6
- col: 6
-
- rows: 6
-
- nextpage:
- enabled: true
- slot:
- row: 6
- col: 8
- material: PAPER
- display: '&eNext Page'
- pagebefore:
- enabled: true
- slot:
- row: 6
- col: 2
- material: PAPER
- display: '&ePage before'
- currentpage:
- enabled: true
- slot:
- row: 6
- col: 4
- material: DOUBLE_PLANT
- display: '&eCurrent page: &a%page'
- player_list_to_row: 4
- playerhead:
- material: SKULL_ITEM
- display: '&e%player'
-
- # PlayerGUI for managing one player on a world
- player:
- fill: false
- title: 'Player options for %player'
-
- back:
- enabled: true
- slot:
- row: 3
- col: 5
-
- rows: 3
-
- build:
- enabled: true
- slot:
- row: 1
- col: 1
- state:
- row: 2
- col: 1
- material: GOLD_AXE
- display: '&eToggle Build-Permission'
- lore:
- - '&7Toggles the permission for a player'
- - '&7To build on this world'
- gamemode:
- enabled: true
- slot:
- row: 1
- col: 2
- state:
- row: 2
- col: 2
- material: END_CRYSTAL
- display: '&eToggle GameMode-Permission'
- lore:
- - '&7Toggles the permission for a player'
- - '&7To change the GameMode on this world'
- teleport:
- enabled: true
- slot:
- row: 1
- col: 3
- state:
- row: 2
- col: 3
- material: COMPASS
- display: '&eToggle Teleport-Permission'
- lore:
- - '&7Toggles the permission for a player'
- - '&7To teleport on this world'
- time:
- enabled: false
- slot:
- row: 1
- col: 4
- state:
- row: 2
- col: 4
- material: 347
- display: '&eToggle Time-Permission'
- lore:
- - '&7Toggles the permission for a player'
- - '&7To change the time on this world'
- addmember:
- enabled: false
- slot:
- row: 1
- col: 6
- state:
- row: 2
- col: 6
- material: 399
- display: '&eToggle Addmember-Permission'
- lore:
- - '&7Toggles the permission for a player'
- - '&7To add a member to this world'
- delmember:
- enabled: false
- slot:
- row: 1
- col: 6
- state:
- row: 2
- col: 6
- material: 286
- display: '&eToggle Delmember-Permission'
- lore:
- - '&7Toggles the permission for a player'
- - '&7To remove a member from this world'
- setpermissions:
- enabled: false
- slot:
- row: 1
- col: 8
- state:
- row: 2
- col: 8
- material: 331
- display: '&eToggle Setpermissions-Permission'
- lore:
- - '&7Toggles the permission for a player'
- - '&7To set permissions for a member of this world'
- administrateworld:
- enabled: false
- slot:
- row: 1
- col: 9
- state:
- row: 2
- col: 9
- material: 421
- display: '&eToggle Addmember-Permission'
- lore:
- - '&7Toggles the permission for a player'
- - '&7To adminstrate this world'
-
-# WorldsystemGUI
-worldsystem:
- fill: false
- title: 'WorldSystem'
-
- rows: 1
-
- back:
- enabled: true
- slot:
- row: 1
- col: 5
-
- playeroptions:
- enabled: true
- slot:
- row: 1
- col: 1
- material: LEATHER_HELMET
- display: '&ePlayer Options'
- worldoptions:
- enabled: true
- slot:
- row: 1
- col: 9
- material: GRASS
- display: '&eWorld Options'
-
-# GUI for choosing world template
-worldchoose:
- fill: false
- title: 'Choose world template'
-
- back:
- enabled: true
- slot:
- row: 4
- col: 5
-
- rows: 4
-
- # The key must be named exactly as in the config.yml
- template_default:
- enabled: true
- slot:
- row: 2
- col: 3
- material: GRASS
- display: '&aDefault template'
-
- another_template:
- enabled: true
- slot:
- row: 2
- col: 7
- material: STONE
+#
+# Config for the GUI "/gui"
+# Counting for rows and columns starts always at 1
+#
+
+options:
+ # How the enabled item should look like
+ enabled:
+ # Material name in the Material enum
+ material: INK_SACK
+ # Data, how it should look like eg. blue, red, green
+ data: 10
+ # Displayname
+ display: '&aEnabled'
+
+ # How the disabled item should look like
+ disabled:
+ material: INK_SACK
+ data: 1
+ display: '&cDisabled'
+
+ # How the comming-soon item should look like
+ coming_soon:
+ material: INK_SACK
+ data: 14
+ display: '&6Coming soon...'
+
+ # How the back item should look like
+ back:
+ material: BARRIER
+ display: '&cBack'
+
+ # When filling of an inventory is true, how the item should look like
+ fill:
+ material: STAINED_GLASS_PANE
+ data: 7
+ display: ''
+
+ # WorldoptionsGUI
+ world:
+ fill: false
+ # What the title of the Inv should be
+ title: 'World Options'
+
+ # Rows
+ rows: 3
+
+ # Where the back item should be
+ back:
+ enabled: true
+ slot:
+ row: 3
+ col: 5
+
+ # Reset button
+ reset:
+ # If feature should be enabled or not
+ enabled: true
+ slot:
+ row: 1
+ col: 8
+ material: DIAMOND_HOE
+ data: 0
+ display: '&eReset World'
+
+ # Fire button
+ fire:
+ enabled: true
+ slot:
+ row: 1
+ col: 2
+ # Where the state item should be
+ state:
+ row: 2
+ col: 2
+ material: FLINT_AND_STEEL
+ display: '&eToggle Fire'
+
+ # TNT button
+ tnt:
+ enabled: true
+ slot:
+ row: 1
+ col: 5
+ state:
+ row: 2
+ col: 5
+ material: TNT
+ display: '&eToggle TNT-Explosion'
+
+ players:
+ title: 'Players added to this world'
+
+ back:
+ enabled: true
+ slot:
+ row: 6
+ col: 6
+
+ rows: 6
+
+ nextpage:
+ enabled: true
+ slot:
+ row: 6
+ col: 8
+ material: PAPER
+ display: '&eNext Page'
+ pagebefore:
+ enabled: true
+ slot:
+ row: 6
+ col: 2
+ material: PAPER
+ display: '&ePage before'
+ currentpage:
+ enabled: true
+ slot:
+ row: 6
+ col: 4
+ material: DOUBLE_PLANT
+ display: '&eCurrent page: &a%page'
+ player_list_to_row: 4
+ playerhead:
+ material: SKULL_ITEM
+ display: '&e%player'
+
+ # PlayerGUI for managing one player on a world
+ player:
+ fill: false
+ title: 'Player options for %player'
+
+ back:
+ enabled: true
+ slot:
+ row: 3
+ col: 5
+
+ rows: 3
+
+ build:
+ enabled: true
+ slot:
+ row: 1
+ col: 1
+ state:
+ row: 2
+ col: 1
+ material: GOLD_AXE
+ display: '&eToggle Build-Permission'
+ lore:
+ - '&7Toggles the permission for a player'
+ - '&7To build on this world'
+ gamemode:
+ enabled: true
+ slot:
+ row: 1
+ col: 2
+ state:
+ row: 2
+ col: 2
+ material: END_CRYSTAL
+ display: '&eToggle GameMode-Permission'
+ lore:
+ - '&7Toggles the permission for a player'
+ - '&7To change the GameMode on this world'
+ teleport:
+ enabled: true
+ slot:
+ row: 1
+ col: 3
+ state:
+ row: 2
+ col: 3
+ material: COMPASS
+ display: '&eToggle Teleport-Permission'
+ lore:
+ - '&7Toggles the permission for a player'
+ - '&7To teleport on this world'
+ worldedit:
+ enabled: true
+ slot:
+ row: 1
+ col: 4
+ state:
+ row: 2
+ col: 4
+ material: WOOD_AXE
+ display: '&eToggle WorldEdit-Permission'
+ lore:
+ - '&7Toggles the permission for a player'
+ - '&7To use WorldEdit on this world'
+ addmember:
+ enabled: false
+ slot:
+ row: 1
+ col: 6
+ state:
+ row: 2
+ col: 6
+ material: 399
+ display: '&eToggle Addmember-Permission'
+ lore:
+ - '&7Toggles the permission for a player'
+ - '&7To add a member to this world'
+ delmember:
+ enabled: false
+ slot:
+ row: 1
+ col: 6
+ state:
+ row: 2
+ col: 6
+ material: 286
+ display: '&eToggle Delmember-Permission'
+ lore:
+ - '&7Toggles the permission for a player'
+ - '&7To remove a member from this world'
+ setpermissions:
+ enabled: false
+ slot:
+ row: 1
+ col: 8
+ state:
+ row: 2
+ col: 8
+ material: 331
+ display: '&eToggle Setpermissions-Permission'
+ lore:
+ - '&7Toggles the permission for a player'
+ - '&7To set permissions for a member of this world'
+ administrateworld:
+ enabled: false
+ slot:
+ row: 1
+ col: 9
+ state:
+ row: 2
+ col: 9
+ material: 421
+ display: '&eToggle Addmember-Permission'
+ lore:
+ - '&7Toggles the permission for a player'
+ - '&7To adminstrate this world'
+
+# WorldsystemGUI
+worldsystem:
+ fill: false
+ title: 'WorldSystem'
+
+ rows: 1
+
+ back:
+ enabled: true
+ slot:
+ row: 1
+ col: 5
+
+ playeroptions:
+ enabled: true
+ slot:
+ row: 1
+ col: 1
+ material: LEATHER_HELMET
+ display: '&ePlayer Options'
+ worldoptions:
+ enabled: true
+ slot:
+ row: 1
+ col: 9
+ material: GRASS
+ display: '&eWorld Options'
+
+# GUI for choosing world template
+worldchoose:
+ fill: false
+ title: 'Choose world template'
+
+ back:
+ enabled: true
+ slot:
+ row: 4
+ col: 5
+
+ rows: 4
+
+ # The key must be named exactly as in the config.yml
+ template_default:
+ enabled: true
+ slot:
+ row: 2
+ col: 3
+ material: GRASS
+ display: '&aDefault template'
+
+ another_template:
+ enabled: true
+ slot:
+ row: 2
+ col: 7
+ material: STONE
display: '&aAnother template'
\ No newline at end of file
diff --git a/WorldSystem/src/main/resources/plugin.yml b/WorldSystem/src/main/resources/plugin.yml
index 98aceb3..90a31e7 100644
--- a/WorldSystem/src/main/resources/plugin.yml
+++ b/WorldSystem/src/main/resources/plugin.yml
@@ -1,119 +1,74 @@
-name: WorldSystem
-version: ${project.version}
-author: Butzlabben
-main: de.butzlabben.world.WorldSystem
-
-api-version: 1.13
-
-loadbefore: [FastAsyncWorldEdit, WorldEdit]
-
-commands:
- ws:
- description: Commands for WorldSystem
- usage: /ws
- ws get:
- usage: /ws get
- permission: ws.get
- ws help:
- usage: /ws help
- ws home:
- usage: /ws home
- ws sethome:
- usage: /ws sethome
- permission: ws.sethome
- ws addmember:
- usage: /ws addmember
- ws delmember:
- usage: /ws delmember
- ws leave:
- usage: /ws leave
- ws tp:
- usage: /ws tp
- ws tnt:
- usage: /ws tnt
- ws fire:
- usage: /ws fire
- ws info:
- usage: /ws info
- ws togglebuild:
- usage: /ws togglebuild
- ws togglegm:
- usage: /ws togglegm
- ws toggletp:
- usage: /ws toggletp
- ws reset:
- usage: /ws reset
- ws gui:
- usage: /ws gui
- ws delete:
- usage: /ws delete
- permission: ws.delete
- ws confirm:
- usage: /ws confirm
- permission: ws.confirm
-
-permissions:
- ws.*:
- default: op
- description: Gives '*'-Perms to all Commands
- children:
- ws.tp.*: true
- ws.get: true
- ws.sethome: true
- ws.tp.world: true
- ws.tp.toother: true
- ws.tp.other: true
- ws.build: true
- ws.gamemode: true
- ws.delete: true
- ws.lag: true
- ws.big: true
- ws.large: true
- ws.confirm: true
- ws.sethome:
- default: true
- description: 'You can set a different worldspawn'
- ws.tp.*:
- default: op
- description: You can teleport everything
- children:
- ws.tp.toother: true
- ws.tp.other: true
- ws.tp.world: true
- ws.build:
- default: op
- description: You can build on other Worlds without WorldPermissions
- ws.get:
- default: true
- description: You can create a world via /ws get
- ws.delete:
- default: op
- description: You can delete a world
- ws.gamemode:
- default: op
- description: You can change GameMode on other worlds
- ws.tp.other:
- default: op
- description: You can teleport other persons
- ws.tp.toother:
- default: op
- description: You can teleport across worlds
- ws.tp.world:
- default: op
- description: You can teleport to without rights World
- ws.lag:
- default: op
- description: You can see lag messages
- ws.big:
- default: op
- description: Gives you a bigger world (if set)
- ws.large:
- default: op
- children:
- ws.big: true
- description: Gives you a even bigger world (if set)
- ws.confirm:
- default: op
- description: You can confirm (if needed) an auto-update
-
+name: WorldSystem
+version: ${project.version}
+author: Butzlabben
+main: de.butzlabben.world.WorldSystem
+
+api-version: 1.13
+
+loadbefore: [FastAsyncWorldEdit, WorldEdit]
+
+permissions:
+ ws.*:
+ default: op
+ description: Gives '*'-Perms to all Commands
+ children:
+ ws.tp.*: true
+ ws.get: true
+ ws.sethome: true
+ ws.tp.world: true
+ ws.tp.toother: true
+ ws.tp.other: true
+ ws.build: true
+ ws.gamemode: true
+ ws.delete: true
+ ws.lag: true
+ ws.big: true
+ ws.large: true
+ ws.confirm: true
+ ws.sethome:
+ default: true
+ description: 'You can set a different worldspawn'
+ ws.tp.*:
+ default: op
+ description: You can teleport everything
+ children:
+ ws.tp.toother: true
+ ws.tp.other: true
+ ws.tp.world: true
+ ws.build:
+ default: op
+ description: You can build on other Worlds without WorldPermissions
+ ws.get:
+ default: true
+ description: You can create a world via /ws get
+ ws.delete:
+ default: op
+ description: You can delete a world
+ ws.gamemode:
+ default: op
+ description: You can change GameMode on other worlds
+ ws.tp.other:
+ default: op
+ description: You can teleport other persons
+ ws.tp.toother:
+ default: op
+ description: You can teleport across worlds
+ ws.tp.world:
+ default: op
+ description: You can teleport to without rights World
+ ws.lag:
+ default: op
+ description: You can see lag messages
+ ws.big:
+ default: op
+ description: Gives you a bigger world (if set)
+ ws.large:
+ default: op
+ children:
+ ws.big: true
+ description: Gives you a even bigger world (if set)
+ ws.confirm:
+ default: op
+ description: You can confirm (if needed) an auto-update
+
default-permission: admin
\ No newline at end of file