Interface Plugin

All Superinterfaces:
CommandExecutor, LifecycleEventOwner, TabCompleter, TabExecutor
All Known Implementing Classes:
JavaPlugin, PluginBase

public interface Plugin extends TabExecutor, LifecycleEventOwner
Represents a Plugin

The use of PluginBase is recommended for actual Implementation

  • Method Details

    • getDataFolder

      @NotNull @NotNull File getDataFolder()
      Returns the folder that the plugin data's files are located in. The folder may not yet exist.
      The folder
    • getDescription

      May be inaccurate due to different plugin implementations.
      Returns the plugin.yaml file containing the details for this plugin
      Contents of the plugin.yaml file
      See Also:
    • getPluginMeta

      @NotNull PluginMeta getPluginMeta()
      Gets the plugin meta for this plugin.
      Specified by:
      getPluginMeta in interface LifecycleEventOwner
    • getConfig

      Gets a FileConfiguration for this plugin, read through "config.yml"

      If there is a default config.yml embedded in this plugin, it will be provided as a default for this Configuration.

      Plugin configuration
    • getResource

      Gets an embedded resource in this plugin
      filename - Filename of the resource
      File if found, otherwise null
    • saveConfig

      void saveConfig()
      Saves the FileConfiguration retrievable by getConfig().
    • saveDefaultConfig

      void saveDefaultConfig()
      Saves the raw contents of the default config.yml file to the location retrievable by getConfig().

      This should fail silently if the config.yml already exists.

    • saveResource

      void saveResource(@NotNull @NotNull String resourcePath, boolean replace)
      Saves the raw contents of any resource embedded with a plugin's .jar file assuming it can be found using getResource(String).

      The resource is saved into the plugin's data folder using the same hierarchy as the .jar file (subdirectories are preserved).

      resourcePath - the embedded resource path to look for within the plugin's .jar file. (No preceding slash).
      replace - if true, the embedded resource will overwrite the contents of an existing file.
      IllegalArgumentException - if the resource path is null, empty, or points to a nonexistent resource.
    • reloadConfig

      void reloadConfig()
      Discards any data in getConfig() and reloads from disk.
    • getPluginLoader

      Deprecated, for removal: This API element is subject to removal in a future version.
      Gets the associated PluginLoader responsible for this plugin
      PluginLoader that controls this plugin
    • getServer

      @NotNull @NotNull Server getServer()
      Returns the Server instance currently running this plugin
      Server running this plugin
    • isEnabled

      boolean isEnabled()
      Returns a value indicating whether or not this plugin is currently enabled
      true if this plugin is enabled, otherwise false
    • onDisable

      void onDisable()
      Called when this plugin is disabled
    • onLoad

      void onLoad()
      Called after a plugin is loaded but before it has been enabled.

      When multiple plugins are loaded, the onLoad() for all plugins is called before any onEnable() is called.

    • onEnable

      void onEnable()
      Called when this plugin is enabled
    • isNaggable

      boolean isNaggable()
      Simple boolean if we can still nag to the logs about things
      boolean whether we can nag
    • setNaggable

      void setNaggable(boolean canNag)
      Set naggable state
      canNag - is this plugin still naggable?
    • getDefaultWorldGenerator

      Gets a ChunkGenerator for use in a default world, as specified in the server configuration
      worldName - Name of the world that this will be applied to
      id - Unique ID, if any, that was specified to indicate which generator was requested
      ChunkGenerator for use in the default world generation
    • getDefaultBiomeProvider

      Gets a BiomeProvider for use in a default world, as specified in the server configuration
      worldName - Name of the world that this will be applied to
      id - Unique ID, if any, that was specified to indicate which biome provider was requested
      BiomeProvider for use in the default world generation
    • getLogger

      @NotNull @NotNull Logger getLogger()
      Returns the plugin logger associated with this server's logger. The returned logger automatically tags all log messages with the plugin's name.
      Logger associated with this plugin
    • getComponentLogger

      @NotNull default ComponentLogger getComponentLogger()
    • getSLF4JLogger

      @NotNull default Logger getSLF4JLogger()
    • getLog4JLogger

      @Deprecated @NotNull default Logger getLog4JLogger()
    • getName

      Returns the name of the plugin.

      This should return the bare name of the plugin and should be used for comparison.

      name of the plugin
    • getLifecycleManager

      @NotNull LifecycleEventManager<Plugin> getLifecycleManager()
      Get the lifecycle event manager for registering handlers for lifecycle events allowed on the Plugin.
      the lifecycle event manager