Respawn the player automatically on death

feature/embed-uploads
Tristan Gosselin-Hane 7 years ago
parent 68d2055707
commit 54121ad015
  1. 13
      webhook-bridge.py

@ -144,11 +144,22 @@ def main():
print("Username: {} Message: {}".format(username, message))
webhook_payload = {'username': username, 'avatar_url': "https://visage.surgeplay.com/face/160/{}".format(player_uuid),
'embeds': [{'title': '{}'.format(message)}]}
post = requests.post(WEBHOOK_URL,json=webhook_payload)
post = requests.post(WEBHOOK_URL,json=webhook_payload)
connection.register_packet_listener(
print_chat, clientbound.play.ChatMessagePacket)
def handle_health_update(health_update_packet):
if health_update_packet.health <= 0:
#We need to respawn!!!!
print("Respawned the player because it died!")
packet = serverbound.play.ClientStatusPacket()
packet.action_id = serverbound.play.ClientStatusPacket.RESPAWN
connection.write_packet(packet)
connection.register_packet_listener(
handle_health_update, clientbound.play.UpdateHealthPacket)
connection.connect()
@discord_bot.event

Loading…
Cancel
Save