2.4.1 - New commandframework

This commit is contained in:
Butzlabben 2019-01-27 22:16:22 +01:00
parent 79bd24a75a
commit 36a4ec3444
20 changed files with 3268 additions and 2642 deletions

6
.idea/vcs.xml Normal file
View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="" vcs="Git" />
</component>
</project>

View File

@ -1,29 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="EclipseModuleManager">
<libelement value="jar://$MODULE_DIR$/../../../spigot-1.12.jar!/" />
<src_description expected_position="2">
<src_folder value="file://$MODULE_DIR$/src" expected_position="2" />
</src_description>
</component>
<component name="NewModuleRootManager">
<output url="file://$MODULE_DIR$/bin" />
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
</content>
<orderEntry type="jdk" jdkName="JavaSE-1.8" jdkType="JavaSDK" />
<orderEntry type="module-library">
<library name="spigot-1.12.jar">
<CLASSES>
<root url="jar://$MODULE_DIR$/../../../spigot-1.12.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES>
<root url="jar://C:/Program Files/Java/jdk1.8.0_131/src.zip!/" />
</SOURCES>
</library>
</orderEntry>
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

View File

@ -1,101 +1,122 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>de.butzlabben.world</groupId>
<artifactId>WorldSystem</artifactId>
<version>2.4.0.3</version>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.build.number>-</project.build.number>
<project.build.version>${project.version}
Build:${project.build.number}</project.build.version>
</properties>
<build>
<defaultGoal>package</defaultGoal>
<sourceDirectory>src/main/java</sourceDirectory>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
<excludes><exclude>LICENSE.txt</exclude></excludes>
</resource>
</resources>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.3</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</build>
<repositories>
<repository>
<id>spigot-repo</id>
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
</repository>
<repository>
<id>fawe-repo</id>
<url>http://ci.athion.net/job/FastAsyncWorldEdit/ws/mvn/</url>
</repository>
<repository>
<id>we-repo</id>
<url>>http://maven.sk89q.com/repo/</url>
</repository>
<!-- Mojang repo for GameProfileBuilder -->
<repository>
<id>mojang</id>
<name>Mojang's Repository</name>
<url>https://libraries.minecraft.net/</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.13-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.mojang</groupId>
<artifactId>authlib</artifactId>
<version>1.5.21</version>
</dependency>
<!--
AsyncWorld is not in the api so I have to use a local file
Issue: https://github.com/boy0001/FastAsyncWorldedit/issues/1060
<dependency>
<groupId>com.boydti</groupId>
<artifactId>fawe-api</artifactId>
<scope>provided</scope>
<version>latest</version>
</dependency>
-->
<!-- Download FAWE and change to path to your path if you want to use it -->
<dependency>
<groupId>com.sk98q.worldedit</groupId>
<artifactId>FastAsnycWorldEdit</artifactId>
<scope>system</scope>
<version>1.0</version>
<systemPath>C:/FastAsyncWorldEdit.jar</systemPath>
</dependency>
<dependency>
<groupId>com.sk89q</groupId>
<artifactId>worldedit</artifactId>
<version>6.0.0-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
</dependencies>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>de.butzlabben.world</groupId>
<artifactId>WorldSystem</artifactId>
<version>2.4.1</version>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.build.number>-</project.build.number>
<project.build.version>${project.version}
Build:${project.build.number}</project.build.version>
</properties>
<build>
<defaultGoal>package</defaultGoal>
<sourceDirectory>src/main/java</sourceDirectory>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
<excludes><exclude>LICENSE.txt</exclude></excludes>
</resource>
</resources>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.3</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.1.0</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<repositories>
<repository>
<id>spigot-repo</id>
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
</repository>
<repository>
<id>fawe-repo</id>
<url>http://ci.athion.net/job/FastAsyncWorldEdit/ws/mvn/</url>
</repository>
<repository>
<id>we-repo</id>
<url>>http://maven.sk89q.com/repo/</url>
</repository>
<!-- Mojang repo for GameProfileBuilder -->
<repository>
<id>mojang</id>
<name>Mojang's Repository</name>
<url>https://libraries.minecraft.net/</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.13-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.mojang</groupId>
<artifactId>authlib</artifactId>
<version>1.5.21</version>
<scope>provided</scope>
</dependency>
<!--
AsyncWorld is not in the api so I have to use a local file
Issue: https://github.com/boy0001/FastAsyncWorldedit/issues/1060
<dependency>
<groupId>com.boydti</groupId>
<artifactId>fawe-api</artifactId>
<scope>provided</scope>
<version>latest</version>
</dependency>
-->
<!-- Download FAWE and change to path to your path if you want to use it -->
<dependency>
<groupId>com.sk98q.worldedit</groupId>
<artifactId>FastAsnycWorldEdit</artifactId>
<scope>system</scope>
<version>1.0</version>
<systemPath>C:/FastAsyncWorldEdit.jar</systemPath>
</dependency>
<dependency>
<groupId>com.sk89q</groupId>
<artifactId>worldedit</artifactId>
<version>6.0.0-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>net.myplayplanet</groupId>
<artifactId>CommandFramework</artifactId>
<version>2.0.0-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
</dependencies>
</project>

