Add remove command.

This commit is contained in:
benwoo1110 2020-12-17 00:21:18 +08:00
parent 5483988276
commit d494017186
2 changed files with 38 additions and 0 deletions

View File

@ -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));
}
/**

View File

@ -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("<world>")
@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);
}
}