Unique ChatColors?

Discussion in 'Plugin Development' started by Areoace, Jan 9, 2016.

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


    How would I go about setting prefixes for certain players to each individual on the server like faction's enemy/ally system? Thanks.
  2. Offline


    @Areoace Not sure what this system does, but if you mean prefixes on their names above their heads, you need to use Scoreboard Teams. Speaking of chat names, you need to setDisplayName of the player.
  3. Offline


    @mine-care I mean like this,

    If a faction 'A' is enemied to faction 'B' they will show up as red for the players in factions 'B'

    However if the faction is allied to faction 'C' it will show up us green for faction 'A'
  4. Offline


    @Areoace Instead of using scoreboard teams, you would have to use Packets and send them to players, depending if they're allied or not.
  5. Offline


    @FabeGabeMC doubtful, I think I have another way, will get back to you.

    @mine-care this is what I was going for, @FabeGabeMC this is how I was gonna do it.

    My issue is I only have 2 people online and if I'm in a clan itll show up blue, and if theyre not in a clan it will show up fine, however when they make a clan it will show up blue for me too.

        public String getRelation(Player getrelation, Player player)
            if(isEnemy(plugin.getplayermanager().getClan(getrelation.getUniqueId().toString()), plugin.getplayermanager().getClan(player.getUniqueId().toString())))
                return ChatColor.DARK_RED + plugin.getplayermanager().getClan(player.getUniqueId().toString()) + " " + ChatColor.RED + player.getName() + "" + ChatColor.DARK_RED + " > ";
            if(isAlly(plugin.getplayermanager().getClan(getrelation.getUniqueId().toString()), plugin.getplayermanager().getClan(player.getUniqueId().toString())))
                return ChatColor.DARK_GREEN + plugin.getplayermanager().getClan(player.getUniqueId().toString()) + " " + ChatColor.GREEN + player.getName() + "" + ChatColor.DARK_GREEN + " > ";
            if(isTrusted(plugin.getplayermanager().getClan(getrelation.getUniqueId().toString()), plugin.getplayermanager().getClan(player.getUniqueId().toString())))
                return ChatColor.AQUA + "*" + ChatColor.DARK_GREEN + plugin.getplayermanager().getClan(player.getUniqueId().toString()) + " " + ChatColor.GREEN +  player.getName() + "" + ChatColor.DARK_GREEN + " > ";
                return ChatColor.YELLOW + player.getName() + "" + ChatColor.GOLD + " > ";
            return ChatColor.DARK_AQUA + plugin.getplayermanager().getClan(player.getUniqueId().toString()) + " " + ChatColor.AQUA + player.getName() + "" + ChatColor.DARK_AQUA + " > ";
    EDIT by Moderator: merged posts, please use the edit button instead of double posting.

    EDIT: Here's my class that I use to send the message

        public void chatFormat(AsyncPlayerChatEvent event) {
            Player player = event.getPlayer();
            for(Player online: plugin.getServer().getOnlinePlayers())
                Player playersonline = (Player) online;
                playersonline.sendMessage(plugin.getclanmanager().getRelation(playersonline, player) + ChatColor.RESET +  event.getMessage() + "");
    Last edited: Jan 9, 2016
  6. Offline


    Still need a resolution :s
  7. Offline


    @Areoace You said factions so I'm guessing youre hooking into it. I dont know the method but I'm 100% sure there is something that allows you to check who your ally is, then I would loop through online players and set their display name to blue or what ever. or use TagAPI.
  8. Offline


    @Irantwomiles I'm making my own, I wanna know how they send ChatColor.RED, green, blue ect to each player depending on the relation, so in short getting the relation of whoever says something in chat and sending a message to all online players with the chatcolor of their name being set to their relation
  9. Offline


    Each player needs there own individual scoreboard, and all the teams needed to be loaded into that scoreboard.

    Its kind of ridiculous, but you can blame mojang for that.

    ^ thats for tags above head

    For ChatColors in the chatbox,
    Cancel the event, and send the message manually to each player and set the chat color depending on there faction / clans relationship
  10. Offline


    Got that, I've just gotta figure out how to get the relation.
Thread Status:
Not open for further replies.

Share This Page