mirror of
https://github.com/Pumpkin-MC/Pumpkin.git
synced 2026-08-30 20:14:23 +00:00
chore: move to crates folder
This commit is contained in:
2
.gitmodules
vendored
2
.gitmodules
vendored
@@ -1,3 +1,3 @@
|
||||
[submodule "pumpkin-plugin-wit"]
|
||||
path = pumpkin-plugin-wit
|
||||
path = crates/pumpkin-plugin-wit
|
||||
url = https://github.com/Pumpkin-MC/pumpkin-plugin-wit
|
||||
|
||||
64
Cargo.toml
64
Cargo.toml
@@ -1,19 +1,23 @@
|
||||
[workspace]
|
||||
resolver = "3"
|
||||
members = [
|
||||
"pumpkin-api-macros",
|
||||
"pumpkin-config",
|
||||
"pumpkin-util",
|
||||
"pumpkin-inventory",
|
||||
"pumpkin-macros/",
|
||||
"pumpkin-protocol/",
|
||||
"pumpkin-world",
|
||||
"pumpkin/",
|
||||
"pumpkin-data",
|
||||
"pumpkin-plugin-api",
|
||||
"pumpkin-codecs"
|
||||
"crates/pumpkin",
|
||||
"crates/pumpkin-api-macros",
|
||||
"crates/pumpkin-codecs",
|
||||
"crates/pumpkin-config",
|
||||
"crates/pumpkin-data",
|
||||
"crates/pumpkin-inventory",
|
||||
"crates/pumpkin-macros",
|
||||
"crates/pumpkin-nbt",
|
||||
"crates/pumpkin-plugin-api",
|
||||
"crates/pumpkin-protocol",
|
||||
"crates/pumpkin-util",
|
||||
"crates/pumpkin-world",
|
||||
]
|
||||
exclude = ["pumpkin-codegen"]
|
||||
exclude = ["tools/pumpkin-codegen"]
|
||||
|
||||
# [workspace.lints.rust]
|
||||
# missing_docs = "warn"
|
||||
|
||||
[workspace.lints.clippy]
|
||||
# Groups
|
||||
@@ -49,7 +53,23 @@ print_stderr = "deny"
|
||||
todo = "deny"
|
||||
unreachable = "deny"
|
||||
unimplemented = "deny"
|
||||
# indexing_slicing = "deny"
|
||||
|
||||
# Safety & Soundness
|
||||
undocumented_unsafe_blocks = "deny"
|
||||
uninit_assumed_init = "deny"
|
||||
uninit_vec = "deny"
|
||||
cast_ptr_alignment = "deny"
|
||||
ptr_as_ptr = "deny"
|
||||
|
||||
# Production Quality & Best Practices
|
||||
fallible_impl_from = "deny"
|
||||
mut_mut = "deny"
|
||||
char_lit_as_u8 = "deny"
|
||||
match_wild_err_arm = "deny"
|
||||
invalid_upcast_comparisons = "deny"
|
||||
|
||||
# Expected/Allowed
|
||||
clone_on_ref_ptr = "allow"
|
||||
|
||||
# Expected/Allowed
|
||||
cargo_common_metadata = "allow"
|
||||
@@ -148,15 +168,15 @@ num-traits = { version = "0.2", default-features = false, features = ["std"] }
|
||||
p384 = { version = "0.14.0", default-features = false, features = ["std", "arithmetic", "pkcs8", "ecdh"] }
|
||||
phf = { version = "0.14.0", default-features = false, features = ["std"] }
|
||||
proc-macro2 = { version = "1.0", default-features = false, features = ["proc-macro"] }
|
||||
pumpkin-codecs = { path = "pumpkin-codecs", default-features = false }
|
||||
pumpkin-config = { path = "pumpkin-config", default-features = false }
|
||||
pumpkin-data = { path = "pumpkin-data", default-features = false }
|
||||
pumpkin-inventory = { path = "pumpkin-inventory", default-features = false }
|
||||
pumpkin-macros = { path = "pumpkin-macros", default-features = false }
|
||||
pumpkin-nbt = { path = "pumpkin-nbt", default-features = false }
|
||||
pumpkin-protocol = { path = "pumpkin-protocol", default-features = false }
|
||||
pumpkin-util = { path = "pumpkin-util", default-features = false }
|
||||
pumpkin-world = { path = "pumpkin-world", default-features = false }
|
||||
pumpkin-codecs = { path = "crates/pumpkin-codecs", default-features = false }
|
||||
pumpkin-config = { path = "crates/pumpkin-config", default-features = false }
|
||||
pumpkin-data = { path = "crates/pumpkin-data", default-features = false }
|
||||
pumpkin-inventory = { path = "crates/pumpkin-inventory", default-features = false }
|
||||
pumpkin-macros = { path = "crates/pumpkin-macros", default-features = false }
|
||||
pumpkin-nbt = { path = "crates/pumpkin-nbt", default-features = false }
|
||||
pumpkin-protocol = { path = "crates/pumpkin-protocol", default-features = false }
|
||||
pumpkin-util = { path = "crates/pumpkin-util", default-features = false }
|
||||
pumpkin-world = { path = "crates/pumpkin-world", default-features = false }
|
||||
quote = { version = "1.0", default-features = false, features = ["proc-macro"] }
|
||||
rand = { version = "0.10.2", default-features = false, features = ["std", "std_rng", "thread_rng"] }
|
||||
rsa = { version = "=0.10.0-rc.18", default-features = false, features = ["std", "encoding"] }
|
||||
|
||||
2
LICENSE
2
LICENSE
@@ -671,4 +671,4 @@ into proprietary programs. If your program is a subroutine library, you
|
||||
may consider it more useful to permit linking proprietary applications with
|
||||
the library. If this is what you want to do, use the GNU Lesser General
|
||||
Public License instead of this License. But first, please read
|
||||
<https://www.gnu.org/licenses/why-not-lgpl.html>.
|
||||
<https://www.gnu.org/licenses/why-not-lgpl.html>.
|
||||
|
||||
@@ -59,19 +59,20 @@ pub fn plugin_impl(_attr: TokenStream, item: TokenStream) -> TokenStream {
|
||||
let input_struct = parse_macro_input!(item as ItemStruct);
|
||||
let struct_ident = &input_struct.ident;
|
||||
|
||||
let methods = PLUGIN_METHODS.lock().unwrap();
|
||||
|
||||
let methods: Vec<proc_macro2::TokenStream> = methods
|
||||
.values()
|
||||
.map(|s| {
|
||||
s.parse::<proc_macro2::TokenStream>().unwrap_or_else(|e| {
|
||||
abort!(
|
||||
struct_ident,
|
||||
format!("re-parsing cached method failed: {e}")
|
||||
)
|
||||
let methods: Vec<proc_macro2::TokenStream> = {
|
||||
let guard = PLUGIN_METHODS.lock().unwrap();
|
||||
guard
|
||||
.values()
|
||||
.map(|s| {
|
||||
s.parse::<proc_macro2::TokenStream>().unwrap_or_else(|e| {
|
||||
abort!(
|
||||
struct_ident,
|
||||
format!("re-parsing cached method failed: {e}")
|
||||
)
|
||||
})
|
||||
})
|
||||
})
|
||||
.collect();
|
||||
.collect()
|
||||
};
|
||||
|
||||
// Combine the original struct definition with the impl block and plugin() function
|
||||
let expanded = quote! {
|
||||
@@ -53,6 +53,7 @@ impl Default for ChunkCompression {
|
||||
}
|
||||
}
|
||||
|
||||
/// Compression algorithm used for chunk data storage.
|
||||
#[derive(Deserialize, Serialize, Clone, Copy)]
|
||||
pub enum Compression {
|
||||
/// `GZip` Compression.
|
||||
@@ -1,3 +1,6 @@
|
||||
//! Configuration management and serialization for the Pumpkin Minecraft server.
|
||||
#![deny(missing_docs)]
|
||||
|
||||
use fun::FunConfig;
|
||||
use logging::LoggingConfig;
|
||||
use pumpkin_util::world_seed::Seed;
|
||||
@@ -8,12 +11,19 @@ use serde::{Deserialize, Serialize, de::DeserializeOwned};
|
||||
use std::path::PathBuf;
|
||||
use std::{fs, num::NonZeroU8, path::Path};
|
||||
use tracing::{debug, warn};
|
||||
|
||||
/// Fun and experimental configuration options.
|
||||
pub mod fun;
|
||||
/// Server logging configuration options.
|
||||
pub mod logging;
|
||||
/// Networking and protocol configuration options.
|
||||
pub mod networking;
|
||||
/// Plugin management configuration options.
|
||||
pub mod plugins;
|
||||
/// Recipe system configuration options.
|
||||
pub mod recipe;
|
||||
|
||||
/// Resource pack configuration options.
|
||||
pub mod resource_pack;
|
||||
|
||||
pub use chat::ChatConfig;
|
||||
@@ -31,15 +41,20 @@ pub use server_links::ServerLinksConfig;
|
||||
mod commands;
|
||||
|
||||
mod chat;
|
||||
/// Chunk loading and saving configuration options.
|
||||
pub mod chunk;
|
||||
/// Lighting engine configuration options.
|
||||
pub mod lighting;
|
||||
/// Operator permission level configuration options.
|
||||
pub mod op;
|
||||
|
||||
mod advancement;
|
||||
mod player_data;
|
||||
mod pvp;
|
||||
mod server_links;
|
||||
/// Whitelist configuration options.
|
||||
pub mod whitelist;
|
||||
/// World generation and dimension configuration options.
|
||||
pub mod world;
|
||||
|
||||
use advancement::AdvancementConfig;
|
||||
@@ -48,11 +63,14 @@ use player_data::PlayerDataConfig;
|
||||
use resource_pack::ResourcePackConfig;
|
||||
use world::LevelConfig;
|
||||
|
||||
/// Root configuration container for Pumpkin server settings.
|
||||
#[derive(Deserialize, Serialize, Default)]
|
||||
#[serde(default)]
|
||||
pub struct PumpkinConfig {
|
||||
/// Core basic configuration settings.
|
||||
#[serde(flatten)]
|
||||
pub basic: BasicConfiguration,
|
||||
/// Advanced and feature-specific configuration settings.
|
||||
#[serde(flatten)]
|
||||
pub advanced: AdvancedConfiguration,
|
||||
}
|
||||
@@ -217,10 +235,12 @@ impl BasicConfiguration {
|
||||
PathBuf::from(&self.default_level_name)
|
||||
}
|
||||
|
||||
/// Validates basic configuration options.
|
||||
pub const fn validate(&self) {}
|
||||
}
|
||||
|
||||
impl AdvancedConfiguration {
|
||||
/// Validates advanced configuration options.
|
||||
pub const fn validate(&self) {
|
||||
//self.resource_pack.validate();
|
||||
}
|
||||
@@ -1,10 +1,14 @@
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
/// Lighting engine calculation mode.
|
||||
#[derive(Deserialize, Serialize, Clone, Copy, PartialEq, Eq, Default)]
|
||||
#[serde(rename_all = "lowercase")]
|
||||
pub enum LightingEngineConfig {
|
||||
/// Default Vanilla lighting propagation.
|
||||
#[default]
|
||||
Default,
|
||||
/// Full skylight everywhere (no shadows).
|
||||
Full,
|
||||
/// Completely dark lighting everywhere (zero light).
|
||||
Dark,
|
||||
}
|
||||
@@ -7,13 +7,21 @@ use crate::LANBroadcastConfig;
|
||||
use bedrock::BedrockConfig;
|
||||
use java::JavaConfig;
|
||||
|
||||
/// Authentication configuration.
|
||||
pub mod auth;
|
||||
/// Bedrock protocol networking configuration.
|
||||
pub mod bedrock;
|
||||
/// Packet compression configuration.
|
||||
pub mod compression;
|
||||
/// Java protocol networking configuration.
|
||||
pub mod java;
|
||||
/// LAN broadcast discovery configuration.
|
||||
pub mod lan_broadcast;
|
||||
/// Reverse proxy and BungeeCord/Velocity configuration.
|
||||
pub mod proxy;
|
||||
/// GS4 Query protocol configuration.
|
||||
pub mod query;
|
||||
/// RCON remote console configuration.
|
||||
pub mod rcon;
|
||||
|
||||
/// Configuration for server networking features.
|
||||
@@ -1,5 +1,6 @@
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
/// Plugin system configuration.
|
||||
#[derive(Deserialize, Serialize, Default)]
|
||||
#[serde(default)]
|
||||
pub struct PluginsConfig {
|
||||
@@ -1,10 +1,13 @@
|
||||
use serde::{Deserialize, Serialize};
|
||||
use uuid::Uuid;
|
||||
|
||||
/// Server resource pack configuration for Java and Bedrock clients.
|
||||
#[derive(Deserialize, Serialize, Default)]
|
||||
#[serde(default)]
|
||||
pub struct ResourcePackConfig {
|
||||
/// Java Edition client resource pack configuration.
|
||||
pub java: JavaResourcePackConfig,
|
||||
/// Bedrock Edition client resource pack configuration.
|
||||
pub bedrock: BedrockResourcePackConfig,
|
||||
}
|
||||
|
||||
@@ -28,6 +31,7 @@ pub struct JavaResourcePackConfig {
|
||||
#[derive(Deserialize, Serialize, Default)]
|
||||
#[serde(default)]
|
||||
pub struct BedrockResourcePackConfig {
|
||||
/// Whether Bedrock resource packs are enabled.
|
||||
pub enabled: bool,
|
||||
/// If true, players cannot join without accepting packs.
|
||||
pub force: bool,
|
||||
@@ -35,22 +39,33 @@ pub struct BedrockResourcePackConfig {
|
||||
pub packs: Vec<BedrockPack>,
|
||||
}
|
||||
|
||||
/// Bedrock resource pack manifest configuration entry.
|
||||
#[derive(Deserialize, Serialize)]
|
||||
pub struct BedrockPack {
|
||||
/// Unique identifier for the Bedrock pack.
|
||||
pub uuid: Uuid,
|
||||
/// Version string of the Bedrock pack.
|
||||
pub version: String,
|
||||
/// Size of the pack in bytes.
|
||||
pub size: u64,
|
||||
/// Download URL for remote Bedrock packs.
|
||||
pub download_url: String,
|
||||
/// Optional encryption content key for encrypted packs.
|
||||
#[serde(default)]
|
||||
pub content_key: String,
|
||||
/// Optional sub-pack name inside the archive.
|
||||
#[serde(default)]
|
||||
pub sub_pack_name: String,
|
||||
/// Optional content identifier.
|
||||
#[serde(default)]
|
||||
pub content_id: String,
|
||||
/// Whether the pack contains client scripts.
|
||||
#[serde(default)]
|
||||
pub has_scripts: bool,
|
||||
/// Whether the pack is marked as an addon pack.
|
||||
#[serde(default)]
|
||||
pub addon_pack: bool,
|
||||
/// Whether Ray Tracing / RTX features are enabled for the pack.
|
||||
#[serde(default)]
|
||||
pub rtx_enabled: bool,
|
||||
}
|
||||
@@ -9,6 +9,7 @@ use crate::{chunk::ChunkConfig, lighting::LightingEngineConfig};
|
||||
pub struct LevelConfig {
|
||||
/// Configuration for chunk behaviour and management.
|
||||
pub chunk: ChunkConfig,
|
||||
/// Configuration for lighting engine propagation mode.
|
||||
#[serde(default)]
|
||||
pub lighting: LightingEngineConfig,
|
||||
/// Number of ticks between autosave checks. If 0, autosave is disabled.
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user