fix: minecraft id naming inconsistencies (#152)

* fix: minecraft id naming inconsistencies

* fix: minecraft legacy beta 1.8 being wrongly id named in definitions

* docs: Update CHANGELOG to document minecraft legacy renames

* docs: Update CHANGELOG to note removal of legacy versions game names being prefixed with 'v'
This commit is contained in:
CosminPerRam 2023-11-16 15:18:15 +02:00 committed by GitHub
parent 13f1c2bf35
commit bd73b657c7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 20 additions and 19 deletions

View file

@ -13,12 +13,12 @@ use crate::{
};
use std::net::SocketAddr;
pub struct LegacyV1_5 {
pub struct LegacyV1_4 {
socket: TcpSocket,
retry_count: usize,
}
impl LegacyV1_5 {
impl LegacyV1_4 {
fn new(address: &SocketAddr, timeout_settings: Option<TimeoutSettings>) -> GDResult<Self> {
let socket = TcpSocket::new(address)?;
socket.apply_timeout(&timeout_settings)?;
@ -75,7 +75,7 @@ impl LegacyV1_5 {
favicon: None,
previews_chat: None,
enforces_secure_chat: None,
server_type: Server::Legacy(LegacyGroup::V1_5),
server_type: Server::Legacy(LegacyGroup::V1_4),
})
}

View file

@ -14,12 +14,12 @@ use std::net::SocketAddr;
use byteorder::BigEndian;
pub struct LegacyV1_3 {
pub struct LegacyVB1_8 {
socket: TcpSocket,
retry_count: usize,
}
impl LegacyV1_3 {
impl LegacyVB1_8 {
fn new(address: &SocketAddr, timeout_settings: Option<TimeoutSettings>) -> GDResult<Self> {
let socket = TcpSocket::new(address)?;
socket.apply_timeout(&timeout_settings)?;
@ -72,7 +72,7 @@ impl LegacyV1_3 {
favicon: None,
previews_chat: None,
enforces_secure_chat: None,
server_type: Server::Legacy(LegacyGroup::V1_3),
server_type: Server::Legacy(LegacyGroup::VB1_8),
})
}

View file

@ -4,9 +4,9 @@ use crate::{
protocol::{
bedrock::Bedrock,
java::Java,
legacy_v1_3::LegacyV1_3,
legacy_v1_5::LegacyV1_5,
legacy_v1_4::LegacyV1_4,
legacy_v1_6::LegacyV1_6,
legacy_vb1_8::LegacyVB1_8,
},
BedrockResponse,
JavaResponse,
@ -20,9 +20,9 @@ use std::net::SocketAddr;
mod bedrock;
mod java;
mod legacy_v1_3;
mod legacy_v1_5;
mod legacy_v1_4;
mod legacy_v1_6;
mod legacy_vb1_8;
/// Queries a Minecraft server with all the protocol variants one by one (Java
/// -> Bedrock -> Legacy (1.6 -> 1.4 -> Beta 1.8)).
@ -61,11 +61,11 @@ pub fn query_legacy(address: &SocketAddr, timeout_settings: Option<TimeoutSettin
return Ok(response);
}
if let Ok(response) = query_legacy_specific(LegacyGroup::V1_5, address, timeout_settings) {
if let Ok(response) = query_legacy_specific(LegacyGroup::V1_4, address, timeout_settings) {
return Ok(response);
}
if let Ok(response) = query_legacy_specific(LegacyGroup::V1_3, address, timeout_settings) {
if let Ok(response) = query_legacy_specific(LegacyGroup::VB1_8, address, timeout_settings) {
return Ok(response);
}
@ -80,8 +80,8 @@ pub fn query_legacy_specific(
) -> GDResult<JavaResponse> {
match group {
LegacyGroup::V1_6 => LegacyV1_6::query(address, timeout_settings),
LegacyGroup::V1_5 => LegacyV1_5::query(address, timeout_settings),
LegacyGroup::V1_3 => LegacyV1_3::query(address, timeout_settings),
LegacyGroup::V1_4 => LegacyV1_4::query(address, timeout_settings),
LegacyGroup::VB1_8 => LegacyVB1_8::query(address, timeout_settings),
}
}

View file

@ -35,9 +35,9 @@ pub enum LegacyGroup {
/// 1.6
V1_6,
/// 1.4 - 1.5
V1_5,
V1_4,
/// Beta 1.8 - 1.3
V1_3,
VB1_8,
}
/// Information about a player.