mirror of
https://github.com/MassiveCraft/Factions.git
synced 2024-11-23 18:55:25 +01:00
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 void sendFactionHereMessage();
|
||||
public void sendFactionHereMessage(Faction from);
|
||||
|
||||
/**
|
||||
* 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);
|
||||
|
||||
if (changedFaction) {
|
||||
me.sendFactionHereMessage();
|
||||
me.sendFactionHereMessage(factionFrom);
|
||||
if (Conf.ownedAreasEnabled && Conf.ownedMessageOnBorder && myFaction == factionTo && !ownersTo.isEmpty()) {
|
||||
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();
|
||||
}
|
||||
|
||||
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();
|
||||
}
|
||||
this.sendMessage(msg);
|
||||
showChat = P.p.getConfig().getBoolean("scoreboard.also-send-chat", true);
|
||||
}
|
||||
if (showChat) {
|
||||
this.sendMessage(P.p.txt.parse(TL.FACTION_LEAVE.format(from.getTag(this), toShow.getTag(this))));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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.."),
|
||||
|
@ -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
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user