mirror of
https://github.com/darksaid98/HuskHomes.git
synced 2026-12-04 14:38:53 +00:00
Add special handling for @s operator to support vanilla suggestions
This commit is contained in:
1 parent
50289d9ca5
commit
af91b224a0
1 file changed
+2
-2
@@ -41,8 +41,8 @@ public class TpCommand extends CommandBase implements TabCompletable, ConsoleExe
|
|||||||
plugin.getCache().updatePlayerListCache(plugin, onlineUser).join();
|
plugin.getCache().updatePlayerListCache(plugin, onlineUser).join();
|
||||||
final String playerToTeleport = plugin.getCache().players.stream()
|
final String playerToTeleport = plugin.getCache().players.stream()
|
||||||
.filter(user -> user.equalsIgnoreCase(targetPlayerToTeleport)).findFirst()
|
.filter(user -> user.equalsIgnoreCase(targetPlayerToTeleport)).findFirst()
|
||||||
.or(() -> plugin.getCache().players.stream()
|
.or(() -> Optional.ofNullable(targetPlayerToTeleport.equals("@s") ? onlineUser.username : null))
|
||||||
.filter(user -> user.toLowerCase().startsWith(targetPlayerToTeleport)).findFirst())
|
.or(() -> plugin.getCache().players.stream().filter(user -> user.toLowerCase().startsWith(targetPlayerToTeleport)).findFirst())
|
||||||
.orElse(null);
|
.orElse(null);
|
||||||
|
|
||||||
// Ensure the player to teleport exists
|
// Ensure the player to teleport exists
|
||||||
|
|||||||
Reference in new issue
Block a user