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 Details

  • Constructor Details

    • WorldResourcepacks

      public WorldResourcepacks()
  • Method Details

    • onEnable

      public void onEnable()
      Specified by:
      onEnable in interface org.bukkit.plugin.Plugin
      Overrides:
      onEnable in class org.bukkit.plugin.java.JavaPlugin
    • onDisable

      public void onDisable()
      Specified by:
      onDisable in interface org.bukkit.plugin.Plugin
      Overrides:
      onDisable in class org.bukkit.plugin.java.JavaPlugin
    • registerCommand

      protected void registerCommand(PluginCommandExecutor executor)
    • loadConfig

      public boolean loadConfig()
      Specified by:
      loadConfig in interface ResourcepacksPlugin
    • getConfigMap

      public Map<String,Object> getConfigMap(Object configuration)
      Description copied from interface: ResourcepacksPlugin
      Convert a configuration object to a map
      Specified by:
      getConfigMap in interface ResourcepacksPlugin
      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 interface ResourcepacksPlugin
      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 interface ResourcepacksPlugin
    • setStoredPack

      public void setStoredPack(UUID playerId, String packName)
      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 interface ResourcepacksPlugin
      Parameters:
      playerId - UUID of the player
      packName - Name of the pack
    • getStoredPack

      public String getStoredPack(UUID playerId)
      Description copied from interface: ResourcepacksPlugin
      Get the pack that a certain player has stored
      Specified by:
      getStoredPack in interface ResourcepacksPlugin
      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 interface ResourcepacksPlugin
      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 interface ResourcepacksPlugin
      Returns:
      The time in seconds; 0 or below should disable that
    • resendPack

      public void resendPack(UUID playerId)
      Description copied from interface: ResourcepacksPlugin
      Resends the pack that corresponds to the player's server
      Specified by:
      resendPack in interface ResourcepacksPlugin
      Parameters:
      playerId - The UUID of the player to resend the pack for
    • sendPackInfo

      public void sendPackInfo(UUID playerId)
      Description copied from interface: ResourcepacksPlugin

      Send a plugin message to the server/proxy the player is connected to!

      Specified by:
      sendPackInfo in interface ResourcepacksPlugin
      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

      public void sendPack(UUID playerId, ResourcePack pack)
      Description copied from interface: ResourcepacksPlugin
      Internal method to send a resoucepack to a player, please use PackManager.setPack(UUID, ResourcePack)!
      Specified by:
      sendPack in interface ResourcepacksPlugin
      Parameters:
      playerId - The UUID of the player to send the pack to
      pack - The resourcepack to send to a player
    • sendPack

      public void sendPack(org.bukkit.entity.Player player, ResourcePack pack)
      Set the resourcepack of a connected player
      Parameters:
      player - The ProxiedPlayer to set the pack for
      pack - The resourcepack to set for the player
    • removePacks

      public void removePacks(UUID playerId)
    • removePacks

      public void removePacks(org.bukkit.entity.Player player)
    • removePack

      public void removePack(UUID playerId, ResourcePack pack)
      Description copied from interface: ResourcepacksPlugin
      Remove a specific pack from a player. Only works on 1.20.3+
      Specified by:
      removePack in interface ResourcepacksPlugin
      Parameters:
      playerId - The UUID of the player to remove the pack from
      pack - The pack to remove
    • removePack

      public void removePack(org.bukkit.entity.Player player, ResourcePack pack)
    • clearPack

      public void clearPack(UUID playerId)
      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 interface ResourcepacksPlugin
      Parameters:
      playerId - The UUID of the player to clear the packs for.
    • clearPack

      public void clearPack(org.bukkit.entity.Player player)
    • getPackManager

      public PackManager getPackManager()
      Specified by:
      getPackManager in interface ResourcepacksPlugin
    • getUserManager

      public UserManager getUserManager()
      Specified by:
      getUserManager in interface ResourcepacksPlugin
    • getMessage

      public String getMessage(ResourcepacksPlayer sender, String key, String... replacements)
      Description copied from interface: ResourcepacksPlugin
      Get a message from the language config
      Specified by:
      getMessage in interface ResourcepacksPlugin
      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
    • 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 available
      key - The message key
      replacements - Optional placeholder replacement array
      Returns:
      The components or an error message if not available, never null
    • hasMessage

      public boolean hasMessage(ResourcepacksPlayer sender, String key)
      Description copied from interface: ResourcepacksPlugin
      Check whether or not the language config contains a certain message
      Specified by:
      hasMessage in interface ResourcepacksPlugin
      Parameters:
      sender - The sender
      key - The message key
      Returns:
      true if the config contains the message; false if not
    • getVersion

      public String getVersion()
      Description copied from interface: ResourcepacksPlugin
      Get the version of the plugin
      Specified by:
      getVersion in interface ResourcepacksPlugin
      Returns:
      The plugin's version as a string
    • getPluginLogger

      public PluginLogger getPluginLogger()
      Specified by:
      getPluginLogger in interface ResourcepacksPlugin
    • logDebug

      public void logDebug(String message)
      Description copied from interface: ResourcepacksPlugin
      Log a debug message
      Specified by:
      logDebug in interface ResourcepacksPlugin
      Parameters:
      message - The message
    • logDebug

      public void logDebug(String message, Throwable throwable)
      Description copied from interface: ResourcepacksPlugin
      Log a debug message with a stacktrace
      Specified by:
      logDebug in interface ResourcepacksPlugin
      Parameters:
      message - The message
      throwable - The throwable
    • getLogLevel

      public Level getLogLevel()
      Description copied from interface: ResourcepacksPlugin
      The debug log level
      Specified by:
      getLogLevel in interface ResourcepacksPlugin
      Returns:
      The debug log level
    • getPlayer

      public ResourcepacksPlayer getPlayer(UUID playerId)
      Description copied from interface: ResourcepacksPlugin
      Get an online player by its UUID
      Specified by:
      getPlayer in interface ResourcepacksPlugin
      Parameters:
      playerId - The player ID
      Returns:
      The ResourcepacksPlayer
    • getPlayer

      public ResourcepacksPlayer getPlayer(String playerName)
      Description copied from interface: ResourcepacksPlugin
      Get an online player by its name
      Specified by:
      getPlayer in interface ResourcepacksPlugin
      Parameters:
      playerName - The player name
      Returns:
      The ResourcepacksPlayer
    • getPlayer

      public ResourcepacksPlayer getPlayer(org.bukkit.entity.Player player)
    • sendMessage

      public boolean sendMessage(ResourcepacksPlayer player, String key, String... replacements)
      Description copied from interface: ResourcepacksPlugin
      Send a message to a player
      Specified by:
      sendMessage in interface ResourcepacksPlugin
      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

      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 interface ResourcepacksPlugin
      Parameters:
      packPlayer - 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

      public void log(Level level, String message)
      Description copied from interface: ResourcepacksPlugin
      Log a message. This strips out all color codes
      Specified by:
      log in interface ResourcepacksPlugin
      Parameters:
      level - The level at which the message should be logged
      message - The message to log
    • log

      public void log(Level level, String message, Throwable throwable)
      Description copied from interface: ResourcepacksPlugin
      Log a message. This strips out all color codes
      Specified by:
      log in interface ResourcepacksPlugin
      Parameters:
      level - The level at which the message should be logged
      message - The message to log
      throwable - The error to log
    • checkPermission

      public boolean checkPermission(ResourcepacksPlayer player, String perm)
      Description copied from interface: ResourcepacksPlugin
      Check whether or not a player has a permission
      Specified by:
      checkPermission in interface ResourcepacksPlugin
      Parameters:
      player - The player to check
      perm - The permission to check for
      Returns:
      true if the player has the permission; false if not
    • checkPermission

      public boolean checkPermission(UUID playerId, String perm)
      Description copied from interface: ResourcepacksPlugin
      Check whether or not a player has a permission
      Specified by:
      checkPermission in interface ResourcepacksPlugin
      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

      public int getPlayerProtocol(UUID playerId)
      Description copied from interface: ResourcepacksPlugin
      Get the protocol version of a player
      Specified by:
      getPlayerProtocol in interface ResourcepacksPlugin
      Parameters:
      playerId - The UUID of the player
      Returns:
      The protocol version or -1 if the player isn't online
    • getPlayerClientType

      public ClientType getPlayerClientType(UUID playerId)
      Description copied from interface: ResourcepacksPlugin
      Get the client type of a player
      Specified by:
      getPlayerClientType in interface ResourcepacksPlugin
      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 interface ResourcepacksPlugin
      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

      public IResourcePackSendEvent callPackSendEvent(UUID playerId, ResourcePack pack)
      Description copied from interface: ResourcepacksPlugin
      Call the ResourcePackSendEvent on the corresponding server
      Specified by:
      callPackSendEvent in interface ResourcepacksPlugin
      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

      public boolean isAuthenticated(UUID playerId)
      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 interface ResourcepacksPlugin
      Parameters:
      playerId - The UUID of the player
      Returns:
      true if he is loggedin; false if not or the status is unknown
    • runTask

      public int runTask(Runnable runnable)
      Description copied from interface: ResourcepacksPlugin
      Run a sync task
      Specified by:
      runTask in interface ResourcepacksPlugin
      Parameters:
      runnable - What to run
      Returns:
      The task id
    • runAsyncTask

      public int runAsyncTask(Runnable runnable)
      Description copied from interface: ResourcepacksPlugin
      Run a task asynchronously
      Specified by:
      runAsyncTask in interface ResourcepacksPlugin
      Parameters:
      runnable - What to run
      Returns:
      The task id
    • getMessageChannelHandler

      public SubChannelHandler<org.bukkit.entity.Player> 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