anecho.JamochaMUD.plugins
Class MusicBox

java.lang.Object
  extended by anecho.JamochaMUD.plugins.MusicBox
All Implemented Interfaces:
PlugInterface, java.awt.event.KeyListener, java.util.EventListener

public class MusicBox
extends java.lang.Object
implements PlugInterface, java.awt.event.KeyListener


Constructor Summary
MusicBox()
           
 
Method Summary
 void activate()
          This function tells the plug-in that it should be functioning.
 void deactivate()
          This function tells the plug-in that it should not be active.
 boolean hasProperties()
          Check to see if the plug-in has configurable properties
 boolean haveConfig()
          This function indicates whether a directory is required to hold settings for our plug-in.
 void initialiseAtLoad()
          This function is called at load-up, in case properties are needed...
 boolean isActive()
          Returns to JamochaMUD whether our plug-in is currently active or not.
 void keyPressed(java.awt.event.KeyEvent key)
           
 void keyReleased(java.awt.event.KeyEvent key)
           
 void keyTyped(java.awt.event.KeyEvent evtKey)
           
 java.lang.String plugInDescription()
          Returns a description, eg.
 java.lang.String plugInName()
          Returns the plugin's proper name
 void plugInProperties()
          Any user configurable options for the plugin
 java.lang.String plugInType()
          Returns a type of either input, output, or other
 java.lang.String plugMain(java.lang.String jamochaString, MuSocket mSock)
          the core of the plugin
protected  void readSettings()
          This method reads the MusicBox settings from a file.
protected  void saveSettings()
          This method saves the current MusicBox settings to a file.
 void setAtHalt()
          Previously this function did most of the functions of Deactivate() but now this is reserved solely for shutting down the plug-in and doing any necessary clean-up.
 void setSettings(JMConfig settings)
          Collect the settings file information that we might need.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MusicBox

public MusicBox()
Method Detail

setSettings

public void setSettings(JMConfig settings)
Collect the settings file information that we might need.

Parameters:
settings - Our JamochaMUD settings file

plugInName

public java.lang.String plugInName()
Returns the plugin's proper name

Specified by:
plugInName in interface PlugInterface
Returns:
The plug-in's name to be displayed by JamochaMUD.

plugInDescription

public java.lang.String plugInDescription()
Returns a description, eg. author, date, build...

Specified by:
plugInDescription in interface PlugInterface
Returns:
Returns a human-readable description of the plug-in used by JamochaMUD.

plugInType

public java.lang.String plugInType()
Returns a type of either input, output, or other

Specified by:
plugInType in interface PlugInterface
Returns:
Returns our plug-in type to JamochaMUD.

plugMain

public java.lang.String plugMain(java.lang.String jamochaString,
                                 MuSocket mSock)
the core of the plugin

Specified by:
plugMain in interface PlugInterface
Parameters:
jamochaString - Original string supplied to our plug-in by JamochaMUD. Not used in this instance.
mSock - The mSock* socket that our input would come from. Not used in this plug-in.
Returns:
Returns an altered string to JamochaMUD. Not used in this plug-in.

plugInProperties

public void plugInProperties()
Any user configurable options for the plugin

Specified by:
plugInProperties in interface PlugInterface

hasProperties

public boolean hasProperties()
Check to see if the plug-in has configurable properties

Specified by:
hasProperties in interface PlugInterface
Returns:
This plug-in returns true as it can be configured.

initialiseAtLoad

public void initialiseAtLoad()
This function is called at load-up, in case properties are needed... eg. lists, settings

Specified by:
initialiseAtLoad in interface PlugInterface

activate

public void activate()
This function tells the plug-in that it should be functioning. See Deactive() for the inverse function. Activate may be called more than once.

Specified by:
activate in interface PlugInterface

deactivate

public void deactivate()
This function tells the plug-in that it should not be active. Deactivate may be called more than once. Formerly this function was handled by SetAtHalt.

Specified by:
deactivate in interface PlugInterface

isActive

public boolean isActive()
Returns to JamochaMUD whether our plug-in is currently active or not.

Specified by:
isActive in interface PlugInterface
Returns:
Returns
true
if the plug-in is currently active and
false
if inactive.

setAtHalt

public void setAtHalt()
Previously this function did most of the functions of Deactivate() but now this is reserved solely for shutting down the plug-in and doing any necessary clean-up.

Specified by:
setAtHalt in interface PlugInterface

haveConfig

public boolean haveConfig()
This function indicates whether a directory is required to hold settings for our plug-in. It is recommended for consistency to let JamochaMUD create and handle any plug-in directories. Plus, it means you can use less code in your plug-in!

Specified by:
haveConfig in interface PlugInterface
Returns:
true
- create a settings directory
false
- no directory required

keyTyped

public void keyTyped(java.awt.event.KeyEvent evtKey)
Specified by:
keyTyped in interface java.awt.event.KeyListener
Parameters:
evtKey -

keyPressed

public void keyPressed(java.awt.event.KeyEvent key)
Specified by:
keyPressed in interface java.awt.event.KeyListener
Parameters:
key -

keyReleased

public void keyReleased(java.awt.event.KeyEvent key)
Specified by:
keyReleased in interface java.awt.event.KeyListener
Parameters:
key -

saveSettings

protected void saveSettings()
This method saves the current MusicBox settings to a file.


readSettings

protected void readSettings()
This method reads the MusicBox settings from a file.