F Notification, allows to not see claim notifications in chat
This commit is contained in:
parent
02eddb9c26
commit
fab2a3bba0
5
pom.xml
5
pom.xml
@ -4,7 +4,7 @@
|
||||
|
||||
<groupId>com.massivecraft</groupId>
|
||||
<artifactId>Factions</artifactId>
|
||||
<version>1.6.9.5-U0.2.1-1.4.1-BETA</version>
|
||||
<version>1.6.9.5-U0.2.1-1.4.2-BETA</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>SaberFactions</name>
|
||||
@ -86,7 +86,8 @@
|
||||
<artifactId>spigot-api</artifactId>
|
||||
<version>1.13-R0.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
<exclusions> <exclusion>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<artifactId>bungeecord-chat</artifactId>
|
||||
<groupId>net.md-5</groupId>
|
||||
</exclusion>
|
||||
|
@ -26,8 +26,9 @@ import java.util.List;
|
||||
|
||||
public interface FPlayer extends EconomyParticipator {
|
||||
|
||||
void setNotificationsEnabled(boolean notifications);
|
||||
|
||||
|
||||
boolean hasNotificationsEnabled();
|
||||
|
||||
void setAlt(boolean alt);
|
||||
|
||||
|
@ -0,0 +1,37 @@
|
||||
package com.massivecraft.factions.cmd;
|
||||
|
||||
import com.massivecraft.factions.zcore.util.TL;
|
||||
|
||||
public class CmdNotifications extends FCommand {
|
||||
|
||||
public CmdNotifications() {
|
||||
this.aliases.add("notifications");
|
||||
this.aliases.add("messages");
|
||||
this.optionalArgs.put("on/off", "flip");
|
||||
this.senderMustBeMember = true;
|
||||
this.senderMustBeModerator = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void perform() {
|
||||
if (args.size() == 0) {
|
||||
toggleNotifications(!fme.hasNotificationsEnabled());
|
||||
} else if (args.size() == 1) {
|
||||
toggleNotifications(argAsBool(0));
|
||||
}
|
||||
}
|
||||
|
||||
private void toggleNotifications(boolean toggle) {
|
||||
fme.setNotificationsEnabled(toggle);
|
||||
if (toggle) {
|
||||
fme.msg(TL.COMMAND_NOTIFICATIONS_TOGGLED_ON);
|
||||
} else {
|
||||
fme.msg(TL.COMMAND_NOTIFICATIONS_TOGGLED_OFF);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public TL getUsageTranslation() {
|
||||
return TL.COMMAND_NOTIFICATIONS_DESCRIPTION;
|
||||
}
|
||||
}
|
@ -126,6 +126,7 @@ public class FCmdRoot extends FCommand {
|
||||
public CmdViewChest cmdViewChest = new CmdViewChest();
|
||||
public CmdPoints cmdPoints = new CmdPoints();
|
||||
public CmdLogout cmdLogout = new CmdLogout();
|
||||
public CmdNotifications cmdNotifications = new CmdNotifications();
|
||||
|
||||
|
||||
|
||||
@ -175,6 +176,7 @@ public class FCmdRoot extends FCommand {
|
||||
this.addSubCommand(this.cmdMap);
|
||||
this.addSubCommand(this.cmdMod);
|
||||
this.addSubCommand(this.cmdMoney);
|
||||
this.addSubCommand(this.cmdNotifications);
|
||||
this.addSubCommand(this.cmdOpen);
|
||||
this.addSubCommand(this.cmdOwner);
|
||||
this.addSubCommand(this.cmdOwnerList);
|
||||
|
@ -593,12 +593,12 @@ public class FactionsPlayerListener implements Listener {
|
||||
String ownersTo = myFaction.getOwnerListString(to);
|
||||
if (changedFaction) {
|
||||
me.sendFactionHereMessage(factionFrom);
|
||||
if (Conf.ownedAreasEnabled && Conf.ownedMessageOnBorder && myFaction == factionTo && !ownersTo.isEmpty()) {
|
||||
if (Conf.ownedAreasEnabled && Conf.ownedMessageOnBorder && myFaction == factionTo && !ownersTo.isEmpty() && me.hasNotificationsEnabled()) {
|
||||
me.sendMessage(TL.GENERIC_OWNERS.format(ownersTo));
|
||||
}
|
||||
} else if (Conf.ownedAreasEnabled && Conf.ownedMessageInsideTerritory && myFaction == factionTo && !myFaction.isWilderness()) {
|
||||
String ownersFrom = myFaction.getOwnerListString(from);
|
||||
if (Conf.ownedMessageByChunk || !ownersFrom.equals(ownersTo)) {
|
||||
if (Conf.ownedMessageByChunk || !ownersFrom.equals(ownersTo) && me.hasNotificationsEnabled()) {
|
||||
if (!ownersTo.isEmpty()) {
|
||||
me.sendMessage(TL.GENERIC_OWNERS.format(ownersTo));
|
||||
} else if (!TL.GENERIC_PUBLICLAND.toString().isEmpty()) {
|
||||
|
@ -75,7 +75,7 @@ public abstract class MemoryFPlayer implements FPlayer {
|
||||
protected transient long lastFrostwalkerMessage;
|
||||
protected transient boolean shouldTakeFallDamage = true;
|
||||
protected boolean isStealthEnabled = false;
|
||||
boolean playerAlerts = false;
|
||||
protected boolean notificationsEnabled = true;
|
||||
boolean inspectMode = false;
|
||||
protected boolean isAlt = false;
|
||||
|
||||
@ -99,6 +99,7 @@ public abstract class MemoryFPlayer implements FPlayer {
|
||||
this.lastLoginTime = System.currentTimeMillis();
|
||||
this.mapAutoUpdating = false;
|
||||
this.autoClaimFor = null;
|
||||
this.notificationsEnabled = true;
|
||||
this.autoSafeZoneEnabled = false;
|
||||
this.autoWarZoneEnabled = false;
|
||||
this.loginPvpDisabled = Conf.noPVPDamageToOthersForXSecondsAfterLogin > 0;
|
||||
@ -124,6 +125,7 @@ public abstract class MemoryFPlayer implements FPlayer {
|
||||
this.autoSafeZoneEnabled = other.autoSafeZoneEnabled;
|
||||
this.autoWarZoneEnabled = other.autoWarZoneEnabled;
|
||||
this.loginPvpDisabled = other.loginPvpDisabled;
|
||||
this.notificationsEnabled = true;
|
||||
this.powerBoost = other.powerBoost;
|
||||
this.role = other.role;
|
||||
this.title = other.title;
|
||||
@ -133,6 +135,7 @@ public abstract class MemoryFPlayer implements FPlayer {
|
||||
this.getKills();
|
||||
this.getDeaths();
|
||||
this.isAdminBypassing = other.isAdminBypassing;
|
||||
this.notificationsEnabled = other.notificationsEnabled;
|
||||
this.showScoreboard = SaberFactions.plugin.getConfig().getBoolean("scoreboard.default-enabled", true);
|
||||
this.mapHeight = Conf.mapHeight;
|
||||
}
|
||||
@ -208,6 +211,16 @@ public abstract class MemoryFPlayer implements FPlayer {
|
||||
this.factionId = faction.getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setNotificationsEnabled(boolean enabled) {
|
||||
this.notificationsEnabled = enabled;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasNotificationsEnabled() {
|
||||
return this.notificationsEnabled;
|
||||
}
|
||||
|
||||
public String getFactionId() {
|
||||
return this.factionId;
|
||||
}
|
||||
|
@ -700,6 +700,10 @@ public enum TL {
|
||||
COMMAND_LOGOUT_DAMAGE_TAKEN("&c&l[!] &7Your logout was cancelled because you were damaged!"),
|
||||
COMMAND_LOGOUT_TELEPORTED("&c&l[!] &7Your logout was cancelled because you teleported!"),
|
||||
|
||||
COMMAND_NOTIFICATIONS_TOGGLED_ON("&c&l[!] &7You will now see claimed land notifications!"),
|
||||
COMMAND_NOTIFICATIONS_TOGGLED_OFF("&c&l[!] &7You will no longer see claimed land notifications!"),
|
||||
COMMAND_NOTIFICATIONS_DESCRIPTION("Toggle notifications for land claiming"),
|
||||
|
||||
COMMAND_SHOW_NOFACTION_SELF("You are not in a faction"),
|
||||
COMMAND_SHOW_NOFACTION_OTHER("That's not a faction"),
|
||||
COMMAND_SHOW_TOSHOW("to show faction information"),
|
||||
|
Loading…
Reference in New Issue
Block a user