diff --git a/pom.xml b/pom.xml
index 2ac2253..d21f594 100644
--- a/pom.xml
+++ b/pom.xml
@@ -30,6 +30,10 @@
jitpack.io
https://jitpack.io
+
+ litecommands-repo
+ https://repo.panda-lang.org/releases
+
@@ -58,21 +62,21 @@
provided
- me.carleslc.Simple-YAML
- Simple-Yaml
- 1.8.4
+ dev.dejvokep
+ boosted-yaml
+ 1.3.2
compile
- com.github.Revxrsal.Lamp
- bukkit
- 3.1.8
+ dev.rollczi
+ litecommands-core
+ 3.3.4
compile
- com.github.Revxrsal.Lamp
- common
- 3.1.8
+ dev.rollczi
+ litecommands-bukkit
+ 3.3.4
compile
@@ -108,8 +112,19 @@
${phantom.relocation}.lamp
- me.carleslc
- org.yaml
+ dev.rollczi
+ ${phantom.relocation}.lc
+
+
+ panda.std
+ ${phantom.relocation}.panda
+
+
+ org.panda-lang
+ ${phantom.relocation}.panda
+
+
+ dev.dejvokep.boostedyaml
${phantom.relocation}.yaml
@@ -125,11 +140,13 @@
false
- org.yaml:*
- me.carleslc.Simple-YAML:*
+ dev.dejvokep.boostedyaml:*
org.bstats:*
com.github.lokka30:MicroLib
com.github.Revxrsal.Lamp:*
+ dev.rollczi:*
+ panda.std:*
+ org.panda-lang:*
diff --git a/src/main/java/me/lokka30/phantomworlds/PhantomWorlds.java b/src/main/java/me/lokka30/phantomworlds/PhantomWorlds.java
index 9c4dde4..fe10a25 100644
--- a/src/main/java/me/lokka30/phantomworlds/PhantomWorlds.java
+++ b/src/main/java/me/lokka30/phantomworlds/PhantomWorlds.java
@@ -1,14 +1,18 @@
package me.lokka30.phantomworlds;
+import dev.rollczi.litecommands.LiteCommands;
+import dev.rollczi.litecommands.bukkit.LiteBukkitFactory;
import me.lokka30.microlib.files.YamlConfigFile;
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.commandsredux.PWCommand;
+import me.lokka30.phantomworlds.commandsredux.params.AliasWorldParameter;
+import me.lokka30.phantomworlds.commandsredux.params.GamemodeParameter;
+import me.lokka30.phantomworlds.commandsredux.params.PortalParameter;
+import me.lokka30.phantomworlds.commandsredux.params.PotionEffectParameter;
+import me.lokka30.phantomworlds.commandsredux.params.SettingParameter;
+import me.lokka30.phantomworlds.commandsredux.params.WorldFolderParameter;
+import me.lokka30.phantomworlds.commandsredux.utils.WorldFolder;
import me.lokka30.phantomworlds.listeners.player.PlayerChangeWorldListener;
import me.lokka30.phantomworlds.listeners.player.PlayerDeathListener;
import me.lokka30.phantomworlds.listeners.player.PlayerJoinListener;
@@ -21,13 +25,16 @@
import me.lokka30.phantomworlds.misc.UpdateCheckerResult;
import me.lokka30.phantomworlds.scheduler.BackupScheduler;
import org.bstats.bukkit.Metrics;
-import org.bukkit.ChatColor;
+import org.bukkit.GameMode;
+import org.bukkit.PortalType;
import org.bukkit.World;
+import org.bukkit.WorldType;
import org.bukkit.plugin.java.JavaPlugin;
+import org.bukkit.potion.PotionEffectType;
import org.bukkit.scheduler.BukkitTask;
-import revxrsal.commands.bukkit.BukkitCommandHandler;
import java.io.File;
+import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
import java.util.concurrent.TimeUnit;
@@ -41,6 +48,8 @@
*/
public class PhantomWorlds extends JavaPlugin {
+ public static final List createTabs = new ArrayList<>();
+
/*
*TODO:
* - Translate backslash character in world names as a space so world names with a space can be used in the plugin
@@ -51,9 +60,10 @@ public class PhantomWorlds extends JavaPlugin {
* - log in console (LogLevel:INFO) when a command is prevented due to a target player seemingly being vanished to the command sender.
*/
+
private static PhantomWorlds instance;
- protected BukkitCommandHandler command;
+ protected LiteCommands> command;
private BukkitTask backupService = null;
@@ -112,6 +122,8 @@ public void onEnable() {
instance = this;
+ createTabs.addAll(generateCreateSuggestions());
+
QuickTimer timer = new QuickTimer(TimeUnit.MILLISECONDS);
checkCompatibility();
loadFiles();
@@ -214,28 +226,15 @@ public void loadWorlds() {
*/
void registerCommands() {
getLogger().info("Registering commands...");
- //Utils.registerCommand(new PhantomWorldsCommand(), "phantomworlds");
-
- this.command = BukkitCommandHandler.create(this);
-
- //Set our command help writer
- 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)));
- }
-
- //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();
+ this.command = LiteBukkitFactory.builder()
+ .commands(new PWCommand())
+ .argument(GameMode.class, new GamemodeParameter())
+ .argument(PortalType.class, new PortalParameter())
+ .argument(List.class, new PotionEffectParameter())
+ .argument(List.class, new SettingParameter())
+ .argument(World.class, new AliasWorldParameter())
+ .argument(WorldFolder.class, new WorldFolderParameter()).build();
}
/**
@@ -309,4 +308,52 @@ public static Logger logger() {
public static WorldManager worldManager() {
return instance.worldManager;
}
+
+ private ArrayList generateCreateSuggestions() {
+ final ArrayList suggestions = new ArrayList<>();
+
+ suggestions.addAll(addTrueFalseValues("generatestructures"));
+ suggestions.addAll(addTrueFalseValues("genstructures"));
+ suggestions.addAll(addTrueFalseValues("structures"));
+ suggestions.addAll(addTrueFalseValues("spawnmobs"));
+ suggestions.addAll(addTrueFalseValues("mobs"));
+ suggestions.addAll(addTrueFalseValues("spawnanimals"));
+ suggestions.addAll(addTrueFalseValues("animals"));
+ suggestions.addAll(addTrueFalseValues("keepspawninmemory"));
+ suggestions.addAll(addTrueFalseValues("spawninmemory"));
+ suggestions.addAll(addTrueFalseValues("hardcore"));
+ suggestions.addAll(addTrueFalseValues("allowpvp"));
+ suggestions.addAll(addTrueFalseValues("pvp"));
+ suggestions.addAll(addTrueFalseValues("difficulty"));
+ suggestions.addAll(addTrueFalseValues("diff"));
+
+ suggestions.add("generator:");
+ suggestions.add("gen:");
+
+ suggestions.add("generatorsettings:");
+ suggestions.add("gensettings:");
+
+ suggestions.add("gamemode:ADVENTURE");
+ suggestions.add("gamemode:CREATIVE");
+ suggestions.add("gamemode:HARDCORE");
+ suggestions.add("gamemode:SURVIVAL");
+
+ suggestions.add("seed:");
+
+ for(WorldType worldType : WorldType.values()) {
+ suggestions.add("type:" + worldType.toString());
+ }
+
+ return suggestions;
+ }
+
+ private ArrayList addTrueFalseValues(String option) {
+ final ArrayList list = new ArrayList<>();
+ option = option + ":";
+
+ list.add(option + "true");
+ list.add(option + "false");
+
+ return list;
+ }
}
\ No newline at end of file
diff --git a/src/main/java/me/lokka30/phantomworlds/commands/Subcommand.java b/src/main/java/me/lokka30/phantomworlds/commands/Subcommand.java
deleted file mode 100644
index a989094..0000000
--- a/src/main/java/me/lokka30/phantomworlds/commands/Subcommand.java
+++ /dev/null
@@ -1,26 +0,0 @@
-package me.lokka30.phantomworlds.commands;
-
-import org.bukkit.command.Command;
-import org.bukkit.command.CommandSender;
-
-import java.util.List;
-
-/**
- * This interface makes it easier to create and utilise subcommands.
- *
- * @author lokka30
- * @since v2.0.0
- */
-public interface Subcommand {
-
- /**
- * @since v2.0.0
- */
- void parseCommand(CommandSender sender, Command cmd, String label, String[] args);
-
- /**
- * @since v2.0.0
- */
- List parseTabCompletion(CommandSender sender, Command cmd, String label, String[] args);
-
-}
\ No newline at end of file
diff --git a/src/main/java/me/lokka30/phantomworlds/commands/phantomworlds/PWCommand.java b/src/main/java/me/lokka30/phantomworlds/commands/phantomworlds/PWCommand.java
deleted file mode 100644
index b8e8929..0000000
--- a/src/main/java/me/lokka30/phantomworlds/commands/phantomworlds/PWCommand.java
+++ /dev/null
@@ -1,176 +0,0 @@
-package me.lokka30.phantomworlds.commands.phantomworlds;
-/*
- * 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.microlib.messaging.MultiMessage;
-import me.lokka30.phantomworlds.PhantomWorlds;
-import me.lokka30.phantomworlds.commands.phantomworlds.sub.BackupCommand;
-import me.lokka30.phantomworlds.commands.phantomworlds.sub.CompatibilityCommand;
-import me.lokka30.phantomworlds.commands.phantomworlds.sub.DebugCommand;
-import me.lokka30.phantomworlds.commands.phantomworlds.sub.DeleteCommand;
-import me.lokka30.phantomworlds.commands.phantomworlds.sub.ImportCommand;
-import me.lokka30.phantomworlds.commands.phantomworlds.sub.InfoCommand;
-import me.lokka30.phantomworlds.commands.phantomworlds.sub.ListCommand;
-import me.lokka30.phantomworlds.commands.phantomworlds.sub.LoadCommand;
-import me.lokka30.phantomworlds.commands.phantomworlds.sub.ReloadCommand;
-import me.lokka30.phantomworlds.commands.phantomworlds.sub.SetSpawnCommand;
-import me.lokka30.phantomworlds.commands.phantomworlds.sub.SpawnCommand;
-import me.lokka30.phantomworlds.commands.phantomworlds.sub.TeleportCommand;
-import me.lokka30.phantomworlds.commands.phantomworlds.sub.UnloadCommand;
-import me.lokka30.phantomworlds.commands.phantomworlds.utils.WorldFolder;
-import org.bukkit.World;
-import org.bukkit.entity.Player;
-import revxrsal.commands.annotation.Command;
-import revxrsal.commands.annotation.Default;
-import revxrsal.commands.annotation.DefaultFor;
-import revxrsal.commands.annotation.Description;
-import revxrsal.commands.annotation.Optional;
-import revxrsal.commands.annotation.Subcommand;
-import revxrsal.commands.bukkit.BukkitCommandActor;
-import revxrsal.commands.bukkit.annotation.CommandPermission;
-import revxrsal.commands.help.CommandHelp;
-
-import java.util.Arrays;
-
-/**
- * PWCommand
- *
- * @author creatorfromhell
- * @since 2.0.5.0
- */
-@Command({"pw", "phantomworlds"})
-public class PWCommand {
-
- @Subcommand({"help", "?"})
- @DefaultFor({"pw", "phantomworlds"})
- public void help(BukkitCommandActor actor, CommandHelp helpEntries, @Default("1") int page) {
-
- (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.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.help.create")
- public void create(BukkitCommandActor actor, final String name) {
- //todo: port create command
- }
-
- @Subcommand({"compatibility"})
- @CommandPermission("phantomworlds.command.phantomworlds.compatibility")
- @Description("command.phantomworlds.help.compatibility")
- public void compatibility(BukkitCommandActor actor) {
- CompatibilityCommand.onCommand(actor);
- }
-
- @Subcommand({"debug"})
- @CommandPermission("phantomworlds.command.phantomworlds.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.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.help.list")
- public void list(BukkitCommandActor actor) {
- ListCommand.onCommand(actor);
- }
-
- @Subcommand({"import", "im"})
- @CommandPermission("phantomworlds.command.phantomworlds.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.help.info")
- public void info(BukkitCommandActor actor) {
- InfoCommand.onCommand(actor);
- }
-
- @Subcommand({"load"})
- @CommandPermission("phantomworlds.command.phantomworlds.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.help.reload")
- public void reload(BukkitCommandActor actor) {
- ReloadCommand.onCommand(actor);
- }
-
- @Subcommand({"setspawn"})
- @CommandPermission("phantomworlds.command.phantomworlds.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.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.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.help.unload")
- public void unload(BukkitCommandActor actor, @Optional final World world) {
- UnloadCommand.onCommand(actor, world);
- }
-}
\ No newline at end of file
diff --git a/src/main/java/me/lokka30/phantomworlds/commands/phantomworlds/PhantomWorldsCommand.java b/src/main/java/me/lokka30/phantomworlds/commands/phantomworlds/PhantomWorldsCommand.java
deleted file mode 100644
index a666894..0000000
--- a/src/main/java/me/lokka30/phantomworlds/commands/phantomworlds/PhantomWorldsCommand.java
+++ /dev/null
@@ -1,103 +0,0 @@
-package me.lokka30.phantomworlds.commands.phantomworlds;
-
-import me.lokka30.microlib.messaging.MultiMessage;
-import me.lokka30.phantomworlds.PhantomWorlds;
-import me.lokka30.phantomworlds.commands.phantomworlds.subcommands.CreateSubcommand;
-import org.bukkit.command.Command;
-import org.bukkit.command.CommandSender;
-import org.bukkit.command.TabExecutor;
-import org.jetbrains.annotations.NotNull;
-
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.List;
-import java.util.Locale;
-
-/**
- * Command: /phantomworlds
- *
- * @author lokka30
- * @since v2.0.0
- */
-public class PhantomWorldsCommand implements TabExecutor {
-
- final CreateSubcommand createSubcommand = new CreateSubcommand();
- /**
- * @since v2.0.0
- */
- @Override
- public boolean onCommand(@NotNull CommandSender sender, @NotNull Command cmd,
- @NotNull String label, String[] args) {
- if(!sender.hasPermission("phantomworlds.command.phantomworlds")) {
- (new MultiMessage(
- PhantomWorlds.instance().messages.getConfig().getStringList("common.no-permission"), Arrays.asList(
- new MultiMessage.Placeholder("prefix",
- PhantomWorlds.instance().messages.getConfig().getString("common.prefix", "&b&lPhantomWorlds: &7"),
- true),
- new MultiMessage.Placeholder("permission", "phantomworlds.command.phantomworlds",
- false)
- ))).send(sender);
- return true;
- }
-
- if(args.length > 0) {
- switch(args[0].toLowerCase()) {
- case "create":
- createSubcommand.parseCommand(sender, cmd, label, args);
- break;
- default:
- (new MultiMessage(
- PhantomWorlds.instance().messages.getConfig()
- .getStringList("command.phantomworlds.invalid-subcommand"),
- Arrays.asList(
- new MultiMessage.Placeholder("prefix", PhantomWorlds.instance().messages.getConfig()
- .getString("common.prefix", "&b&lPhantomWorlds: &7"), true),
- new MultiMessage.Placeholder("arg", args[0], false)
- ))).send(sender);
-
- sendAvailableSubcommands(sender, label);
- break;
- }
- } else {
- sendAvailableSubcommands(sender, label);
- }
- return true;
- }
-
- /**
- * Displays messages that list available subcommands for /phantomworlds
- *
- * @param label label of the command (alias used).
- * @param sender commandsender of the command
- *
- * @since v2.0.0
- */
- void sendAvailableSubcommands(CommandSender sender, String label) {
- (new MultiMessage(
- PhantomWorlds.instance().messages.getConfig().getStringList("command.phantomworlds.usage"), Arrays.asList(
- new MultiMessage.Placeholder("prefix",
- PhantomWorlds.instance().messages.getConfig().getString("common.prefix", "&b&lPhantomWorlds: &7"),
- true),
- new MultiMessage.Placeholder("label", label, false)
- ))).send(sender);
- }
-
- /**
- * @since v2.0.0
- */
- @Override
- public List onTabComplete(@NotNull CommandSender sender, @NotNull Command cmd,
- @NotNull String label, String[] args) {
- if(args.length == 1) {
- return Arrays.asList("create", "gamerule", "info", "list", "setspawn", "reload", "teleport", "tp",
- "spawn", "unload", "debug", "compatibility");
- }
-
- switch(args[0].toLowerCase(Locale.ROOT)) {
- case "create":
- return createSubcommand.parseTabCompletion(sender, cmd, label, args);
- default:
- return Collections.emptyList();
- }
- }
-}
\ No newline at end of file
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
deleted file mode 100644
index 8d02ca3..0000000
--- a/src/main/java/me/lokka30/phantomworlds/commands/phantomworlds/parameters/resolvers/AliasWorldResolver.java
+++ /dev/null
@@ -1,39 +0,0 @@
-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.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();
-
- return PhantomWorlds.worldManager().findWorld(value);
- }
-}
\ No newline at end of file
diff --git a/src/main/java/me/lokka30/phantomworlds/commands/phantomworlds/parameters/resolvers/WorldFolderResolver.java b/src/main/java/me/lokka30/phantomworlds/commands/phantomworlds/parameters/resolvers/WorldFolderResolver.java
deleted file mode 100644
index fa2e277..0000000
--- a/src/main/java/me/lokka30/phantomworlds/commands/phantomworlds/parameters/resolvers/WorldFolderResolver.java
+++ /dev/null
@@ -1,38 +0,0 @@
-package me.lokka30.phantomworlds.commands.phantomworlds.parameters.resolvers;
-/*
- * The New Economy
- * Copyright (C) 2022 - 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 org.jetbrains.annotations.NotNull;
-import revxrsal.commands.process.ValueResolver;
-
-/**
- * StatusResolver
- *
- * @author creatorfromhell
- * @since 0.1.2.0
- */
-public class WorldFolderResolver implements ValueResolver {
-
- @Override
- public WorldFolder resolve(@NotNull ValueResolverContext context) throws Throwable {
- final String value = context.arguments().pop();
-
- return new WorldFolder(value);
- }
-}
\ No newline at end of file
diff --git a/src/main/java/me/lokka30/phantomworlds/commands/phantomworlds/parameters/suggestion/WorldFolderSuggestion.java b/src/main/java/me/lokka30/phantomworlds/commands/phantomworlds/parameters/suggestion/WorldFolderSuggestion.java
deleted file mode 100644
index 95b2f33..0000000
--- a/src/main/java/me/lokka30/phantomworlds/commands/phantomworlds/parameters/suggestion/WorldFolderSuggestion.java
+++ /dev/null
@@ -1,53 +0,0 @@
-package me.lokka30.phantomworlds.commands.phantomworlds.parameters.suggestion;
-/*
- * The New Economy
- * Copyright (C) 2022 - 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 org.bukkit.Bukkit;
-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;
-
-/**
- * RegionSuggestion
- *
- * @author creatorfromhell
- * @since 0.1.2.0
- */
-public class WorldFolderSuggestion implements SuggestionProvider {
-
- @Override
- public @NotNull Collection getSuggestions(@NotNull List list, @NotNull CommandActor commandActor, @NotNull ExecutableCommand executableCommand) throws Throwable {
-
- final List folders = new ArrayList<>();
- final File directory = Bukkit.getWorldContainer();
-
- for(File file : directory.listFiles()) {
- final File levelDat = new File(file, "level.dat");
- if(file.isDirectory() && levelDat.exists()) {
- folders.add(file.getName());
- }
- }
- return folders;
- }
-}
\ No newline at end of file
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
deleted file mode 100644
index 695e852..0000000
--- a/src/main/java/me/lokka30/phantomworlds/commands/phantomworlds/subcommands/CreateSubcommand.java
+++ /dev/null
@@ -1,439 +0,0 @@
-package me.lokka30.phantomworlds.commands.phantomworlds.subcommands;
-
-import me.lokka30.microlib.maths.QuickTimer;
-import me.lokka30.microlib.messaging.MultiMessage;
-import me.lokka30.phantomworlds.PhantomWorlds;
-import me.lokka30.phantomworlds.commands.Subcommand;
-import me.lokka30.phantomworlds.misc.Utils;
-import me.lokka30.phantomworlds.world.PhantomWorld;
-import org.bukkit.Bukkit;
-import org.bukkit.Difficulty;
-import org.bukkit.GameMode;
-import org.bukkit.World;
-import org.bukkit.WorldType;
-import org.bukkit.command.Command;
-import org.bukkit.command.CommandSender;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.List;
-import java.util.Locale;
-import java.util.Optional;
-import java.util.concurrent.TimeUnit;
-
-/**
- * @author lokka30
- * @since v2.0.0
- */
-public class CreateSubcommand implements Subcommand {
-
- final ArrayList TAB_COMPLETIONS_FOR_OPTIONS_ARGS;
-
- public CreateSubcommand() {
- TAB_COMPLETIONS_FOR_OPTIONS_ARGS = generateOptionsTabCompletionList();
- }
-
- /*
- cmd: /pw create [options...]
- arg: - 0 1 2 3+
- len: 0 1 2 3 4+
- */
-
- /**
- * @since v2.0.0
- */
- @Override
- public void parseCommand(CommandSender sender, Command cmd, String label, String[] args) {
- if(!sender.hasPermission("phantomworlds.command.phantomworlds.create")) {
- (new MultiMessage(
- PhantomWorlds.instance().messages.getConfig().getStringList("common.no-permission"), Arrays.asList(
- new MultiMessage.Placeholder("prefix",
- PhantomWorlds.instance().messages.getConfig().getString("common.prefix", "&b&lPhantomWorlds: &7"),
- true),
- new MultiMessage.Placeholder("permission",
- "phantomworlds.command.phantomworlds.create", false)
- ))).send(sender);
- return;
- }
-
- if(args.length < 3) {
- (new MultiMessage(
- PhantomWorlds.instance().messages.getConfig()
- .getStringList("command.phantomworlds.subcommands.create.usage"), Arrays.asList(
- new MultiMessage.Placeholder("prefix",
- PhantomWorlds.instance().messages.getConfig().getString("common.prefix", "&b&lPhantomWorlds: &7"),
- true),
- new MultiMessage.Placeholder("label", label, false)
- ))).send(sender);
- return;
- }
-
- final String worldName = args[1];
- if(Bukkit.getWorld(worldName) != null) {
- (new MultiMessage(
- PhantomWorlds.instance().messages.getConfig()
- .getStringList("command.phantomworlds.subcommands.create.already-loaded"),
- Arrays.asList(
- new MultiMessage.Placeholder("prefix", PhantomWorlds.instance().messages.getConfig()
- .getString("common.prefix", "&b&lPhantomWorlds: &7"), true),
- new MultiMessage.Placeholder("world", worldName, false),
- new MultiMessage.Placeholder("label", label, false)
- ))).send(sender);
- return;
- }
-
- World.Environment environment;
- try {
- environment = World.Environment.valueOf(args[2].toUpperCase(Locale.ROOT));
- } catch(IllegalArgumentException ex) {
- (new MultiMessage(
- PhantomWorlds.instance().messages.getConfig().getStringList(
- "command.phantomworlds.subcommands.create.options.invalid-environment"),
- Arrays.asList(
- new MultiMessage.Placeholder("prefix", PhantomWorlds.instance().messages.getConfig()
- .getString("common.prefix", "&b&lPhantomWorlds: &7"), true),
- new MultiMessage.Placeholder("type", args[2], false),
- new MultiMessage.Placeholder("types", String.join(
- PhantomWorlds.instance().messages.getConfig().getString("common.list-delimiter", "&7, &b"),
- Utils.enumValuesToStringList(World.Environment.values())), true)
- ))).send(sender);
- return;
- }
-
- /* Default options: */
- boolean generateStructures = true;
- String generator = null;
- String generatorSettings = null;
- boolean hardcore = false;
- Long seed = null;
- WorldType worldType = WorldType.NORMAL;
- boolean spawnMobs = true;
- boolean spawnAnimals = true;
- boolean keepSpawnInMemory = false;
- boolean allowPvP = true;
- Difficulty difficulty = Difficulty.NORMAL;
- GameMode mode = GameMode.SURVIVAL;
-
- if(args.length > 3) {
- for(int index = 3; index < args.length; index++) {
- String arg = args[index];
-
- String[] split = arg.split(":", 2);
- if(split.length != 2) {
- (new MultiMessage(
- PhantomWorlds.instance().messages.getConfig().getStringList(
- "command.phantomworlds.subcommands.create.options.invalid-option"),
- Arrays.asList(
- new MultiMessage.Placeholder("prefix", PhantomWorlds.instance().messages.getConfig()
- .getString("common.prefix", "&b&lPhantomWorlds: &7"), true),
- new MultiMessage.Placeholder("option", args[index], false),
- new MultiMessage.Placeholder("options", String.join(
- PhantomWorlds.instance().messages.getConfig()
- .getString("common.list-delimiter", "&7, &b"),
- Arrays.asList("genStructures", "gen", "genSettings", "hardcore",
- "seed", "type", "spawnMobs", "spawnAnimals",
- "keepSpawnInMemory", "allowPvP", "difficulty", "gamemode")
- ), true)
- ))).send(sender);
- return;
- }
-
- String option = split[0].toLowerCase(Locale.ROOT);
- StringBuilder value = new StringBuilder(split[1]);
-
- if(option.startsWith("-")) {
- option = option.substring(1);
- } // remove - character if present, those switching from PW v1 may still use it by accident.
-
- switch(option) {
- case "generatestructures":
- case "genstructures":
- case "structures":
-
- final Optional gen = Utils.parseFromString(sender, value, option);
- if(!gen.isPresent()) {
- return;
- }
- generateStructures = gen.get();
- break;
-
- case "generator":
- case "gen":
- generator = value.toString();
- break;
-
- case "generatorsettings":
- case "gensettings":
- generatorSettings = value.toString();
- break;
- case "gamemode":
- mode = GameMode.valueOf(value.toString());
- break;
- case "hardcore":
-
- final Optional hard = Utils.parseFromString(sender, value, option);
- if(!hard.isPresent()) {
- return;
- }
- hardcore = hard.get();
- break;
-
- case "seed":
- try {
- seed = Long.valueOf(value.toString());
- } catch(NumberFormatException ex) {
- (new MultiMessage(
- PhantomWorlds.instance().messages.getConfig().getStringList(
- "command.phantomworlds.subcommands.create.options.invalid-value"),
- Arrays.asList(
- new MultiMessage.Placeholder("prefix", PhantomWorlds.instance().messages.getConfig()
- .getString("common.prefix", "&b&lPhantomWorlds: &7"), true),
- new MultiMessage.Placeholder("value", value.toString(), false),
- new MultiMessage.Placeholder("option", option, false),
- new MultiMessage.Placeholder("expected", "Long (any number)",
- false)
- ))).send(sender);
- return;
- }
- break;
- case "type":
- case "worldtype":
- try {
- worldType = WorldType.valueOf(
- value.toString().toUpperCase(Locale.ROOT));
- } catch(IllegalArgumentException ex) {
- (new MultiMessage(
- PhantomWorlds.instance().messages.getConfig().getStringList(
- "command.phantomworlds.subcommands.create.options.invalid-value-list"),
- Arrays.asList(
- new MultiMessage.Placeholder("prefix", PhantomWorlds.instance().messages.getConfig()
- .getString("common.prefix", "&b&lPhantomWorlds: &7"), true),
- new MultiMessage.Placeholder("value", value.toString(), false),
- new MultiMessage.Placeholder("option", option, false),
- new MultiMessage.Placeholder("expected", "WorldType", false),
- new MultiMessage.Placeholder("values", String.join(
- PhantomWorlds.instance().messages.getConfig()
- .getString("common.list-delimiter", "&7, &b"),
- Utils.enumValuesToStringList(WorldType.values())), true)
- ))).send(sender);
- return;
- }
- break;
- case "spawnmobs":
- case "mobs":
-
- final Optional mobs = Utils.parseFromString(sender, value, option);
- if(!mobs.isPresent()) {
- return;
- }
- spawnMobs = mobs.get();
- break;
-
- case "spawnanimals":
- case "animals":
-
- final Optional animals = Utils.parseFromString(sender, value, option);
- if(!animals.isPresent()) {
- return;
- }
- spawnAnimals = animals.get();
- break;
-
- case "keepspawninmemory":
- case "spawninmemory":
-
- final Optional spawn = Utils.parseFromString(sender, value, option);
- if(!spawn.isPresent()) {
- return;
- }
- keepSpawnInMemory = spawn.get();
- break;
-
- case "allowpvp":
- case "pvp":
-
- final Optional pvp = Utils.parseFromString(sender, value, option);
- if(!pvp.isPresent()) {
- return;
- }
- allowPvP = pvp.get();
- break;
-
- case "difficulty":
- case "diff":
- try {
- difficulty = Difficulty.valueOf(
- value.toString().toUpperCase(Locale.ROOT));
- } catch(IllegalArgumentException ex) {
- (new MultiMessage(
- PhantomWorlds.instance().messages.getConfig().getStringList(
- "command.phantomworlds.subcommands.create.options.invalid-value-list"),
- Arrays.asList(
- new MultiMessage.Placeholder("prefix", PhantomWorlds.instance().messages.getConfig()
- .getString("common.prefix", "&b&lPhantomWorlds: &7"), true),
- new MultiMessage.Placeholder("value", value.toString(), false),
- new MultiMessage.Placeholder("option", option, false),
- new MultiMessage.Placeholder("expected", "Difficulty", false),
- new MultiMessage.Placeholder("values", String.join(
- PhantomWorlds.instance().messages.getConfig()
- .getString("common.list-delimiter", "&7, &b"),
- Utils.enumValuesToStringList(Difficulty.values())), true)
- ))).send(sender);
- return;
- }
- break;
- default:
- (new MultiMessage(
- PhantomWorlds.instance().messages.getConfig().getStringList(
- "command.phantomworlds.subcommands.create.options.invalid-option"),
- Arrays.asList(
- new MultiMessage.Placeholder("prefix", PhantomWorlds.instance().messages.getConfig()
- .getString("common.prefix", "&b&lPhantomWorlds: &7"), true),
- new MultiMessage.Placeholder("option", option, false),
- new MultiMessage.Placeholder("options", String.join(
- PhantomWorlds.instance().messages.getConfig()
- .getString("common.list-delimiter", "&7, &b"),
- Arrays.asList("genStructures", "gen", "genSettings", "hardcore",
- "seed", "type", "spawnMobs", "spawnAnimals",
- "keepSpawnInMemory", "allowPvP", "difficulty")
- ), true)
- ))).send(sender);
- return;
- }
- }
- }
-
- final PhantomWorld pworld = new PhantomWorld(
- worldName, environment, generateStructures, generator,
- generatorSettings, hardcore, seed, worldType, spawnMobs,
- spawnAnimals, keepSpawnInMemory, allowPvP, difficulty, mode
- );
-
- final QuickTimer quickTimer = new QuickTimer(TimeUnit.MILLISECONDS);
-
- (new MultiMessage(
- PhantomWorlds.instance().messages.getConfig()
- .getStringList("command.phantomworlds.subcommands.create.creation.starting"),
- Arrays.asList(
- new MultiMessage.Placeholder("prefix",
- PhantomWorlds.instance().messages.getConfig().getString("common.prefix", "&b&lPhantomWorlds: &7"),
- true),
- new MultiMessage.Placeholder("world", worldName, false)
- ))).send(sender);
-
- (new MultiMessage(
- PhantomWorlds.instance().messages.getConfig().getStringList(
- "command.phantomworlds.subcommands.create.creation.saving-world-data"),
- Arrays.asList(
- new MultiMessage.Placeholder("prefix",
- PhantomWorlds.instance().messages.getConfig().getString("common.prefix", "&b&lPhantomWorlds: &7"),
- true),
- new MultiMessage.Placeholder("world", worldName, false)
- ))).send(sender);
-
- pworld.save();
-
- (new MultiMessage(
- PhantomWorlds.instance().messages.getConfig().getStringList(
- "command.phantomworlds.subcommands.create.creation.constructing-world"),
- Arrays.asList(
- new MultiMessage.Placeholder("prefix",
- PhantomWorlds.instance().messages.getConfig().getString("common.prefix", "&b&lPhantomWorlds: &7"),
- true),
- new MultiMessage.Placeholder("world", worldName, false)
- ))).send(sender);
-
- pworld.create();
-
- (new MultiMessage(
- PhantomWorlds.instance().messages.getConfig()
- .getStringList("command.phantomworlds.subcommands.create.creation.complete"),
- Arrays.asList(
- new MultiMessage.Placeholder("prefix",
- PhantomWorlds.instance().messages.getConfig().getString("common.prefix", "&b&lPhantomWorlds: &7"),
- true),
- new MultiMessage.Placeholder("world", worldName, false),
- new MultiMessage.Placeholder("time", Long.toString(quickTimer.getDuration()), false),
- new MultiMessage.Placeholder("label", label, false)
- ))).send(sender);
- }
-
- /**
- * @since v2.0.0
- */
- @Override
- public List parseTabCompletion(CommandSender sender, Command cmd, String label, String[] args) {
- if(!sender.hasPermission("phantomworlds.command.phantomworlds.create")) {
- return Collections.emptyList();
- }
-
- if(args.length == 2) {
- return Collections.singletonList("ExampleWorldName");
- }
-
- if(args.length == 3) {
- return Utils.enumValuesToStringList(World.Environment.values());
- }
-
- if(args.length > 3) {
- return TAB_COMPLETIONS_FOR_OPTIONS_ARGS;
- }
-
- return Collections.emptyList();
- }
-
- ArrayList generateOptionsTabCompletionList() {
- final ArrayList suggestions = new ArrayList<>();
-
- suggestions.addAll(addTrueFalseValues("generatestructures"));
- suggestions.addAll(addTrueFalseValues("genstructures"));
- suggestions.addAll(addTrueFalseValues("structures"));
- suggestions.addAll(addTrueFalseValues("spawnmobs"));
- suggestions.addAll(addTrueFalseValues("mobs"));
- suggestions.addAll(addTrueFalseValues("spawnanimals"));
- suggestions.addAll(addTrueFalseValues("animals"));
- suggestions.addAll(addTrueFalseValues("keepspawninmemory"));
- suggestions.addAll(addTrueFalseValues("spawninmemory"));
- suggestions.addAll(addTrueFalseValues("hardcore"));
- suggestions.addAll(addTrueFalseValues("allowpvp"));
- suggestions.addAll(addTrueFalseValues("pvp"));
- suggestions.addAll(addTrueFalseValues("difficulty"));
- suggestions.addAll(addTrueFalseValues("diff"));
-
- suggestions.add("generator:");
- suggestions.add("gen:");
-
- suggestions.add("generatorsettings:");
- suggestions.add("gensettings:");
-
- suggestions.add("gamemode:ADVENTURE");
- suggestions.add("gamemode:CREATIVE");
- suggestions.add("gamemode:HARDCORE");
- suggestions.add("gamemode:SURVIVAL");
-
- suggestions.add("seed:");
-
- for(WorldType worldType : WorldType.values()) {
- suggestions.add("type:" + worldType.toString());
- }
-
- return suggestions;
- }
-
- ArrayList addTrueFalseValues(String option) {
- final ArrayList list = new ArrayList<>();
- option = option + ":";
-
- list.add(option + "true");
- list.add(option + "t");
- list.add(option + "yes");
- list.add(option + "y");
- list.add(option + "false");
- list.add(option + "f");
- list.add(option + "no");
- list.add(option + "n");
-
- return list;
- }
-}
\ No newline at end of file
diff --git a/src/main/java/me/lokka30/phantomworlds/commandsredux/PWCommand.java b/src/main/java/me/lokka30/phantomworlds/commandsredux/PWCommand.java
new file mode 100644
index 0000000..4d25d4a
--- /dev/null
+++ b/src/main/java/me/lokka30/phantomworlds/commandsredux/PWCommand.java
@@ -0,0 +1,188 @@
+package me.lokka30.phantomworlds.commandsredux;
+/*
+ * Phantom Worlds
+ * Copyright (C) 2023 - 2024 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 dev.rollczi.litecommands.annotations.argument.Arg;
+import dev.rollczi.litecommands.annotations.command.Command;
+import dev.rollczi.litecommands.annotations.context.Context;
+import dev.rollczi.litecommands.annotations.description.Description;
+import dev.rollczi.litecommands.annotations.execute.Execute;
+import dev.rollczi.litecommands.annotations.optional.OptionalArg;
+import dev.rollczi.litecommands.annotations.permission.Permission;
+import me.lokka30.phantomworlds.commandsredux.sub.BackupCommand;
+import me.lokka30.phantomworlds.commandsredux.sub.CompatibilityCommand;
+import me.lokka30.phantomworlds.commandsredux.sub.CreateCommand;
+import me.lokka30.phantomworlds.commandsredux.sub.DebugCommand;
+import me.lokka30.phantomworlds.commandsredux.sub.DeleteCommand;
+import me.lokka30.phantomworlds.commandsredux.sub.ImportCommand;
+import me.lokka30.phantomworlds.commandsredux.sub.InfoCommand;
+import me.lokka30.phantomworlds.commandsredux.sub.ListCommand;
+import me.lokka30.phantomworlds.commandsredux.sub.LoadCommand;
+import me.lokka30.phantomworlds.commandsredux.sub.ReloadCommand;
+import me.lokka30.phantomworlds.commandsredux.sub.SetSpawnCommand;
+import me.lokka30.phantomworlds.commandsredux.sub.SpawnCommand;
+import me.lokka30.phantomworlds.commandsredux.sub.TeleportCommand;
+import me.lokka30.phantomworlds.commandsredux.sub.UnloadCommand;
+import me.lokka30.phantomworlds.commandsredux.sub.set.SetEffectsCommand;
+import me.lokka30.phantomworlds.commandsredux.sub.set.SetGamemodeCommand;
+import me.lokka30.phantomworlds.commandsredux.sub.set.SetPortalCommand;
+import me.lokka30.phantomworlds.commandsredux.sub.set.SetWhitelistCommand;
+import me.lokka30.phantomworlds.commandsredux.utils.WorldFolder;
+import org.bukkit.GameMode;
+import org.bukkit.PortalType;
+import org.bukkit.World;
+import org.bukkit.command.CommandSender;
+import org.bukkit.entity.Player;
+
+import java.util.List;
+
+/**
+ * PWCommand
+ *
+ * @author creatorfromhell
+ * @since 2.0.5.0
+ */
+@Command(name = "phantomworlds", aliases = "pw")
+public class PWCommand {
+
+ @Execute(name = "backup", aliases = {"archive", "bu"})
+ @Permission("phantomworlds.command.phantomworlds.backup")
+ @Description("command.phantomworlds.help.backup")
+ public void backup(@Context CommandSender commandSender, @OptionalArg("world") final World world) {
+ BackupCommand.onCommand(commandSender, world);
+ }
+
+ @Execute(name = "create", aliases = {"+", "new"})
+ @Permission("phantomworlds.command.phantomworlds.create")
+ @Description("command.phantomworlds.help.create")
+ public void create(@Context CommandSender commandSender, @Arg("world name") final String name, @Arg("environment")World.Environment environment, @OptionalArg("world-setting") List settings) {
+ CreateCommand.onCommand(commandSender, name, environment, settings);
+ }
+
+ @Execute(name = "compatibility")
+ @Permission("phantomworlds.command.phantomworlds.compatibility")
+ @Description("command.phantomworlds.help.compatibility")
+ public void compatibility(@Context CommandSender commandSender) {
+ CompatibilityCommand.onCommand(commandSender);
+ }
+
+ @Execute(name = "debug")
+ @Permission("phantomworlds.command.phantomworlds.debug")
+ @Description("command.phantomworlds.help.debug")
+ public void debug(@Context CommandSender commandSender, @OptionalArg("level") final String level) {
+ DebugCommand.onCommand(commandSender, level);
+ }
+
+ @Execute(name = "delete", aliases = {"-", "remove", "del"})
+ @Permission("phantomworlds.command.phantomworlds.delete")
+ @Description("command.phantomworlds.help.delete")
+ public void delete(@Context CommandSender commandSender, @OptionalArg("world") final World world) {
+ DeleteCommand.onCommand(commandSender, world);
+ }
+
+ @Execute(name = "list", aliases = {"l"})
+ @Permission("phantomworlds.command.phantomworlds.list")
+ @Description("command.phantomworlds.help.list")
+ public void list(@Context CommandSender commandSender) {
+ ListCommand.onCommand(commandSender);
+ }
+
+ @Execute(name = "import", aliases = {"im"})
+ @Permission("phantomworlds.command.phantomworlds.import")
+ @Description("command.phantomworlds.help.import")
+ public void importCMD(@Context CommandSender commandSender, @OptionalArg("world") final World world) {
+ ImportCommand.onCommand(commandSender, world);
+ }
+
+ @Execute(name = "info", aliases = {"i"})
+ @Permission("phantomworlds.command.phantomworlds.info")
+ @Description("command.phantomworlds.help.info")
+ public void info(@Context CommandSender commandSender) {
+ InfoCommand.onCommand(commandSender);
+ }
+
+ @Execute(name = "load")
+ @Permission("phantomworlds.command.phantomworlds.load")
+ @Description("command.phantomworlds.help.load")
+ public void load(@Context CommandSender commandSender, @OptionalArg("world folder") final WorldFolder world) {
+ LoadCommand.onCommand(commandSender, world);
+ }
+
+ @Execute(name = "reload", aliases = {"r"})
+ @Permission("phantomworlds.command.phantomworlds.reload")
+ @Description("command.phantomworlds.help.reload")
+ public void reload(@Context CommandSender commandSender) {
+ ReloadCommand.onCommand(commandSender);
+ }
+
+ @Execute(name = "set effects", aliases = {"set eff"})
+ @Permission("phantomworlds.command.phantomworlds.set.effects")
+ @Description("command.phantomworlds.help.seteffects")
+ public void setEffects(@Context CommandSender commandSender, @Arg("world") World world, @OptionalArg("potion-effects") List effects) {
+ SetEffectsCommand.onCommand(commandSender, world, effects);
+ }
+
+ @Execute(name = "set gamemode", aliases = {"set mode"})
+ @Permission("phantomworlds.command.phantomworlds.set.gamemode")
+ @Description("command.phantomworlds.help.setgamemode")
+ public void setGamemode(@Context CommandSender commandSender, @Arg("world") World world, @Arg("mode") GameMode mode) {
+ SetGamemodeCommand.onCommand(commandSender, world, mode);
+ }
+
+ @Execute(name = "set portal")
+ @Permission("phantomworlds.command.phantomworlds.set.portal")
+ @Description("command.phantomworlds.help.setportal")
+ public void setPortal(@Context CommandSender commandSender, @Arg("world") World world, @Arg("portal type") PortalType portal, @Arg("world to") World worldTo) {
+ SetPortalCommand.onCommand(commandSender, world, portal, worldTo);
+ }
+
+ @Execute(name = "set whitelist")
+ @Permission("phantomworlds.command.phantomworlds.set.whitelist")
+ @Description("command.phantomworlds.help.setwhitelist")
+ public void setWhitelist(@Context CommandSender commandSender, @Arg("world") World world, @Arg("whitelist") boolean whitelist) {
+ SetWhitelistCommand.onCommand(commandSender, world, whitelist);
+ }
+
+ @Execute(name = "setspawn", aliases = {"ss"})
+ @Permission("phantomworlds.command.phantomworlds.setspawn")
+ @Description("command.phantomworlds.help.setspawn")
+ public void setspawn(@Context CommandSender commandSender, @OptionalArg("x") Double x, @OptionalArg("y") Double y, @OptionalArg("z") Double z, @OptionalArg("world") World world, @OptionalArg("yaw") Float yaw, @OptionalArg("pitch") Float pitch) {
+ SetSpawnCommand.onCommand(commandSender, x, y, z, world, yaw, pitch);
+ }
+
+ @Execute(name = "spawn")
+ @Permission("phantomworlds.command.phantomworlds.spawn")
+ @Description("command.phantomworlds.help.spawn")
+ public void spawn(@Context CommandSender commandSender, @OptionalArg("world") final World world, @OptionalArg("target") final Player player) {
+ SpawnCommand.onCommand(commandSender, world, player);
+ }
+
+ @Execute(name = "teleport", aliases = {"tp"})
+ @Permission("phantomworlds.command.phantomworlds.teleport")
+ @Description("command.phantomworlds.help.tp")
+ public void tp(@Context CommandSender commandSender, @OptionalArg("world") final World world, @OptionalArg("target") final Player player) {
+ TeleportCommand.onCommand(commandSender, world, player);
+ }
+
+ @Execute(name = "unload", aliases = {"u"})
+ @Permission("phantomworlds.command.phantomworlds.unload")
+ @Description("command.phantomworlds.help.unload")
+ public void unload(@Context CommandSender commandSender, @OptionalArg("world") final World world) {
+ UnloadCommand.onCommand(commandSender, world);
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/me/lokka30/phantomworlds/commandsredux/handler/PWInvalidUsageHandler.java b/src/main/java/me/lokka30/phantomworlds/commandsredux/handler/PWInvalidUsageHandler.java
new file mode 100644
index 0000000..355acbe
--- /dev/null
+++ b/src/main/java/me/lokka30/phantomworlds/commandsredux/handler/PWInvalidUsageHandler.java
@@ -0,0 +1,41 @@
+package me.lokka30.phantomworlds.commandsredux.handler;
+/*
+ * Phantom Worlds
+ * Copyright (C) 2023 - 2024 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 dev.rollczi.litecommands.handler.result.ResultHandlerChain;
+import dev.rollczi.litecommands.invalidusage.InvalidUsage;
+import dev.rollczi.litecommands.invalidusage.InvalidUsageHandler;
+import dev.rollczi.litecommands.invocation.Invocation;
+import dev.rollczi.litecommands.schematic.Schematic;
+import org.bukkit.command.CommandSender;
+
+/**
+ * InvalidUsageHandler
+ *
+ * @author creatorfromhell
+ * @since 2.0.5.0
+ */
+public class PWInvalidUsageHandler implements InvalidUsageHandler {
+ @Override
+ public void handle(Invocation invocation, InvalidUsage result, ResultHandlerChain chain) {
+
+ final CommandSender sender = invocation.sender();
+ final Schematic schematic = result.getSchematic();
+
+ }
+}
diff --git a/src/main/java/me/lokka30/phantomworlds/commands/phantomworlds/parameters/suggestion/AliasWorldSuggestion.java b/src/main/java/me/lokka30/phantomworlds/commandsredux/params/AliasWorldParameter.java
similarity index 52%
rename from src/main/java/me/lokka30/phantomworlds/commands/phantomworlds/parameters/suggestion/AliasWorldSuggestion.java
rename to src/main/java/me/lokka30/phantomworlds/commandsredux/params/AliasWorldParameter.java
index 4e3a09f..9525884 100644
--- a/src/main/java/me/lokka30/phantomworlds/commands/phantomworlds/parameters/suggestion/AliasWorldSuggestion.java
+++ b/src/main/java/me/lokka30/phantomworlds/commandsredux/params/AliasWorldParameter.java
@@ -1,7 +1,7 @@
-package me.lokka30.phantomworlds.commands.phantomworlds.parameters.suggestion;
+package me.lokka30.phantomworlds.commandsredux.params;
/*
* Phantom Worlds
- * Copyright (C) 2023 Daniel "creatorfromhell" Vidmar
+ * Copyright (C) 2023 - 2024 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
@@ -17,34 +17,40 @@
* along with this program. If not, see .
*/
+import dev.rollczi.litecommands.argument.Argument;
+import dev.rollczi.litecommands.argument.parser.ParseResult;
+import dev.rollczi.litecommands.argument.resolver.ArgumentResolver;
+import dev.rollczi.litecommands.invocation.Invocation;
+import dev.rollczi.litecommands.suggestion.SuggestionContext;
+import dev.rollczi.litecommands.suggestion.SuggestionResult;
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 org.bukkit.command.CommandSender;
import java.util.ArrayList;
-import java.util.Collection;
import java.util.List;
/**
- * AliasWorldSuggestion
+ * AliasWorldParameter
*
* @author creatorfromhell
* @since 2.0.5.0
*/
-public class AliasWorldSuggestion implements SuggestionProvider {
+public class AliasWorldParameter extends ArgumentResolver {
+ @Override
+ protected ParseResult parse(Invocation invocation, Argument context, String argument) {
+ return ParseResult.success(PhantomWorlds.worldManager().findWorld(argument));
+ }
@Override
- public @NotNull Collection getSuggestions(@NotNull List list, @NotNull CommandActor commandActor, @NotNull ExecutableCommand executableCommand) throws Throwable {
+ public SuggestionResult suggest(Invocation invocation, Argument argument, SuggestionContext context) {
final List worlds = new ArrayList<>(PhantomWorlds.worldManager().aliases.keySet());
for(final World world : Bukkit.getWorlds()) {
worlds.add(world.getName());
}
- return worlds;
+ return SuggestionResult.of(worlds);
}
}
\ No newline at end of file
diff --git a/src/main/java/me/lokka30/phantomworlds/commandsredux/params/GamemodeParameter.java b/src/main/java/me/lokka30/phantomworlds/commandsredux/params/GamemodeParameter.java
new file mode 100644
index 0000000..aebcedc
--- /dev/null
+++ b/src/main/java/me/lokka30/phantomworlds/commandsredux/params/GamemodeParameter.java
@@ -0,0 +1,66 @@
+package me.lokka30.phantomworlds.commandsredux.params;
+/*
+ * Phantom Worlds
+ * Copyright (C) 2023 - 2024 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 dev.rollczi.litecommands.argument.Argument;
+import dev.rollczi.litecommands.argument.parser.ParseResult;
+import dev.rollczi.litecommands.argument.resolver.ArgumentResolver;
+import dev.rollczi.litecommands.invocation.Invocation;
+import dev.rollczi.litecommands.suggestion.SuggestionContext;
+import dev.rollczi.litecommands.suggestion.SuggestionResult;
+import org.bukkit.GameMode;
+import org.bukkit.command.CommandSender;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * PotionEffectParameter
+ *
+ * @author creatorfromhell
+ * @since 2.0.5.0
+ */
+public class GamemodeParameter extends ArgumentResolver {
+
+ private static final Map GAME_MODE_ARGUMENTS = new HashMap<>();
+
+ static {
+ for (GameMode value : GameMode.values()) {
+ GAME_MODE_ARGUMENTS.put(value.name().toLowerCase(), value);
+
+ //noinspection deprecation
+ GAME_MODE_ARGUMENTS.put(String.valueOf(value.getValue()), value);
+ }
+ }
+
+ @Override
+ protected ParseResult parse(Invocation invocation, Argument context, String argument) {
+ GameMode gameMode = GAME_MODE_ARGUMENTS.get(argument.toLowerCase());
+
+ if (gameMode == null) {
+ return ParseResult.failure("Invalid gamemode argument!");
+ }
+
+ return ParseResult.success(gameMode);
+ }
+
+ @Override
+ public SuggestionResult suggest(Invocation invocation, Argument argument, SuggestionContext context) {
+ return SuggestionResult.of(GAME_MODE_ARGUMENTS.keySet());
+ }
+}
diff --git a/src/main/java/me/lokka30/phantomworlds/commandsredux/params/PortalParameter.java b/src/main/java/me/lokka30/phantomworlds/commandsredux/params/PortalParameter.java
new file mode 100644
index 0000000..5b702ac
--- /dev/null
+++ b/src/main/java/me/lokka30/phantomworlds/commandsredux/params/PortalParameter.java
@@ -0,0 +1,62 @@
+package me.lokka30.phantomworlds.commandsredux.params;
+/*
+ * Phantom Worlds
+ * Copyright (C) 2023 - 2024 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 dev.rollczi.litecommands.argument.Argument;
+import dev.rollczi.litecommands.argument.parser.ParseResult;
+import dev.rollczi.litecommands.argument.resolver.ArgumentResolver;
+import dev.rollczi.litecommands.invocation.Invocation;
+import dev.rollczi.litecommands.suggestion.SuggestionContext;
+import dev.rollczi.litecommands.suggestion.SuggestionResult;
+import org.bukkit.PortalType;
+import org.bukkit.command.CommandSender;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * PotionEffectParameter
+ *
+ * @author creatorfromhell
+ * @since 2.0.5.0
+ */
+public class PortalParameter extends ArgumentResolver {
+
+ private static final Map PORTAL_ARGUMENTS = new HashMap<>();
+
+ static {
+ PORTAL_ARGUMENTS.put("end", PortalType.ENDER);
+ PORTAL_ARGUMENTS.put("nether", PortalType.NETHER);
+ }
+
+ @Override
+ protected ParseResult parse(Invocation invocation, Argument context, String argument) {
+ PortalType gameMode = PORTAL_ARGUMENTS.get(argument.toLowerCase());
+
+ if (gameMode == null) {
+ return ParseResult.failure("Invalid portal type argument!");
+ }
+
+ return ParseResult.success(gameMode);
+ }
+
+ @Override
+ public SuggestionResult suggest(Invocation invocation, Argument argument, SuggestionContext context) {
+ return SuggestionResult.of(PORTAL_ARGUMENTS.keySet());
+ }
+}
diff --git a/src/main/java/me/lokka30/phantomworlds/commandsredux/params/PotionEffectParameter.java b/src/main/java/me/lokka30/phantomworlds/commandsredux/params/PotionEffectParameter.java
new file mode 100644
index 0000000..5eedb2c
--- /dev/null
+++ b/src/main/java/me/lokka30/phantomworlds/commandsredux/params/PotionEffectParameter.java
@@ -0,0 +1,62 @@
+package me.lokka30.phantomworlds.commandsredux.params;
+/*
+ * Phantom Worlds
+ * Copyright (C) 2023 - 2024 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 dev.rollczi.litecommands.argument.Argument;
+import dev.rollczi.litecommands.argument.parser.ParseResult;
+import dev.rollczi.litecommands.argument.resolver.ArgumentResolver;
+import dev.rollczi.litecommands.invocation.Invocation;
+import dev.rollczi.litecommands.suggestion.SuggestionContext;
+import dev.rollczi.litecommands.suggestion.SuggestionResult;
+import org.bukkit.command.CommandSender;
+import org.bukkit.potion.PotionEffectType;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+/**
+ * PotionEffectParameter
+ *
+ * @author creatorfromhell
+ * @since 2.0.5.0
+ */
+public class PotionEffectParameter extends ArgumentResolver {
+
+ private static final List POTION_EFFECTS = new ArrayList<>();
+
+ static {
+ for (PotionEffectType value : PotionEffectType.values()) {
+ POTION_EFFECTS.add(value.getName());
+ }
+ }
+
+ @Override
+ protected ParseResult parse(Invocation invocation, Argument context, String argument) {
+ return ParseResult.success(Collections.singletonList(argument));
+ }
+
+ @Override
+ public SuggestionResult suggest(Invocation invocation, Argument argument, SuggestionContext context) {
+
+ if(argument.getKeyName().equalsIgnoreCase("potion-effects")) {
+ return SuggestionResult.of(POTION_EFFECTS);
+ }
+ return SuggestionResult.of(new ArrayList<>());
+ }
+}
diff --git a/src/main/java/me/lokka30/phantomworlds/commandsredux/params/SettingParameter.java b/src/main/java/me/lokka30/phantomworlds/commandsredux/params/SettingParameter.java
new file mode 100644
index 0000000..5dabd30
--- /dev/null
+++ b/src/main/java/me/lokka30/phantomworlds/commandsredux/params/SettingParameter.java
@@ -0,0 +1,53 @@
+package me.lokka30.phantomworlds.commandsredux.params;
+/*
+ * Phantom Worlds
+ * Copyright (C) 2023 - 2024 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 dev.rollczi.litecommands.argument.Argument;
+import dev.rollczi.litecommands.argument.parser.ParseResult;
+import dev.rollczi.litecommands.argument.resolver.ArgumentResolver;
+import dev.rollczi.litecommands.invocation.Invocation;
+import dev.rollczi.litecommands.suggestion.SuggestionContext;
+import dev.rollczi.litecommands.suggestion.SuggestionResult;
+import me.lokka30.phantomworlds.PhantomWorlds;
+import org.bukkit.command.CommandSender;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+/**
+ * Setting
+ *
+ * @author creatorfromhell
+ * @since 2.0.5.0
+ */
+public class SettingParameter extends ArgumentResolver {
+ @Override
+ protected ParseResult parse(Invocation invocation, Argument context, String argument) {
+ return ParseResult.success(Collections.singletonList(argument));
+ }
+
+ @Override
+ public SuggestionResult suggest(Invocation invocation, Argument argument, SuggestionContext context) {
+
+ if(argument.getKeyName().equalsIgnoreCase("world-setting")) {
+ return SuggestionResult.of(PhantomWorlds.createTabs);
+ }
+ return SuggestionResult.of(new ArrayList<>());
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/me/lokka30/phantomworlds/commandsredux/params/WorldFolderParameter.java b/src/main/java/me/lokka30/phantomworlds/commandsredux/params/WorldFolderParameter.java
new file mode 100644
index 0000000..4136a1e
--- /dev/null
+++ b/src/main/java/me/lokka30/phantomworlds/commandsredux/params/WorldFolderParameter.java
@@ -0,0 +1,67 @@
+package me.lokka30.phantomworlds.commandsredux.params;
+/*
+ * Phantom Worlds
+ * Copyright (C) 2023 - 2024 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 dev.rollczi.litecommands.argument.Argument;
+import dev.rollczi.litecommands.argument.parser.ParseResult;
+import dev.rollczi.litecommands.argument.resolver.ArgumentResolver;
+import dev.rollczi.litecommands.invocation.Invocation;
+import dev.rollczi.litecommands.suggestion.SuggestionContext;
+import dev.rollczi.litecommands.suggestion.SuggestionResult;
+import me.lokka30.phantomworlds.commandsredux.utils.WorldFolder;
+import org.bukkit.Bukkit;
+import org.bukkit.command.CommandSender;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * WorldFolderParameter
+ *
+ * @author creatorfromhell
+ * @since 2.0.5.0
+ */
+public class WorldFolderParameter extends ArgumentResolver {
+ @Override
+ protected ParseResult parse(Invocation invocation, Argument context, String argument) {
+ final File directory = Bukkit.getWorldContainer();
+ final File worldDir = new File(directory, argument);
+
+ if(!worldDir.exists()) {
+ return ParseResult.failure("Invalid world directory specified!");
+ }
+ return ParseResult.success(new WorldFolder(argument));
+ }
+
+ @Override
+ public SuggestionResult suggest(Invocation invocation, Argument argument, SuggestionContext context) {
+ final List folders = new ArrayList<>();
+ final File directory = Bukkit.getWorldContainer();
+
+ if(directory.exists()) {
+ for(File file : directory.listFiles()) {
+ final File levelDat = new File(file, "level.dat");
+ if(file.isDirectory() && levelDat.exists()) {
+ folders.add(file.getName());
+ }
+ }
+ }
+ return SuggestionResult.of(folders);
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/me/lokka30/phantomworlds/commands/phantomworlds/sub/BackupCommand.java b/src/main/java/me/lokka30/phantomworlds/commandsredux/sub/BackupCommand.java
similarity index 82%
rename from src/main/java/me/lokka30/phantomworlds/commands/phantomworlds/sub/BackupCommand.java
rename to src/main/java/me/lokka30/phantomworlds/commandsredux/sub/BackupCommand.java
index 578b898..0d2f3a1 100644
--- a/src/main/java/me/lokka30/phantomworlds/commands/phantomworlds/sub/BackupCommand.java
+++ b/src/main/java/me/lokka30/phantomworlds/commandsredux/sub/BackupCommand.java
@@ -1,8 +1,8 @@
-package me.lokka30.phantomworlds.commands.phantomworlds.sub;
+package me.lokka30.phantomworlds.commandsredux.sub;
/*
* Phantom Worlds
- * Copyright (C) 2023 Daniel "creatorfromhell" Vidmar
+ * Copyright (C) 2023 - 2024 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
@@ -22,7 +22,7 @@
import me.lokka30.phantomworlds.PhantomWorlds;
import me.lokka30.phantomworlds.misc.Utils;
import org.bukkit.World;
-import revxrsal.commands.bukkit.BukkitCommandActor;
+import org.bukkit.command.CommandSender;
import java.util.Arrays;
@@ -34,9 +34,9 @@
*/
public class BackupCommand {
- public static void onCommand(final BukkitCommandActor actor, final World world) {
+ public static void onCommand(final CommandSender sender, final World world) {
- if(!Utils.checkWorld(actor.getSender(), "command.phantomworlds.subcommands.backup.usage", world)) {
+ if(!Utils.checkWorld(sender, "command.phantomworlds.subcommands.backup.usage", world)) {
return;
}
@@ -48,7 +48,7 @@ public static void onCommand(final BukkitCommandActor actor, final World world)
PhantomWorlds.instance().messages.getConfig().getString("common.prefix", "&b&lPhantomWorlds: &7"),
true),
new MultiMessage.Placeholder("world", world.getName(), false)
- ))).send(actor.getSender());
+ ))).send(sender);
}
(new MultiMessage(
@@ -58,6 +58,6 @@ public static void onCommand(final BukkitCommandActor actor, final World world)
PhantomWorlds.instance().messages.getConfig().getString("common.prefix", "&b&lPhantomWorlds: &7"),
true),
new MultiMessage.Placeholder("world", world.getName(), false)
- ))).send(actor.getSender());
+ ))).send(sender);
}
}
\ No newline at end of file
diff --git a/src/main/java/me/lokka30/phantomworlds/commands/phantomworlds/sub/CompatibilityCommand.java b/src/main/java/me/lokka30/phantomworlds/commandsredux/sub/CompatibilityCommand.java
similarity index 90%
rename from src/main/java/me/lokka30/phantomworlds/commands/phantomworlds/sub/CompatibilityCommand.java
rename to src/main/java/me/lokka30/phantomworlds/commandsredux/sub/CompatibilityCommand.java
index b3ad57e..a32b3bc 100644
--- a/src/main/java/me/lokka30/phantomworlds/commands/phantomworlds/sub/CompatibilityCommand.java
+++ b/src/main/java/me/lokka30/phantomworlds/commandsredux/sub/CompatibilityCommand.java
@@ -1,7 +1,7 @@
-package me.lokka30.phantomworlds.commands.phantomworlds.sub;
+package me.lokka30.phantomworlds.commandsredux.sub;
/*
* Phantom Worlds
- * Copyright (C) 2023 Daniel "creatorfromhell" Vidmar
+ * Copyright (C) 2023 - 2024 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
@@ -20,7 +20,7 @@
import me.lokka30.microlib.messaging.MultiMessage;
import me.lokka30.phantomworlds.PhantomWorlds;
import me.lokka30.phantomworlds.misc.CompatibilityChecker;
-import revxrsal.commands.bukkit.BukkitCommandActor;
+import org.bukkit.command.CommandSender;
import java.util.Arrays;
import java.util.Collections;
@@ -33,7 +33,7 @@
*/
public class CompatibilityCommand {
- public static void onCommand(final BukkitCommandActor actor) {
+ public static void onCommand(final CommandSender sender) {
(new MultiMessage(
PhantomWorlds.instance().messages.getConfig()
.getStringList("command.phantomworlds.subcommands.compatibility.start"),
@@ -41,7 +41,7 @@ public static void onCommand(final BukkitCommandActor actor) {
new MultiMessage.Placeholder("prefix",
PhantomWorlds.instance().messages.getConfig().getString("common.prefix", "&b&lPhantomWorlds: &7"),
true)
- ))).send(actor.getSender());
+ ))).send(sender);
PhantomWorlds.instance().compatibilityChecker.checkAll();
@@ -52,7 +52,7 @@ public static void onCommand(final BukkitCommandActor actor) {
Collections.singletonList(
new MultiMessage.Placeholder("prefix", PhantomWorlds.instance().messages.getConfig()
.getString("common.prefix", "&b&lPhantomWorlds: &7"), true)
- ))).send(actor.getSender());
+ ))).send(sender);
return;
}
@@ -65,7 +65,7 @@ public static void onCommand(final BukkitCommandActor actor) {
true),
new MultiMessage.Placeholder("amount",
String.valueOf(PhantomWorlds.instance().compatibilityChecker.incompatibilities.size()), false)
- ))).send(actor.getSender());
+ ))).send(sender);
for(int i = 0; i < PhantomWorlds.instance().compatibilityChecker.incompatibilities.size(); i++) {
CompatibilityChecker.Incompatibility incompatibility = PhantomWorlds.instance().compatibilityChecker.incompatibilities.get(
@@ -82,7 +82,7 @@ public static void onCommand(final BukkitCommandActor actor) {
new MultiMessage.Placeholder("reason", incompatibility.reason, true),
new MultiMessage.Placeholder("recommendation", incompatibility.recommendation,
true)
- ))).send(actor.getSender());
+ ))).send(sender);
}
}
}
\ No newline at end of file
diff --git a/src/main/java/me/lokka30/phantomworlds/commandsredux/sub/CreateCommand.java b/src/main/java/me/lokka30/phantomworlds/commandsredux/sub/CreateCommand.java
new file mode 100644
index 0000000..f67b5a0
--- /dev/null
+++ b/src/main/java/me/lokka30/phantomworlds/commandsredux/sub/CreateCommand.java
@@ -0,0 +1,325 @@
+package me.lokka30.phantomworlds.commandsredux.sub;
+/*
+ * Phantom Worlds
+ * Copyright (C) 2023 - 2024 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.microlib.maths.QuickTimer;
+import me.lokka30.microlib.messaging.MultiMessage;
+import me.lokka30.phantomworlds.PhantomWorlds;
+import me.lokka30.phantomworlds.misc.Utils;
+import me.lokka30.phantomworlds.world.PhantomWorld;
+import org.bukkit.Bukkit;
+import org.bukkit.Difficulty;
+import org.bukkit.GameMode;
+import org.bukkit.World;
+import org.bukkit.WorldType;
+import org.bukkit.command.CommandSender;
+
+import java.util.Arrays;
+import java.util.List;
+import java.util.Locale;
+import java.util.Optional;
+import java.util.concurrent.TimeUnit;
+
+/**
+ * CreateCommand
+ *
+ * @author creatorfromhell
+ * @since 2.0.5.0
+ */
+public class CreateCommand {
+
+ public static void onCommand(final CommandSender sender, final String worldName, final World.Environment environment, final List settings) {
+
+ if(Bukkit.getWorld(worldName) != null) {
+ (new MultiMessage(
+ PhantomWorlds.instance().messages.getConfig()
+ .getStringList("command.phantomworlds.subcommands.create.already-loaded"),
+ Arrays.asList(
+ new MultiMessage.Placeholder("prefix", PhantomWorlds.instance().messages.getConfig()
+ .getString("common.prefix", "&b&lPhantomWorlds: &7"), true),
+ new MultiMessage.Placeholder("world", worldName, false),
+ new MultiMessage.Placeholder("label", "pw", false)
+ ))).send(sender);
+ return;
+ }
+
+ if(environment == null) {
+ (new MultiMessage(
+ PhantomWorlds.instance().messages.getConfig().getStringList(
+ "command.phantomworlds.subcommands.create.options.invalid-environment"),
+ Arrays.asList(
+ new MultiMessage.Placeholder("prefix", PhantomWorlds.instance().messages.getConfig()
+ .getString("common.prefix", "&b&lPhantomWorlds: &7"), true),
+ new MultiMessage.Placeholder("type", "", false),
+ new MultiMessage.Placeholder("types", String.join(
+ PhantomWorlds.instance().messages.getConfig().getString("common.list-delimiter", "&7, &b"),
+ Utils.enumValuesToStringList(World.Environment.values())), true)
+ ))).send(sender);
+ return;
+ }
+
+ /* Default options: */
+ boolean generateStructures = true;
+ String generator = null;
+ String generatorSettings = null;
+ boolean hardcore = false;
+ Long seed = null;
+ WorldType worldType = WorldType.NORMAL;
+ boolean spawnMobs = true;
+ boolean spawnAnimals = true;
+ boolean keepSpawnInMemory = false;
+ boolean allowPvP = true;
+ Difficulty difficulty = Difficulty.NORMAL;
+ GameMode mode = GameMode.SURVIVAL;
+ for(final String setting : settings) {
+
+ final String[] split = setting.split(":", 2);
+ if(split.length != 2) {
+ (new MultiMessage(
+ PhantomWorlds.instance().messages.getConfig().getStringList(
+ "command.phantomworlds.subcommands.create.options.invalid-option"),
+ Arrays.asList(
+ new MultiMessage.Placeholder("prefix", PhantomWorlds.instance().messages.getConfig()
+ .getString("common.prefix", "&b&lPhantomWorlds: &7"), true),
+ new MultiMessage.Placeholder("option", setting, false),
+ new MultiMessage.Placeholder("options", String.join(
+ PhantomWorlds.instance().messages.getConfig()
+ .getString("common.list-delimiter", "&7, &b"),
+ Arrays.asList("genStructures", "gen", "genSettings", "hardcore",
+ "seed", "type", "spawnMobs", "spawnAnimals",
+ "keepSpawnInMemory", "allowPvP", "difficulty", "gamemode")
+ ), true)
+ ))).send(sender);
+ return;
+ }
+
+ final String option = split[0].toLowerCase(Locale.ROOT);
+ final StringBuilder value = new StringBuilder(split[1]);
+
+ switch(option) {
+ case "generatestructures":
+ case "genstructures":
+ case "structures":
+
+ final Optional gen = Utils.parseFromString(sender, value, option);
+ if(!gen.isPresent()) {
+ return;
+ }
+ generateStructures = gen.get();
+ break;
+
+ case "generator":
+ case "gen":
+ generator = value.toString();
+ break;
+
+ case "generatorsettings":
+ case "gensettings":
+ generatorSettings = value.toString();
+ break;
+ case "gamemode":
+ mode = GameMode.valueOf(value.toString());
+ break;
+ case "hardcore":
+
+ final Optional hard = Utils.parseFromString(sender, value, option);
+ if(!hard.isPresent()) {
+ return;
+ }
+ hardcore = hard.get();
+ break;
+
+ case "seed":
+ try {
+ seed = Long.valueOf(value.toString());
+ } catch(NumberFormatException ex) {
+ (new MultiMessage(
+ PhantomWorlds.instance().messages.getConfig().getStringList(
+ "command.phantomworlds.subcommands.create.options.invalid-value"),
+ Arrays.asList(
+ new MultiMessage.Placeholder("prefix", PhantomWorlds.instance().messages.getConfig()
+ .getString("common.prefix", "&b&lPhantomWorlds: &7"), true),
+ new MultiMessage.Placeholder("value", value.toString(), false),
+ new MultiMessage.Placeholder("option", option, false),
+ new MultiMessage.Placeholder("expected", "Long (any number)",
+ false)
+ ))).send(sender);
+ return;
+ }
+ break;
+ case "type":
+ case "worldtype":
+ try {
+ worldType = WorldType.valueOf(
+ value.toString().toUpperCase(Locale.ROOT));
+ } catch(IllegalArgumentException ex) {
+ (new MultiMessage(
+ PhantomWorlds.instance().messages.getConfig().getStringList(
+ "command.phantomworlds.subcommands.create.options.invalid-value-list"),
+ Arrays.asList(
+ new MultiMessage.Placeholder("prefix", PhantomWorlds.instance().messages.getConfig()
+ .getString("common.prefix", "&b&lPhantomWorlds: &7"), true),
+ new MultiMessage.Placeholder("value", value.toString(), false),
+ new MultiMessage.Placeholder("option", option, false),
+ new MultiMessage.Placeholder("expected", "WorldType", false),
+ new MultiMessage.Placeholder("values", String.join(
+ PhantomWorlds.instance().messages.getConfig()
+ .getString("common.list-delimiter", "&7, &b"),
+ Utils.enumValuesToStringList(WorldType.values())), true)
+ ))).send(sender);
+ return;
+ }
+ break;
+ case "spawnmobs":
+ case "mobs":
+
+ final Optional mobs = Utils.parseFromString(sender, value, option);
+ if(!mobs.isPresent()) {
+ return;
+ }
+ spawnMobs = mobs.get();
+ break;
+
+ case "spawnanimals":
+ case "animals":
+
+ final Optional animals = Utils.parseFromString(sender, value, option);
+ if(!animals.isPresent()) {
+ return;
+ }
+ spawnAnimals = animals.get();
+ break;
+
+ case "keepspawninmemory":
+ case "spawninmemory":
+
+ final Optional spawn = Utils.parseFromString(sender, value, option);
+ if(!spawn.isPresent()) {
+ return;
+ }
+ keepSpawnInMemory = spawn.get();
+ break;
+
+ case "allowpvp":
+ case "pvp":
+
+ final Optional pvp = Utils.parseFromString(sender, value, option);
+ if(!pvp.isPresent()) {
+ return;
+ }
+ allowPvP = pvp.get();
+ break;
+
+ case "difficulty":
+ case "diff":
+ try {
+ difficulty = Difficulty.valueOf(
+ value.toString().toUpperCase(Locale.ROOT));
+ } catch(IllegalArgumentException ex) {
+ (new MultiMessage(
+ PhantomWorlds.instance().messages.getConfig().getStringList(
+ "command.phantomworlds.subcommands.create.options.invalid-value-list"),
+ Arrays.asList(
+ new MultiMessage.Placeholder("prefix", PhantomWorlds.instance().messages.getConfig()
+ .getString("common.prefix", "&b&lPhantomWorlds: &7"), true),
+ new MultiMessage.Placeholder("value", value.toString(), false),
+ new MultiMessage.Placeholder("option", option, false),
+ new MultiMessage.Placeholder("expected", "Difficulty", false),
+ new MultiMessage.Placeholder("values", String.join(
+ PhantomWorlds.instance().messages.getConfig()
+ .getString("common.list-delimiter", "&7, &b"),
+ Utils.enumValuesToStringList(Difficulty.values())), true)
+ ))).send(sender);
+ return;
+ }
+ break;
+ default:
+ (new MultiMessage(
+ PhantomWorlds.instance().messages.getConfig().getStringList(
+ "command.phantomworlds.subcommands.create.options.invalid-option"),
+ Arrays.asList(
+ new MultiMessage.Placeholder("prefix", PhantomWorlds.instance().messages.getConfig()
+ .getString("common.prefix", "&b&lPhantomWorlds: &7"), true),
+ new MultiMessage.Placeholder("option", option, false),
+ new MultiMessage.Placeholder("options", String.join(
+ PhantomWorlds.instance().messages.getConfig()
+ .getString("common.list-delimiter", "&7, &b"),
+ Arrays.asList("genStructures", "gen", "genSettings", "hardcore",
+ "seed", "type", "spawnMobs", "spawnAnimals",
+ "keepSpawnInMemory", "allowPvP", "difficulty")
+ ), true)
+ ))).send(sender);
+ return;
+ }
+ }
+
+ final PhantomWorld pworld = new PhantomWorld(
+ worldName, environment, generateStructures, generator,
+ generatorSettings, hardcore, seed, worldType, spawnMobs,
+ spawnAnimals, keepSpawnInMemory, allowPvP, difficulty, mode
+ );
+
+ final QuickTimer quickTimer = new QuickTimer(TimeUnit.MILLISECONDS);
+
+ (new MultiMessage(
+ PhantomWorlds.instance().messages.getConfig()
+ .getStringList("command.phantomworlds.subcommands.create.creation.starting"),
+ Arrays.asList(
+ new MultiMessage.Placeholder("prefix",
+ PhantomWorlds.instance().messages.getConfig().getString("common.prefix", "&b&lPhantomWorlds: &7"),
+ true),
+ new MultiMessage.Placeholder("world", worldName, false)
+ ))).send(sender);
+
+ (new MultiMessage(
+ PhantomWorlds.instance().messages.getConfig().getStringList(
+ "command.phantomworlds.subcommands.create.creation.saving-world-data"),
+ Arrays.asList(
+ new MultiMessage.Placeholder("prefix",
+ PhantomWorlds.instance().messages.getConfig().getString("common.prefix", "&b&lPhantomWorlds: &7"),
+ true),
+ new MultiMessage.Placeholder("world", worldName, false)
+ ))).send(sender);
+
+ pworld.save();
+
+ (new MultiMessage(
+ PhantomWorlds.instance().messages.getConfig().getStringList(
+ "command.phantomworlds.subcommands.create.creation.constructing-world"),
+ Arrays.asList(
+ new MultiMessage.Placeholder("prefix",
+ PhantomWorlds.instance().messages.getConfig().getString("common.prefix", "&b&lPhantomWorlds: &7"),
+ true),
+ new MultiMessage.Placeholder("world", worldName, false)
+ ))).send(sender);
+
+ pworld.create();
+
+ (new MultiMessage(
+ PhantomWorlds.instance().messages.getConfig()
+ .getStringList("command.phantomworlds.subcommands.create.creation.complete"),
+ Arrays.asList(
+ new MultiMessage.Placeholder("prefix",
+ PhantomWorlds.instance().messages.getConfig().getString("common.prefix", "&b&lPhantomWorlds: &7"),
+ true),
+ new MultiMessage.Placeholder("world", worldName, false),
+ new MultiMessage.Placeholder("time", Long.toString(quickTimer.getDuration()), false),
+ new MultiMessage.Placeholder("label", "pw", false)
+ ))).send(sender);
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/me/lokka30/phantomworlds/commands/phantomworlds/sub/DebugCommand.java b/src/main/java/me/lokka30/phantomworlds/commandsredux/sub/DebugCommand.java
similarity index 76%
rename from src/main/java/me/lokka30/phantomworlds/commands/phantomworlds/sub/DebugCommand.java
rename to src/main/java/me/lokka30/phantomworlds/commandsredux/sub/DebugCommand.java
index 80283fb..3c97ad9 100644
--- a/src/main/java/me/lokka30/phantomworlds/commands/phantomworlds/sub/DebugCommand.java
+++ b/src/main/java/me/lokka30/phantomworlds/commandsredux/sub/DebugCommand.java
@@ -1,7 +1,7 @@
-package me.lokka30.phantomworlds.commands.phantomworlds.sub;
+package me.lokka30.phantomworlds.commandsredux.sub;
/*
* Phantom Worlds
- * Copyright (C) 2023 Daniel "creatorfromhell" Vidmar
+ * Copyright (C) 2023 - 2024 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
@@ -18,7 +18,7 @@
*/
import me.lokka30.microlib.messaging.MessageUtils;
-import revxrsal.commands.bukkit.BukkitCommandActor;
+import org.bukkit.command.CommandSender;
import java.util.Locale;
@@ -30,21 +30,21 @@
*/
public class DebugCommand {
- public static void onCommand(final BukkitCommandActor actor, final String level) {
+ public static void onCommand(final CommandSender sender, final String level) {
final String parsed = (level == null)? "nothing" : level;
switch(parsed.toLowerCase(Locale.ROOT)) {
case "dump":
- actor.getSender().sendMessage(
+ sender.sendMessage(
MessageUtils.colorizeStandardCodes("&b&lPhantomWorlds: &7Incomplete."));
break;
default:
- actor.getSender().sendMessage(MessageUtils.colorizeStandardCodes(
+ sender.sendMessage(MessageUtils.colorizeStandardCodes(
"&b&lPhantomWorlds: &7Invalid debug method '%method%'.")
.replace("%method%", parsed)
);
- actor.getSender().sendMessage(MessageUtils.colorizeStandardCodes(
+ sender.sendMessage(MessageUtils.colorizeStandardCodes(
"&b&lPhantomWorlds: &7Note: Please do not run this subcommand unless you are sure you are meant to be doing so."));
break;
}
diff --git a/src/main/java/me/lokka30/phantomworlds/commands/phantomworlds/sub/DeleteCommand.java b/src/main/java/me/lokka30/phantomworlds/commandsredux/sub/DeleteCommand.java
similarity index 81%
rename from src/main/java/me/lokka30/phantomworlds/commands/phantomworlds/sub/DeleteCommand.java
rename to src/main/java/me/lokka30/phantomworlds/commandsredux/sub/DeleteCommand.java
index f2f21db..9312650 100644
--- a/src/main/java/me/lokka30/phantomworlds/commands/phantomworlds/sub/DeleteCommand.java
+++ b/src/main/java/me/lokka30/phantomworlds/commandsredux/sub/DeleteCommand.java
@@ -1,7 +1,7 @@
-package me.lokka30.phantomworlds.commands.phantomworlds.sub;
+package me.lokka30.phantomworlds.commandsredux.sub;
/*
* Phantom Worlds
- * Copyright (C) 2023 Daniel "creatorfromhell" Vidmar
+ * Copyright (C) 2023 - 2024 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
@@ -21,8 +21,8 @@
import me.lokka30.phantomworlds.PhantomWorlds;
import me.lokka30.phantomworlds.misc.Utils;
import org.bukkit.World;
+import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
-import revxrsal.commands.bukkit.BukkitCommandActor;
import java.util.Arrays;
@@ -34,15 +34,15 @@
*/
public class DeleteCommand {
- public static void onCommand(final BukkitCommandActor actor, final World world) {
+ public static void onCommand(final CommandSender sender, final World world) {
- if(!Utils.checkWorld(actor.getSender(), "command.phantomworlds.subcommands.delete.usage", world)) {
+ if(!Utils.checkWorld(sender, "command.phantomworlds.subcommands.delete.usage", world)) {
return;
}
- if(actor.getSender() instanceof Player) {
+ if(sender instanceof Player) {
- if(world.getPlayers().contains((Player)actor.getSender())) {
+ if(world.getPlayers().contains((Player)sender)) {
(new MultiMessage(
PhantomWorlds.instance().messages.getConfig().getStringList(
"command.phantomworlds.subcommands.unload.in-specified-world"),
@@ -50,7 +50,7 @@ public static void onCommand(final BukkitCommandActor actor, final World world)
new MultiMessage.Placeholder("prefix", PhantomWorlds.instance().messages.getConfig()
.getString("common.prefix", "&b&lPhantomWorlds: &7"), true),
new MultiMessage.Placeholder("world", world.getName(), false)
- ))).send(actor.getSender());
+ ))).send(sender);
return;
}
}
@@ -63,7 +63,7 @@ public static void onCommand(final BukkitCommandActor actor, final World world)
PhantomWorlds.instance().messages.getConfig().getString("common.prefix", "&b&lPhantomWorlds: &7"),
true),
new MultiMessage.Placeholder("world", world.getName(), false)
- ))).send(actor.getSender());
+ ))).send(sender);
}
(new MultiMessage(
@@ -73,6 +73,6 @@ public static void onCommand(final BukkitCommandActor actor, final World world)
PhantomWorlds.instance().messages.getConfig().getString("common.prefix", "&b&lPhantomWorlds: &7"),
true),
new MultiMessage.Placeholder("world", world.getName(), false)
- ))).send(actor.getSender());
+ ))).send(sender);
}
}
\ No newline at end of file
diff --git a/src/main/java/me/lokka30/phantomworlds/commands/phantomworlds/sub/ImportCommand.java b/src/main/java/me/lokka30/phantomworlds/commandsredux/sub/ImportCommand.java
similarity index 88%
rename from src/main/java/me/lokka30/phantomworlds/commands/phantomworlds/sub/ImportCommand.java
rename to src/main/java/me/lokka30/phantomworlds/commandsredux/sub/ImportCommand.java
index 9303baf..27d55cd 100644
--- a/src/main/java/me/lokka30/phantomworlds/commands/phantomworlds/sub/ImportCommand.java
+++ b/src/main/java/me/lokka30/phantomworlds/commandsredux/sub/ImportCommand.java
@@ -1,7 +1,7 @@
-package me.lokka30.phantomworlds.commands.phantomworlds.sub;
+package me.lokka30.phantomworlds.commandsredux.sub;
/*
* Phantom Worlds
- * Copyright (C) 2023 Daniel "creatorfromhell" Vidmar
+ * Copyright (C) 2023 - 2024 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
@@ -22,7 +22,7 @@
import me.lokka30.phantomworlds.world.PhantomWorld;
import org.bukkit.GameMode;
import org.bukkit.World;
-import revxrsal.commands.bukkit.BukkitCommandActor;
+import org.bukkit.command.CommandSender;
import java.util.Arrays;
import java.util.Collections;
@@ -35,7 +35,7 @@
*/
public class ImportCommand {
- public static void onCommand(final BukkitCommandActor actor, final World world) {
+ public static void onCommand(final CommandSender sender, final World world) {
if(world == null) {
(new MultiMessage(
@@ -44,7 +44,7 @@ public static void onCommand(final BukkitCommandActor actor, final World world)
Collections.singletonList(
new MultiMessage.Placeholder("prefix", PhantomWorlds.instance().messages.getConfig()
.getString("common.prefix", "&b&lPhantomWorlds: &7"), true)
- ))).send(actor.getSender());
+ ))).send(sender);
return;
}
@@ -57,7 +57,7 @@ public static void onCommand(final BukkitCommandActor actor, final World world)
new MultiMessage.Placeholder("prefix", PhantomWorlds.instance().messages.getConfig()
.getString("common.prefix", "&b&lPhantomWorlds: &7"), true),
new MultiMessage.Placeholder("world", world.getName(), false)
- ))).send(actor.getSender());
+ ))).send(sender);
return;
}
@@ -74,6 +74,6 @@ public static void onCommand(final BukkitCommandActor actor, final World world)
new MultiMessage.Placeholder("prefix", PhantomWorlds.instance().messages.getConfig()
.getString("common.prefix", "&b&lPhantomWorlds: &7"), true),
new MultiMessage.Placeholder("world", world.getName(), false)
- ))).send(actor.getSender());
+ ))).send(sender);
}
}
\ No newline at end of file
diff --git a/src/main/java/me/lokka30/phantomworlds/commands/phantomworlds/sub/InfoCommand.java b/src/main/java/me/lokka30/phantomworlds/commandsredux/sub/InfoCommand.java
similarity index 88%
rename from src/main/java/me/lokka30/phantomworlds/commands/phantomworlds/sub/InfoCommand.java
rename to src/main/java/me/lokka30/phantomworlds/commandsredux/sub/InfoCommand.java
index 324e39c..1e7258d 100644
--- a/src/main/java/me/lokka30/phantomworlds/commands/phantomworlds/sub/InfoCommand.java
+++ b/src/main/java/me/lokka30/phantomworlds/commandsredux/sub/InfoCommand.java
@@ -1,7 +1,7 @@
-package me.lokka30.phantomworlds.commands.phantomworlds.sub;
+package me.lokka30.phantomworlds.commandsredux.sub;
/*
* Phantom Worlds
- * Copyright (C) 2023 Daniel "creatorfromhell" Vidmar
+ * Copyright (C) 2023 - 2024 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
@@ -19,7 +19,7 @@
import me.lokka30.microlib.messaging.MultiMessage;
import me.lokka30.phantomworlds.PhantomWorlds;
-import revxrsal.commands.bukkit.BukkitCommandActor;
+import org.bukkit.command.CommandSender;
import java.util.Arrays;
@@ -31,7 +31,7 @@
*/
public class InfoCommand {
- public static void onCommand(final BukkitCommandActor actor) {
+ public static void onCommand(final CommandSender sender) {
(new MultiMessage(
PhantomWorlds.instance().messages.getConfig()
@@ -48,6 +48,6 @@ public static void onCommand(final BukkitCommandActor actor) {
PhantomWorlds.CONTRIBUTORS), false),
new MultiMessage.Placeholder("supportedServerVersions", PhantomWorlds.instance().supportedServerVersions,
false)
- ))).send(actor.getSender());
+ ))).send(sender);
}
}
\ No newline at end of file
diff --git a/src/main/java/me/lokka30/phantomworlds/commands/phantomworlds/sub/ListCommand.java b/src/main/java/me/lokka30/phantomworlds/commandsredux/sub/ListCommand.java
similarity index 91%
rename from src/main/java/me/lokka30/phantomworlds/commands/phantomworlds/sub/ListCommand.java
rename to src/main/java/me/lokka30/phantomworlds/commandsredux/sub/ListCommand.java
index 62ecec8..f35839a 100644
--- a/src/main/java/me/lokka30/phantomworlds/commands/phantomworlds/sub/ListCommand.java
+++ b/src/main/java/me/lokka30/phantomworlds/commandsredux/sub/ListCommand.java
@@ -1,7 +1,7 @@
-package me.lokka30.phantomworlds.commands.phantomworlds.sub;
+package me.lokka30.phantomworlds.commandsredux.sub;
/*
* Phantom Worlds
- * Copyright (C) 2023 Daniel "creatorfromhell" Vidmar
+ * Copyright (C) 2023 - 2024 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
@@ -21,7 +21,7 @@
import me.lokka30.phantomworlds.PhantomWorlds;
import org.bukkit.Bukkit;
import org.bukkit.World;
-import revxrsal.commands.bukkit.BukkitCommandActor;
+import org.bukkit.command.CommandSender;
import java.io.File;
import java.util.Arrays;
@@ -35,7 +35,7 @@
*/
public class ListCommand {
- public static void onCommand(final BukkitCommandActor actor) {
+ public static void onCommand(final CommandSender sender) {
(new MultiMessage(
PhantomWorlds.instance().messages.getConfig()
.getStringList("command.phantomworlds.subcommands.list.header-loaded"), Arrays.asList(
@@ -43,7 +43,7 @@ public static void onCommand(final BukkitCommandActor actor) {
PhantomWorlds.instance().messages.getConfig().getString("common.prefix", "&b&lPhantomWorlds: &7"),
true),
new MultiMessage.Placeholder("amount", String.valueOf(Bukkit.getWorlds().size()), false)
- ))).send(actor.getSender());
+ ))).send(sender);
final HashSet loaded = new HashSet<>();
@@ -60,7 +60,7 @@ public static void onCommand(final BukkitCommandActor actor) {
PhantomWorlds.instance().messages.getConfig().getString("common.prefix", "&b&lPhantomWorlds: &7"),
true),
new MultiMessage.Placeholder("world", world, false)
- ))).send(actor.getSender());
+ ))).send(sender);
}
final HashSet unloaded = new HashSet<>();
@@ -82,7 +82,7 @@ public static void onCommand(final BukkitCommandActor actor) {
PhantomWorlds.instance().messages.getConfig().getString("common.prefix", "&b&lPhantomWorlds: &7"),
true),
new MultiMessage.Placeholder("amount", String.valueOf(unloaded.size()), false)
- ))).send(actor.getSender());
+ ))).send(sender);
for(String world : unloaded) {
(new MultiMessage(
@@ -92,7 +92,7 @@ public static void onCommand(final BukkitCommandActor actor) {
PhantomWorlds.instance().messages.getConfig().getString("common.prefix", "&b&lPhantomWorlds: &7"),
true),
new MultiMessage.Placeholder("world", world, false)
- ))).send(actor.getSender());
+ ))).send(sender);
}
final HashSet archived = new HashSet<>();
@@ -110,7 +110,7 @@ public static void onCommand(final BukkitCommandActor actor) {
PhantomWorlds.instance().messages.getConfig().getString("common.prefix", "&b&lPhantomWorlds: &7"),
true),
new MultiMessage.Placeholder("amount", String.valueOf(archived.size()), false)
- ))).send(actor.getSender());
+ ))).send(sender);
for(String world : archived) {
(new MultiMessage(
@@ -120,7 +120,7 @@ public static void onCommand(final BukkitCommandActor actor) {
PhantomWorlds.instance().messages.getConfig().getString("common.prefix", "&b&lPhantomWorlds: &7"),
true),
new MultiMessage.Placeholder("world", world, false)
- ))).send(actor.getSender());
+ ))).send(sender);
}
}
}
\ 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/commandsredux/sub/LoadCommand.java
similarity index 88%
rename from src/main/java/me/lokka30/phantomworlds/commands/phantomworlds/sub/LoadCommand.java
rename to src/main/java/me/lokka30/phantomworlds/commandsredux/sub/LoadCommand.java
index 6b76d6f..442d977 100644
--- a/src/main/java/me/lokka30/phantomworlds/commands/phantomworlds/sub/LoadCommand.java
+++ b/src/main/java/me/lokka30/phantomworlds/commandsredux/sub/LoadCommand.java
@@ -1,7 +1,7 @@
-package me.lokka30.phantomworlds.commands.phantomworlds.sub;
+package me.lokka30.phantomworlds.commandsredux.sub;
/*
* Phantom Worlds
- * Copyright (C) 2023 Daniel "creatorfromhell" Vidmar
+ * Copyright (C) 2023 - 2024 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
@@ -19,9 +19,9 @@
import me.lokka30.microlib.messaging.MultiMessage;
import me.lokka30.phantomworlds.PhantomWorlds;
-import me.lokka30.phantomworlds.commands.phantomworlds.utils.WorldFolder;
+import me.lokka30.phantomworlds.commandsredux.utils.WorldFolder;
import me.lokka30.phantomworlds.misc.WorldLoadResponse;
-import revxrsal.commands.bukkit.BukkitCommandActor;
+import org.bukkit.command.CommandSender;
import java.util.Arrays;
@@ -37,7 +37,7 @@
*/
public class LoadCommand {
- public static void onCommand(final BukkitCommandActor actor, final WorldFolder world) {
+ public static void onCommand(final CommandSender sender, final WorldFolder world) {
if(world == null || world.getFolder() == null) {
(new MultiMessage(
@@ -47,7 +47,7 @@ public static void onCommand(final BukkitCommandActor actor, final WorldFolder w
PhantomWorlds.instance().messages.getConfig().getString("common.prefix", "&b&lPhantomWorlds: &7"),
true),
new MultiMessage.Placeholder("label", "pw", false)
- ))).send(actor.getSender());
+ ))).send(sender);
return;
}
@@ -62,7 +62,7 @@ public static void onCommand(final BukkitCommandActor actor, final WorldFolder w
.getString("common.prefix", "&b&lPhantomWorlds: &7"), true),
new MultiMessage.Placeholder("world", world.getFolder(), false),
new MultiMessage.Placeholder("label", "pw", false)
- ))).send(actor.getSender());
+ ))).send(sender);
return;
}
@@ -75,7 +75,7 @@ public static void onCommand(final BukkitCommandActor actor, final WorldFolder w
.getString("common.prefix", "&b&lPhantomWorlds: &7"), true),
new MultiMessage.Placeholder("world", world.getFolder(), false),
new MultiMessage.Placeholder("label", "pw", false)
- ))).send(actor.getSender());
+ ))).send(sender);
return;
}
@@ -89,7 +89,7 @@ public static void onCommand(final BukkitCommandActor actor, final WorldFolder w
.getString("common.prefix", "&b&lPhantomWorlds: &7"), true),
new MultiMessage.Placeholder("world", world.getFolder(), false),
new MultiMessage.Placeholder("label", "pw", false)
- ))).send(actor.getSender());
+ ))).send(sender);
return;
}
@@ -100,6 +100,6 @@ public static void onCommand(final BukkitCommandActor actor, final WorldFolder w
new MultiMessage.Placeholder("prefix", PhantomWorlds.instance().messages.getConfig()
.getString("common.prefix", "&b&lPhantomWorlds: &7"), true),
new MultiMessage.Placeholder("world", world.getFolder(), false)
- ))).send(actor.getSender());
+ ))).send(sender);
}
}
\ No newline at end of file
diff --git a/src/main/java/me/lokka30/phantomworlds/commands/phantomworlds/sub/ReloadCommand.java b/src/main/java/me/lokka30/phantomworlds/commandsredux/sub/ReloadCommand.java
similarity index 86%
rename from src/main/java/me/lokka30/phantomworlds/commands/phantomworlds/sub/ReloadCommand.java
rename to src/main/java/me/lokka30/phantomworlds/commandsredux/sub/ReloadCommand.java
index 8e03eb7..9f4fbbb 100644
--- a/src/main/java/me/lokka30/phantomworlds/commands/phantomworlds/sub/ReloadCommand.java
+++ b/src/main/java/me/lokka30/phantomworlds/commandsredux/sub/ReloadCommand.java
@@ -1,7 +1,7 @@
-package me.lokka30.phantomworlds.commands.phantomworlds.sub;
+package me.lokka30.phantomworlds.commandsredux.sub;
/*
* Phantom Worlds
- * Copyright (C) 2023 Daniel "creatorfromhell" Vidmar
+ * Copyright (C) 2023 - 2024 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
@@ -19,7 +19,7 @@
import me.lokka30.microlib.messaging.MultiMessage;
import me.lokka30.phantomworlds.PhantomWorlds;
-import revxrsal.commands.bukkit.BukkitCommandActor;
+import org.bukkit.command.CommandSender;
import java.util.Collections;
@@ -31,7 +31,7 @@
*/
public class ReloadCommand {
- public static void onCommand(final BukkitCommandActor actor) {
+ public static void onCommand(final CommandSender sender) {
(new MultiMessage(
PhantomWorlds.instance().messages.getConfig()
.getStringList("command.phantomworlds.subcommands.reload.reloading-files"),
@@ -39,7 +39,7 @@ public static void onCommand(final BukkitCommandActor actor) {
new MultiMessage.Placeholder("prefix",
PhantomWorlds.instance().messages.getConfig().getString("common.prefix", "&b&lPhantomWorlds: &7"),
true)
- ))).send(actor.getSender());
+ ))).send(sender);
PhantomWorlds.instance().loadFiles();
@@ -50,7 +50,7 @@ public static void onCommand(final BukkitCommandActor actor) {
new MultiMessage.Placeholder("prefix",
PhantomWorlds.instance().messages.getConfig().getString("common.prefix", "&b&lPhantomWorlds: &7"),
true)
- ))).send(actor.getSender());
+ ))).send(sender);
PhantomWorlds.instance().loadWorlds();
@@ -61,6 +61,6 @@ public static void onCommand(final BukkitCommandActor actor) {
new MultiMessage.Placeholder("prefix",
PhantomWorlds.instance().messages.getConfig().getString("common.prefix", "&b&lPhantomWorlds: &7"),
true)
- ))).send(actor.getSender());
+ ))).send(sender);
}
}
\ No newline at end of file
diff --git a/src/main/java/me/lokka30/phantomworlds/commands/phantomworlds/sub/SetSpawnCommand.java b/src/main/java/me/lokka30/phantomworlds/commandsredux/sub/SetSpawnCommand.java
similarity index 80%
rename from src/main/java/me/lokka30/phantomworlds/commands/phantomworlds/sub/SetSpawnCommand.java
rename to src/main/java/me/lokka30/phantomworlds/commandsredux/sub/SetSpawnCommand.java
index 6dd3722..5a13fd9 100644
--- a/src/main/java/me/lokka30/phantomworlds/commands/phantomworlds/sub/SetSpawnCommand.java
+++ b/src/main/java/me/lokka30/phantomworlds/commandsredux/sub/SetSpawnCommand.java
@@ -1,7 +1,7 @@
-package me.lokka30.phantomworlds.commands.phantomworlds.sub;
+package me.lokka30.phantomworlds.commandsredux.sub;
/*
* Phantom Worlds
- * Copyright (C) 2023 Daniel "creatorfromhell" Vidmar
+ * Copyright (C) 2023 - 2024 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
@@ -22,7 +22,8 @@
import me.lokka30.phantomworlds.misc.Utils;
import org.bukkit.Location;
import org.bukkit.World;
-import revxrsal.commands.bukkit.BukkitCommandActor;
+import org.bukkit.command.CommandSender;
+import org.bukkit.entity.Player;
import java.io.IOException;
import java.util.Arrays;
@@ -35,9 +36,9 @@
*/
public class SetSpawnCommand {
- public static void onCommand(final BukkitCommandActor actor, Double x, Double y, Double z, World world, Float yaw, Float pitch) {
+ public static void onCommand(final CommandSender sender, Double x, Double y, Double z, World world, Float yaw, Float pitch) {
- if(actor.isConsole() || actor.getAsPlayer() == null) {
+ if(!(sender instanceof Player)) {
if(x == null || y == null || z == null || world == null) {
(new MultiMessage(
PhantomWorlds.instance().messages.getConfig()
@@ -46,24 +47,26 @@ public static void onCommand(final BukkitCommandActor actor, Double x, Double y,
new MultiMessage.Placeholder("prefix", PhantomWorlds.instance().messages.getConfig()
.getString("common.prefix", "&b&lPhantomWorlds: &7"), true),
new MultiMessage.Placeholder("label", "setspawn", false)
- ))).send(actor.getSender());
+ ))).send(sender);
return;
}
}
- final World finalWorld = (world == null)? actor.getAsPlayer().getWorld() : world;
- final double finalX = (x == null)? actor.getAsPlayer().getLocation().getX() : x;
- final double finalY = (y == null)? actor.getAsPlayer().getLocation().getY() : y;
- final double finalZ = (z == null)? actor.getAsPlayer().getLocation().getZ() : z;
+ final Player player = (Player)sender;
+
+ final World finalWorld = (world == null)? ((Player)sender).getWorld() : world;
+ final double finalX = (x == null)? ((Player)sender).getLocation().getX() : x;
+ final double finalY = (y == null)? ((Player)sender).getLocation().getY() : y;
+ final double finalZ = (z == null)? ((Player)sender).getLocation().getZ() : z;
float finalYaw = (yaw == null)? 0 : yaw;
float finalPitch = (pitch == null)? 0 : pitch;
- if(yaw == null && actor.getAsPlayer() != null) {
- finalYaw = actor.getAsPlayer().getLocation().getYaw();
+ if(yaw == null && sender instanceof Player) {
+ finalYaw = ((Player)sender).getLocation().getYaw();
}
- if(pitch == null && actor.getAsPlayer() != null) {
- finalPitch = actor.getAsPlayer().getLocation().getPitch();
+ if(pitch == null && sender instanceof Player) {
+ finalPitch = ((Player)sender).getLocation().getPitch();
}
final String cfgPath = "worlds-to-load." + finalWorld.getName();
@@ -104,6 +107,6 @@ public static void onCommand(final BukkitCommandActor actor, Double x, Double y,
new MultiMessage.Placeholder("z", String.valueOf(Utils.roundTwoDecimalPlaces(finalZ)), false),
new MultiMessage.Placeholder("yaw", String.valueOf(Utils.roundTwoDecimalPlaces(finalYaw)), false),
new MultiMessage.Placeholder("pitch", String.valueOf(Utils.roundTwoDecimalPlaces(finalPitch)), false)
- ))).send(actor.getSender());
+ ))).send(sender);
}
}
\ No newline at end of file
diff --git a/src/main/java/me/lokka30/phantomworlds/commands/phantomworlds/sub/SpawnCommand.java b/src/main/java/me/lokka30/phantomworlds/commandsredux/sub/SpawnCommand.java
similarity index 59%
rename from src/main/java/me/lokka30/phantomworlds/commands/phantomworlds/sub/SpawnCommand.java
rename to src/main/java/me/lokka30/phantomworlds/commandsredux/sub/SpawnCommand.java
index 46b5a36..115bc57 100644
--- a/src/main/java/me/lokka30/phantomworlds/commands/phantomworlds/sub/SpawnCommand.java
+++ b/src/main/java/me/lokka30/phantomworlds/commandsredux/sub/SpawnCommand.java
@@ -1,7 +1,7 @@
-package me.lokka30.phantomworlds.commands.phantomworlds.sub;
+package me.lokka30.phantomworlds.commandsredux.sub;
/*
* Phantom Worlds
- * Copyright (C) 2023 Daniel "creatorfromhell" Vidmar
+ * Copyright (C) 2023 - 2024 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
@@ -19,8 +19,8 @@
import me.lokka30.phantomworlds.misc.Utils;
import org.bukkit.World;
+import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
-import revxrsal.commands.bukkit.BukkitCommandActor;
/**
* SpawnCommand
@@ -30,10 +30,10 @@
*/
public class SpawnCommand {
- public static void onCommand(final BukkitCommandActor actor, final World world, final Player player) {
- if(actor.isConsole() && !Utils.checkWorld(actor.getSender(), "command.phantomworlds.subcommands.spawn.usage", world)) {
+ public static void onCommand(final CommandSender sender, final World world, final Player player) {
+ if(!(sender instanceof Player) && !Utils.checkWorld(sender, "command.phantomworlds.subcommands.spawn.usage", world)) {
return;
}
- Utils.teleportToWorld(actor.getSender(), "spawn", "spawn", (player == null)? actor.getSender().getName() : player.getName(), (actor.isPlayer() && world == null)? actor.getAsPlayer().getWorld().getName() : world.getName());
+ Utils.teleportToWorld(sender, "spawn", "spawn", (player == null)? sender.getName() : player.getName(), (sender instanceof Player && world == null)? ((Player)sender).getWorld().getName() : world.getName());
}
}
\ No newline at end of file
diff --git a/src/main/java/me/lokka30/phantomworlds/commands/phantomworlds/sub/TeleportCommand.java b/src/main/java/me/lokka30/phantomworlds/commandsredux/sub/TeleportCommand.java
similarity index 63%
rename from src/main/java/me/lokka30/phantomworlds/commands/phantomworlds/sub/TeleportCommand.java
rename to src/main/java/me/lokka30/phantomworlds/commandsredux/sub/TeleportCommand.java
index 5485d01..2fbb8e7 100644
--- a/src/main/java/me/lokka30/phantomworlds/commands/phantomworlds/sub/TeleportCommand.java
+++ b/src/main/java/me/lokka30/phantomworlds/commandsredux/sub/TeleportCommand.java
@@ -1,7 +1,7 @@
-package me.lokka30.phantomworlds.commands.phantomworlds.sub;
+package me.lokka30.phantomworlds.commandsredux.sub;
/*
* Phantom Worlds
- * Copyright (C) 2023 Daniel "creatorfromhell" Vidmar
+ * Copyright (C) 2023 - 2024 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
@@ -19,8 +19,8 @@
import me.lokka30.phantomworlds.misc.Utils;
import org.bukkit.World;
+import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
-import revxrsal.commands.bukkit.BukkitCommandActor;
/**
* TeleportCommand
@@ -30,10 +30,10 @@
*/
public class TeleportCommand {
- public static void onCommand(final BukkitCommandActor actor, final World world, final Player player) {
- if(!Utils.checkWorld(actor.getSender(), "command.phantomworlds.subcommands.teleport.usage", world)) {
+ public static void onCommand(final CommandSender sender, final World world, final Player player) {
+ if(!Utils.checkWorld(sender, "command.phantomworlds.subcommands.teleport.usage", world)) {
return;
}
- Utils.teleportToWorld(actor.getSender(), "teleport", "teleport", (player == null)? actor.getSender().getName() : player.getName(), world.getName());
+ Utils.teleportToWorld(sender, "teleport", "teleport", (player == null)? sender.getName() : player.getName(), world.getName());
}
}
\ No newline at end of file
diff --git a/src/main/java/me/lokka30/phantomworlds/commands/phantomworlds/sub/UnloadCommand.java b/src/main/java/me/lokka30/phantomworlds/commandsredux/sub/UnloadCommand.java
similarity index 79%
rename from src/main/java/me/lokka30/phantomworlds/commands/phantomworlds/sub/UnloadCommand.java
rename to src/main/java/me/lokka30/phantomworlds/commandsredux/sub/UnloadCommand.java
index 67df729..a1addf5 100644
--- a/src/main/java/me/lokka30/phantomworlds/commands/phantomworlds/sub/UnloadCommand.java
+++ b/src/main/java/me/lokka30/phantomworlds/commandsredux/sub/UnloadCommand.java
@@ -1,7 +1,7 @@
-package me.lokka30.phantomworlds.commands.phantomworlds.sub;
+package me.lokka30.phantomworlds.commandsredux.sub;
/*
* Phantom Worlds
- * Copyright (C) 2023 Daniel "creatorfromhell" Vidmar
+ * Copyright (C) 2023 - 2024 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
@@ -21,8 +21,8 @@
import me.lokka30.phantomworlds.PhantomWorlds;
import me.lokka30.phantomworlds.misc.Utils;
import org.bukkit.World;
+import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
-import revxrsal.commands.bukkit.BukkitCommandActor;
import java.util.Arrays;
@@ -34,14 +34,14 @@
*/
public class UnloadCommand {
- public static void onCommand(final BukkitCommandActor actor, final World world) {
- if(!Utils.checkWorld(actor.getSender(), "command.phantomworlds.subcommands.unload.usage", world)) {
+ public static void onCommand(final CommandSender sender, final World world) {
+ if(!Utils.checkWorld(sender, "command.phantomworlds.subcommands.unload.usage", world)) {
return;
}
- if(actor.getSender() instanceof Player) {
+ if(sender instanceof Player) {
- if(world.getPlayers().contains((Player)actor.getSender())) {
+ if(world.getPlayers().contains((Player)sender)) {
(new MultiMessage(
PhantomWorlds.instance().messages.getConfig().getStringList(
"command.phantomworlds.subcommands.unload.in-specified-world"),
@@ -49,7 +49,7 @@ public static void onCommand(final BukkitCommandActor actor, final World world)
new MultiMessage.Placeholder("prefix", PhantomWorlds.instance().messages.getConfig()
.getString("common.prefix", "&b&lPhantomWorlds: &7"), true),
new MultiMessage.Placeholder("world", world.getName(), false)
- ))).send(actor.getSender());
+ ))).send(sender);
return;
}
}
@@ -64,6 +64,6 @@ public static void onCommand(final BukkitCommandActor actor, final World world)
PhantomWorlds.instance().messages.getConfig().getString("common.prefix", "&b&lPhantomWorlds: &7"),
true),
new MultiMessage.Placeholder("world", world.getName(), false)
- ))).send(actor.getSender());
+ ))).send(sender);
}
}
\ No newline at end of file
diff --git a/src/main/java/me/lokka30/phantomworlds/commandsredux/sub/set/SetEffectsCommand.java b/src/main/java/me/lokka30/phantomworlds/commandsredux/sub/set/SetEffectsCommand.java
new file mode 100644
index 0000000..4d4f50e
--- /dev/null
+++ b/src/main/java/me/lokka30/phantomworlds/commandsredux/sub/set/SetEffectsCommand.java
@@ -0,0 +1,68 @@
+package me.lokka30.phantomworlds.commandsredux.sub.set;
+/*
+ * Phantom Worlds
+ * Copyright (C) 2023 - 2024 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.microlib.messaging.MultiMessage;
+import me.lokka30.phantomworlds.PhantomWorlds;
+import me.lokka30.phantomworlds.misc.Utils;
+import org.bukkit.World;
+import org.bukkit.command.CommandSender;
+import org.bukkit.entity.Player;
+
+import java.io.IOException;
+import java.util.Arrays;
+import java.util.List;
+
+/**
+ * SetEffectsCommand
+ *
+ * @author creatorfromhell
+ * @since 2.0.5.0
+ */
+public class SetEffectsCommand {
+ public static void onCommand(final CommandSender sender, final World world, final List effects) {
+ if(!Utils.checkWorld(sender, "command.phantomworlds.subcommands.seteffects.usage", world)) {
+ return;
+ }
+
+ final World finalWorld = (world == null)? ((Player)sender).getWorld() : world;
+
+ final String cfgPath = "worlds-to-load." + finalWorld.getName();
+ if(PhantomWorlds.instance().data.getConfig().contains(cfgPath)) {
+ //PhantomWorlds manages this world so let's set the spawn here for better accuracy.
+ PhantomWorlds.instance().data.getConfig().set(cfgPath + ".effects", String.join(", ", effects));
+
+ try {
+ PhantomWorlds.instance().data.save();
+ } catch(final IOException ex) {
+ throw new RuntimeException(ex);
+ }
+
+ }
+
+ (new MultiMessage(
+ PhantomWorlds.instance().messages.getConfig()
+ .getStringList("command.phantomworlds.subcommands.seteffects.success"), Arrays.asList(
+ new MultiMessage.Placeholder("prefix",
+ PhantomWorlds.instance().messages.getConfig().getString("common.prefix", "&b&lPhantomWorlds: &7"),
+ true),
+ new MultiMessage.Placeholder("world", finalWorld.getName(), false),
+ new MultiMessage.Placeholder("effects", effects.toString(), false)
+ ))).send(sender);
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/me/lokka30/phantomworlds/commandsredux/sub/set/SetGamemodeCommand.java b/src/main/java/me/lokka30/phantomworlds/commandsredux/sub/set/SetGamemodeCommand.java
new file mode 100644
index 0000000..fc99cb7
--- /dev/null
+++ b/src/main/java/me/lokka30/phantomworlds/commandsredux/sub/set/SetGamemodeCommand.java
@@ -0,0 +1,69 @@
+package me.lokka30.phantomworlds.commandsredux.sub.set;
+/*
+ * Phantom Worlds
+ * Copyright (C) 2023 - 2024 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.microlib.messaging.MultiMessage;
+import me.lokka30.phantomworlds.PhantomWorlds;
+import me.lokka30.phantomworlds.misc.Utils;
+import org.bukkit.GameMode;
+import org.bukkit.World;
+import org.bukkit.command.CommandSender;
+import org.bukkit.entity.Player;
+
+import java.io.IOException;
+import java.util.Arrays;
+
+/**
+ * SetGamemodeCommand
+ *
+ * @author creatorfromhell
+ * @since 2.0.5.0
+ */
+public class SetGamemodeCommand {
+
+ public static void onCommand(final CommandSender sender, final World world, final GameMode mode) {
+ if(!Utils.checkWorld(sender, "command.phantomworlds.subcommands.setgamemode.usage", world)) {
+ return;
+ }
+
+ final World finalWorld = (world == null)? ((Player)sender).getWorld() : world;
+
+ final String cfgPath = "worlds-to-load." + finalWorld.getName();
+ if(PhantomWorlds.instance().data.getConfig().contains(cfgPath)) {
+ //PhantomWorlds manages this world so let's set the spawn here for better accuracy.
+ PhantomWorlds.instance().data.getConfig().set(cfgPath + ".gameMode", mode.name());
+
+ try {
+ PhantomWorlds.instance().data.save();
+ } catch(final IOException ex) {
+ throw new RuntimeException(ex);
+ }
+
+ }
+
+ (new MultiMessage(
+ PhantomWorlds.instance().messages.getConfig()
+ .getStringList("command.phantomworlds.subcommands.setgamemode.success"), Arrays.asList(
+ new MultiMessage.Placeholder("prefix",
+ PhantomWorlds.instance().messages.getConfig().getString("common.prefix", "&b&lPhantomWorlds: &7"),
+ true),
+ new MultiMessage.Placeholder("world", finalWorld.getName(), false),
+ new MultiMessage.Placeholder("gamemode", mode.name(), false)
+ ))).send(sender);
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/me/lokka30/phantomworlds/commandsredux/sub/set/SetPortalCommand.java b/src/main/java/me/lokka30/phantomworlds/commandsredux/sub/set/SetPortalCommand.java
new file mode 100644
index 0000000..6dc0ef0
--- /dev/null
+++ b/src/main/java/me/lokka30/phantomworlds/commandsredux/sub/set/SetPortalCommand.java
@@ -0,0 +1,72 @@
+package me.lokka30.phantomworlds.commandsredux.sub.set;
+/*
+ * Phantom Worlds
+ * Copyright (C) 2023 - 2024 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.microlib.messaging.MultiMessage;
+import me.lokka30.phantomworlds.PhantomWorlds;
+import me.lokka30.phantomworlds.misc.Utils;
+import org.bukkit.PortalType;
+import org.bukkit.World;
+import org.bukkit.command.CommandSender;
+import org.bukkit.entity.Player;
+
+import java.io.IOException;
+import java.util.Arrays;
+
+/**
+ * SetPortalCommand
+ *
+ * @author creatorfromhell
+ * @since 2.0.5.0
+ */
+public class SetPortalCommand {
+
+ public static void onCommand(final CommandSender sender, final World world, final PortalType portal, final World worldTo) {
+ if(!Utils.checkWorld(sender, "command.phantomworlds.subcommands.setportal.usage", world)) {
+ return;
+ }
+
+ final String type = (portal.equals(PortalType.ENDER))? "end" : "nether";
+
+ final World finalWorld = (world == null)? ((Player)sender).getWorld() : world;
+
+ final String cfgPath = "worlds-to-load." + finalWorld.getName();
+ if(PhantomWorlds.instance().data.getConfig().contains(cfgPath)) {
+ //PhantomWorlds manages this world so let's set the spawn here for better accuracy.
+ PhantomWorlds.instance().data.getConfig().set(cfgPath + "." + type, worldTo.getName());
+
+ try {
+ PhantomWorlds.instance().data.save();
+ } catch(final IOException ex) {
+ throw new RuntimeException(ex);
+ }
+
+ }
+
+ (new MultiMessage(
+ PhantomWorlds.instance().messages.getConfig()
+ .getStringList("command.phantomworlds.subcommands.setportal.success"), Arrays.asList(
+ new MultiMessage.Placeholder("prefix",
+ PhantomWorlds.instance().messages.getConfig().getString("common.prefix", "&b&lPhantomWorlds: &7"),
+ true),
+ new MultiMessage.Placeholder("world", finalWorld.getName(), false),
+ new MultiMessage.Placeholder("portal", portal.name(), false),
+ new MultiMessage.Placeholder("world_to", worldTo.getName(), false)
+ ))).send(sender);
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/me/lokka30/phantomworlds/commandsredux/sub/set/SetWhitelistCommand.java b/src/main/java/me/lokka30/phantomworlds/commandsredux/sub/set/SetWhitelistCommand.java
new file mode 100644
index 0000000..4db93d5
--- /dev/null
+++ b/src/main/java/me/lokka30/phantomworlds/commandsredux/sub/set/SetWhitelistCommand.java
@@ -0,0 +1,68 @@
+package me.lokka30.phantomworlds.commandsredux.sub.set;
+/*
+ * Phantom Worlds
+ * Copyright (C) 2023 - 2024 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.microlib.messaging.MultiMessage;
+import me.lokka30.phantomworlds.PhantomWorlds;
+import me.lokka30.phantomworlds.misc.Utils;
+import org.bukkit.World;
+import org.bukkit.command.CommandSender;
+import org.bukkit.entity.Player;
+
+import java.io.IOException;
+import java.util.Arrays;
+
+/**
+ * SetWhitelistCommand
+ *
+ * @author creatorfromhell
+ * @since 2.0.5.0
+ */
+public class SetWhitelistCommand {
+
+ public static void onCommand(final CommandSender sender, final World world, final boolean whitelist) {
+ if(!Utils.checkWorld(sender, "command.phantomworlds.subcommands.setwhitelist.usage", world)) {
+ return;
+ }
+
+ final World finalWorld = (world == null)? ((Player)sender).getWorld() : world;
+
+ final String cfgPath = "worlds-to-load." + finalWorld.getName();
+ if(PhantomWorlds.instance().data.getConfig().contains(cfgPath)) {
+ //PhantomWorlds manages this world so let's set the spawn here for better accuracy.
+ PhantomWorlds.instance().data.getConfig().set(cfgPath + ".whitelist", whitelist);
+
+ try {
+ PhantomWorlds.instance().data.save();
+ } catch(final IOException ex) {
+ throw new RuntimeException(ex);
+ }
+
+ }
+
+ (new MultiMessage(
+ PhantomWorlds.instance().messages.getConfig()
+ .getStringList("command.phantomworlds.subcommands.setwhitelist.success"), Arrays.asList(
+ new MultiMessage.Placeholder("prefix",
+ PhantomWorlds.instance().messages.getConfig().getString("common.prefix", "&b&lPhantomWorlds: &7"),
+ true),
+ new MultiMessage.Placeholder("world", finalWorld.getName(), false),
+ new MultiMessage.Placeholder("whitelist", whitelist + "", false)
+ ))).send(sender);
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/me/lokka30/phantomworlds/commands/phantomworlds/utils/WorldFolder.java b/src/main/java/me/lokka30/phantomworlds/commandsredux/utils/WorldFolder.java
similarity index 89%
rename from src/main/java/me/lokka30/phantomworlds/commands/phantomworlds/utils/WorldFolder.java
rename to src/main/java/me/lokka30/phantomworlds/commandsredux/utils/WorldFolder.java
index 6de0436..476584d 100644
--- a/src/main/java/me/lokka30/phantomworlds/commands/phantomworlds/utils/WorldFolder.java
+++ b/src/main/java/me/lokka30/phantomworlds/commandsredux/utils/WorldFolder.java
@@ -1,7 +1,7 @@
-package me.lokka30.phantomworlds.commands.phantomworlds.utils;
+package me.lokka30.phantomworlds.commandsredux.utils;
/*
* Phantom Worlds
- * Copyright (C) 2023 Daniel "creatorfromhell" Vidmar
+ * Copyright (C) 2023 - 2024 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
diff --git a/src/main/java/me/lokka30/phantomworlds/listeners/player/PlayerChangeWorldListener.java b/src/main/java/me/lokka30/phantomworlds/listeners/player/PlayerChangeWorldListener.java
index 0f6b915..86726b3 100644
--- a/src/main/java/me/lokka30/phantomworlds/listeners/player/PlayerChangeWorldListener.java
+++ b/src/main/java/me/lokka30/phantomworlds/listeners/player/PlayerChangeWorldListener.java
@@ -1,7 +1,7 @@
package me.lokka30.phantomworlds.listeners.player;
/*
* Phantom Worlds
- * Copyright (C) 2023 Daniel "creatorfromhell" Vidmar
+ * Copyright (C) 2023 - 2024 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
diff --git a/src/main/java/me/lokka30/phantomworlds/listeners/player/PlayerDeathListener.java b/src/main/java/me/lokka30/phantomworlds/listeners/player/PlayerDeathListener.java
index b01af1e..4cdfe75 100644
--- a/src/main/java/me/lokka30/phantomworlds/listeners/player/PlayerDeathListener.java
+++ b/src/main/java/me/lokka30/phantomworlds/listeners/player/PlayerDeathListener.java
@@ -1,7 +1,7 @@
package me.lokka30.phantomworlds.listeners.player;
/*
* Phantom Worlds
- * Copyright (C) 2023 Daniel "creatorfromhell" Vidmar
+ * Copyright (C) 2023 - 2024 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
diff --git a/src/main/java/me/lokka30/phantomworlds/listeners/player/PlayerJoinListener.java b/src/main/java/me/lokka30/phantomworlds/listeners/player/PlayerJoinListener.java
index 0288645..00ded8b 100644
--- a/src/main/java/me/lokka30/phantomworlds/listeners/player/PlayerJoinListener.java
+++ b/src/main/java/me/lokka30/phantomworlds/listeners/player/PlayerJoinListener.java
@@ -1,7 +1,7 @@
package me.lokka30.phantomworlds.listeners.player;
/*
* Phantom Worlds
- * Copyright (C) 2023 Daniel "creatorfromhell" Vidmar
+ * Copyright (C) 2023 - 2024 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
diff --git a/src/main/java/me/lokka30/phantomworlds/listeners/player/PlayerPortalListener.java b/src/main/java/me/lokka30/phantomworlds/listeners/player/PlayerPortalListener.java
index 18944e0..c7c54d9 100644
--- a/src/main/java/me/lokka30/phantomworlds/listeners/player/PlayerPortalListener.java
+++ b/src/main/java/me/lokka30/phantomworlds/listeners/player/PlayerPortalListener.java
@@ -1,7 +1,7 @@
package me.lokka30.phantomworlds.listeners.player;
/*
* Phantom Worlds
- * Copyright (C) 2023 Daniel "creatorfromhell" Vidmar
+ * Copyright (C) 2023 - 2024 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
diff --git a/src/main/java/me/lokka30/phantomworlds/listeners/player/PlayerTeleportListener.java b/src/main/java/me/lokka30/phantomworlds/listeners/player/PlayerTeleportListener.java
index 30661b6..10e96c8 100644
--- a/src/main/java/me/lokka30/phantomworlds/listeners/player/PlayerTeleportListener.java
+++ b/src/main/java/me/lokka30/phantomworlds/listeners/player/PlayerTeleportListener.java
@@ -1,7 +1,7 @@
package me.lokka30.phantomworlds.listeners.player;
/*
* Phantom Worlds
- * Copyright (C) 2023 Daniel "creatorfromhell" Vidmar
+ * Copyright (C) 2023 - 2024 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
diff --git a/src/main/java/me/lokka30/phantomworlds/listeners/world/WorldInitListener.java b/src/main/java/me/lokka30/phantomworlds/listeners/world/WorldInitListener.java
index 9ef2002..deb7c44 100644
--- a/src/main/java/me/lokka30/phantomworlds/listeners/world/WorldInitListener.java
+++ b/src/main/java/me/lokka30/phantomworlds/listeners/world/WorldInitListener.java
@@ -1,7 +1,7 @@
package me.lokka30.phantomworlds.listeners.world;
/*
* Phantom Worlds
- * Copyright (C) 2023 Daniel "creatorfromhell" Vidmar
+ * Copyright (C) 2023 - 2024 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
diff --git a/src/main/java/me/lokka30/phantomworlds/managers/FileManager.java b/src/main/java/me/lokka30/phantomworlds/managers/FileManager.java
index 8a9ff86..d27ea5e 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(7),
+ MESSAGES(8),
DATA(2);
public final int latestFileVersion; // If == -1: 'do not migrate me!'
diff --git a/src/main/java/me/lokka30/phantomworlds/misc/WorldLoadResponse.java b/src/main/java/me/lokka30/phantomworlds/misc/WorldLoadResponse.java
index 948a524..a5a9954 100644
--- a/src/main/java/me/lokka30/phantomworlds/misc/WorldLoadResponse.java
+++ b/src/main/java/me/lokka30/phantomworlds/misc/WorldLoadResponse.java
@@ -1,7 +1,7 @@
package me.lokka30.phantomworlds.misc;
/*
* Phantom Worlds
- * Copyright (C) 2023 Daniel "creatorfromhell" Vidmar
+ * Copyright (C) 2023 - 2024 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
diff --git a/src/main/java/me/lokka30/phantomworlds/scheduler/BackupScheduler.java b/src/main/java/me/lokka30/phantomworlds/scheduler/BackupScheduler.java
index 53948a4..22548f8 100644
--- a/src/main/java/me/lokka30/phantomworlds/scheduler/BackupScheduler.java
+++ b/src/main/java/me/lokka30/phantomworlds/scheduler/BackupScheduler.java
@@ -1,7 +1,7 @@
package me.lokka30.phantomworlds.scheduler;
/*
* Phantom Worlds
- * Copyright (C) 2023 Daniel "creatorfromhell" Vidmar
+ * Copyright (C) 2023 - 2024 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
diff --git a/src/main/java/me/lokka30/phantomworlds/world/PhantomWorld.java b/src/main/java/me/lokka30/phantomworlds/world/PhantomWorld.java
index 603ee17..2221412 100644
--- a/src/main/java/me/lokka30/phantomworlds/world/PhantomWorld.java
+++ b/src/main/java/me/lokka30/phantomworlds/world/PhantomWorld.java
@@ -1,7 +1,7 @@
package me.lokka30.phantomworlds.world;
/*
* Phantom Worlds
- * Copyright (C) 2023 Daniel "creatorfromhell" Vidmar
+ * Copyright (C) 2023 - 2024 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
diff --git a/src/main/resources/messages.yml b/src/main/resources/messages.yml
index 4e137cb..e7cfd76 100644
--- a/src/main/resources/messages.yml
+++ b/src/main/resources/messages.yml
@@ -23,6 +23,10 @@ command:
- '&8 &m->&b /%label% list &8- &7list loaded worlds'
- '&8 &m->&b /%label% teleport &8- &7teleport to a loaded world''s spawnpoint'
- '&8 &m->&b /%label% spawn [player] &8- &7teleport to the spawn of the current world'
+ - '&8 &m->&b /%label% set effects [effects] &8- &7set the potion effects to be applied to players in this world.'
+ - '&8 &m->&b /%label% set gamemode &8- &7set the gamemode for this world.'
+ - '&8 &m->&b /%label% set portal &8- &7set where the specified portal type takes players in this world.'
+ - '&8 &m->&b /%label% set whitelist &8- &7set whether there is a whitelist for this world or not.'
- '&8 &m->&b /%label% setspawn &8- &7set the spawnpoint of a world'
- '&8 &m->&b /%label% delete &8- &7delete a world'
- '&8 &m->&b /%label% backup &8- &backup a world'
@@ -41,6 +45,10 @@ command:
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.'
+ seteffects: '&b/pw set effects [effects] &8- &7set the potion effects to be applied to players in this world.'
+ setgamemode: '&b/pw set gamemode &8- &7set the gamemode for this world.'
+ setportal: '&b/pw set portal &8- &7set where the specified portal type takes players in this world.'
+ setwhitelist: '&b/pw set whitelist &8- &7set whether there is a whitelist for this world or not.'
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- &7backup a world'
@@ -231,6 +239,38 @@ command:
reload-complete:
- '%prefix% Reload complete.'
+ seteffects:
+
+ usage:
+ - '%prefix% Invalid usage, try ''&b/%label% set effects [effects] &8- &7''.'
+
+ success:
+ - '%prefix% Successfully set the potion effects of world ''&b%world%&7'' to ''&b%effects%&7''.'
+
+ setgamemode:
+
+ usage:
+ - '%prefix% Invalid usage, try ''&b/%label% set gamemode &8- &7''.'
+
+ success:
+ - '%prefix% Successfully set the gamemode of world ''&b%world%&7'' to ''&b%gamemode%&7''.'
+
+ setportal:
+
+ usage:
+ - '%prefix% Invalid usage, try ''&b/%label% set portal &8- &7''.'
+
+ success:
+ - '%prefix% Successfully set the portal destination for portal ''&b%portal%&7'' of world ''&b%world%&7'' to world ''&b%world_to%&7''.'
+
+ setwhitelist:
+
+ usage:
+ - '%prefix% Invalid usage, try ''&b/%label% set whitelist &8- &7''.'
+
+ success:
+ - '%prefix% Successfully set whitelist of world ''&b%world%&7'' to ''&b%whitelist%&7''.'
+
setspawn:
usage:
@@ -306,5 +346,5 @@ command:
# Do not touch anything here unless you know what you are doing.
advanced:
- file-version: 7
+ file-version: 8
generated-with: '${project.version}'
\ No newline at end of file