Allow default prefix customization from lang file

This commit is contained in:
Byteflux 2014-10-21 18:08:26 -07:00 committed by t00thpick1
parent 33bd9f7e81
commit 90e57740a2
3 changed files with 8 additions and 4 deletions

View File

@ -1,8 +1,8 @@
package com.massivecraft.factions.scoreboards; package com.massivecraft.factions.scoreboards;
import com.massivecraft.factions.*; import com.massivecraft.factions.*;
import com.massivecraft.factions.zcore.util.TL;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.OfflinePlayer; import org.bukkit.OfflinePlayer;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.scheduler.BukkitRunnable; import org.bukkit.scheduler.BukkitRunnable;
@ -166,7 +166,9 @@ public class FScoreboard {
// Update faction prefix // Update faction prefix
if(P.p.getConfig().getBoolean("scoreboard.default-prefixes", false)) { if(P.p.getConfig().getBoolean("scoreboard.default-prefixes", false)) {
String prefix = faction.getRelationTo(this.fplayer).getColor() + "[" + faction.getTag().substring(0, Math.min(9, faction.getTag().length())) + "] " + ChatColor.RESET; String prefix = TL.DEFAULT_PREFIX.toString();
prefix = prefix.replace("{relationcolor}", faction.getRelationTo(this.fplayer).getColor().toString());
prefix = prefix.replace("{faction}", faction.getTag().substring(0, Math.min("{faction}".length() + 16 - prefix.length(), faction.getTag().length())));
if (team.getPrefix() == null || !team.getPrefix().equals(prefix)) { if (team.getPrefix() == null || !team.getPrefix().equals(prefix)) {
team.setPrefix(prefix); team.setPrefix(prefix);
} }

View File

@ -30,7 +30,8 @@ public enum TL {
WARZONE_DESCRIPTION("warzone-description", "Not the safest place to be."), WARZONE_DESCRIPTION("warzone-description", "Not the safest place to be."),
SAFEZONE("safezone", "&6Safezone"), SAFEZONE("safezone", "&6Safezone"),
SAFEZONE_DESCRIPTION("safezone-description", "Free from pvp and monsters."), SAFEZONE_DESCRIPTION("safezone-description", "Free from pvp and monsters."),
TOGGLE_SB("toggle-sb", "You now have scoreboards set to {value}"); TOGGLE_SB("toggle-sb", "You now have scoreboards set to {value}"),
DEFAULT_PREFIX("default-prefix", "{relationcolor}[{faction}] &r");
private String path; private String path;
private String def; private String def;

View File

@ -10,3 +10,4 @@ warzone-description: "Not the safest place to be."
safezone: "&6Safezone" safezone: "&6Safezone"
safezone-description: "Free from pvp and monsters." safezone-description: "Free from pvp and monsters."
toggle-sb: "You now have scoreboards set to {value}" toggle-sb: "You now have scoreboards set to {value}"
default-prefix: "{relationcolor}[{faction}] &r"