diff --git a/server/src/login_provider.rs b/server/src/login_provider.rs index 64007e4684..2c53a6bd34 100644 --- a/server/src/login_provider.rs +++ b/server/src/login_provider.rs @@ -1,6 +1,7 @@ use crate::settings::BanRecord; use authc::{AuthClient, AuthClientError, AuthToken, Uuid}; use common_net::msg::RegisterError; +#[cfg(feature = "plugins")] use common_sys::plugin::PluginMgr; use hashbrown::{HashMap, HashSet}; use plugin_api::event::{PlayerJoinEvent, PlayerJoinResult}; @@ -57,7 +58,7 @@ impl LoginProvider { &mut self, username_or_token: &str, world: &World, - plugin_manager: &PluginMgr, + #[cfg(feature = "plugins")] plugin_manager: &PluginMgr, admins: &HashSet, whitelist: &HashSet, banlist: &HashMap, @@ -78,7 +79,7 @@ impl LoginProvider { if !whitelist.is_empty() && !whitelist.contains(&uuid) && !admins.contains(&uuid) { return Err(RegisterError::NotOnWhitelist); } - + #[cfg(feature = "plugins")] match plugin_manager.execute_event(&world, &PlayerJoinEvent { player_name: username.clone(), player_id: *uuid.as_bytes(), diff --git a/server/src/register.rs b/server/src/register.rs index 3f480bd5f7..73fa04356d 100644 --- a/server/src/register.rs +++ b/server/src/register.rs @@ -3,6 +3,8 @@ use common_net::msg::{ ClientRegister, PlayerInfo, PlayerListUpdate, RegisterError, ServerGeneral, ServerRegisterAnswer, }; + +#[cfg(feature = "plugins")] use common_sys::plugin::PluginMgr; use hashbrown::HashMap; use plugin_api::Uid; @@ -29,10 +31,12 @@ pub(crate) fn handle_register_msg( editable_settings: &Fetch<'_, EditableSettings>, msg: ClientRegister, ) -> Result<(), crate::error::Error> { + #[cfg(feature = "plugins")] let plugin_mgr = world.read_resource::(); let (username, uuid) = match login_provider.try_login( &msg.token_or_username, world, + #[cfg(feature = "plugins")] &plugin_mgr, &*editable_settings.admins, &*editable_settings.whitelist,