|
| 1 | +Plugin files are python modules. |
| 2 | + |
| 3 | +Plugins SHOULD contain the following global variables: |
| 4 | +AUTHOR: String containing name or handle of plugin author, or list of the same. |
| 5 | +CONTACT: String containing contact details (preferably an email address) for author, or list of the same. |
| 6 | +DESCRIPTION: String containing description of plugin. |
| 7 | + |
| 8 | +Plugins MAY contain the following defined functions: |
| 9 | + on_start(): |
| 10 | + Run on plugin initialisation. If an exception is raised here, plugin is disabled and a warning is given. |
| 11 | + on_tick(users): |
| 12 | + Run approximately every server tick (200ms). Users is a list of all currently connected User objects. |
| 13 | + Important note: This call occurs on a signal and may interrupt any other execution at any point. |
| 14 | + Any code using this function should prepare accordingly. |
| 15 | + on_packet(packet, user, to_server): |
| 16 | + This function is called for every packet passing through the proxy. |
| 17 | + packet is a Packet and contains packet data. |
| 18 | + user is a User and contains session data. |
| 19 | + to_server is a bool and is True for client->server packets, False for server->client. |
| 20 | + This function may return: |
| 21 | + a Packet |
| 22 | + a list of Packet |
| 23 | + and each packet in the list will be passed along to the next plugin in the chain. |
| 24 | + Note that returning [] has the effect of dropping the packet. |
| 25 | + Note also that it is common to simply modify the given Packet before returning it. |
| 26 | + |
| 27 | +If a plugin wishes to log to the main logger, it MAY use the root logger available through the logging module. |
| 28 | +However, in general, the plugin SHOULD use its own logging path. |
| 29 | + |
| 30 | +Plugins MAY import any of the items contained in the top level directory. |
| 31 | +As an exception, plugins MAY NOT import proxy.py |
| 32 | +Plugins SHOULD make use of the functions given in helpers.py |
0 commit comments