I have made a plugin which requires a prefix to the player in chat. How would i go about coding this so that i can have a custom name infront of the players name (like essentials)
Example: Code:java player.setDisplayName(ChatColor.RED + "[Some-Prefix] " + ChatColor.BLUE + player.getName());
chasechocolate I tried this but it doesnt work when i type in chat i get <NoLiver92> message i put your code on player join but i cant get it to work
NoLiver92 are there any other plugins on the server that could interfere with yours? If not, try adding a line of debug to print out player.getDisplayName().
lenis0012 sorry i wasnt clear, i need to integrate it with something like pex and essentials but i dont know how to do this
Have a look at http://dev.bukkit.org/server-mods/vault/ under the "Linking Vault section" Basically you only want to deal with chat; so you only need the setupChat() method called from onEnable() which assigns a reference to a "chat" e.g Code: import org.bukkit.whatever import what.ever.packages.from.vault public class MyPlugin extends JavaPlugin{ private Chat chat public void onEnable(){ ... setupChat(); ... //later on do whatever with chat methods } } Once you have the chat variable initialized, you can do all kinds of stuff like chat.getPlayerPrefix("Timatooth", "world") etc. JavaDocs for Vault's chat API here: http://mythcraft.dyndns.org/javadoc/vault/
If you're using specifically Essentials and nothing else, I'd use Essentials to set someone's nickname. There's also the lazy method of executing a command from console to set someone's pEX prefix, but I'd advise against that (and using pEX in general). Using Essentials: Code: String prefix = "[SomePrefix]"; String playerName = player.getName(); Plugin essentialsPlugin = Bukkit.getServer().getPluginManager().getPlugin("Essentials"); if (essentialsPlugin != null) { if (essentialsPlugin instanceof Essentials) { Essentials essentials = (Essentials) essentialsPlugin; essentials.getUserMap().getUser(playerName).setNickname(prefix + " " + essentials.getUserMap().getUser(playerName).getNickname()); } } (or at least that's how I used to do it, no guarantees.) Other than that, using Vault works too, especially if you plan for it to be run on servers that don't use Essentials for chat.