refactor: Make world name condition check id clearer

This commit is contained in:
Ben Woo 2023-02-09 17:09:28 +08:00
parent 1f907d93af
commit 16096acc34
6 changed files with 10 additions and 10 deletions

View File

@ -26,13 +26,13 @@ public class CloneCommand extends MultiverseCommand {
@Description("Clones a world.")
public void onCloneCommand(CommandIssuer issuer,
@Conditions("worldname:scope=both")
@Conditions("validWorldName:scope=both")
@Syntax("<world>")
@Description("The target world to clone.")
String worldName,
@Single
@Conditions("worldname:scope=new")
@Conditions("validWorldName:scope=new")
@Syntax("<new world name>")
@Description("The new cloned world name.")
String newWorldName

View File

@ -84,7 +84,7 @@ public class CreateCommand extends MultiverseCommand {
@Description("{@@mv-core.create_description}")
public void onCreateCommand(BukkitCommandIssuer issuer,
@Conditions("worldname:scope=new")
@Conditions("validWorldName:scope=new")
@Syntax("<name>")
@Description("{@@mv-core.create_name_description}")
String worldName,

View File

@ -28,7 +28,7 @@ public class DeleteCommand extends MultiverseCommand {
public void onDeleteCommand(BukkitCommandIssuer issuer,
@Single
@Conditions("worldname:scope=both")
@Conditions("validWorldName:scope=both")
@Syntax("<world>")
@Description("The world you want to delete.")
String worldName

View File

@ -26,7 +26,7 @@ public class LoadCommand extends MultiverseCommand {
public void onLoadCommand(BukkitCommandIssuer issuer,
@Single
@Conditions("worldname:scope=unloaded")
@Conditions("validWorldName:scope=unloaded")
@Syntax("<world>")
@Description("Name of world you want to load.")
String worldName

View File

@ -45,7 +45,7 @@ public class RegenCommand extends MultiverseCommand {
@Description("Regenerates a world on your server. The previous state will be lost PERMANENTLY.")
public void onRegenCommand(BukkitCommandIssuer issuer,
@Conditions("worldname:scope=both")
@Conditions("validWorldName:scope=both")
@Syntax("<world>")
@Description("World that you want to regen.")
String worldName,

View File

@ -24,12 +24,12 @@ public class MVCommandConditions {
CommandConditions<BukkitCommandIssuer, BukkitCommandExecutionContext, BukkitConditionContext> conditions
= commandManager.getCommandConditions();
conditions.addCondition(String.class, "worldname", this::checkWorldName);
conditions.addCondition(String.class, "validWorldName", this::checkValidWorldName);
}
private void checkWorldName(ConditionContext<BukkitCommandIssuer> context,
BukkitCommandExecutionContext executionContext,
String worldName
private void checkValidWorldName(ConditionContext<BukkitCommandIssuer> context,
BukkitCommandExecutionContext executionContext,
String worldName
) {
String scope = context.getConfigValue("scope", "loaded");