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
ChatPluginServerPlayers and enabled worlds.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionGets the online Bedrock players' UUIDs.Gets the list of the enabled worlds.static ServerPlayerManagerGets this manager's instance.Deprecated.Names should not be used to identify players.Gets a player fromgetPlayers()by their UUID.static LonggetPlayerLoginTime(UUID player) Gets an online player's login time.Gets the loadedChatPluginServerPlayers' map.getPlayers(InetAddress ipAddress) Gets the list of loadedChatPluginServerPlayers with the specified IP address.Gets the online players' login times.static Map<UUID, VersionUtils.Version> Gets the online players' versions.static VersionUtils.VersiongetPlayerVersion(UUID player) Gets an online player's version.intGets the total amount of players stored in the storage.static booleanisBedrockPlayer(UUID player) Checks if the specified player is connected through aMultiPlatformIntegration.booleanisWorldEnabled(String world) Checks if a world is contained in the enabled worlds' list.voidload()Loads (or reloads) this manager.abstract intloadPlayer(PlayerAdapter player) Adds a player togetPlayers().voidsetStorageCount(int storageCount) Sets the amount of players stored in the storage.voidunload()Unloads this manager.abstract intunloadPlayer(UUID player) Removes a player fromgetPlayers().Methods inherited from class me.remigio07.chatplugin.api.common.player.PlayerManager
getDisplayedTimeZone, getFloodgateUsernamePrefix, getPlayersIPs, getPlayersNames, getUsernamePattern, isEnabled, isValidUsername, loadOnlinePlayersMethods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods 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:ChatPluginManagerLoads (or reloads) this manager.- Specified by:
loadin interfaceChatPluginManager- Overrides:
loadin classPlayerManager- Throws:
ChatPluginManagerException- If something goes wrong
-
unload
public void unload()Description copied from interface:ChatPluginManagerUnloads this manager.Will do nothing if this method is not overridden.
- Specified by:
unloadin interfaceChatPluginManager- Overrides:
unloadin classPlayerManager
-
getPlayers
Gets the loadedChatPluginServerPlayers' map.Do not modify the returned map.
- Specified by:
getPlayersin classPlayerManager- Returns:
- Loaded players' map
- See Also:
-
getPlayers
Gets the list of loadedChatPluginServerPlayers with the specified IP address.- Specified by:
getPlayersin classPlayerManager- Parameters:
ipAddress- IP address to check- Returns:
- Loaded players' map
- See Also:
-
getPlayer
Gets a player fromgetPlayers()by their UUID.Will return
nullif the player is not loaded.- Specified by:
getPlayerin 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
nullif the player is not loaded.- Specified by:
getPlayerin 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- IfcheckPatternand 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
nullif 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
nullif 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 aPlayerJoinpacket 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:
-