Factions color problems

Discussion in 'Plugin Development' started by javoris767, Aug 29, 2013.

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

    javoris767

    Whenever someone talks the colors aren't correct. This meaning that if they are enemy it should display their faction tag as red. Every thing just displays as green. If anyone knows how this works that will be work :0

    Code:
       
        public String FactionName(Player p)
        {
            if(UConf.isDisabled(p)) return "";
     
            UPlayer up = UPlayer.get(p);
           
            Faction faction = up.getFaction();
            if(faction.isNone()) return "";
           
            return faction.getName();
        }
       
        public String FactionNameForce(Player p)
        {
            UPlayer up = UPlayer.get(p);
           
            Faction faction = up.getFaction();
            return faction.getName();
        }
       
        public String Relcolor(Player p, Player rp)
        {
            if(rp == null) return "";
           
            if(UConf.isDisabled(p)) return "";
           
            UPlayer up = UPlayer.get(p);
            UPlayer urp = UPlayer.get(rp);
           
            return urp.getRelationTo(up).getColor().toString();
        }
       
        public String FactionRole(Player p)
        {
            if(UConf.isDisabled(p)) return "";
           
            UPlayer up = UPlayer.get(p);
           
            return Txt.upperCaseFirst(up.getRole().toString().toLowerCase());
        }
       
        public String RolePrefix(Player p)
        {
            if(UConf.isDisabled(p)) return "";
           
            UPlayer up = UPlayer.get(p);
           
            Faction faction = up.getFaction();
            if(faction.isNone()) return "";
           
            return up.getRole().getPrefix();
        }
       
        public String RolePrefixForce(Player p)
        {
            if(UConf.isDisabled(p)) return "";
           
            UPlayer up = UPlayer.get(p);
           
            return up.getRole().getPrefix();
        }
       
        public String FactionTitle(Player p)
        {
            if(UConf.isDisabled(p)) return "";
           
            UPlayer up = UPlayer.get(p);
           
            if(!up.hasTitle()) return "";
            return up.getTitle();
        }
     
  2. Offline

    AsianWiz

    Bump, it'd be great if someone found a solution :3
     
  3. Offline

    CeramicTitan

    can you show your chat event? or wherever you output the strings that are incorrect.
     
  4. Offline

    javoris767

    CeramicTitan

    Code:
        @EventHandler
        public void onPlayerChat(AsyncPlayerChatEvent event) {
            if (event.isCancelled()) return;
            Player player = event.getPlayer();
            String message = event.getMessage();
            if (message == null) return;
            if (Bukkit.getPluginManager().getPlugin("Factions") == null) {
                event.setFormat(plugin.API.parseChat(player, message, plugin.chatFormat));
            }else{
                UPlayer up = UPlayer.get(player);
                event.setFormat(plugin.fac.factionChat(player, message, plugin.chatFormat, up));
     
            }
        }
     
  5. Offline

    CeramicTitan

    do you wanna upload your code to github or something so i can have a good look through it?
     
  6. Offline

    javoris767

  7. Offline

    CeramicTitan

    In your config, change the iName key.
    Code:
    iname-format: '{+factions_relcolor+factions_name&r}{+w}[+prefix+group+suffix&f] +name'
     
  8. Offline

    javoris767

    I know that, but when it's used the colors aren't correct. Neutral factions and all other relations show the color green. Here is the config.

    Code:
      "colorMember": "GREEN",
      "colorAlly": "DARK_PURPLE",
      "colorTruce": "LIGHT_PURPLE",
      "colorNeutral": "WHITE",
      "colorEnemy": "RED",
      "colorNoPVP": "GOLD",
      "colorFriendlyFire": "DARK_RED",
    
     
  9. Offline

    CeramicTitan

    Due to lack of accounts, i couldn't really test that. Do you have a test server?
     
  10. Offline

    javoris767

    Yea I do :p I'll pm you the IP
     
  11. Offline

    CeramicTitan

    alright
     
  12. Offline

    javoris767

  13. Offline

    javoris767

    bump o-o
     
Thread Status:
Not open for further replies.

Share This Page