From 301d3cc03374698905790107856605b58b9b9ddf Mon Sep 17 00:00:00 2001 From: creatorfromhell Date: Sun, 10 Dec 2023 01:49:41 -0500 Subject: [PATCH] Add aliases as an option to data.yml. --- .../lokka30/phantomworlds/PhantomWorlds.java | 25 +++++---- .../commands/phantomworlds/PWCommand.java | 48 +++++++++------- .../resolvers/AliasWorldResolver.java | 42 ++++++++++++++ .../resolvers/GameRulesResolver.java | 49 ++++++++++++++++ .../suggestion/AliasWorldSuggestion.java | 51 +++++++++++++++++ .../phantomworlds/sub/LoadCommand.java | 2 - .../subcommands/CreateSubcommand.java | 1 - .../phantomworlds/utils/WorldRule.java | 55 ++++++++++++++++++ .../phantomworlds/managers/FileManager.java | 2 +- .../phantomworlds/managers/WorldManager.java | 28 ++++++++-- .../phantomworlds/managers/WorldRule.java | 56 +++++++++++++++++++ src/main/resources/messages.yml | 19 ++++++- 12 files changed, 336 insertions(+), 42 deletions(-) create mode 100644 src/main/java/me/lokka30/phantomworlds/commands/phantomworlds/parameters/resolvers/AliasWorldResolver.java create mode 100644 src/main/java/me/lokka30/phantomworlds/commands/phantomworlds/parameters/resolvers/GameRulesResolver.java create mode 100644 src/main/java/me/lokka30/phantomworlds/commands/phantomworlds/parameters/suggestion/AliasWorldSuggestion.java create mode 100644 src/main/java/me/lokka30/phantomworlds/commands/phantomworlds/utils/WorldRule.java create mode 100644 src/main/java/me/lokka30/phantomworlds/managers/WorldRule.java diff --git a/src/main/java/me/lokka30/phantomworlds/PhantomWorlds.java b/src/main/java/me/lokka30/phantomworlds/PhantomWorlds.java index 6d8fd46..e59846a 100644 --- a/src/main/java/me/lokka30/phantomworlds/PhantomWorlds.java +++ b/src/main/java/me/lokka30/phantomworlds/PhantomWorlds.java @@ -4,7 +4,9 @@ import me.lokka30.microlib.maths.QuickTimer; import me.lokka30.microlib.other.UpdateChecker; import me.lokka30.phantomworlds.commands.phantomworlds.PWCommand; +import me.lokka30.phantomworlds.commands.phantomworlds.parameters.resolvers.AliasWorldResolver; import me.lokka30.phantomworlds.commands.phantomworlds.parameters.resolvers.WorldFolderResolver; +import me.lokka30.phantomworlds.commands.phantomworlds.parameters.suggestion.AliasWorldSuggestion; import me.lokka30.phantomworlds.commands.phantomworlds.parameters.suggestion.WorldFolderSuggestion; import me.lokka30.phantomworlds.commands.phantomworlds.utils.WorldFolder; import me.lokka30.phantomworlds.listeners.player.PlayerChangeWorldListener; @@ -18,7 +20,6 @@ import me.lokka30.phantomworlds.misc.UpdateCheckerResult; import me.lokka30.phantomworlds.scheduler.BackupScheduler; import org.bstats.bukkit.Metrics; -import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.World; import org.bukkit.plugin.java.JavaPlugin; @@ -26,6 +27,8 @@ import revxrsal.commands.bukkit.BukkitCommandHandler; import java.io.File; +import java.util.LinkedList; +import java.util.List; import java.util.concurrent.TimeUnit; import java.util.logging.Logger; @@ -58,6 +61,8 @@ public class PhantomWorlds extends JavaPlugin { */ public static final String[] CONTRIBUTORS = new String[]{"madison-allen"}; + public static final List COMMAND_HELP = new LinkedList<>(); + public static final String BACKUP_FOLDER = "backups"; public static final String ARCHIVE_FOLDER = "archives"; @@ -213,24 +218,20 @@ void registerCommands() { this.command = BukkitCommandHandler.create(this); //Set our command help writer - command.setHelpWriter((command, actor) -> { - if(command.getDescription() == null) { - return ""; - } - - final String description = PhantomWorlds.instance().messages.getConfig().getString(command.getDescription()); - if(description == null) { - return ""; - } + for(final String key : messages.getConfig().getConfigurationSection("command.phantomworlds.help").getKeys(false)) { + COMMAND_HELP.add(ChatColor.translateAlternateColorCodes('&', messages.getConfig().getString("command.phantomworlds.help." + key, "Missing help message. Key: " + key))); + } - return ChatColor.translateAlternateColorCodes('&', description); - }); + //Override the help writer because it dupes commands for some reason. + command.setHelpWriter((command, actor) ->""); //Register Resolvers this.command.registerValueResolver(WorldFolder.class, new WorldFolderResolver()); + this.command.registerValueResolver(World.class, new AliasWorldResolver()); //Register Suggestors this.command.getAutoCompleter().registerParameterSuggestions(WorldFolder.class, new WorldFolderSuggestion()); + this.command.getAutoCompleter().registerParameterSuggestions(World.class, new AliasWorldSuggestion()); this.command.register(new PWCommand()); this.command.registerBrigadier(); diff --git a/src/main/java/me/lokka30/phantomworlds/commands/phantomworlds/PWCommand.java b/src/main/java/me/lokka30/phantomworlds/commands/phantomworlds/PWCommand.java index f9ea0b8..93cfe30 100644 --- a/src/main/java/me/lokka30/phantomworlds/commands/phantomworlds/PWCommand.java +++ b/src/main/java/me/lokka30/phantomworlds/commands/phantomworlds/PWCommand.java @@ -45,7 +45,7 @@ import revxrsal.commands.bukkit.annotation.CommandPermission; import revxrsal.commands.help.CommandHelp; -import java.util.ArrayList; +import java.util.Arrays; /** * PWCommand @@ -59,107 +59,117 @@ public class PWCommand { @Subcommand({"help", "?"}) @DefaultFor({"pw", "phantomworlds"}) public void help(BukkitCommandActor actor, CommandHelp helpEntries, @Default("1") int page) { - for(final String entry : helpEntries.paginate(page, 5)) { - (new MultiMessage( - PhantomWorlds.instance().messages.getConfig().getStringList(entry), new ArrayList<>() - )).send(actor.getSender()); + + (new MultiMessage( + PhantomWorlds.instance().messages.getConfig() + .getStringList("command.phantomworlds.help-header"), Arrays.asList( + new MultiMessage.Placeholder("prefix", + PhantomWorlds.instance().messages.getConfig().getString("common.prefix", "&b&lPhantomWorlds: &7"), + true), + new MultiMessage.Placeholder("page", String.valueOf(page), false), + new MultiMessage.Placeholder("max", String.valueOf(helpEntries.paginate(page, 5).size()), false) + + ))).send(actor.getSender()); + + for(String str : PhantomWorlds.COMMAND_HELP) { + actor.getSender().sendMessage(str); } } @Subcommand({"backup", "archive", "bu"}) @CommandPermission("phantomworlds.command.phantomworlds.backup") - @Description("command.phantomworlds.usages.backup") + @Description("command.phantomworlds.help.backup") public void backup(BukkitCommandActor actor, @Optional final World world) { BackupCommand.onCommand(actor, world); } @Subcommand({"create", "+", "new"}) @CommandPermission("phantomworlds.command.phantomworlds.create") - @Description("command.phantomworlds.usages.create") + @Description("command.phantomworlds.help.create") public void create(BukkitCommandActor actor) { //todo: port create command } @Subcommand({"compatibility"}) @CommandPermission("phantomworlds.command.phantomworlds.compatibility") - @Description("command.phantomworlds.usages.compatibility") + @Description("command.phantomworlds.help.compatibility") public void compatibility(BukkitCommandActor actor) { CompatibilityCommand.onCommand(actor); } @Subcommand({"debug"}) @CommandPermission("phantomworlds.command.phantomworlds.debug") - @Description("command.phantomworlds.usages.debug") + @Description("command.phantomworlds.help.debug") public void debug(BukkitCommandActor actor, @Optional final String level) { DebugCommand.onCommand(actor, level); } @Subcommand({"delete", "-", "remove", "del"}) @CommandPermission("phantomworlds.command.phantomworlds.delete") - @Description("command.phantomworlds.usages.delete") + @Description("command.phantomworlds.help.delete") public void delete(BukkitCommandActor actor, @Optional final World world) { DeleteCommand.onCommand(actor, world); } @Subcommand({"list", "l"}) @CommandPermission("phantomworlds.command.phantomworlds.list") - @Description("command.phantomworlds.usages.list") + @Description("command.phantomworlds.help.list") public void list(BukkitCommandActor actor) { ListCommand.onCommand(actor); } @Subcommand({"import", "im"}) @CommandPermission("phantomworlds.command.phantomworlds.import") - @Description("command.phantomworlds.usages.import") + @Description("command.phantomworlds.help.import") public void importCMD(BukkitCommandActor actor, @Optional final World world) { ImportCommand.onCommand(actor, world); } @Subcommand({"info", "i"}) @CommandPermission("phantomworlds.command.phantomworlds.info") - @Description("command.phantomworlds.usages.info") + @Description("command.phantomworlds.help.info") public void info(BukkitCommandActor actor) { InfoCommand.onCommand(actor); } @Subcommand({"load"}) @CommandPermission("phantomworlds.command.phantomworlds.load") - @Description("command.phantomworlds.usages.load") + @Description("command.phantomworlds.help.load") public void load(BukkitCommandActor actor, @Optional final WorldFolder world) { LoadCommand.onCommand(actor, world); } @Subcommand({"reload", "r"}) @CommandPermission("phantomworlds.command.phantomworlds.reload") - @Description("command.phantomworlds.usages.reload") + @Description("command.phantomworlds.help.reload") public void reload(BukkitCommandActor actor) { ReloadCommand.onCommand(actor); } @Subcommand({"setspawn"}) @CommandPermission("phantomworlds.command.phantomworlds.setspawn") - @Description("command.phantomworlds.usages.setspawn") + @Description("command.phantomworlds.help.setspawn") public void setspawn(BukkitCommandActor actor, @Optional Double x, @Optional Double y, @Optional Double z, @Optional World world, @Optional Float yaw, @Optional Float pitch) { SetSpawnCommand.onCommand(actor, x, y, z, world, yaw, pitch); } @Subcommand({"spawn"}) @CommandPermission("phantomworlds.command.phantomworlds.spawn") - @Description("command.phantomworlds.usages.spawn") + @Description("command.phantomworlds.help.spawn") public void spawn(BukkitCommandActor actor, @Optional final World world, @Optional final Player player) { SpawnCommand.onCommand(actor, world, player); } @Subcommand({"teleport", "tp"}) @CommandPermission("phantomworlds.command.phantomworlds.teleport") - @Description("command.phantomworlds.usages.tp") + @Description("command.phantomworlds.help.tp") public void tp(BukkitCommandActor actor, @Optional final World world, @Optional final Player player) { TeleportCommand.onCommand(actor, world, player); } @Subcommand({"unload", "u"}) @CommandPermission("phantomworlds.command.phantomworlds.unload") - @Description("command.phantomworlds.usages.unload") + @Description("command.phantomworlds.help.unload") public void unload(BukkitCommandActor actor, @Optional final World world) { UnloadCommand.onCommand(actor, world); } diff --git a/src/main/java/me/lokka30/phantomworlds/commands/phantomworlds/parameters/resolvers/AliasWorldResolver.java b/src/main/java/me/lokka30/phantomworlds/commands/phantomworlds/parameters/resolvers/AliasWorldResolver.java new file mode 100644 index 0000000..36565ac --- /dev/null +++ b/src/main/java/me/lokka30/phantomworlds/commands/phantomworlds/parameters/resolvers/AliasWorldResolver.java @@ -0,0 +1,42 @@ +package me.lokka30.phantomworlds.commands.phantomworlds.parameters.resolvers; +/* + * Phantom Worlds + * Copyright (C) 2023 Daniel "creatorfromhell" Vidmar + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +import me.lokka30.phantomworlds.PhantomWorlds; +import org.bukkit.Bukkit; +import org.bukkit.World; +import org.jetbrains.annotations.NotNull; +import revxrsal.commands.process.ValueResolver; + +/** + * AliasWorldResolver + * + * @author creatorfromhell + * @since 2.0.5.0 + */ +public class AliasWorldResolver implements ValueResolver { + + @Override + public World resolve(@NotNull ValueResolverContext context) throws Throwable { + final String value = context.arguments().pop(); + + final String name = PhantomWorlds.worldManager().aliases.getOrDefault(value, value); + + return Bukkit.getWorld(name); + } +} \ No newline at end of file diff --git a/src/main/java/me/lokka30/phantomworlds/commands/phantomworlds/parameters/resolvers/GameRulesResolver.java b/src/main/java/me/lokka30/phantomworlds/commands/phantomworlds/parameters/resolvers/GameRulesResolver.java new file mode 100644 index 0000000..85a0e3f --- /dev/null +++ b/src/main/java/me/lokka30/phantomworlds/commands/phantomworlds/parameters/resolvers/GameRulesResolver.java @@ -0,0 +1,49 @@ +package me.lokka30.phantomworlds.commands.phantomworlds.parameters.resolvers; +/* + * Phantom Worlds + * Copyright (C) 2023 Daniel "creatorfromhell" Vidmar + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +import me.lokka30.phantomworlds.commands.phantomworlds.utils.WorldFolder; +import me.lokka30.phantomworlds.commands.phantomworlds.utils.WorldRule; +import org.bukkit.GameRule; +import org.jetbrains.annotations.NotNull; +import revxrsal.commands.process.ValueResolver; + +import java.util.ArrayList; +import java.util.ListIterator; + +/** + * GameRulesResolver + * + * @author creatorfromhell + * @since 2.0.5.0 + */ +public class GameRulesResolver implements ValueResolver { + + @Override + public WorldRule[] resolve(@NotNull ValueResolverContext context) throws Throwable { + final WorldRule[] rules = new WorldRule[context.arguments().size()]; + final ListIterator it = context.arguments().listIterator(); + + while(it.hasNext()) { + final String value = it.next(); + + + } + return rules; + } +} \ No newline at end of file diff --git a/src/main/java/me/lokka30/phantomworlds/commands/phantomworlds/parameters/suggestion/AliasWorldSuggestion.java b/src/main/java/me/lokka30/phantomworlds/commands/phantomworlds/parameters/suggestion/AliasWorldSuggestion.java new file mode 100644 index 0000000..134ea0a --- /dev/null +++ b/src/main/java/me/lokka30/phantomworlds/commands/phantomworlds/parameters/suggestion/AliasWorldSuggestion.java @@ -0,0 +1,51 @@ +package me.lokka30.phantomworlds.commands.phantomworlds.parameters.suggestion; +/* + * Phantom Worlds + * Copyright (C) 2023 Daniel "creatorfromhell" Vidmar + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +import me.lokka30.phantomworlds.PhantomWorlds; +import org.bukkit.Bukkit; +import org.bukkit.World; +import org.jetbrains.annotations.NotNull; +import revxrsal.commands.autocomplete.SuggestionProvider; +import revxrsal.commands.command.CommandActor; +import revxrsal.commands.command.ExecutableCommand; + +import java.io.File; +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; + +/** + * AliasWorldSuggestion + * + * @author creatorfromhell + * @since 2.0.5.0 + */ +public class AliasWorldSuggestion implements SuggestionProvider { + + @Override + public @NotNull Collection getSuggestions(@NotNull List list, @NotNull CommandActor commandActor, @NotNull ExecutableCommand executableCommand) throws Throwable { + + final List worlds = new ArrayList<>(PhantomWorlds.worldManager().aliases.keySet()); + + for(final World world : Bukkit.getWorlds()) { + worlds.add(world.getName()); + } + return worlds; + } +} \ No newline at end of file diff --git a/src/main/java/me/lokka30/phantomworlds/commands/phantomworlds/sub/LoadCommand.java b/src/main/java/me/lokka30/phantomworlds/commands/phantomworlds/sub/LoadCommand.java index f1bdfc9..6b76d6f 100644 --- a/src/main/java/me/lokka30/phantomworlds/commands/phantomworlds/sub/LoadCommand.java +++ b/src/main/java/me/lokka30/phantomworlds/commands/phantomworlds/sub/LoadCommand.java @@ -21,10 +21,8 @@ import me.lokka30.phantomworlds.PhantomWorlds; import me.lokka30.phantomworlds.commands.phantomworlds.utils.WorldFolder; import me.lokka30.phantomworlds.misc.WorldLoadResponse; -import org.bukkit.Bukkit; import revxrsal.commands.bukkit.BukkitCommandActor; -import java.io.File; import java.util.Arrays; import static me.lokka30.phantomworlds.misc.WorldLoadResponse.ALREADY_LOADED; diff --git a/src/main/java/me/lokka30/phantomworlds/commands/phantomworlds/subcommands/CreateSubcommand.java b/src/main/java/me/lokka30/phantomworlds/commands/phantomworlds/subcommands/CreateSubcommand.java index 264688f..695e852 100644 --- a/src/main/java/me/lokka30/phantomworlds/commands/phantomworlds/subcommands/CreateSubcommand.java +++ b/src/main/java/me/lokka30/phantomworlds/commands/phantomworlds/subcommands/CreateSubcommand.java @@ -14,7 +14,6 @@ import org.bukkit.command.Command; import org.bukkit.command.CommandSender; -import java.io.IOException; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; diff --git a/src/main/java/me/lokka30/phantomworlds/commands/phantomworlds/utils/WorldRule.java b/src/main/java/me/lokka30/phantomworlds/commands/phantomworlds/utils/WorldRule.java new file mode 100644 index 0000000..6981168 --- /dev/null +++ b/src/main/java/me/lokka30/phantomworlds/commands/phantomworlds/utils/WorldRule.java @@ -0,0 +1,55 @@ +package me.lokka30.phantomworlds.commands.phantomworlds.utils; +/* + * Phantom Worlds + * Copyright (C) 2023 Daniel "creatorfromhell" Vidmar + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +/** + * WorldRule + * + * @author creatorfromhell + * @since 2.0.5.0 + */ +public class WorldRule { + + private final String full; + private String rule; + private String value; + + public WorldRule(String full) { + this.full = full; + } + + public String getFull() { + return full; + } + + public String getRule() { + return rule; + } + + public void setRule(String rule) { + this.rule = rule; + } + + public String getValue() { + return value; + } + + public void setValue(String value) { + this.value = value; + } +} \ No newline at end of file diff --git a/src/main/java/me/lokka30/phantomworlds/managers/FileManager.java b/src/main/java/me/lokka30/phantomworlds/managers/FileManager.java index f44eedf..8a9ff86 100644 --- a/src/main/java/me/lokka30/phantomworlds/managers/FileManager.java +++ b/src/main/java/me/lokka30/phantomworlds/managers/FileManager.java @@ -161,7 +161,7 @@ void alertIncorrectVersion(final PWFile pwFile) { public enum PWFile { SETTINGS(2), ADVANCED_SETTINGS(1), - MESSAGES(6), + MESSAGES(7), DATA(2); public final int latestFileVersion; // If == -1: 'do not migrate me!' diff --git a/src/main/java/me/lokka30/phantomworlds/managers/WorldManager.java b/src/main/java/me/lokka30/phantomworlds/managers/WorldManager.java index b2deeb8..c8a28ec 100644 --- a/src/main/java/me/lokka30/phantomworlds/managers/WorldManager.java +++ b/src/main/java/me/lokka30/phantomworlds/managers/WorldManager.java @@ -12,7 +12,12 @@ import java.io.File; import java.io.IOException; +import java.util.ArrayList; +import java.util.HashMap; import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; import static me.lokka30.phantomworlds.misc.Utils.zipFolder; @@ -24,6 +29,8 @@ */ public class WorldManager { + public final Map aliases = new LinkedHashMap<>(); + /** * For all worlds listed in PW's data file, if they aren't already loaded by Bukkit, then tell * Bukkit to load them @@ -114,22 +121,35 @@ public WorldLoadResponse loadWorld(final String worldName) { public PhantomWorld getPhantomWorldFromData(final String name) { final String cfgPath = "worlds-to-load." + name + "."; + if(PhantomWorlds.instance().data.getConfig().contains(cfgPath + "alias")) { + for(final String alias : PhantomWorlds.instance().data.getConfig().getConfigurationSection(cfgPath + "alias").getKeys(false)) { + aliases.put(alias, name); + } + } + final PhantomWorld world = new PhantomWorld( name, World.Environment.valueOf( - PhantomWorlds.instance().data.getConfig().getString(cfgPath + "environment", "NORMAL")), + PhantomWorlds.instance().data.getConfig().getString(cfgPath + "environment", "NORMAL") + ), PhantomWorlds.instance().data.getConfig().getBoolean(cfgPath + "generateStructures", true), PhantomWorlds.instance().data.getConfig().getString(cfgPath + "generator", null), PhantomWorlds.instance().data.getConfig().getString(cfgPath + "generatorSettings", null), PhantomWorlds.instance().data.getConfig().getBoolean(cfgPath + "hardcore", false), PhantomWorlds.instance().data.getConfig().getLong(cfgPath + "seed", 0), - WorldType.valueOf(PhantomWorlds.instance().data.getConfig().getString(cfgPath + "worldType", "NORMAL")), + WorldType.valueOf( + PhantomWorlds.instance().data.getConfig().getString(cfgPath + "worldType", "NORMAL") + ), PhantomWorlds.instance().data.getConfig().getBoolean(cfgPath + "spawnMobs", true), PhantomWorlds.instance().data.getConfig().getBoolean(cfgPath + "spawnAnimals", true), PhantomWorlds.instance().data.getConfig().getBoolean(cfgPath + "keepSpawnInMemory", false), PhantomWorlds.instance().data.getConfig().getBoolean(cfgPath + "allowPvP", true), - Difficulty.valueOf(PhantomWorlds.instance().data.getConfig().getString(cfgPath + "difficulty", "NORMAL")), - GameMode.valueOf(PhantomWorlds.instance().data.getConfig().getString(cfgPath + "gameMode", "SURVIVAL")) + Difficulty.valueOf( + PhantomWorlds.instance().data.getConfig().getString(cfgPath + "difficulty", "NORMAL") + ), + GameMode.valueOf( + PhantomWorlds.instance().data.getConfig().getString(cfgPath + "gameMode", "SURVIVAL") + ) ); if(PhantomWorlds.instance().data.getConfig().contains(cfgPath + "rules") && diff --git a/src/main/java/me/lokka30/phantomworlds/managers/WorldRule.java b/src/main/java/me/lokka30/phantomworlds/managers/WorldRule.java new file mode 100644 index 0000000..d48e5e7 --- /dev/null +++ b/src/main/java/me/lokka30/phantomworlds/managers/WorldRule.java @@ -0,0 +1,56 @@ +package me.lokka30.phantomworlds.managers; +/* + * Phantom Worlds + * Copyright (C) 2023 Daniel "creatorfromhell" Vidmar + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +/** + * WorldRule + * + * @author creatorfromhell + * @since 2.0.5.0 + */ +public abstract class WorldRule { + + private final String full; + + private String id; + private String value; + + public WorldRule(String full) { + this.full = full; + } + + public String getFull() { + return full; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getValue() { + return value; + } + + public void setValue(String value) { + this.value = value; + } +} \ No newline at end of file diff --git a/src/main/resources/messages.yml b/src/main/resources/messages.yml index f0dc800..4e137cb 100644 --- a/src/main/resources/messages.yml +++ b/src/main/resources/messages.yml @@ -32,16 +32,18 @@ command: - '&8 &m->&b /%label% info &8- &7view info about the plugin' - '&8 &m->&b /%label% compatibility &8- &7check for incompatibilities' - usages: + help-header: '&7=== %prefix% &f[&7%page%&f/&b%max%&f] &7===' + help: create: '&b/pw create [options...] &8- &7create a world' import: '&b/pw import &8- &7import a world' list: '&b/pw list &8- &7list worlds' tp: '&b/pw teleport [player] &8- &7teleport to a loaded world''s spawnpoint' spawn: '&b/pw spawn &8- &7teleport to the spawn of the current world' + debug: '&b/pw debug &8- &7Change the debug mode for PhantomWorlds.' setspawn: '&b/pw setspawn [x] [y] [z] [world] [yaw] [pitch] &8- &7set the spawnpoint of a world' delete: '&b/pw delete &8- &7delete a world' - backup: '&b/pw backup &8- &backup a world' + backup: '&b/pw backup &8- &7backup a world' unload: '&b/pw unload &8- &7unload a loaded world' load: '&b/pw load &8- &7load an unloaded world' reload: '&b/pw reload &8- &7reload all config & data files' @@ -136,6 +138,17 @@ command: usage: - '%prefix% Invalid usage, try ''&b/%label% create [options...]&7''.' + debug: + + usage: + - '%prefix% Invalid usage, try ''&b/%label% debug &7''.' + + success: + - '%prefix%: &7Note: Please do not run this subcommand unless you are sure you are meant to be doing so' + + failure: + - '%prefix%: &7Invalid debug method ''%method%''.' + delete: usage: @@ -293,5 +306,5 @@ command: # Do not touch anything here unless you know what you are doing. advanced: - file-version: 6 + file-version: 7 generated-with: '${project.version}' \ No newline at end of file