Text events

Discussion in 'Plugin Development' started by Jazed, Aug 14, 2012.

Thread Status:
Not open for further replies.
  1. Offline

    Jazed

    Hi,

    So what I am trying to do is change the text color for a player with a specific permission:

    Code:
    if (e.getPlayer().isOp()) {
                            e.setFormat("%s:" + ChatColor.GREEN + " %s");
                        } else if (e.getPlayer().hasPermission("websend.ingame")) {
                            e.setFormat("%s:" + ChatColor.LIGHT_PURPLE + " %s");
                        } else if (e.getPlayer().hasPermission("websend.team")) {
                            e.setFormat("%s:" + ChatColor.GREEN + " %s");
                        } else {
                            e.setFormat("%s: %s");
                        }
    
    They work but don't show colors and also a player with ALL permissions (*, shown as isOp()) their brackets don't get changed into a colon...

    Anyone? :)

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 27, 2016
  2. Offline

    coldguy101

    Why dont you just look at chat event and for every chat event for a player with a specific permission, add ChatColor.COLOR before the message sent to the server chat?
     
  3. Offline

    Jazed

    That is what i am doing... I format the text and send it. The problem is it doesn't change the color of the messages and players that have all permissions don't get those brackets changed into a colon e.g. <Jazed> to Jazed:, the others do though.

    In the 1.2.5 buikld it worked but in 1.3.1 it doesn't. Does anyone know a fix or how to do it?

    Bump.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 27, 2016
Thread Status:
Not open for further replies.

Share This Page