org.mudcraft.bukkit.socials.message
Class Message

java.lang.Object
  extended by org.mudcraft.bukkit.socials.message.Message

public class Message
extends java.lang.Object

The Message class is used used to create and broadcast output in accordance with a format that also varies depending upon which player witnesses it.

The format specifier is a character string. The format specifier is composed of zero of more directives: ordinary characters (not {), which are copied, unchanged, to the output; and conversion specifications, each of which results in fetching zero or more arguments.

Each conversion specification is introduced by the { character, and ends with the } character. In between, there may be one or two macros, the second of which, if present, is delimited by a : character. The first macro is expanded only when the message is witnessed by the actor, the Player performing the message; the second macro is expanded when another Player witnesses the message.

Macros may contain either one component, or two components separated by a . character. A single component is interpreted as a literal; it is trimmed of leading and trailing whitespace but no other evaluation is performed. Alternatively, if two components are found, the first identifies the context element to be evaluated and the second identifies which property of the context element to select.

The following properties are supported:

Author:
Geoffrey Davis

Nested Class Summary
 class Message.Context
          Contains contextual information used to render a message.
static interface Message.Filter
          Defines the contract for specialized predicate classes that indicate whether a Player is eligible to receive a message.
 
Constructor Summary
Message(Socials plugin)
          Constructs a new Message instance.
 
Method Summary
 org.bukkit.ChatColor getChatColor()
          Gets the message's chat color.
 Message.Context getContext()
          Gets the message context.
 java.util.List<Message.Filter> getFilters()
          Gets the configured filters.
 java.lang.String getFormatSpecifier()
          Gets the message's format specifier.
 Socials getPlugin()
          Gets the Socials plug-in.
 void send(org.bukkit.entity.Player me)
          Sends the message.
 Message setChatColor(org.bukkit.ChatColor chatColor)
          Sets the message's chat color.
 Message setFormatSpecifier(java.lang.String formatSpecifier)
          Sets the message's format specifier.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Message

public Message(Socials plugin)
Constructs a new Message instance.

Parameters:
plugin - the Socials object
Method Detail

getChatColor

public org.bukkit.ChatColor getChatColor()
Gets the message's chat color.

Returns:
the ChatColor of the message
See Also:
setChatColor(ChatColor)

getFilters

public java.util.List<Message.Filter> getFilters()
Gets the configured filters.

Returns:
a mutable List of Message.Filters

getFormatSpecifier

public java.lang.String getFormatSpecifier()
Gets the message's format specifier.

Returns:
the message's format specifier
See Also:
setFormatSpecifier(String)

getContext

public Message.Context getContext()
Gets the message context.

Returns:
the Message.Context object

getPlugin

public Socials getPlugin()
Gets the Socials plug-in.

Returns:
the Socials object

send

public void send(org.bukkit.entity.Player me)
Sends the message.

Parameters:
me - the Player doing the message

setChatColor

public Message setChatColor(org.bukkit.ChatColor chatColor)
Sets the message's chat color.

Parameters:
chatColor - the ChatColor of the message
Returns:
a reference to this object
See Also:
getChatColor()

setFormatSpecifier

public Message setFormatSpecifier(java.lang.String formatSpecifier)
Sets the message's format specifier.

Parameters:
formatSpecifier - the message's format specifier
Returns:
a reference to this object
See Also:
getFormatSpecifier()