Add configurable faction enter/leave message
This commit is contained in:
parent
d7067d3f27
commit
4e17d43c91
@ -191,7 +191,7 @@ public interface FPlayer extends EconomyParticipator {
|
|||||||
|
|
||||||
public boolean isInEnemyTerritory();
|
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.
|
* Check if the scoreboard should be shown. Simple method to be used by above method.
|
||||||
|
@ -166,7 +166,7 @@ public class FactionsPlayerListener implements Listener {
|
|||||||
String ownersTo = myFaction.getOwnerListString(to);
|
String ownersTo = myFaction.getOwnerListString(to);
|
||||||
|
|
||||||
if (changedFaction) {
|
if (changedFaction) {
|
||||||
me.sendFactionHereMessage();
|
me.sendFactionHereMessage(factionFrom);
|
||||||
if (Conf.ownedAreasEnabled && Conf.ownedMessageOnBorder && myFaction == factionTo && !ownersTo.isEmpty()) {
|
if (Conf.ownedAreasEnabled && Conf.ownedMessageOnBorder && myFaction == factionTo && !ownersTo.isEmpty()) {
|
||||||
me.sendMessage(TL.GENERIC_OWNERS.format(ownersTo));
|
me.sendMessage(TL.GENERIC_OWNERS.format(ownersTo));
|
||||||
}
|
}
|
||||||
|
@ -559,17 +559,15 @@ public abstract class MemoryFPlayer implements FPlayer {
|
|||||||
return Board.getInstance().getFactionAt(new FLocation(this)).getRelationTo(this).isEnemy();
|
return Board.getInstance().getFactionAt(new FLocation(this)).getRelationTo(this).isEnemy();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void sendFactionHereMessage() {
|
public void sendFactionHereMessage(Faction from) {
|
||||||
Faction toShow = Board.getInstance().getFactionAt(getLastStoodAt());
|
Faction toShow = Board.getInstance().getFactionAt(getLastStoodAt());
|
||||||
|
boolean showChat = true;
|
||||||
if (shouldShowScoreboard(toShow)) {
|
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));
|
FScoreboard.get(this).setTemporarySidebar(new FInfoSidebar(toShow));
|
||||||
} else {
|
showChat = P.p.getConfig().getBoolean("scoreboard.also-send-chat", true);
|
||||||
String msg = toShow.getTag(this);
|
}
|
||||||
if (toShow.getDescription().length() > 0) {
|
if (showChat) {
|
||||||
msg += " - " + toShow.getDescription();
|
this.sendMessage(P.p.txt.parse(TL.FACTION_LEAVE.format(from.getTag(this), toShow.getTag(this))));
|
||||||
}
|
|
||||||
this.sendMessage(msg);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -694,6 +694,7 @@ public enum TL {
|
|||||||
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}"),
|
||||||
|
FACTION_LEAVE("faction-leave", "<a>Leaving %1$s, <a>Entering %2$s"),
|
||||||
DEFAULT_PREFIX("default-prefix", "{relationcolor}[{faction}] &r"),
|
DEFAULT_PREFIX("default-prefix", "{relationcolor}[{faction}] &r"),
|
||||||
FACTION_LOGIN("faction-login", "&e%1$s &9logged in."),
|
FACTION_LOGIN("faction-login", "&e%1$s &9logged in."),
|
||||||
FACTION_LOGOUT("faction-logout", "&e%1$s &9logged out.."),
|
FACTION_LOGOUT("faction-logout", "&e%1$s &9logged out.."),
|
||||||
|
@ -96,6 +96,8 @@ tooltips:
|
|||||||
# Use &0-9a-f for colors and include messages in "quotes"
|
# Use &0-9a-f for colors and include messages in "quotes"
|
||||||
scoreboard:
|
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.
|
# How long do we want scoreboards to stay if set temporarily.
|
||||||
expiration: 7
|
expiration: 7
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user