Protocols should be more generic. Keep it all in C++ (could be done in Lua, but no reason to do so). Protocol base class/interface? It should at least register itself with the server and worlds can check if a given protocol is available and do whatever it wants based on that. E.g., worlds could choose whether to use CPE or not and players could create entirely classic worlds (no CPE).
Example idea:
class IProtocol {
virtual bool IsValidBlock(int type) = 0;
virtual GetName() = 0;
};
...
class CPE : public IProtocol
{
// implement the above virtual functions
/// ...
}
CPE::CPE()
{
Server::GetInstance()->RegisterProtocol("CPE", this);
}
/* ...
* Server/World use the above for whatever
*/
Protocols should be more generic. Keep it all in C++ (could be done in Lua, but no reason to do so). Protocol base class/interface? It should at least register itself with the server and worlds can check if a given protocol is available and do whatever it wants based on that. E.g., worlds could choose whether to use CPE or not and players could create entirely classic worlds (no CPE).
Example idea: