diff --git a/tes3mp-plugin/src/plugin/mod.rs b/tes3mp-plugin/src/plugin/mod.rs index ff32fe5..d615f17 100644 --- a/tes3mp-plugin/src/plugin/mod.rs +++ b/tes3mp-plugin/src/plugin/mod.rs @@ -56,9 +56,9 @@ pub const NPC: c_ushort = 3; #[macro_export] macro_rules! call_instance { ($call:tt, $($argument:expr),+) => { - let mut instance = unsafe { + let instance = unsafe { EVENTS_INSTANCE - .as_ref() + .as_mut() .expect(format!("No events instance created: {}\n", stringify!($call)).as_str()) }; instance.$call($($argument),+); @@ -66,9 +66,9 @@ macro_rules! call_instance { }; ($call:tt) => { - let mut instance = unsafe { + let instance = unsafe { EVENTS_INSTANCE - .as_ref() + .as_mut() .expect(format!("No events instance created: {}\n", stringify!($call)).as_str()) }; instance.$call(); diff --git a/tes3mp-test/src/lib.rs b/tes3mp-test/src/lib.rs index be50053..169eda1 100644 --- a/tes3mp-test/src/lib.rs +++ b/tes3mp-test/src/lib.rs @@ -9,15 +9,15 @@ impl Events for Server { Server } - fn on_any(&self, event: &str) { + fn on_any(&mut self, event: &str) { plugin::log_message(LOG_INFO, format!("Event triggered: {}", event).as_str()); } - fn on_server_init(&self) { + fn on_server_init(&mut self) { plugin::log_message(plugin::LOG_WARN, "Hello from Rust :3"); } - fn on_server_post_init(&self) { + fn on_server_post_init(&mut self) { plugin::log_message(plugin::LOG_FATAL, "Hi!?"); } }