Working plugin loader

This commit is contained in:
2025-12-11 22:44:00 +01:00
parent d2fe5d9d62
commit 5e2e819a94
2 changed files with 6 additions and 3 deletions
+2 -3
View File
@@ -57,6 +57,7 @@ impl PluginLoader {
.get(&plugin_json.id) .get(&plugin_json.id)
.is_none() .is_none()
{} {}
LOGGER.info(format!("Loaded {}", plugin_json.id));
Plugin( Plugin(
self.plugin_clients self.plugin_clients
.lock() .lock()
@@ -70,11 +71,9 @@ impl PluginLoader {
pub fn start_server(&self) { pub fn start_server(&self) {
let plugin_clients = self.plugin_clients.clone(); let plugin_clients = self.plugin_clients.clone();
let listener = TcpListener::bind("0.0.0.0:7243").unwrap();
std::thread::spawn(move || { std::thread::spawn(move || {
let listener = TcpListener::bind("0.0.0.0:7243").unwrap();
LOGGER.info("Server listening at 0.0.0.0:7243");
for stream in listener.incoming() { for stream in listener.incoming() {
let mut stream = stream.unwrap(); let mut stream = stream.unwrap();
let mut s = String::new(); let mut s = String::new();
+4
View File
@@ -67,6 +67,10 @@ impl Server {
} }
pub fn run(self: &Arc<Self>) -> crate::Result<()> { pub fn run(self: &Arc<Self>) -> crate::Result<()> {
// Start plugin loader
Self::LOGGER.info("Starting loader");
self.plugin_loader.start_server();
// Load plugins // Load plugins
Self::LOGGER.info("Loading plugins"); Self::LOGGER.info("Loading plugins");
for entry in fs::read_dir(self.root.join("plugins"))? { for entry in fs::read_dir(self.root.join("plugins"))? {