@NonnullByDefault public final class Players extends Object
| Modifier and Type | Method and Description |
|---|---|
static Collection<Player> |
all()
Gets all players on the server.
|
static Collection<OfflinePlayer> |
allOffline() |
static void |
forEach(Consumer<Player> consumer)
Applies a given action to all players on the server
|
static void |
forEachIfPlayer(Iterable<Object> objects,
Consumer<Player> consumer)
Applies an action to each object in the iterable, if it is a player.
|
static void |
forEachInRange(Location center,
double radius,
Consumer<Player> consumer)
Applies an action to all players within a given radius of a point
|
static void |
forEachOffline(Consumer<OfflinePlayer> consumer) |
static Optional<Player> |
get(String username)
Gets a player by username.
|
static Optional<Player> |
get(UUID uuid)
Gets a player by uuid.
|
static Player |
getNullable(String username)
Gets a player by username.
|
static Player |
getNullable(UUID uuid)
Gets a player by uuid.
|
static Optional<OfflinePlayer> |
getOffline(String username) |
static Optional<OfflinePlayer> |
getOffline(UUID uuid) |
static OfflinePlayer |
getOfflineNullable(String username) |
static OfflinePlayer |
getOfflineNullable(UUID uuid) |
static void |
msg(CommandSender sender,
String... msgs)
Messages a sender a set of messages.
|
static void |
playSound(Location location,
Sound sound) |
static void |
playSound(Player player,
Location location,
Sound sound) |
static void |
playSound(Player player,
Sound sound) |
static void |
resetFlySpeed(Player player) |
static void |
resetWalkSpeed(Player player) |
static void |
sendBlockChange(Player player,
Block block,
Material type) |
static void |
sendBlockChange(Player player,
Block block,
Material type,
int data) |
static void |
sendBlockChange(Player player,
Location loc,
Material type) |
static void |
sendBlockChange(Player player,
Location loc,
Material type,
int data) |
static void |
spawnEffect(Location location,
Effect effect) |
static void |
spawnEffect(Location location,
Effect effect,
int amount) |
static void |
spawnEffect(Player player,
Location location,
Effect effect) |
static void |
spawnEffect(Player player,
Location location,
Effect effect,
int amount) |
static void |
spawnParticle(Location location,
Particle particle) |
static void |
spawnParticle(Location location,
Particle particle,
int amount) |
static void |
spawnParticle(Player player,
Location location,
Particle particle) |
static void |
spawnParticle(Player player,
Location location,
Particle particle,
int amount) |
static void |
spawnParticleOffset(Location location,
Particle particle,
double offset) |
static void |
spawnParticleOffset(Location location,
Particle particle,
int amount,
double offset) |
static void |
spawnParticleOffset(Player player,
Location location,
Particle particle,
double offset) |
static void |
spawnParticleOffset(Player player,
Location location,
Particle particle,
int amount,
double offset) |
static Stream<Player> |
stream()
Gets a stream of all players on the server.
|
static Stream<Player> |
streamInRange(Location center,
double radius)
Gets a stream of all players within a given radius of a point
|
static Stream<OfflinePlayer> |
streamOffline() |
@Nullable public static Player getNullable(UUID uuid)
uuid - the uuidpublic static Optional<Player> get(UUID uuid)
uuid - the uuid@Nullable public static Player getNullable(String username)
username - the players usernamepublic static Optional<Player> get(String username)
username - the players usernamepublic static Collection<Player> all()
public static Stream<Player> stream()
public static void forEach(Consumer<Player> consumer)
consumer - the action to applypublic static void forEachIfPlayer(Iterable<Object> objects, Consumer<Player> consumer)
objects - the objects to iterateconsumer - the action to applypublic static Stream<Player> streamInRange(Location center, double radius)
center - the pointradius - the radiuspublic static void forEachInRange(Location center, double radius, Consumer<Player> consumer)
center - the pointradius - the radiusconsumer - the action to applypublic static void msg(CommandSender sender, String... msgs)
sender - the sendermsgs - the messages to send@Nullable public static OfflinePlayer getOfflineNullable(UUID uuid)
public static Optional<OfflinePlayer> getOffline(UUID uuid)
@Nullable public static OfflinePlayer getOfflineNullable(String username)
public static Optional<OfflinePlayer> getOffline(String username)
public static Collection<OfflinePlayer> allOffline()
public static Stream<OfflinePlayer> streamOffline()
public static void forEachOffline(Consumer<OfflinePlayer> consumer)
public static void sendBlockChange(Player player, Location loc, Material type, int data)
public static void sendBlockChange(Player player, Block block, Material type, int data)
public static void spawnParticle(Player player, Location location, Particle particle, int amount)
public static void spawnParticleOffset(Player player, Location location, Particle particle, double offset)
public static void spawnParticleOffset(Location location, Particle particle, double offset)
public static void spawnParticleOffset(Player player, Location location, Particle particle, int amount, double offset)
public static void spawnParticleOffset(Location location, Particle particle, int amount, double offset)
public static void spawnEffect(Player player, Location location, Effect effect, int amount)
public static void resetWalkSpeed(Player player)
public static void resetFlySpeed(Player player)
Copyright © 2020. All rights reserved.