Class ChatPlugin

java.lang.Object
me.remigio07.chatplugin.api.ChatPlugin

public abstract class ChatPlugin extends Object
ChatPlugin's main class's abstraction.
  • Field Details

    • VERSION

      public static final String VERSION
      String containing the plugin's current version.

      Content: 🤷

  • Constructor Details

    • ChatPlugin

      public ChatPlugin()
  • Method Details

    • isLoaded

      public boolean isLoaded()
      Checks if ChatPlugin has finished (re)loading.
      Returns:
      Whether the plugin is loaded
    • hasStarted

      public boolean hasStarted()
      Checks if ChatPlugin has started correctly.
      Returns:
      Whether the plugin has started
    • isReloading

      public boolean isReloading()
      Checks if a reload is being performed.
      Returns:
      Whether the plugin is reloading
    • getManagers

      public ChatPluginManagers getManagers()
      Gets the managers' manager. Yeah...
      Returns:
      Managers' manager
    • getLogger

      public Object getLogger()
      Gets the plugin's logger.

      There are two loggers supported:

      Returns:
      Plugin's logger
      See Also:
    • getDataFolder

      public File getDataFolder()
      Gets ChatPlugin's data folder in plugins folder.
      Returns:
      Data folder
    • getStartupTime

      public int getStartupTime()
      Gets the time elapsed during ChatPlugin's startup, in milliseconds.
      Returns:
      Time elapsed in milliseconds
    • getLastReloadTime

      public int getLastReloadTime()
      Gets the time elapsed during ChatPlugin's last reload, in milliseconds.
      Returns:
      Time elapsed in milliseconds
    • getInstance

      public static ChatPlugin getInstance()
      Gets ChatPlugin's instance, the main one.
      Returns:
      Main instance
    • reload

      public abstract int reload()
      Reloads ChatPlugin. Totally.

      If the reload fails the plugin will be safely disabled and an error message will be sent to the console.

      Returns:
      Time elapsed in milliseconds or 0 if not loaded or -1 if failed
      See Also:
    • unload

      @Deprecated public abstract int unload()
      Deprecated.
      Internal use only. You should never need to manually unload ChatPlugin.
      Unloads ChatPlugin.

      If the unload fails the plugin will be safely disabled and an error message will be sent to the console.

      Returns:
      Time elapsed in milliseconds or 0 if already unloaded or -1 if failed
      See Also:
    • runConsoleCommand

      public abstract void runConsoleCommand(String command)
      Runs a command from the console.
      Parameters:
      command - Command to run
    • sendConsoleMessage

      public abstract void sendConsoleMessage(String message, boolean log)
      Sends a message to the console.
      Parameters:
      message - Message to send
      log - Whether to LogManager.writeToFile(String) the message
    • printStartMessage

      public abstract void printStartMessage()
      Prints the beautiful start message.
    • isOnlineMode

      public abstract boolean isOnlineMode()
      Checks if ChatPlugin is running on online mode.
      Returns:
      Whether online mode is enabled
      Throws:
      IllegalStateException - If !Environment.isProxy() and !isLoaded()
    • isPremium

      public abstract boolean isPremium()
      Checks if a licensed copy of ChatPlugin is running.
      Returns:
      Whether the plugin is premium