mirror of
https://github.com/ammaraskar/pyCraft.git
synced 2025-02-03 05:21:39 +01:00
start.py: cosmetic improvements.
This commit is contained in:
parent
e9f095de42
commit
ca100a5b1f
17
start.py
17
start.py
@ -59,7 +59,7 @@ def main():
|
|||||||
options = get_options()
|
options = get_options()
|
||||||
|
|
||||||
if options.offline:
|
if options.offline:
|
||||||
print("Connecting in offline mode")
|
print("Connecting in offline mode...")
|
||||||
connection = Connection(
|
connection = Connection(
|
||||||
options.address, options.port, username=options.username)
|
options.address, options.port, username=options.username)
|
||||||
else:
|
else:
|
||||||
@ -69,7 +69,7 @@ def main():
|
|||||||
except YggdrasilError as e:
|
except YggdrasilError as e:
|
||||||
print(e)
|
print(e)
|
||||||
sys.exit()
|
sys.exit()
|
||||||
print("Logged in as " + auth_token.username)
|
print("Logged in as %s..." % auth_token.username)
|
||||||
connection = Connection(
|
connection = Connection(
|
||||||
options.address, options.port, auth_token=auth_token)
|
options.address, options.port, auth_token=auth_token)
|
||||||
|
|
||||||
@ -89,14 +89,21 @@ def main():
|
|||||||
connection.register_packet_listener(
|
connection.register_packet_listener(
|
||||||
print_outgoing, Packet, outgoing=True)
|
print_outgoing, Packet, outgoing=True)
|
||||||
|
|
||||||
connection.connect()
|
def handle_join_game(join_game_packet):
|
||||||
|
print('Connected.')
|
||||||
|
|
||||||
|
connection.register_packet_listener(
|
||||||
|
handle_join_game, clientbound.play.JoinGamePacket)
|
||||||
|
|
||||||
def print_chat(chat_packet):
|
def print_chat(chat_packet):
|
||||||
print("Position: " + str(chat_packet.position))
|
print("Message (%s): %s" % (
|
||||||
print("Data: " + chat_packet.json_data)
|
chat_packet.field_string('position'), chat_packet.json_data))
|
||||||
|
|
||||||
connection.register_packet_listener(
|
connection.register_packet_listener(
|
||||||
print_chat, clientbound.play.ChatMessagePacket)
|
print_chat, clientbound.play.ChatMessagePacket)
|
||||||
|
|
||||||
|
connection.connect()
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
try:
|
try:
|
||||||
text = input()
|
text = input()
|
||||||
|
Loading…
Reference in New Issue
Block a user