From 8fe02ed1150c81e52ec6405f2abfd8e8563e3d99 Mon Sep 17 00:00:00 2001 From: mat Date: Tue, 6 Sep 2022 22:24:21 -0500 Subject: BrigadierNodeStub::name() --- .../src/packets/game/clientbound_commands_packet.rs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'azalea-protocol') diff --git a/azalea-protocol/src/packets/game/clientbound_commands_packet.rs b/azalea-protocol/src/packets/game/clientbound_commands_packet.rs index 732ceaa9..c05f710a 100644 --- a/azalea-protocol/src/packets/game/clientbound_commands_packet.rs +++ b/azalea-protocol/src/packets/game/clientbound_commands_packet.rs @@ -10,7 +10,7 @@ use std::io::{Read, Write}; pub struct ClientboundCommandsPacket { pub entries: Vec, #[var] - pub root_index: i32, + pub root_index: u32, } #[derive(Debug, Clone)] @@ -279,3 +279,13 @@ pub enum NodeType { suggestions_type: Option, }, } + +impl BrigadierNodeStub { + pub fn name(&self) -> Option<&str> { + match &self.node_type { + NodeType::Root => None, + NodeType::Literal { name } => Some(name), + NodeType::Argument { name, .. } => Some(name), + } + } +} -- cgit v1.2.3