Use 1.20.3 protocol version

This commit is contained in:
timvisee 2024-03-16 17:51:56 +01:00
parent 485941cf81
commit 0eec1e0b55
No known key found for this signature in database
GPG Key ID: B8DB720BC383E172
7 changed files with 17 additions and 19 deletions

4
Cargo.lock generated
View File

@ -771,7 +771,7 @@ checksum = "523dc4f511e55ab87b694dc30d0f820d60906ef06413f93d4d7a1385599cc149"
[[package]] [[package]]
name = "minecraft-protocol" name = "minecraft-protocol"
version = "0.1.0" version = "0.1.0"
source = "git+https://github.com/timvisee/rust-minecraft-protocol?rev=b00328e#b00328e67c3c968ddd03a40202ba233ea0411a64" source = "git+https://github.com/timvisee/rust-minecraft-protocol?rev=4f93bb3#4f93bb3438d25fd23410d7c30964971e59cfb327"
dependencies = [ dependencies = [
"byteorder", "byteorder",
"minecraft-protocol-derive", "minecraft-protocol-derive",
@ -784,7 +784,7 @@ dependencies = [
[[package]] [[package]]
name = "minecraft-protocol-derive" name = "minecraft-protocol-derive"
version = "0.0.0" version = "0.0.0"
source = "git+https://github.com/timvisee/rust-minecraft-protocol?rev=b00328e#b00328e67c3c968ddd03a40202ba233ea0411a64" source = "git+https://github.com/timvisee/rust-minecraft-protocol?rev=4f93bb3#4f93bb3438d25fd23410d7c30964971e59cfb327"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",

View File

@ -50,7 +50,7 @@ dotenv = "0.15"
flate2 = { version = "1.0", default-features = false, features = ["default"] } flate2 = { version = "1.0", default-features = false, features = ["default"] }
futures = { version = "0.3", default-features = false, features = ["executor"] } futures = { version = "0.3", default-features = false, features = ["executor"] }
log = "0.4" log = "0.4"
minecraft-protocol = { git = "https://github.com/timvisee/rust-minecraft-protocol", rev = "b00328e" } minecraft-protocol = { git = "https://github.com/timvisee/rust-minecraft-protocol", rev = "4f93bb3" }
named-binary-tag = "0.6" named-binary-tag = "0.6"
nix = { version = "0.28", features = ["process", "signal"] } nix = { version = "0.28", features = ["process", "signal"] }
notify = "4.0" notify = "4.0"

View File

@ -18,8 +18,8 @@
# Server version & protocol hint. # Server version & protocol hint.
# Sent to clients until actual server version is known. # Sent to clients until actual server version is known.
# See: https://git.io/J1Fvx # See: https://git.io/J1Fvx
#version = "1.19.3" #version = "1.20.3"
#protocol = 761 #protocol = 765
[server] [server]
# Server address. Internal IP and port of server started by lazymc to proxy to. # Server address. Internal IP and port of server started by lazymc to proxy to.

View File

@ -3,11 +3,10 @@ use std::sync::Arc;
use std::time::Duration; use std::time::Duration;
use bytes::BytesMut; use bytes::BytesMut;
use minecraft_protocol::data::server_status::ServerStatus;
use minecraft_protocol::decoder::Decoder; use minecraft_protocol::decoder::Decoder;
use minecraft_protocol::version::v1_14_4::handshake::Handshake; use minecraft_protocol::version::v1_14_4::handshake::Handshake;
use minecraft_protocol::version::v1_14_4::status::{ use minecraft_protocol::version::v1_20_3::status::{
PingRequest, PingResponse, StatusRequest, StatusResponse, PingRequest, PingResponse, ServerStatus, StatusRequest, StatusResponse,
}; };
use rand::Rng; use rand::Rng;
use tokio::io::AsyncWriteExt; use tokio::io::AsyncWriteExt;

View File

@ -9,7 +9,7 @@ pub mod packets;
/// in the configuration. /// in the configuration.
/// ///
/// Should be kept up-to-date with latest supported Minecraft version by lazymc. /// Should be kept up-to-date with latest supported Minecraft version by lazymc.
pub const PROTO_DEFAULT_VERSION: &str = "1.19.3"; pub const PROTO_DEFAULT_VERSION: &str = "1.20.3";
/// Default minecraft protocol version. /// Default minecraft protocol version.
/// ///
@ -17,7 +17,7 @@ pub const PROTO_DEFAULT_VERSION: &str = "1.19.3";
/// in the configuration. /// in the configuration.
/// ///
/// Should be kept up-to-date with latest supported Minecraft version by lazymc. /// Should be kept up-to-date with latest supported Minecraft version by lazymc.
pub const PROTO_DEFAULT_PROTOCOL: u32 = 761; pub const PROTO_DEFAULT_PROTOCOL: u32 = 765;
/// Compression threshold to use. /// Compression threshold to use.
// TODO: read this from server.properties instead // TODO: read this from server.properties instead

View File

@ -4,7 +4,7 @@ use std::sync::Arc;
use std::time::{Duration, Instant}; use std::time::{Duration, Instant};
use futures::FutureExt; use futures::FutureExt;
use minecraft_protocol::data::server_status::ServerStatus; use minecraft_protocol::version::v1_20_3::status::ServerStatus;
use tokio::process::Command; use tokio::process::Command;
use tokio::sync::watch; use tokio::sync::watch;
#[cfg(feature = "rcon")] #[cfg(feature = "rcon")]

View File

@ -1,13 +1,12 @@
use std::sync::Arc; use std::sync::Arc;
use bytes::BytesMut; use bytes::BytesMut;
use minecraft_protocol::data::chat::{Message, Payload}; use minecraft_protocol::data::server_status::{OnlinePlayers, ServerVersion};
use minecraft_protocol::data::server_status::*;
use minecraft_protocol::decoder::Decoder; use minecraft_protocol::decoder::Decoder;
use minecraft_protocol::encoder::Encoder; use minecraft_protocol::encoder::Encoder;
use minecraft_protocol::version::v1_14_4::handshake::Handshake; use minecraft_protocol::version::v1_14_4::handshake::Handshake;
use minecraft_protocol::version::v1_14_4::login::LoginStart; use minecraft_protocol::version::v1_14_4::login::LoginStart;
use minecraft_protocol::version::v1_14_4::status::StatusResponse; use minecraft_protocol::version::v1_20_3::status::{ServerStatus, StatusResponse};
use tokio::fs; use tokio::fs;
use tokio::io::AsyncWriteExt; use tokio::io::AsyncWriteExt;
use tokio::net::TcpStream; use tokio::net::TcpStream;
@ -232,11 +231,11 @@ async fn server_status(client_info: &ClientInfo, config: &Config, server: &Serve
if config.motd.from_server && status.is_some() { if config.motd.from_server && status.is_some() {
status.as_ref().unwrap().description.clone() status.as_ref().unwrap().description.clone()
} else { } else {
Message::new(Payload::text(match server_state { match server_state {
server::State::Stopped | server::State::Started => &config.motd.sleeping, server::State::Stopped | server::State::Started => config.motd.sleeping.clone(),
server::State::Starting => &config.motd.starting, server::State::Starting => config.motd.starting.clone(),
server::State::Stopping => &config.motd.stopping, server::State::Stopping => config.motd.stopping.clone(),
})) }
} }
}; };