Send titles when entering faction territory.

Allows users to pick which, if any, or all, ways of sending faction enter messages from: scoreboard, chat, and titles.
Adds new config.yml options and lang messages.
This commit is contained in:
Trent Hensler 2018-03-16 10:08:19 -07:00
parent 8950be61d1
commit 1e2a6b34b4
3 changed files with 31 additions and 0 deletions

View File

@ -594,7 +594,24 @@ public abstract class MemoryFPlayer implements FPlayer {
public void sendFactionHereMessage(Faction from) {
Faction toShow = Board.getInstance().getFactionAt(getLastStoodAt());
boolean showTitle = P.p.getConfig().getBoolean("enter-titles.enabled", true);
boolean showChat = true;
Player player = getPlayer();
if (showTitle && player != null) {
int in = P.p.getConfig().getInt("enter-titles.fade-in", 10);
int stay = P.p.getConfig().getInt("enter-titles.stay", 70);
int out = P.p.getConfig().getInt("enter-titles.fade-out", 20);
String title = TL.FACTION_ENTER_TITLE.format(this);
String sub = TL.FACTION_ENTER_SUBTITLE.format(toShow.getTag(this));
// We send null instead of empty because Spigot won't touch the title if it's null, but clears if empty.
// We're just trying to be as unintrusive as possible.
player.sendTitle(title.isEmpty() ? null : title, sub.isEmpty() ? null : sub, in, stay, out);
showChat = P.p.getConfig().getBoolean("enter-titles.also-show-chat", false);
}
if (showInfoBoard(toShow)) {
FScoreboard.get(this).setTemporarySidebar(new FInfoSidebar(toShow));
showChat = P.p.getConfig().getBoolean("scoreboard.also-send-chat", true);

View File

@ -772,6 +772,8 @@ public enum TL {
SAFEZONE_DESCRIPTION("safezone-description", "Free from pvp and monsters."),
TOGGLE_SB("toggle-sb", "You now have scoreboards set to {value}"),
FACTION_LEAVE("faction-leave", "<a>Leaving %1$s, <a>Entering %2$s"),
FACTION_ENTER_TITLE("faction-enter-title", ""),
FACTION_ENTER_SUBTITLE("faction-enter-subtitle", "%s"),
FACTIONS_ANNOUNCEMENT_TOP("faction-announcement-top", "&d--Unread Faction Announcements--"),
FACTIONS_ANNOUNCEMENT_BOTTOM("faction-announcement-bottom", "&d--Unread Faction Announcements--"),
DEFAULT_PREFIX("default-prefix", "{relationcolor}[{faction}] &r"),

View File

@ -72,6 +72,18 @@ fly-falldamage-cooldown: 3
# http://i.gyazo.com/6a1a31222e58a5d60ff341c13f6a8404.gif
disable-pistons-in-territory: false
# Should we send titles when players enter Factions?
# This is the same as finfo.titles and can be shown in conjunction with scoreboard and chat if necessary.
# If you only want to show titles when entering territory,
# leave this true and set scoreboard.finfo.titles and scoreboard.alsosendchat to false.
enter-titles:
enabled: true
fade-in: 10
stay: 70
fade-out: 20
also-show-chat: false
# ToolTips
# This section is to configure tooltips for things like /f list
tooltips: