pal_rcon
Palworld 用の Rcon クライアントです。
既知の問題
-
マルチバイト文字に対応していない
サーバーがマルチバイト文字に対応していないため、マルチバイト文字が入っているといろいろとおかしくなる。
送信時: 文字化けを起こす
受信時: おそらく length がうまく計算されておらず、メッセージが途中で途切れてしまう -
ShowPlayers がうまく機能しない
うまく機能しない場合がいくつか確認しています。- プレイヤーがログイン中(キャラクリ中含む)の場合
ワールドに入る寸前に PlayerUID が読み込まれるので、それまでは PlayerUID が 00000000 となって Steam の名前が返される。
さらに Steam の名前がマルチバイト文字だと上記の不具合によりレスポンスが途中で切れてしまう。 - プレイヤーの名前にマルチバイト文字が含まれている場合
上記参照。
- プレイヤーがログイン中(キャラクリ中含む)の場合
-
パケット ID がちゃんと返ってこない
Rcon では任意の数字を送信時に一緒に送ることで、レスポンスにその数字を含めて返してくれます。
ログイン時はちゃんと返ってきますが、コマンドを送信すると 0 が返ってきます。
このクライアントの実装について
-
"\n"で終わっていない場合は再試行する
PalWorld の レスポンスは必ず改行で終わるようです。
改行で終わっていない場合は max_attempts の数だけ再試行します。
特に起きやすい ShowPlayers ではデフォルトで 10 回にしてあります。
もし、マルチバイト文字が含まれていなければリトライの間にログインが完了し、正しい情報を取得できます。
最後まで"\n"で終わらなかった場合はうまくデコードできない可能性があるので IncompleteMessageError を送出します。
IncompleteMessageError.message に受信した Payload が入っています。 -
送信時のエンコードは ASCII です
UTF-8 でエンコードすると文字化けする上にレスポンスも文字化けしてしまうので ASCII でエンコードしています。
マルチバイト文字を渡すと UnicodeEncodeError となるので注意してください。
使い方
pip install pal_rcon
Sync
from pal_rcon import PalRcon
# with Context Manager
with PalRcon("127.0.0.1", 25575, "password") as rcon:
res = rcon.send_info()
print(res.message)
# not Context Manager
rcon = PalRcon("127.0.0.1", 25575, "password")
rcon.connect()
res = rcon.send_info()
print(res.message)
rcon.disconnect()
Async
from pal_rcon import AsyncPalRcon
# with Context Manager
async with AsyncPalRcon("127.0.0.1", 25575, "password") as rcon:
res = await rcon.send_info()
print(res.message)
# not Context Manager
rcon = AsyncPalRcon("127.0.0.1", 25575, "password")
await rcon.connect()
res = await rcon.send_info()
print(res.message)
await rcon.disconnect()
Send Commands
rcon.execute_command(command: str | list, max_attempts: int | None = 1) -> CommandResponse
rcon.send_shutdown(seconds: int | None = 1, message: str | None = "", send_save: bool | None = False, max_attempts: int | None = 1) -> CommandResponse:
rcon.send_do_exit(max_attempts: int | None = 1) -> CommandResponse
rcon.send_broadcast(message: str, max_attempts: int | None = 1) -> CommandResponse
rcon.send_kick_player(steam_id: str | int, max_attempts: int | None = 1) -> CommandResponse
rcon.send_ban_player(steam_id: str | int, max_attempts: int | None = 1) -> CommandResponse
rcon.send_show_players(max_attempts: int | None = 10) -> PlayerlistResponse
rcon.send_info(max_attempts: int | None = 1) -> CommandResponse
rcon.send_save(max_attempts: int | None = 1) -> CommandResponse
License MIT ©Charahiro-tan
Metadata
Release files for pal_rcon 0.0.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pal_rcon-0.0.3.tar.gz | 8.8 kB | Without provenance | Details for pal_rcon-0.0.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pal_rcon-0.0.3-py3-none-any.whl | Python 3 | none | any | Details for pal_rcon-0.0.3-py3-none-any.whl |
Total release size: 19.5 kB
Release files / pal_rcon-0.0.3.tar.gz
| Download URL | pal_rcon-0.0.3.tar.gz |
|---|---|
| Size | 8.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
80a2b1768c4f65f358d803e53e6cfd1b922d4ff62bcc7fcaee9eaa71ae16f42b
|
|
BLAKE2b-256 checksum How to use checksums |
0bcbd56f1e6366add1fb2aa27fb05e91c336391a6044028e2b115fe4a9ca8adf
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
pdm/2.12.3 CPython/3.10.12
|
Release files / pal_rcon-0.0.3-py3-none-any.whl
| Download URL | pal_rcon-0.0.3-py3-none-any.whl |
|---|---|
| Size | 10.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
98de75a53f63790774978d4b83c20e01a951d372a85e6ea86eec914738f318ae
|
|
BLAKE2b-256 checksum How to use checksums |
a15a85d59cefb459c89b54ecc5a831037fe2e68ff59156406aed3e59a83046e4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
pdm/2.12.3 CPython/3.10.12
|
Security for pal_rcon 0.0.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.