From 9f5e5c092be9167e4d5222fdee4a1d2c419e5052 Mon Sep 17 00:00:00 2001 From: EightFactorial Date: Tue, 6 Dec 2022 18:48:48 -0800 Subject: Complete ClientboundCommand{Suggestion}sPacket, Serde support for NBT Tags (#49) * Serializing ClientboundStatusResponsePacket Enable serialization of ClientboundStatusResponsePacket * Update clientbound_status_response_packet.rs Add options previewsChat and enforcesSecureChat * Serialize Style and TextColor * Serialize BaseComponent * Serialize TextComponent * Fix Style * Serialize Component * Fix multiple formats per message, fix reset tag * Fix Style, again * Use FlatMapSerializer * Forgot italics * Count struct fields, reorganize logic * Serialize TranslatableComponent * Rewrite TextComponent Serializer * Fix using TextColor::Parse * Code Cleanup * Add default attribute, just in case * Clippy * use serde derive feature + preferred formatting choices * McBufWritable for BrigadierNodeStub * Thanks Clippy... * Implement suggestions in azalea-brigadier * Serde support for NBT Tags * Serde options * Forgot Options * Oops, that's McBufWritable for BrigadierParser * Fix McBufWritable for SlotData * Complete ClientboundUpdateRecipesPacket * fix some issues * better impl McBufReadable for Suggestions Co-authored-by: BuildTools Co-authored-by: mat --- azalea-brigadier/src/exceptions/command_syntax_exception.rs | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'azalea-brigadier/src/exceptions/command_syntax_exception.rs') diff --git a/azalea-brigadier/src/exceptions/command_syntax_exception.rs b/azalea-brigadier/src/exceptions/command_syntax_exception.rs index 14376a87..0254820d 100755 --- a/azalea-brigadier/src/exceptions/command_syntax_exception.rs +++ b/azalea-brigadier/src/exceptions/command_syntax_exception.rs @@ -1,5 +1,4 @@ use super::builtin_exceptions::BuiltInExceptions; -use crate::message::Message; use std::{ cmp, fmt::{self, Write}, @@ -8,7 +7,7 @@ use std::{ #[derive(Clone, PartialEq)] pub struct CommandSyntaxException { pub type_: BuiltInExceptions, - message: Message, + message: String, input: Option, cursor: Option, } @@ -16,7 +15,7 @@ pub struct CommandSyntaxException { const CONTEXT_AMOUNT: usize = 10; impl CommandSyntaxException { - pub fn new(type_: BuiltInExceptions, message: Message, input: &str, cursor: usize) -> Self { + pub fn new(type_: BuiltInExceptions, message: String, input: &str, cursor: usize) -> Self { Self { type_, message, @@ -25,7 +24,7 @@ impl CommandSyntaxException { } } - pub fn create(type_: BuiltInExceptions, message: Message) -> Self { + pub fn create(type_: BuiltInExceptions, message: String) -> Self { Self { type_, message, @@ -35,7 +34,7 @@ impl CommandSyntaxException { } pub fn message(&self) -> String { - let mut message = self.message.string(); + let mut message = self.message.clone(); let context = self.context(); if let Some(context) = context { write!( @@ -49,7 +48,7 @@ impl CommandSyntaxException { message } - pub fn raw_message(&self) -> &Message { + pub fn raw_message(&self) -> &String { &self.message } -- cgit v1.2.3