feat: Added docs via MkDocs
This commit is contained in:
27
docs/defaultEvents/onBan.md
Normal file
27
docs/defaultEvents/onBan.md
Normal file
@@ -0,0 +1,27 @@
|
||||
# `event` onBan
|
||||
!!! note
|
||||
If serial/mac/ip/name indexes doesn't exist, then the parameters has not been specified when ban was added.
|
||||
If timestamp doesn't exist, then ban was permanent.
|
||||
|
||||
This event is triggered when new ban is being added.
|
||||
|
||||
## Parameters
|
||||
* `dict` **kwargs**:
|
||||
* `str` **mac**: MAC address of the banned player.
|
||||
* `str` **ip**: IP address of the banned player.
|
||||
* `str` **serial**: serial of the banned player.
|
||||
* `str` **name**: nickname of the banned player.
|
||||
* `int` **timestamp**: timestamp when the ban expires.
|
||||
|
||||
## Usage
|
||||
```python
|
||||
import g2o
|
||||
from datetime import datetime
|
||||
|
||||
@g2o.event('onBan')
|
||||
def onBan(**kwargs):
|
||||
print(f'Player {kwargs['name']} has been banned.')
|
||||
if ('timestamp' in kwargs):
|
||||
banExpires = datetime.fromtimestamp(kwargs['timestamp'])
|
||||
print(f'Ban expires at {banExpires}')
|
||||
```
|
||||
15
docs/defaultEvents/onExit.md
Normal file
15
docs/defaultEvents/onExit.md
Normal file
@@ -0,0 +1,15 @@
|
||||
# `event` onExit
|
||||
This event is triggered when server is going to shut down.
|
||||
You can use it, to save some data before closing up, or do something else.
|
||||
|
||||
## Parameters
|
||||
No parameters.
|
||||
|
||||
## Usage
|
||||
```python
|
||||
import g2o
|
||||
|
||||
@g2o.event('onExit')
|
||||
def onExitEvt(**kwargs):
|
||||
print('Bye')
|
||||
```
|
||||
14
docs/defaultEvents/onInit.md
Normal file
14
docs/defaultEvents/onInit.md
Normal file
@@ -0,0 +1,14 @@
|
||||
# `event` onInit
|
||||
This event is triggered when server successfully starts up.
|
||||
|
||||
## Parameters
|
||||
No parameters.
|
||||
|
||||
## Usage
|
||||
```python
|
||||
import g2o
|
||||
|
||||
@g2o.event('onInit')
|
||||
def onInitEventHandler(**kwargs):
|
||||
print('Called onInit event')
|
||||
```
|
||||
14
docs/defaultEvents/onTick.md
Normal file
14
docs/defaultEvents/onTick.md
Normal file
@@ -0,0 +1,14 @@
|
||||
# `event` onTick
|
||||
This event is triggered in every server main loop iteration.
|
||||
|
||||
## Parameters
|
||||
No parameters.
|
||||
|
||||
## Usage
|
||||
```python
|
||||
import g2o
|
||||
|
||||
@g2o.event('onTick')
|
||||
def onTickEvt(**kwargs):
|
||||
print('Tock')
|
||||
```
|
||||
20
docs/defaultEvents/onTime.md
Normal file
20
docs/defaultEvents/onTime.md
Normal file
@@ -0,0 +1,20 @@
|
||||
# `event` onTime
|
||||
This event is triggered each time when game time minute passes.
|
||||
|
||||
## Parameters
|
||||
* `dict` **kwargs**:
|
||||
* `int` **day**: the current ingame day.
|
||||
* `int` **hour**: the current ingame hour.
|
||||
* `int` **min**: the current ingame minutes.
|
||||
|
||||
## Usage
|
||||
```python
|
||||
import g2o
|
||||
|
||||
@g2o.event('onTick')
|
||||
def onTickEvt(**kwargs):
|
||||
day = kwargs['day']
|
||||
hour = kwargs['hour']
|
||||
mins = kwargs['min']
|
||||
print(f'Current time: Day {day}, Hour {hour}, Min {mins}')
|
||||
```
|
||||
23
docs/defaultEvents/onUnban.md
Normal file
23
docs/defaultEvents/onUnban.md
Normal file
@@ -0,0 +1,23 @@
|
||||
# `event` onUnban
|
||||
!!! note
|
||||
If serial/mac/ip/name indexes doesn't exist, then the parameters has not been specified when ban was added.
|
||||
If timestamp doesn't exist, then ban was permanent.
|
||||
|
||||
This event is triggered when ban with specified info is being removed.
|
||||
|
||||
## Parameters
|
||||
* `dict` **kwargs**:
|
||||
* `str` **mac**: MAC address of the banned player.
|
||||
* `str` **ip**: IP address of the banned player.
|
||||
* `str` **serial**: serial of the banned player.
|
||||
* `str` **name**: nickname of the banned player.
|
||||
* `int` **timestamp**: timestamp when the ban expires.
|
||||
|
||||
## Usage
|
||||
```python
|
||||
import g2o
|
||||
|
||||
@g2o.event('onUnban')
|
||||
def onUnban(**kwargs):
|
||||
print(f'Player {kwargs['name']} has been unbanned.')
|
||||
```
|
||||
Reference in New Issue
Block a user