mirror of
https://github.com/kuitoi/kuitoi-Server.git
synced 2025-08-17 16:25:36 +00:00
Plugins and Events documentation
This commit is contained in:
parent
b4c200c31b
commit
d1c58b64e4
@ -23,7 +23,7 @@ BeamingDrive Multiplayer (BeamMP) server compatible with BeamMP clients.
|
||||
- [x] Tabulation
|
||||
- [ ] _(Deferred)_ Normal text scroll
|
||||
- [ ] Documentation:
|
||||
- [x] [Plugins and Events](docs/plugins.md)
|
||||
- [x] [Plugins and Events](docs/plugins and events.md)
|
||||
|
||||
## Installation
|
||||
|
||||
|
33
docs/plugins and events.md
Normal file
33
docs/plugins and events.md
Normal file
@ -0,0 +1,33 @@
|
||||
# Plugins System
|
||||
|
||||
## Install
|
||||
|
||||
[//]: # (TODO: BEAM LIB)
|
||||
Lib can't ready to use
|
||||
* From pip:\
|
||||
`$ pip install ...`
|
||||
* From source:\
|
||||
`git clone https://github.com/kuitoi/...`
|
||||
|
||||
## Example
|
||||
|
||||
```python
|
||||
import BEAMP
|
||||
|
||||
beam = BEAMP("TestPlugin")
|
||||
logger = beam.log
|
||||
|
||||
def load(): # Plugins load from here
|
||||
print(beam.name)
|
||||
|
||||
def on_started():
|
||||
logger.info("Server starting...")
|
||||
|
||||
beam.register_event("on_started", on_started)
|
||||
```
|
||||
|
||||
* Basic Events: ['on_started', 'on_auth, 'on_stop']
|
||||
* Create new event : `beam.register_event("my_event", my_event_function)`
|
||||
* Call event: `beam.call_event("my_event")`
|
||||
* Call event with some data: `beam.call_event("my_event", data, data2)`
|
||||
* Calls _**can't support**_ like this: `beam.call_event("my_event", data=data)`
|
Loading…
x
Reference in New Issue
Block a user