Send a MC|Brand plugin message when joining servers
This commit is contained in:
parent
d8bdf94da2
commit
fc82b62a04
|
@ -36,6 +36,7 @@ use shared::{Axis, Position};
|
||||||
use format;
|
use format;
|
||||||
|
|
||||||
mod sun;
|
mod sun;
|
||||||
|
pub mod plugin_messages;
|
||||||
|
|
||||||
pub struct Server {
|
pub struct Server {
|
||||||
username: String,
|
username: String,
|
||||||
|
@ -519,6 +520,11 @@ impl Server {
|
||||||
|
|
||||||
self.entity_map.insert(join.entity_id, player);
|
self.entity_map.insert(join.entity_id, player);
|
||||||
self.player = Some(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) {
|
fn on_respawn(&mut self, respawn: packet::play::clientbound::Respawn) {
|
||||||
|
|
|
@ -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,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue