mirror of
https://github.com/Multiverse/Multiverse-Core.git
synced 2024-11-26 12:35:39 +01:00
Merge pull request #2983 from Multiverse/conditions-id
Fix command conditions not registering and lowercased
This commit is contained in:
commit
3800513dc5
@ -36,13 +36,13 @@ public class CloneCommand extends MultiverseCommand {
|
||||
@Description("{@@mv-core.clone.description}")
|
||||
public void onCloneCommand(CommandIssuer issuer,
|
||||
|
||||
@Conditions("validWorldName:scope=both")
|
||||
@Conditions("worldname:scope=both")
|
||||
@Syntax("<world>")
|
||||
@Description("{@@mv-core.clone.world.description}")
|
||||
String worldName,
|
||||
|
||||
@Single
|
||||
@Conditions("validWorldName:scope=new")
|
||||
@Conditions("worldname:scope=new")
|
||||
@Syntax("<new world name>")
|
||||
@Description("{@@mv-core.clone.newWorld.description}")
|
||||
String newWorldName
|
||||
|
@ -100,7 +100,7 @@ public class CreateCommand extends MultiverseCommand {
|
||||
@Description("{@@mv-core.create.description}")
|
||||
public void onCreateCommand(BukkitCommandIssuer issuer,
|
||||
|
||||
@Conditions("validWorldName:scope=new")
|
||||
@Conditions("worldname:scope=new")
|
||||
@Syntax("<name>")
|
||||
@Description("{@@mv-core.create.name.description}")
|
||||
String worldName,
|
||||
|
@ -39,7 +39,7 @@ public class DeleteCommand extends MultiverseCommand {
|
||||
public void onDeleteCommand(BukkitCommandIssuer issuer,
|
||||
|
||||
@Single
|
||||
@Conditions("validWorldName:scope=both")
|
||||
@Conditions("worldname:scope=both")
|
||||
@Syntax("<world>")
|
||||
@Description("The world you want to delete.")
|
||||
String worldName
|
||||
|
@ -69,7 +69,7 @@ public class ImportCommand extends MultiverseCommand {
|
||||
@Description("{@@mv-core.import.description")
|
||||
public void onImportCommand(BukkitCommandIssuer issuer,
|
||||
|
||||
@Conditions("validWorldName:scope=new")
|
||||
@Conditions("worldname:scope=new")
|
||||
@Syntax("<name>")
|
||||
@Description("{@@mv-core.import.name.description}")
|
||||
String worldName,
|
||||
|
@ -37,7 +37,7 @@ public class LoadCommand extends MultiverseCommand {
|
||||
public void onLoadCommand(BukkitCommandIssuer issuer,
|
||||
|
||||
@Single
|
||||
@Conditions("validWorldName:scope=unloaded")
|
||||
@Conditions("worldname:scope=unloaded")
|
||||
@Syntax("<world>")
|
||||
@Description("{@@mv-core.load.world.description}")
|
||||
String worldName
|
||||
|
@ -56,7 +56,7 @@ public class RegenCommand extends MultiverseCommand {
|
||||
@Description("{@@mv-core.regen.description}")
|
||||
public void onRegenCommand(BukkitCommandIssuer issuer,
|
||||
|
||||
@Conditions("validWorldName:scope=both")
|
||||
@Conditions("worldname:scope=both")
|
||||
@Syntax("<world>")
|
||||
@Description("{@@mv-core.regen.world.description}")
|
||||
String worldName,
|
||||
|
@ -8,7 +8,6 @@ import co.aikar.commands.ConditionContext;
|
||||
import co.aikar.commands.ConditionFailedException;
|
||||
import com.onarandombox.MultiverseCore.api.MVWorldManager;
|
||||
import com.onarandombox.MultiverseCore.world.WorldNameChecker;
|
||||
import jakarta.annotation.PostConstruct;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class MVCommandConditions {
|
||||
@ -22,19 +21,19 @@ public class MVCommandConditions {
|
||||
private MVCommandConditions(@NotNull MVCommandManager commandManager, @NotNull MVWorldManager worldManager) {
|
||||
this.worldManager = worldManager;
|
||||
this.commandManager = commandManager;
|
||||
registerConditions();
|
||||
}
|
||||
|
||||
@PostConstruct
|
||||
private void registerConditions() {
|
||||
CommandConditions<BukkitCommandIssuer, BukkitCommandExecutionContext, BukkitConditionContext> conditions
|
||||
= commandManager.getCommandConditions();
|
||||
|
||||
conditions.addCondition(String.class, "validWorldName", this::checkValidWorldName);
|
||||
conditions.addCondition(String.class, "worldname", this::checkWorldname);
|
||||
}
|
||||
|
||||
private void checkValidWorldName(ConditionContext<BukkitCommandIssuer> context,
|
||||
BukkitCommandExecutionContext executionContext,
|
||||
String worldName
|
||||
private void checkWorldname(ConditionContext<BukkitCommandIssuer> context,
|
||||
BukkitCommandExecutionContext executionContext,
|
||||
String worldName
|
||||
) {
|
||||
String scope = context.getConfigValue("scope", "loaded");
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user