Class Plugin

java.lang.Object
dev.twilite.client.plugins.Plugin
All Implemented Interfaces:
com.google.inject.Module
Direct Known Subclasses:
BehaviorPlugin, TickPlugin

public abstract class Plugin extends Object implements com.google.inject.Module
Base class for TwiLite plugins.

Plugins are discovered by PluginManager, described with PluginDescriptor, configured through configure(PluginContext), and then started/stopped by the plugin lifecycle. Subclasses usually override startUp() and shutDown().

  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Returns whether this plugin is currently active.
    dev.twilite.client.config.ConfigPersistence
    Controls how this plugin's config is resolved and saved.
    void
    configure(com.google.inject.Binder binder)
    Allows plugins to install plugin-local Guice bindings.
    void
    configure(dev.twilite.client.plugins.PluginContext context)
    Supplies runtime services to this plugin before startup.
    Returns the configured plugin display name, or the class name when no descriptor is present.
    boolean
    Returns whether this plugin is temporarily paused by an interrupt.
    dev.twilite.client.plugins.scope.PluginScope
    Returns the scheduling scope for this plugin.

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • Plugin

      public Plugin()
  • Method Details

    • configure

      public void configure(dev.twilite.client.plugins.PluginContext context)
      Supplies runtime services to this plugin before startup.
    • configure

      public void configure(com.google.inject.Binder binder)
      Allows plugins to install plugin-local Guice bindings.
      Specified by:
      configure in interface com.google.inject.Module
    • scope

      public dev.twilite.client.plugins.scope.PluginScope scope()
      Returns the scheduling scope for this plugin.
    • configPersistence

      public dev.twilite.client.config.ConfigPersistence configPersistence()
      Controls how this plugin's config is resolved and saved.
    • name

      public String name()
      Returns the configured plugin display name, or the class name when no descriptor is present.
    • active

      public boolean active()
      Returns whether this plugin is currently active.
    • paused

      public boolean paused()
      Returns whether this plugin is temporarily paused by an interrupt.