i18n: Delete command

This commit is contained in:
Lildirt 2023-03-01 11:23:27 -05:00
parent 5e4e925bb1
commit fa0e9f4268
3 changed files with 20 additions and 5 deletions

View File

@ -10,7 +10,9 @@ import co.aikar.commands.annotation.Single;
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.queue.QueuedCommand;
import com.onarandombox.MultiverseCore.utils.MVCorei18n;
import org.bukkit.ChatColor;
import org.jetbrains.annotations.NotNull;
@ -24,7 +26,7 @@ public class DeleteCommand extends MultiverseCoreCommand {
@CommandPermission("multiverse.core.delete")
@CommandCompletion("@mvworlds:scope=both")
@Syntax("<world>")
@Description("Deletes a world on your server PERMANENTLY.")
@Description("{@@mv-core.delete.description}")
public void onDeleteCommand(BukkitCommandIssuer issuer,
@Single
@ -36,14 +38,17 @@ public class DeleteCommand extends MultiverseCoreCommand {
this.plugin.getMVCommandManager().getCommandQueueManager().addToQueue(new QueuedCommand(
issuer.getIssuer(),
() -> {
issuer.sendMessage(String.format("Deleting world '%s'...", worldName));
issuer.sendInfo(MVCorei18n.DELETE_DELETING,
"{world}", worldName);
if (!this.plugin.getMVWorldManager().deleteWorld(worldName)) {
issuer.sendMessage(String.format("%sThere was an issue deleting '%s'! Please check console for errors.", ChatColor.RED, worldName));
issuer.sendInfo(MVCorei18n.DELETE_FAILED,
"{world}", worldName);
return;
}
issuer.sendMessage(String.format("%sWorld %s was deleted!", ChatColor.GREEN, worldName));
issuer.sendInfo(MVCorei18n.DELETE_SUCCESS,
"{world}", worldName);
},
"Are you sure you want to delete world '" + worldName + "'?"
"{@@mv-core.delete.prompt}".replace("{world}", worldName)
));
}
}

View File

@ -24,6 +24,11 @@ public enum MVCorei18n implements MessageKeyProvider {
CREATE_FAILED,
CREATE_SUCCESS,
// delete command
DELETE_DELETING,
DELETE_FAILED,
DELETE_SUCCESS,
DELETE_PROMPT,
DEBUG_INFO_OFF,
DEBUG_INFO_ON;

View File

@ -26,6 +26,11 @@ mv-core.create.loading=Creating world...
mv-core.create.failed=&cFailed to create world '{worldName}'! See console for details.
mv-core.create.success=&aWorld '{worldName}' created successfully!
mv-core.delete.description=Deletes a world on your server PERMANENTLY.
mv-core.delete.deleting=Deleting world '{world}'...
mv-core.delete.failed=There was an issue deleting '{world}'! Please check console for errors.
mv-core.delete.success=World {world} was deleted!
mv-core.delete.prompt=Are you sure you want to delete world '{world}'?
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.