Class AnnoyingPlugin

java.lang.Object
org.bukkit.plugin.PluginBase
org.bukkit.plugin.java.JavaPlugin
xyz.srnyx.annoyingapi.AnnoyingPlugin
All Implemented Interfaces:
org.bukkit.command.CommandExecutor, org.bukkit.command.TabCompleter, org.bukkit.command.TabExecutor, org.bukkit.plugin.Plugin

public class AnnoyingPlugin extends org.bukkit.plugin.java.JavaPlugin
Represents a plugin using Annoying API
  • Field Details

  • Constructor Details

    • AnnoyingPlugin

      public AnnoyingPlugin()
      Constructs a new AnnoyingPlugin instance
  • Method Details

    • onLoad

      public final 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.

      Do not try to override this method! Override load() instead

      Specified by:
      onLoad in interface org.bukkit.plugin.Plugin
      Overrides:
      onLoad in class org.bukkit.plugin.java.JavaPlugin
      See Also:
    • onEnable

      public final void onEnable()
      Called when the plugin is enabled.

      Do not try to override this method! Override enable() instead

      Specified by:
      onEnable in interface org.bukkit.plugin.Plugin
      Overrides:
      onEnable in class org.bukkit.plugin.java.JavaPlugin
      See Also:
    • onDisable

      public final void onDisable()
      Called when the plugin is disabled

      Do not try to override this method! Override disable() instead

      Specified by:
      onDisable in interface org.bukkit.plugin.Plugin
      Overrides:
      onDisable in class org.bukkit.plugin.java.JavaPlugin
      See Also:
    • load

      public void load()
      Called when the plugin is loaded
      See Also:
    • enable

      public void enable()
      Called after dependency checks, start-up messages, and command/listener registration
      See Also:
    • disable

      public void disable()
      Called when the plugin is disabled
      See Also:
    • reload

      public void reload()
      Called when the plugin is reloaded
      See Also:
    • disablePlugin

      public void disablePlugin()
      Runs PluginManager.disablePlugin(Plugin) with this as the plugin
      Do not override this method! Override disable() instead
      See Also:
    • reloadPlugin

      public void reloadPlugin()
      Reloads the plugin (messages, etc...). This will not trigger onLoad() or onEnable()

      This is not run automatically (such as onEnable() and onDisable()), it is to be used manually by the plugin itself (ex: in a /reload command)

      Do not override this method! Override reload() instead

      See Also:
    • loadMessages

      public void loadMessages()
      Loads the messages.yml file to messages and globalPlaceholders
    • getMessagesString

      @NotNull public @NotNull String getMessagesString(@NotNull @NotNull String key)
      Gets a string from messages with the specified key
      Parameters:
      key - the key of the string
      Returns:
      the string, or the key if messages is null or the string is not found
    • parsePapiPlaceholders

      @NotNull public @NotNull String parsePapiPlaceholders(@Nullable @Nullable org.bukkit.OfflinePlayer player, @Nullable @Nullable String message)
      Parses all PlaceholderAPI placeholders in a message
      Parameters:
      player - the OfflinePlayer to parse the placeholders for (or null if none)
      message - the message to parse
      Returns:
      the parsed message
    • unregisterClasses

      public void unregisterClasses()
      Unregisters all Registrables in registeredClasses
    • checkUpdate

      public void checkUpdate()
      See Also:
    • loadDataManger

      public void loadDataManger(@Nullable @Nullable StorageConfig storageConfig, boolean saveCache)
      Attempts to load the dataManager, catching any exceptions and logging them
      If storage-new.yml exists, it will attempt to migrate the data from storage.yml to storage-new.yml using DataManager.attemptDatabaseMigration()
      Parameters:
      storageConfig - the StorageConfig to load the data manager with. If null, storage.yml will be used
      saveCache - whether to save the cache before loading the data manager (data may be lost if false)
    • getRelocation

      @NotNull public @NotNull net.byteflux.libby.relocation.Relocation getRelocation(@NotNull @NotNull String from, @NotNull @NotNull String name)
      Gets a Relocation for the specified package
      Parameters:
      from - the package to relocate
      name - the name of the module being relocated (getLibsPackage() + name)
      Returns:
      the relocation
    • getRelocation

      @NotNull public @NotNull net.byteflux.libby.relocation.Relocation getRelocation(@NotNull @NotNull String from)
      Gets a Relocation for the specified package
      Parameters:
      from - the package to relocate
      Returns:
      the relocation
    • getLibsPackage

      @NotNull public @NotNull String getLibsPackage()
      Gets the package path for relocated libraries
      Returns:
      the path
    • log

      public static void log(@Nullable @Nullable Level level, @Nullable @Nullable Object message, @Nullable @Nullable Throwable throwable)
      Logs a message with the specified level and throwable to the console
      Parameters:
      level - the level of the message. If null, Level.INFO will be used
      message - the message to log
      throwable - the throwable to log
    • log

      public static void log(@Nullable @Nullable Level level, @Nullable @Nullable Object message)
      Parameters:
      level - the level of the message. If null, Level.INFO will be used
      message - the message to log
    • log

      public static void log(@Nullable @Nullable Object message)
      Calls log(Level, Object, Throwable) with null as the level and throwable
      Parameters:
      message - the message to log
    • replaceBrackets

      @NotNull public static @NotNull String replaceBrackets(@NotNull @NotNull String string)
      Replaces all instances of {} in a string with .
      Used for replacing brackets in package names
      Parameters:
      string - the string to replace brackets in
      Returns:
      the string with brackets replaced