py2hackCraft2 1.0.5__tar.gz → 1.0.7__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: py2hackCraft2
3
- Version: 1.0.5
3
+ Version: 1.0.7
4
4
  Summary: These are APIs that connect to the hackCraft2 server from Python to manipulate pets.
5
5
  Home-page: https://pypi.org/project/py2hackCraft2/
6
6
  Author: Masafumi Terazono
@@ -77,7 +77,7 @@ class _WebSocketClient:
77
77
  elif(type == 'logged'):
78
78
  self.connected = True
79
79
  self.result = data
80
- elif(type == 'entities'):
80
+ elif(type == 'attach'):
81
81
  self.result = data
82
82
  elif(type == 'event'):
83
83
  jsonEvent = json.loads(data)
@@ -91,6 +91,8 @@ class _WebSocketClient:
91
91
  callback_thread.start()
92
92
  # callback(jsonEvent['data'])
93
93
  return
94
+ else:
95
+ self.result = data
94
96
  self.response_event.set() # イベントをセットして、メッセージの受信を通知
95
97
  except json.JSONDecodeError:
96
98
  logging.error("JSONDecodeError '%s'" % message)
@@ -264,13 +266,15 @@ class Player:
264
266
  raise UninitializedClientError("Client is not initialized")
265
267
 
266
268
  message = {
267
- "type": "entities",
269
+ "type": "attach",
270
+ "data": {"entity": name}
268
271
  }
269
272
  self.client.send(json.dumps(message))
270
- entities = self.client.result
271
- entity = next((entity for entity in entities if entity['name'] == name), None)
273
+ uuid = self.client.result
274
+ if(uuid is None):
275
+ raise ValueError("Entity '%s' not found" % name)
272
276
 
273
- return Entity(self.client, self.world, entity['entityUuid'])
277
+ return Entity(self.client, self.world, uuid)
274
278
 
275
279
  class World:
276
280
  """
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: py2hackCraft2
3
- Version: 1.0.5
3
+ Version: 1.0.7
4
4
  Summary: These are APIs that connect to the hackCraft2 server from Python to manipulate pets.
5
5
  Home-page: https://pypi.org/project/py2hackCraft2/
6
6
  Author: Masafumi Terazono
@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
2
2
 
3
3
  setup(
4
4
  name="py2hackCraft2",
5
- version="1.0.5",
5
+ version="1.0.7",
6
6
  packages=find_packages(),
7
7
  install_requires=[
8
8
  "websocket-client" # websocketライブラリの追加
File without changes
File without changes