diff --git a/pom.xml b/pom.xml
index fca3faa0..a652e920 100644
--- a/pom.xml
+++ b/pom.xml
@@ -330,8 +330,8 @@
net.coreprotect
- CoreProtect
- 2
+ coreprotect
+ 2.15.0
provided
@@ -350,6 +350,10 @@
+
+ net.coreprotect
+ http://maven.playpro.com/
+
ess-repo
http://ci.ender.zone/plugin/repository/everything/
diff --git a/src/main/java/META-INF/MANIFEST.MF b/src/main/java/META-INF/MANIFEST.MF
new file mode 100644
index 00000000..f43662f0
--- /dev/null
+++ b/src/main/java/META-INF/MANIFEST.MF
@@ -0,0 +1,3 @@
+Manifest-Version: 1.0
+Main-Class: com.massivecraft.factions.SaberFactions
+
diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdFGlobal.java b/src/main/java/com/massivecraft/factions/cmd/CmdFGlobal.java
new file mode 100644
index 00000000..2d5a90d6
--- /dev/null
+++ b/src/main/java/com/massivecraft/factions/cmd/CmdFGlobal.java
@@ -0,0 +1,52 @@
+package com.massivecraft.factions.cmd;
+
+import com.massivecraft.factions.zcore.util.TL;
+import org.bukkit.entity.Player;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.UUID;
+
+public class CmdFGlobal extends FCommand {
+
+ public CmdFGlobal() {
+
+ super();
+ this.aliases.add("gchat");
+ this.aliases.add("global");
+ this.aliases.add("globalchat");
+
+ this.disableOnLock = false;
+ this.disableOnSpam = false;
+
+ senderMustBePlayer = true;
+ senderMustBeMember = true;
+ senderMustBeModerator = false;
+ senderMustBeColeader = false;
+ senderMustBeAdmin = false;
+ }
+
+ public static List toggled = new ArrayList<>();
+
+ @Override
+ public void perform() {
+
+ Player p = (Player)sender;
+
+ // /f global
+
+ if (toggled.contains(p.getUniqueId())){
+ toggled.remove(p.getUniqueId());
+ }else{
+ toggled.add(p.getUniqueId());
+ }
+
+ fme.msg(TL.COMMAND_F_GLOBAL_TOGGLE, toggled.contains(p.getUniqueId()) ? "enabled" : "disabled");
+ }
+
+ @Override
+ public TL getUsageTranslation() {
+ return TL.COMMAND_F_GLOBAL_DESCRIPTION;
+ }
+
+}
diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdGrace.java b/src/main/java/com/massivecraft/factions/cmd/CmdGrace.java
index d62afee8..2de4c895 100644
--- a/src/main/java/com/massivecraft/factions/cmd/CmdGrace.java
+++ b/src/main/java/com/massivecraft/factions/cmd/CmdGrace.java
@@ -11,7 +11,6 @@ public class CmdGrace extends FCommand {
super();
this.aliases.add("grace");
- this.aliases.add("gracee");
this.permission = Permission.GRACE.node;
this.disableOnLock = false;
diff --git a/src/main/java/com/massivecraft/factions/cmd/FCmdRoot.java b/src/main/java/com/massivecraft/factions/cmd/FCmdRoot.java
index 1c69da00..8cb9c1b3 100644
--- a/src/main/java/com/massivecraft/factions/cmd/FCmdRoot.java
+++ b/src/main/java/com/massivecraft/factions/cmd/FCmdRoot.java
@@ -111,6 +111,7 @@ public class FCmdRoot extends FCommand {
public CmdSpam cmdSpam = new CmdSpam();
public CmdCorner cmdCorner = new CmdCorner();
public CmdInventorySee cmdInventorySee = new CmdInventorySee();
+ public CmdFGlobal cmdFGlobal = new CmdFGlobal();
@@ -227,6 +228,7 @@ public class FCmdRoot extends FCommand {
this.addSubCommand(this.cmdStrikeSet);
this.addSubCommand(this.cmdSpam);
this.addSubCommand(this.cmdCorner);
+ this.addSubCommand(this.cmdFGlobal);
if (SaberFactions.plugin.getConfig().getBoolean("f-inventory-see.Enabled")) {
diff --git a/src/main/java/com/massivecraft/factions/listeners/FactionsPlayerListener.java b/src/main/java/com/massivecraft/factions/listeners/FactionsPlayerListener.java
index c46cca3e..559fefee 100644
--- a/src/main/java/com/massivecraft/factions/listeners/FactionsPlayerListener.java
+++ b/src/main/java/com/massivecraft/factions/listeners/FactionsPlayerListener.java
@@ -1,6 +1,7 @@
package com.massivecraft.factions.listeners;
import com.massivecraft.factions.*;
+import com.massivecraft.factions.cmd.CmdFGlobal;
import com.massivecraft.factions.cmd.CmdFly;
import com.massivecraft.factions.cmd.CmdSeeChunk;
import com.massivecraft.factions.event.FPlayerEnteredFactionEvent;
@@ -9,6 +10,7 @@ import com.massivecraft.factions.event.FPlayerLeaveEvent;
import com.massivecraft.factions.scoreboards.FScoreboard;
import com.massivecraft.factions.scoreboards.FTeamWrapper;
import com.massivecraft.factions.scoreboards.sidebar.FDefaultSidebar;
+import com.massivecraft.factions.struct.ChatMode;
import com.massivecraft.factions.struct.Permission;
import com.massivecraft.factions.struct.Relation;
import com.massivecraft.factions.struct.Role;
@@ -966,4 +968,41 @@ public class FactionsPlayerListener implements Listener {
}
}
}
+
+ @EventHandler
+ public void AsyncPlayerChatEvent(AsyncPlayerChatEvent e){
+ Player p = e.getPlayer();
+
+ if (CmdFGlobal.toggled.contains(p.getUniqueId())){
+ //they're muted, check status of Faction Chat
+ if (FPlayers.getInstance().getByPlayer(p).getFaction() == null) {
+ //they're muted, and not in a faction, cancel and return
+ e.setCancelled(true);
+ return;
+ } else {
+ //are in a faction that's not Wilderness, SafeZone, or Warzone, check their chat status
+ if (!FPlayers.getInstance().getByPlayer(p).getChatMode().isAtLeast(ChatMode.ALLIANCE)) {
+ //their Faction Chat Mode is not at-least a Alliance, cancel and return
+ e.setCancelled(true);
+ return;
+ }
+ }
+ }
+
+ //we made it this far, since we didn't return yet, we must have sent the chat event through
+ //iterate through all of recipients and check if they're muted, then remove them from the event list
+
+ List l = new ArrayList<>();
+
+ l.addAll(e.getRecipients());
+
+ for (int i = l.size() - 1; i >= 0; i--){ // going backwards in the list to prevent a ConcurrentModificationException
+ Player recipient = l.get(i);
+ if (recipient != null){
+ if (CmdFGlobal.toggled.contains(recipient.getUniqueId())){
+ e.getRecipients().remove(recipient);
+ }
+ }
+ }
+ }
}
diff --git a/src/main/java/com/massivecraft/factions/zcore/util/TL.java b/src/main/java/com/massivecraft/factions/zcore/util/TL.java
index 13442c87..88f7f9f4 100644
--- a/src/main/java/com/massivecraft/factions/zcore/util/TL.java
+++ b/src/main/java/com/massivecraft/factions/zcore/util/TL.java
@@ -818,6 +818,10 @@ public enum TL {
COMMAND_RULES_SET_SUCCESS("&cRule set successfully!"),
COMMAND_RULES_CLEAR_SUCCESS("&cRule cleared successfully!"),
+ // F Global \\
+ COMMAND_F_GLOBAL_TOGGLE("&c&l[!] &7You have &b%1$s &7Global Chat"),
+ COMMAND_F_GLOBAL_DESCRIPTION("Toggle global chat and only allow factions based chats"),
+
/**
* Leaving - This is accessed through a command, and so it MAY need a COMMAND_* slug :s
*/
@@ -899,6 +903,7 @@ public enum TL {
GENERIC_PLACEHOLDER(""),
GENERIC_NOTENOUGHMONEY("&cYou dont have enough money!"),
GENERIC_MONEYTAKE("&c{amount} has been taken from your account."),
+ // F Global \\
PLAYER_NOT_FOUND("&c&l[!] &b%1$s &7is either not online or not in your faction!"),