Skip to main content

BroadcastMessage

Enum BroadcastMessage 

Source
pub enum BroadcastMessage {
    Chat {
        content: NbtCompound,
    },
    PlayerJoined {
        info: PlayerSnapshot,
    },
    PlayerLeft {
        uuid: Uuid,
        entity_id: i32,
        username: String,
    },
    EntityMoved {
        entity_id: i32,
        x: f64,
        y: f64,
        z: f64,
        yaw: f32,
        pitch: f32,
        on_ground: bool,
    },
    BlockChanged {
        x: i32,
        y: i32,
        z: i32,
        block_state: i32,
    },
}
Expand description

A message broadcast from one player’s task to all others.

Sent through the broadcast::Sender and received by each player’s broadcast::Receiver in their play loop. Plugins use ChatContext::broadcast to send these.

Variants§

§

Chat

A chat message to display in all players’ chat windows.

Fields

§content: NbtCompound

The formatted text component as NBT.

§

PlayerJoined

A new player has joined the server.

Fields

§info: PlayerSnapshot

Snapshot of the joining player’s state.

§

PlayerLeft

A player has left the server.

Fields

§uuid: Uuid

The leaving player’s UUID (for PlayerRemove packet).

§entity_id: i32

The leaving player’s entity ID (for EntityDestroy packet).

§username: String

The leaving player’s username (for chat message).

§

EntityMoved

A player moved or changed look direction.

Fields

§entity_id: i32

The moving player’s entity ID.

§x: f64

New absolute X coordinate.

§y: f64

New absolute Y coordinate.

§z: f64

New absolute Z coordinate.

§yaw: f32

New yaw angle (degrees).

§pitch: f32

New pitch angle (degrees).

§on_ground: bool

Whether the player is on the ground.

§

BlockChanged

A block was modified in the world.

Fields

§x: i32

Block X coordinate (absolute world coordinates).

§y: i32

Block Y coordinate (absolute world coordinates).

§z: i32

Block Z coordinate (absolute world coordinates).

§block_state: i32

The new block state ID.

Trait Implementations§

Source§

impl Clone for BroadcastMessage

Source§

fn clone(&self) -> BroadcastMessage

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for BroadcastMessage

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.