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 booleanprivate static final SimpleDateFormatprivate final UserBanListstatic final Componentstatic final Componentstatic final Fileprivate final IpBanListprivate static final org.slf4j.Loggerstatic 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 ServerPlayer 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, NotificationService notificationService) -
Method Summary
Modifier and TypeMethodDescriptionvoidvoidbroadcast(@Nullable 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, @Nullable 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 overlay) voidbroadcastSystemMessage(Component serverMessage, Function<ServerPlayer, Component> playerMessageFactory, boolean overlay) voidbroadcastSystemToAllExceptTeam(Player player, Component message) voidbroadcastSystemToTeam(Player player, Component message) booleancanBypassPlayerLimit(NameAndId nameAndId) @Nullable ComponentcanPlayerLogin(SocketAddress address, NameAndId nameAndId) voidbooleangetBans()intString[]getOps()@Nullable ServerPlayer@Nullable ServerPlayerGets the ServerPlayer object representing the player with the UUID.getPlayerAdvancements(ServerPlayer player) @Nullable ServerPlayergetPlayerByName(String username) intString[]getPlayerStats(Player player) getPlayersWithAddress(String address) int@Nullable CompoundTagintString[]booleanbooleanbooleanbooleanisWhiteListed(NameAndId nameAndId) loadPlayerData(NameAndId nameAndId) private PathlocateStatsFile(com.mojang.authlib.GameProfile profile) voidvoidop(NameAndId nameAndId, Optional<LevelBasedPermissionSet> permissionLevel, Optional<Boolean> canBypassPlayerLimit) 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 tags if this is an IntegratedPlayerList.voidsaveAll()voidsendActiveEffects(LivingEntity entity, ServerGamePacketListenerImpl connection) voidsendActivePlayerEffects(ServerPlayer player) voidsendAllPlayerInfo(ServerPlayer player) Sends the player's 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, LevelBasedPermissionSet permissions) voidsetAllowCommandsForAllPlayers(boolean allowCommandsForAllPlayers) voidsetSimulationDistance(int simulationDistance) voidsetViewDistance(int viewDistance) voidtick()protected voidupdateEntireScoreboard(ServerScoreboard scoreboard, ServerPlayer player) private booleanverifyChatTrusted(PlayerChatMessage message) 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 ServerPlayer objects. -
bans
-
ipBans
-
ops
-
whitelist
-
stats
-
advancements
-
playerIo
-
registries
-
viewDistance
private int viewDistance -
simulationDistance
private int simulationDistance -
allowCommandsForAllPlayers
private boolean allowCommandsForAllPlayers -
sendAllPlayerInfoIn
private int sendAllPlayerInfoIn -
playersView
-
-
Constructor Details
-
PlayerList
public PlayerList(MinecraftServer server, LayeredRegistryAccess<RegistryLayer> registries, PlayerDataStorage playerIo, NotificationService notificationService)
-
-
Method Details
-
placeNewPlayer
-
updateEntireScoreboard
-
addWorldborderListener
-
loadPlayerData
-
save
Also stores the tags 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
-
disconnectAllPlayersWithProfile
-
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
-
op
public void op(NameAndId nameAndId, Optional<LevelBasedPermissionSet> permissionLevel, Optional<Boolean> canBypassPlayerLimit) -
deop
-
sendPlayerPermissionLevel
-
isWhiteListed
-
isOp
-
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 player's inventory to himself. -
getPlayerCount
public int getPlayerCount() -
getMaxPlayers
public int getMaxPlayers() -
isUsingWhitelist
public boolean isUsingWhitelist() -
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 overlay) -
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
-
locateStatsFile
-
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. -
getPlayer
-
canBypassPlayerLimit
-
reloadResources
public void reloadResources() -
isAllowCommandsForAllPlayers
public boolean isAllowCommandsForAllPlayers() -
getPlayerIo
-