mirror of
https://github.com/Multiverse/Multiverse-Core.git
synced 2025-02-27 18:02:37 +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}")
|
@Description("{@@mv-core.clone.description}")
|
||||||
public void onCloneCommand(CommandIssuer issuer,
|
public void onCloneCommand(CommandIssuer issuer,
|
||||||
|
|
||||||
@Conditions("validWorldName:scope=both")
|
@Conditions("worldname:scope=both")
|
||||||
@Syntax("<world>")
|
@Syntax("<world>")
|
||||||
@Description("{@@mv-core.clone.world.description}")
|
@Description("{@@mv-core.clone.world.description}")
|
||||||
String worldName,
|
String worldName,
|
||||||
|
|
||||||
@Single
|
@Single
|
||||||
@Conditions("validWorldName:scope=new")
|
@Conditions("worldname:scope=new")
|
||||||
@Syntax("<new world name>")
|
@Syntax("<new world name>")
|
||||||
@Description("{@@mv-core.clone.newWorld.description}")
|
@Description("{@@mv-core.clone.newWorld.description}")
|
||||||
String newWorldName
|
String newWorldName
|
||||||
|
@ -100,7 +100,7 @@ public class CreateCommand extends MultiverseCommand {
|
|||||||
@Description("{@@mv-core.create.description}")
|
@Description("{@@mv-core.create.description}")
|
||||||
public void onCreateCommand(BukkitCommandIssuer issuer,
|
public void onCreateCommand(BukkitCommandIssuer issuer,
|
||||||
|
|
||||||
@Conditions("validWorldName:scope=new")
|
@Conditions("worldname:scope=new")
|
||||||
@Syntax("<name>")
|
@Syntax("<name>")
|
||||||
@Description("{@@mv-core.create.name.description}")
|
@Description("{@@mv-core.create.name.description}")
|
||||||
String worldName,
|
String worldName,
|
||||||
|
@ -39,7 +39,7 @@ public class DeleteCommand extends MultiverseCommand {
|
|||||||
public void onDeleteCommand(BukkitCommandIssuer issuer,
|
public void onDeleteCommand(BukkitCommandIssuer issuer,
|
||||||
|
|
||||||
@Single
|
@Single
|
||||||
@Conditions("validWorldName:scope=both")
|
@Conditions("worldname:scope=both")
|
||||||
@Syntax("<world>")
|
@Syntax("<world>")
|
||||||
@Description("The world you want to delete.")
|
@Description("The world you want to delete.")
|
||||||
String worldName
|
String worldName
|
||||||
|
@ -69,7 +69,7 @@ public class ImportCommand extends MultiverseCommand {
|
|||||||
@Description("{@@mv-core.import.description")
|
@Description("{@@mv-core.import.description")
|
||||||
public void onImportCommand(BukkitCommandIssuer issuer,
|
public void onImportCommand(BukkitCommandIssuer issuer,
|
||||||
|
|
||||||
@Conditions("validWorldName:scope=new")
|
@Conditions("worldname:scope=new")
|
||||||
@Syntax("<name>")
|
@Syntax("<name>")
|
||||||
@Description("{@@mv-core.import.name.description}")
|
@Description("{@@mv-core.import.name.description}")
|
||||||
String worldName,
|
String worldName,
|
||||||
|
@ -37,7 +37,7 @@ public class LoadCommand extends MultiverseCommand {
|
|||||||
public void onLoadCommand(BukkitCommandIssuer issuer,
|
public void onLoadCommand(BukkitCommandIssuer issuer,
|
||||||
|
|
||||||
@Single
|
@Single
|
||||||
@Conditions("validWorldName:scope=unloaded")
|
@Conditions("worldname:scope=unloaded")
|
||||||
@Syntax("<world>")
|
@Syntax("<world>")
|
||||||
@Description("{@@mv-core.load.world.description}")
|
@Description("{@@mv-core.load.world.description}")
|
||||||
String worldName
|
String worldName
|
||||||
|
@ -56,7 +56,7 @@ public class RegenCommand extends MultiverseCommand {
|
|||||||
@Description("{@@mv-core.regen.description}")
|
@Description("{@@mv-core.regen.description}")
|
||||||
public void onRegenCommand(BukkitCommandIssuer issuer,
|
public void onRegenCommand(BukkitCommandIssuer issuer,
|
||||||
|
|
||||||
@Conditions("validWorldName:scope=both")
|
@Conditions("worldname:scope=both")
|
||||||
@Syntax("<world>")
|
@Syntax("<world>")
|
||||||
@Description("{@@mv-core.regen.world.description}")
|
@Description("{@@mv-core.regen.world.description}")
|
||||||
String worldName,
|
String worldName,
|
||||||
|
@ -8,7 +8,6 @@ import co.aikar.commands.ConditionContext;
|
|||||||
import co.aikar.commands.ConditionFailedException;
|
import co.aikar.commands.ConditionFailedException;
|
||||||
import com.onarandombox.MultiverseCore.api.MVWorldManager;
|
import com.onarandombox.MultiverseCore.api.MVWorldManager;
|
||||||
import com.onarandombox.MultiverseCore.world.WorldNameChecker;
|
import com.onarandombox.MultiverseCore.world.WorldNameChecker;
|
||||||
import jakarta.annotation.PostConstruct;
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
public class MVCommandConditions {
|
public class MVCommandConditions {
|
||||||
@ -22,19 +21,19 @@ public class MVCommandConditions {
|
|||||||
private MVCommandConditions(@NotNull MVCommandManager commandManager, @NotNull MVWorldManager worldManager) {
|
private MVCommandConditions(@NotNull MVCommandManager commandManager, @NotNull MVWorldManager worldManager) {
|
||||||
this.worldManager = worldManager;
|
this.worldManager = worldManager;
|
||||||
this.commandManager = commandManager;
|
this.commandManager = commandManager;
|
||||||
|
registerConditions();
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostConstruct
|
|
||||||
private void registerConditions() {
|
private void registerConditions() {
|
||||||
CommandConditions<BukkitCommandIssuer, BukkitCommandExecutionContext, BukkitConditionContext> conditions
|
CommandConditions<BukkitCommandIssuer, BukkitCommandExecutionContext, BukkitConditionContext> conditions
|
||||||
= commandManager.getCommandConditions();
|
= commandManager.getCommandConditions();
|
||||||
|
|
||||||
conditions.addCondition(String.class, "validWorldName", this::checkValidWorldName);
|
conditions.addCondition(String.class, "worldname", this::checkWorldname);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void checkValidWorldName(ConditionContext<BukkitCommandIssuer> context,
|
private void checkWorldname(ConditionContext<BukkitCommandIssuer> context,
|
||||||
BukkitCommandExecutionContext executionContext,
|
BukkitCommandExecutionContext executionContext,
|
||||||
String worldName
|
String worldName
|
||||||
) {
|
) {
|
||||||
String scope = context.getConfigValue("scope", "loaded");
|
String scope = context.getConfigValue("scope", "loaded");
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user