1 #ifndef BLANK_SERVER_SERVER_HPP
2 #define BLANK_SERVER_SERVER_HPP
4 #include "../app/Config.hpp"
5 #include "../shared/CLI.hpp"
6 #include "../world/World.hpp"
7 #include "../world/WorldManipulator.hpp"
23 class ClientConnection;
26 : public WorldManipulator {
29 Server(const Config::Network &, World &, const World::Config &, const WorldSave &);
36 UDPsocket &GetSocket() noexcept { return serv_sock; }
37 UDPpacket &GetPacket() noexcept { return serv_pack; }
39 World &GetWorld() noexcept { return world; }
40 const WorldSave &GetWorldSave() noexcept { return save; }
42 void SetPlayerModel(const Model &) noexcept;
43 bool HasPlayerModel() const noexcept;
44 const Model &GetPlayerModel() const noexcept;
46 Player *JoinPlayer(const std::string &name);
48 void SetBlock(Chunk &, int, const Block &) override;
50 /// for use by client connections when they receive a line from the player
51 void DispatchMessage(Player &, const std::string &);
53 /// send message to all connected clients
54 void DistributeMessage(std::uint8_t type, std::uint32_t ref, const std::string &msg);
57 void HandlePacket(const UDPpacket &);
59 ClientConnection &GetClient(const IPaddress &);
66 std::list<ClientConnection> clients;
69 ChunkIndex &spawn_index;
70 const WorldSave &save;
71 const Model *player_model;