MiniMOTD

MiniMOTD

5k Downloads

[Feature Request] Set MOTD via API

ItWasEnder opened this issue ยท 4 comments

commented

Is your feature request related to a problem? Please describe.
Having to modify a file in order to set the motd, and then having to reload the plugin for it to become active.

Describe the solution you'd like
A developer API to be able to set the "current" motd, probably wont support multiple MOTD like the config unless there would be an easy way to implement this. This would allow people to incorporate the server list MOTD into their own plugins to make their server more interactable.

Example:

You want to do some development on the live server and you can't have player on for that, instead of having to go into the config and add a new line for he motd (including all the special colonizing you do to make your motd unique) you can just specify the maintenance motd in your plugin and have it change the active motd. After you're done you can tell MiniMOTD to switch back to the config motd.
MiniMOTD.getAPI().setMOTD("properly-formatted-string");
MiniMOTD.getAPI().resetMOTD();

Optional: MiniMOTD.getAPI().setMOTD(List<String> properly-formatted-list-of-strings);

Another Example:

You throw events on your server and want to announce when they are happening in order to draw more plays to your server. Instead of having to prepare the server MOTD a day in advance (if you start your server daily like me). You can just make/commission a plugin that can set the motd to whatever you want using in-game commands and switch it back whenever. This makes for a nice way to interact with your playerbase and a great feature to add to your server. (Spigot again, because I don't restart my proxy)

If I had the knowledge to create a sophisticated plugin like this, this is definitely something I would include in it, just to give others that readiness to change the MOTD at any moment.

Describe alternatives you've considered
Having your plugin actively change the needed file then using plugman to reload it because I'm pretty sure you can't force MiniMOTD to reload itself, (This would only be possible on the spigot version, I use bungeecord)

Additional context

  • Ability to set one or multiple motd using an API
  • Ability to reset the motd to whatever is contained inside the config file for MiniMOTD
  • Preview function (for development only) to parse your string to make sure it is formatted correctly
  • Maybe a way to serve a specific user a custom MOTD
commented

Assuming either of these limitations are in place, best case scenario is that other plugins/mods using MiniMOTDs APIs would need to compile against and be compatible with each MiniMOTD platform separately, which imo is pretty ugly.

I mean... Then it should be the goal of MiniMOTD to ship a universal API that uses generics and/or custom entities that each separate "module" (i.e. the bukkit version) wraps the required info around.

Like similar to how I made a ProxyLogger interface for my plugin to have a unified system for logging purposes on multiple platforms... Of course it wouldn't be that easy in MiniMOTD, but I think it would be a doable solution.

commented

Assuming either of these limitations are in place, best case scenario is that other plugins/mods using MiniMOTDs APIs would need to compile against and be compatible with each MiniMOTD platform separately, which imo is pretty ugly.

I mean... Then it should be the goal of MiniMOTD to ship a universal API that uses generics and/or custom entities that each separate "module" (i.e. the bukkit version) wraps the required info around.

Like similar to how I made a ProxyLogger interface for my plugin to have a unified system for logging purposes on multiple platforms... Of course it wouldn't be that easy in MiniMOTD, but I think it would be a doable solution.

This is nowhere near as simple as you think it is. No idea what a ProxyLogger interface is, but logging in MiniMOTD is already abstracted using slf4j.

commented

Notable mentions as to what this could be used for #56 #59 #33

Maybe even #19 if done more intricately. (Developers can get the protocol version of players and serve them a specified MOTD)

commented

The main issue with exposing any API from MiniMOTD is that not every platform relocates dependencies/MiniMOTD classes to the same location, due to:

  1. The fact MiniMOTD ships a universal jar
  2. The fact that not every supported platform natively supports Adventure

Assuming either of these limitations are in place, best case scenario is that other plugins/mods using MiniMOTDs APIs would need to compile against and be compatible with each MiniMOTD platform separately, which imo is pretty ugly.