Class ServerPlayerManager
java.lang.Object
me.remigio07.chatplugin.api.common.player.PlayerManager
me.remigio07.chatplugin.api.server.player.ServerPlayerManager
- All Implemented Interfaces:
ChatPluginManager
Manager that handles
ChatPluginServerPlayer
s and enabled worlds.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionGets the online Bedrock players' UUIDs.Gets the list of the enabled worlds.static ServerPlayerManager
Gets this manager's instance.Deprecated.Names should not be used to identify players.Gets a player fromgetPlayers()
by their UUID.static Long
getPlayerLoginTime
(UUID player) Gets an online player's login time.Gets the loadedChatPluginServerPlayer
s' map.getPlayers
(InetAddress ipAddress) Gets the list of loadedChatPluginServerPlayer
s with the specified IP address.Gets the online players' login times.static Map
<UUID, VersionUtils.Version> Gets the online players' versions.static VersionUtils.Version
getPlayerVersion
(UUID player) Gets an online player's version.int
Gets the total amount of players stored in the storage.static boolean
isBedrockPlayer
(UUID player) Checks if the specified player is connected through aMultiPlatformIntegration
.boolean
isWorldEnabled
(String world) Checks if a world is contained in the enabled worlds' list.void
load()
Loads (or reloads) this manager.abstract int
loadPlayer
(PlayerAdapter player) Adds a player togetPlayers()
.void
setStorageCount
(int storageCount) Sets the amount of players stored in the storage.void
unload()
Unloads this manager.abstract int
unloadPlayer
(UUID player) Removes a player fromgetPlayers()
.Methods inherited from class me.remigio07.chatplugin.api.common.player.PlayerManager
getDisplayedTimeZone, getFloodgateUsernamePrefix, getPlayersIPs, getPlayersNames, getUsernamePattern, isEnabled, isValidUsername, loadOnlinePlayers
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface me.remigio07.chatplugin.api.common.util.manager.ChatPluginManager
checkAvailability, isReloadable, reload
-
Constructor Details
-
ServerPlayerManager
public ServerPlayerManager()
-
-
Method Details
-
load
Description copied from interface:ChatPluginManager
Loads (or reloads) this manager.- Specified by:
load
in interfaceChatPluginManager
- Overrides:
load
in classPlayerManager
- Throws:
ChatPluginManagerException
- If something goes wrong
-
unload
public void unload()Description copied from interface:ChatPluginManager
Unloads this manager.Will do nothing if this method is not overridden.
- Specified by:
unload
in interfaceChatPluginManager
- Overrides:
unload
in classPlayerManager
-
getPlayers
Gets the loadedChatPluginServerPlayer
s' map.Do not modify the returned map.
- Specified by:
getPlayers
in classPlayerManager
- Returns:
- Loaded players' map
- See Also:
-
getPlayers
Gets the list of loadedChatPluginServerPlayer
s with the specified IP address.- Specified by:
getPlayers
in classPlayerManager
- Parameters:
ipAddress
- IP address to check- Returns:
- Loaded players' map
- See Also:
-
getPlayer
Gets a player fromgetPlayers()
by their UUID.Will return
null
if the player is not loaded.- Specified by:
getPlayer
in classPlayerManager
- Parameters:
uuid
- Player to get- Returns:
- Loaded
ChatPluginServerPlayer
- See Also:
-
getPlayer
@Deprecated public ChatPluginServerPlayer getPlayer(String name, boolean checkPattern, boolean ignoreCase) Deprecated.Names should not be used to identify players. UsegetPlayer(UUID)
instead.Gets a player fromgetPlayers()
by their name.Will return
null
if the player is not loaded.- Specified by:
getPlayer
in classPlayerManager
- Parameters:
name
- Player to getcheckPattern
- Whether to check the name againstPlayerManager.getUsernamePattern()
ignoreCase
- Whether to ignore case when checking online players- Returns:
- Loaded
ChatPluginServerPlayer
- Throws:
IllegalArgumentException
- IfcheckPattern
and specified name!
PlayerManager.isValidUsername(String)
- See Also:
-
getEnabledWorlds
Gets the list of the enabled worlds.Found at: "settings.enabled-worlds" in
ConfigurationType.CONFIG
- Returns:
- List of enabled worlds
- See Also:
-
isWorldEnabled
Checks if a world is contained in the enabled worlds' list.Note: do not use this method to check if players are loaded. Players may be loaded in disabled worlds and unloaded in enabled worlds. Use
getPlayer(UUID)
to check whether a player is loaded or not.- Parameters:
world
- Name of the world to check- Returns:
- Whether the world is enabled
-
getStorageCount
public int getStorageCount()Gets the total amount of players stored in the storage.This value is only used to translate
{total_players}
.- Returns:
- Amount of players
-
setStorageCount
public void setStorageCount(int storageCount) Sets the amount of players stored in the storage.This value is only used to translate
{total_players}
.- Parameters:
storageCount
- Amount of players
-
getPlayersVersions
Gets the online players' versions.- Returns:
- Online players' versions
-
getPlayerVersion
Gets an online player's version.Will return
null
if they are not online.- Parameters:
player
- Player's UUID- Returns:
- Player's version
-
getPlayersLoginTimes
Gets the online players' login times.- Returns:
- Online players' login times
-
getPlayerLoginTime
Gets an online player's login time.Will return
null
if they are not online.- Parameters:
player
- Player's UUID- Returns:
- Player's login time
-
getBedrockPlayers
Gets the online Bedrock players' UUIDs.- Returns:
- Online Bedrock players' UUIDs
-
isBedrockPlayer
Checks if the specified player is connected through aMultiPlatformIntegration
.- Parameters:
player
- Player's UUID- Returns:
- Whether the player is using the BE
-
getInstance
Gets this manager's instance.- Returns:
- Manager's instance
-
loadPlayer
Adds a player togetPlayers()
.Will do nothing and return 0 if they are already loaded.
- Parameters:
player
- Player to load- Returns:
- Time elapsed, in milliseconds
- Throws:
IllegalStateException
- IfProxyManager.isEnabled()
and this server has not received aPlayerJoin
packet from the proxy containing information about the specified player's version- See Also:
-
unloadPlayer
Removes a player fromgetPlayers()
.Will do nothing and return 0 if they are not loaded.
- Parameters:
player
- Player to unload- Returns:
- Time elapsed, in milliseconds
- See Also:
-