Class WorldResourcepacks
java.lang.Object
org.bukkit.plugin.PluginBase
org.bukkit.plugin.java.JavaPlugin
de.themoep.resourcepacksplugin.bukkit.WorldResourcepacks
- All Implemented Interfaces:
ResourcepacksPlugin
,org.bukkit.command.CommandExecutor
,org.bukkit.command.TabCompleter
,org.bukkit.command.TabExecutor
,org.bukkit.plugin.Plugin
public class WorldResourcepacks
extends org.bukkit.plugin.java.JavaPlugin
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
(org.bukkit.entity.Player player) net.md_5.bungee.api.chat.BaseComponent[]
getComponents
(ResourcepacksPlayer sender, String key, String... replacements) Get message components from the language configgetConfigMap
(Object configuration) Convert a configuration object to a mapprotected de.themoep.resourcepacksplugin.bukkit.internal.InternalHelper
Get the internal helperThe debug log levelgetMessage
(ResourcepacksPlayer sender, String key, String... replacements) Get a message from the language configSubChannelHandler<org.bukkit.entity.Player>
Get the handler for sub channels that listens on the "rp:plugin" channel to register new sub channelsint
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
(org.bukkit.entity.Player 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 storedorg.bukkit.configuration.ConfigurationSection
Get 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 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
void
onEnable()
protected void
registerCommand
(PluginCommandExecutor executor) 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
removePack
(org.bukkit.entity.Player player, ResourcePack pack) void
removePacks
(UUID playerId) void
removePacks
(org.bukkit.entity.Player player) void
resendPack
(UUID playerId) Resends the pack that corresponds to the player's servervoid
resendPack
(org.bukkit.entity.Player player) Resends the pack that corresponds to the player's worldint
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 packPlayer, 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
sendPack
(org.bukkit.entity.Player player, ResourcePack pack) Set the resourcepack of a connected playervoid
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 resetMethods inherited from class org.bukkit.plugin.java.JavaPlugin
getClassLoader, getCommand, getConfig, getDataFolder, getDefaultBiomeProvider, getDefaultWorldGenerator, getDescription, getFile, getLogger, getPlugin, getPluginLoader, getProvidingPlugin, getResource, getServer, getTextResource, isEnabled, isNaggable, onCommand, onLoad, onTabComplete, reloadConfig, saveConfig, saveDefaultConfig, saveResource, setEnabled, setNaggable, toString
Methods inherited from class org.bukkit.plugin.PluginBase
equals, getName, hashCode
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface de.themoep.resourcepacksplugin.core.ResourcepacksPlugin
getDataFolder, getMessage, getMessage, getName, getPlayerPackFormat, isEnabled, startupMessage, supportsMultiplePacks
-
Field Details
-
pluginCommand
-
-
Constructor Details
-
WorldResourcepacks
public WorldResourcepacks()
-
-
Method Details
-
onEnable
public void onEnable()- Specified by:
onEnable
in interfaceorg.bukkit.plugin.Plugin
- Overrides:
onEnable
in classorg.bukkit.plugin.java.JavaPlugin
-
onDisable
public void onDisable()- Specified by:
onDisable
in interfaceorg.bukkit.plugin.Plugin
- Overrides:
onDisable
in classorg.bukkit.plugin.java.JavaPlugin
-
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 org.bukkit.configuration.ConfigurationSection 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
-
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
-
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
-
resendPack
public void resendPack(org.bukkit.entity.Player player) Resends the pack that corresponds to the player's world- Parameters:
player
- The player to set the pack 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
-
sendPack
Set the resourcepack of a connected player- Parameters:
player
- The ProxiedPlayer to set the pack forpack
- The resourcepack to set for the player
-
removePacks
-
removePacks
public void removePacks(org.bukkit.entity.Player 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
-
removePack
-
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.
-
clearPack
public void clearPack(org.bukkit.entity.Player player) -
getPackManager
- Specified by:
getPackManager
in interfaceResourcepacksPlugin
-
getUserManager
- Specified by:
getUserManager
in interfaceResourcepacksPlugin
-
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
-
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 packPlayer, Level level, String key, String... replacements) Description copied from interface:ResourcepacksPlugin
Send a message to a sender- Specified by:
sendMessage
in interfaceResourcepacksPlugin
- Parameters:
packPlayer
- 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
-
getMessageChannelHandler
Get the handler for sub channels that listens on the "rp:plugin" channel to register new sub channels- Returns:
- The message channel handler
-
getInternalHelper
protected de.themoep.resourcepacksplugin.bukkit.internal.InternalHelper getInternalHelper()Get the internal helper- Returns:
- The internal helper
-