PlaceholderAPI java code examples

private void updatePrefix(FScoreboard fboard) {

if (SavageFactions.plugin.getConfig().getBoolean( "scoreboard.default-prefixes" , false )) {

FPlayer fplayer = fboard.getFPlayer();

Team team = teams.get(fboard);

boolean focused = false ;

if ((SavageFactions.plugin.getConfig().getBoolean( "ffocus.Enabled" )) && (fplayer.getFaction() != null) && (fplayer.getFaction().getFocused() != null)) {

for (FPlayer fp : this .faction.getFPlayersWhereOnline( true )) {

if (fplayer.getFaction().getFocused().equalsIgnoreCase(fp.getName())) {

team.setPrefix(ChatColor.translateAlternateColorCodes( '&' , SavageFactions.plugin.getConfig().getString( "ffocus.Prefix" , "&7&b" )));

focused = true ;

}

}

}

if (!focused) {

String prefix = TL.DEFAULT_PREFIX.toString();

prefix = PlaceholderAPI. setPlaceholders (fplayer.getPlayer(), prefix);

prefix = PlaceholderAPI. setBracketPlaceholders (fplayer.getPlayer(), prefix);

prefix = prefix.replace( "{relationcolor}" , this .faction.getRelationTo(fplayer).getColor().toString());

prefix = prefix.replace( "{faction}" ,

this .faction.getTag().substring( 0 , Math.min( "{faction}" .length() + 16 - prefix.length(), this .faction.getTag().length())));

if ((team.getPrefix() == null) || (!team.getPrefix().equals(prefix))) {

team.setPrefix(prefix);

}

}

}

}

Comentarios

Entradas populares de este blog

Unnofficial Python wrapper for the unite-db.com REST API.

bybit-api