Struct veloren_plugin_api::event::PluginLoadEvent
source · pub struct PluginLoadEvent {
pub game_mode: GameMode,
}
Expand description
This event is called when the plugin is loaded
Your event should be named on_load
Example
ⓘ
#[event_handler]
pub fn on_load(load: PluginLoadEvent) {
match load.game_mode {
GameMode::Server => emit_action(Action::Print("Hello, server!".to_owned())),
GameMode::Client => emit_action(Action::Print("Hello, client!".to_owned())),
GameMode::Singleplayer => emit_action(Action::Print("Hello, singleplayer!".to_owned())),
}
}
Fields§
§game_mode: GameMode
Trait Implementations§
source§impl Clone for PluginLoadEvent
impl Clone for PluginLoadEvent
source§fn clone(&self) -> PluginLoadEvent
fn clone(&self) -> PluginLoadEvent
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for PluginLoadEvent
impl Debug for PluginLoadEvent
source§impl<'de> Deserialize<'de> for PluginLoadEvent
impl<'de> Deserialize<'de> for PluginLoadEvent
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where __D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
source§impl PartialEq<PluginLoadEvent> for PluginLoadEvent
impl PartialEq<PluginLoadEvent> for PluginLoadEvent
source§fn eq(&self, other: &PluginLoadEvent) -> bool
fn eq(&self, other: &PluginLoadEvent) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.source§impl Serialize for PluginLoadEvent
impl Serialize for PluginLoadEvent
impl Eq for PluginLoadEvent
impl StructuralEq for PluginLoadEvent
impl StructuralPartialEq for PluginLoadEvent
Auto Trait Implementations§
impl RefUnwindSafe for PluginLoadEvent
impl Send for PluginLoadEvent
impl Sync for PluginLoadEvent
impl Unpin for PluginLoadEvent
impl UnwindSafe for PluginLoadEvent
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
§impl<C, M> ConvertSaveload<M> for Cwhere
C: Clone + Serialize + DeserializeOwned,
impl<C, M> ConvertSaveload<M> for Cwhere C: Clone + Serialize + DeserializeOwned,
§type Error = Infallible
type Error = Infallible
Error may occur during serialization or deserialization of component
§fn convert_into<F>(
&self,
_: F
) -> Result<<C as ConvertSaveload<M>>::Data, <C as ConvertSaveload<M>>::Error>where
F: FnMut(Entity) -> Option<M>,
fn convert_into<F>( &self, _: F ) -> Result<<C as ConvertSaveload<M>>::Data, <C as ConvertSaveload<M>>::Error>where F: FnMut(Entity) -> Option<M>,
Convert this data type into serializable form (
Data
) using
entity to marker mapping function§fn convert_from<F>(
data: <C as ConvertSaveload<M>>::Data,
_: F
) -> Result<C, <C as ConvertSaveload<M>>::Error>where
F: FnMut(M) -> Option<Entity>,
fn convert_from<F>( data: <C as ConvertSaveload<M>>::Data, _: F ) -> Result<C, <C as ConvertSaveload<M>>::Error>where F: FnMut(M) -> Option<Entity>,
Convert this data from a deserializable form (
Data
) using
entity to marker mapping function§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
source§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.