Plugins
From ScapeFX Wiki
Contents |
Overview
Plugins are used by mud administrators to customize the ScapeFX client for their game.
How to send data to plugins from your game
The easiest way to access plugins from your game is by using SFXP and the plugin tag. All you need to do is add the plugin to the client and then access it by using the plugin name as ID in the SFXP tag.
ESC#plugin:myPluginESC#This is a string holding data for a pluginESC#plugin>
How to access another plugin
All plugins have a reference to a ScapeFXAPI_GUIManager instance which can be used to access other plugins.
@Override
public void receiveMessage(String message){
MyPlugin plugin = (MyPlugin)this.getGUIManager().getPlugin("MyPlugin");
// TODO: do stuff with the external plugin when this plugin receives a message
}
Plugin classes
There are several different types of plugins:
ScapeFXPlugin_Skin -------------------------------- The skin plugin can be used to provide graphics and colors for the components of the client UI. ScapeFXPlugin_StatusBar -------------------------------- This plugin can be used to modify the bottom statusbar of the client. It is possbile to hide existing ScapeFX components and add your own buttons or Java components. ScapeFXPlugin_NetworkParser -------------------------------- The network parser plugin can be used when you want to add a special parser for the incoming network traffic. It could be reading the incoming text for your own protocol codes and sending the data onwards to your special panels. NOTICE: If you add a plugin of this type it will override the default SFXP plugin and you will loose all its features. ScapeFXPlugin_NetworkConnect -------------------------------- This plugin is called whenever the client connects to the server immediately before it receives anything over the connection. ScapeFXPlugin_MenuBar -------------------------------- This plugin modifies the menu of the client. You can use this plugin to remove existing ScapeFX menues or add your own. ScapeFXPlugin_DefaultLayout -------------------------------- The default layout plugin creates an array of persistent data that should be loaded as default when there is no xml configuration file available with saved persistent data. ScapeFXPlugin_CommandParser -------------------------------- If you want to add special commands into the client that should perform something before they are sent to the server you can add a command parser plugin.
How to add plugins
You can add plugins in the jnlp startup file as arguments. If you have several plugins you can also bundle them together in a ScapeFXPlugin_Pack and just add that single pack to the startup arguments.
Example of a pack:
public class YourPack extends ScapeFXAPI_Pack{
public YourPack(){
addPlugin(new SomeOtherParserPlugin());
}
@Override
public String getPluginInfo(){
return "Some info for your pack";
}
@Override
public String getPluginName(){
return "YourPack";
}
}
Example jnlp startup arguments:
<argument>PLUGIN=com.mysite.myclient.YourPack</argument>
