mirror of
https://github.com/zyllian/classics.git
synced 2025-05-10 02:26:53 -07:00
add basic server configuration + password protection
This commit is contained in:
parent
ca94ec10f2
commit
c78303cf44
7 changed files with 146 additions and 17 deletions
39
src/server/config.rs
Normal file
39
src/server/config.rs
Normal file
|
@ -0,0 +1,39 @@
|
|||
use serde::{Deserialize, Serialize};
|
||||
|
||||
/// configuration for the server
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
pub struct ServerConfig {
|
||||
/// the server's name
|
||||
pub name: String,
|
||||
/// the server's motd
|
||||
pub motd: String,
|
||||
/// the server's password, if any
|
||||
pub password: Option<String>,
|
||||
/// the level's size
|
||||
pub level_size: Option<ConfigCoordinates>,
|
||||
/// the level's spawn point
|
||||
pub spawn: Option<ConfigCoordinates>,
|
||||
}
|
||||
|
||||
impl Default for ServerConfig {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
name: "classic server wowie".to_string(),
|
||||
motd: "here's the default server motd".to_string(),
|
||||
password: None,
|
||||
level_size: None,
|
||||
spawn: None,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// coordinates as stored in configuration
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub struct ConfigCoordinates {
|
||||
/// the X coordinate
|
||||
pub x: usize,
|
||||
/// the Y coordinate
|
||||
pub y: usize,
|
||||
/// the Z coordinate
|
||||
pub z: usize,
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue