aboutsummaryrefslogtreecommitdiff
path: root/azalea-client/src/plugins/packet/game/events.rs
diff options
context:
space:
mode:
authormat <git@matdoes.dev>2025-03-25 05:16:10 +0000
committermat <git@matdoes.dev>2025-03-25 05:16:10 +0000
commit8af265e48bf9f3d5263c074d034770e4216bb3f3 (patch)
tree2605ce1d6ed8c74d47b6c355e6918721b0dc07aa /azalea-client/src/plugins/packet/game/events.rs
parent4c53498f0795f821066941f39917ad2e4fa9a3cc (diff)
downloadazalea-drasl-8af265e48bf9f3d5263c074d034770e4216bb3f3.tar.xz
PongPlugin
Diffstat (limited to 'azalea-client/src/plugins/packet/game/events.rs')
-rw-r--r--azalea-client/src/plugins/packet/game/events.rs18
1 files changed, 18 insertions, 0 deletions
diff --git a/azalea-client/src/plugins/packet/game/events.rs b/azalea-client/src/plugins/packet/game/events.rs
index 8a5aca3c..ad81f9bd 100644
--- a/azalea-client/src/plugins/packet/game/events.rs
+++ b/azalea-client/src/plugins/packet/game/events.rs
@@ -212,3 +212,21 @@ pub struct InstanceLoadedEvent {
pub name: ResourceLocation,
pub instance: Weak<RwLock<Instance>>,
}
+
+/// A Bevy trigger that's sent when our client receives a [`ClientboundPing`]
+/// packet in the game state.
+///
+/// Also see [`ConfigPingEvent`] which is used for the config state.
+///
+/// This is not an event and can't be listened to from a normal system,
+///so `EventReader<PingEvent>` will not work.
+///
+/// To use it, add your "system" with `add_observer` instead of `add_systems`
+/// and use `Trigger<PingEvent>` instead of `EventReader`.
+///
+/// The client Entity that received the packet will be attached to the trigger.
+///
+/// [`ClientboundPing`]: azalea_protocol::packets::game::ClientboundPing
+/// [`ConfigPingEvent`]: crate::packet::config::ConfigPingEvent
+#[derive(Event, Debug, Clone)]
+pub struct PingEvent(pub azalea_protocol::packets::game::ClientboundPing);