mirror of
https://github.com/tribufu/rust-gamedig
synced 2026-05-06 07:17:27 +00:00
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:
parent
13f1c2bf35
commit
bd73b657c7
6 changed files with 20 additions and 19 deletions
|
|
@ -21,6 +21,7 @@ Game:
|
|||
- - Left 4 Dead: `left4dead` -> `l4d`.
|
||||
- - 7 Days to Die: `7d2d` in definitions and `sd2d` in game declaration -> `sdtd`.
|
||||
- - Quake 3 Arena: `quake3arena` -> `q3a`.
|
||||
- Minecraft Legacy 1.5 and 1.3 were renamed to 1.4 and beta 1.8 respectively to show the lowest version they support, this change includes Structs, Enum and game id renames, also removed the "v" from the game definition name.
|
||||
|
||||
Protocols:
|
||||
- Valve: Removed `SteamApp` due to it not being really useful at all, replaced all instances with `Engine`.
|
||||
|
|
|
|||
|
|
@ -41,9 +41,9 @@ pub static GAMES: Map<&'static str, Game> = phf_map! {
|
|||
"minecraftbedrock" => game!("Minecraft (bedrock)", 19132, Protocol::Minecraft(Some(Server::Bedrock))),
|
||||
"minecraftpocket" => game!("Minecraft (pocket)", 19132, Protocol::Minecraft(Some(Server::Bedrock))),
|
||||
"minecraftjava" => game!("Minecraft (java)", 25565, Protocol::Minecraft(Some(Server::Java))),
|
||||
"minecraftlegacy16" => game!("Minecraft (legacy v1.6)", 25565, Protocol::Minecraft(Some(Server::Legacy(LegacyGroup::V1_6)))),
|
||||
"minecraftlegacy15" => game!("Minecraft (legacy v1.4-1.5)", 25565, Protocol::Minecraft(Some(Server::Legacy(LegacyGroup::V1_5)))),
|
||||
"minecraftlegacy13" => game!("Minecraft (legacy vB1.8-1.3)", 25565, Protocol::Minecraft(Some(Server::Legacy(LegacyGroup::V1_3)))),
|
||||
"minecraftlegacy16" => game!("Minecraft (legacy 1.6)", 25565, Protocol::Minecraft(Some(Server::Legacy(LegacyGroup::V1_6)))),
|
||||
"minecraftlegacy14" => game!("Minecraft (legacy 1.4)", 25565, Protocol::Minecraft(Some(Server::Legacy(LegacyGroup::V1_4)))),
|
||||
"minecraftlegacyb18" => game!("Minecraft (legacy b1.8)", 25565, Protocol::Minecraft(Some(Server::Legacy(LegacyGroup::VB1_8)))),
|
||||
"alienswarm" => game!("Alien Swarm", 27015, Protocol::Valve(Engine::new(630))),
|
||||
"aoc" => game!("Age of Chivalry", 27015, Protocol::Valve(Engine::new(17510))),
|
||||
"a2oa" => game!("ARMA 2: Operation Arrowhead", 2304, Protocol::Valve(Engine::new(33930))),
|
||||
|
|
|
|||
|
|
@ -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),
|
||||
})
|
||||
}
|
||||
|
||||
|
|
@ -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),
|
||||
})
|
||||
}
|
||||
|
||||
|
|
@ -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),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue