Skip to content

Commit

Permalink
Added SkyCommand#getOnlineNames
Browse files Browse the repository at this point in the history
  • Loading branch information
xDec0de committed Dec 27, 2024
1 parent 5204247 commit 1fd4fa9
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions shared/src/main/java/net/codersky/skyutils/cmd/SkyCommand.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package net.codersky.skyutils.cmd;

import net.codersky.skyutils.SkyUtils;
import net.codersky.skyutils.crossplatform.player.SkyPlayer;
import net.codersky.skyutils.java.SkyCollections;
import net.codersky.skyutils.java.math.SkyNumbers;
import net.codersky.skyutils.java.strings.SkyStrings;
Expand Down Expand Up @@ -201,6 +202,23 @@ default boolean hasAccess(@NotNull S sender, boolean message) {
return true;
}

/*
- Utility
*/

/**
* Utility method to get a {@link List} with the names of all current <b>online</b> players.
* This is generally used on {@link #onTab(SkyCommandSender, String[]) tab complete}.
*
* @return A {@link List} with the names of all current <b>online</b> players.
*
* @since SkyUtils 1.0.0
*/
@NotNull
default List<String> getOnlineNames() {
return getUtils().getOnlinePlayers().stream().map(SkyPlayer::getName).toList();
}

/*
- Argument conversion - Event pattern removal
*/
Expand Down

0 comments on commit 1fd4fa9

Please sign in to comment.