Class PlayerFinder
java.lang.Object
org.mvplugins.multiverse.core.utils.PlayerFinder
Helper class to get
Player from name, UUID or Selectors.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic @Nullable org.bukkit.entity.PlayerGet aPlayerbased on an identifier of name UUID or selector.static @Nullable org.bukkit.entity.PlayerGet aPlayerbased on an identifier of name UUID or selector.static @Nullable org.bukkit.entity.PlayerGet aPlayerbased on player name.static @Nullable org.bukkit.entity.PlayergetBySelector(@NotNull String playerSelector, @NotNull org.bukkit.command.CommandSender sender) Get aPlayerbased on vanilla selectors.static @Nullable org.bukkit.entity.PlayerGet aPlayerbased on player UUID.static @Nullable org.bukkit.entity.PlayerGet aPlayerbased on playerUUID.static @NotNull List<org.bukkit.entity.Player> Get multiplePlayerbased on many identifiers of name UUID or selector.static @NotNull List<org.bukkit.entity.Player> Get multiplePlayerbased on many identifiers of name UUID or selector.static @NotNull List<org.bukkit.entity.Player> getMultiBySelector(@NotNull String playerSelector, @NotNull org.bukkit.command.CommandSender sender) Get multiplePlayerbased on vanilla selectors.static booleanisSelector(@NotNull String playerIdentifier) Check if the player identifier is a selector.static @NotNull io.vavr.control.Try<@NotNull List<org.bukkit.entity.Player>> tryGetMulti(@Nullable String playerIdentifiers, @NotNull org.bukkit.command.CommandSender sender) Get multiplePlayerbased on many identifiers of name UUID or selector.static @NotNull io.vavr.control.Try<@NotNull List<org.bukkit.entity.Player>> tryGetMultiBySelector(@NotNull String playerSelector, @NotNull org.bukkit.command.CommandSender sender) Get multiplePlayerbased on vanilla selectors.
-
Constructor Details
-
PlayerFinder
public PlayerFinder()
-
-
Method Details
-
get
@Nullable public static @Nullable org.bukkit.entity.Player get(@Nullable @Nullable String playerIdentifier) Get aPlayerbased on an identifier of name UUID or selector.- Parameters:
playerIdentifier- An identifier of name UUID or selector.- Returns:
- The player if found, else null.
-
get
@Nullable public static @Nullable org.bukkit.entity.Player get(@Nullable @Nullable String playerIdentifier, @NotNull @NotNull org.bukkit.command.CommandSender sender) Get aPlayerbased on an identifier of name UUID or selector.- Parameters:
playerIdentifier- An identifier of name UUID or selector.sender- Target sender for selector.- Returns:
- The player if found, else null.
-
getMulti
@NotNull public static @NotNull List<org.bukkit.entity.Player> getMulti(@Nullable @Nullable String playerIdentifiers) Get multiplePlayerbased on many identifiers of name UUID or selector.- Parameters:
playerIdentifiers- An identifier of multiple names, UUIDs or selectors, separated by comma.- Returns:
- A list of all the
Playerfound.
-
getMulti
@NotNull public static @NotNull List<org.bukkit.entity.Player> getMulti(@Nullable @Nullable String playerIdentifiers, @NotNull @NotNull org.bukkit.command.CommandSender sender) Get multiplePlayerbased on many identifiers of name UUID or selector.- Parameters:
playerIdentifiers- An identifier of multiple names, UUIDs or selectors, separated by comma.sender- Target sender for selector.- Returns:
- A list of all the
Playerfound.
-
tryGetMulti
@AvailableSince("5.4") @NotNull public static @NotNull io.vavr.control.Try<@NotNull List<org.bukkit.entity.Player>> tryGetMulti(@Nullable @Nullable String playerIdentifiers, @NotNull @NotNull org.bukkit.command.CommandSender sender) Get multiplePlayerbased on many identifiers of name UUID or selector.- Parameters:
playerIdentifiers- An identifier of multiple names, UUIDs or selectors, separated by comma.sender- Target sender for selector.- Returns:
- A list of all the
Playerfound. - Since:
- 5.4
-
isSelector
Check if the player identifier is a selector.- Parameters:
playerIdentifier- An identifier of name, UUID or selector.- Returns:
- True if the identifier is a selector, else false.
- Since:
- 5.4
-
getByName
@Nullable public static @Nullable org.bukkit.entity.Player getByName(@NotNull @NotNull String playerName) Get aPlayerbased on player name.- Parameters:
playerName- Name of aPlayer.- Returns:
- The player if found, else null.
-
getByUuid
@Nullable public static @Nullable org.bukkit.entity.Player getByUuid(@NotNull @NotNull String playerUuid) Get aPlayerbased on player UUID.- Parameters:
playerUuid- UUID of a player.- Returns:
- The player if found, else null.
-
getByUuid
@Nullable public static @Nullable org.bukkit.entity.Player getByUuid(@NotNull @NotNull UUID playerUuid) Get aPlayerbased on playerUUID.- Parameters:
playerUuid- UUID of a player.- Returns:
- The player if found, else null.
-
getBySelector
@Nullable public static @Nullable org.bukkit.entity.Player getBySelector(@NotNull @NotNull String playerSelector, @NotNull @NotNull org.bukkit.command.CommandSender sender) Get aPlayerbased on vanilla selectors.- Parameters:
playerSelector- A target selector, usually starts with an '@'.sender- Target sender for selector.- Returns:
- The player if only one found, else null.
-
getMultiBySelector
@NotNull public static @NotNull List<org.bukkit.entity.Player> getMultiBySelector(@NotNull @NotNull String playerSelector, @NotNull @NotNull org.bukkit.command.CommandSender sender) Get multiplePlayerbased on vanilla selectors.- Parameters:
playerSelector- A target selector, usually starts with an '@'.sender- Target sender for selector.- Returns:
- A list of all the
Playerfound.
-
tryGetMultiBySelector
@AvailableSince("5.4") @NotNull public static @NotNull io.vavr.control.Try<@NotNull List<org.bukkit.entity.Player>> tryGetMultiBySelector(@NotNull @NotNull String playerSelector, @NotNull @NotNull org.bukkit.command.CommandSender sender) Get multiplePlayerbased on vanilla selectors.- Parameters:
playerSelector- A target selector, usually starts with an '@'.sender- Target sender for selector.- Returns:
- A list of all the
Playerfound. - Since:
- 5.4
-