Added F Global
This commit is contained in:
parent
391ce50581
commit
28f32ec616
8
pom.xml
8
pom.xml
@ -330,8 +330,8 @@
|
|||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>net.coreprotect</groupId>
|
<groupId>net.coreprotect</groupId>
|
||||||
<artifactId>CoreProtect</artifactId>
|
<artifactId>coreprotect</artifactId>
|
||||||
<version>2</version>
|
<version>2.15.0</version>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
@ -350,6 +350,10 @@
|
|||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<repositories>
|
<repositories>
|
||||||
|
<repository>
|
||||||
|
<id>net.coreprotect</id>
|
||||||
|
<url>http://maven.playpro.com/</url>
|
||||||
|
</repository>
|
||||||
<repository>
|
<repository>
|
||||||
<id>ess-repo</id>
|
<id>ess-repo</id>
|
||||||
<url>http://ci.ender.zone/plugin/repository/everything/</url>
|
<url>http://ci.ender.zone/plugin/repository/everything/</url>
|
||||||
|
3
src/main/java/META-INF/MANIFEST.MF
Normal file
3
src/main/java/META-INF/MANIFEST.MF
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
Manifest-Version: 1.0
|
||||||
|
Main-Class: com.massivecraft.factions.SaberFactions
|
||||||
|
|
52
src/main/java/com/massivecraft/factions/cmd/CmdFGlobal.java
Normal file
52
src/main/java/com/massivecraft/factions/cmd/CmdFGlobal.java
Normal file
@ -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<UUID> 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;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -11,7 +11,6 @@ public class CmdGrace extends FCommand {
|
|||||||
|
|
||||||
super();
|
super();
|
||||||
this.aliases.add("grace");
|
this.aliases.add("grace");
|
||||||
this.aliases.add("gracee");
|
|
||||||
|
|
||||||
this.permission = Permission.GRACE.node;
|
this.permission = Permission.GRACE.node;
|
||||||
this.disableOnLock = false;
|
this.disableOnLock = false;
|
||||||
|
@ -111,6 +111,7 @@ public class FCmdRoot extends FCommand {
|
|||||||
public CmdSpam cmdSpam = new CmdSpam();
|
public CmdSpam cmdSpam = new CmdSpam();
|
||||||
public CmdCorner cmdCorner = new CmdCorner();
|
public CmdCorner cmdCorner = new CmdCorner();
|
||||||
public CmdInventorySee cmdInventorySee = new CmdInventorySee();
|
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.cmdStrikeSet);
|
||||||
this.addSubCommand(this.cmdSpam);
|
this.addSubCommand(this.cmdSpam);
|
||||||
this.addSubCommand(this.cmdCorner);
|
this.addSubCommand(this.cmdCorner);
|
||||||
|
this.addSubCommand(this.cmdFGlobal);
|
||||||
|
|
||||||
|
|
||||||
if (SaberFactions.plugin.getConfig().getBoolean("f-inventory-see.Enabled")) {
|
if (SaberFactions.plugin.getConfig().getBoolean("f-inventory-see.Enabled")) {
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package com.massivecraft.factions.listeners;
|
package com.massivecraft.factions.listeners;
|
||||||
|
|
||||||
import com.massivecraft.factions.*;
|
import com.massivecraft.factions.*;
|
||||||
|
import com.massivecraft.factions.cmd.CmdFGlobal;
|
||||||
import com.massivecraft.factions.cmd.CmdFly;
|
import com.massivecraft.factions.cmd.CmdFly;
|
||||||
import com.massivecraft.factions.cmd.CmdSeeChunk;
|
import com.massivecraft.factions.cmd.CmdSeeChunk;
|
||||||
import com.massivecraft.factions.event.FPlayerEnteredFactionEvent;
|
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.FScoreboard;
|
||||||
import com.massivecraft.factions.scoreboards.FTeamWrapper;
|
import com.massivecraft.factions.scoreboards.FTeamWrapper;
|
||||||
import com.massivecraft.factions.scoreboards.sidebar.FDefaultSidebar;
|
import com.massivecraft.factions.scoreboards.sidebar.FDefaultSidebar;
|
||||||
|
import com.massivecraft.factions.struct.ChatMode;
|
||||||
import com.massivecraft.factions.struct.Permission;
|
import com.massivecraft.factions.struct.Permission;
|
||||||
import com.massivecraft.factions.struct.Relation;
|
import com.massivecraft.factions.struct.Relation;
|
||||||
import com.massivecraft.factions.struct.Role;
|
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<Player> 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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -818,6 +818,10 @@ public enum TL {
|
|||||||
COMMAND_RULES_SET_SUCCESS("&cRule set successfully!"),
|
COMMAND_RULES_SET_SUCCESS("&cRule set successfully!"),
|
||||||
COMMAND_RULES_CLEAR_SUCCESS("&cRule cleared 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
|
* 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("<This is a placeholder for a message you should not see>"),
|
GENERIC_PLACEHOLDER("<This is a placeholder for a message you should not see>"),
|
||||||
GENERIC_NOTENOUGHMONEY("&cYou dont have enough money!"),
|
GENERIC_NOTENOUGHMONEY("&cYou dont have enough money!"),
|
||||||
GENERIC_MONEYTAKE("&c{amount} has been taken from your account."),
|
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!"),
|
PLAYER_NOT_FOUND("&c&l[!] &b%1$s &7is either not online or not in your faction!"),
|
||||||
|
Loading…
Reference in New Issue
Block a user