Add configurable faction enter/leave message

This commit is contained in:
Nick Porillo 2015-05-12 23:25:28 -04:00
parent d7067d3f27
commit 4e17d43c91
5 changed files with 11 additions and 10 deletions

View File

@ -191,7 +191,7 @@ public interface FPlayer extends EconomyParticipator {
public boolean isInEnemyTerritory();
public void sendFactionHereMessage();
public void sendFactionHereMessage(Faction from);
/**
* Check if the scoreboard should be shown. Simple method to be used by above method.

View File

@ -166,7 +166,7 @@ public class FactionsPlayerListener implements Listener {
String ownersTo = myFaction.getOwnerListString(to);
if (changedFaction) {
me.sendFactionHereMessage();
me.sendFactionHereMessage(factionFrom);
if (Conf.ownedAreasEnabled && Conf.ownedMessageOnBorder && myFaction == factionTo && !ownersTo.isEmpty()) {
me.sendMessage(TL.GENERIC_OWNERS.format(ownersTo));
}

View File

@ -559,17 +559,15 @@ public abstract class MemoryFPlayer implements FPlayer {
return Board.getInstance().getFactionAt(new FLocation(this)).getRelationTo(this).isEnemy();
}
public void sendFactionHereMessage() {
public void sendFactionHereMessage(Faction from) {
Faction toShow = Board.getInstance().getFactionAt(getLastStoodAt());
boolean showChat = true;
if (shouldShowScoreboard(toShow)) {
// Shows them the scoreboard instead of sending a message in chat. Will disappear after a few seconds.
FScoreboard.get(this).setTemporarySidebar(new FInfoSidebar(toShow));
} else {
String msg = toShow.getTag(this);
if (toShow.getDescription().length() > 0) {
msg += " - " + toShow.getDescription();
showChat = P.p.getConfig().getBoolean("scoreboard.also-send-chat", true);
}
this.sendMessage(msg);
if (showChat) {
this.sendMessage(P.p.txt.parse(TL.FACTION_LEAVE.format(from.getTag(this), toShow.getTag(this))));
}
}

View File

@ -694,6 +694,7 @@ public enum TL {
SAFEZONE("safezone", "&6Safezone"),
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"),
DEFAULT_PREFIX("default-prefix", "{relationcolor}[{faction}] &r"),
FACTION_LOGIN("faction-login", "&e%1$s &9logged in."),
FACTION_LOGOUT("faction-logout", "&e%1$s &9logged out.."),

View File

@ -96,6 +96,8 @@ tooltips:
# Use &0-9a-f for colors and include messages in "quotes"
scoreboard:
# send faction change message as well when scoreboard is up?
also-send-chat: true
# How long do we want scoreboards to stay if set temporarily.
expiration: 7