Skip to content
This repository has been archived by the owner on Jun 19, 2020. It is now read-only.

Generic protocols #44

Open
vexyl opened this issue Jul 30, 2018 · 1 comment
Open

Generic protocols #44

vexyl opened this issue Jul 30, 2018 · 1 comment
Assignees
Labels
enhancement New feature or request

Comments

@vexyl
Copy link
Owner

vexyl commented Jul 30, 2018

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
*/
@vexyl vexyl added the enhancement New feature or request label Jul 30, 2018
@vexyl vexyl self-assigned this Jul 30, 2018
@GiantCrocodile
Copy link
Contributor

A protocol should also report its version and if it's deprecated (can be checked by the server).

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants