mirror of
https://github.com/darksaid98/HuskHomes.git
synced 2026-12-01 14:38:53 +00:00
Fix /tp command not working for vanished users, close #255
This commit is contained in:
1 parent
88802db702
commit
e20dcc4ce4
1 file changed
+8
-1
@@ -39,7 +39,14 @@ public class TpCommand extends CommandBase implements TabCompletable, ConsoleExe
|
||||
|
||||
// Find the online user to teleport
|
||||
plugin.getCache().updatePlayerListCache(plugin, onlineUser).thenRun(() -> {
|
||||
final String playerToTeleport = plugin.getCache().players.stream()
|
||||
// Get the list of potential teleports, filtered against vanished players, but ensuring the executor is in the list
|
||||
final List<String> players = plugin.getCache().players;
|
||||
if (!players.contains(onlineUser.username)) {
|
||||
players.add(onlineUser.username);
|
||||
}
|
||||
|
||||
// Find the player to teleport
|
||||
final String playerToTeleport = players.stream()
|
||||
.filter(user -> user.equalsIgnoreCase(targetPlayerToTeleport)).findFirst()
|
||||
.or(() -> Optional.ofNullable(targetPlayerToTeleport.equals("@s") ? onlineUser.username : null))
|
||||
.or(() -> plugin.getCache().players.stream().filter(user -> user.toLowerCase().startsWith(targetPlayerToTeleport)).findFirst())
|
||||
|
||||
Reference in new issue
Block a user