Bukkit-API  1.7.9-R0.2
The inofficial Bukkit-API
PluginNameConversationPrefix.java
1 package org.bukkit.conversations;
2 
3 import org.bukkit.ChatColor;
5 import org.bukkit.plugin.Plugin;
6 
7 /**
8  * PluginNameConversationPrefix is a {@link ConversationPrefix} implementation
9  * that displays the plugin name in front of conversation output.
10  */
12 
13  protected String separator;
14  protected ChatColor prefixColor;
15  protected Plugin plugin;
16 
17  private String cachedPrefix;
18 
19  public PluginNameConversationPrefix(Plugin plugin) {
20  this(plugin, " > ", ChatColor.LIGHT_PURPLE);
21  }
22 
23  public PluginNameConversationPrefix(Plugin plugin, String separator, ChatColor prefixColor) {
24  this.separator = separator;
25  this.prefixColor = prefixColor;
26  this.plugin = plugin;
27 
28  cachedPrefix = prefixColor + plugin.getDescription().getName() + separator + ChatColor.WHITE;
29  }
30 
31  /**
32  * Prepends each conversation message with the plugin name.
33  *
34  * @param context Context information about the conversation.
35  * @return An empty string.
36  */
37  public String getPrefix(ConversationContext context) {
38  return cachedPrefix;
39  }
40 }
PluginDescriptionFile getDescription()