View File

@ -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;
}
}

View File

@ -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<String> onTabComplete(CommandSender cs, Command cmd, String label, String[] args) {
List<String> 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<String> 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<String> 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<String> 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 <World>"));
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());
});
}
}

View File

@ -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 <Player>")
public void delMemberCommand(CommandArgs args) {
Player p = args.getSender(Player.class);
if (args.length() < 1) {
p.sendMessage(MessageConfig.getWrongUsage().replaceAll("%usage", "/ws delmember <Player>"));
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 <Player>")
public void deleteCommand(CommandArgs args) {
CommandSender cs = args.getSender(CommandSender.class);
if (args.length() < 1) {
cs.sendMessage(MessageConfig.getWrongUsage().replaceAll("%usage", "/ws delete <Player>"));
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 <Player>")
public void addMemberCommand(CommandArgs args) {
Player p = args.getSender(Player.class);
if (args.length() < 1) {
p.sendMessage(MessageConfig.getWrongUsage().replaceAll("%usage", "/ws addmember <Player>"));
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 <Player>")
public void toggleTeleportCommand(CommandArgs args) {
Player p = args.getSender(Player.class);
if (args.length() < 1) {
p.sendMessage(MessageConfig.getWrongUsage().replaceAll("%usage", "/ws toggletp <Player>"));
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 <Player>")
public void toggleGamemodeCommand(CommandArgs args) {
Player p = args.getSender(Player.class);
if (args.length() < 1) {
p.sendMessage(MessageConfig.getWrongUsage().replaceAll("%usage", "/ws togglegm <Player>"));
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 <Player>")
public void toggleWorldeditCommand(CommandArgs args) {
Player p = args.getSender(Player.class);
if (args.length() < 1) {
p.sendMessage(MessageConfig.getWrongUsage().replaceAll("%usage", "/ws togglewe <Player>"));
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 <Player>")
public void toggleBuildCommand(CommandArgs args) {
Player p = args.getSender(Player.class);
if (args.length() < 1) {
p.sendMessage(MessageConfig.getWrongUsage().replaceAll("%usage", "/ws togglebuild <Player>"));
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()));
}
}
}

View File

@ -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<Player> 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());
}
}
}

View File

@ -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<String> 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<String, File> 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<String> getCommandHelp() {
List<String> 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<String> 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<String, File> 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<String> getCommandHelp() {
List<String> 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");
}
}

View File

@ -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;
}
}

View File

@ -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);
}
}

View File

@ -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);
}
}

View File

@ -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;
}
}

View File

@ -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());
}
}

View File

@ -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'

View File

@ -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"

View File

@ -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"

View File

@ -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"
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"

View File

@ -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'

View File

@ -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 <player>
ws delmember:
usage: /ws delmember <player>
ws leave:
usage: /ws leave
ws tp:
usage: /ws tp <target>
ws tnt:
usage: /ws tnt
ws fire:
usage: /ws fire
ws info:
usage: /ws info
ws togglebuild:
usage: /ws togglebuild <player>
ws togglegm:
usage: /ws togglegm <player>
ws toggletp:
usage: /ws toggletp <player>
ws reset:
usage: /ws reset
ws gui:
usage: /ws gui
ws delete:
usage: /ws delete <player>
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