Files
Blitz/include/blitz/protocol/packets/ServerTpsPacket.h
2023-10-14 18:22:48 +02:00

41 lines
865 B
C++

#pragma once
#include "blitz/protocol/Protocol.h"
namespace blitz {
namespace protocol {
class ServerTpsPacket : public Packet {
private:
float m_TPS;
float m_MSPT;
std::uint64_t m_PacketSendTime; // used to calculate ping
public:
ServerTpsPacket() {}
ServerTpsPacket(float tps, float mspt, std::uint64_t sendTime) : m_TPS(tps), m_MSPT(mspt), m_PacketSendTime(sendTime) {}
virtual ~ServerTpsPacket() {}
virtual DataBuffer Serialize(bool packetID = true) const;
virtual void Deserialize(DataBuffer& data);
virtual void Dispatch(PacketHandler* handler) const;
float GetTPS() const {
return m_TPS;
}
float GetMSPT() const {
return m_MSPT;
}
std::uint64_t GetPacketSendTime() const {
return m_PacketSendTime;
}
virtual PacketType GetType() const {
return PacketType::ServerTps;
}
};
} // namespace protocol
} // namespace blitz