Plugin API documentation

Plugin API Doc

Class: PhpSendPlugin

- Abstract plugin class. All plugins should extend this one.

Functions:

boolean send(String msg)

Sends msg to previously opened socket. NOTE: To recognize what plugin sent the message, the raw data sent is: PluginID:msg!!!

Params

  • msg - Message to be sent

Returns

  • true - Message sent
  • false - Failed to send message.

String post(String args[])

Sends post data defined in args to default url form config.yml

Params

  • args - Post keys and values formated (key1=val1, key2=val2 ...)

Returns

  • String - The webpage generated by php script
  • null - Connection failed

String post(String addr, String args[])

Sends post data defined in args to url addr.

Params

  • addr - Url defining where to send request.
  • args - Post keys and values formated (key1=val1, key2=val2 ... )

Returns

  • String - The webpage generated by php script
  • null - Connection failed

boolean OnWebCommand(String cmd)

SHOULD BE OVERWRITTEN METHOD. Defines the behaveiour of plugin on command cmd.

Params

  • cmd - Command receieved by PHPsend main plugin.

Returns

  • true - If command should be passed further (executed by server)
  • false - If command was handled here and shouldn't be passed.

boolean OnWebCommandAsPlayer(String player, String cmd)

SHOULD BE OVERWRITTEN METHOD. Defines the behaveiour of plugin on player associated command.

Params

  • player - The name of player
  • cmd - Command receieved by PHPsend main plugin.

Returns

  • true - If command should be passed further (executed by server)
  • false - If command was handled here and shouldn't be passed.

General methods

From MainPhpSend, static:
boolean registerPlugin(PhpSendPlugin plugin,String ID)

Registers your plugin to pass events to.

Params

  • plugin - Instance of your plugin class. Should be previously created (new YourPlugin())
  • ID - unique Id of your plugin

Returns

  • true - Plugin succesfully registered
  • false - Plugin register failed :C

(Note: Should be called from MainPhpSend: MainPhpSend.registerPlugin(somePlugin,"MyID");


Comments

Posts Quoted:
Reply
Clear All Quotes