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

@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>de.butzlabben.world</groupId> <groupId>de.butzlabben.world</groupId>
<artifactId>WorldSystem</artifactId> <artifactId>WorldSystem</artifactId>
<version>2.4.0.3</version> <version>2.4.1</version>
<properties> <properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.build.number>-</project.build.number> <project.build.number>-</project.build.number>
@ -30,6 +30,19 @@
<target>1.8</target> <target>1.8</target>
</configuration> </configuration>
</plugin> </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> </plugins>
</build> </build>
@ -68,6 +81,7 @@
<groupId>com.mojang</groupId> <groupId>com.mojang</groupId>
<artifactId>authlib</artifactId> <artifactId>authlib</artifactId>
<version>1.5.21</version> <version>1.5.21</version>
<scope>provided</scope>
</dependency> </dependency>
<!-- <!--
@ -97,5 +111,12 @@
<version>6.0.0-SNAPSHOT</version> <version>6.0.0-SNAPSHOT</version>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
<dependency>
<groupId>net.myplayplanet</groupId>
<artifactId>CommandFramework</artifactId>
<version>2.0.0-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
</dependencies> </dependencies>
</project> </project>

View File

@ -1,8 +1,14 @@
package de.butzlabben.world; package de.butzlabben.world;
import java.io.File; import de.butzlabben.autoupdater.AutoUpdater;
import java.io.IOException; 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.bstats.bukkit.Metrics;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.World; import org.bukkit.World;
@ -10,212 +16,171 @@ import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.plugin.PluginManager; import org.bukkit.plugin.PluginManager;
import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.plugin.java.JavaPlugin;
import de.butzlabben.autoupdater.AutoUpdater; import java.io.File;
import de.butzlabben.world.command.WSAddmemberCommand; import java.io.IOException;
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 Butzlabben
* @author Jubeki * @author Jubeki
* @since 10.07.2017
* @version 2.2.0.1 * @version 2.2.0.1
* @since 10.07.2017
*/ */
public class WorldSystem extends JavaPlugin { public class WorldSystem extends JavaPlugin {
final private String version = this.getDescription().getVersion(); final private String version = this.getDescription().getVersion();
private CreatorAdapter creator; private CreatorAdapter creator;
private CommandFramework framework;
private static boolean is1_13 = false; private static boolean is1_13 = false;
@Override @Override
public void onEnable() { public void onEnable() {
//Set right version //Set right version
if(Bukkit.getVersion().contains("1.13") || Bukkit.getVersion().contains("1_13") ) if (Bukkit.getVersion().contains("1.13") || Bukkit.getVersion().contains("1_13"))
is1_13 = true; is1_13 = true;
createConfigs(); createConfigs();
PluginManager pm = Bukkit.getPluginManager(); PluginManager pm = Bukkit.getPluginManager();
pm.registerEvents(new PlayerListener(), this); pm.registerEvents(new PlayerListener(), this);
pm.registerEvents(new BlockListener(), this); pm.registerEvents(new BlockListener(), this);
pm.registerEvents(new PlayerDeathListener(), this); pm.registerEvents(new PlayerDeathListener(), this);
pm.registerEvents(new CommandListener(), 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 WorldCheckerRunnable(), 20 * 5,
Bukkit.getScheduler().scheduleSyncRepeatingTask(this, new GCRunnable(), 20 * 5, 20 * PluginConfig.getLagCheckPeriod());
20 * PluginConfig.getGCPeriod());
}
Bukkit.getScheduler().scheduleSyncRepeatingTask(this, () -> { if (PluginConfig.useGC()) {
for (World w : Bukkit.getWorlds()) { Bukkit.getScheduler().scheduleSyncRepeatingTask(this, new GCRunnable(), 20 * 5,
SystemWorld sw = SystemWorld.getSystemWorld(w.getName()); 20 * PluginConfig.getGCPeriod());
if (sw != null && sw.isLoaded()) }
SettingsConfig.editWorld(w);
} Bukkit.getScheduler().scheduleSyncRepeatingTask(this, () -> {
}, 20, 20 * 10); for (World w : Bukkit.getWorlds()) {
SystemWorld sw = SystemWorld.getSystemWorld(w.getName());
if (sw != null && sw.isLoaded())
SettingsConfig.editWorld(w);
Bukkit.getScheduler().scheduleSyncRepeatingTask(this, new Runnable() { }
@Override }, 20, 20 * 10);
public void run() {
for (World w : Bukkit.getWorlds()) {
SystemWorld.tryUnloadLater(w);
}
}
}, 20 * 60 * 2, 20 * 60 * 2);
// COMMANDS Bukkit.getScheduler().scheduleSyncRepeatingTask(this, new Runnable() {
getCommand("ws").setExecutor(new WSCommand()); @Override
getCommand("ws get").setExecutor(new WSGetCommand()); public void run() {
getCommand("ws addmember").setExecutor(new WSAddmemberCommand()); for (World w : Bukkit.getWorlds()) {
getCommand("ws delmember").setExecutor(new WSDelmemberCommand()); SystemWorld.tryUnloadLater(w);
getCommand("ws home").setExecutor(new WSHomeCommand()); }
// Here we go for #20 and #22 }
getCommand("ws sethome").setExecutor(new WSSethomeCommand()); }, 20 * 60 * 2, 20 * 60 * 2);
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()); //COMMANDS
framework = new CommandFramework(this);
framework.registerCommands(new WSCommand());
framework.registerCommands(new WorldSettingsCommands());
framework.registerCommands(new WorldAdministrateCommand());
getCommand("ws gui").setExecutor(new GuiCommand());
System.setProperty("bstats.relocatecheck", "false"); System.setProperty("bstats.relocatecheck", "false");
Metrics m = new Metrics(this); Metrics m = new Metrics(this);
m.addCustomChart(new Metrics.SingleLineChart("worlds", DependenceConfig::getHighestID)); m.addCustomChart(new Metrics.SingleLineChart("worlds", DependenceConfig::getHighestID));
AutoUpdater.startAsync(); AutoUpdater.startAsync();
// Choose right creatoradapter for #16 // Choose right creatoradapter for #16
if (Bukkit.getPluginManager().getPlugin("FastAsyncWorldEdit") != null if (Bukkit.getPluginManager().getPlugin("FastAsyncWorldEdit") != null
&& Bukkit.getPluginManager().getPlugin("WorldEdit") != null) { && Bukkit.getPluginManager().getPlugin("WorldEdit") != null) {
creator = new AsyncCreatorAdapter(); creator = new AsyncCreatorAdapter();
Bukkit.getConsoleSender() Bukkit.getConsoleSender()
.sendMessage(PluginConfig.getPrefix() + "Found FAWE! Try now to create worlds async"); .sendMessage(PluginConfig.getPrefix() + "Found FAWE! Try now to create worlds async");
} else { } else {
creator = (c, sw, r) -> { creator = (c, sw, r) -> {
Bukkit.getWorlds().add(c.createWorld()); Bukkit.getWorlds().add(c.createWorld());
if (sw != null) if (sw != null)
sw.setCreating(false); sw.setCreating(false);
r.run(); r.run();
}; };
} }
// Starting for #28 // Starting for #28
if (PluginConfig.shouldDelete()) { if (PluginConfig.shouldDelete()) {
Bukkit.getConsoleSender().sendMessage(PluginConfig.getPrefix() Bukkit.getConsoleSender().sendMessage(PluginConfig.getPrefix()
+ "Searching for old worlds to delete if not loaded for " + PluginConfig.deleteAfter() + " days"); + "Searching for old worlds to delete if not loaded for " + PluginConfig.deleteAfter() + " days");
DependenceConfig.checkWorlds(); DependenceConfig.checkWorlds();
} }
Bukkit.getConsoleSender().sendMessage(PluginConfig.getPrefix() + "Succesfully enabled WorldSystem v" + version); Bukkit.getConsoleSender().sendMessage(PluginConfig.getPrefix() + "Succesfully enabled WorldSystem v" + version);
} }
@Override @Override
public void onDisable() { public void onDisable() {
for (World w : Bukkit.getWorlds()) { for (World w : Bukkit.getWorlds()) {
SystemWorld sw = SystemWorld.getSystemWorld(w.getName()); SystemWorld sw = SystemWorld.getSystemWorld(w.getName());
if (sw != null && sw.isLoaded()) { if (sw != null && sw.isLoaded()) {
sw.directUnload(w); sw.directUnload(w);
} }
} }
Bukkit.getConsoleSender() Bukkit.getConsoleSender()
.sendMessage(PluginConfig.getPrefix() + "Succesfully disabled WorldSystem v" + version); .sendMessage(PluginConfig.getPrefix() + "Succesfully disabled WorldSystem v" + version);
} }
public static void createConfigs() { public static void createConfigs() {
File dir = new File(JavaPlugin.getPlugin(WorldSystem.class).getDataFolder() + "/worldsources"); File dir = new File(JavaPlugin.getPlugin(WorldSystem.class).getDataFolder() + "/worldsources");
File config = new File(JavaPlugin.getPlugin(WorldSystem.class).getDataFolder(), "config.yml"); File config = new File(JavaPlugin.getPlugin(WorldSystem.class).getDataFolder(), "config.yml");
File dconfig = new File(JavaPlugin.getPlugin(WorldSystem.class).getDataFolder(), "dependence.yml"); File dconfig = new File(JavaPlugin.getPlugin(WorldSystem.class).getDataFolder(), "dependence.yml");
File languages = new File(JavaPlugin.getPlugin(WorldSystem.class).getDataFolder() + "/languages"); File languages = new File(JavaPlugin.getPlugin(WorldSystem.class).getDataFolder() + "/languages");
File gui = new File(JavaPlugin.getPlugin(WorldSystem.class).getDataFolder(), "gui.yml"); File gui = new File(JavaPlugin.getPlugin(WorldSystem.class).getDataFolder(), "gui.yml");
if (!dir.exists()) { if (!dir.exists()) {
dir.mkdirs(); dir.mkdirs();
} }
if (languages.exists() == false) if (languages.exists() == false)
languages.mkdirs(); languages.mkdirs();
PluginConfig.checkConfig(config); PluginConfig.checkConfig(config);
// Done with #6 // Done with #6
MessageConfig.checkConfig(new File(languages, "en.yml")); MessageConfig.checkConfig(new File(languages, "en.yml"));
MessageConfig.checkConfig(new File(languages, "de.yml")); MessageConfig.checkConfig(new File(languages, "de.yml"));
MessageConfig.checkConfig(new File(languages, "hu.yml")); MessageConfig.checkConfig(new File(languages, "hu.yml"));
MessageConfig.checkConfig(new File(languages, "nl.yml")); MessageConfig.checkConfig(new File(languages, "nl.yml"));
MessageConfig.checkConfig(new File(languages, "pl.yml")); MessageConfig.checkConfig(new File(languages, "pl.yml"));
MessageConfig.checkConfig(new File(languages, "es.yml")); MessageConfig.checkConfig(new File(languages, "es.yml"));
MessageConfig.checkConfig(new File(languages, "ru.yml")); MessageConfig.checkConfig(new File(languages, "ru.yml"));
MessageConfig.checkConfig(new File(languages, "fi.yml")); MessageConfig.checkConfig(new File(languages, "fi.yml"));
// Here we are for #5 // Here we are for #5
MessageConfig.checkConfig(new File(languages, "zh.yml")); MessageConfig.checkConfig(new File(languages, "zh.yml"));
MessageConfig.checkConfig(new File(languages, "fr.yml")); MessageConfig.checkConfig(new File(languages, "fr.yml"));
MessageConfig.checkConfig(new File(languages, PluginConfig.getLanguage() + ".yml")); MessageConfig.checkConfig(new File(languages, PluginConfig.getLanguage() + ".yml"));
if (!dconfig.exists()) { if (!dconfig.exists()) {
try { try {
dconfig.createNewFile(); dconfig.createNewFile();
} catch (IOException e) { } catch (IOException e) {
System.err.println("Wasn't able to create DependenceConfig"); System.err.println("Wasn't able to create DependenceConfig");
e.printStackTrace(); e.printStackTrace();
} }
new DependenceConfig(); new DependenceConfig();
} }
YamlConfiguration cfg = YamlConfiguration.loadConfiguration(config); YamlConfiguration cfg = YamlConfiguration.loadConfiguration(config);
SettingsConfig.checkConfig(); SettingsConfig.checkConfig();
File worlddir = new File(cfg.getString("worldfolder")); File worlddir = new File(cfg.getString("worldfolder"));
if (!worlddir.exists()) { if (!worlddir.exists()) {
worlddir.mkdirs(); worlddir.mkdirs();
} }
GuiConfig.checkConfig(gui); GuiConfig.checkConfig(gui);
} }
public static WorldSystem getInstance() { public static WorldSystem getInstance() {
return JavaPlugin.getPlugin(WorldSystem.class); return JavaPlugin.getPlugin(WorldSystem.class);
} }
public CreatorAdapter getAdapter() { public CreatorAdapter getAdapter() {
return creator; return creator;
} }
public static boolean is1_13() { public static boolean is1_13() {
return is1_13; return is1_13;
} }
} }

