Make Icon Optional
This commit is contained in:
1 parent
e23587b698
commit
b37039126a
3 files changed
+11
-5
No files matched your search
@@ -188,8 +188,8 @@ pub struct StatusResponse {
|
|||||||
pub version: Version,
|
pub version: Version,
|
||||||
pub players: Players,
|
pub players: Players,
|
||||||
pub description: String,
|
pub description: String,
|
||||||
pub favicon: String, // data:image/png;base64,<data>
|
pub favicon: Option<String>, // data:image/png;base64,<data>
|
||||||
// Players, favicon ...
|
// Players, favicon ...
|
||||||
}
|
}
|
||||||
#[derive(Serialize)]
|
#[derive(Serialize)]
|
||||||
pub struct Version {
|
pub struct Version {
|
||||||
|
|||||||
@@ -302,7 +302,7 @@ impl Client {
|
|||||||
if config.hurt_animation {
|
if config.hurt_animation {
|
||||||
// TODO
|
// TODO
|
||||||
// thats how we prevent borrow errors :c
|
// thats how we prevent borrow errors :c
|
||||||
let packet = &CHurtAnimation::new(&entity_id, 10.0);
|
let packet = &CHurtAnimation::new(&entity_id, attacker_player.entity.yaw);
|
||||||
self.send_packet(packet);
|
self.send_packet(packet);
|
||||||
client.send_packet(packet);
|
client.send_packet(packet);
|
||||||
server.broadcast_packet_expect(
|
server.broadcast_packet_expect(
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ use std::{
|
|||||||
cell::{RefCell, RefMut},
|
cell::{RefCell, RefMut},
|
||||||
collections::HashMap,
|
collections::HashMap,
|
||||||
io::Cursor,
|
io::Cursor,
|
||||||
|
path::Path,
|
||||||
rc::Rc,
|
rc::Rc,
|
||||||
sync::{
|
sync::{
|
||||||
atomic::{AtomicI32, Ordering},
|
atomic::{AtomicI32, Ordering},
|
||||||
@@ -408,7 +409,12 @@ impl Server {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn build_response(config: &BasicConfiguration) -> StatusResponse {
|
pub fn build_response(config: &BasicConfiguration) -> StatusResponse {
|
||||||
let path = concat!(env!("CARGO_MANIFEST_DIR"), "/icon.png");
|
let icon_path = concat!(env!("CARGO_MANIFEST_DIR"), "/icon.png");
|
||||||
|
let icon = if Path::new(icon_path).exists() {
|
||||||
|
Some(Self::load_icon(icon_path))
|
||||||
|
} else {
|
||||||
|
None
|
||||||
|
};
|
||||||
|
|
||||||
StatusResponse {
|
StatusResponse {
|
||||||
version: Version {
|
version: Version {
|
||||||
@@ -424,7 +430,7 @@ impl Server {
|
|||||||
}],
|
}],
|
||||||
},
|
},
|
||||||
description: config.motd.clone(),
|
description: config.motd.clone(),
|
||||||
favicon: Self::load_icon(path),
|
favicon: icon,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user