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 boolean
private boolean
private static final SimpleDateFormat
private final UserBanList
static final Component
private boolean
static final Component
static final File
private final IpBanList
private static final org.slf4j.Logger
protected final int
static final File
private final ServerOpList
private final PlayerDataStorage
private 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 int
private int
private final MinecraftServer
private int
private final Map
<UUID, ServerStatsCounter> static final File
private int
private final UserWhiteList
static final File
-
Constructor Summary
ConstructorsConstructorDescriptionPlayerList
(MinecraftServer server, LayeredRegistryAccess<RegistryLayer> registries, PlayerDataStorage playerIo, int maxPlayers) -
Method Summary
Modifier and TypeMethodDescriptionvoid
void
broadcast
(Player except, double x, double y, double z, double radius, ResourceKey<Level> dimension, Packet<?> packet) void
broadcastAll
(Packet<?> packet) void
broadcastAll
(Packet<?> packet, ResourceKey<Level> dimension) private void
broadcastChatMessage
(PlayerChatMessage message, Predicate<ServerPlayer> shouldFilterMessageTo, ServerPlayer sender, ChatType.Bound boundChatType) void
broadcastChatMessage
(PlayerChatMessage message, CommandSourceStack sender, ChatType.Bound boundChatType) void
broadcastChatMessage
(PlayerChatMessage message, ServerPlayer sender, ChatType.Bound boundChatType) void
broadcastSystemMessage
(Component message, boolean bypassHiddenChat) void
broadcastSystemMessage
(Component serverMessage, Function<ServerPlayer, Component> playerMessageFactory, boolean bypassHiddenChat) void
broadcastSystemToAllExceptTeam
(Player player, Component message) void
broadcastSystemToTeam
(Player player, Component message) boolean
canBypassPlayerLimit
(com.mojang.authlib.GameProfile profile) canPlayerLogin
(SocketAddress socketAddress, com.mojang.authlib.GameProfile gameProfile) void
deop
(com.mojang.authlib.GameProfile profile) boolean
disconnectAllPlayersWithProfile
(com.mojang.authlib.GameProfile gameProfile) getBans()
int
String[]
getOps()
Gets the ServerPlayer object representing the player with the UUID.getPlayerAdvancements
(ServerPlayer player) getPlayerByName
(String username) int
getPlayerForLogin
(com.mojang.authlib.GameProfile gameProfile, ClientInformation clientInformation) String[]
getPlayerStats
(Player player) getPlayersWithAddress
(String address) int
int
String[]
boolean
boolean
isOp
(com.mojang.authlib.GameProfile profile) boolean
boolean
isWhiteListed
(com.mojang.authlib.GameProfile profile) load
(ServerPlayer player) void
op
(com.mojang.authlib.GameProfile profile) void
placeNewPlayer
(Connection connection, ServerPlayer player, CommonListenerCookie cookie) void
void
void
remove
(ServerPlayer player) Called when a player disconnects from the game.void
respawn
(ServerPlayer player, boolean keepInventory, Entity.RemovalReason reason) protected void
save
(ServerPlayer player) Also stores the NBTTags if this is an IntegratedPlayerList.void
saveAll()
void
sendActiveEffects
(LivingEntity entity, ServerGamePacketListenerImpl connection) void
sendActivePlayerEffects
(ServerPlayer player) void
sendAllPlayerInfo
(ServerPlayer player) Sends the players inventory to himself.void
sendLevelInfo
(ServerPlayer player, ServerLevel level) Updates the time and weather for the given player to those of the given worldvoid
private void
sendPlayerPermissionLevel
(ServerPlayer player, int permLevel) void
setAllowCommandsForAllPlayers
(boolean allowCommandsForAllPlayers) void
setSimulationDistance
(int simulationDistance) void
setUsingWhiteList
(boolean whitelistEnabled) void
setViewDistance
(int viewDistance) void
tick()
protected void
updateEntireScoreboard
(ServerScoreboard scoreboard, ServerPlayer player) private boolean
verifyChatTrusted
(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()
-