mirror of
https://github.com/trainerlord/WorldSystem.git
synced 2024-12-02 13:23:21 +01:00
2.4.1 - New commandframework
This commit is contained in:
parent
79bd24a75a
commit
36a4ec3444
6
.idea/vcs.xml
Normal file
6
.idea/vcs.xml
Normal file
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="" vcs="Git" />
|
||||
</component>
|
||||
</project>
|
@ -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>
|
@ -3,7 +3,7 @@
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>de.butzlabben.world</groupId>
|
||||
<artifactId>WorldSystem</artifactId>
|
||||
<version>2.4.0.3</version>
|
||||
<version>2.4.1</version>
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<project.build.number>-</project.build.number>
|
||||
@ -30,6 +30,19 @@
|
||||
<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>
|
||||
|
||||
@ -68,6 +81,7 @@
|
||||
<groupId>com.mojang</groupId>
|
||||
<artifactId>authlib</artifactId>
|
||||
<version>1.5.21</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<!--
|
||||
@ -97,5 +111,12 @@
|
||||
<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>
|
@ -1,8 +1,14 @@
|
||||
package de.butzlabben.world;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
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;
|
||||
@ -10,212 +16,171 @@ 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;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* @author Butzlabben
|
||||
* @author Jubeki
|
||||
* @since 10.07.2017
|
||||
* @version 2.2.0.1
|
||||
* @since 10.07.2017
|
||||
*/
|
||||
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
|
||||
public void onEnable() {
|
||||
//Set right version
|
||||
if(Bukkit.getVersion().contains("1.13") || Bukkit.getVersion().contains("1_13") )
|
||||
is1_13 = true;
|
||||
@Override
|
||||
public void onEnable() {
|
||||
//Set right version
|
||||
if (Bukkit.getVersion().contains("1.13") || Bukkit.getVersion().contains("1_13"))
|
||||
is1_13 = true;
|
||||
|
||||
createConfigs();
|
||||
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);
|
||||
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, new WorldCheckerRunnable(), 20 * 5,
|
||||
20 * PluginConfig.getLagCheckPeriod());
|
||||
|
||||
Bukkit.getScheduler().scheduleSyncRepeatingTask(this, () -> {
|
||||
for (World w : Bukkit.getWorlds()) {
|
||||
SystemWorld sw = SystemWorld.getSystemWorld(w.getName());
|
||||
if (sw != null && sw.isLoaded())
|
||||
SettingsConfig.editWorld(w);
|
||||
if (PluginConfig.useGC()) {
|
||||
Bukkit.getScheduler().scheduleSyncRepeatingTask(this, new GCRunnable(), 20 * 5,
|
||||
20 * PluginConfig.getGCPeriod());
|
||||
}
|
||||
|
||||
}
|
||||
}, 20, 20 * 10);
|
||||
Bukkit.getScheduler().scheduleSyncRepeatingTask(this, () -> {
|
||||
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
|
||||
public void run() {
|
||||
for (World w : Bukkit.getWorlds()) {
|
||||
SystemWorld.tryUnloadLater(w);
|
||||
}
|
||||
}
|
||||
}, 20 * 60 * 2, 20 * 60 * 2);
|
||||
}
|
||||
}, 20, 20 * 10);
|
||||
|
||||
// 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());
|
||||
Bukkit.getScheduler().scheduleSyncRepeatingTask(this, new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
for (World w : Bukkit.getWorlds()) {
|
||||
SystemWorld.tryUnloadLater(w);
|
||||
}
|
||||
}
|
||||
}, 20 * 60 * 2, 20 * 60 * 2);
|
||||
|
||||
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");
|
||||
Metrics m = new Metrics(this);
|
||||
m.addCustomChart(new Metrics.SingleLineChart("worlds", DependenceConfig::getHighestID));
|
||||
System.setProperty("bstats.relocatecheck", "false");
|
||||
Metrics m = new Metrics(this);
|
||||
m.addCustomChart(new Metrics.SingleLineChart("worlds", DependenceConfig::getHighestID));
|
||||
|
||||
AutoUpdater.startAsync();
|
||||
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();
|
||||
};
|
||||
}
|
||||
// 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();
|
||||
}
|
||||
// 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);
|
||||
}
|
||||
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);
|
||||
}
|
||||
}
|
||||
@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);
|
||||
}
|
||||
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"));
|
||||
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);
|
||||
}
|
||||
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 static WorldSystem getInstance() {
|
||||
return JavaPlugin.getPlugin(WorldSystem.class);
|
||||
}
|
||||
|
||||
public CreatorAdapter getAdapter() {
|
||||
return creator;
|
||||
}
|
||||
public CreatorAdapter getAdapter() {
|
||||
return creator;
|
||||
}
|
||||
|
||||
public static boolean is1_13() {
|
||||
return is1_13;
|
||||
}
|
||||
public static boolean is1_13() {
|
||||
return is1_13;
|
||||
}
|
||||
}
|
||||
|
@ -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.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;
|
||||
|
||||
public class WSCommand implements CommandExecutor, TabCompleter {
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
@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;
|
||||
}
|
||||
public class WSCommand {
|
||||
|
||||
@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;
|
||||
}
|
||||
@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());
|
||||
});
|
||||
}
|
||||
}
|
@ -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()));
|
||||
}
|
||||
}
|
||||
}
|
@ -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());
|
||||
}
|
||||
}
|
||||
}
|
@ -245,6 +245,15 @@ public class MessageConfig {
|
||||
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!");
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -4,7 +4,7 @@ public enum WorldPerm {
|
||||
|
||||
MEMBER("ws.member"),
|
||||
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;
|
||||
|
||||
|
@ -2,6 +2,7 @@ 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;
|
||||
|
||||
@ -26,6 +27,7 @@ public class PlayerOptionsGUI extends OrcInventory {
|
||||
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");
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
@ -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;
|
||||
}
|
||||
}
|
@ -1,17 +1,15 @@
|
||||
package de.butzlabben.world.wrapper;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
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 com.google.common.base.Preconditions;
|
||||
|
||||
import de.butzlabben.world.config.PluginConfig;
|
||||
import de.butzlabben.world.config.WorldConfig;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* 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 {
|
||||
|
||||
private OfflinePlayer p;
|
||||
private String worldname;
|
||||
private OfflinePlayer p;
|
||||
private String worldname;
|
||||
|
||||
/**
|
||||
* @return the worldname, where the worldplayer object was created for
|
||||
*/
|
||||
public String getWorldname() {
|
||||
return 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");
|
||||
/**
|
||||
* 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;
|
||||
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;
|
||||
}
|
||||
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());
|
||||
}
|
||||
/**
|
||||
* @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");
|
||||
public boolean toggleWorldEdit() {
|
||||
Preconditions.checkArgument(isOnSystemWorld(), "player must be for this on a systemworld");
|
||||
|
||||
WorldConfig wc = WorldConfig.getWorldConfig(worldname);
|
||||
if (!wc.isMember(p.getUniqueId()))
|
||||
return false;
|
||||
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;
|
||||
}
|
||||
|
||||
boolean teleport = wc.canTeleport(p.getUniqueId());
|
||||
teleport = !teleport;
|
||||
wc.setTeleport(p.getUniqueId(), teleport);
|
||||
try {
|
||||
wc.save();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return teleport;
|
||||
}
|
||||
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());
|
||||
}
|
||||
|
||||
/**
|
||||
* @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");
|
||||
/**
|
||||
* 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;
|
||||
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;
|
||||
}
|
||||
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 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 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());
|
||||
}
|
||||
|
||||
/**
|
||||
* @return if he is a member
|
||||
*/
|
||||
public boolean isMember() {
|
||||
Preconditions.checkArgument(isOnSystemWorld(), "player must be for this on a systemworld");
|
||||
/**
|
||||
* 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);
|
||||
return wc.isMember(p.getUniqueId());
|
||||
}
|
||||
WorldConfig wc = WorldConfig.getWorldConfig(worldname);
|
||||
if (!wc.isMember(p.getUniqueId()))
|
||||
return false;
|
||||
|
||||
public WorldPlayer(OfflinePlayer p, String worldname) {
|
||||
this.p = p;
|
||||
this.worldname = worldname;
|
||||
}
|
||||
boolean changeGamemode = wc.canGamemode(p.getUniqueId());
|
||||
changeGamemode = !changeGamemode;
|
||||
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
|
||||
*/
|
||||
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 if he is a member
|
||||
*/
|
||||
public boolean isMember() {
|
||||
Preconditions.checkArgument(isOnSystemWorld(), "player must be for this on a systemworld");
|
||||
|
||||
/**
|
||||
* @return the given player
|
||||
*/
|
||||
public OfflinePlayer getPlayer() {
|
||||
return p;
|
||||
}
|
||||
WorldConfig wc = WorldConfig.getWorldConfig(worldname);
|
||||
return wc.isMember(p.getUniqueId());
|
||||
}
|
||||
|
||||
/**
|
||||
* @return if he ist the owner
|
||||
*/
|
||||
public boolean isOwnerofWorld() {
|
||||
if (!isOnSystemWorld())
|
||||
return false;
|
||||
WorldConfig wc = WorldConfig.getWorldConfig(worldname);
|
||||
return wc.getOwner().equals(p.getUniqueId());
|
||||
}
|
||||
public WorldPlayer(OfflinePlayer p, String worldname) {
|
||||
this.p = p;
|
||||
this.worldname = worldname;
|
||||
}
|
||||
|
||||
/**
|
||||
* @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());
|
||||
}
|
||||
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());
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -83,12 +83,6 @@ options:
|
||||
material: TNT
|
||||
display: '&eToggle TNT-Explosion'
|
||||
|
||||
back:
|
||||
enabled: true
|
||||
slot:
|
||||
row: 3
|
||||
col: 5
|
||||
|
||||
players:
|
||||
title: 'Players added to this world'
|
||||
|
||||
@ -150,8 +144,8 @@ options:
|
||||
material: GOLDEN_AXE
|
||||
display: '&eToggle Build-Permission'
|
||||
lore:
|
||||
- '&7Toggles the permission for a player'
|
||||
- '&7To build on this world'
|
||||
- '&7Toggles the permission for a player'
|
||||
- '&7To build on this world'
|
||||
gamemode:
|
||||
enabled: true
|
||||
slot:
|
||||
@ -163,8 +157,8 @@ options:
|
||||
material: END_CRYSTAL
|
||||
display: '&eToggle GameMode-Permission'
|
||||
lore:
|
||||
- '&7Toggles the permission for a player'
|
||||
- '&7To change the GameMode on this world'
|
||||
- '&7Toggles the permission for a player'
|
||||
- '&7To change the GameMode on this world'
|
||||
teleport:
|
||||
enabled: true
|
||||
slot:
|
||||
@ -176,21 +170,21 @@ options:
|
||||
material: COMPASS
|
||||
display: '&eToggle Teleport-Permission'
|
||||
lore:
|
||||
- '&7Toggles the permission for a player'
|
||||
- '&7To teleport on this world'
|
||||
time:
|
||||
enabled: false
|
||||
- '&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: 347
|
||||
display: '&eToggle Time-Permission'
|
||||
material: WOODEN_AXE
|
||||
display: '&eToggle WorldEdit-Permission'
|
||||
lore:
|
||||
- '&7Toggles the permission for a player'
|
||||
- '&7To change the time on this world'
|
||||
- '&7Toggles the permission for a player'
|
||||
- '&7To use WorldEdit on this world'
|
||||
addmember:
|
||||
enabled: false
|
||||
slot:
|
||||
@ -202,8 +196,8 @@ options:
|
||||
material: 399
|
||||
display: '&eToggle Addmember-Permission'
|
||||
lore:
|
||||
- '&7Toggles the permission for a player'
|
||||
- '&7To add a member to this world'
|
||||
- '&7Toggles the permission for a player'
|
||||
- '&7To add a member to this world'
|
||||
delmember:
|
||||
enabled: false
|
||||
slot:
|
||||
@ -215,8 +209,8 @@ options:
|
||||
material: 286
|
||||
display: '&eToggle Delmember-Permission'
|
||||
lore:
|
||||
- '&7Toggles the permission for a player'
|
||||
- '&7To remove a member from this world'
|
||||
- '&7Toggles the permission for a player'
|
||||
- '&7To remove a member from this world'
|
||||
setpermissions:
|
||||
enabled: false
|
||||
slot:
|
||||
@ -228,8 +222,8 @@ options:
|
||||
material: 331
|
||||
display: '&eToggle Setpermissions-Permission'
|
||||
lore:
|
||||
- '&7Toggles the permission for a player'
|
||||
- '&7To set permissions for a member of this world'
|
||||
- '&7Toggles the permission for a player'
|
||||
- '&7To set permissions for a member of this world'
|
||||
administrateworld:
|
||||
enabled: false
|
||||
slot:
|
||||
@ -241,8 +235,8 @@ options:
|
||||
material: 421
|
||||
display: '&eToggle Addmember-Permission'
|
||||
lore:
|
||||
- '&7Toggles the permission for a player'
|
||||
- '&7To adminstrate this world'
|
||||
- '&7Toggles the permission for a player'
|
||||
- '&7To adminstrate this world'
|
||||
|
||||
# WorldsystemGUI
|
||||
worldsystem:
|
||||
|
@ -48,6 +48,9 @@ toggle:
|
||||
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!"
|
||||
@ -78,6 +81,7 @@ command_help:
|
||||
- "/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"
|
@ -48,6 +48,9 @@ toggle:
|
||||
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!"
|
||||
@ -79,6 +82,7 @@ command_help:
|
||||
- "/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"
|
@ -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é ..."
|
||||
lagdetection: "Décalage Détection dans le monde: &c%world"
|
||||
lagdetection: "Lag détecté sur le monde: &c%world"
|
||||
wrong_usage: "&c%usage"
|
||||
not_registered: "&cCe joueur n'a pas encore rejoint!!"
|
||||
|
||||
world:
|
||||
reseted: "Vous auriez été réinitialisé!"
|
||||
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 du &c%player&6!"
|
||||
other: "Vous avez supprimé le monde de &c%player&6!"
|
||||
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!"
|
||||
setting_up: "&aChargement du monde ..."
|
||||
setting_up: "&aChargement du monde..."
|
||||
playerlist: "Joueurs dans ce monde: %players"
|
||||
still_creating: "&cWorld is still creating"
|
||||
set_home: "You set the home"
|
||||
still_creating: "&cLe monde est encore en train de se créer"
|
||||
set_home: "Vous avez placé le home"
|
||||
|
||||
member:
|
||||
removed: "Vous avez supprimé &c%player&6 de votre monde!"
|
||||
added: "Vous avez ajouté un &c%player&6 à votre monde!"
|
||||
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: "&cThere are no members added"
|
||||
no_one_added: "&cIl n'y a aucun membre d'ajouté"
|
||||
|
||||
request:
|
||||
expired: "&cVotre demande a expiré!"
|
||||
@ -40,20 +40,23 @@ request:
|
||||
|
||||
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!"
|
||||
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 maintenant téléporter!"
|
||||
disabled: "&c%player&6 ne peut maintenant téléporter!"
|
||||
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 maintenant construire!"
|
||||
disabled: "&c%player&6 ne peut maintenant construire!"
|
||||
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é les TNT dégâts!"
|
||||
disabled: "&cVous avez désactivé les TNT dégâts!"
|
||||
enabled: "&aVous avez activé la TNT!"
|
||||
disabled: "&cVous avez désactivé la TNT!"
|
||||
|
||||
info:
|
||||
owner: "Propriétaire: %data"
|
||||
@ -61,24 +64,25 @@ info:
|
||||
member: "Membre: %data"
|
||||
tnt: "TNT: %data"
|
||||
fire: "Feu: %data"
|
||||
enabled: "&aAllumer"
|
||||
disabled: "&cÉteindre"
|
||||
enabled: "&aActivé"
|
||||
disabled: "&cDésactivé"
|
||||
|
||||
command_help:
|
||||
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 sethome &8- &7Sets a specific home"
|
||||
- "/ws gui &8- &7Ouvre le menu de l'interface graphique si vous êtes le propriétaire mondial"
|
||||
- "/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 à 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"
|
||||
- "/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"
|
@ -8,7 +8,7 @@ options:
|
||||
enabled:
|
||||
# Material name in the Material enum
|
||||
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
|
||||
# Displayname
|
||||
display: '&aEnabled'
|
||||
@ -149,8 +149,8 @@ options:
|
||||
material: GOLD_AXE
|
||||
display: '&eToggle Build-Permission'
|
||||
lore:
|
||||
- '&7Toggles the permission for a player'
|
||||
- '&7To build on this world'
|
||||
- '&7Toggles the permission for a player'
|
||||
- '&7To build on this world'
|
||||
gamemode:
|
||||
enabled: true
|
||||
slot:
|
||||
@ -162,8 +162,8 @@ options:
|
||||
material: END_CRYSTAL
|
||||
display: '&eToggle GameMode-Permission'
|
||||
lore:
|
||||
- '&7Toggles the permission for a player'
|
||||
- '&7To change the GameMode on this world'
|
||||
- '&7Toggles the permission for a player'
|
||||
- '&7To change the GameMode on this world'
|
||||
teleport:
|
||||
enabled: true
|
||||
slot:
|
||||
@ -175,21 +175,21 @@ options:
|
||||
material: COMPASS
|
||||
display: '&eToggle Teleport-Permission'
|
||||
lore:
|
||||
- '&7Toggles the permission for a player'
|
||||
- '&7To teleport on this world'
|
||||
time:
|
||||
enabled: false
|
||||
- '&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: 347
|
||||
display: '&eToggle Time-Permission'
|
||||
material: WOOD_AXE
|
||||
display: '&eToggle WorldEdit-Permission'
|
||||
lore:
|
||||
- '&7Toggles the permission for a player'
|
||||
- '&7To change the time on this world'
|
||||
- '&7Toggles the permission for a player'
|
||||
- '&7To use WorldEdit on this world'
|
||||
addmember:
|
||||
enabled: false
|
||||
slot:
|
||||
@ -201,8 +201,8 @@ options:
|
||||
material: 399
|
||||
display: '&eToggle Addmember-Permission'
|
||||
lore:
|
||||
- '&7Toggles the permission for a player'
|
||||
- '&7To add a member to this world'
|
||||
- '&7Toggles the permission for a player'
|
||||
- '&7To add a member to this world'
|
||||
delmember:
|
||||
enabled: false
|
||||
slot:
|
||||
@ -214,8 +214,8 @@ options:
|
||||
material: 286
|
||||
display: '&eToggle Delmember-Permission'
|
||||
lore:
|
||||
- '&7Toggles the permission for a player'
|
||||
- '&7To remove a member from this world'
|
||||
- '&7Toggles the permission for a player'
|
||||
- '&7To remove a member from this world'
|
||||
setpermissions:
|
||||
enabled: false
|
||||
slot:
|
||||
@ -227,8 +227,8 @@ options:
|
||||
material: 331
|
||||
display: '&eToggle Setpermissions-Permission'
|
||||
lore:
|
||||
- '&7Toggles the permission for a player'
|
||||
- '&7To set permissions for a member of this world'
|
||||
- '&7Toggles the permission for a player'
|
||||
- '&7To set permissions for a member of this world'
|
||||
administrateworld:
|
||||
enabled: false
|
||||
slot:
|
||||
@ -240,8 +240,8 @@ options:
|
||||
material: 421
|
||||
display: '&eToggle Addmember-Permission'
|
||||
lore:
|
||||
- '&7Toggles the permission for a player'
|
||||
- '&7To adminstrate this world'
|
||||
- '&7Toggles the permission for a player'
|
||||
- '&7To adminstrate this world'
|
||||
|
||||
# WorldsystemGUI
|
||||
worldsystem:
|
||||
|
@ -7,51 +7,6 @@ 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
|
||||
|
Loading…
Reference in New Issue
Block a user