Skip to content

Commit a01f2c4

Browse files
committed
Rename interaction -> interactions
1 parent 2550a2a commit a01f2c4

File tree

5 files changed

+15
-9
lines changed

5 files changed

+15
-9
lines changed

README.md

+13-7
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,7 @@ and where to learn what to send and when.
346346

347347
import httpx
348348

349-
from mcproto.client import Client
349+
from mcproto.interactions.client import Client
350350
from mcproto.connection import TCPAsyncConnection
351351
from mcproto.auth.account import Account
352352
from mcproto.types.uuid import UUID
@@ -371,8 +371,8 @@ async def main():
371371
async with httpx.AsyncClient() as client:
372372
async with (await TCPAsyncConnection.make_client((HOST, PORT), 2)) as connection:
373373
client = Client(
374-
host="localhost",
375-
port=25565,
374+
host=HOST,
375+
port=PORT,
376376
httpx_client=client,
377377
account=account,
378378
conn=connection,
@@ -388,20 +388,26 @@ async def main():
388388
# In the back, the `status` function has performed a handshake to transition us from
389389
# the initial (None) game state, to the STATUS game state, and then sent a status
390390
# request, getting back a response.
391-
391+
#
392392
# The Client instance also includes a `login` function, which is capable to go through
393393
# the entire login flow, leaving you in PLAY game state. Note that unless you've
394394
# set MINECRAFT_ACCESS_TOKEN, you will only be able to do this for warez servers.
395-
395+
#
396396
# But since we just called `status`, it left us in the STATUS game state, but we need
397397
# to be in LOGIN game state. The `login` function will work if called from an initial
398398
# game state (None), as it's smart enough to perform a handshake getting us to LOGIN,
399399
# however it doesn't know what to do from STATUS game state.
400-
400+
#
401401
# What we can do, is simply set game_state back to None (this is what happens during
402402
# initialization of the Client class), making the login function send out another
403403
# handshake, this time transitioning to LOGIN instead of STATUS. We could also create
404404
# a completely new client instance.
405+
#
406+
# Note that this way of naively resetting the game-state won't always work, as the
407+
# underlying connection isn't actually reset, and it's possible that in some cases,
408+
# the server simply won't let us perform another handshake on the same connection.
409+
# You will likely encounter this if you attempt to request status twice, however
410+
# transitioning to login in this way will generally work.
405411
client.game_state = None
406412

407413
client.login()
@@ -419,7 +425,7 @@ To start this server, you can run the following:
419425

420426
```python
421427
import httpx
422-
from mcproto.server import Server
428+
from mcproto.interactions.server import Server
423429

424430
HOST = "0.0.0.0"
425431
PORT = 25565
File renamed without changes.

mcproto/interaction/client.py mcproto/interactions/client.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
from mcproto.auth.account import Account
66
from mcproto.connection import TCPAsyncConnection
77
from mcproto.encryption import encrypt_token_and_secret, generate_shared_secret
8-
from mcproto.interaction.exceptions import InvalidGameStateError, UnexpectedPacketError
8+
from mcproto.interactions.exceptions import InvalidGameStateError, UnexpectedPacketError
99
from mcproto.multiplayer import compute_server_hash, join_request
1010
from mcproto.packets.handshaking.handshake import Handshake, NextState
1111
from mcproto.packets.interactions import async_read_packet, async_write_packet
File renamed without changes.

mcproto/interaction/server.py mcproto/interactions/server.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
from mcproto.connection import TCPAsyncConnection
1111
from mcproto.encryption import decrypt_token_and_secret, generate_rsa_key, generate_verify_token
12-
from mcproto.interaction.exceptions import InvalidVerifyTokenError, UnexpectedPacketError
12+
from mcproto.interactions.exceptions import InvalidVerifyTokenError, UnexpectedPacketError
1313
from mcproto.multiplayer import compute_server_hash, join_check
1414
from mcproto.packets.handshaking.handshake import Handshake, NextState
1515
from mcproto.packets.interactions import async_read_packet, async_write_packet

0 commit comments

Comments
 (0)