Send a MC|Brand plugin message when joining servers

This commit is contained in:
Thinkofname 2016-04-08 18:30:05 +01:00
parent d8bdf94da2
commit fc82b62a04
2 changed files with 24 additions and 0 deletions

View File

@ -36,6 +36,7 @@ use shared::{Axis, Position};
use format;
mod sun;
pub mod plugin_messages;
pub struct Server {
username: String,
@ -519,6 +520,11 @@ impl Server {
self.entity_map.insert(join.entity_id, player);
self.player = Some(player);
// Let the server know who we are
self.write_packet(plugin_messages::Brand {
brand: "Steven".into(),
}.as_message());
}
fn on_respawn(&mut self, respawn: packet::play::clientbound::Respawn) {

View File

@ -0,0 +1,18 @@
use protocol::Serializable;
use protocol::packet::play::serverbound::PluginMessageServerbound;
pub struct Brand {
pub brand: String,
}
impl Brand {
pub fn as_message(self) -> PluginMessageServerbound {
let mut data = vec![];
Serializable::write_to(&self.brand, &mut data).unwrap();
PluginMessageServerbound {
channel: "MC|Brand".into(),
data: data,
}
}
}