Allow players to set titles with colors. Adds #1036.
factions.title.color permission which is included in factions.fullplayer permission subset.
This commit is contained in:
@@ -9,6 +9,7 @@ import com.massivecraft.factions.util.WarmUpUtil;
|
||||
import mkremins.fanciful.FancyMessage;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.List;
|
||||
@@ -115,7 +116,7 @@ public interface FPlayer extends EconomyParticipator {
|
||||
|
||||
public String getTitle();
|
||||
|
||||
public void setTitle(String title);
|
||||
public void setTitle(CommandSender sender, String title);
|
||||
|
||||
public String getName();
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@ public class CmdTitle extends FCommand {
|
||||
return;
|
||||
}
|
||||
|
||||
you.setTitle(title);
|
||||
you.setTitle(sender, title);
|
||||
|
||||
// Inform
|
||||
myFaction.msg(TL.COMMAND_TITLE_CHANGED, fme.describeTo(myFaction, true), you.describeTo(myFaction, true));
|
||||
|
||||
@@ -75,6 +75,7 @@ public enum Permission {
|
||||
STUCK("stuck"),
|
||||
TAG("tag"),
|
||||
TITLE("title"),
|
||||
TITLE_COLOR("title.color"),
|
||||
TOGGLE_ALLIANCE_CHAT("togglealliancechat"),
|
||||
UNCLAIM("unclaim"),
|
||||
UNCLAIM_ALL("unclaimall"),
|
||||
|
||||
@@ -19,6 +19,7 @@ import com.massivecraft.factions.util.WarmUpUtil;
|
||||
import com.massivecraft.factions.zcore.util.TL;
|
||||
import mkremins.fanciful.FancyMessage;
|
||||
import org.bukkit.*;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.HashSet;
|
||||
@@ -351,7 +352,12 @@ public abstract class MemoryFPlayer implements FPlayer {
|
||||
return this.hasFaction() ? title : TL.NOFACTION_PREFIX.toString();
|
||||
}
|
||||
|
||||
public void setTitle(String title) {
|
||||
public void setTitle(CommandSender sender, String title) {
|
||||
// Check if the setter has it.
|
||||
if (sender.hasPermission(Permission.TITLE_COLOR.node)) {
|
||||
title = ChatColor.translateAlternateColorCodes('&', title);
|
||||
}
|
||||
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user