Class PlayerManager
java.lang.Object
me.remigio07.chatplugin.api.common.player.PlayerManager
- All Implemented Interfaces:
ChatPluginManager
- Direct Known Subclasses:
ProxyPlayerManager
,ServerPlayerManager
Manager that handles
ChatPluginPlayer
s and OfflinePlayer
s.- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionGets the time zone displayed to players in messages.Gets the prefix added in front of Bedrock players' usernames to prevent duplicates.static PlayerManager
Gets this manager's instance.abstract ChatPluginPlayer
Deprecated.Names should not be used to identify players.abstract ChatPluginPlayer
Gets a player fromgetPlayers()
by their UUID.abstract Map
<UUID, ? extends ChatPluginPlayer> Gets the loadedChatPluginPlayer
s' map.abstract List
<? extends ChatPluginPlayer> getPlayers
(InetAddress ipAddress) Gets the list of loadedChatPluginPlayer
s with the specified IP address.Gets the list of loaded players' IP addresses.Gets the list of loaded players' names.Gets the pattern used to verify valid usernames.boolean
Checks if this manager is enabled.boolean
isValidUsername
(String username) Checks if the specified String is a valid username.void
load()
Loads (or reloads) this manager.abstract void
Loads all online players in the network (if run on a proxy) or in an enabled world (if run on a server).void
unload()
Unloads this manager.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
-
PlayerManager
public PlayerManager()
-
-
Method Details
-
load
Description copied from interface:ChatPluginManager
Loads (or reloads) this manager.- Specified by:
load
in interfaceChatPluginManager
- 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
-
isEnabled
public boolean isEnabled()Description copied from interface:ChatPluginManager
Checks if this manager is enabled.- Specified by:
isEnabled
in interfaceChatPluginManager
- Returns:
- Whether this manager is enabled
-
getPlayersNames
Gets the list of loaded players' names.- Returns:
- Enabled players' names
- See Also:
-
getPlayersIPs
Gets the list of loaded players' IP addresses.- Returns:
- Enabled players' IPs
- See Also:
-
getFloodgateUsernamePrefix
Gets the prefix added in front of Bedrock players' usernames to prevent duplicates.This method retrieves the prefix using Floodgate's
MultiPlatformIntegration.getUsernamePrefix()
or from "settings.floodgate-username-prefix" inConfigurationType.CONFIG
depending on the current environment.- Returns:
- Bedrock players' prefix
-
getUsernamePattern
Gets the pattern used to verify valid usernames.This will consider Bedrock players if Floodgate is installed or
getFloodgateUsernamePrefix()
depending on the current environment.- Returns:
- Username's pattern
-
isValidUsername
Checks if the specified String is a valid username.- Parameters:
username
- Username to check- Returns:
- Whether the specified username is valid
- See Also:
-
getDisplayedTimeZone
Gets the time zone displayed to players in messages.Found at: "settings.displayed-time-zone" in
ConfigurationType.CONFIG
- Returns:
- Displayed time zone
-
getInstance
Gets this manager's instance.- Returns:
- Manager's instance
-
getPlayers
Gets the loadedChatPluginPlayer
s' map.Do not modify the returned map.
- Returns:
- Loaded players' map
- See Also:
-
getPlayers
Gets the list of loadedChatPluginPlayer
s with the specified IP address.- 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.- Parameters:
uuid
- Player to get- Returns:
- Loaded
ChatPluginPlayer
- See Also:
-
getPlayer
@Deprecated public abstract ChatPluginPlayer 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.- Parameters:
name
- Player to getcheckPattern
- Whether to check the name againstgetUsernamePattern()
ignoreCase
- Whether to ignore case when checking online players- Returns:
- Loaded
ChatPluginPlayer
- Throws:
IllegalArgumentException
- IfcheckPattern
and specified name!
isValidUsername(String)
- See Also:
-
loadOnlinePlayers
public abstract void loadOnlinePlayers()Loads all online players in the network (if run on a proxy) or in an enabled world (if run on a server).
-