From 28eb9e595fe6a9108d6131d33e668d040a92fbf6 Mon Sep 17 00:00:00 2001 From: Zoriot Date: Sun, 11 Oct 2026 22:37:52 +0200 Subject: [PATCH] fix(navigation): filter btwarps suggestions to teams with warps Only suggest build teams that have at least one warp group and exclude the player's current team, since people were confusing the argument with their own team's warps. Resolves #99. --- .../warps/commands/BtWarpsCommand.java | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/main/java/net/buildtheearth/buildteamtools/modules/navigation/components/warps/commands/BtWarpsCommand.java b/src/main/java/net/buildtheearth/buildteamtools/modules/navigation/components/warps/commands/BtWarpsCommand.java index fc960d46..497d0620 100644 --- a/src/main/java/net/buildtheearth/buildteamtools/modules/navigation/components/warps/commands/BtWarpsCommand.java +++ b/src/main/java/net/buildtheearth/buildteamtools/modules/navigation/components/warps/commands/BtWarpsCommand.java @@ -6,9 +6,14 @@ import net.buildtheearth.buildteamtools.modules.navigation.components.warps.WarpsComponent; import net.buildtheearth.buildteamtools.modules.network.model.BuildTeam; import net.buildtheearth.buildteamtools.modules.network.model.Permissions; +import net.buildtheearth.buildteamtools.modules.common.commands.BttCommandManager; +import net.buildtheearth.buildteamtools.modules.network.NetworkModule; import org.bukkit.entity.Player; import org.incendo.cloud.parser.standard.StringParser; +import java.util.List; +import java.util.stream.Stream; + public class BtWarpsCommand extends BuildteamCommand { @Override public void register(Module owner) { @@ -20,6 +25,17 @@ public void register(Module owner) { (sender, buildTeamName) -> btCommand(sender, buildTeamName, Permissions.WARP_USE)); } + @Override + protected List suggestions(String input) { + BuildTeam current = NetworkModule.getInstance().getBuildTeam(); + List candidates = NetworkModule.getInstance().getBuildTeams().stream() + .filter(team -> team.getWarpGroups() != null && !team.getWarpGroups().isEmpty()) + .filter(team -> current == null || !team.getID().equals(current.getID())) + .flatMap(team -> Stream.of(team.getTag(), team.getBlankName())) + .toList(); + return BttCommandManager.matchingSuggestions(candidates, input); + } + @Override public void execute(Player player, BuildTeam team) { WarpsComponent.openWarpMenu(player, team, null);