I need help with Chat Format on bukkit

Discussion in 'Plugin Development' started by BlackLucky221, Oct 13, 2020.

  1. Offline

    BlackLucky221

    0 error and the plugin run but it don't work, what is the problem?
    Code:
    @EventHandlerpublic void chatFormat(AsyncPlayerChatEvent event){Player p = event.getPlayer();if(p.hasPermission("chat.format.member"){event.setFormat(ChatColor.DARK_GRAY + "[" + ChatColor.DARK_GREEN + "MEMBER" + ChatColor.DARK_GRAY + "] " + ChatColor.DARK_GREEN + p.getDisplayName() + ChatColor.DARK_GRAY + ": " + ChatColor.WHITE + event.getMessage();//This will give the player with that permission node that Chat format.}else if(p.hasPermission("chat.format.moderator"){event.setFormat(ChatColor.DARK_GRAY + "[" + ChatColor.RED + "MODERATOR" + ChatColor.DARK_GRAY + "] " + ChatColor.RED + p.getDisplayName() + ChatColor.DARK_GRAY + ": " + ChatColor.WHITE + event.getMessage();//This will give the player with that permission node that Chat format.}else if(p.hasPermission("chat.format.admin"){event.setFormat(ChatColor.DARK_GRAY + "[" + ChatColor.DARK_RED + "ADMIN" + ChatColor.DARK_GRAY + "] " + ChatColor.DARK_RED + p.getDisplayName() + ChatColor.DARK_GRAY + ": " + ChatColor.WHITE + event.getMessage();//This will give the player with that permission node that Chat format.}else{event.setFormat(ChatColor.DARK_GRAY + "[" + ChatColor.GRAY + "UNKNOWN" + ChatColor.DARK_GRAY + "] " + ChatColor.GRAY + p.getDisplayName() + ChatColor.DARK_GRAY + ": " + ChatColor.WHITE + event.getMessage();//If the player has non of the above permission nodes they will have this Chat format.}
     
    Last edited by a moderator: Oct 13, 2020
  2. Offline

    timtower Moderator Moderator

    @BlackLucky221 Did you register the event?
    And don't put things in lists, use code blocks: [code]<code here>[/code]
     

Share This Page