Interface ResourcepacksPlugin

All Known Implementing Classes:
BungeeResourcepacks, VelocityResourcepacks, WorldResourcepacks

public interface ResourcepacksPlugin
Created by Phoenix616 on 03.02.2016.
  • Method Details

    • startupMessage

      default void startupMessage()
    • loadConfig

      boolean loadConfig()
    • getConfigMap

      Map<String,Object> getConfigMap(Object configuration)
      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

      void resendPack(UUID playerId)
      Resends the pack that corresponds to the player's server
      Parameters:
      playerId - The UUID of the player to resend the pack for
    • sendPackInfo

      void sendPackInfo(UUID playerId)

      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

      void sendPack(UUID playerId, ResourcePack pack)
      Internal method to send a resoucepack to a player, please use PackManager.setPack(UUID, ResourcePack)!
      Parameters:
      playerId - The UUID of the player to send the pack to
      pack - The resourcepack to send to a player
    • removePack

      void removePack(UUID playerId, ResourcePack pack)
      Remove a specific pack from a player. Only works on 1.20.3+
      Parameters:
      playerId - The UUID of the player to remove the pack from
      pack - The pack to remove
    • clearPack

      void clearPack(UUID playerId)
      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 default String getMessage(String key)
      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 default String getMessage(String key, Map<String,String> replacements)
      Get a message from the config and replace variables
      Parameters:
      key - The message's key
      replacements - The replacements in a mapping variable-replacement
      Returns:
      The defined message string or an error message if the variable isn't known.
    • getMessage

      String getMessage(ResourcepacksPlayer sender, String key, String... replacements)
      Get a message from the language config
      Parameters:
      sender - The sender to get the message from, will use the client language if available
      key - The message key
      replacements - Optional placeholder replacement array
      Returns:
      The message or an error message if not available, never null
    • hasMessage

      boolean hasMessage(ResourcepacksPlayer sender, String key)
      Check whether or not the language config contains a certain message
      Parameters:
      sender - The sender
      key - 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

      void logDebug(String message)
      Log a debug message
      Parameters:
      message - The message
    • logDebug

      void logDebug(String message, Throwable throwable)
      Log a debug message with a stacktrace
      Parameters:
      message - The message
      throwable - The throwable
    • getLogLevel

      Level getLogLevel()
      The debug log level
      Returns:
      The debug log level
    • getPlayer

      ResourcepacksPlayer getPlayer(UUID playerId)
      Get an online player by its UUID
      Parameters:
      playerId - The player ID
      Returns:
      The ResourcepacksPlayer
    • getPlayer

      ResourcepacksPlayer getPlayer(String playerName)
      Get an online player by its name
      Parameters:
      playerName - The player name
      Returns:
      The ResourcepacksPlayer
    • sendMessage

      boolean sendMessage(ResourcepacksPlayer player, String key, String... replacements)
      Send a message to a player
      Parameters:
      player - The player
      key - The key of the message to send
      replacements - An optional array with placeholder replacements
      Returns:
      true if the message was sent; false if the player was offline or the message empty
    • sendMessage

      boolean sendMessage(ResourcepacksPlayer sender, Level level, String key, String... replacements)
      Send a message to a sender
      Parameters:
      sender - The the sender
      level - The level to log to if the sender is the console!
      key - The key of the message to send
      replacements - An optional array with placeholder replacements
      Returns:
      true if the message was sent; false if the player was offline or the message empty
    • log

      void log(Level level, String message)
      Log a message. This strips out all color codes
      Parameters:
      level - The level at which the message should be logged
      message - The message to log
    • log

      void log(Level level, String message, Throwable throwable)
      Log a message. This strips out all color codes
      Parameters:
      level - The level at which the message should be logged
      message - The message to log
      throwable - The error to log
    • checkPermission

      boolean checkPermission(ResourcepacksPlayer resourcepacksPlayer, String perm)
      Check whether or not a player has a permission
      Parameters:
      resourcepacksPlayer - The player to check
      perm - The permission to check for
      Returns:
      true if the player has the permission; false if not
    • checkPermission

      boolean checkPermission(UUID playerId, String perm)
      Check whether or not a player has a permission
      Parameters:
      playerId - The UUID of the player
      perm - The permission to check for
      Returns:
      true if the player has the permission; false if not
    • getPlayerProtocol

      int getPlayerProtocol(UUID playerId)
      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

      default int getPlayerPackFormat(UUID playerId)
      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

      default ClientType getPlayerClientType(UUID playerId)
      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 player
      packs - The ResourcePacks that were selected or an empty list if none were selected
      status - The status of the selection
      Returns:
      The ResourcePackSelectEvent interface which might have been modified (especially the pack)
    • callPackSendEvent

      IResourcePackSendEvent callPackSendEvent(UUID playerId, ResourcePack pack)
      Call the ResourcePackSendEvent on the corresponding server
      Parameters:
      playerId - The UUID of the player
      pack - The ResourcePack that was send
      Returns:
      The ResourcePackSendEvent interface which might have been modified or cancelled
    • isAuthenticated

      boolean isAuthenticated(UUID playerId)
      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

      int runTask(Runnable runnable)
      Run a sync task
      Parameters:
      runnable - What to run
      Returns:
      The task id
    • runAsyncTask

      int runAsyncTask(Runnable runnable)
      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

      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 reset
      Parameters:
      playerId - UUID of the player
      packName - Name of the pack
    • getStoredPack

      String getStoredPack(UUID playerId)
      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

      default boolean supportsMultiplePacks(UUID playerId)
      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