Package com.minecolonies.core.util
Class ServerUtils
java.lang.Object
com.minecolonies.core.util.ServerUtils
Utility for server related stuff.
Here you can query players on the server.
- Since:
- 0.2
-
Method Summary
Modifier and TypeMethodDescriptionstatic @Nullable net.minecraft.world.entity.player.PlayergetPlayerFromPermPlayer(@NotNull net.minecraft.world.entity.player.Player player, @NotNull net.minecraft.world.level.Level world) Retrieves a Player fromPlayer.static @Nullable net.minecraft.world.entity.player.PlayergetPlayerFromUUID(@Nullable UUID uuid, @NotNull net.minecraft.world.level.Level world) Finds a player by his UUIDstatic @Nullable net.minecraft.world.entity.player.PlayergetPlayerFromUUID(@NotNull net.minecraft.world.level.Level world, @NotNull UUID id) Returns the online PlayerEntity with the given UUID.static @NotNull List<net.minecraft.world.entity.player.Player> getPlayersFromPermPlayer(@NotNull List<net.minecraft.world.entity.player.Player> players, @NotNull net.minecraft.world.level.Level world) Returns a list of players from a list ofColonyPlayer.static @NotNull List<net.minecraft.world.entity.player.Player> getPlayersFromUUID(@Nullable net.minecraft.world.level.Level world, @NotNull Collection<UUID> ids) Returns a list of online players whose UUID's match the ones provided.
-
Method Details
-
getPlayerFromUUID
@Nullable public static @Nullable net.minecraft.world.entity.player.Player getPlayerFromUUID(@NotNull @NotNull net.minecraft.world.level.Level world, @NotNull @NotNull UUID id) Returns the online PlayerEntity with the given UUID.- Parameters:
world- world the player is inid- the player's UUID- Returns:
- the Player
-
getPlayersFromUUID
@NotNull public static @NotNull List<net.minecraft.world.entity.player.Player> getPlayersFromUUID(@Nullable @Nullable net.minecraft.world.level.Level world, @NotNull @NotNull Collection<UUID> ids) Returns a list of online players whose UUID's match the ones provided.- Parameters:
world- the world the players are in.ids- List of UUIDs- Returns:
- list of PlayerEntitys
-
getPlayersFromPermPlayer
@NotNull public static @NotNull List<net.minecraft.world.entity.player.Player> getPlayersFromPermPlayer(@NotNull @NotNull List<net.minecraft.world.entity.player.Player> players, @NotNull @NotNull net.minecraft.world.level.Level world) Returns a list of players from a list ofColonyPlayer.The
ColonyPlayeris a wrapper around aUUIDof minecraft players. The List will simply be converted into anPlayertype.- Parameters:
players- The list of players to convert.world- an instance of the world.- Returns:
- A list of
Players
-
getPlayerFromPermPlayer
@Nullable public static @Nullable net.minecraft.world.entity.player.Player getPlayerFromPermPlayer(@NotNull @NotNull net.minecraft.world.entity.player.Player player, @NotNull @NotNull net.minecraft.world.level.Level world) Retrieves a Player fromPlayer.Simply converts our type into the base type.
Passes this
ColonyPlayer.getID()togetPlayerFromUUID(Level, UUID).- Parameters:
player- TheColonyPlayerto convertworld- an instance of the world.- Returns:
- The
Playerreference.
-
getPlayerFromUUID
@Nullable public static @Nullable net.minecraft.world.entity.player.Player getPlayerFromUUID(@Nullable @Nullable UUID uuid, @NotNull @NotNull net.minecraft.world.level.Level world) Finds a player by his UUIDFound on jabelarminecraft.
- Parameters:
uuid- the uuid to search forworld- an instance of the world.- Returns:
- The player the player if found or null
-