pub struct JavaStatus {
pub version: JavaVersion,
pub players: JavaPlayers,
pub description: String,
pub favicon: Option<String>,
pub map: Option<String>,
pub gamemode: Option<String>,
pub software: Option<String>,
pub plugins: Option<Vec<JavaPlugin>>,
pub mods: Option<Vec<JavaMod>>,
pub raw_data: Value,
}Expand description
Java Edition server status.
Contains detailed information about a Java Edition server, including version, players, plugins, mods, and more.
§Example
use rust_mc_status::{McClient, ServerEdition};
let client = McClient::new();
let status = client.ping("mc.hypixel.net", ServerEdition::Java).await?;
if let rust_mc_status::ServerData::Java(java) = status.data {
println!("Version: {}", java.version.name);
println!("Players: {}/{}", java.players.online, java.players.max);
println!("Description: {}", java.description);
if let Some(plugins) = &java.plugins {
println!("Plugins: {}", plugins.len());
}
}Fields§
§version: JavaVersionServer version information.
players: JavaPlayersPlayer information.
description: StringServer description (MOTD).
favicon: Option<String>Base64-encoded favicon (PNG image data).
map: Option<String>Current map name.
gamemode: Option<String>Game mode.
software: Option<String>Server software (e.g., “Paper”, “Spigot”, “Vanilla”).
plugins: Option<Vec<JavaPlugin>>List of installed plugins.
mods: Option<Vec<JavaMod>>List of installed mods.
raw_data: ValueRaw JSON data from server response.
Implementations§
Source§impl JavaStatus
impl JavaStatus
Sourcepub fn save_favicon(&self, filename: &str) -> Result<(), McError>
pub fn save_favicon(&self, filename: &str) -> Result<(), McError>
Save the server favicon to a file.
The favicon is decoded from base64 and saved as a PNG image.
§Arguments
filename- Path where the favicon should be saved
§Errors
Returns an error if:
- No favicon is available
- Base64 decoding fails
- File I/O fails
§Example
use rust_mc_status::{McClient, ServerEdition};
let client = McClient::new();
let status = client.ping("mc.hypixel.net", ServerEdition::Java).await?;
if let rust_mc_status::ServerData::Java(java) = status.data {
java.save_favicon("server_icon.png")?;
}Trait Implementations§
Source§impl Clone for JavaStatus
impl Clone for JavaStatus
Source§fn clone(&self) -> JavaStatus
fn clone(&self) -> JavaStatus
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for JavaStatus
impl Debug for JavaStatus
Source§impl<'de> Deserialize<'de> for JavaStatus
impl<'de> Deserialize<'de> for JavaStatus
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for JavaStatus
impl RefUnwindSafe for JavaStatus
impl Send for JavaStatus
impl Sync for JavaStatus
impl Unpin for JavaStatus
impl UnwindSafe for JavaStatus
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more