From 0963467d7a559317e77ce4dcc3ce76d661fc1890 Mon Sep 17 00:00:00 2001 From: TestingPlant <44930139+TestingPlant@users.noreply.github.com> Date: Sun, 19 Jan 2025 19:42:55 +0000 Subject: [PATCH] fix: remove PluginMessage PluginMessage was never consumed anywhere and caused an abort because of this. --- crates/hyperion/src/simulation/event.rs | 16 ------------ crates/hyperion/src/simulation/handlers.rs | 25 +------------------ .../hyperion/src/storage/event/queue/mod.rs | 1 - 3 files changed, 1 insertion(+), 41 deletions(-) diff --git a/crates/hyperion/src/simulation/event.rs b/crates/hyperion/src/simulation/event.rs index 5bd60e8c..1ae82b88 100644 --- a/crates/hyperion/src/simulation/event.rs +++ b/crates/hyperion/src/simulation/event.rs @@ -91,22 +91,6 @@ pub struct ReleaseUseItem { pub item: ItemKind, } -pub struct PluginMessage { - pub channel: RuntimeLifetime<&'static str>, - pub data: RuntimeLifetime<&'static [u8]>, -} - -impl std::fmt::Debug for PluginMessage { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - let bytes = bytes::Bytes::copy_from_slice(self.data.get()); - - f.debug_struct("PluginMessage") - .field("channel", self.channel.get()) - .field("data", &bytes) - .finish() - } -} - #[derive(Copy, Clone, Debug, PartialEq, Eq, Hash)] #[repr(i32)] #[expect(missing_docs, reason = "self explanatory")] diff --git a/crates/hyperion/src/simulation/handlers.rs b/crates/hyperion/src/simulation/handlers.rs index ca2cea7f..6b6c5b0a 100644 --- a/crates/hyperion/src/simulation/handlers.rs +++ b/crates/hyperion/src/simulation/handlers.rs @@ -36,8 +36,7 @@ use super::{ use crate::{ net::{Compose, ConnectionId, decoder::BorrowedPacketFrame}, simulation::{ - Pitch, Yaw, aabb, - event::{self, PluginMessage}, + Pitch, Yaw, aabb, event, metadata::{entity::Pose, living_entity::HandStates}, packet::HandlerRegistry, }, @@ -510,27 +509,6 @@ pub fn creative_inventory_action( Ok(()) } -pub fn custom_payload<'a>( - packet: &play::CustomPayloadC2s<'a>, - handle: &dyn LifetimeHandle<'a>, - query: &mut PacketSwitchQuery<'_>, -) -> anyhow::Result<()> { - let channel = packet.channel.clone().into_inner(); - - let Cow::Borrowed(borrow) = channel else { - bail!("NO") - }; - - let event = PluginMessage { - channel: RuntimeLifetime::new(borrow, handle), - data: RuntimeLifetime::new(packet.data.0.0, handle), - }; - - query.events.push(event, query.world); - - Ok(()) -} - // keywords: inventory fn click_slot( pkt: &play::ClickSlotC2s<'_>, @@ -649,7 +627,6 @@ pub fn add_builtin_handlers(registry: &mut HandlerRegistry) { registry.add_handler(Box::new(client_status)); registry.add_handler(Box::new(chat_command)); registry.add_handler(Box::new(creative_inventory_action)); - registry.add_handler(Box::new(custom_payload)); registry.add_handler(Box::new(full)); registry.add_handler(Box::new(hand_swing)); registry.add_handler(Box::new(look_and_on_ground)); diff --git a/crates/hyperion/src/storage/event/queue/mod.rs b/crates/hyperion/src/storage/event/queue/mod.rs index 7d950d9c..1d63faf8 100644 --- a/crates/hyperion/src/storage/event/queue/mod.rs +++ b/crates/hyperion/src/storage/event/queue/mod.rs @@ -53,7 +53,6 @@ define_events! { event::DestroyBlock, event::ItemDropEvent, event::PlaceBlock, - event::PluginMessage, event::PostureUpdate, event::SwingArm, event::ToggleDoor,