Home›Java›Mods›pMessage
[​IMG]
An API for consistent plugin messages across your server!

pMessage allows you, the server owner, to have all of your installed plugins send players messages with the same formatting. This makes your server look more professional as all plugins have the same format, layout and style.

Discord: https://discord.gg/011Ko7udD8zmZt8JN


[​IMG]

Consistent plugin messages across your server!
Customisable message formats!
Custom error, success and information colours!
Custom 'no permission' and 'must be player' messages!


[​IMG]

/pmessage - This is the main (and only) command for the plugin.
/pmessage reload - Reloads the configuration file.

pmessage.reload - Access to /pmessage reload.

[​IMG]

Using pMessage is simple.

  1. Add pMessage to your project in your IDE just like your Spigot/Craftbukkit jar. For example, in Eclipse, you add it as an External Library in your project's Build Path.​
  2. Create an instance of the Messenger class in your plugin's main class:​

    Code (Text):
    Messenger msg;
    public void onEnable(){
        if(getServer().getPluginManager().isPluginEnabled("pMessage"))
            msg = new Messenger(this);
    }
    ​
  3. Call any of the below methods when you want to send a message. The 'receiver' argument for all the methods takes a CommandSender, so you can pass the console or a player.​
  4. Add pMessages as a dependency in your plugin.yml.​
​

Methods

Code (Text):
msg.needPermission(CommandSender receiver);
This sends the server owner defined 'need permission' message to the player/console. This should be used when .hasPermission or .isOp returns false.

Code (Text):
msg.needPlayer(CommandSender receiver);
This sends the server owner defined 'must be player' message to the player/console (should only ever be console). This should be used when instanceof Player returns false.

Code (Text):
msg.error(CommandSender receiver, String message);
This sends the player/console a message with the server owner defined error colour. This should be used when you want to send an error message.

Code (Text):
msg.success(CommandSender receiver, String message);
This sends the player/console a message with the server owner defined success colour. This should be used when you want to send a success message.

Code (Text):
msg.info(CommandSender receiver, String message);
This sends the player/console a message with the server owner defined informative colour. This should be used when you want to send a message that is not an error or a success message.

Code (Text):
msg.msg(CommandSender receiver, String message, ChatColor colour);
This sends the player/console a message with your specified colour, but in the server owner's message format.

Variables

Code (Text):
msg.ERROR_COLOR;
This gets the colour of all error messages that has been set by the server owner.

Code (Text):
msg.INFO_COLOR;
This gets the colour of all informative messages that has been set by the server owner.

Code (Text):
msg.SUCCESS_COLOR;
This gets the colour of all success messages that has been set by the server owner.


[​IMG]
This section is for server owners. If you are a developer looking to use pMessage in your plugin then please see the API Usage section above.

The configuration file allows you to tweak how plugin messages will look.

For 'success', 'error' and 'info' the values can be any colour code in name form. For a list of accepted colours, go to this link and use values under the 'Technical Name' column.

'format' - This is the overall format of a message. This can be whatever, but is must contain '%plugin%' and '%message%' (without quotation marks). '%plugin%' will be replaced with the name of the plugin sending the message, and '%message%' will be replaced with the message itself. You should always have &r before %message% as this allows the message colours to not glitch.

'success' - This is the chat colour of all messages that plugins define as success messages. The default colour is green.
'error' - This is the chat colour of all messages that plugins define as error messages. The default colour is red.
'info' - This is the chat colour of all messages that plugins define as informative messages. The default colour is gold.

'no-permission' - This is the message sent when a plugin wants to inform the player that they do not have permission. This value will be used in the 'format' set above, replacing '%message%'.

'no-player' - This is the message sent when a plugin wants to inform the console that only players can execute a command. This value will be used in the 'format' set above, replacing '%message%'.


[​IMG]
Just drag and drop the pMessage.jar into your /plugins folder. Then restart or reload your server and you're good to go!


Please note that this plugin will not do much by itself. This is primarily an API, and so it will not need to be used unless other plugins use it.

Also, not all plugins use pMessage, so not all plugin messages will be formatted by pMessage. Only plugins that support it will be formatted.
​

Commands

Plugin details

Read from the plugin's own plugin.yml.

Quick facts

Install steps are the general flow for this file type — How to install Minecraft Java mods & modpacks walks through it step by step.

pMessage is a free Minecraft Java mod. Compatible with Minecraft 1.9. Downloaded 33,080 times (via Spigot). Download it and open it directly in the game.

Explore more