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:
Trent Hensler 2018-02-15 18:02:59 -08:00
parent ab7f474323
commit 3f1edf1096
5 changed files with 16 additions and 5 deletions

View File

@ -9,6 +9,7 @@ import com.massivecraft.factions.util.WarmUpUtil;
import mkremins.fanciful.FancyMessage; import mkremins.fanciful.FancyMessage;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import java.util.List; import java.util.List;
@ -115,7 +116,7 @@ public interface FPlayer extends EconomyParticipator {
public String getTitle(); public String getTitle();
public void setTitle(String title); public void setTitle(CommandSender sender, String title);
public String getName(); public String getName();

View File

@ -42,7 +42,7 @@ public class CmdTitle extends FCommand {
return; return;
} }
you.setTitle(title); you.setTitle(sender, title);
// Inform // Inform
myFaction.msg(TL.COMMAND_TITLE_CHANGED, fme.describeTo(myFaction, true), you.describeTo(myFaction, true)); myFaction.msg(TL.COMMAND_TITLE_CHANGED, fme.describeTo(myFaction, true), you.describeTo(myFaction, true));

View File

@ -75,6 +75,7 @@ public enum Permission {
STUCK("stuck"), STUCK("stuck"),
TAG("tag"), TAG("tag"),
TITLE("title"), TITLE("title"),
TITLE_COLOR("title.color"),
TOGGLE_ALLIANCE_CHAT("togglealliancechat"), TOGGLE_ALLIANCE_CHAT("togglealliancechat"),
UNCLAIM("unclaim"), UNCLAIM("unclaim"),
UNCLAIM_ALL("unclaimall"), UNCLAIM_ALL("unclaimall"),

View File

@ -19,6 +19,7 @@ import com.massivecraft.factions.util.WarmUpUtil;
import com.massivecraft.factions.zcore.util.TL; import com.massivecraft.factions.zcore.util.TL;
import mkremins.fanciful.FancyMessage; import mkremins.fanciful.FancyMessage;
import org.bukkit.*; import org.bukkit.*;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import java.util.HashSet; import java.util.HashSet;
@ -351,7 +352,12 @@ public abstract class MemoryFPlayer implements FPlayer {
return this.hasFaction() ? title : TL.NOFACTION_PREFIX.toString(); 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; this.title = title;
} }

View File

@ -51,10 +51,11 @@ permissions:
factions.show.bypassexempt: true factions.show.bypassexempt: true
factions.kit.fullplayer: factions.kit.fullplayer:
default: true default: true
description: Can also create new factions. description: Can also create new factions and use title colors.
children: children:
factions.kit.halfplayer: true factions.kit.halfplayer: true
factions.create: true factions.create: true
factions.title.color: true
factions.kit.halfplayer: factions.kit.halfplayer:
description: Can do all but create factions. description: Can do all but create factions.
children: children:
@ -239,6 +240,8 @@ permissions:
description: change the faction tag description: change the faction tag
factions.title: factions.title:
description: set or remove a players title description: set or remove a players title
factions.title.color:
description: set yours or other player's titles to be colored.
factions.version: factions.version:
description: see the version of the plugin description: see the version of the plugin
factions.unclaim: factions.unclaim:
@ -276,4 +279,4 @@ permissions:
factions.setmaxvault: factions.setmaxvault:
description: Set a faction's max vaults. description: Set a faction's max vaults.
factions.mapheight: factions.mapheight:
description: Set your /f map height. description: Set your /f map height.