#ACF (Aikar Command Framework) and custom args.

1 messages · Page 1 of 1 (latest)

vapid dove
#

How can I use custom args using Aikar Command Framework?
I've created a class like this:

@Getter
@Setter
@RequiredArgsConstructor
public class Arena {
    private final UUID id;
    private final String name;
    private final ArenaType type;
    private final World world;
    private final int maxPlayers;
    private final Map<TeamColor, Location> spawns;
    private final Map<GeneratorType, List<Location>> generators;
    private final Location lobby;
    private final Location[] shop, upgrade, beds;
    private GameStatus status = GameStatus.WAITING;
}

And I would like to use it inside a subcommand arg

    public void join(final CommandSender sender, Arena arena) {

How can I make it resolve the arg?
(Transform the player string to an arena obj)

azure flicker
#

registerContext

#

like this

vapid dove
#

Something like this?:

        cmdManager.getCommandContexts().registerContext(Arena.class, c -> {
            String arenaName = c.popFirstArg();
            return Arena.getArena(arenaName);
        });
#

I could also add a @Condition("isArena") Arena arena

azure flicker
#

i believe so, dunno what @Condition is tho

vapid dove
#

NICE! Tysm

azure flicker
#

ig that condition checks if the name is valid?

vapid dove
#

smth like that