Add a variable to indicate if the client is spawned

This commit is contained in:
Ammar Askar committed 2015-03-22 18:20:01 +05:00
1 parent 463b48414e
commit 20c4c87510
1 file changed
+3
+3
View File
@@ -31,6 +31,8 @@ class Connection(object):
_write_lock = Lock() _write_lock = Lock()
networking_thread = None networking_thread = None
options = ConnectionOptions() options = ConnectionOptions()
#: Indicates if this connection is spawned in the Minecraft game world
spawned = False
def __init__(self, address, port, login_response): def __init__(self, address, port, login_response):
"""Sets up an instance of this object to be able to connect to a minecraft server. """Sets up an instance of this object to be able to connect to a minecraft server.
@@ -291,6 +293,7 @@ class PlayingReactor(PacketReactor):
position_response.on_ground = True position_response.on_ground = True
self.connection.write_packet(position_response) self.connection.write_packet(position_response)
self.connection.spawned = True
if packet.packet_name == "disconnect": if packet.packet_name == "disconnect":
print(packet.json_data) # TODO: handle propagating this back print(packet.json_data) # TODO: handle propagating this back