diff --git a/src/main/java/com/onarandombox/MultiverseCore/MultiverseCore.java b/src/main/java/com/onarandombox/MultiverseCore/MultiverseCore.java index bb5c29af..6784666e 100644 --- a/src/main/java/com/onarandombox/MultiverseCore/MultiverseCore.java +++ b/src/main/java/com/onarandombox/MultiverseCore/MultiverseCore.java @@ -35,6 +35,7 @@ import com.onarandombox.MultiverseCore.api.SafeTTeleporter; import com.onarandombox.MultiverseCore.commands_acf.CoordCommand; import com.onarandombox.MultiverseCore.commands_acf.CreateCommand; import com.onarandombox.MultiverseCore.commands_acf.ReloadCommand; +import com.onarandombox.MultiverseCore.commands_acf.RemoveCommand; import com.onarandombox.MultiverseCore.commands_acf.SpawnCommand; import com.onarandombox.MultiverseCore.commands_acf.UsageCommand; import com.onarandombox.MultiverseCore.commands_helper.CommandTools; @@ -738,6 +739,7 @@ public class MultiverseCore extends JavaPlugin implements MVPlugin, Core { this.commandHandler.registerCommand(new CoordCommand(this)); this.commandHandler.registerCommand(new SpawnCommand(this)); this.commandHandler.registerCommand(new ReloadCommand(this)); + this.commandHandler.registerCommand(new RemoveCommand(this)); } /** diff --git a/src/main/java/com/onarandombox/MultiverseCore/commands_acf/RemoveCommand.java b/src/main/java/com/onarandombox/MultiverseCore/commands_acf/RemoveCommand.java new file mode 100644 index 00000000..ac30eab2 --- /dev/null +++ b/src/main/java/com/onarandombox/MultiverseCore/commands_acf/RemoveCommand.java @@ -0,0 +1,36 @@ +package com.onarandombox.MultiverseCore.commands_acf; + +import co.aikar.commands.annotation.CommandAlias; +import co.aikar.commands.annotation.CommandCompletion; +import co.aikar.commands.annotation.CommandPermission; +import co.aikar.commands.annotation.Description; +import co.aikar.commands.annotation.Flags; +import co.aikar.commands.annotation.Subcommand; +import co.aikar.commands.annotation.Syntax; +import com.onarandombox.MultiverseCore.MultiverseCore; +import com.onarandombox.MultiverseCore.api.MultiverseWorld; +import org.bukkit.command.CommandSender; +import org.jetbrains.annotations.NotNull; + +@CommandAlias("mv") +public class RemoveCommand extends MultiverseCommand { + + public RemoveCommand(MultiverseCore plugin) { + super(plugin); + } + + @Subcommand("remove") + @CommandPermission("multiverse.core.spawn.other") + @CommandCompletion("@MVWorlds|@unloadedWorlds") + @Syntax("") + @Description("Unloads a world from Multiverse and removes it from worlds.yml, this does NOT DELETE the world folder.") + public void onRemoveCommand(@NotNull CommandSender sender, + @NotNull @Flags("other") MultiverseWorld world) { + + String resultMessage = (this.plugin.getMVWorldManager().removeWorldFromConfig(world.getName())) + ? "World removed from config!" + : "Error trying to remove world from config!"; + + sender.sendMessage(resultMessage); + } +}