pub struct EventContext<'a, T> {
pub data: &'a T,
/* private fields */
}Expand description
A smart wrapper for a server event.
This struct provides read-only access to the event’s data and methods to mutate or cancel it.
Fields§
§data: &'a TImplementations§
Source§impl<'a, T> EventContext<'a, T>
impl<'a, T> EventContext<'a, T>
Source§impl<'a> EventContext<'a, ChatEvent>
impl<'a> EventContext<'a, ChatEvent>
Sourcepub fn set_message(&mut self, message: String)
pub fn set_message(&mut self, message: String)
Sets the message for this event.
Source§impl<'a> EventContext<'a, BlockBreakEvent>
impl<'a> EventContext<'a, BlockBreakEvent>
Source§impl<'a> EventContext<'a, PlayerFoodLossEvent>
impl<'a> EventContext<'a, PlayerFoodLossEvent>
Source§impl<'a> EventContext<'a, PlayerHealEvent>
impl<'a> EventContext<'a, PlayerHealEvent>
Sourcepub fn set_amount(&mut self, amount: f64)
pub fn set_amount(&mut self, amount: f64)
Sets the amount for this event.
Source§impl<'a> EventContext<'a, PlayerHurtEvent>
impl<'a> EventContext<'a, PlayerHurtEvent>
Sourcepub fn set_damage(&mut self, damage: f64)
pub fn set_damage(&mut self, damage: f64)
Sets the damage for this event.
Sourcepub fn set_attack_immunity_ms(&mut self, attack_immunity_ms: i64)
pub fn set_attack_immunity_ms(&mut self, attack_immunity_ms: i64)
Sets the attack_immunity_ms for this event.
Source§impl<'a> EventContext<'a, PlayerDeathEvent>
impl<'a> EventContext<'a, PlayerDeathEvent>
Sourcepub fn set_keep_inventory(&mut self, keep_inventory: bool)
pub fn set_keep_inventory(&mut self, keep_inventory: bool)
Sets the keep_inventory for this event.
Source§impl<'a> EventContext<'a, PlayerRespawnEvent>
impl<'a> EventContext<'a, PlayerRespawnEvent>
Source§impl<'a> EventContext<'a, PlayerAttackEntityEvent>
impl<'a> EventContext<'a, PlayerAttackEntityEvent>
Sourcepub fn set_height(&mut self, height: f64)
pub fn set_height(&mut self, height: f64)
Sets the height for this event.
Sourcepub fn set_critical(&mut self, critical: bool)
pub fn set_critical(&mut self, critical: bool)
Sets the critical for this event.
Source§impl<'a> EventContext<'a, PlayerExperienceGainEvent>
impl<'a> EventContext<'a, PlayerExperienceGainEvent>
Sourcepub fn set_amount(&mut self, amount: i32)
pub fn set_amount(&mut self, amount: i32)
Sets the amount for this event.
Source§impl<'a> EventContext<'a, PlayerLecternPageTurnEvent>
impl<'a> EventContext<'a, PlayerLecternPageTurnEvent>
Sourcepub fn set_new_page(&mut self, new_page: i32)
pub fn set_new_page(&mut self, new_page: i32)
Sets the new_page for this event.
Source§impl<'a> EventContext<'a, PlayerItemPickupEvent>
impl<'a> EventContext<'a, PlayerItemPickupEvent>
Source§impl<'a> EventContext<'a, PlayerTransferEvent>
impl<'a> EventContext<'a, PlayerTransferEvent>
Sourcepub fn set_address(&mut self, address: Address)
pub fn set_address(&mut self, address: Address)
Sets the address for this event.
Source§impl<'a> EventContext<'a, WorldExplosionEvent>
impl<'a> EventContext<'a, WorldExplosionEvent>
Sourcepub fn set_entity_uuids(&mut self, entity_uuids: Vec<String>)
pub fn set_entity_uuids(&mut self, entity_uuids: Vec<String>)
Sets the entity_uuids for this event.
Sourcepub fn set_blocks(&mut self, blocks: BlockPosList)
pub fn set_blocks(&mut self, blocks: BlockPosList)
Sets the blocks for this event.
Sourcepub fn set_item_drop_chance(&mut self, item_drop_chance: f64)
pub fn set_item_drop_chance(&mut self, item_drop_chance: f64)
Sets the item_drop_chance for this event.
Sourcepub fn set_spawn_fire(&mut self, spawn_fire: bool)
pub fn set_spawn_fire(&mut self, spawn_fire: bool)
Sets the spawn_fire for this event.
Auto Trait Implementations§
impl<'a, T> Freeze for EventContext<'a, T>
impl<'a, T> RefUnwindSafe for EventContext<'a, T>where
T: RefUnwindSafe,
impl<'a, T> Send for EventContext<'a, T>where
T: Sync,
impl<'a, T> Sync for EventContext<'a, T>where
T: Sync,
impl<'a, T> Unpin for EventContext<'a, T>
impl<'a, T> UnwindSafe for EventContext<'a, T>where
T: RefUnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request