diff --git a/src/main/java/net/elytrium/velocitytools/Settings.java b/src/main/java/net/elytrium/velocitytools/Settings.java index 065b73b..66e8cf8 100644 --- a/src/main/java/net/elytrium/velocitytools/Settings.java +++ b/src/main/java/net/elytrium/velocitytools/Settings.java @@ -103,6 +103,9 @@ public static class FIND { public String USERNAME_NEEDED = "&cYou must supply the username."; public String PLAYER_ONLINE_AT = "&6{0} &fis online at &6{1}"; public String PLAYER_NOT_ONLINE = "&6{0} &fis not online."; + + @Comment(@CommentValue("List of players that cannot be found using /find command")) + public List FIND_BLACKLIST = List.of("player1", "player2"); } public static class SEND { diff --git a/src/main/java/net/elytrium/velocitytools/commands/FindCommand.java b/src/main/java/net/elytrium/velocitytools/commands/FindCommand.java index 9b38fe6..53bcfeb 100644 --- a/src/main/java/net/elytrium/velocitytools/commands/FindCommand.java +++ b/src/main/java/net/elytrium/velocitytools/commands/FindCommand.java @@ -36,11 +36,13 @@ public class FindCommand implements SimpleCommand { private final ProxyServer server; private final Component usernameNeeded; private final String playerOnlineAt; + private final List blacklist; public FindCommand(ProxyServer server) { this.server = server; this.usernameNeeded = VelocityTools.getSerializer().deserialize(Settings.IMP.COMMANDS.FIND.USERNAME_NEEDED); this.playerOnlineAt = Settings.IMP.COMMANDS.FIND.PLAYER_ONLINE_AT; + this.blacklist = Settings.IMP.COMMANDS.FIND.FIND_BLACKLIST; } @Override @@ -50,11 +52,13 @@ public List suggest(SimpleCommand.Invocation invocation) { if (args.length == 0) { return this.server.getAllPlayers().stream() .map(Player::getUsername) + .filter(name -> !blacklist.contains(name)) .collect(Collectors.toList()); } else if (args.length == 1) { return this.server.getAllPlayers().stream() .map(Player::getUsername) .filter(name -> name.regionMatches(true, 0, args[0], 0, args[0].length())) + .filter(name -> !blacklist.contains(name)) .collect(Collectors.toList()); } else { return ImmutableList.of(); @@ -70,7 +74,7 @@ public void execute(SimpleCommand.Invocation invocation) { source.sendMessage(this.usernameNeeded); } else { Optional player = this.server.getPlayer(args[0]); - if (player.isPresent()) { + if (player.isPresent() && !blacklist.contains(player.get().getUsername())) { Player player0 = player.get(); Optional server = player0.getCurrentServer(); server.ifPresent(srv ->