1 #ifndef BLANK_SERVER_SERVER_HPP
2 #define BLANK_SERVER_SERVER_HPP
4 #include "../app/Config.hpp"
5 #include "../world/World.hpp"
6 #include "../world/WorldManipulator.hpp"
22 class ClientConnection;
25 : public WorldManipulator {
28 Server(const Config::Network &, World &, const World::Config &, const WorldSave &);
35 UDPsocket &GetSocket() noexcept { return serv_sock; }
36 UDPpacket &GetPacket() noexcept { return serv_pack; }
38 World &GetWorld() noexcept { return world; }
39 const WorldSave &GetWorldSave() noexcept { return save; }
41 void SetPlayerModel(const Model &) noexcept;
42 bool HasPlayerModel() const noexcept;
43 const Model &GetPlayerModel() const noexcept;
45 Player *JoinPlayer(const std::string &name);
47 void SetBlock(Chunk &, int, const Block &) override;
49 /// send message to all connected clients
50 void DistributeMessage(std::uint8_t type, std::uint32_t ref, const std::string &msg);
53 void HandlePacket(const UDPpacket &);
55 ClientConnection &GetClient(const IPaddress &);
62 std::list<ClientConnection> clients;
65 ChunkIndex &spawn_index;
66 const WorldSave &save;
67 const Model *player_model;