Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature Request] MOTD "Profiles" #59

Open
Andre601 opened this issue Apr 28, 2021 · 0 comments
Open

[Feature Request] MOTD "Profiles" #59

Andre601 opened this issue Apr 28, 2021 · 0 comments
Labels
enhancement New feature or request

Comments

@Andre601
Copy link

Andre601 commented Apr 28, 2021

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."
    }
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant