GameServer.h 827 B

123456789101112131415161718192021222324252627282930313233343536
  1. #ifndef GAMESERVER_H
  2. #define GAMESERVER_H
  3. #include "commands/CommandManager.h"
  4. #include "common/world/World.h"
  5. #include "gaming-core/memory/UniquePointer.h"
  6. #include "gaming-core/network/Packet.h"
  7. #include "gaming-core/utils/Clock.h"
  8. #include "gaming-core/utils/List.h"
  9. #include "raw-terminal/RawReader.h"
  10. #include "server/commands/ServerState.h"
  11. class GameServer final {
  12. ServerState state;
  13. Clock tps;
  14. RawReader<256, 10> reader;
  15. CommandManager commandManager;
  16. BlockRegistry blocks;
  17. List<UniquePointer<World>> worlds;
  18. public:
  19. GameServer(Server& server);
  20. void tick();
  21. void onConnect(Server::Client& client);
  22. void onDisconnect(Server::Client& client);
  23. void onPacket(Server::Client& client, InPacket& in);
  24. bool isRunning() const;
  25. private:
  26. void handleCommands();
  27. };
  28. #endif