error display + remove unused imports
This commit is contained in:
parent
abb717f4cf
commit
a3fd9dc40b
3 changed files with 24 additions and 14 deletions
|
@ -1,6 +1,5 @@
|
|||
use std::{net::TcpListener, sync::{Arc, Mutex}, thread};
|
||||
|
||||
use rust_mc_proto::{DataBufferReader, DataBufferWriter, MCConn, MCConnTcp, MinecraftConnection, Packet, ProtocolError};
|
||||
use rust_mc_proto::{DataBufferReader, DataBufferWriter, MCConnTcp, MinecraftConnection, Packet, ProtocolError};
|
||||
|
||||
/*
|
||||
|
||||
|
@ -44,7 +43,15 @@ fn accept_client(mut conn: MCConnTcp, server: Arc<Mutex<MinecraftServer>>) -> Re
|
|||
if handshake {
|
||||
if packet.id == 0x00 {
|
||||
let mut status = Packet::empty(0x00);
|
||||
status.write_string(&server.lock().unwrap().motd)?;
|
||||
|
||||
let serv = server.lock().unwrap();
|
||||
|
||||
let motd = serv.motd.clone();
|
||||
let motd = motd.replace(
|
||||
"PROTOCOL_VERSION",
|
||||
&serv.protocol_version.to_string());
|
||||
|
||||
status.write_string(&motd)?;
|
||||
conn.write_packet(&status)?;
|
||||
} else if packet.id == 0x01 {
|
||||
let mut status = Packet::empty(0x01);
|
||||
|
@ -83,7 +90,7 @@ fn main() {
|
|||
765,
|
||||
"{
|
||||
\"version\":{
|
||||
\"protocol\":765,
|
||||
\"protocol\":PROTOCOL_VERSION,
|
||||
\"name\":\"Version name\"
|
||||
},
|
||||
\"players\":{
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
use std::{net::TcpListener, sync::{atomic::AtomicBool, atomic::Ordering}, thread};
|
||||
use std::sync::mpsc::channel;
|
||||
use rust_mc_proto::{DataBufferReader, DataBufferWriter, MCConn, MCConnTcp, MinecraftConnection, Packet, ProtocolError};
|
||||
use std::{net::TcpListener, thread, sync::mpsc::channel};
|
||||
use rust_mc_proto::{DataBufferReader, DataBufferWriter, MCConnTcp, Packet};
|
||||
|
||||
const LONG_TEXT: &str = "some_long_text_wow_123123123123123123123123";
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue