MkDocs, Readme, Files API, Automated session saving, v2.0.1
MkDocs: sphinx docstrings rewritten to google, improved config, written the major part of how-to. Readme: centered title + logo, added badges, features list, updated changelog. Improved Files API, added automatical session saving and restoring to Client. Some changes in makefile and gitignore. License Notice now refers to all contributors.
This commit is contained in:
parent
dc52f92985
commit
4892430f19
39 changed files with 1832 additions and 569 deletions
57
docs/howto/players.md
Normal file
57
docs/howto/players.md
Normal file
|
@ -0,0 +1,57 @@
|
|||
# How-To 3: Players lists
|
||||
You can add a player to operators,
|
||||
include in the whitelist or ban
|
||||
using this feature.
|
||||
|
||||
## Common usage
|
||||
It's pretty easy:
|
||||
```python
|
||||
from python_aternos import Client, Lists
|
||||
|
||||
...
|
||||
|
||||
whitelist = serv.players(Lists.whl)
|
||||
|
||||
whitelist.add('jeb_')
|
||||
whitelist.remove('Notch')
|
||||
|
||||
whitelist.list_players()
|
||||
# ['DarkCat09', 'jeb_']
|
||||
```
|
||||
|
||||
## List types
|
||||
|
||||
| Name | Enum key |
|
||||
|:----------:|:---------:|
|
||||
| Whitelist |`Lists.whl`|
|
||||
| Operators |`Lists.ops`|
|
||||
| Banned |`Lists.ban`|
|
||||
|Banned by IP|`Lists.ips`|
|
||||
|
||||
For example, I want to ban someone:
|
||||
```python
|
||||
serv.players(Lists.ban).add('someone')
|
||||
```
|
||||
|
||||
And give myself operator rights:
|
||||
```python
|
||||
serv.players(Lists.ops).add('DarkCat09')
|
||||
```
|
||||
|
||||
Unban someone:
|
||||
```python
|
||||
serv.players(Lists.ban).remove('someone')
|
||||
```
|
||||
|
||||
Unban someone who I banned by IP:
|
||||
```python
|
||||
serv.players(Lists.ips).remove('anyone')
|
||||
```
|
||||
|
||||
## Caching
|
||||
If `list_players` doesn't show added players, call it with `cache=False` argument, like list_servers.
|
||||
```python
|
||||
lst = serv.players(Lists.ops)
|
||||
lst.list_players(cache=False)
|
||||
# ['DarkCat09', 'jeb_']
|
||||
```
|
Reference in a new issue