diff --git a/src/errors.rs b/src/errors.rs index 23711a9..04fd2f5 100644 --- a/src/errors.rs +++ b/src/errors.rs @@ -39,7 +39,7 @@ pub enum GDError { /// Couldn't automatically query. AutoQuery(&'static str), /// A protocol-defined expected format was not met. - ProtocolRule(&'static str), + ProtocolFormat(&'static str), } impl fmt::Display for GDError { @@ -59,7 +59,7 @@ impl fmt::Display for GDError { GDError::SocketConnect(details) => write!(f, "Socket connect: {details}"), GDError::JsonParse(details) => write!(f, "Json parse: {details}"), GDError::AutoQuery(details) => write!(f, "Auto query: {details}"), - GDError::ProtocolRule(details) => write!(f, "Protocol rule: {details}"), + GDError::ProtocolFormat(details) => write!(f, "Protocol rule: {details}"), } } } diff --git a/src/protocols/minecraft/protocol/legacy_bv1_8.rs b/src/protocols/minecraft/protocol/legacy_bv1_8.rs index b935c9a..aea38d9 100644 --- a/src/protocols/minecraft/protocol/legacy_bv1_8.rs +++ b/src/protocols/minecraft/protocol/legacy_bv1_8.rs @@ -31,7 +31,7 @@ impl LegacyBV1_8 { let mut pos = 0; if get_u8(&buf, &mut pos)? != 0xFF { - return Err(GDError::ProtocolRule("Expected 0xFF at the begin of the packet.")); + return Err(GDError::ProtocolFormat("Expected 0xFF at the begin of the packet.")); } let length = get_u16_be(&buf, &mut pos)? * 2; diff --git a/src/protocols/minecraft/protocol/legacy_v1_4.rs b/src/protocols/minecraft/protocol/legacy_v1_4.rs index 29815be..2fc3cd8 100644 --- a/src/protocols/minecraft/protocol/legacy_v1_4.rs +++ b/src/protocols/minecraft/protocol/legacy_v1_4.rs @@ -32,7 +32,7 @@ impl LegacyV1_4 { let mut pos = 0; if get_u8(&buf, &mut pos)? != 0xFF { - return Err(GDError::ProtocolRule("Expected 0xFF at the begin of the packet.")); + return Err(GDError::ProtocolFormat("Expected 0xFF at the begin of the packet.")); } let length = get_u16_be(&buf, &mut pos)? * 2; diff --git a/src/protocols/minecraft/protocol/legacy_v1_6.rs b/src/protocols/minecraft/protocol/legacy_v1_6.rs index 0659261..4f203a7 100644 --- a/src/protocols/minecraft/protocol/legacy_v1_6.rs +++ b/src/protocols/minecraft/protocol/legacy_v1_6.rs @@ -81,14 +81,14 @@ impl LegacyV1_6 { let mut pos = 0; if get_u8(&buf, &mut pos)? != 0xFF { - return Err(GDError::ProtocolRule("Expected a certain byte (0xFF) at the begin of the packet.")); + return Err(GDError::ProtocolFormat("Expected a certain byte (0xFF) at the begin of the packet.")); } let length = get_u16_be(&buf, &mut pos)? * 2; error_by_expected_size((length + 3) as usize, buf.len())?; if !LegacyV1_6::is_protocol(&buf, &mut pos)? { - return Err(GDError::ProtocolRule("Expected certain bytes at the beginning of the packet.")); + return Err(GDError::ProtocolFormat("Expected certain bytes at the beginning of the packet.")); } LegacyV1_6::get_response(&buf, &mut pos)