show date right in status description

This commit is contained in:
2026-06-01 00:21:14 +02:00
parent b818f7eaa3
commit dea2bd0af7
4 changed files with 189 additions and 2 deletions

View File

@ -10,6 +10,8 @@ use json::object;
use crate::minecraft::varint::varint_write;
use std::collections::VecDeque;
use chrono::{DateTime, Utc};
impl Client {
pub async fn status_intent_handle(&self, packet: &mut VecDeque<u8>, packet_id: i32) -> Result<(),String> {
let status_response = object! {
@ -53,7 +55,11 @@ impl Client {
match self.server.as_ref().unwrap() {
Ok(server) => {
let login = match server.last_login {
Some(date) => { format!("{:?}", date) },
Some(date) => {
let datetime: DateTime<Utc> = date.into();
format!("{}", datetime.format("%d-%m-%Y at %H:%M").to_string())
},
None => { "never".to_string() }
};
format!("§fServer is {}\nlast login: {}", server.status, login)