vexyl / MCHawk

A Minecraft classic server
MIT License
8 stars 4 forks source link

Inheritance for CPE #59

Open GiantCrocodile opened 6 years ago

GiantCrocodile commented 6 years ago

I think CPE should be a class which inherits from Protocol and Packet should be an inner class of Protocol?

vexyl commented 6 years ago

I do not think CPE should inherit from Protocol, but they should both inherit from some (pure?) abstract base class. See issue #44. Packet inherits from BufferStream, and I'm not sure if it is a good idea to put it under Protocol as it should be used for all protocols not just classic (which suggests that Protocol is poorly named).

GiantCrocodile commented 6 years ago

I think there should be a abstract/virtual class which is called Protocol and then you got ClassicProtocol and ClassicProtocolExtended. I don't see a reason for Packet class in its current state - it is in detail implemented and I'm not sure other implementations fit better for other protocols. Maybe there should be a Package class to inherit from (like Protocol class) and you provide a default one (like the currently existing one).