View File

@ -1,147 +1,235 @@
package de.butzlabben.world.command; package de.butzlabben.world.command;
import java.util.LinkedList; import de.butzlabben.autoupdater.AutoUpdater;
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.WorldSystem;
import de.butzlabben.world.config.DependenceConfig;
import de.butzlabben.world.config.MessageConfig; import de.butzlabben.world.config.MessageConfig;
import de.butzlabben.world.config.PluginConfig; 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;
public class WSCommand implements CommandExecutor, TabCompleter { import java.util.Iterator;
import java.util.List;
@Override public class WSCommand {
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 @Command(name = "ws")
public boolean onCommand(CommandSender cs, Command cmd, String label, String[] args) { public void mainCommand(CommandArgs args) {
if (args.length > 0) { CommandSender cs = args.getSender(CommandSender.class);
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;
}
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

@ -245,6 +245,15 @@ public class MessageConfig {
return getMessage("toggle.build.disabled", "§c%player§6 can no longer build!"); 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() { public static String getToggleFireEnabled() {
return getMessage("toggle.fire.enabled", "§aYou activated fire!"); return getMessage("toggle.fire.enabled", "§aYou activated fire!");
} }

View File

@ -4,7 +4,7 @@ public enum WorldPerm {
MEMBER("ws.member"), MEMBER("ws.member"),
GAMEMODE("ws.gamemode"), BUILD("ws.build"), TELEPORT("ws.teleport"), GAMEMODE("ws.gamemode"), BUILD("ws.build"), TELEPORT("ws.teleport"),
EDITMEMBERS("ws.edit"), ADMINISTRATEMEMBERS, ADMINISTRATEWORLD; EDITMEMBERS("ws.edit"), ADMINISTRATEMEMBERS, ADMINISTRATEWORLD, WORLDEDIT("ws.worldedit");
private final String opPerm; private final String opPerm;

View File

@ -2,6 +2,7 @@ package de.butzlabben.world.gui;
import java.util.UUID; import java.util.UUID;
import de.butzlabben.world.gui.playeroption.WorldEditStatus;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@ -26,6 +27,7 @@ public class PlayerOptionsGUI extends OrcInventory {
loadItem("build", "/ws togglebuild " + otherPlayer, new BuildStatus(wp)); loadItem("build", "/ws togglebuild " + otherPlayer, new BuildStatus(wp));
loadItem("gamemode", "/ws togglegm " + otherPlayer, new GamemodeStatus(wp)); loadItem("gamemode", "/ws togglegm " + otherPlayer, new GamemodeStatus(wp));
loadItem("teleport", "/ws toggletp " + otherPlayer, new TeleportStatus(wp)); loadItem("teleport", "/ws toggletp " + otherPlayer, new TeleportStatus(wp));
loadItem("worldedit", "/ws togglewe " + otherPlayer, new WorldEditStatus(wp));
loadItem("time"); loadItem("time");
loadItem("addmember"); loadItem("addmember");
loadItem("delmember"); loadItem("delmember");

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,17 +1,15 @@
package de.butzlabben.world.wrapper; package de.butzlabben.world.wrapper;
import java.io.File; import com.google.common.base.Preconditions;
import java.io.IOException; import de.butzlabben.world.config.PluginConfig;
import de.butzlabben.world.config.WorldConfig;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.OfflinePlayer; import org.bukkit.OfflinePlayer;
import org.bukkit.configuration.file.YamlConfiguration; import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import com.google.common.base.Preconditions; import java.io.File;
import java.io.IOException;
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 * This class represents a player, on a systemworld or not but be carefull when
@ -23,174 +21,198 @@ import de.butzlabben.world.config.WorldConfig;
*/ */
public class WorldPlayer { public class WorldPlayer {
private OfflinePlayer p; private OfflinePlayer p;
private String worldname; private String worldname;
/** /**
* @return the worldname, where the worldplayer object was created for * @return the worldname, where the worldplayer object was created for
*/ */
public String getWorldname() { public String getWorldname() {
return worldname; return worldname;
} }
/** /**
* toggles building for this player * toggles building for this player
* *
* @return whether can build or not * @return whether can build or not
*/ */
public boolean toggleBuild() { public boolean toggleBuild() {
Preconditions.checkArgument(isOnSystemWorld(), "player must be for this on a systemworld"); Preconditions.checkArgument(isOnSystemWorld(), "player must be for this on a systemworld");
WorldConfig wc = WorldConfig.getWorldConfig(worldname); WorldConfig wc = WorldConfig.getWorldConfig(worldname);
if (!wc.isMember(p.getUniqueId())) if (!wc.isMember(p.getUniqueId()))
return false; return false;
boolean build = wc.canBuild(p.getUniqueId()); boolean build = wc.canBuild(p.getUniqueId());
build = !build; build = !build;
wc.setBuild(p.getUniqueId(), build); wc.setBuild(p.getUniqueId(), build);
try { try {
wc.save(); wc.save();
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
} }
return build; return build;
} }
/** /**
* @return whether can build or not * @return whether can build or not
*/ */
public boolean canBuild() { public boolean canBuild() {
Preconditions.checkArgument(isOnSystemWorld(), "player must be for this on a systemworld"); Preconditions.checkArgument(isOnSystemWorld(), "player must be for this on a systemworld");
WorldConfig wc = WorldConfig.getWorldConfig(worldname); WorldConfig wc = WorldConfig.getWorldConfig(worldname);
return wc.canBuild(p.getUniqueId()); return wc.canBuild(p.getUniqueId());
} }
/** public boolean toggleWorldEdit() {
* toggles teleporting for this player Preconditions.checkArgument(isOnSystemWorld(), "player must be for this on a systemworld");
*
* @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); WorldConfig wc = WorldConfig.getWorldConfig(this.worldname);
if (!wc.isMember(p.getUniqueId())) if (!wc.isMember(this.p.getUniqueId())) {
return false; 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;
}
boolean teleport = wc.canTeleport(p.getUniqueId()); public boolean canWorldedit() {
teleport = !teleport; Preconditions.checkArgument(isOnSystemWorld(), "player must be for this on a systemworld");
wc.setTeleport(p.getUniqueId(), teleport); WorldConfig wc = WorldConfig.getWorldConfig(this.worldname);
try { return wc.canWorldEdit(this.p.getUniqueId());
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 * toggles teleporting for this player
* *
* @return whether can change his gamemode or not * @return whether can teleport or not
*/ */
public boolean toggleGamemode() { public boolean toggleTeleport() {
Preconditions.checkArgument(isOnSystemWorld(), "player must be for this on a systemworld"); Preconditions.checkArgument(isOnSystemWorld(), "player must be for this on a systemworld");
WorldConfig wc = WorldConfig.getWorldConfig(worldname); WorldConfig wc = WorldConfig.getWorldConfig(worldname);
if (!wc.isMember(p.getUniqueId())) if (!wc.isMember(p.getUniqueId()))
return false; return false;
boolean changeGamemode = wc.canGamemode(p.getUniqueId()); boolean teleport = wc.canTeleport(p.getUniqueId());
changeGamemode = !changeGamemode; teleport = !teleport;
wc.setGamemode(p.getUniqueId(), changeGamemode); wc.setTeleport(p.getUniqueId(), teleport);
try { try {
wc.save(); wc.save();
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
} }
return changeGamemode; return teleport;
} }
/** /**
* @return whether can change his gamemode or not * @return whether can teleport or not
*/ */
public boolean canChangeGamemode() { public boolean canTeleport() {
Preconditions.checkArgument(isOnSystemWorld(), "player must be for this on a systemworld"); Preconditions.checkArgument(isOnSystemWorld(), "player must be for this on a systemworld");
WorldConfig wc = WorldConfig.getWorldConfig(worldname); WorldConfig wc = WorldConfig.getWorldConfig(worldname);
return wc.canGamemode(p.getUniqueId()); return wc.canTeleport(p.getUniqueId());
} }
/** /**
* @return if he is a member * toggles gamemode changing for this player
*/ *
public boolean isMember() { * @return whether can change his gamemode or not
Preconditions.checkArgument(isOnSystemWorld(), "player must be for this on a systemworld"); */
public boolean toggleGamemode() {
Preconditions.checkArgument(isOnSystemWorld(), "player must be for this on a systemworld");
WorldConfig wc = WorldConfig.getWorldConfig(worldname); WorldConfig wc = WorldConfig.getWorldConfig(worldname);
return wc.isMember(p.getUniqueId()); if (!wc.isMember(p.getUniqueId()))
} return false;
public WorldPlayer(OfflinePlayer p, String worldname) { boolean changeGamemode = wc.canGamemode(p.getUniqueId());
this.p = p; changeGamemode = !changeGamemode;
this.worldname = worldname; wc.setGamemode(p.getUniqueId(), changeGamemode);
} try {
wc.save();
} catch (IOException e) {
e.printStackTrace();
}
return changeGamemode;
}
public WorldPlayer(Player p) { /**
this(p, p.getWorld().getName()); * @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 on a systemworld or not * @return if he is a member
*/ */
public boolean isOnSystemWorld() { public boolean isMember() {
File worldconfig = new File(Bukkit.getWorldContainer(), worldname + "/worldconfig.yml"); Preconditions.checkArgument(isOnSystemWorld(), "player must be for this on a systemworld");
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;
}
/** WorldConfig wc = WorldConfig.getWorldConfig(worldname);
* @return the given player return wc.isMember(p.getUniqueId());
*/ }
public OfflinePlayer getPlayer() {
return p;
}
/** public WorldPlayer(OfflinePlayer p, String worldname) {
* @return if he ist the owner this.p = p;
*/ this.worldname = worldname;
public boolean isOwnerofWorld() { }
if (!isOnSystemWorld())
return false;
WorldConfig wc = WorldConfig.getWorldConfig(worldname);
return wc.getOwner().equals(p.getUniqueId());
}
/** public WorldPlayer(Player p) {
* @param worldname this(p, p.getWorld().getName());
* of the world to be tested }
* @return worldname if he is the owner of the specified world
*/ /**
public boolean isMemberofWorld(String worldname) { * @return if he is on a systemworld or not
WorldConfig wc = WorldConfig.getWorldConfig(worldname); */
return wc.isMember(p.getUniqueId()); 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

@ -83,12 +83,6 @@ options:
material: TNT material: TNT
display: '&eToggle TNT-Explosion' display: '&eToggle TNT-Explosion'
back:
enabled: true
slot:
row: 3
col: 5
players: players:
title: 'Players added to this world' title: 'Players added to this world'
@ -150,8 +144,8 @@ options:
material: GOLDEN_AXE material: GOLDEN_AXE
display: '&eToggle Build-Permission' display: '&eToggle Build-Permission'
lore: lore:
- '&7Toggles the permission for a player' - '&7Toggles the permission for a player'
- '&7To build on this world' - '&7To build on this world'
gamemode: gamemode:
enabled: true enabled: true
slot: slot:
@ -163,8 +157,8 @@ options:
material: END_CRYSTAL material: END_CRYSTAL
display: '&eToggle GameMode-Permission' display: '&eToggle GameMode-Permission'
lore: lore:
- '&7Toggles the permission for a player' - '&7Toggles the permission for a player'
- '&7To change the GameMode on this world' - '&7To change the GameMode on this world'
teleport: teleport:
enabled: true enabled: true
slot: slot:
@ -176,21 +170,21 @@ options:
material: COMPASS material: COMPASS
display: '&eToggle Teleport-Permission' display: '&eToggle Teleport-Permission'
lore: lore:
- '&7Toggles the permission for a player' - '&7Toggles the permission for a player'
- '&7To teleport on this world' - '&7To teleport on this world'
time: worldedit:
enabled: false enabled: true
slot: slot:
row: 1 row: 1
col: 4 col: 4
state: state:
row: 2 row: 2
col: 4 col: 4
material: 347 material: WOODEN_AXE
display: '&eToggle Time-Permission' display: '&eToggle WorldEdit-Permission'
lore: lore:
- '&7Toggles the permission for a player' - '&7Toggles the permission for a player'
- '&7To change the time on this world' - '&7To use WorldEdit on this world'
addmember: addmember:
enabled: false enabled: false
slot: slot:
@ -202,8 +196,8 @@ options:
material: 399 material: 399
display: '&eToggle Addmember-Permission' display: '&eToggle Addmember-Permission'
lore: lore:
- '&7Toggles the permission for a player' - '&7Toggles the permission for a player'
- '&7To add a member to this world' - '&7To add a member to this world'
delmember: delmember:
enabled: false enabled: false
slot: slot:
@ -215,8 +209,8 @@ options:
material: 286 material: 286
display: '&eToggle Delmember-Permission' display: '&eToggle Delmember-Permission'
lore: lore:
- '&7Toggles the permission for a player' - '&7Toggles the permission for a player'
- '&7To remove a member from this world' - '&7To remove a member from this world'
setpermissions: setpermissions:
enabled: false enabled: false
slot: slot:
@ -228,8 +222,8 @@ options:
material: 331 material: 331
display: '&eToggle Setpermissions-Permission' display: '&eToggle Setpermissions-Permission'
lore: lore:
- '&7Toggles the permission for a player' - '&7Toggles the permission for a player'
- '&7To set permissions for a member of this world' - '&7To set permissions for a member of this world'
administrateworld: administrateworld:
enabled: false enabled: false
slot: slot:
@ -241,8 +235,8 @@ options:
material: 421 material: 421
display: '&eToggle Addmember-Permission' display: '&eToggle Addmember-Permission'
lore: lore:
- '&7Toggles the permission for a player' - '&7Toggles the permission for a player'
- '&7To adminstrate this world' - '&7To adminstrate this world'
# WorldsystemGUI # WorldsystemGUI
worldsystem: worldsystem:

View File

@ -48,6 +48,9 @@ toggle:
build: build:
enabled: "&a%player&6 kann nun bauen!" enabled: "&a%player&6 kann nun bauen!"
disabled: "&c%player&6 kann nicht mehr 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: fire:
enabled: "&aFeuer aktiviert!" enabled: "&aFeuer aktiviert!"
disabled: "&cFeuer deaktiviert!" disabled: "&cFeuer deaktiviert!"
@ -78,6 +81,7 @@ command_help:
- "/ws togglegm &8- &7Erlaubt/Verbietet einem Spieler den Spielmodus zu wechseln" - "/ws togglegm &8- &7Erlaubt/Verbietet einem Spieler den Spielmodus zu wechseln"
- "/ws togglebuild &8- &7Erlaubt/Verbietet einem Spieler zu bauen" - "/ws togglebuild &8- &7Erlaubt/Verbietet einem Spieler zu bauen"
- "/ws toggletp &8- &7Erlaubt/Verbietet einem Spieler sich zu teleportieren" - "/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 info &8- &7Zeigt Informationen \u00fcber die Welt"
- "/ws reset &8- &7Setzt deine Welt zur\u00fcck" - "/ws reset &8- &7Setzt deine Welt zur\u00fcck"
delete_command: "/ws delete &8- &7L\u00f6scht eine Welt" delete_command: "/ws delete &8- &7L\u00f6scht eine Welt"

View File

@ -48,6 +48,9 @@ toggle:
build: build:
enabled: "&a%player&6 can now build!" enabled: "&a%player&6 can now build!"
disabled: "&c%player&6 can no longer 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: fire:
enabled: "&aYou activated fire!" enabled: "&aYou activated fire!"
disabled: "&cYou deactivated fire!" disabled: "&cYou deactivated fire!"
@ -79,6 +82,7 @@ command_help:
- "/ws togglegm &8- &7Allows/Denies a player changing gamemode" - "/ws togglegm &8- &7Allows/Denies a player changing gamemode"
- "/ws togglebuild &8- &7Allows/Denies a player building on your world" - "/ws togglebuild &8- &7Allows/Denies a player building on your world"
- "/ws toggletp &8- &7Allows/Denies a player teleporting 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 info &8- &7Shows information about the world"
- "/ws reset &8- &7Will reset your world" - "/ws reset &8- &7Will reset your world"
delete_command: "/ws delete &8- &7Will delete a world" delete_command: "/ws delete &8- &7Will delete a world"

View File

@ -1,34 +1,34 @@
nopermission: "&cVous n'avez pas la permission de le faire!" nopermission: "&cVous n'avez pas la permission!"
unknown_error: "&cQuelque chose s'est mal passé ..." unknown_error: "&cQuelque chose s'est mal passé ..."
lagdetection: "Décalage Détection dans le monde: &c%world" lagdetection: "Lag détecté sur le monde: &c%world"
wrong_usage: "&c%usage" wrong_usage: "&c%usage"
not_registered: "&cCe joueur n'a pas encore rejoint!!" not_registered: "&cCe joueur n'a pas encore rejoint!!"
world: world:
reseted: "Vous auriez été réinitialisé!" reseted: "Votre monde a été réinitialisé!"
still_loaded: "&cVotre monde est toujours chargé!" still_loaded: "&cVotre monde est toujours chargé!"
not_on: "&cVous n'êtes pas sur un monde!" not_on: "&cVous n'êtes pas sur un monde!"
created: "Votre monde est maintenant prêt. Allez-y avec &a/ws home" created: "Votre monde est maintenant prêt. Allez-y avec &a/ws home"
already_exists: "&cVous avez déjà un monde!" already_exists: "&cVous avez déjà un monde!"
delete: delete:
own: "&cVotre monde a été supprimé!" own: "&cVotre monde a été supprimé!"
other: "Vous avez supprimé le monde du &c%player&6!" other: "Vous avez supprimé le monde de &c%player&6!"
does_not_exists: does_not_exists:
own: "&cTu n'as pas de monde!" own: "&cVous n'avez pas de monde!"
other: "&cCe joueur n'a pas de monde!" other: "&cCe joueur n'a pas de monde!"
setting_up: "&aChargement du monde ..." setting_up: "&aChargement du monde..."
playerlist: "Joueurs dans ce monde: %players" playerlist: "Joueurs dans ce monde: %players"
still_creating: "&cWorld is still creating" still_creating: "&cLe monde est encore en train de se créer"
set_home: "You set the home" set_home: "Vous avez placé le home"
member: member:
removed: "Vous avez supprimé &c%player&6 de votre monde!" removed: "Vous avez retiré &c%player&6 de votre monde!"
added: "Vous avez ajouté un &c%player&6 à votre monde!" added: "Vous avez ajouté &c%player&6 à votre monde!"
already_added: "&cCe joueur est déjà membre!" already_added: "&cCe joueur est déjà membre!"
not_added: not_added:
own: "&cCe joueur n'est pas membre!" own: "&cCe joueur n'est pas membre!"
other: "&cVous n'avez pas été ajouté à ce monde!" other: "&cVous n'avez pas été ajouté à ce monde!"
no_one_added: "&cThere are no members added" no_one_added: "&cIl n'y a aucun membre d'ajouté"
request: request:
expired: "&cVotre demande a expiré!" expired: "&cVotre demande a expiré!"
@ -40,20 +40,23 @@ request:
toggle: toggle:
gamemode: gamemode:
enabled: "&a%player&6 peut maintenant changer leur mode de jeu!" enabled: "&a%player&6 peut désormais changer son mode de jeu!"
disabled: "&c%player&6 ne peut maintenant changer leur mode de jeu!" disabled: "&c%player&6 ne peut désormais plus changer son mode de jeu!"
teleport: teleport:
enabled: "&a%player&6 peut maintenant téléporter!" enabled: "&a%player&6 peut désormais se téléporter!"
disabled: "&c%player&6 ne peut maintenant téléporter!" disabled: "&c%player&6 ne peut désormais plus se téléporter!"
build: build:
enabled: "&a%player&6 peut maintenant construire!" enabled: "&a%player&6 peut désormais construire!"
disabled: "&c%player&6 ne peut maintenant 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: fire:
enabled: "&aVous avez activé le feu!" enabled: "&aVous avez activé le feu!"
disabled: "&cVous avez désactivé le feu!" disabled: "&cVous avez désactivé le feu!"
tnt: tnt:
enabled: "&aVous avez activé les TNT dégâts!" enabled: "&aVous avez activé la TNT!"
disabled: "&cVous avez désactivé les TNT dégâts!" disabled: "&cVous avez désactivé la TNT!"
info: info:
owner: "Propriétaire: %data" owner: "Propriétaire: %data"
@ -61,24 +64,25 @@ info:
member: "Membre: %data" member: "Membre: %data"
tnt: "TNT: %data" tnt: "TNT: %data"
fire: "Feu: %data" fire: "Feu: %data"
enabled: "&aAllumer" enabled: "&aActivé"
disabled: "&cÉteindre" disabled: "&cDésactivé"
command_help: command_help:
list: list:
- "/ws get &8- &7Je vais vous donner un monde" - "/ws get &8- &7Vous donne un monde"
- "/ws home &8- &7Vous téléporte sur votre monde" - "/ws home &8- &7Vous téléporte sur votre monde"
- "/ws sethome &8- &7Sets a specific home" - "/ws sethome &8- &7Définit un home spécifique"
- "/ws gui &8- &7Ouvre le menu de l'interface graphique si vous êtes le propriétaire mondial" - "/ws gui &8- &7Ouvre le menu de votre monde"
- "/ws tp &8- &7Vous téléporte sur un monde spécifique" - "/ws tp &8- &7Vous téléporte sur un monde spécifique"
- "/ws addmember &8- &7Ajoute un joueur à ton monde" - "/ws addmember &8- &7Ajoute un joueur à votre monde"
- "/ws delmember &8- &7Supprime un joueur de votre monde" - "/ws delmember &8- &7Retire un joueur de votre monde"
- "/ws leave &8- &7Laissez un monde" - "/ws leave &8- &7Quitter un monde"
- "/ws tnt &8- &7Permet / Refuse TNT sur votre monde" - "/ws tnt &8- &7Active / Désactive la TNT sur votre monde"
- "/ws fire &8- &7Permet / Refuse le feu sur votre monde" - "/ws fire &8- &7Active / Désactive le feu sur votre monde"
- "/ws togglegm &8- &7Permet / Refuse à un joueur de changer de mode de jeu" - "/ws togglegm &8- &7Autorise / Interdit à un joueur de changer de mode de jeu"
- "/ws togglebuild &8- &7Permet / Refuse à un joueur de construire sur votre monde" - "/ws togglebuild &8- &7Autorise / Interdit à un joueur de construire sur votre monde"
- "/ws toggletp &8- &7Permet / Refuse à un joueur de se téléporter sur votre monde" - "/ws toggletp &8- &7Autorise / Interdit à un joueur de se téléporter sur votre monde"
- "/ws info &8- &7Affiche des informations sur le monde" - "/ws togglewe &8- &7Autorise / Interdit à un joueur d'utiliser WorldEdit"
- "/ws reset &8- &7Réinitialisera votre monde" - "/ws info &8- &7Affiche les informations relatives à un monde"
delete_command: "/ws delete &8- &7Va supprimer un monde" - "/ws reset &8- &7Réinitialiser votre monde"
delete_command: "/ws delete &8- &7Supprimer votre monde"

View File

@ -8,7 +8,7 @@ options:
enabled: enabled:
# Material name in the Material enum # Material name in the Material enum
material: INK_SACK material: INK_SACK
# Data, how it should look like eg. blue, red, green # Data, how it should look like eg. blue, red, green
data: 10 data: 10
# Displayname # Displayname
display: '&aEnabled' display: '&aEnabled'
@ -149,8 +149,8 @@ options:
material: GOLD_AXE material: GOLD_AXE
display: '&eToggle Build-Permission' display: '&eToggle Build-Permission'
lore: lore:
- '&7Toggles the permission for a player' - '&7Toggles the permission for a player'
- '&7To build on this world' - '&7To build on this world'
gamemode: gamemode:
enabled: true enabled: true
slot: slot:
@ -162,8 +162,8 @@ options:
material: END_CRYSTAL material: END_CRYSTAL
display: '&eToggle GameMode-Permission' display: '&eToggle GameMode-Permission'
lore: lore:
- '&7Toggles the permission for a player' - '&7Toggles the permission for a player'
- '&7To change the GameMode on this world' - '&7To change the GameMode on this world'
teleport: teleport:
enabled: true enabled: true
slot: slot:
@ -175,21 +175,21 @@ options:
material: COMPASS material: COMPASS
display: '&eToggle Teleport-Permission' display: '&eToggle Teleport-Permission'
lore: lore:
- '&7Toggles the permission for a player' - '&7Toggles the permission for a player'
- '&7To teleport on this world' - '&7To teleport on this world'
time: worldedit:
enabled: false enabled: true
slot: slot:
row: 1 row: 1
col: 4 col: 4
state: state:
row: 2 row: 2
col: 4 col: 4
material: 347 material: WOOD_AXE
display: '&eToggle Time-Permission' display: '&eToggle WorldEdit-Permission'
lore: lore:
- '&7Toggles the permission for a player' - '&7Toggles the permission for a player'
- '&7To change the time on this world' - '&7To use WorldEdit on this world'
addmember: addmember:
enabled: false enabled: false
slot: slot:
@ -201,8 +201,8 @@ options:
material: 399 material: 399
display: '&eToggle Addmember-Permission' display: '&eToggle Addmember-Permission'
lore: lore:
- '&7Toggles the permission for a player' - '&7Toggles the permission for a player'
- '&7To add a member to this world' - '&7To add a member to this world'
delmember: delmember:
enabled: false enabled: false
slot: slot:
@ -214,8 +214,8 @@ options:
material: 286 material: 286
display: '&eToggle Delmember-Permission' display: '&eToggle Delmember-Permission'
lore: lore:
- '&7Toggles the permission for a player' - '&7Toggles the permission for a player'
- '&7To remove a member from this world' - '&7To remove a member from this world'
setpermissions: setpermissions:
enabled: false enabled: false
slot: slot:
@ -227,8 +227,8 @@ options:
material: 331 material: 331
display: '&eToggle Setpermissions-Permission' display: '&eToggle Setpermissions-Permission'
lore: lore:
- '&7Toggles the permission for a player' - '&7Toggles the permission for a player'
- '&7To set permissions for a member of this world' - '&7To set permissions for a member of this world'
administrateworld: administrateworld:
enabled: false enabled: false
slot: slot:
@ -240,8 +240,8 @@ options:
material: 421 material: 421
display: '&eToggle Addmember-Permission' display: '&eToggle Addmember-Permission'
lore: lore:
- '&7Toggles the permission for a player' - '&7Toggles the permission for a player'
- '&7To adminstrate this world' - '&7To adminstrate this world'
# WorldsystemGUI # WorldsystemGUI
worldsystem: worldsystem:

View File

@ -7,51 +7,6 @@ api-version: 1.13
loadbefore: [FastAsyncWorldEdit, WorldEdit] 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: permissions:
ws.*: ws.*:
default: op default: op