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<SmallVec<[JavaPlugin; 8]>>,
pub mods: Option<SmallVec<[JavaMod; 8]>>,
pub raw_data: Value,
}Expand description
Full status payload returned by a Java Edition server.
Produced by parsing the JSON body of the Status Response packet (0x00).
Accessed via JavaServerStatus accessors or
directly through ServerData::Java.
§Serde behaviour
favicon is excluded from serialisation (#[serde(skip_serializing)]) to
avoid bloating JSON output — it is a base64 PNG that can be hundreds of KB.
raw_data is excluded entirely (#[serde(skip)]).
Fields§
§version: JavaVersionServer version information (name string + protocol number).
players: JavaPlayersOnline / max player counts plus an optional sample list.
description: StringPrimary server description (MOTD). May contain §-color codes.
Use JavaServerStatus::motd_clean
to get a plain-text version.
favicon: Option<String>Base64-encoded 64×64 PNG favicon. None if the server does not
send one. Excluded from JSON serialisation — use
JavaServerStatus::favicon or
save_favicon to access it.
map: Option<String>Current map/world name. Only present on servers that expose it (e.g. via a status plugin).
gamemode: Option<String>Game mode string (e.g. "Survival"). Plugin-specific, not standard.
software: Option<String>Server software name (e.g. "Paper 1.21.4"). Plugin-specific.
plugins: Option<SmallVec<[JavaPlugin; 8]>>Plugin list. SmallVec<[_; 8]> avoids a heap allocation for servers
with 8 or fewer plugins, which covers most vanilla/lightly-modded setups.
None when the server does not expose plugin information.
mods: Option<SmallVec<[JavaMod; 8]>>Mod list (Forge/Fabric servers). Same allocation strategy as plugins.
None when the server does not expose mod information.
raw_data: ValueRaw JSON response body. Excluded from serialisation. Useful for accessing non-standard fields added by server plugins.
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 PNG file on disk.
Strips the optional data:image/png;base64, URI prefix before decoding.
§Errors
McError::Protocol— no favicon available (field isNone).McError::Protocol— base64 decoding failed (malformed data).McError::Io— file could not be created or written.
§Example
let client = McClient::builder().build();
if let Ok(s) = client.java("mc.hypixel.net").await {
s.save_favicon("hypixel_icon.png")?;
}Trait Implementations§
Source§impl Clone for JavaStatus
impl Clone for JavaStatus
Source§fn clone(&self) -> JavaStatus
fn clone(&self) -> JavaStatus
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
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>,
Auto Trait Implementations§
impl Freeze for JavaStatus
impl RefUnwindSafe for JavaStatus
impl Send for JavaStatus
impl Sync for JavaStatus
impl Unpin for JavaStatus
impl UnsafeUnpin 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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more