i18n: Load command

This commit is contained in:
Lildirt 2023-03-01 11:24:48 -05:00
parent 38002261b7
commit 8b450910ba
3 changed files with 20 additions and 5 deletions

View File

@ -10,6 +10,7 @@ import co.aikar.commands.annotation.Single;
import co.aikar.commands.annotation.Subcommand; import co.aikar.commands.annotation.Subcommand;
import co.aikar.commands.annotation.Syntax; import co.aikar.commands.annotation.Syntax;
import com.onarandombox.MultiverseCore.MultiverseCore; import com.onarandombox.MultiverseCore.MultiverseCore;
import com.onarandombox.MultiverseCore.utils.MVCorei18n;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
@CommandAlias("mv") @CommandAlias("mv")
@ -22,21 +23,24 @@ public class LoadCommand extends MultiverseCoreCommand {
@CommandPermission("multiverse.core.load") @CommandPermission("multiverse.core.load")
@CommandCompletion("@mvworlds:scope=unloaded") @CommandCompletion("@mvworlds:scope=unloaded")
@Syntax("<world>") @Syntax("<world>")
@Description("Loads a world. World must be already in worlds.yml, else please use /mv import.") @Description("{@@mv-core.load.description}")
public void onLoadCommand(BukkitCommandIssuer issuer, public void onLoadCommand(BukkitCommandIssuer issuer,
@Single @Single
@Conditions("validWorldName:scope=unloaded") @Conditions("validWorldName:scope=unloaded")
@Syntax("<world>") @Syntax("<world>")
@Description("Name of world you want to load.") @Description("{@@mv-core.load.world.description}")
String worldName String worldName
) { ) {
issuer.sendMessage(String.format("Loading world '%s'...", worldName)); issuer.sendInfo(MVCorei18n.LOAD_LOADING,
"{world}", worldName);
if (!this.plugin.getMVWorldManager().loadWorld(worldName)) { if (!this.plugin.getMVWorldManager().loadWorld(worldName)) {
issuer.sendMessage(String.format("Error trying to load world '%s'!", worldName)); issuer.sendInfo(MVCorei18n.LOAD_FAILED,
"{world}", worldName);
return; return;
} }
issuer.sendMessage(String.format("Loaded world '%s'!", worldName)); issuer.sendInfo(MVCorei18n.LOAD_SUCCESS,
"{world}", worldName);
} }
} }

View File

@ -39,6 +39,11 @@ public enum MVCorei18n implements MessageKeyProvider {
IMPORT_IMPORTING, IMPORT_IMPORTING,
IMPORT_FAILED, IMPORT_FAILED,
IMPORT_SUCCESS, IMPORT_SUCCESS,
// load command
LOAD_LOADING,
LOAD_FAILED,
LOAD_SUCCESS,
DEBUG_INFO_OFF, DEBUG_INFO_OFF,
DEBUG_INFO_ON; DEBUG_INFO_ON;

View File

@ -47,6 +47,12 @@ 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.importing=Starting import of world '{world}'...
mv-core.import.failed=Failed! See console for more details. mv-core.import.failed=Failed! See console for more details.
mv-core.import.success=Complete! mv-core.import.success=Complete!
mv-core.load.description=Loads a world. World must be already in worlds.yml, else please use /mv import.
mv-core.load.world.description=Name of world you want to load.
mv-core.load.loading=Loading world '{world}'...
mv-core.load.failed=Error trying to load world '{world}'!
mv-core.load.success=Loaded world '{world}'!
mv-core.debug.info.description=Show the current debug level. 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.off=&fMultiverse Debug mode is &cOFF&f.
mv-core.debug.info.on=&fMultiverse Debug mode is at &alevel {level}&f. mv-core.debug.info.on=&fMultiverse Debug mode is at &alevel {level}&f.