package xyz.upperlevel.uppercore.arena.command;

import xyz.upperlevel.uppercore.arena.Arena;
import xyz.upperlevel.uppercore.arena.ArenaManager;
import xyz.upperlevel.uppercore.command.functional.parameter.ParameterHandler;
import xyz.upperlevel.uppercore.command.functional.parameter.ParameterParseException;

import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Queue;
import java.util.stream.Collectors;

public final class ArenaParameterHandler {
    private ArenaParameterHandler() {
    }

    public static void register() {
        ParameterHandler.register(
                Collections.singletonList(Arena.class),
                args -> {
                    Arena arena = ArenaManager.get().get(args.take());
                    if (arena == null) {
                        throw args.areWrong();
                    }
                    return arena;
                },
                args -> {
                    if (args.remaining() > 1)
                        return Collections.emptyList();
                    return ArenaManager.get().getArenas()
                            .stream()
                            .filter(arena -> arena.getId().startsWith(args.take()))
                            .map(Arena::getId)
                            .collect(Collectors.toList());
                });
    }
}

@@ -222,195 +222,37 @@
 er;%0A
-import xyz.upperlevel.uppercore.command.functional.parameter.ParameterParseException;%0A%0Aimport java.util.Arrays;%0Aimport java.util.Collections;%0Aimport java.util.List;%0Aimport java.util.Queue
+%0Aimport java.util.Collections
 ;%0Aim
@@ -885,24 +885,76 @@
 mptyList();%0A
+                    String arenaName = args.take();%0A
             
@@ -1109,25 +1109,23 @@
 sWith(ar
-gs.take()
+enaName
 ))%0A     

Fix tab-complete when having many arenas