Pumpkin/pumpkin-plugin-wit/v0.1.0/server.wit
2026-04-10 10:36:44 +02:00

42 lines
1.3 KiB
Plaintext

interface server {
use player.{player};
/// Represents the difficulty setting of a Minecraft server.
enum difficulty {
/// Hostile mobs do not spawn. Players regain health automatically.
peaceful,
/// Hostile mobs deal less damage.
easy,
/// Standard Minecraft difficulty.
normal,
/// Hostile mobs deal more damage.
hard,
}
/// Represents the global server instance.
resource server {
/// Returns the current difficulty level of the server.
get-difficulty: func() -> difficulty;
/// Returns the total number of players currently connected to the server.
get-player-count: func() -> u32;
/// Returns the rolling average Milliseconds Per Tick (MSPT).
/// A value below 50.0 is required for a stable 20 TPS.
get-mspt: func() -> f64;
/// Returns the effective Ticks Per Second (TPS).
/// Ideal value is 20.0.
get-tps: func() -> f64;
/// Returns a list of all online players across all worlds.
get-all-players: func() -> list<player>;
/// Searches for a player by their exact name.
get-player-by-name: func(name: string) -> option<player>;
/// Searches for a player by their UUID string.
get-player-by-uuid: func(id: string) -> option<player>;
}
}