mirror of
https://github.com/Multiverse/Multiverse-Core.git
synced 2024-11-15 23:26:18 +01:00
refactor: Make world name condition check id clearer
This commit is contained in:
parent
1f907d93af
commit
16096acc34
@ -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
|
||||
|
@ -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,
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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,
|
||||
|
@ -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");
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user