the game where you go into mines and start crafting! but for consoles (forked directly from smartcmd's github)
1#pragma once
2class PendingConnection;
3class PlayerConnection;
4class MinecraftServer;
5class Socket;
6class ServerSettingsChangedPacket;
7
8using namespace std;
9
10class ServerConnection
11{
12// public static Logger logger = Logger.getLogger("Minecraft");
13
14private:
15// ServerSocket serverSocket;
16// private Thread listenThread;
17public:
18 volatile bool running;
19private:
20 int connectionCounter;
21private:
22 CRITICAL_SECTION pending_cs; // 4J added
23 vector< shared_ptr<PendingConnection> > pending;
24 vector< shared_ptr<PlayerConnection> > players;
25
26 // 4J - When the server requests a texture, it should add it to here while we are waiting for it
27 vector<wstring> m_pendingTextureRequests;
28public:
29 MinecraftServer *server;
30
31public:
32 ServerConnection(MinecraftServer *server); // 4J - removed params InetAddress address, int port);
33 ~ServerConnection();
34 void NewIncomingSocket(Socket *socket); // 4J - added
35
36 void removeSpamProtection(Socket *socket) { }// 4J Stu - Not implemented as not required
37 void addPlayerConnection(shared_ptr<PlayerConnection> uc);
38private:
39 void handleConnection(shared_ptr<PendingConnection> uc);
40public:
41 void stop();
42 void tick();
43
44 // 4J Added
45 bool addPendingTextureRequest(const wstring &textureName);
46 void handleTextureReceived(const wstring &textureName);
47 void handleTextureAndGeometryReceived(const wstring &textureName);
48 void handleServerSettingsChanged(shared_ptr<ServerSettingsChangedPacket> packet);
49 vector< shared_ptr<PlayerConnection> > *getPlayers();
50};