Inactive [INACTIVE] [DEV] MessageManager

Discussion in 'Inactive/Unsupported Plugins' started by EdGruberman, Jun 8, 2011.

  1. Offline

    EdGruberman

    MessageManager - API for standardizing message color and formatting:
    Version: v6.1.0




    If you were sent here from another plugin that has this as a dependency, simply download the MessageManager.jar file to your plugins folder and you can safely ignore everything else which is mostly for developers below.



    Overview:
    What is MessageManager?

    From a Player perspective, it is how in-game message text looks. A standardized look to help immediately recognize if the text is a personal message only you can see or if everyone on the server can see it also. The same color for messages of the same importance. e.g. Background event related messages will be grey, while important messages that warn you will be yellow. If enabled for the server you play on, it will timestamp messages in a timezone you can configure.

    From a Server Administrator perspective, it is how you can control what messages from each plugin look like. You can control a color theme to ensure consistency across plugins. You can set level thresholds to limit the display of less important or even debug messages. You can enable timestamps.

    From a Plugin Developer perspective, it is an API that enables you to standardize your plugin's messages. It helps simplify the targeting of groups of recipients.

    Channel settings (level, format, color) are plugin specific. Timestamp settings (format, pattern, timezone) are player specific.

    The MessageManager plugin mostly exists to standardize the way I develop my plugins. It's now a required dependency for most all my plugins. I found myself frequently either trying to remember what formatting I had used before to keep things standard across my plugins, or worse; Wanting to change the formatting and having to go back through all my plugins and find all the references to be updated accordingly.

    Features:
    • Fully customizable common format (Private messages prefixed with "-> <Message>", world messages prefixed with "[<WorldName>] <Message>", etc.)
    • Fully customizable common color theme (Dark colors for common/public broadcasts, light color equivalents for private)
    • Timestamps with player controllable time zones

    Message Codes:
    All formats and messages sent through MessageManager recognize color codes similar to how they used to be implemented for Minecraft. Messages will have an ampersand followed by a character be replaced by the corresponding color.

    You can use any of the ChatColor supported codes.

    &0 BLACK
    &1 DARK_BLUE
    &2 DARK_GREEN
    &3 DARK_AQUA
    &4 DARK_RED
    &5 DARK_PURPLE
    &6 GOLD
    &7 GRAY
    &8 DARK_GRAY
    &9 BLUE
    &a GREEN
    &b AQUA
    &c RED
    &d LIGHT_PURPLE
    &e YELLOW
    &f WHITE
    &k MAGIC (Random fast changing characters)
    &l BOLD
    &m STRIKETHROUGH
    &n UNDERLINE
    &o ITALIC
    &r RESET - undo all ChatColor and Message Codes
    &_ BASE - revert to the Base Message Color/Formatting

    In-Game Commands (open)
    In-Game Commands:
    Code:
    /messagemanager reload - Reloads configuration for the plugin
    /timestamp[ <Player>] - Display current timestamp settings for <Player>
    /timestamp[ <Player>] reset - Revert all changes back to default for <Player>
    /timestamp[ <Player>] on - Enable timestamp display for <Player>
    /timestamp[ <Player>] off - Disable timestamp display for <Player>
    /timestamp[ <Player>] pattern([ get]| set <Pattern>) - Display or configure pattern for <Player>
    /timestamp[ <Player>] format([ get]| set <Format>) - Display or configure format for <Player>
    /timestamp[ <Player>] timezone([ get]| set <TimeZone>) - Display or configure time zone for <Player>
    /timezone[ <TimeZone>] - Display or configure time zone
    Players by default have the ability to display their own timestamp settings, but not configure them. Server Operators by default have the ability to display and configure any players timestamp settings.
    Server Operators can enable the following permission for any players they want to have the ability to configure their own timestamp settings.
    Code:
    messagemanager.timestamp.self
    The most common command will probably be to adjust the time zone. For this reason there is the last command, the /timezone command. This also has an alias of /tz. This is probably the single command you'll want to make sure your users are educated on.
    The TimeZone parameter is a standard TimeZone ID. The command will list any IDs which partially match the input if there is no exact match and there is more than one partial match.
    For instance, to find the available Canadian timezones, I could issue the following command:
    Code:
    /tz canada
    Which would result in the following back:
    Code:
    Canada/Pacific (Pacific Standard Time)
    Canada/Yukon (Pacific Standard Time)
    Canada/Mountain (Mountain Standard Time)
    Canada/Central (Central Standard Time)
    Canada/East-Saskatchewan (Central Standard Time)
    Canada/Saskatchewan (Central Standard Time)
    Canada/Eastern (Eastern Standard Time)
    Canada/Atlantic (Atlantic Standard Time)
    Canada/Newfoundland (Newfoundland Standard Time)
    Then I could commit to one with the following command:
    Code:
    /tz canada/pac
    And that would only match one TimeZone ID and result in:
    Code:
    EdGruberman's Timestamp TimeZone: Canada/Pacific (Pacific Standard Time)
    Which confirms my new time zone setting.



    Configuration:
    Default MessageManager.yml File (open)
    Default MessageManager.yml File
    Code:
    PLAYER:
        level:
            channel: ALL
            log: 'OFF'
        format: '-> %1$s' # 1 = Message, 2 = Player Name
        color:
            SEVERE: RED
            WARNING: YELLOW
            NOTICE: LIGHT_PURPLE
            INFO: WHITE
            STATUS: GREEN
            EVENT: GRAY
            RIGHTS: BLUE
            CONFIG: AQUA
            FINE: BLACK
            FINER: BLACK
            FINEST: BLACK
    SERVER:
        level:
            channel: ALL
            log: ALL
        format: '%1$s' # 1 = Message, 2 = Server Name
        color:
            SEVERE: DARK_RED
            WARNING: GOLD
            NOTICE: DARK_PURPLE
            INFO: WHITE
            STATUS: DARK_GREEN
            EVENT: DARK_GRAY
            RIGHTS: DARK_BLUE
            CONFIG: DARK_AQUA
            FINE: BLACK
            FINER: BLACK
            FINEST: BLACK
    WORLD:
        level:
            channel: ALL
            log: ALL
        format: '[%2$s] %1$s' # 1 = Message, 2 = World Name
        color:
            SEVERE: DARK_RED
            WARNING: GOLD
            NOTICE: DARK_PURPLE
            INFO: WHITE
            STATUS: DARK_GREEN
            EVENT: DARK_GRAY
            RIGHTS: DARK_BLUE
            CONFIG: DARK_AQUA
            FINE: BLACK
            FINER: BLACK
            FINEST: BLACK
    CUSTOM:
        level:
            channel: ALL
            log: 'OFF'
        format: '[%2$s] %1$s' # 1 = Message, 2 = Channel Name
        color:
            SEVERE: DARK_RED
            WARNING: GOLD
            NOTICE: DARK_PURPLE
            INFO: WHITE
            STATUS: DARK_GREEN
            EVENT: DARK_GRAY
            RIGHTS: DARK_BLUE
            CONFIG: DARK_AQUA
            FINE: BLACK
            FINER: BLACK
            FINEST: BLACK
    log: '[%3$s] [%4$s] %2$s %1$s' # 1 = Message, 2 = Channel Description, 3 = Originating Plugin, 4 = Message Level


    Channel Type
    PLAYER = A single player (or console)
    SERVER = All players connected
    WORLD = Only players currently in the specified world
    CUSTOM = This is a special case defined and controlled by specific plugins (e.g. A chat room plugin could control custom chat rooms with this channel.)

    Each channel type has a level threshold for both channel and log, a message format, and default colors associated with each level. The level threshold is defined in more detail below, but basically it will cause only messages of that level or "higher" to be displayed. The message format can contain message codes (also defined in more detail below) and controls the standard look of messages sent to that type of channel. The colors are defined under Base Message Color below.

    Message Level
    SEVERE = Errors and reverted actions
    WARNING = Dangerous
    NOTICE = Instructions, requirements
    INFO = Standard data
    STATUS = Directly related to player's actions
    EVENT = External to player's actions
    RIGHTS = Permissions related
    CONFIG = Current settings
    FINE = Debug
    FINER = Detailed Debug
    FINEST = Extra Debug
    (The descriptions are only loose suggestions. The basic concept is to have plugins attempt to assess the importance/meaning of all messages and assign them as closely as possible.)

    Level thresholds defined for channel or log will prevent any messages lower than the defined threshold from being displayed. For instance, if the level threshold is set to CONFIG, no debug related messages coming in at FINE, FINER, or FINEST will be displayed. But any other higher or equivalent level message (CONFIG, RIGHTS, EVENT, STATUS, INFO, NOTICE, WARNING, and SEVERE) will display. This is useful for turning debug messages on at varying detail depending on the need, or perhaps preventing basic configuration messages and permission related messages. It is really up to each implementing plugin to define how it assigns these messages and leverage the threshold accordingly.

    Base Message Color
    Each level has a base color defined for each possible destination. All messages for a given destination with a given level will have the same base color applied at the front of the message. Color codes and native color characters will override the base color for the remaining characters in a message.
    Default Colors (open)
    Default Colors
    Code:
    PLAYER:
        color:
            SEVERE: RED
            WARNING: YELLOW
            NOTICE: LIGHT_PURPLE
            INFO: WHITE
            STATUS: GREEN
            EVENT: GRAY
            RIGHTS: BLUE
            CONFIG: AQUA
            FINE: BLACK
            FINER: BLACK
            FINEST: BLACK
    SERVER:
        color:
            SEVERE: DARK_RED
            WARNING: GOLD
            NOTICE: DARK_PURPLE
            INFO: WHITE
            STATUS: DARK_GREEN
            EVENT: DARK_GRAY
            RIGHTS: DARK_BLUE
            CONFIG: DARK_AQUA
            FINE: BLACK
            FINER: BLACK
            FINEST: BLACK
    WORLD:
        color:
            SEVERE: DARK_RED
            WARNING: GOLD
            NOTICE: DARK_PURPLE
            INFO: WHITE
            STATUS: DARK_GREEN
            EVENT: DARK_GRAY
            RIGHTS: DARK_BLUE
            CONFIG: DARK_AQUA
            FINE: BLACK
            FINER: BLACK
            FINEST: BLACK
    CUSTOM:
        color:
            SEVERE: DARK_RED
            WARNING: GOLD
            NOTICE: DARK_PURPLE
            INFO: WHITE
            STATUS: DARK_GREEN
            EVENT: DARK_GRAY
            RIGHTS: DARK_BLUE
            CONFIG: DARK_AQUA
            FINE: BLACK
            FINER: BLACK
            FINEST: BLACK



    Plugin Specific Configuration Overrides
    MessageManager configuration settings can be either globally defined in the /plugins/MessageManager/MessageManager.yml or overridden in each plugin separately in /plugin/<PluginName>/MessageManager.yml


    Plugin Developers (open)
    Plugin Developers:
    SimpleTemplate has example source code that demonstrates how I create my plugins that use MessageManager.

    There are three key points to note. The first is how to instantiate MessageManager and use it.
    The Main.java code demonstrates a bare minimum plugin implementation that uses MessageManager. Note carefully that the onLoad method loads the config.yml file or creates it from the default supplied in the JAR if one does not already exist.

    The second point to note is how the plugin override file (/plugin/<PluginName>/MessageManager.yml) for a plugin implementing MessageManager can control which messages are displayed. If it has any entries that match /plugins/MessageManager/config.yml, it will use the plugin override values.
    The defaults/MessageManager.yml file demonstrates these entries being used in a common manner.

    The third and last point is that a plugin's plugin.yml file will need to have a depend entry to establish the need for MessageManager to be loaded first.
    The plugin.yml file for the SimpleTemplate plugin demonstrates this entry.

    A final note for those interested, Player channels are more technically CommandSender channels as they will manage messages to either a player or a console. In an attempt to make the configuration more intuitive for Server Administrators, it is named PLAYER.


    Plugins Currently Requiring MessageManager:

    Recent Changelog:
    Version 6.1.0 (2012/04/06) [ Download | Source ]
    • CHG: Reset Code (&*) removed
    • CHG: Closure Code (&_) now acts as Base Code
    • CHG: Base Code (&_) now replaces with reset code, base color code, and base format codes
    • CHG: Added static factory method for easier access to plugin instance
    • CHG: Recipients can now be pulled by name for offline players
    • FIX: Closure codes following reset codes would not reset color to base
    Version 6.0.1 (2012/03/26) [ Download | Source ]
    • FIX: FIX: NPE after disable/reload
    Version 6.0.0 (2012/03/26) [ Download | Source ]
    • CHG: Complete overhaul to fully integrate channel based management
    • CHG: Added support for &* reset code which reverts all colors/formatting back to channel default color and formatting
    • CHG: Multiple ChatColor codes can be assigned as base
    • CHG: Treat consoles as standard message recipients instead of as a log file
    • CHG: Remove duplicate color characters
    • CHG: Update for new format codes in 1.2.4
    • CHG: Configuration files updated to be more intuitive
    • CHG: Added send methods for CommandSender target


    Full Changelog: (open)
    Full Changelog:
    Version 6.1.0 (2012/04/06) [ Download | Source ]
    • CHG: Reset Code (&*) removed
    • CHG: Closure Code (&_) now acts as Base Code
    • CHG: Base Code (&_) now replaces with reset code, base color code, and base format codes
    • CHG: Added static factory method for easier access to plugin instance
    • CHG: Recipients can now be pulled by name for offline players
    • FIX: Closure codes following reset codes would not reset color to base
    Version 6.0.1 (2012/03/26) [ Download | Source ]
    • FIX: FIX: NPE after disable/reload
    Version 6.0.0 (2012/03/26) [ Download | Source ]
    • CHG: Complete overhaul to fully integrate channel based management
    • CHG: Added support for &* reset code which reverts all colors/formatting back to channel default color and formatting
    • CHG: Multiple ChatColor codes can be assigned as base
    • CHG: Treat consoles as standard message recipients instead of as a log file
    • CHG: Remove duplicate color characters
    • CHG: Update for new format codes in 1.2.4
    • CHG: Configuration files updated to be more intuitive
    • CHG: Added send methods for CommandSender target
    Version 5.0.0 (2012/03/08) [ Download | Source ]
    • CHG: Color codes now accepted as lowercase or uppercase
    • CHG: Added getColor method to retrieve current color equivalent for a level and channel
    • CHG: Added support for special K color code
    • CHG: Added stripColor method to remove all color codes
    • CHG: Moved to new Bukkit event system
    • CHG: Refactored commands to use newer classes
    • FIX: NPE when another plugin attempts to send message through MessageManager on player join
    Version 4.0.5 (2011/11/20) [ Download | Source ]
    • FIX: Default configuration file not being created
    Version 4.0.4 (2011/11/18) [ Download | Source ]
    • FIX: NPE related to player connection error
    • FIX: World messages sometimes not showing after player moves between worlds.
    Version 4.0.3 (2011/09/29) [ Download | Source ]
    • FIX: World messages not received after using portal
    • FIX: Player not receiving messages after teleporting between worlds
    • FIX: Simplified Timestamp class to leverage SimpleDateFormat
    • FIX: Code clean-up (final keyword)
    • FIX: Javadoc improvements
    Version 4.0.2 (2011/08/28) [ Download | Source ]
    • FIX: Timestamp not updating time
    Version 4.0.1 (2011/08/24) [ Download | Source ]
    • FIX: In-game commands not working for non-server operators
    Version 4.0.0 (2011/08/23) [ Download | Source ]
    • CHG: Message coloring capability with text using embedded color codes (&x)
    • CHG: Added ability to set default timestamp display for messages
    • CHG: In-game commands to manage timestamp
    • CHG: Bukkit permissions used for in-game commands
    • CHG: Explicit color code removed from timestamp in favor of embedded color codes
    • CHG: Include debug references for compiler
    • CHG: Major code clean-up/organization
    Version 3.0.0 (2011/07/25) [ Download | Source ]
    • CHG: Overhaul of public methods to standardize code
    • CHG: Concept of channels used to route messages (Server, World, Player, Log or Custom)
    • CHG: Rights level changed from 600 to 725
    • FIX: Configuration file code organization
    • FIX: Protected/final keyword clean-up
    Version 2.0.0 (2011/06/08) [ Download | Source ]
    • Initial release
     
    DoomLord and Don Redhorse like this.
  2. Offline

    Plague

    please update do latest recommended CB
     
  3. Offline

    EdGruberman

    @Plague - Thank you for catching that. I've actually been using this successfully with 860 and later versions. I've updated the topic.
     
  4. Offline

    EdGruberman

    This latest update rennovates how it manages messages. Everything has been changed to a "channel send" concept that varies what it does based upon the parameters supplied. Send to a server object to send a message to everyone in that server's channel. Send to a world object to send a message to everyone in that world's channel. Send to a player object to send a message to that specific player's channel.

    By default players are automatically placed in the default channels of Server, World, and Player. There is a Log channel that eventually I'll add the ability to let ops/those with permissions join and monitor the server log while in-game. There is also the facility to allow Custom channels where other plugins can hook in and create channels and manage players in.
     
  5. Offline

    DestinysCourage

    Hi, Ed! I love your idea, but can you tell me how to install it? I'm not much of a bukkit-plugin installer, so I'm having some difficulties >_< If you can help me, thanks!
     
  6. Offline

    EdGruberman

    @DestinysCourage - If you are not a plugin developer and you don't need this installed as a result of another plugin (currently only the Sleep plugin publicly requires this), this won't help you at all.

    This is all about a developer being able to simplify/centralize their plugin's external communications with players and the server log. If a plugin isn't specifically coded to do something with it, your server won't do anything different with it installed.

    Now this all said, perhaps you are looking for some way to control your servers default messages? And perhaps add timestamps as a result?

    You could test such features of the MessageFormatter plugin: https://github.com/EdGruberman/MessageFormatter/raw/master/dist/MessageFormatter.jar

    I haven't taken the time to really tailor that for an official public release, but I use it on my server. It timestamps chat and some other default messages (kicks, joins, quits, etc). It also adds some color formatting to /send /tell and /broadcast commands. Eventually I'll have it colorize chat text that people put color coding in for. Also, I plan on adding a feature to MessageFormatter to let people use a command to customize their timestamp for their local timezone sometime soon. I might look to release that plugin offficialy at that point.

    If you want to try MessageFormatter, just copy the MessageFormatter.jar and MessageManager.jar files in to your server's plugins folder and restart your server. Magic should happen. If it doesn't let me know and I can try and help as I can!
     
  7. Offline

    DestinysCourage

    Oh okay XD so, to put it in short : I can't use it. Is that right? XD
     
  8. Offline

    EdGruberman

    Heh, in a vacuum no.

    If you need to install it for the Sleep plugin, just copy MessageManager.jar to your server's plugins folder and restart.

    Otherwise, no. :) <3
     
  9. Offline

    Zathras

    Is there a list of plugins that use MessageManager?
     
  10. Offline

    EdGruberman

    Right now, the only officially released plugin is Sleep. I'll make a section in the first post for this, probably is a good reference for clarity.

    That said, I use this plugin for all my other plugins that haven't been released officially yet, but you can find them at https://github.com/EdGruberman if you want to live dangerously. ;) I can't guarantee they'll do anything other than make your server act like mine though. :)
     
  11. Offline

    EdGruberman

    Updated to 4.0.0.

    Added in-game commands to allow users to manage their own time zones for the timestamp.
    Also added more complete color code parsing. Plugin developers can send messages with &<color hex code> tags to override the default message level color. (&_ will end a color and revert to the previous color in effect on the message.)

    I really need to flush out the documentation on all this more though. For now I'm still assuming I'm pretty much the only one depending on this plugin.
     
  12. Offline

    EdGruberman

    I just released 4.0.3. It is mostly some code clean-up but an important fix is also included for world messages not being received by players sometimes when portals/teleportation is used between worlds.

    You should just be able to copy the latest jar file over your old jar file and you won't have to change any configuration files/etc.

    •FIX: World messages not received after using portal
    •FIX: Player not receiving messages after teleporting between worlds
    •FIX: Simplified Timestamp class to leverage SimpleDateFormat
    •FIX: Code clean-up (final keyword)
    •FIX: Javadoc improvements
     
  13. Offline

    EdGruberman

    Updated to 4.0.4

    Most important fix is:
    •FIX: World messages sometimes not showing after player moves between worlds.

    Updating is as simple as dropping the new jar file over the old one.
     
  14. Offline

    EdGruberman

    Found a problem with it not creating the default configuration file if it's not present already. Updated to 4.0.5.
     
  15. Offline

    EdGruberman

    Version 5.0.0 (2012/03/08) [ Download | Source ]
    • CHG: Color codes now accepted as lowercase or uppercase
    • CHG: Added getColor method to retrieve current color equivalent for a level and channel
    • CHG: Added support for special K color code
    • CHG: Added stripColor method to remove all color codes
    • CHG: Moved to new Bukkit event system
    • CHG: Refactored commands to use newer classes
    • FIX: NPE when another plugin attempts to send message through MessageManager on player join
     
  16. Offline

    EdGruberman

    Version 6.0.0 (2012/03/26) [ Download | Source ]
    • CHG: Complete overhaul to fully integrate channel based management
    • CHG: Added support for &* reset code which reverts all colors/formatting back to channel default color and formatting
    • CHG: Multiple ChatColor codes can be assigned as base
    • CHG: Treat consoles as standard message recipients instead of as a log file
    • CHG: Remove duplicate color characters
    • CHG: Update for new format codes in 1.2.4
    • CHG: Configuration files updated to be more intuitive
    • CHG: Added send methods for CommandSender target
     
  17. Offline

    EdGruberman

    Version 6.1.0 (2012/04/06) [ Download | Source ]
    • CHG: Reset Code (&*) removed
    • CHG: Closure Code (&_) now acts as Base Code
    • CHG: Base Code (&_) now replaces with reset code, base color code, and base format codes
    • CHG: Added static factory method for easier access to plugin instance
    • CHG: Recipients can now be pulled by name for offline players
    • FIX: Closure codes following reset codes would not reset color to base

    Biggest impact here is the &_ code now replacing &*. If you've customized any messages from plugins with either of those codes, you should reassess them at this point.
     
  18. Offline

    EdGruberman

Share This Page