145c4c877b
A Horizon client sends a client mod's batch of command lines as one `horizon:quiet_commands` payload, which Horizon's server announces only to Horizon clients. Each line runs exactly as the player typing it would (the same checks, their own permission level), with vanilla's suppressed output: no feedback and no failure in anyone's chat. Batches wait in a queue: at most 64 lines run per player per tick, and at most 4096 wait. Each finished batch is one line in the server's log. tools/quiet_commands_e2e.py checks it on the dedicated server: a non-op's quiet setblock is refused, an op's runs, and nothing reaches the chat. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
63 lines
1.6 KiB
Rust
63 lines
1.6 KiB
Rust
//! The Minecraft Java Edition network protocol (of the version in `horizon_core::version`):
|
|
//! primitive codecs, framing, compression, encryption, and typed packets for
|
|
//! every connection state, shared by the Horizon client and (later) server.
|
|
#![forbid(unsafe_code)]
|
|
pub mod buf;
|
|
pub mod chunk;
|
|
pub mod connection;
|
|
pub mod crypto;
|
|
pub mod entity_data;
|
|
pub mod frame;
|
|
pub mod ids;
|
|
pub mod item;
|
|
pub mod packets;
|
|
pub mod quiet;
|
|
pub mod registry;
|
|
mod resolver;
|
|
pub mod rsa;
|
|
pub mod secure_chat;
|
|
pub mod servers;
|
|
pub mod text;
|
|
|
|
/// SharedConstants.getProtocolVersion().
|
|
pub const PROTOCOL_VERSION: i32 = horizon_core::version::PROTOCOL_VERSION;
|
|
/// The game version servers report in their status.
|
|
pub const GAME_VERSION: &str = horizon_core::VANILLA_VERSION;
|
|
|
|
/// Connection protocol states (ConnectionProtocol).
|
|
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
|
|
pub enum State {
|
|
Handshake,
|
|
Status,
|
|
Login,
|
|
Configuration,
|
|
Play,
|
|
}
|
|
/// PacketFlow.
|
|
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
|
|
pub enum Direction {
|
|
Clientbound,
|
|
Serverbound,
|
|
}
|
|
|
|
/// A malformed or unsupported packet.
|
|
#[derive(Clone, Debug, PartialEq, Eq)]
|
|
pub struct Error(pub String);
|
|
impl Error {
|
|
pub fn new(message: impl Into<String>) -> Self {
|
|
Self(message.into())
|
|
}
|
|
}
|
|
impl std::fmt::Display for Error {
|
|
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
|
f.write_str(&self.0)
|
|
}
|
|
}
|
|
impl std::error::Error for Error {}
|
|
impl From<std::io::Error> for Error {
|
|
fn from(e: std::io::Error) -> Self {
|
|
Self(e.to_string())
|
|
}
|
|
}
|
|
pub type Result<T> = std::result::Result<T, Error>;
|