ColinHDev / CPlot

Land and world management plugin for PocketMine-MP
https://discord.gg/cAYKEtaqnp
GNU General Public License v3.0
29 stars 12 forks source link

Implement session system for improved command and event api #88

Open ColinHDev opened 1 year ago

ColinHDev commented 1 year ago

Currently, it is a big pain to send messages to players due to the complicated language system.

The idea is to introduce a Session class for each online player that handles all the weird logic for sendMessage(), sendTitle(), etc. This should improve the API and remove a bunch of lines of boilerplate code.

The problem is the following: Not all (sub)commands are sent by players, some like /p generate can also be run by the console. There are some ideas that came to my mind over the last few days:

Input towards this is highly encouraged, so that I don't end up implementing an inferior API design just because of missing input. 👀 Any opinion is welcome! ^^

ColinHDev commented 1 year ago

While writing this, I came up with the following as an extension of the first idea:

ColinHDev commented 1 year ago

@supercrafter333, since you are the only person I know of, who worked with custom subcommand classes, I would especially be interested in your opinion.

supercrafter333 commented 1 year ago

I think the first idea (and your Extension for it) is the best. Your second idea would be bad in production and your last idea would be a bit annoying for developers.

ColinHDev commented 1 year ago

Alright, thank you!