diff --git a/plugin-api/src/lib.rs b/plugin-api/src/lib.rs index 725c7ba..4483360 100644 --- a/plugin-api/src/lib.rs +++ b/plugin-api/src/lib.rs @@ -59,7 +59,7 @@ impl PluginManager { self.plugins } - pub fn load_all(self, socket: SocketRef, players: Arc>>) { + pub fn load_all(&self) { let plugins = plugin_imports::load_plugins(); let my_test_plugin = get_plugin!(test_plugin, plugins); diff --git a/src/main.rs b/src/main.rs index 6b79274..dfb43d7 100644 --- a/src/main.rs +++ b/src/main.rs @@ -69,6 +69,10 @@ impl HorizonServer { logger: logger.clone(), }); + // Load all plugins for this pool + let my_manager = plugin_test_api::PluginManager::new(); + my_manager.load_all(); + let pool_clone = pool.clone(); thread::spawn(move || { let rt = Runtime::new().unwrap(); @@ -100,16 +104,10 @@ impl HorizonServer { socket.id.as_str()); let id = socket.id.as_str(); - let player = Player::new(socket.clone(), Uuid::new_v4()); + let player: Player = Player::new(socket.clone(), Uuid::new_v4()); players::init(socket.clone(), pool.players.clone()); - // Load all plugins in a new manager for this player - // (TODO: Change this to a per-thread instance of manager and - // per player socket event listeners) - let my_manager = plugin_test_api::PluginManager::new(); - my_manager.load_all(socket.clone(), pool.players.clone()); - pool.players.write().unwrap().push(player.clone()); log_debug!(pool.logger, "PLAYER", "Player {} (UUID: {}) added to pool",