Class BungeeResourcepacks
java.lang.Object
net.md_5.bungee.api.plugin.Plugin
de.themoep.resourcepacksplugin.bungee.BungeeResourcepacks
- All Implemented Interfaces:
ResourcepacksPlugin
public class BungeeResourcepacks
extends net.md_5.bungee.api.plugin.Plugin
implements ResourcepacksPlugin
Created by Phoenix616 on 18.03.2015.
-
Field Summary
-
Constructor Summary
-
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 player, 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.void
clearPack
(net.md_5.bungee.api.connection.ProxiedPlayer player) int
net.md_5.bungee.api.chat.BaseComponent[]
getComponents
(ResourcepacksPlayer sender, String key, String... replacements) Get message components from the language configde.themoep.bungeeplugin.FileConfiguration
getConfigMap
(Object configuration) Convert a configuration object to a mapstatic BungeeResourcepacks
The debug log levelgetMessage
(ResourcepacksPlayer sender, String key, String... replacements) Get a message from the language configSubChannelHandler<net.md_5.bungee.api.connection.Server>
Get the handler for sub channels that listens on the "rp:plugin" channel to register new sub channelsgetName()
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 UUIDgetPlayer
(net.md_5.bungee.api.connection.ProxiedPlayer player) getPlayerClientType
(UUID playerId) Get the client type of a playerint
getPlayerProtocol
(UUID playerId) Get the protocol version of a playergetStoredPack
(UUID playerId) Get the pack that a certain player has storednet.md_5.bungee.config.Configuration
Get the version of the pluginboolean
hasBackend
(UUID playerId) Check if a player has a pack set by a backend serverboolean
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
onEnable()
protected void
registerCommand
(PluginCommandExecutor executor) protected boolean
registerPacket
(net.md_5.bungee.protocol.Protocol protocol, String directionName, Class<? extends net.md_5.bungee.protocol.DefinedPacket> packetClass, Supplier<? extends net.md_5.bungee.protocol.DefinedPacket> constructor) void
reloadConfig
(boolean resend) Reloads the configuration from the file and resends 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 servervoid
resendPack
(net.md_5.bungee.api.connection.ProxiedPlayer player) 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 player, 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)
!protected void
sendPack
(net.md_5.bungee.api.connection.ProxiedPlayer player, ResourcePack pack) Send a resourcepack to a connected playervoid
sendPackInfo
(UUID playerId) Send a plugin message to the server/proxy the player is connected to!void
setAuthenticated
(UUID playerId, boolean b) void
setBackend
(UUID playerId) Add a player's UUID to the list of players with a backend packvoid
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 resetvoid
unsetBackend
(UUID playerId) Remove a player's UUID from the list of players with a backend packMethods inherited from class net.md_5.bungee.api.plugin.Plugin
getDataFolder, getDescription, getExecutorService, getFile, getLogger, getProxy, getResourceAsStream, onDisable, onLoad
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface de.themoep.resourcepacksplugin.core.ResourcepacksPlugin
getDataFolder, getMessage, getMessage, getPlayerPackFormat, startupMessage, supportsMultiplePacks
-
Field Details
-
pluginCommand
-
-
Constructor Details
-
BungeeResourcepacks
public BungeeResourcepacks()
-
-
Method Details
-
onEnable
public void onEnable()- Overrides:
onEnable
in classnet.md_5.bungee.api.plugin.Plugin
-
registerPacket
-
registerCommand
-
loadConfig
public boolean loadConfig()- Specified by:
loadConfig
in interfaceResourcepacksPlugin
-
getConfigMap
Description copied from interface:ResourcepacksPlugin
Convert a configuration object to a map- Specified by:
getConfigMap
in interfaceResourcepacksPlugin
- Parameters:
configuration
- The configuration object- Returns:
- The configuration map or null if input was null or is not supported
-
reloadConfig
public void reloadConfig(boolean resend) Reloads the configuration from the file and resends the resource pack to all online players- Specified by:
reloadConfig
in interfaceResourcepacksPlugin
- Parameters:
resend
- Whether or not all players should get their applicable pack resend
-
saveConfigChanges
public void saveConfigChanges()Description copied from interface:ResourcepacksPlugin
Save changes made on runtime to the config- Specified by:
saveConfigChanges
in interfaceResourcepacksPlugin
-
setStoredPack
Description copied from interface:ResourcepacksPlugin
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- Specified by:
setStoredPack
in interfaceResourcepacksPlugin
- Parameters:
playerId
- UUID of the playerpackName
- Name of the pack
-
getStoredPack
Description copied from interface:ResourcepacksPlugin
Get the pack that a certain player has stored- Specified by:
getStoredPack
in interfaceResourcepacksPlugin
- Parameters:
playerId
- The UUID of the player- Returns:
- The name of the pack or
null
if none was stored
-
getStoredPacks
public net.md_5.bungee.config.Configuration getStoredPacks() -
isUsepackTemporary
public boolean isUsepackTemporary()Description copied from interface:ResourcepacksPlugin
Get whether or not the default /usepack behaviour is to apply temporary opr permanent- Specified by:
isUsepackTemporary
in interfaceResourcepacksPlugin
- Returns:
true
if it's temporary,false
if not
-
getPermanentPackRemoveTime
public int getPermanentPackRemoveTime()Description copied from interface:ResourcepacksPlugin
Get the time in which the permanent pack will be reset if the player disconnects- Specified by:
getPermanentPackRemoveTime
in interfaceResourcepacksPlugin
- Returns:
- The time in seconds; 0 or below should disable that
-
getInstance
-
getConfig
public de.themoep.bungeeplugin.FileConfiguration getConfig() -
isEnabled
public boolean isEnabled()Get whether the plugin successful enabled or not- Specified by:
isEnabled
in interfaceResourcepacksPlugin
- Returns:
- Whether or not the plugin was enabled
-
resendPack
public void resendPack(net.md_5.bungee.api.connection.ProxiedPlayer player) Resends the pack that corresponds to the player's server- Parameters:
player
- The player to set the pack for
-
resendPack
Description copied from interface:ResourcepacksPlugin
Resends the pack that corresponds to the player's server- Specified by:
resendPack
in interfaceResourcepacksPlugin
- Parameters:
playerId
- The UUID of the player to resend the pack for
-
sendPack
Send a resourcepack to a connected player- Parameters:
player
- The ProxiedPlayer to send the pack topack
- The resourcepack to send the pack to
-
sendPackInfo
Description copied from interface:ResourcepacksPlugin
Send a plugin message to the server/proxy the player is connected to!
- Specified by:
sendPackInfo
in interfaceResourcepacksPlugin
- Parameters:
playerId
- The UUID of the player to send the pack info for
-
sendPack
Description copied from interface:ResourcepacksPlugin
Internal method to send a resoucepack to a player, please usePackManager.setPack(UUID, ResourcePack)
!- Specified by:
sendPack
in interfaceResourcepacksPlugin
- Parameters:
playerId
- The UUID of the player to send the pack topack
- The resourcepack to send to a player
-
removePack
Description copied from interface:ResourcepacksPlugin
Remove a specific pack from a player. Only works on 1.20.3+- Specified by:
removePack
in interfaceResourcepacksPlugin
- Parameters:
playerId
- The UUID of the player to remove the pack frompack
- The pack to remove
-
clearPack
public void clearPack(net.md_5.bungee.api.connection.ProxiedPlayer player) -
clearPack
Description copied from interface:ResourcepacksPlugin
Clear the packs of a player stored in memory and sends that info to the other servers.
Does not remove from the client!- Specified by:
clearPack
in interfaceResourcepacksPlugin
- Parameters:
playerId
- The UUID of the player to clear the packs for.
-
getPackManager
- Specified by:
getPackManager
in interfaceResourcepacksPlugin
-
getUserManager
- Specified by:
getUserManager
in interfaceResourcepacksPlugin
-
setBackend
Add a player's UUID to the list of players with a backend pack- Parameters:
playerId
- The uuid of the player
-
unsetBackend
Remove a player's UUID from the list of players with a backend pack- Parameters:
playerId
- The uuid of the player
-
hasBackend
Check if a player has a pack set by a backend server- Parameters:
playerId
- The UUID of the player- Returns:
- If the player has a backend pack
-
getMessage
Description copied from interface:ResourcepacksPlugin
Get a message from the language config- Specified by:
getMessage
in interfaceResourcepacksPlugin
- 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
-
getComponents
public net.md_5.bungee.api.chat.BaseComponent[] getComponents(ResourcepacksPlayer sender, String key, String... replacements) Get message components 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 components or an error message if not available, never null
-
hasMessage
Description copied from interface:ResourcepacksPlugin
Check whether or not the language config contains a certain message- Specified by:
hasMessage
in interfaceResourcepacksPlugin
- Parameters:
sender
- The senderkey
- The message key- Returns:
true
if the config contains the message;false
if not
-
getName
Description copied from interface:ResourcepacksPlugin
Get the name of the plugin- Specified by:
getName
in interfaceResourcepacksPlugin
- Returns:
- The plugin's name as a string
-
getVersion
Description copied from interface:ResourcepacksPlugin
Get the version of the plugin- Specified by:
getVersion
in interfaceResourcepacksPlugin
- Returns:
- The plugin's version as a string
-
getPluginLogger
- Specified by:
getPluginLogger
in interfaceResourcepacksPlugin
-
logDebug
Description copied from interface:ResourcepacksPlugin
Log a debug message- Specified by:
logDebug
in interfaceResourcepacksPlugin
- Parameters:
message
- The message
-
logDebug
Description copied from interface:ResourcepacksPlugin
Log a debug message with a stacktrace- Specified by:
logDebug
in interfaceResourcepacksPlugin
- Parameters:
message
- The messagethrowable
- The throwable
-
getLogLevel
Description copied from interface:ResourcepacksPlugin
The debug log level- Specified by:
getLogLevel
in interfaceResourcepacksPlugin
- Returns:
- The debug log level
-
getPlayer
Description copied from interface:ResourcepacksPlugin
Get an online player by its UUID- Specified by:
getPlayer
in interfaceResourcepacksPlugin
- Parameters:
playerId
- The player ID- Returns:
- The ResourcepacksPlayer
-
getPlayer
Description copied from interface:ResourcepacksPlugin
Get an online player by its name- Specified by:
getPlayer
in interfaceResourcepacksPlugin
- Parameters:
playerName
- The player name- Returns:
- The ResourcepacksPlayer
-
getPlayer
-
sendMessage
Description copied from interface:ResourcepacksPlugin
Send a message to a player- Specified by:
sendMessage
in interfaceResourcepacksPlugin
- 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
public boolean sendMessage(ResourcepacksPlayer player, Level level, String key, String... replacements) Description copied from interface:ResourcepacksPlugin
Send a message to a sender- Specified by:
sendMessage
in interfaceResourcepacksPlugin
- Parameters:
player
- 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
Description copied from interface:ResourcepacksPlugin
Log a message. This strips out all color codes- Specified by:
log
in interfaceResourcepacksPlugin
- Parameters:
level
- The level at which the message should be loggedmessage
- The message to log
-
log
Description copied from interface:ResourcepacksPlugin
Log a message. This strips out all color codes- Specified by:
log
in interfaceResourcepacksPlugin
- Parameters:
level
- The level at which the message should be loggedmessage
- The message to logthrowable
- The error to log
-
checkPermission
Description copied from interface:ResourcepacksPlugin
Check whether or not a player has a permission- Specified by:
checkPermission
in interfaceResourcepacksPlugin
- Parameters:
player
- The player to checkperm
- The permission to check for- Returns:
true
if the player has the permission;false
if not
-
checkPermission
Description copied from interface:ResourcepacksPlugin
Check whether or not a player has a permission- Specified by:
checkPermission
in interfaceResourcepacksPlugin
- Parameters:
playerId
- The UUID of the playerperm
- The permission to check for- Returns:
true
if the player has the permission;false
if not
-
getPlayerProtocol
Description copied from interface:ResourcepacksPlugin
Get the protocol version of a player- Specified by:
getPlayerProtocol
in interfaceResourcepacksPlugin
- Parameters:
playerId
- The UUID of the player- Returns:
- The protocol version or -1 if the player isn't online
-
getPlayerClientType
Description copied from interface:ResourcepacksPlugin
Get the client type of a player- Specified by:
getPlayerClientType
in interfaceResourcepacksPlugin
- Parameters:
playerId
- The UUID of the player- Returns:
- The type of the player's client
-
callPackSelectEvent
public IResourcePackSelectEvent callPackSelectEvent(UUID playerId, List<ResourcePack> packs, IResourcePackSelectEvent.Status status) Description copied from interface:ResourcepacksPlugin
Call the ResourcePackSelectEvent on the corresponding server- Specified by:
callPackSelectEvent
in interfaceResourcepacksPlugin
- 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
Description copied from interface:ResourcepacksPlugin
Call the ResourcePackSendEvent on the corresponding server- Specified by:
callPackSendEvent
in interfaceResourcepacksPlugin
- Parameters:
playerId
- The UUID of the playerpack
- The ResourcePack that was send- Returns:
- The ResourcePackSendEvent interface which might have been modified or cancelled
-
isAuthenticated
Description copied from interface:ResourcepacksPlugin
Check whether or not a certain player is currently logged in with auth plugins (currently supports AuthMe Reloaded)- Specified by:
isAuthenticated
in interfaceResourcepacksPlugin
- Parameters:
playerId
- The UUID of the player- Returns:
true
if he is loggedin;false
if not or the status is unknown
-
runTask
Description copied from interface:ResourcepacksPlugin
Run a sync task- Specified by:
runTask
in interfaceResourcepacksPlugin
- Parameters:
runnable
- What to run- Returns:
- The task id
-
runAsyncTask
Description copied from interface:ResourcepacksPlugin
Run a task asynchronously- Specified by:
runAsyncTask
in interfaceResourcepacksPlugin
- Parameters:
runnable
- What to run- Returns:
- The task id
-
setAuthenticated
-
getBungeeVersion
public int getBungeeVersion() -
getMessageChannelHandler
Get the handler for sub channels that listens on the "rp:plugin" channel to register new sub channels- Returns:
- The message channel handler
-