Package net.minecraft.server.players
Class PlayerList
java.lang.Object
net.minecraft.server.players.PlayerList
- All Implemented Interfaces:
IPlayerListExtension
- 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 pServer, LayeredRegistryAccess<RegistryLayer> pRegistries, PlayerDataStorage pPlayerIo, int pMaxPlayers) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddWorldborderListener(ServerLevel pLevel) voidbroadcast(Player pExcept, double pX, double pY, double pZ, double pRadius, ResourceKey<Level> pDimension, Packet<?> pPacket) voidbroadcastAll(Packet<?> pPacket) voidbroadcastAll(Packet<?> pPacket, ResourceKey<Level> pDimension) private voidbroadcastChatMessage(PlayerChatMessage pMessage, Predicate<ServerPlayer> pShouldFilterMessageTo, ServerPlayer pSender, ChatType.Bound pBoundChatType) voidbroadcastChatMessage(PlayerChatMessage pMessage, CommandSourceStack pSender, ChatType.Bound pBoundChatType) voidbroadcastChatMessage(PlayerChatMessage pMessage, ServerPlayer pSender, ChatType.Bound pBoundChatType) voidbroadcastSystemMessage(Component pMessage, boolean pBypassHiddenChat) voidbroadcastSystemMessage(Component pServerMessage, Function<ServerPlayer, Component> pPlayerMessageFactory, boolean pBypassHiddenChat) voidbroadcastSystemToAllExceptTeam(Player pPlayer, Component pMessage) voidbroadcastSystemToTeam(Player pPlayer, Component pMessage) booleancanBypassPlayerLimit(com.mojang.authlib.GameProfile pProfile) canPlayerLogin(SocketAddress pSocketAddress, com.mojang.authlib.GameProfile pGameProfile) voiddeop(com.mojang.authlib.GameProfile pProfile) booleandisconnectAllPlayersWithProfile(com.mojang.authlib.GameProfile pGameProfile) getBans()intString[]getOps()Gets the ServerPlayer object representing the player with the UUID.getPlayerAdvancements(ServerPlayer pPlayer) getPlayerByName(String pUsername) intString[]getPlayerStats(Player pPlayer) getPlayersWithAddress(String pAddress) intintString[]booleanbooleanisOp(com.mojang.authlib.GameProfile pProfile) booleanbooleanisWhiteListed(com.mojang.authlib.GameProfile pProfile) load(ServerPlayer pPlayer, ProblemReporter pProblemReporter) voidop(com.mojang.authlib.GameProfile pProfile) voidplaceNewPlayer(Connection pConnection, ServerPlayer pPlayer, CommonListenerCookie pCookie) voidvoidvoidremove(ServerPlayer pPlayer) Called when a player disconnects from the game.voidrespawn(ServerPlayer pPlayer, boolean pKeepInventory, Entity.RemovalReason pReason) protected voidsave(ServerPlayer pPlayer) Also stores the NBTTags if this is an IntegratedPlayerList.voidsaveAll()voidsendActiveEffects(LivingEntity pEntity, ServerGamePacketListenerImpl pConnection) voidsendActivePlayerEffects(ServerPlayer pPlayer) voidsendAllPlayerInfo(ServerPlayer pPlayer) Sends the players inventory to himself.voidsendLevelInfo(ServerPlayer pPlayer, ServerLevel pLevel) Updates the time and weather for the given player to those of the given worldvoidsendPlayerPermissionLevel(ServerPlayer pPlayer) private voidsendPlayerPermissionLevel(ServerPlayer pPlayer, int pPermLevel) voidsetAllowCommandsForAllPlayers(boolean pAllowCommandsForAllPlayers) voidsetSimulationDistance(int pSimulationDistance) voidsetUsingWhiteList(boolean pWhitelistEnabled) voidsetViewDistance(int pViewDistance) voidtick()protected voidupdateEntireScoreboard(ServerScoreboard pScoreboard, ServerPlayer pPlayer) private booleanverifyChatTrusted(PlayerChatMessage pMessage) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface net.neoforged.neoforge.common.extensions.IPlayerListExtension
broadcast, broadcast, broadcastAll, broadcastAll, self
-
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 pSocketAddress, com.mojang.authlib.GameProfile pGameProfile) -
disconnectAllPlayersWithProfile
public boolean disconnectAllPlayersWithProfile(com.mojang.authlib.GameProfile pGameProfile) -
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 pProfile) -
deop
public void deop(com.mojang.authlib.GameProfile pProfile) -
sendPlayerPermissionLevel
-
isWhiteListed
public boolean isWhiteListed(com.mojang.authlib.GameProfile pProfile) -
isOp
public boolean isOp(com.mojang.authlib.GameProfile pProfile) -
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 pProfile) -
reloadResources
public void reloadResources() -
isAllowCommandsForAllPlayers
public boolean isAllowCommandsForAllPlayers()
-