2020-07-31 02:53:40 +01:00
|
|
|
#pragma once
|
|
|
|
|
2020-08-01 02:36:29 +01:00
|
|
|
#include "Common.h"
|
2020-07-31 02:53:40 +01:00
|
|
|
#include "NetworkMessage.h"
|
2020-08-02 02:44:35 +01:00
|
|
|
#include "protocol/ProtocolDefinitions.h"
|
2020-08-01 00:55:47 +01:00
|
|
|
#include <cstdio>
|
2020-08-01 22:53:02 +01:00
|
|
|
#include <cstdint>
|
2020-07-31 02:53:40 +01:00
|
|
|
|
|
|
|
namespace Feather
|
|
|
|
{
|
2020-08-01 02:36:29 +01:00
|
|
|
class DedicatedServer;
|
2020-07-31 02:53:40 +01:00
|
|
|
class PacketReader;
|
|
|
|
class MinecraftClient;
|
|
|
|
|
|
|
|
class ProtocolContext
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
inline ProtocolState GetState() const
|
|
|
|
{
|
|
|
|
return m_state;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline void SetState(ProtocolState state)
|
|
|
|
{
|
2020-08-01 02:36:29 +01:00
|
|
|
Log_Info("Setting state: %d", (int)state);
|
2020-07-31 02:53:40 +01:00
|
|
|
m_state = state;
|
|
|
|
}
|
|
|
|
private:
|
|
|
|
ProtocolState m_state = ProtocolState::Handholding;
|
|
|
|
};
|
|
|
|
|
|
|
|
class Protocol
|
|
|
|
{
|
2020-08-01 02:36:29 +01:00
|
|
|
DedicatedServer& m_server;
|
2020-07-31 02:53:40 +01:00
|
|
|
public:
|
2020-08-01 02:36:29 +01:00
|
|
|
Protocol(DedicatedServer& server) : m_server(server) {}
|
|
|
|
|
2020-07-31 02:53:40 +01:00
|
|
|
void HandlePacket(MinecraftClient& client, PacketReader& packet);
|
|
|
|
};
|
2020-08-01 00:55:47 +01:00
|
|
|
}
|