Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 0 additions & 16 deletions crates/hyperion/src/simulation/event.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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")]
Expand Down
25 changes: 1 addition & 24 deletions crates/hyperion/src/simulation/handlers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
},
Expand Down Expand Up @@ -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<'_>,
Expand Down Expand Up @@ -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));
Expand Down
1 change: 0 additions & 1 deletion crates/hyperion/src/storage/event/queue/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ define_events! {
event::DestroyBlock,
event::ItemDropEvent,
event::PlaceBlock,
event::PluginMessage,
event::PostureUpdate,
event::SwingArm,
event::ToggleDoor,
Expand Down
Loading