Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nicer Config #316

Closed
1 task done
Commandcracker opened this issue Nov 18, 2024 · 1 comment
Closed
1 task done

Nicer Config #316

Commandcracker opened this issue Nov 18, 2024 · 1 comment
Assignees
Labels
enhancement New feature or request

Comments

@Commandcracker
Copy link
Contributor

I've searched existing issues and couldn't find a duplicate.

  • I confirm this is not a duplicate.

Is your feature request related to a problem? Please describe.

What I would like

  • Comments
  • Log when a default value is used
  • More "grouping"

Describe the solution you'd like

Using toml_edit, to keep comments and something custom to translate struct doc comments into toml comments.
Console warning if a value has not been set correctly and the default is used.

example:

/// Basic Server Configuration
/// See https://snowiiii.github.io/Pumpkin/config/introduction.html
/// and https://snowiiii.github.io/Pumpkin/config/basic.html
/// for thirder information!
#[derive(Serialize, Deserialize)]
#[serde(default)]
pub struct BasicConfiguration {
    /// The address to bind the server to.
    pub server_address: SocketAddr,
    /// The seed for world generation.
    pub seed: String,
    /// The maximum number of players allowed on the server. Specifying `0` disables the limit.
    pub max_players: u32,
    /// The maximum view distance for players.
    pub view_distance: u8,
    /// The maximum simulated view distance.
    pub simulation_distance: u8,
    /// The default game difficulty.
    pub default_difficulty: Difficulty,
    /// Whether the Nether dimension is enabled.
    pub allow_nether: bool,
    /// Whether the server is in hardcore mode.
    pub hardcore: bool,
    /// Whether online mode is enabled. Requires valid Minecraft accounts.
    pub online_mode: bool,
    /// Whether packet encryption is enabled. Required when online mode is enabled.
    pub encryption: bool,
    /// The server's description displayed on the status screen.
    pub motd: String,
    pub tps: f32,
    /// The default game mode for players.
    pub default_gamemode: GameMode,
    /// Whether to remove IPs from logs or not
    pub scrub_ips: bool,
    /// Whether to use a server favicon
    pub use_favicon: bool,
    /// Path to server favicon
    pub favicon_path: String,
}

->

# Basic Server Configuration
# See https://snowiiii.github.io/Pumpkin/config/introduction.html
# and https://snowiiii.github.io/Pumpkin/config/basic.html
# for thirder information!

# The address to bind the server to.
server_address = "0.0.0.0:25565"
# The seed for world generation.
seed = ""
# The maximum number of players allowed on the server. Specifying `0` disables the limit.
max_players = 100000
# The maximum view distance for players.
view_distance = 10
# The maximum simulated view distance.
simulation_distance = 10
# The default game difficulty.
default_difficulty = "Normal"
# Whether the Nether dimension is enabled.
allow_nether = true
# Whether the server is in hardcore mode.
hardcore = false
# Whether online mode is enabled. Requires valid Minecraft accounts.
online_mode = true
# Whether packet encryption is enabled. Required when online mode is enabled.
encryption = true
# The server's description displayed on the status screen.
motd = "A Blazing fast Pumpkin Server!"
tps = 20.0
# The default game mode for players.
default_gamemode = "Survival"
# Whether to remove IPs from logs or not
scrub_ips = true
# Whether to use a server favicon
use_favicon = true
favicon_path = "icon.png"
# Path to server favicon

Many values could be better grouped like view_distance and simulation_distance into "rendering" or online_mode and encryption into "rendering" in order to make the whole config file better structured.

@Commandcracker Commandcracker added the enhancement New feature or request label Nov 18, 2024
@Snowiiii
Copy link
Owner

Im not sure about comments. There is no good way to add them using toml or Serde.
I just planned to link people to the docs where you can then see up-to-date defaults and descriptions.

In the features.toml config everything is "grouped" together in categories . This is not the case in the configuration.toml because it is and will stay very simple, much like "server.properties" from vanilla. IMOP There are so few values that categories are unnecessary

@Snowiiii Snowiiii closed this as completed Dec 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants