diff --git a/CHANGELOG.md b/CHANGELOG.md index 8bc5b57..ebfee80 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,6 +22,7 @@ Protocols: - Valve: The rules field is now a `HashMap` instead of a `Vec` (where the `ServerRule` structure had a name and a value fields). - Valve: Structs that contained the `players`, `max_players` and `bots` fields have been renamed to `players_online`, `players_maximum` and `players_bots` respectively. - Minecraft: Structs that contained the `online_players`, `max_players` and `sample_players` fields have been renamed to `players_online`, `players_maximum` and `players_sample` respectively. +- Minecraft: The Java query response struct named `Response` has been renamed to `JavaResponse`. Errors: - Besides the `BadGame` error, now no other errors returns details about what happened (as it was quite pointless). diff --git a/src/protocols/minecraft/types.rs b/src/protocols/minecraft/types.rs index aa85e82..1723b81 100644 --- a/src/protocols/minecraft/types.rs +++ b/src/protocols/minecraft/types.rs @@ -43,7 +43,7 @@ pub struct Player { pub struct JavaResponse { /// Version name, example: "1.19.2". pub version_name: String, - /// Version protocol, example: 760 (for 1.19.2). + /// Version protocol, example: 760 (for 1.19.2). Note that for versions below 1.6 this field is always -1. pub version_protocol: i32, /// Number of server capacity. pub players_maximum: u32, @@ -66,25 +66,25 @@ pub struct JavaResponse { /// A Bedrock Edition query response. #[derive(Debug)] pub struct BedrockResponse { - /// Server edition. + /// Server's edition. pub edition: String, - /// Server name. + /// Server's name. pub name: String, /// Version name, example: "1.19.40". pub version_name: String, /// Version protocol, example: 760 (for 1.19.2). pub version_protocol: String, - /// Number of server capacity. + /// Maximum number of players the server reports it can hold. pub players_maximum: u32, - /// Number of online players. + /// Number of players on the server. pub players_online: u32, /// Server id. pub id: Option, - /// The map. + /// Currently running map's name. pub map: Option, - /// Game mode. + /// Current game mode. pub game_mode: Option, - /// Tell's the server type. + /// Tells the server type. pub server_type: Server } diff --git a/src/protocols/types.rs b/src/protocols/types.rs index eebeb88..5e0bac6 100644 --- a/src/protocols/types.rs +++ b/src/protocols/types.rs @@ -10,7 +10,7 @@ pub struct TimeoutSettings { } impl TimeoutSettings { - /// Construct new settings, passing None will block indefinitely. Passing zero Duration throws GDError::[InvalidInput](GDError::InvalidInput). + /// Construct new settings, passing None will block indefinitely. Passing zero Duration throws GDError::[InvalidInput](InvalidInput). pub fn new(read: Option, write: Option) -> GDResult { if let Some(read_duration) = read { if read_duration == Duration::new(0, 0) { diff --git a/src/protocols/valve/types.rs b/src/protocols/valve/types.rs index 986f3ed..fcb955f 100644 --- a/src/protocols/valve/types.rs +++ b/src/protocols/valve/types.rs @@ -35,7 +35,7 @@ pub struct ServerInfo { pub map: String, /// Name of the folder containing the game files. pub folder: String, - /// Full name of the game. + /// The name of the game. pub game: String, /// [Steam Application ID](https://developer.valvesoftware.com/wiki/Steam_Application_ID) of game. pub appid: u32, @@ -72,7 +72,7 @@ pub struct ServerPlayer { pub name: String, /// General score. pub score: u32, - /// How long they've been on the server for. + /// How long a player has been in the server (seconds). pub duration: f32, /// Only for [the ship](https://developer.valvesoftware.com/wiki/The_Ship): deaths count pub deaths: Option, //the_ship @@ -95,11 +95,11 @@ pub struct ExtraData { pub port: Option, /// Server's SteamID. pub steam_id: Option, - /// Spectator port number for SourceTV. + /// SourceTV's port. pub tv_port: Option, - /// Name of the spectator server for SourceTV. + /// SourceTV's name. pub tv_name: Option, - /// Tags that describe the game according to the server. + /// Keywords that describe the server according to it. pub keywords: Option, /// The server's 64-bit GameID. pub game_id: Option @@ -250,10 +250,14 @@ pub mod game { use crate::protocols::valve::types::get_optional_extracted_data; use super::{Server, ServerPlayer}; + /// A player's details. #[derive(Debug)] pub struct Player { + /// Player's name. pub name: String, + /// Player's score. pub score: u32, + /// How long a player has been in the server (seconds). pub duration: f32 } @@ -267,25 +271,44 @@ pub mod game { } } + /// The query response. #[derive(Debug)] pub struct Response { + /// Protocol used by the server. pub protocol: u8, + /// Name of the server. pub name: String, + /// Map name. pub map: String, + /// The name of the game. pub game: String, + /// Number of players on the server. pub players_online: u8, + /// Details about the server's players (not all players necessarily). pub players_details: Vec, + /// Maximum number of players the server reports it can hold. pub players_maximum: u8, + /// Number of bots on the server. pub players_bots: u8, + /// Dedicated, NonDedicated or SourceTV pub server_type: Server, + /// Indicates whether the server requires a password. pub has_password: bool, + /// Indicated whether the server uses VAC. pub vac_secured: bool, + /// Version of the game installed on the server. pub version: String, + /// The server's reported connection port. pub port: Option, + /// Server's SteamID. pub steam_id: Option, + /// SourceTV's connection port. pub tv_port: Option, + /// SourceTV's name. pub tv_name: Option, + /// Keywords that describe the server according to it. pub keywords: Option, + /// Server's rules. pub rules: HashMap }