i18n: Import command

This commit is contained in:
Lildirt 2023-03-01 11:24:31 -05:00
parent 9e5fb2cf4b
commit 38002261b7
3 changed files with 23 additions and 7 deletions

View File

@ -13,10 +13,12 @@ import co.aikar.commands.annotation.Optional;
import co.aikar.commands.annotation.Subcommand;
import co.aikar.commands.annotation.Syntax;
import com.onarandombox.MultiverseCore.MultiverseCore;
import com.onarandombox.MultiverseCore.api.MVCore;
import com.onarandombox.MultiverseCore.commandtools.flags.CommandFlag;
import com.onarandombox.MultiverseCore.commandtools.flags.CommandFlagGroup;
import com.onarandombox.MultiverseCore.commandtools.flags.CommandValueFlag;
import com.onarandombox.MultiverseCore.commandtools.flags.ParsedCommandFlags;
import com.onarandombox.MultiverseCore.utils.MVCorei18n;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.World;
@ -51,26 +53,27 @@ public class ImportCommand extends MultiverseCoreCommand {
@CommandPermission("multiverse.core.import")
@CommandCompletion("@mvworlds:scope=potential @flags:groupName=mvimport")
@Syntax("<name> <env> --generator [generator[:id]] --adjust-spawn")
@Description("Imports a existing world folder.")
@Description("{@@mv-core.import.description")
public void onImportCommand(BukkitCommandIssuer issuer,
@Conditions("validWorldName:scope=new")
@Syntax("<name>")
@Description("Name of the world folder.")
@Description("{@@mv-core.import.name.description}")
String worldName,
@Syntax("<env>")
@Description("The world's environment. See: /mv env")
@Description("{@@mv-core.import.env.description}")
World.Environment environment,
@Optional
@Syntax("--generator [generator[:id]] --adjust-spawn")
@Description("Other world settings. See: https://gg.gg/nn8c2")
@Description("{@@mv-core.import.other.description}")
String[] flags) {
ParsedCommandFlags parsedFlags = parseFlags(flags);
issuer.sendMessage(String.format("Starting import of world '%s'...", worldName));
issuer.sendInfo(MVCorei18n.IMPORT_IMPORTING,
"{world}", worldName);
if (!this.worldManager.addWorld(
worldName, environment,
@ -80,9 +83,9 @@ public class ImportCommand extends MultiverseCoreCommand {
parsedFlags.flagValue("--generator", String.class),
parsedFlags.hasFlag("--adjust-spawn"))
) {
issuer.sendMessage(String.format("%sFailed! See console for more details.", ChatColor.RED));
issuer.sendInfo(MVCorei18n.IMPORT_FAILED);
return;
}
issuer.sendMessage(String.format("%sComplete!", ChatColor.GREEN));
issuer.sendInfo(MVCorei18n.IMPORT_SUCCESS);
}
}

View File

@ -34,6 +34,11 @@ public enum MVCorei18n implements MessageKeyProvider {
GAMERULE_FAILED,
GAMERULE_SUCCESS_SINGLE,
GAMERULE_SUCCESS_MULTIPLE,
// import command
IMPORT_IMPORTING,
IMPORT_FAILED,
IMPORT_SUCCESS,
DEBUG_INFO_OFF,
DEBUG_INFO_ON;

View File

@ -39,6 +39,14 @@ mv-core.gamerule.world.description=World to apply gamerule to, current world by
mv-core.gamerule.failed=Failed to set gamerule {gamerule} to {value} in {world}. It should be a {type}.
mv-core.gamerule.success.single=Successfully set {gamerule} to {value} in {world}.
mv-core.gamerule.success.multiple=Successfully set {gamerule} to {value} in {count} worlds.
mv-core.import.description=Imports an existing world folder.
mv-core.import.name.description=Name of the world folder.
mv-core.import.env.description=The world's environment. See: /mv env
mv-core.import.other.description=Other world settings. See: https://gg.gg/nn8c2
mv-core.import.importing=Starting import of world '{world}'...
mv-core.import.failed=Failed! See console for more details.
mv-core.import.success=Complete!
mv-core.debug.info.description=Show the current debug level.
mv-core.debug.info.off=&fMultiverse Debug mode is &cOFF&f.
mv-core.debug.info.on=&fMultiverse Debug mode is at &alevel {level}&f.