py2hackCraft2 1.0.4__tar.gz → 1.0.5__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.
- {py2hackCraft2-1.0.4 → py2hackCraft2-1.0.5}/PKG-INFO +1 -1
- {py2hackCraft2-1.0.4 → py2hackCraft2-1.0.5}/py2hackCraft/modules.py +38 -1
- {py2hackCraft2-1.0.4 → py2hackCraft2-1.0.5}/py2hackCraft2.egg-info/PKG-INFO +1 -1
- {py2hackCraft2-1.0.4 → py2hackCraft2-1.0.5}/setup.py +1 -1
- {py2hackCraft2-1.0.4 → py2hackCraft2-1.0.5}/README.md +0 -0
- {py2hackCraft2-1.0.4 → py2hackCraft2-1.0.5}/py2hackCraft/__init__.py +0 -0
- {py2hackCraft2-1.0.4 → py2hackCraft2-1.0.5}/py2hackCraft/material.py +0 -0
- {py2hackCraft2-1.0.4 → py2hackCraft2-1.0.5}/py2hackCraft2.egg-info/SOURCES.txt +0 -0
- {py2hackCraft2-1.0.4 → py2hackCraft2-1.0.5}/py2hackCraft2.egg-info/dependency_links.txt +0 -0
- {py2hackCraft2-1.0.4 → py2hackCraft2-1.0.5}/py2hackCraft2.egg-info/requires.txt +0 -0
- {py2hackCraft2-1.0.4 → py2hackCraft2-1.0.5}/py2hackCraft2.egg-info/top_level.txt +0 -0
- {py2hackCraft2-1.0.4 → py2hackCraft2-1.0.5}/setup.cfg +0 -0
|
@@ -143,6 +143,21 @@ class Location:
|
|
|
143
143
|
z: int
|
|
144
144
|
world: str = "world"
|
|
145
145
|
|
|
146
|
+
@dataclass
|
|
147
|
+
class EventMessage:
|
|
148
|
+
"""
|
|
149
|
+
イベントメッセージを表すデータクラス。
|
|
150
|
+
|
|
151
|
+
Attributes:
|
|
152
|
+
sender (str): 送信者の名前。
|
|
153
|
+
uuid (str): 送信者の一意の識別子(UUID)。
|
|
154
|
+
message (str): イベントメッセージ。
|
|
155
|
+
"""
|
|
156
|
+
entityUuid: str
|
|
157
|
+
sender: str
|
|
158
|
+
uuid: str
|
|
159
|
+
message: str
|
|
160
|
+
|
|
146
161
|
|
|
147
162
|
@dataclass
|
|
148
163
|
class ChatMessage:
|
|
@@ -150,7 +165,7 @@ class ChatMessage:
|
|
|
150
165
|
チャットメッセージを表すデータクラス。
|
|
151
166
|
|
|
152
167
|
Attributes:
|
|
153
|
-
player (str):
|
|
168
|
+
player (str): プレイヤー名。
|
|
154
169
|
uuid (str): プレイヤーの一意の識別子(UUID)。
|
|
155
170
|
message (str): プレイヤーがチャットで送信したメッセージの内容。
|
|
156
171
|
"""
|
|
@@ -396,6 +411,28 @@ class Entity:
|
|
|
396
411
|
callbackFunc(self, power)
|
|
397
412
|
self.client.setCallback('onEntityRedstone', callbackWrapper)
|
|
398
413
|
|
|
414
|
+
def setOnMessage(self, callbackFunc: Callable[['Entity', str], Any]):
|
|
415
|
+
"""
|
|
416
|
+
メッセージを受信したときに呼び出されるコールバック関数を設定する。
|
|
417
|
+
"""
|
|
418
|
+
def callbackWrapper(data):
|
|
419
|
+
logging.debug("setOnMessage callbackWrapper '%s'" % data)
|
|
420
|
+
if(data['entityUuid'] == self.uuid):
|
|
421
|
+
logging.debug("callbackWrapper '%s'" % data)
|
|
422
|
+
event = EventMessage(**data)
|
|
423
|
+
callbackFunc(self, event)
|
|
424
|
+
self.client.setCallback('onCustomEvent', callbackWrapper)
|
|
425
|
+
|
|
426
|
+
def sendMessage(self, target: str, message: str):
|
|
427
|
+
"""
|
|
428
|
+
メッセージを送信する。
|
|
429
|
+
|
|
430
|
+
Args:
|
|
431
|
+
target (str): 送信先のEntityの名前。
|
|
432
|
+
message (str): 送信するメッセージの内容。
|
|
433
|
+
"""
|
|
434
|
+
self.client.sendCall(self.uuid, "sendEvent", [target, message])
|
|
435
|
+
|
|
399
436
|
def getWorld(self) -> 'World':
|
|
400
437
|
"""
|
|
401
438
|
指定された名前のワールドを取得する。
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|