Show players a custom MOTD when they ping your server from their client. Create as many
categories as you need. Add new categories and messages to the messages.yml file that is
auto generated for you (requires ConfigFileGenerator).
If a player has the permission motd.member they will get the messages from the member
category. The same is true for any category you create. Just assign players the corresponding
motd.<categoryName> permission node.
Commands:
* Reload messages.yml file after you edit and save - /motd reload
* Reset the messages.yml file to factory settings - /motd --reset
* Save the iplist.yml and messages.yml files - /motd save
Built In Permissions:
- motd.admin
- motd.trial
- motd.member
- motd.expired
- motd.customNode
________________________________________________________________________________
|----------------!Read The Comments In The Script Below For Detailed Usage Instructions!---------------|
|_______________________________________________________________________________|
I want comments! Rip it apart! What have i done absolutely wrong? What have i done absolutely right?
Has this script helped you in any way? Did you try to use it and it just didn't work?
Thumbs Up are nice too!
________________________________________________________________________________
|----------------|______________Comment and Thumbs Up for Updates______________|---------------|
|_______________________________________________________________________________|
# ---------------------------------------------------------------------------- ## |# |# M O T D M a n a g e r |# |# A system for serving custom MOTDs |# |# |# Author: |Anthony| |# Version: 0.1 |# dScript Version: 0.9.5-b1522 |# |# Dependencies: |# - ConfigFileGenerator: http://scripts.citizensnpcs.co/view/0coo5b | # ---------------------------------------------------------------------------- ## # # ABOUT:# # MOTD Manager stores the IP address of players that connect to your server.# It will then use this list of IP:player to check the player for a permission# and send them a random message from the appropriate category when they view# their server list in their client.# # # USAGE:# # - Edit the messages.yml file that is generated on first run# - Edit the messages for the existing categories# - Create new categories if needed# - You can use denizen tags inside the messages to display dynamic content# to the viewer.# - After editing the messages.yml file you must reload the config files# /motd reload# # - Assign players the desired motd.<category> permission node.# # - Reset the config file# # # TODO - Future Feature Fluff:# # - Add better command support# - Ability to list/view/edit/create/delete categories and messages# # - Maybe make it not write to the IPlist.yml if the info is the same# #______________________________________________________________________________#
'ServerPing':
type: world
debug: false
events:
# What happens when a player (or bot) pings the server
on server list ping:
- inject locally ping instantly
on player joins:
- run locally join instantly
on server start:
- run locally loadYaml instantly delay:2s
on motd command:
- if !<context.server> {
- if !<player.has_permission[motd.admin]> queue stop
}
- if <c.args.get[1].is[==].to[reload]> {
- determine passively FULFILLED
- run locally loadYaml instantly delay:2s
- narrate "Configs reloaded!"
- queue stop
}
- if <c.args.get[1].is[==].to[save]> {
- determine passively FULFILLED
- run locally save instantly def:ipList
- run locally save instantly def:messages
- narrate "Configs saved!"
- queue stop
}
- if <c.args.get[1].is[==].to[--reset]> {
- determine passively FULFILLED
- flag <player> ConfigFileGeneratorNotify:true
- run s@ConfigFileGeneratorHelper def:MOTDManager|messages|false|true|true instantly
- flag <player> ConfigFileGeneratorNotify:!
- run locally loadYaml instantly delay:2s
- queue stop
}
ping:
- define address '<context.address.replace[.].with[-]>'
- define maxPlayers '<context.max_players>'
# Do we know this IP?
- if !<yaml[MOTDManager_ipList].contains[%address%]> {
- define message '<parse:<yaml[MOTDManager_messages].read[messages.messages.unknown].random>>'
- determine <def[message]>
- queue stop
}# Ok, we know this IP
- define player '<yaml[MOTDManager_ipList].read[%address%].as_player>'# Is this person in the minecraft ban file?
- if <def[player].is_banned> {
- define message '<parse:<yaml[MOTDManager_messages].read[messages.messages.banned].random>>'
- determine <def[message]>
- queue stop
}# Build a list of message types based on the contents of the messages.yml file
- define messageTypes '<yaml[MOTDManager_messages].list_keys[messages.messages].exclude[unknown|banned]>'
# Determine which category to pull a message from, then get a random message from that category.# Default to unknown if they don't fit in a category# BUG: Stops on first success. Would rather gather all cats and rando from
- foreach %messageTypes% {
- if <def[player].has_permission[motd.%value%].global> {
- define message '<parse:<yaml[MOTDManager_messages].read[messages.messages.%value%].random>>'
- foreach stop
}
else {
- define message '<parse:<yaml[MOTDManager_messages].read[messages.messages.unknown].random>>'
}}
- determine <def[message]>
join:
# Add the player IP as a key with the player object as the value.# Using the IP as the key gives us known info on server ping event BUT has# the potential to have stale data since player IP is dynamic (generally).# This always writes, even if the node exists. If multiple people connect# from the same IP, it will store the last player to connect.
- yaml 'write:<player.ip.address.replace[.].with[-].before[<&co>]>' 'value:<player>' id:MOTDManager_ipList
- run locally save instantly def:ipList
loadYaml:
# Loads the yaml files and generates default files if they don't exist.
- announce "<&b>Loading MOTD Manager config files..." to_console
- if !<server.has_file[MOTDManager/messages.yml]> {
- if <player> != null {
- flag <player> ConfigFileGeneratorNotify:true
- run s@ConfigFileGeneratorHelper def:MOTDManager|messages|false|true|false instantly
- flag <player> ConfigFileGeneratorNotify:!
}
else run s@ConfigFileGeneratorHelper def:MOTDManager|messages instantly
}
else {
- if <yaml.list.contains[MOTDManager_messages]> yaml unload 'id:MOTDManager_messages'
}
- yaml 'load:MOTDManager/messages.yml' 'id:MOTDManager_messages'
- if !<server.has_file[MOTDManager/ipList.yml]> {
- yaml create 'id:MOTDManager_ipList'
- yaml 'write:description' 'value:This file stores a list of IP addresses and the last known player UUID' id:MOTDManager_ipList
- yaml 'savefile:MOTDManager/ipList.yml' 'id:MOTDManager_ipList'
}
else {
- if <yaml.list.contains[MOTDManager_ipList]> yaml unload 'id:MOTDManager_ipList'
}
- yaml 'load:MOTDManager/ipList.yml' 'id:MOTDManager_ipList'
- announce "<&b>MOTD Manager config files Loaded!" to_console
save:
- yaml 'savefile:MOTDManager/%1%.yml' 'id:MOTDManager_%1%'
- yaml unload 'id:MOTDManager_%1%'
- yaml 'load:MOTDManager/%1%.yml' 'id:MOTDManager_%1%'################################################################################# ## Messages ## ## These are the default messages. They will be used to build the messages.yml ## file. You can add additional messages and categories to that file after it ## has been generated. ## ##______________________________________________________________________________## ##______________________________DO_NOT_EDIT_THIS_DATA___________________________##______________________________________________________________________________#
MOTDManager_messages:
type: yaml data
debug: false
# Just add new messages and permissions to check.# The banned and unknown sections are checked outside the other types.
messages:
information:
description:
- 'Custom MOTD system'
- 'Display a custom MOTD to players based on a permission.'
- 'MOTD for Staff groups, player groups, or individual players.'
- 'This file holds all the messages for the server ping event.'
usage:
- 'Add/change the messages in the categories below as needed.'
- 'We can use denizen tags to add almost any information to the custom'
- 'messages such as last login time, how much econ money they have, etc.'
- 'Make sure players have the appropriate permission (listed below).'
- 'You can create new categories by simply creating a new node under the'
- 'messages node and assigning players the corresponding permission.'
permissions:
- 'motd.trial'
- 'motd.member'
- 'motd.expired'
- 'motd.customNode'
messages:
unknown:
- '<&6>We<&sq>ve never met!<&nl><&e>Here<&sq>s a Second Line!'
banned:
- '<&c>You have been Banned <&6><def[player].name>!<&nl><&b>Appeal your ban on the forum!'
expired:
- '<&6>Your membership has expired <def[player].name>!<&nl><&e>Go to the forum to renew today!'
trial:
- '<&6>We hope you<&sq>re enjoying yourself <&a><def[player].name>!<&nl><&e>You first joined <def[player].first_played.formatted> ago.'
member:
- '<&6>Welcome back <&a><def[player].name>!<&nl><&e>We<&sq>re glad to see you!'
customNode:
- '<&6>Hey, you<&sq>re special <&a><def[player].name>!<&nl><&e>C<&sq>mon in, the coffee is fresh!'
In my opinion a must need in case you pay attention to the details! And in overal a great addition to every and any kind of server! Try it out folks!
I'll be using this on our server! Great script!