Interface ResourcepacksPlugin
- All Known Implementing Classes:
BungeeResourcepacks
,VelocityResourcepacks
,WorldResourcepacks
public interface ResourcepacksPlugin
Created by Phoenix616 on 03.02.2016.
-
Method Summary
Modifier and TypeMethodDescriptioncallPackSelectEvent
(UUID playerId, List<ResourcePack> packs, IResourcePackSelectEvent.Status status) Call the ResourcePackSelectEvent on the corresponding servercallPackSendEvent
(UUID playerId, ResourcePack pack) Call the ResourcePackSendEvent on the corresponding serverboolean
checkPermission
(ResourcepacksPlayer resourcepacksPlayer, String perm) Check whether or not a player has a permissionboolean
checkPermission
(UUID playerId, String perm) Check whether or not a player has a permissionvoid
Clear the packs of a player stored in memory and sends that info to the other servers.getConfigMap
(Object configuration) Convert a configuration object to a mapThe debug log levelgetMessage
(ResourcepacksPlayer sender, String key, String... replacements) Get a message from the language configdefault String
getMessage
(String key) Deprecated.default String
getMessage
(String key, Map<String, String> replacements) Deprecated.getName()
Get the name of the pluginint
Get the time in which the permanent pack will be reset if the player disconnectsGet an online player by its nameGet an online player by its UUIDdefault ClientType
getPlayerClientType
(UUID playerId) Get the client type of a playerdefault int
getPlayerPackFormat
(UUID playerId) Get the format of the pack this player can maximally useint
getPlayerProtocol
(UUID playerId) Get the protocol version of a playergetStoredPack
(UUID playerId) Get the pack that a certain player has storedGet the version of the pluginboolean
hasMessage
(ResourcepacksPlayer sender, String key) Check whether or not the language config contains a certain messageboolean
isAuthenticated
(UUID playerId) Check whether or not a certain player is currently logged in with auth plugins (currently supports AuthMe Reloaded)boolean
Get whether the plugin successful enabled or notboolean
Get whether or not the default /usepack behaviour is to apply temporary opr permanentboolean
void
Log a message.void
Log a message.void
Log a debug messagevoid
Log a debug message with a stacktracevoid
reloadConfig
(boolean resend) Reloads the configuration from the file and resend the resource pack to all online playersvoid
removePack
(UUID playerId, ResourcePack pack) Remove a specific pack from a player.void
resendPack
(UUID playerId) Resends the pack that corresponds to the player's serverint
runAsyncTask
(Runnable runnable) Run a task asynchronouslyint
Run a sync taskvoid
Save changes made on runtime to the configboolean
sendMessage
(ResourcepacksPlayer player, String key, String... replacements) Send a message to a playerboolean
sendMessage
(ResourcepacksPlayer sender, Level level, String key, String... replacements) Send a message to a sendervoid
sendPack
(UUID playerId, ResourcePack pack) Internal method to send a resoucepack to a player, please usePackManager.setPack(UUID, ResourcePack)
!void
sendPackInfo
(UUID playerId) Send a plugin message to the server/proxy the player is connected to!void
setStoredPack
(UUID playerId, String packName) Set the pack that the player should get when logging in when no other pack applies and that gets used instead of the empty pack on resetdefault void
default boolean
supportsMultiplePacks
(UUID playerId) Check whether a player uses a version that supports multiple packs (starting with Java 1.20.3)
-
Method Details
-
startupMessage
default void startupMessage() -
loadConfig
boolean loadConfig() -
getConfigMap
Convert a configuration object to a map- Parameters:
configuration
- The configuration object- Returns:
- The configuration map or null if input was null or is not supported
-
reloadConfig
void reloadConfig(boolean resend) Reloads the configuration from the file and resend the resource pack to all online players- Parameters:
resend
- Whether or not all players should get their applicable pack resend
-
isEnabled
boolean isEnabled()Get whether the plugin successful enabled or not- Returns:
true
if the plugin was proberly enabled
-
resendPack
Resends the pack that corresponds to the player's server- Parameters:
playerId
- The UUID of the player to resend the pack for
-
sendPackInfo
Send a plugin message to the server/proxy the player is connected to!
- Parameters:
playerId
- The UUID of the player to send the pack info for
-
sendPack
Internal method to send a resoucepack to a player, please usePackManager.setPack(UUID, ResourcePack)
!- Parameters:
playerId
- The UUID of the player to send the pack topack
- The resourcepack to send to a player
-
removePack
Remove a specific pack from a player. Only works on 1.20.3+- Parameters:
playerId
- The UUID of the player to remove the pack frompack
- The pack to remove
-
clearPack
Clear the packs of a player stored in memory and sends that info to the other servers.
Does not remove from the client!- Parameters:
playerId
- The UUID of the player to clear the packs for.
-
getPackManager
PackManager getPackManager() -
getUserManager
UserManager getUserManager() -
getMessage
Deprecated.Get a message from the config- Parameters:
key
- The message's key- Returns:
- The defined message string or an error message if the variable isn't known.
-
getMessage
Deprecated.Get a message from the config and replace variables- Parameters:
key
- The message's keyreplacements
- The replacements in a mapping variable-replacement- Returns:
- The defined message string or an error message if the variable isn't known.
-
getMessage
Get a message from the language config- Parameters:
sender
- The sender to get the message from, will use the client language if availablekey
- The message keyreplacements
- Optional placeholder replacement array- Returns:
- The message or an error message if not available, never null
-
hasMessage
Check whether or not the language config contains a certain message- Parameters:
sender
- The senderkey
- The message key- Returns:
true
if the config contains the message;false
if not
-
getName
String getName()Get the name of the plugin- Returns:
- The plugin's name as a string
-
getVersion
String getVersion()Get the version of the plugin- Returns:
- The plugin's version as a string
-
getPluginLogger
PluginLogger getPluginLogger() -
getDataFolder
File getDataFolder() -
logDebug
Log a debug message- Parameters:
message
- The message
-
logDebug
Log a debug message with a stacktrace- Parameters:
message
- The messagethrowable
- The throwable
-
getLogLevel
Level getLogLevel()The debug log level- Returns:
- The debug log level
-
getPlayer
Get an online player by its UUID- Parameters:
playerId
- The player ID- Returns:
- The ResourcepacksPlayer
-
getPlayer
Get an online player by its name- Parameters:
playerName
- The player name- Returns:
- The ResourcepacksPlayer
-
sendMessage
Send a message to a player- Parameters:
player
- The playerkey
- The key of the message to sendreplacements
- An optional array with placeholder replacements- Returns:
true
if the message was sent;false
if the player was offline or the message empty
-
sendMessage
Send a message to a sender- Parameters:
sender
- The the senderlevel
- The level to log to if the sender is the console!key
- The key of the message to sendreplacements
- An optional array with placeholder replacements- Returns:
true
if the message was sent;false
if the player was offline or the message empty
-
log
Log a message. This strips out all color codes- Parameters:
level
- The level at which the message should be loggedmessage
- The message to log
-
log
Log a message. This strips out all color codes- Parameters:
level
- The level at which the message should be loggedmessage
- The message to logthrowable
- The error to log
-
checkPermission
Check whether or not a player has a permission- Parameters:
resourcepacksPlayer
- The player to checkperm
- The permission to check for- Returns:
true
if the player has the permission;false
if not
-
checkPermission
Check whether or not a player has a permission- Parameters:
playerId
- The UUID of the playerperm
- The permission to check for- Returns:
true
if the player has the permission;false
if not
-
getPlayerProtocol
Get the protocol version of a player- Parameters:
playerId
- The UUID of the player- Returns:
- The protocol version or -1 if the player isn't online
-
getPlayerPackFormat
Get the format of the pack this player can maximally use- Parameters:
playerId
- The UUID of the player- Returns:
- The pack format or -1 if the player isn't online
-
getPlayerClientType
Get the client type of a player- Parameters:
playerId
- The UUID of the player- Returns:
- The type of the player's client
-
callPackSelectEvent
IResourcePackSelectEvent callPackSelectEvent(UUID playerId, List<ResourcePack> packs, IResourcePackSelectEvent.Status status) Call the ResourcePackSelectEvent on the corresponding server- Parameters:
playerId
- The UUID of the playerpacks
- The ResourcePacks that were selected or an empty list if none were selectedstatus
- The status of the selection- Returns:
- The ResourcePackSelectEvent interface which might have been modified (especially the pack)
-
callPackSendEvent
Call the ResourcePackSendEvent on the corresponding server- Parameters:
playerId
- The UUID of the playerpack
- The ResourcePack that was send- Returns:
- The ResourcePackSendEvent interface which might have been modified or cancelled
-
isAuthenticated
Check whether or not a certain player is currently logged in with auth plugins (currently supports AuthMe Reloaded)- Parameters:
playerId
- The UUID of the player- Returns:
true
if he is loggedin;false
if not or the status is unknown
-
runTask
Run a sync task- Parameters:
runnable
- What to run- Returns:
- The task id
-
runAsyncTask
Run a task asynchronously- Parameters:
runnable
- What to run- Returns:
- The task id
-
saveConfigChanges
void saveConfigChanges()Save changes made on runtime to the config -
setStoredPack
Set the pack that the player should get when logging in when no other pack applies and that gets used instead of the empty pack on reset- Parameters:
playerId
- UUID of the playerpackName
- Name of the pack
-
getStoredPack
Get the pack that a certain player has stored- Parameters:
playerId
- The UUID of the player- Returns:
- The name of the pack or
null
if none was stored
-
isUsepackTemporary
boolean isUsepackTemporary()Get whether or not the default /usepack behaviour is to apply temporary opr permanent- Returns:
true
if it's temporary,false
if not
-
getPermanentPackRemoveTime
int getPermanentPackRemoveTime()Get the time in which the permanent pack will be reset if the player disconnects- Returns:
- The time in seconds; 0 or below should disable that
-
supportsMultiplePacks
Check whether a player uses a version that supports multiple packs (starting with Java 1.20.3)- Parameters:
playerId
- The UUID of the player- Returns:
- true or false
-
getMessage(ResourcepacksPlayer, String, String...)