Package net.minecraft.server.players
Class PlayerList
java.lang.Object
net.minecraft.server.players.PlayerList
- Direct Known Subclasses:
DedicatedPlayerList,IntegratedPlayerList
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Map<UUID, PlayerAdvancements> private static final booleanprivate booleanprivate static final SimpleDateFormatprivate final UserBanListstatic final Componentprivate booleanstatic final Componentstatic final Fileprivate final IpBanListprivate static final org.slf4j.Loggerprotected final intstatic final Fileprivate final ServerOpListprivate final PlayerDataStorageprivate final List<ServerPlayer> private final Map<UUID, ServerPlayer> A map containing the key-value pairs for UUIDs and their EntityPlayerMP objects.private final List<ServerPlayer> private final LayeredRegistryAccess<RegistryLayer> private static final intprivate intprivate final MinecraftServerprivate intprivate final Map<UUID, ServerStatsCounter> static final Fileprivate intprivate final UserWhiteListstatic final File -
Constructor Summary
ConstructorsConstructorDescriptionPlayerList(MinecraftServer server, LayeredRegistryAccess<RegistryLayer> registries, PlayerDataStorage playerIo, int maxPlayers) -
Method Summary
Modifier and TypeMethodDescriptionvoidvoidbroadcast(Player except, double x, double y, double z, double radius, ResourceKey<Level> dimension, Packet<?> packet) voidbroadcastAll(Packet<?> packet) voidbroadcastAll(Packet<?> packet, ResourceKey<Level> dimension) private voidbroadcastChatMessage(PlayerChatMessage message, Predicate<ServerPlayer> shouldFilterMessageTo, ServerPlayer sender, ChatType.Bound boundChatType) voidbroadcastChatMessage(PlayerChatMessage message, CommandSourceStack sender, ChatType.Bound boundChatType) voidbroadcastChatMessage(PlayerChatMessage message, ServerPlayer sender, ChatType.Bound boundChatType) voidbroadcastSystemMessage(Component message, boolean bypassHiddenChat) voidbroadcastSystemMessage(Component serverMessage, Function<ServerPlayer, Component> playerMessageFactory, boolean bypassHiddenChat) voidbroadcastSystemToAllExceptTeam(Player player, Component message) voidbroadcastSystemToTeam(Player player, Component message) booleancanBypassPlayerLimit(com.mojang.authlib.GameProfile profile) canPlayerLogin(SocketAddress socketAddress, com.mojang.authlib.GameProfile gameProfile) voiddeop(com.mojang.authlib.GameProfile profile) booleandisconnectAllPlayersWithProfile(com.mojang.authlib.GameProfile gameProfile) getBans()intString[]getOps()Gets the ServerPlayer object representing the player with the UUID.getPlayerAdvancements(ServerPlayer player) getPlayerByName(String username) intgetPlayerForLogin(com.mojang.authlib.GameProfile gameProfile, ClientInformation clientInformation) String[]getPlayerStats(Player player) getPlayersWithAddress(String address) intintString[]booleanbooleanisOp(com.mojang.authlib.GameProfile profile) booleanbooleanisWhiteListed(com.mojang.authlib.GameProfile profile) load(ServerPlayer player) voidop(com.mojang.authlib.GameProfile profile) voidplaceNewPlayer(Connection connection, ServerPlayer player, CommonListenerCookie cookie) voidvoidvoidremove(ServerPlayer player) Called when a player disconnects from the game.voidrespawn(ServerPlayer player, boolean keepInventory, Entity.RemovalReason reason) protected voidsave(ServerPlayer player) Also stores the NBTTags if this is an IntegratedPlayerList.voidsaveAll()voidsendActiveEffects(LivingEntity entity, ServerGamePacketListenerImpl connection) voidsendActivePlayerEffects(ServerPlayer player) voidsendAllPlayerInfo(ServerPlayer player) Sends the players inventory to himself.voidsendLevelInfo(ServerPlayer player, ServerLevel level) Updates the time and weather for the given player to those of the given worldvoidprivate voidsendPlayerPermissionLevel(ServerPlayer player, int permLevel) voidsetAllowCommandsForAllPlayers(boolean allowCommandsForAllPlayers) voidsetSimulationDistance(int simulationDistance) voidsetUsingWhiteList(boolean whitelistEnabled) voidsetViewDistance(int viewDistance) voidtick()protected voidupdateEntireScoreboard(ServerScoreboard scoreboard, ServerPlayer player) private booleanverifyChatTrusted(PlayerChatMessage message)
-
Field Details
-
USERBANLIST_FILE
-
IPBANLIST_FILE
-
OPLIST_FILE
-
WHITELIST_FILE
-
CHAT_FILTERED_FULL
-
DUPLICATE_LOGIN_DISCONNECT_MESSAGE
-
LOGGER
private static final org.slf4j.Logger LOGGER -
SEND_PLAYER_INFO_INTERVAL
private static final int SEND_PLAYER_INFO_INTERVAL- See Also:
-
BAN_DATE_FORMAT
-
server
-
players
-
playersByUUID
A map containing the key-value pairs for UUIDs and their EntityPlayerMP objects. -
bans
-
ipBans
-
ops
-
whitelist
-
stats
-
advancements
-
playerIo
-
doWhiteList
private boolean doWhiteList -
registries
-
maxPlayers
protected final int maxPlayers -
viewDistance
private int viewDistance -
simulationDistance
private int simulationDistance -
allowCommandsForAllPlayers
private boolean allowCommandsForAllPlayers -
ALLOW_LOGOUTIVATOR
private static final boolean ALLOW_LOGOUTIVATOR- See Also:
-
sendAllPlayerInfoIn
private int sendAllPlayerInfoIn -
playersView
-
-
Constructor Details
-
PlayerList
public PlayerList(MinecraftServer server, LayeredRegistryAccess<RegistryLayer> registries, PlayerDataStorage playerIo, int maxPlayers)
-
-
Method Details
-
placeNewPlayer
-
updateEntireScoreboard
-
addWorldborderListener
-
load
-
save
Also stores the NBTTags if this is an IntegratedPlayerList. -
remove
Called when a player disconnects from the game. Writes player data to disk and removes them from the world. -
canPlayerLogin
@Nullable public Component canPlayerLogin(SocketAddress socketAddress, com.mojang.authlib.GameProfile gameProfile) -
getPlayerForLogin
public ServerPlayer getPlayerForLogin(com.mojang.authlib.GameProfile gameProfile, ClientInformation clientInformation) -
disconnectAllPlayersWithProfile
public boolean disconnectAllPlayersWithProfile(com.mojang.authlib.GameProfile gameProfile) -
respawn
public ServerPlayer respawn(ServerPlayer player, boolean keepInventory, Entity.RemovalReason reason) -
sendActivePlayerEffects
-
sendActiveEffects
-
sendPlayerPermissionLevel
-
tick
public void tick() -
broadcastAll
-
broadcastAll
-
broadcastSystemToTeam
-
broadcastSystemToAllExceptTeam
-
getPlayerNamesArray
-
getBans
-
getIpBans
-
op
public void op(com.mojang.authlib.GameProfile profile) -
deop
public void deop(com.mojang.authlib.GameProfile profile) -
sendPlayerPermissionLevel
-
isWhiteListed
public boolean isWhiteListed(com.mojang.authlib.GameProfile profile) -
isOp
public boolean isOp(com.mojang.authlib.GameProfile profile) -
getPlayerByName
-
broadcast
public void broadcast(@Nullable Player except, double x, double y, double z, double radius, ResourceKey<Level> dimension, Packet<?> packet) -
saveAll
public void saveAll() -
getWhiteList
-
getWhiteListNames
-
getOps
-
getOpNames
-
reloadWhiteList
public void reloadWhiteList() -
sendLevelInfo
Updates the time and weather for the given player to those of the given world -
sendAllPlayerInfo
Sends the players inventory to himself. -
getPlayerCount
public int getPlayerCount() -
getMaxPlayers
public int getMaxPlayers() -
isUsingWhitelist
public boolean isUsingWhitelist() -
setUsingWhiteList
public void setUsingWhiteList(boolean whitelistEnabled) -
getPlayersWithAddress
-
getViewDistance
public int getViewDistance() -
getSimulationDistance
public int getSimulationDistance() -
getServer
-
getSingleplayerData
-
setAllowCommandsForAllPlayers
public void setAllowCommandsForAllPlayers(boolean allowCommandsForAllPlayers) -
removeAll
public void removeAll() -
broadcastSystemMessage
-
broadcastSystemMessage
public void broadcastSystemMessage(Component serverMessage, Function<ServerPlayer, Component> playerMessageFactory, boolean bypassHiddenChat) -
broadcastChatMessage
public void broadcastChatMessage(PlayerChatMessage message, CommandSourceStack sender, ChatType.Bound boundChatType) -
broadcastChatMessage
public void broadcastChatMessage(PlayerChatMessage message, ServerPlayer sender, ChatType.Bound boundChatType) -
broadcastChatMessage
private void broadcastChatMessage(PlayerChatMessage message, Predicate<ServerPlayer> shouldFilterMessageTo, @Nullable ServerPlayer sender, ChatType.Bound boundChatType) -
verifyChatTrusted
-
getPlayerStats
-
getPlayerAdvancements
-
setViewDistance
public void setViewDistance(int viewDistance) -
setSimulationDistance
public void setSimulationDistance(int simulationDistance) -
getPlayers
-
getPlayer
Gets the ServerPlayer object representing the player with the UUID. -
canBypassPlayerLimit
public boolean canBypassPlayerLimit(com.mojang.authlib.GameProfile profile) -
reloadResources
public void reloadResources() -
isAllowCommandsForAllPlayers
public boolean isAllowCommandsForAllPlayers()
-