mirror of
https://github.com/Pumpkin-MC/Pumpkin.git
synced 2026-08-31 08:22:33 +00:00
Add default gamemode to configuration
This commit is contained in:
@@ -2,7 +2,7 @@ use std::path::Path;
|
||||
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::server::Difficulty;
|
||||
use crate::{entity::player::GameMode, server::Difficulty};
|
||||
|
||||
/// Current Config version of the Base Config
|
||||
const CURRENT_BASE_VERSION: &str = "1.0.0";
|
||||
@@ -59,6 +59,8 @@ pub struct BasicConfiguration {
|
||||
pub prevent_proxy_connections: bool,
|
||||
/// The description send when Client performs a Status request, (e.g Multiplayer Screen)
|
||||
pub motd: String,
|
||||
/// default gamemode (e.g. Survival, Creative...)
|
||||
pub default_gamemode: GameMode,
|
||||
}
|
||||
|
||||
impl Default for BasicConfiguration {
|
||||
@@ -80,6 +82,7 @@ impl Default for BasicConfiguration {
|
||||
encryption: true,
|
||||
prevent_proxy_connections: true,
|
||||
motd: "A Blazing fast Pumpkin Server!".to_string(),
|
||||
default_gamemode: GameMode::Survival,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
use pumpkin_protocol::VarInt;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use super::{Entity, EntityId};
|
||||
|
||||
@@ -74,7 +75,7 @@ impl ChatMode {
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy)]
|
||||
#[derive(Clone, Copy, PartialEq, Serialize, Deserialize)]
|
||||
pub enum GameMode {
|
||||
Undefined,
|
||||
Survival,
|
||||
|
||||
@@ -131,8 +131,12 @@ impl Server {
|
||||
0,
|
||||
"minecraft:overworld".into(),
|
||||
0, // seed
|
||||
GameMode::Survival.to_byte() as u8,
|
||||
GameMode::Survival.to_byte(),
|
||||
match self.base_config.default_gamemode {
|
||||
GameMode::Undefined => GameMode::Survival,
|
||||
game_mode => game_mode,
|
||||
}
|
||||
.to_byte() as u8,
|
||||
self.base_config.default_gamemode.to_byte(),
|
||||
false,
|
||||
false,
|
||||
false, // deth loc
|
||||
|
||||
Reference in New Issue
Block a user