Solved Help, pex api

Discussion in 'Plugin Development' started by Iervolino, Aug 7, 2013.

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

    Iervolino

    This is the code:

    Code:
    @EventHandler
    public void OnJoin(PlayerJoinEvent event){
    for(Player player : Bukkit.getOnlinePlayers()){
    String name = player.getName();
    PermissionUser user  = PermissionsEx.getUser(player);
    String prefix = user.getPrefix();
     
    if(name.length() + 2 > 16){
    name = name.substring(0, name.length() - 2);
    }
     
    player.setPlayerListName(prefix + name);
    }
    }
    And this, is what is happening:

    [​IMG]

    Is there some way to use & instead ChatColor, cause the plugin get directly the pex prefix (config)?
     
  2. ChatColor.translateAlternateColorCodes('&', "textToTranslate");
    should work for this
     
  3. Offline

    Iervolino


    Well, I didn't understood, I don't want to translate a text..

    It's a format no a text
     
  4. But you want to "translate" the &-Codes into ChatColors.
    Code:
    player.setPlayerListName(ChatColor.translateAlternateColorCodes('&', prefix + name));
     
  5. Offline

    Iervolino


    Thanks, worked!
     
Thread Status:
Not open for further replies.

Share This Page