MiniMOTD

MiniMOTD

5k Downloads

[Feature Request] MOTD "Profiles"

Andre601 opened this issue ยท 0 comments

commented

Is your feature request related to a problem? Please describe.
Not related to a problem

Describe the solution you'd like
It could be a nice implementation to have a way to define multiple "MOTD Profiles". By that I essentially mean different files which all have conditions, priorities and the MOTD(s) to use (including any other changes like icons, player count change, etc)

Those additional files should be in their own folder (i.e. plugins/MiniMOTD/profiles/) to not make the main folder cluttered with them.

Example File:

# Lower number = Lower priority
priority=10

# Not entirely sure about the syntax... Just using a random one
# If the player is banned, show this setting
condition="{isBanned}"

icon-enabled=true
motd-enabled=true
motds=[
    {
        icon="banned"
        line1="<red>You're banned from this Server!"
        line2="<gray>Appeal at <aqua>https://myserver.com/ban-appeal"
    }
]
player-count-settings {
    allow-exceeding-maximum=false
    disable-player-list-hover=true
    hide-player-count=true
}

The above example would override whatever has been defined in the default main.conf (which would act as the default if none of the profiles match) when the condition matches.
Any setting missing from that file would use whatever is set in the main.conf

I can think of the following placeholders to be available for conditions if it isn't too hard to implement:

  • {isBanned}
    Returns true or false based on whether the player is banned or not
  • {size}
    Returns a number representing the current amount of players online on the server.
    Could be used in an expression such as {size} == 69 to return true or false based on it.
  • {date <format>}
    Allows comparing the current date to a specific one using a specified SimpleDateFormat.
    Could be used in an expression such as {date dd.MM} == '01.01' to return true or false based on it.
  • {hour}
    Returns a number representing the current hour (1-24) based on the timezone the server is in (or default to UTC?).
    Could be used in an expression such as {hour} >= 23 && {hour} <= 1 to return true or false based on it.
  • {minute}
    Same as {hour} but the number represents the current minute (0-59).
  • {second}
    Same as {hour} but the number represents the current second (0-59).
  • {version}
    Returns a number representing the protocol version of a client.
    Could be used in an expression such as {version} <= 393 to return true or false based on it.

Describe alternatives you've considered
There isn't really any. You at most can define multiple MOTDs, icons and such which are selected at random.

Additional context
This could be a neat solution for issues #19 and #56 as the following config examples could be used.

Pre 1.16 MOTDs:

# Lower number = Lower priority
priority=10

condition="{version} <= 578" # Version is less or equal to 1.15.2

icon-enabled=true
motd-enabled=true
motds=[
    {
        line1="<gray>[<green>1.13-1.16.5</green>] Welcome to <aqua>play.myserver.com</aqua>!"
        line2="<gray>Our website: <aqua>https://myserver.com</aqua>"
    }
]

Time-based MOTD:

# Lower number = Lower priority
priority=10

condition="{hour} >= 23 && {hour} <= 24" # Time is between 11PM and midnight

icon-enabled=true
motd-enabled=true
motds=[
    {
        line1="<gray>[<green>1.13-1.16.5</green>] Welcome to <aqua>play.myserver.com</aqua>!"
        line2="<red>MyServer is currently in <bold>Maintenance Mode</bold>! Check back later."
    }
]