FeatherMC/src/DedicatedServer.h

33 lines
773 B
C
Raw Normal View History

2020-07-24 10:17:36 +01:00
#pragma once
#include "MinecraftClient.h"
#include "ServerStatus.h"
2020-08-01 02:36:29 +01:00
#include "Protocol.h"
2020-07-29 01:46:31 +01:00
#include "network/IListenerInterface.h"
2020-07-24 10:17:36 +01:00
namespace Feather
{
2020-07-25 04:44:00 +01:00
class ServerProperties;
2020-07-29 01:46:31 +01:00
class DedicatedServer final : public Network::IListenerInterface
2020-07-24 10:17:36 +01:00
{
public:
2020-07-25 04:44:00 +01:00
DedicatedServer(ServerProperties* properties);
2020-07-24 10:17:36 +01:00
~DedicatedServer();
2020-07-29 01:46:31 +01:00
void OnClientConnect(Network::TCPClientHandle&& client) override;
2020-08-01 04:54:31 +01:00
void OnClientDisconnect(const Network::TCPClient* client) override;
2020-07-29 01:46:31 +01:00
2020-08-01 02:36:29 +01:00
ServerStatus& GetStatus() { return m_status; }
2020-07-24 10:17:36 +01:00
private:
2020-07-25 04:44:00 +01:00
ServerProperties* m_properties;
2020-07-25 03:01:16 +01:00
Network::TCPListener m_listener;
ServerStatus m_status;
2020-08-01 02:36:29 +01:00
Protocol m_protocol;
2020-07-29 01:46:31 +01:00
LockableList<MinecraftClient> m_clients;
2020-07-24 10:17:36 +01:00
};
}