Compare commits
3 Commits
9f4fbead7f
...
dad057825c
Author | SHA1 | Date |
---|---|---|
Daniel | dad057825c | |
Daniel | 540bf968cc | |
Daniel | 825413fcc3 |
|
@ -0,0 +1 @@
|
|||
When Merging Rewrite with Master On Complete Remember to only Stage the necessary Files.
|
|
@ -0,0 +1,89 @@
|
|||
nopermission: "&cYou do not have permission to that command!"
|
||||
unknown_error: "&cSomething went wrong..."
|
||||
lagdetection: "Lagdetection in world: &c%world"
|
||||
wrong_usage: "&c%usage"
|
||||
not_registered: "&cThis player hasn't joined yet!"
|
||||
|
||||
world:
|
||||
reseted: "You would was reset!"
|
||||
still_loaded: "&cYour world is still loaded!"
|
||||
not_on: "&cYou are not on a world!"
|
||||
created: "Your world is now ready. Get there with &a/ws home"
|
||||
already_exists: "&cYou already have a world!"
|
||||
delete:
|
||||
own: "&cYour world was deleted!"
|
||||
other: "You deleted the world of &c%player&6!"
|
||||
does_not_exists:
|
||||
own: "&cYou don't have a world!"
|
||||
other: "&cThis player doesn't has a world!"
|
||||
setting_up: "&aLoading world..."
|
||||
playerlist: "Players in this world: %players"
|
||||
still_creating: "&cWorld is still creating"
|
||||
set_home: "You set the home"
|
||||
not_enough_money: "You do not have enough money"
|
||||
|
||||
member:
|
||||
removed: "You removed &c%player&6 from your world!"
|
||||
added: "You have added &c%player&6 to your world!"
|
||||
already_added: "&cThis player is already a member!"
|
||||
not_added:
|
||||
own: "&cThis player isn't a member!"
|
||||
other: "&cYou have not been added to this world!"
|
||||
no_one_added: "&cThere are no members added"
|
||||
|
||||
request:
|
||||
expired: "&cYour request has expired!"
|
||||
confirm: "WARNING - Please confirm reset of your world: %command"
|
||||
until_expire: "&cYour request expires in %time seconds!"
|
||||
already_sent: "&cYou already sent a request!"
|
||||
not_sent: "&cYou have not sent a request!"
|
||||
invalid_input: "&c%input is not a valid request!"
|
||||
|
||||
toggle:
|
||||
gamemode:
|
||||
enabled: "&a%player&6 can now change their gamemode!"
|
||||
disabled: "&c%player&6 can no longer change their gamemode!"
|
||||
teleport:
|
||||
enabled: "&a%player&6 can now teleport!"
|
||||
disabled: "&c%player&6 can no longer teleport!"
|
||||
build:
|
||||
enabled: "&a%player&6 can now build!"
|
||||
disabled: "&c%player&6 can no longer build!"
|
||||
worldedit:
|
||||
enabled: "&a%player&6 can now use WorldEdit!"
|
||||
disabled: "&c%player&6 can no longer use WorldEdit!"
|
||||
fire:
|
||||
enabled: "&aYou activated fire!"
|
||||
disabled: "&cYou deactivated fire!"
|
||||
tnt:
|
||||
enabled: "&aYou activated TNT-Damage!"
|
||||
disabled: "&cYou deactivated TNT-Damage!"
|
||||
|
||||
info:
|
||||
owner: "Owner: %data"
|
||||
id: "ID: %data"
|
||||
member: "Member: %data"
|
||||
tnt: "TNT: %data"
|
||||
fire: "Fire: %data"
|
||||
enabled: "&aOn"
|
||||
disabled: "&cOff"
|
||||
|
||||
command_help:
|
||||
list:
|
||||
- "/ws get &8- &7Will give you a world"
|
||||
- "/ws home &8- &7Teleports you on your world"
|
||||
- "/ws sethome &8- &7Sets a specific home"
|
||||
- "/ws gui &8- &7Opens the GUI menu if you are the world owner"
|
||||
- "/ws tp &8- &7Teleports you on a specific world"
|
||||
- "/ws addmember &8- &7Adds a player to your world"
|
||||
- "/ws delmember &8- &7Removes a player from your world"
|
||||
- "/ws leave &8- &7Leave a world"
|
||||
- "/ws tnt &8- &7Allows/Denies TNT on your world"
|
||||
- "/ws fire &8- &7Allows/Denies Fire on your world"
|
||||
- "/ws togglegm &8- &7Allows/Denies a player changing gamemode"
|
||||
- "/ws togglebuild &8- &7Allows/Denies a player building on your world"
|
||||
- "/ws toggletp &8- &7Allows/Denies a player teleporting on your world"
|
||||
- "/ws togglewe &8- &7Allows/Denys a player using WorldEdit"
|
||||
- "/ws info &8- &7Shows information about the world"
|
||||
- "/ws reset &8- &7Will reset your world"
|
||||
delete_command: "/ws delete &8- &7Will delete a world"
|
|
@ -0,0 +1,88 @@
|
|||
nopermission: "&cNo tienes permiso."
|
||||
unknown_error: "&cAlgo salio mal..."
|
||||
lagdetection: "Deteccion de lag en el mundo: &c%world"
|
||||
wrong_usage: "&c%usage"
|
||||
not_registered: "&cEse jugador no existe."
|
||||
|
||||
world:
|
||||
reseted: "Tu mundo ha sido reiniciado."
|
||||
still_loaded: "&cTu mundo aun esta cargando."
|
||||
not_on: "&cNo estas en un mundo."
|
||||
created: "Tu mundo esta listo. Ve a el con &a/ws home&6."
|
||||
already_exists: "&cYa tienes un mundo."
|
||||
delete:
|
||||
own: "&cTu mundo ha sido eliminado"
|
||||
other: "Has eliminado el mundo de &c%player&6."
|
||||
does_not_exists:
|
||||
own: "&cNo tienes un mundo."
|
||||
other: "&cEse jugador no tiene un mundo."
|
||||
setting_up: "&aConfigurando el mundo..."
|
||||
playerlist: "Jugadores en este mundo: %players"
|
||||
still_creating: "&cEl mundo aun no esta listo."
|
||||
set_home: "Has establecido el hogar."
|
||||
not_enough_money: "No tienes suficiente dinero."
|
||||
|
||||
member:
|
||||
removed: "Has eliminado a &c%player&6 de tu mundo."
|
||||
added: "Has agregado a &c%player&6 a tu mundo."
|
||||
already_added: "&cEse jugador ya es miembro de tu mundo."
|
||||
not_added:
|
||||
own: "&cEse jugador no es miembro de tu mundo."
|
||||
other: "&cNo estas agregado a este mundo."
|
||||
no_one_added: "&cNo hay jugadores agregados."
|
||||
|
||||
request:
|
||||
expired: "&cTu solicitud ha expirado."
|
||||
confirm: "&cPor favor confirma el reinicio de tu mundo con: %command"
|
||||
until_expire: "&cTu solicitud expira en %time segundos."
|
||||
already_sent: "&cYa has enviado una solicitud."
|
||||
not_sent: "&cNo has enviado una solicitud."
|
||||
invalid_input: "&c%input no es una solicitud valida."
|
||||
|
||||
toggle:
|
||||
gamemode:
|
||||
enabled: "&a%player&6 ahora puede cambiar su modo de juego."
|
||||
disabled: "&c%player&6 ya no puede cambiar su modo de juego."
|
||||
teleport:
|
||||
enabled: "&a%player&6 ahora puede teletransportarse."
|
||||
disabled: "&c%player&6 ya no puede teletransportarse."
|
||||
build:
|
||||
enabled: "&a%player&6 ahora puede construir."
|
||||
disabled: "&c%player&6 ya no puede construir"
|
||||
worldedit:
|
||||
enabled: "&a%player&6 ahora puede usar WorldEdit."
|
||||
disabled: "&c%player&6 ya no puede usar WorldEdit."
|
||||
fire:
|
||||
enabled: "&aHas activado el fuego."
|
||||
disabled: "&cHas desactivado el fuego."
|
||||
tnt:
|
||||
enabled: "&aHas activado la TNT."
|
||||
disabled: "&cHas desactivado la TNT."
|
||||
|
||||
info:
|
||||
owner: "Propietario: %data"
|
||||
id: "ID: %data"
|
||||
member: "Miembros: %data"
|
||||
tnt: "TNT: %data"
|
||||
fire: "Fuego: %data"
|
||||
enabled: "&aActivado"
|
||||
disabled: "&cDesactivado"
|
||||
command_help:
|
||||
list:
|
||||
- "/ws get &8- &7Obten tu mundo"
|
||||
- "/ws home &8- &7Ve a tu mundo"
|
||||
- "/ws sethome &8- &7Sets a specific home"
|
||||
- "/ws gui &8- &7Abre el menu de tu mundo"
|
||||
- "/ws tp &8- &7Ve a un mundo especifico"
|
||||
- "/ws addmember &8- &7Agrega jugadores a tu mundo"
|
||||
- "/ws delmember &8- &7Elimina jugadores de tu mundo"
|
||||
- "/ws leave &8- &7Salir de un mundo"
|
||||
- "/ws tnt &8- &7Activa/Desactiva la TNT en tu mundo"
|
||||
- "/ws fire &8- &7Activa/Desactiva el FUEGO en tu mundo"
|
||||
- "/ws togglegm &8- &7Activa/Desactiva el cambio de modo"
|
||||
- "/ws togglebuild &8- &7Activa/Desactiva la construccion"
|
||||
- "/ws toggletp &8- &7Activa/Desactiva la teletransportacion"
|
||||
- "/ws togglewe &8- &7Activa/Desactiva el uso de WorldEdit."
|
||||
- "/ws info &8- &7Muestra informacion del mundo"
|
||||
- "/ws reset &8- &7Reinicia tu mundo"
|
||||
delete_command: "/ws delete &8- &7Elimina tu mundo"
|
|
@ -4,32 +4,37 @@ import de.butzlabben.world.commands.WorldSystemCommandExecuter;
|
|||
import de.butzlabben.world.commands.commands.DebugCommandTest;
|
||||
import de.butzlabben.world.commands.commands.WorldSystemTabComplete;
|
||||
import de.butzlabben.world.config.PluginConfig;
|
||||
import org.bukkit.plugin.PluginDescriptionFile;
|
||||
import de.butzlabben.world.utils.PluginRunner;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
import org.bukkit.plugin.java.JavaPluginLoader;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.InputStream;
|
||||
|
||||
public class WorldSystem extends JavaPlugin
|
||||
public class WorldSystem
|
||||
{
|
||||
private PluginRunner runner;
|
||||
protected static WorldSystem activeInst = null;
|
||||
|
||||
private static PluginConfig cfg;
|
||||
|
||||
public WorldSystem()
|
||||
{
|
||||
super();
|
||||
|
||||
private WorldSystem(PluginRunner run) {
|
||||
runner = run;
|
||||
}
|
||||
|
||||
protected WorldSystem(JavaPluginLoader loader, PluginDescriptionFile description, File dataFolder, File file)
|
||||
{
|
||||
super(loader, description, dataFolder, file);
|
||||
protected WorldSystem() {
|
||||
runner = null;
|
||||
}
|
||||
|
||||
public void saveDefaultConfig()
|
||||
{
|
||||
runner.saveDefaultConfig();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEnable() {
|
||||
createConfigs();
|
||||
|
||||
createCommands();
|
||||
}
|
||||
|
||||
|
@ -42,12 +47,12 @@ public class WorldSystem extends JavaPlugin
|
|||
cmdExecuter.addCommand("test", new DebugCommandTest());
|
||||
}
|
||||
|
||||
this.getCommand("ws").setExecutor(cmdExecuter);
|
||||
this.getCommand("ws").setTabCompleter(new WorldSystemTabComplete(cmdExecuter));
|
||||
runner.getCommand("ws").setExecutor(cmdExecuter);
|
||||
runner.getCommand("ws").setTabCompleter(new WorldSystemTabComplete(cmdExecuter));
|
||||
}
|
||||
|
||||
private void createConfigs() {
|
||||
File folder = getInstance().getDataFolder();
|
||||
File folder = runner.getInstance().getDataFolder();
|
||||
try
|
||||
{
|
||||
cfg = new PluginConfig(new File(folder, "config.yml"));
|
||||
|
@ -63,7 +68,14 @@ public class WorldSystem extends JavaPlugin
|
|||
}
|
||||
|
||||
public static WorldSystem getInstance() {
|
||||
return JavaPlugin.getPlugin(WorldSystem.class);
|
||||
if (activeInst == null) {
|
||||
activeInst = new WorldSystem(JavaPlugin.getPlugin(PluginRunner.class));
|
||||
}
|
||||
return activeInst;
|
||||
}
|
||||
|
||||
public InputStream getResource(String filename) {
|
||||
return runner.getResource(filename);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,33 @@
|
|||
package de.butzlabben.world.commands.commands;
|
||||
|
||||
import de.butzlabben.world.WorldSystem;
|
||||
import de.butzlabben.world.commands.WorldSystemCommand;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class BaseCommand implements WorldSystemCommand
|
||||
{
|
||||
@Override
|
||||
public boolean run(CommandSender sender)
|
||||
{
|
||||
return false;
|
||||
|
||||
// String prefix = WorldSystem.getWSConfig().getPrefix();
|
||||
// sender.sendMessage(
|
||||
// prefix + "WorldSystem by Butzlabben v" + WorldSystem.getInstance().getDescription().getVersion());
|
||||
// sender.sendMessage(prefix + "Contributors: Jubeki, montlikadani, jstoeckm2");
|
||||
// List<String> cmdHelp = MessageConfig.getCommandHelp();
|
||||
// cmdHelp.forEach(s -> sender.sendMessage(prefix + s));
|
||||
// if (sender.hasPermission("ws.delete"))
|
||||
// {
|
||||
// sender.sendMessage(MessageConfig.getDeleteCommandHelp());
|
||||
// }
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] arguments()
|
||||
{
|
||||
return new String[0];
|
||||
}
|
||||
}
|
|
@ -0,0 +1,290 @@
|
|||
package de.butzlabben.world.config;
|
||||
|
||||
import com.fastasyncworldedit.core.configuration.file.YamlConfiguration;
|
||||
import de.butzlabben.world.WorldSystem;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import java.io.*;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.nio.file.Files;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class LanguageConfig
|
||||
{
|
||||
|
||||
//TODO NEXT Logger
|
||||
private static final List<String> defaultCmdHelp = new ArrayList<>(20);
|
||||
private static File languageFile;
|
||||
|
||||
static {
|
||||
defaultCmdHelp.add("/ws get §8- §7Will give you a World");
|
||||
defaultCmdHelp.add("/ws home §8- §7Teleports you on your World");
|
||||
defaultCmdHelp.add("/ws sethome §8- §7Sets a specific home");
|
||||
defaultCmdHelp.add("/ws tp §8- §7Teleports you on a specific World");
|
||||
defaultCmdHelp.add("/ws addmember §8- §7Adds a player to your World");
|
||||
defaultCmdHelp.add("/ws delmember§8 - §7Removes a player from your World");
|
||||
defaultCmdHelp.add("/ws tnt §8- §7Allows/Denys TNT on your World");
|
||||
defaultCmdHelp.add("/ws fire §8- §7Allows/Denys Fire on your World");
|
||||
defaultCmdHelp.add("/ws togglechgm §8- §7Allows/Denys a player changing gamemode");
|
||||
defaultCmdHelp.add("/ws togglebuild §8- §7Allows/Denys a player building");
|
||||
defaultCmdHelp.add("/ws toggletp §8- §7Allows/Denys a player teleporting");
|
||||
defaultCmdHelp.add("/ws info §8- §7Shows information about the World");
|
||||
defaultCmdHelp.add("/ws reset §8- §7Will reset your World");
|
||||
}
|
||||
|
||||
//limit Constructor Access
|
||||
private LanguageConfig() {
|
||||
}
|
||||
|
||||
public static void checkConfig(File f) {
|
||||
languageFile = f;
|
||||
if (!languageFile.exists()) {
|
||||
try {
|
||||
String[] fileName = f.getName().split("/");
|
||||
InputStream in = WorldSystem.getInstance().getResource("languages/" + fileName[fileName.length - 1]);
|
||||
|
||||
if (in == null) {
|
||||
in = WorldSystem.getInstance().getResource("custom.yml");
|
||||
}
|
||||
Files.copy(in, languageFile.toPath());
|
||||
} catch (IOException e) {
|
||||
System.err.println("Wasn't able to create Message file");
|
||||
e.printStackTrace(); //TODO Replace with Logger
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static YamlConfiguration getConfig() {
|
||||
try {
|
||||
return YamlConfiguration.loadConfiguration(new InputStreamReader(new FileInputStream(languageFile), StandardCharsets.UTF_8));
|
||||
} catch (FileNotFoundException e) {
|
||||
e.printStackTrace();//TODO Replace with Logger
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private static String getRawMessage(String path, String alt) {
|
||||
return ChatColor.translateAlternateColorCodes('&', getConfig().getString(path, alt));
|
||||
}
|
||||
|
||||
private static String getMessage(String path, String alt) {
|
||||
return WorldSystem.getWSConfig().getPrefix() + getRawMessage(path, alt);
|
||||
}
|
||||
|
||||
public static String getNoPermission() {
|
||||
return getMessage("nopermission", "§cYou don't have permissions!");
|
||||
}
|
||||
|
||||
public static String getSettingUpWorld() {
|
||||
return getMessage("world.setting_up", "§aSetting up world...");
|
||||
}
|
||||
|
||||
public static String getPlayerList() {
|
||||
return getMessage("world.playerlist", "Player in this world: %player");
|
||||
}
|
||||
|
||||
public static String getLagDetection() {
|
||||
return getMessage("lagdetection", "Lagdetection in world from: §c%world");
|
||||
}
|
||||
|
||||
public static String getWrongUsage() {
|
||||
return getMessage("wrong_usage", "§c%usage");
|
||||
}
|
||||
|
||||
public static String getNoWorldOwn() {
|
||||
return getMessage("world.does_not_exists.own", "§cYou don't have a world!");
|
||||
}
|
||||
|
||||
public static String getNoWorldOther() {
|
||||
return getMessage("world.does_not_exists.other", "§cThis player doesn't has a world!");
|
||||
}
|
||||
|
||||
public static String getNotRegistered() {
|
||||
return getMessage("not_registered", "§cThis player hasn't joined yet!");
|
||||
}
|
||||
|
||||
public static String getAlreadyMember() {
|
||||
return getMessage("member.already_added", "§cThis player is already a member!");
|
||||
}
|
||||
|
||||
public static String getMemberAdded() {
|
||||
return getMessage("member.added", "You have added &c%player&6 to your World!");
|
||||
}
|
||||
|
||||
public static String getUnknownError() {
|
||||
return getMessage("unknown_error", "§cSomething went wrong...");
|
||||
}
|
||||
|
||||
public static String getDeleteWorldOwn() {
|
||||
return getMessage("world.delete.own", "§cYour world was deleted!");
|
||||
}
|
||||
|
||||
public static String getDeleteWorldOther() {
|
||||
return getMessage("world.delete.other", "You deleted the world of §c%player§6!");
|
||||
}
|
||||
|
||||
public static String getNoMemberOwn() {
|
||||
return getMessage("member.not_added.own", "§cThis player isn't a member!");
|
||||
}
|
||||
|
||||
public static String getMemberRemoved() {
|
||||
return getMessage("member.removed", "You removed §c%player§6 from your world!");
|
||||
}
|
||||
|
||||
public static String getNoMemberAdded() {
|
||||
return getMessage("member.no_one_added", "§cThere are no members added");
|
||||
}
|
||||
|
||||
public static String getWorldAlreadyExists() {
|
||||
return getMessage("world.already_exists", "§cYou already have a world!");
|
||||
}
|
||||
|
||||
public static String getWorldCreated() {
|
||||
return getMessage("world.created", "Your world is now ready. Get there with §a/ws home");
|
||||
}
|
||||
|
||||
public static String getWorldStillCreating() {
|
||||
return getMessage("world.still_creating", "§cWorld is still creating");
|
||||
}
|
||||
|
||||
public static String getNotOnWorld() {
|
||||
return getMessage("world.not_on", "§cYou are not on a world!");
|
||||
}
|
||||
|
||||
public static String getWorldStillLoaded() {
|
||||
return getMessage("world.still_loaded", "§cYour world is still loaded!");
|
||||
}
|
||||
|
||||
public static String getNoRequestSend() {
|
||||
return getMessage("request.not_sent", "§cYou didn't send a request!");
|
||||
}
|
||||
|
||||
public static String getWorldReseted() {
|
||||
return getMessage("world.reseted", "Your world was reseted!");
|
||||
}
|
||||
|
||||
public static String getInvalidInput() {
|
||||
return getMessage("request.invalid_input", "§c%input is not a valid input!");
|
||||
}
|
||||
|
||||
public static String getRequestAlreadySent() {
|
||||
return getMessage("request.already_sent", "§cYou already sent a request!");
|
||||
}
|
||||
|
||||
public static String getRequestExpired() {
|
||||
return getMessage("request.expired", "§cYou request is expired!");
|
||||
}
|
||||
|
||||
public static String getTimeUntilExpires() {
|
||||
return getMessage("request.until_expire", "§cYour request expires in %time seconds!");
|
||||
}
|
||||
|
||||
public static String getConfirmRequest() {
|
||||
return getMessage("request.confirm", "§cPlease confirm reset of your world: %command");
|
||||
}
|
||||
|
||||
public static String getNoMemberOther() {
|
||||
return getMessage("member.not_added.other", "§cYou are not added to this world!");
|
||||
}
|
||||
|
||||
public static String getInfoOwner() {
|
||||
return getMessage("info.owner", "Owner: %data");
|
||||
}
|
||||
|
||||
public static String getInfoId() {
|
||||
return getMessage("info.id", "ID: %data");
|
||||
}
|
||||
|
||||
public static String getInfoMember() {
|
||||
return getMessage("info.member", "Member: %data");
|
||||
}
|
||||
|
||||
public static String getInfoTnt() {
|
||||
return getMessage("info.tnt", "TNT: %data");
|
||||
}
|
||||
|
||||
public static String getInfoFire() {
|
||||
return getMessage("info.fire", "Fire: %data");
|
||||
}
|
||||
|
||||
public static String getInfoEnabled() {
|
||||
return getRawMessage("info.enabled", "§aOn");
|
||||
}
|
||||
|
||||
public static String getInfoDisabled() {
|
||||
return getRawMessage("info.disabled", "§cOff");
|
||||
}
|
||||
|
||||
public static String getToggleGameModeEnabled() {
|
||||
return getMessage("toggle.gamemode.enabled", "§a%player§6 can now change his gamemode!");
|
||||
}
|
||||
|
||||
public static String getToggleGameModeDisabled() {
|
||||
return getMessage("toggle.gamemode.disabled", "§c%player§6 can no longer change his gamemode!");
|
||||
}
|
||||
|
||||
public static String getToggleTeleportEnabled() {
|
||||
return getMessage("toggle.teleport.enabled", "§a%player§6 can now teleport!");
|
||||
}
|
||||
|
||||
public static String getToggleTeleportDisabled() {
|
||||
return getMessage("toggle.teleport.disabled", "§c%player§6 can no longer teleport!");
|
||||
}
|
||||
|
||||
public static String getToggleBuildEnabled() {
|
||||
return getMessage("toggle.build.enabled", "§a%player§6 can now build!");
|
||||
}
|
||||
|
||||
public static String getToggleBuildDisabled() {
|
||||
return getMessage("toggle.build.disabled", "§c%player§6 can no longer build!");
|
||||
}
|
||||
|
||||
public static String getToggleWorldeditEnabled() {
|
||||
return getMessage("toggle.worldedit.enabled", "§a%player§6 can now use WorldEdit!");
|
||||
}
|
||||
|
||||
public static String getToggleWorldeditDisabled() {
|
||||
return getMessage("toggle.worldedit.disabled", "§c%player§6 can no longer use WorldEdit!");
|
||||
}
|
||||
|
||||
|
||||
public static String getToggleFireEnabled() {
|
||||
return getMessage("toggle.fire.enabled", "§aYou activated fire!");
|
||||
}
|
||||
|
||||
public static String getToggleFireDisabled() {
|
||||
return getMessage("toggle.fire.disabled", "§cYou deactivated fire!");
|
||||
}
|
||||
|
||||
public static String getToggleTntEnabled() {
|
||||
return getMessage("toggle.tnt.enabled", "§aYou activated TNT-Damage!");
|
||||
}
|
||||
|
||||
public static String getToggleTntDisabled() {
|
||||
return getMessage("toggle.tnt.disabled", "§cYou deactivated TNT-Damage!");
|
||||
}
|
||||
|
||||
public static String getDeleteCommandHelp() {
|
||||
return getMessage("command_help.delete_command", "/ws delete §8- §7Will delete a World");
|
||||
}
|
||||
|
||||
public static List<String> getCommandHelp() {
|
||||
List<String> list = getConfig().getStringList("command_help.list");
|
||||
if (list == null)
|
||||
list = defaultCmdHelp;
|
||||
list = list.stream().map(s -> ChatColor.translateAlternateColorCodes('&', s)).collect(Collectors.toList());
|
||||
return list;
|
||||
}
|
||||
|
||||
public static String getHomeSet() {
|
||||
return getMessage("world.set_home", "You set the home");
|
||||
}
|
||||
|
||||
public static String getNotEnoughMoney() {
|
||||
return getMessage("not_enough_money", "You do not have enough money");
|
||||
}
|
||||
|
||||
}
|
|
@ -29,7 +29,7 @@ public class PluginConfig {
|
|||
public PluginConfig(File configFile) throws FileNotFoundException {
|
||||
this.configFile = configFile;
|
||||
if (!configFile.exists()) {
|
||||
JavaPlugin.getPlugin(WorldSystem.class).saveDefaultConfig();
|
||||
WorldSystem.getInstance().saveDefaultConfig();
|
||||
}
|
||||
|
||||
try {
|
||||
|
|
|
@ -0,0 +1,22 @@
|
|||
package de.butzlabben.world.utils;
|
||||
|
||||
import de.butzlabben.world.WorldSystem;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
public class PluginRunner extends JavaPlugin
|
||||
{
|
||||
|
||||
private WorldSystem plugin;
|
||||
|
||||
@Override
|
||||
public void onEnable() {
|
||||
plugin = WorldSystem.getInstance();
|
||||
plugin.onEnable();
|
||||
}
|
||||
|
||||
public static PluginRunner getInstance() {
|
||||
return JavaPlugin.getPlugin(PluginRunner.class);
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,42 @@
|
|||
package de.butzlabben.world;
|
||||
|
||||
import org.apache.commons.io.FileUtils;
|
||||
|
||||
import java.io.*;
|
||||
|
||||
public class MockWorldSystem extends WorldSystem
|
||||
{
|
||||
private File configFile;
|
||||
|
||||
public MockWorldSystem(File cfg) {
|
||||
activeInst = this;
|
||||
configFile = cfg;
|
||||
}
|
||||
|
||||
public MockWorldSystem() {
|
||||
activeInst = this;
|
||||
configFile = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void saveDefaultConfig() {
|
||||
File source = new File("src/main/resources/config.yml");
|
||||
try {
|
||||
FileUtils.copyFile(source, configFile);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public InputStream getResource(String filename) {
|
||||
try
|
||||
{
|
||||
return new FileInputStream("src/main/resources/" + filename);
|
||||
}
|
||||
catch (FileNotFoundException e)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
package de.butzlabben.world;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
|
||||
public class TestWorldSystem
|
||||
{
|
||||
@Test
|
||||
public void testMockInstance() {
|
||||
WorldSystem mock = new MockWorldSystem(null);
|
||||
assertEquals(mock, WorldSystem.getInstance());
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,68 @@
|
|||
package de.butzlabben.world.config;
|
||||
|
||||
import de.butzlabben.world.MockWorldSystem;
|
||||
import de.butzlabben.world.WorldSystem;
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.junit.jupiter.api.BeforeAll;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
|
||||
public class TestLanguageConfig
|
||||
{
|
||||
@BeforeAll
|
||||
static void CleanLastTest() throws IOException
|
||||
{
|
||||
FileUtils.cleanDirectory(new File("TestFiles/workingDir/"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testInitEN() {
|
||||
File languages = new File("TestFiles/en.yml");
|
||||
|
||||
//Fails if something went Wrong
|
||||
LanguageConfig.checkConfig(languages);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testInitES() {
|
||||
File languages = new File("TestFiles/es.yml");
|
||||
|
||||
//Fails if something went Wrong
|
||||
LanguageConfig.checkConfig(languages);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testInitENnoExist() {
|
||||
WorldSystem mock = new MockWorldSystem();
|
||||
File languages = new File("TestFiles/workingDir/en.yml");
|
||||
|
||||
//Fails if something went Wrong
|
||||
LanguageConfig.checkConfig(languages);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testHelpEN() {
|
||||
File languages = new File("TestFiles/en.yml");
|
||||
|
||||
//Fails if something went Wrong
|
||||
LanguageConfig.checkConfig(languages);
|
||||
|
||||
assertEquals(16,LanguageConfig.getCommandHelp().size());
|
||||
|
||||
assertEquals( "/ws get §8- §7Will give you a world",LanguageConfig.getCommandHelp().get(0));
|
||||
}
|
||||
|
||||
// @Test
|
||||
// public void testNoPermEN() {
|
||||
// File languages = new File("TestFiles/en.yml");
|
||||
//
|
||||
// //Fails if something went Wrong
|
||||
// LanguageConfig.checkConfig(languages);
|
||||
//
|
||||
// assertEquals( "§cYou do not have permission to that command!", LanguageConfig.getNoPermission());
|
||||
// }
|
||||
}
|
|
@ -1,19 +1,30 @@
|
|||
package de.butzlabben.world.config;
|
||||
|
||||
import be.seeseemelk.mockbukkit.MockBukkit;
|
||||
import be.seeseemelk.mockbukkit.MockPlugin;
|
||||
import be.seeseemelk.mockbukkit.ServerMock;
|
||||
import de.butzlabben.world.MockWorldSystem;
|
||||
import de.butzlabben.world.WorldSystem;
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.bukkit.Difficulty;
|
||||
import org.bukkit.GameMode;
|
||||
import org.junit.jupiter.api.AfterAll;
|
||||
import org.junit.jupiter.api.BeforeAll;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
|
||||
public class TestPluginConfig {
|
||||
|
||||
@BeforeAll
|
||||
static void CleanLastTest() throws IOException
|
||||
{
|
||||
FileUtils.cleanDirectory(new File("TestFiles/workingDir/"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testPluginConfigInit() throws FileNotFoundException {
|
||||
|
@ -21,6 +32,15 @@ public class TestPluginConfig {
|
|||
PluginConfig cfg = new PluginConfig(cfgFile);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testNoPluginConfigInit() throws FileNotFoundException {
|
||||
File cfgFile = new File("TestFiles/workingDir/TestConfigNoExist.yml");
|
||||
WorldSystem mock = new MockWorldSystem(cfgFile);
|
||||
|
||||
PluginConfig cfg = new PluginConfig(cfgFile);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//TODO ADD Invalid Config Test
|
||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -1,14 +0,0 @@
|
|||
name: 'WorldSystem'
|
||||
version: '2.4.20'
|
||||
main: de.butzlabben.world.WorldSystem
|
||||
author: Trainerlord
|
||||
description: The one world per player solution you have always dreamed of.
|
||||
|
||||
commands:
|
||||
ws:
|
||||
description: Main Commands for World System
|
||||
usage: /ws
|
||||
permission: ws.*;
|
||||
|
||||
|
||||
api-version: '1.17'
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue