mirror of
https://github.com/tribufu/rust-gamedig
synced 2026-05-06 15:27:28 +00:00
Protocol: Minecraft: Rename players-related fields
This commit is contained in:
parent
4fb1350753
commit
f2ae81002e
7 changed files with 24 additions and 24 deletions
|
|
@ -20,8 +20,8 @@ Crate:
|
|||
### Breaking:
|
||||
Protocols:
|
||||
- Valve: The rules field is now a `HashMap<String, String>` instead of a `Vec<ServerRule>` (where the `ServerRule` structure had a name and a value fields).
|
||||
- Valve: `ServerInfo`'s `players`, `max_players` and `bots` have been renamed to `players_online`, `players_maximum` and `players_bots` respectively.
|
||||
- Valve: `Response`'s `players`, `max_players` and `bots` have been renamed to `players_online`, `players_maximum` and `players_bots` respectively.
|
||||
- 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.
|
||||
|
||||
Errors:
|
||||
- Besides the `BadGame` error, now no other errors returns details about what happened (as it was quite pointless).
|
||||
|
|
|
|||
|
|
@ -83,8 +83,8 @@ impl Bedrock {
|
|||
name: status[1].to_string(),
|
||||
version_name: status[3].to_string(),
|
||||
version_protocol: status[2].to_string(),
|
||||
max_players: status[5].parse().map_err(|_| TypeParse)?,
|
||||
online_players: status[4].parse().map_err(|_| TypeParse)?,
|
||||
players_maximum: status[5].parse().map_err(|_| TypeParse)?,
|
||||
players_online: status[4].parse().map_err(|_| TypeParse)?,
|
||||
id: status.get(6).and_then(|v| Some(v.to_string())),
|
||||
map: status.get(7).and_then(|v| Some(v.to_string())),
|
||||
game_mode: match status.get(8) {
|
||||
|
|
|
|||
|
|
@ -110,9 +110,9 @@ impl Java {
|
|||
Ok(Response {
|
||||
version_name,
|
||||
version_protocol,
|
||||
max_players,
|
||||
online_players,
|
||||
sample_players,
|
||||
players_maximum: max_players,
|
||||
players_online: online_players,
|
||||
players_sample: sample_players,
|
||||
description: value_response["description"].to_string(),
|
||||
favicon: value_response["favicon"].as_str().map(str::to_string),
|
||||
previews_chat: value_response["previewsChat"].as_bool(),
|
||||
|
|
|
|||
|
|
@ -51,9 +51,9 @@ impl LegacyBV1_8 {
|
|||
Ok(Response {
|
||||
version_name: "Beta 1.8+".to_string(),
|
||||
version_protocol: -1,
|
||||
max_players,
|
||||
online_players,
|
||||
sample_players: None,
|
||||
players_maximum: max_players,
|
||||
players_online: online_players,
|
||||
players_sample: None,
|
||||
description,
|
||||
favicon: None,
|
||||
previews_chat: None,
|
||||
|
|
|
|||
|
|
@ -56,9 +56,9 @@ impl LegacyV1_4 {
|
|||
Ok(Response {
|
||||
version_name: "1.4+".to_string(),
|
||||
version_protocol: -1,
|
||||
max_players,
|
||||
online_players,
|
||||
sample_players: None,
|
||||
players_maximum: max_players,
|
||||
players_online: online_players,
|
||||
players_sample: None,
|
||||
description,
|
||||
favicon: None,
|
||||
previews_chat: None,
|
||||
|
|
|
|||
|
|
@ -64,9 +64,9 @@ impl LegacyV1_6 {
|
|||
Ok(Response {
|
||||
version_name,
|
||||
version_protocol,
|
||||
max_players,
|
||||
online_players,
|
||||
sample_players: None,
|
||||
players_maximum: max_players,
|
||||
players_online: online_players,
|
||||
players_sample: None,
|
||||
description,
|
||||
favicon: None,
|
||||
previews_chat: None,
|
||||
|
|
|
|||
|
|
@ -46,11 +46,11 @@ pub struct Response {
|
|||
/// Version protocol, example: 760 (for 1.19.2).
|
||||
pub version_protocol: i32,
|
||||
/// Number of server capacity.
|
||||
pub max_players: u32,
|
||||
pub players_maximum: u32,
|
||||
/// Number of online players.
|
||||
pub online_players: u32,
|
||||
pub players_online: u32,
|
||||
/// Some online players (can be missing).
|
||||
pub sample_players: Option<Vec<Player>>,
|
||||
pub players_sample: Option<Vec<Player>>,
|
||||
/// Server's description or MOTD.
|
||||
pub description: String,
|
||||
/// The favicon (can be missing).
|
||||
|
|
@ -75,9 +75,9 @@ pub struct BedrockResponse {
|
|||
/// Version protocol, example: 760 (for 1.19.2).
|
||||
pub version_protocol: String,
|
||||
/// Number of server capacity.
|
||||
pub max_players: u32,
|
||||
pub players_maximum: u32,
|
||||
/// Number of online players.
|
||||
pub online_players: u32,
|
||||
pub players_online: u32,
|
||||
/// Server id.
|
||||
pub id: Option<String>,
|
||||
/// The map.
|
||||
|
|
@ -93,9 +93,9 @@ impl Response {
|
|||
Self {
|
||||
version_name: response.version_name,
|
||||
version_protocol: 0,
|
||||
max_players: response.max_players,
|
||||
online_players: response.online_players,
|
||||
sample_players: None,
|
||||
players_maximum: response.players_maximum,
|
||||
players_online: response.players_online,
|
||||
players_sample: None,
|
||||
description: response.name,
|
||||
favicon: None,
|
||||
previews_chat: None,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue