the game where you go into mines and start crafting! but for consoles (forked directly from smartcmd's github)
at main 49 lines 1.4 kB view raw
1#pragma once 2#include "..\Minecraft.World\PacketListener.h" 3class MinecraftServer; 4class Socket; 5class LoginPacket; 6class Connection; 7class Random; 8using namespace std; 9 10class PendingConnection : public PacketListener 11{ 12private: 13 static const int FAKE_LAG = 0; 14 static const int MAX_TICKS_BEFORE_LOGIN = 20 * 30; 15 16 // public static Logger logger = Logger.getLogger("Minecraft"); 17 static Random *random; 18 19public: 20 Connection *connection; 21public: 22 bool done; 23private: 24 MinecraftServer *server; 25 int _tick; 26 wstring name; 27 shared_ptr<LoginPacket> acceptedLogin; 28 wstring loginKey; 29 30public: 31 PendingConnection(MinecraftServer *server, Socket *socket, const wstring& id); 32 ~PendingConnection(); 33 void tick(); 34 void disconnect(DisconnectPacket::eDisconnectReason reason); 35 virtual void handlePreLogin(shared_ptr<PreLoginPacket> packet); 36 virtual void handleLogin(shared_ptr<LoginPacket> packet); 37 virtual void handleAcceptedLogin(shared_ptr<LoginPacket> packet); 38 virtual void onDisconnect(DisconnectPacket::eDisconnectReason reason, void *reasonObjects); 39 virtual void handleGetInfo(shared_ptr<GetInfoPacket> packet); 40 virtual void handleKeepAlive(shared_ptr<KeepAlivePacket> packet); 41 virtual void onUnhandledPacket(shared_ptr<Packet> packet); 42 void send(shared_ptr<Packet> packet); 43 wstring getName(); 44 virtual bool isServerPacketListener(); 45 virtual bool isDisconnected(); 46 47private: 48 void sendPreLoginResponse(); 49};