001 /** 002 * Plugin.java - Extend this to create your own plugins. 003 * 004 * @author James 005 */ 006 public abstract class Plugin { 007 008 private String name = ""; 009 private boolean enabled = true; 010 private boolean usesListeners; 011 012 /** 013 * Enables the plugin 014 */ 015 public abstract void enable(); 016 017 /** 018 * Disables the plugin 019 */ 020 public abstract void disable(); 021 022 /** 023 * Returns true if this plugin is enabled 024 * 025 * @return 026 */ 027 public boolean isEnabled() { 028 return enabled; 029 } 030 031 /** 032 * Toggles whether or not this plugin is enabled 033 * 034 * @return 035 */ 036 public boolean toggleEnabled() { 037 enabled = !enabled; 038 return enabled; 039 } 040 041 /** 042 * Sets the name of this plugin 043 * 044 * @param name 045 */ 046 public void setName(String name) { 047 this.name = name; 048 } 049 050 /** 051 * Returns the name of this plugin 052 * 053 * @return name 054 */ 055 public String getName() { 056 return name; 057 } 058 059 /** 060 * Plugin is loaded and may now register hooks 061 */ 062 public void initialize() { 063 } 064 }