diff options
| author | mat <github@matdoes.dev> | 2022-09-06 22:24:21 -0500 |
|---|---|---|
| committer | mat <github@matdoes.dev> | 2022-09-06 22:24:21 -0500 |
| commit | 8fe02ed1150c81e52ec6405f2abfd8e8563e3d99 (patch) | |
| tree | 96989f3d96ebf7b0bdbf4f1325726b987c0a9d9e | |
| parent | 403ae0d72bdf792de5fa34db78d3013fb752c8d4 (diff) | |
| download | azalea-drasl-8fe02ed1150c81e52ec6405f2abfd8e8563e3d99.tar.xz | |
BrigadierNodeStub::name()
| -rw-r--r-- | azalea-protocol/src/packets/game/clientbound_commands_packet.rs | 12 |
1 files changed, 11 insertions, 1 deletions
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<BrigadierNodeStub>, #[var] - pub root_index: i32, + pub root_index: u32, } #[derive(Debug, Clone)] @@ -279,3 +279,13 @@ pub enum NodeType { suggestions_type: Option<ResourceLocation>, }, } + +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), + } + } +} |
