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 pServer, LayeredRegistryAccess<RegistryLayer> pRegistries, PlayerDataStorage pPlayerIo, int pMaxPlayers) -
Method Summary
Modifier and TypeMethodDescriptionvoid
addWorldborderListener
(ServerLevel pLevel) void
broadcast
(Player pExcept, double pX, double pY, double pZ, double pRadius, ResourceKey<Level> pDimension, Packet<?> pPacket) void
broadcastAll
(Packet<?> pPacket) void
broadcastAll
(Packet<?> pPacket, ResourceKey<Level> pDimension) private void
broadcastChatMessage
(PlayerChatMessage pMessage, Predicate<ServerPlayer> pShouldFilterMessageTo, ServerPlayer pSender, ChatType.Bound pBoundChatType) void
broadcastChatMessage
(PlayerChatMessage pMessage, CommandSourceStack pSender, ChatType.Bound pBoundChatType) void
broadcastChatMessage
(PlayerChatMessage pMessage, ServerPlayer pSender, ChatType.Bound pBoundChatType) void
broadcastSystemMessage
(Component pMessage, boolean pBypassHiddenChat) void
broadcastSystemMessage
(Component pServerMessage, Function<ServerPlayer, Component> pPlayerMessageFactory, boolean pBypassHiddenChat) void
broadcastSystemToAllExceptTeam
(Player pPlayer, Component pMessage) void
broadcastSystemToTeam
(Player pPlayer, Component pMessage) boolean
canBypassPlayerLimit
(com.mojang.authlib.GameProfile p_11298_) canPlayerLogin
(SocketAddress p_11257_, com.mojang.authlib.GameProfile p_11258_) void
deop
(com.mojang.authlib.GameProfile p_11281_) boolean
disconnectAllPlayersWithProfile
(com.mojang.authlib.GameProfile p_295670_) getBans()
int
String[]
getOps()
Gets the ServerPlayer object representing the player with the UUID.getPlayerAdvancements
(ServerPlayer pPlayer) getPlayerByName
(String pUsername) int
getPlayerForLogin
(com.mojang.authlib.GameProfile p_215625_, ClientInformation p_302018_) String[]
getPlayerStats
(Player pPlayer) getPlayersWithAddress
(String pAddress) int
int
String[]
boolean
boolean
isOp
(com.mojang.authlib.GameProfile p_11304_) boolean
boolean
isWhiteListed
(com.mojang.authlib.GameProfile p_11294_) load
(ServerPlayer pPlayer) void
op
(com.mojang.authlib.GameProfile p_11254_) void
placeNewPlayer
(Connection pConnection, ServerPlayer pPlayer, CommonListenerCookie pCookie) void
void
void
remove
(ServerPlayer pPlayer) Called when a player disconnects from the game.void
respawn
(ServerPlayer pPlayer, boolean pKeepInventory, Entity.RemovalReason pReason) protected void
save
(ServerPlayer pPlayer) Also stores the NBTTags if this is an IntegratedPlayerList.void
saveAll()
void
sendActiveEffects
(LivingEntity pEntity, ServerGamePacketListenerImpl pConnection) void
sendActivePlayerEffects
(ServerPlayer pPlayer) void
sendAllPlayerInfo
(ServerPlayer pPlayer) Sends the players inventory to himself.void
sendLevelInfo
(ServerPlayer pPlayer, ServerLevel pLevel) Updates the time and weather for the given player to those of the given worldvoid
sendPlayerPermissionLevel
(ServerPlayer pPlayer) private void
sendPlayerPermissionLevel
(ServerPlayer pPlayer, int pPermLevel) void
setAllowCommandsForAllPlayers
(boolean pAllowCommandsForAllPlayers) void
setSimulationDistance
(int pSimulationDistance) void
setUsingWhiteList
(boolean pWhitelistEnabled) void
setViewDistance
(int pViewDistance) void
tick()
protected void
updateEntireScoreboard
(ServerScoreboard pScoreboard, ServerPlayer pPlayer) private boolean
verifyChatTrusted
(PlayerChatMessage pMessage)
-
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 pServer, LayeredRegistryAccess<RegistryLayer> pRegistries, PlayerDataStorage pPlayerIo, int pMaxPlayers)
-
-
Method Details
-
placeNewPlayer
public void placeNewPlayer(Connection pConnection, ServerPlayer pPlayer, CommonListenerCookie pCookie) -
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 p_11257_, com.mojang.authlib.GameProfile p_11258_) -
getPlayerForLogin
public ServerPlayer getPlayerForLogin(com.mojang.authlib.GameProfile p_215625_, ClientInformation p_302018_) -
disconnectAllPlayersWithProfile
public boolean disconnectAllPlayersWithProfile(com.mojang.authlib.GameProfile p_295670_) -
respawn
public ServerPlayer respawn(ServerPlayer pPlayer, boolean pKeepInventory, Entity.RemovalReason pReason) -
sendActivePlayerEffects
-
sendActiveEffects
-
sendPlayerPermissionLevel
-
tick
public void tick() -
broadcastAll
-
broadcastAll
-
broadcastSystemToTeam
-
broadcastSystemToAllExceptTeam
-
getPlayerNamesArray
-
getBans
-
getIpBans
-
op
public void op(com.mojang.authlib.GameProfile p_11254_) -
deop
public void deop(com.mojang.authlib.GameProfile p_11281_) -
sendPlayerPermissionLevel
-
isWhiteListed
public boolean isWhiteListed(com.mojang.authlib.GameProfile p_11294_) -
isOp
public boolean isOp(com.mojang.authlib.GameProfile p_11304_) -
getPlayerByName
-
broadcast
public void broadcast(@Nullable Player pExcept, double pX, double pY, double pZ, double pRadius, ResourceKey<Level> pDimension, Packet<?> pPacket) -
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 pWhitelistEnabled) -
getPlayersWithAddress
-
getViewDistance
public int getViewDistance() -
getSimulationDistance
public int getSimulationDistance() -
getServer
-
getSingleplayerData
-
setAllowCommandsForAllPlayers
public void setAllowCommandsForAllPlayers(boolean pAllowCommandsForAllPlayers) -
removeAll
public void removeAll() -
broadcastSystemMessage
-
broadcastSystemMessage
public void broadcastSystemMessage(Component pServerMessage, Function<ServerPlayer, Component> pPlayerMessageFactory, boolean pBypassHiddenChat) -
broadcastChatMessage
public void broadcastChatMessage(PlayerChatMessage pMessage, CommandSourceStack pSender, ChatType.Bound pBoundChatType) -
broadcastChatMessage
public void broadcastChatMessage(PlayerChatMessage pMessage, ServerPlayer pSender, ChatType.Bound pBoundChatType) -
broadcastChatMessage
private void broadcastChatMessage(PlayerChatMessage pMessage, Predicate<ServerPlayer> pShouldFilterMessageTo, @Nullable ServerPlayer pSender, ChatType.Bound pBoundChatType) -
verifyChatTrusted
-
getPlayerStats
-
getPlayerAdvancements
-
setViewDistance
public void setViewDistance(int pViewDistance) -
setSimulationDistance
public void setSimulationDistance(int pSimulationDistance) -
getPlayers
-
getPlayer
Gets the ServerPlayer object representing the player with the UUID. -
canBypassPlayerLimit
public boolean canBypassPlayerLimit(com.mojang.authlib.GameProfile p_11298_) -
reloadResources
public void reloadResources() -
isAllowCommandsForAllPlayers
public boolean isAllowCommandsForAllPlayers()
-