add logging and serde rename things

This commit is contained in:
TriMill 2022-12-17 15:45:43 -05:00
parent d4cf718214
commit a3375c53a4
2 changed files with 7 additions and 2 deletions

View file

@ -3,6 +3,7 @@ use std::{net::IpAddr, fs::OpenOptions};
use serde::Deserialize; use serde::Deserialize;
#[derive(Deserialize, PartialEq, Eq)] #[derive(Deserialize, PartialEq, Eq)]
#[serde(rename_all="lowercase")]
pub enum LoginMode { pub enum LoginMode {
Offline, Offline,
Velocity, Velocity,

View file

@ -4,12 +4,12 @@ use std::io::Write;
use chrono::Utc; use chrono::Utc;
use env_logger::Env; use env_logger::Env;
use log::info; use log::{info, warn};
use mlua::Lua; use mlua::Lua;
use network::NetworkServer; use network::NetworkServer;
use plugins::Plugins; use plugins::Plugins;
use crate::config::load_config; use crate::config::{load_config, LoginMode};
mod config; mod config;
mod plugins; mod plugins;
@ -43,6 +43,10 @@ fn main() {
info!("Starting Quectocraft version {}", VERSION); info!("Starting Quectocraft version {}", VERSION);
let config = load_config().expect("Failed to load config"); let config = load_config().expect("Failed to load config");
match config.login {
LoginMode::Offline => warn!("Running in offline mode!"),
LoginMode::Velocity => info!("Running in velocity mode"),
}
let lua = Lua::new(); let lua = Lua::new();
let mut plugins = Plugins::new(&lua).expect("Error initializing lua environment"); let mut plugins = Plugins::new(&lua).expect("Error initializing lua environment");