mirror of
https://github.com/italicsjenga/valence.git
synced 2024-12-23 22:41:30 +11:00
Expose the send_packet fn when 'protocol' feature is active
This commit is contained in:
parent
a06ba7e645
commit
7bdcc28b65
|
@ -160,7 +160,7 @@ pub(crate) struct ClientFlags {
|
||||||
got_keepalive: bool,
|
got_keepalive: bool,
|
||||||
hardcore: bool,
|
hardcore: bool,
|
||||||
#[bits(7)]
|
#[bits(7)]
|
||||||
_pad: u8
|
_pad: u8,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Client {
|
impl Client {
|
||||||
|
@ -233,6 +233,8 @@ impl Client {
|
||||||
|
|
||||||
/// Sends a system message to the player.
|
/// Sends a system message to the player.
|
||||||
pub fn send_message(&mut self, msg: impl Into<Text>) {
|
pub fn send_message(&mut self, msg: impl Into<Text>) {
|
||||||
|
// We buffer messages because weird things happen if we send them before the
|
||||||
|
// login packet.
|
||||||
self.msgs_to_send.push(msg.into());
|
self.msgs_to_send.push(msg.into());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -410,6 +412,12 @@ impl Client {
|
||||||
|
|
||||||
/// Attempts to enqueue a play packet to be sent to this client. The client
|
/// Attempts to enqueue a play packet to be sent to this client. The client
|
||||||
/// is disconnected if the clientbound packet buffer is full.
|
/// is disconnected if the clientbound packet buffer is full.
|
||||||
|
#[cfg(feature = "protocol")]
|
||||||
|
pub fn send_packet(&mut self, packet: impl Into<S2cPlayPacket>) {
|
||||||
|
send_packet(&mut self.send, packet);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(not(feature = "protocol"))]
|
||||||
pub(crate) fn send_packet(&mut self, packet: impl Into<S2cPlayPacket>) {
|
pub(crate) fn send_packet(&mut self, packet: impl Into<S2cPlayPacket>) {
|
||||||
send_packet(&mut self.send, packet);
|
send_packet(&mut self.send, packet);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue