Add ToggleAllianceChat command (sorry I couldn't think of a shorter name, but this is extremely useful for YouTubers)

This commit is contained in:
vemacs 2015-03-04 23:55:46 -05:00
parent 50e0bd87a6
commit 7fd590fc75
5 changed files with 55 additions and 1 deletions

View File

@ -66,6 +66,7 @@ public class CmdHelp extends FCommand {
pageLines.add(p.cmdBase.cmdJoin.getUseageTemplate(true)); pageLines.add(p.cmdBase.cmdJoin.getUseageTemplate(true));
pageLines.add(p.cmdBase.cmdLeave.getUseageTemplate(true)); pageLines.add(p.cmdBase.cmdLeave.getUseageTemplate(true));
pageLines.add(p.cmdBase.cmdChat.getUseageTemplate(true)); pageLines.add(p.cmdBase.cmdChat.getUseageTemplate(true));
pageLines.add(p.cmdBase.cmdToggleAllianceChat.getUseageTemplate(true));
pageLines.add(p.cmdBase.cmdHome.getUseageTemplate(true)); pageLines.add(p.cmdBase.cmdHome.getUseageTemplate(true));
pageLines.add(p.txt.parse(TL.COMMAND_HELP_NEXTCREATE.toString())); pageLines.add(p.txt.parse(TL.COMMAND_HELP_NEXTCREATE.toString()));
helpPages.add(pageLines); helpPages.add(pageLines);

View File

@ -0,0 +1,46 @@
package com.massivecraft.factions.cmd;
import com.massivecraft.factions.Conf;
import com.massivecraft.factions.struct.Permission;
import com.massivecraft.factions.zcore.util.TL;
public class CmdToggleAllianceChat extends FCommand {
public CmdToggleAllianceChat() {
super();
this.aliases.add("tac");
this.aliases.add("togglealliancechat");
this.disableOnLock = false;
this.permission = Permission.TOGGLE_ALLIANCE_CHAT.node;
this.disableOnLock = false;
senderMustBePlayer = true;
senderMustBeMember = true;
senderMustBeModerator = false;
senderMustBeAdmin = false;
}
@Override
public TL getUsageTranslation() {
return TL.COMMAND_TOGGLEALLIANCECHAT_DESCRIPTION;
}
@Override
public void perform() {
if (!Conf.factionOnlyChat) {
msg(TL.COMMAND_CHAT_DISABLED.toString());
return;
}
boolean ignoreAllianceChat = fme.isIgnoreAllianceChat();
if (ignoreAllianceChat) {
msg(TL.COMMAND_TOGGLEALLIANCECHAT_UNIGNORE);
fme.setIgnoreAllianceChat(false);
} else {
msg(TL.COMMAND_TOGGLEALLIANCECHAT_IGNORE);
fme.setIgnoreAllianceChat(true);
}
}
}

View File

@ -49,6 +49,7 @@ public class FCmdRoot extends FCommand {
public CmdStatus cmdStatus = new CmdStatus(); public CmdStatus cmdStatus = new CmdStatus();
public CmdTag cmdTag = new CmdTag(); public CmdTag cmdTag = new CmdTag();
public CmdTitle cmdTitle = new CmdTitle(); public CmdTitle cmdTitle = new CmdTitle();
public CmdToggleAllianceChat cmdToggleAllianceChat = new CmdToggleAllianceChat();
public CmdUnclaim cmdUnclaim = new CmdUnclaim(); public CmdUnclaim cmdUnclaim = new CmdUnclaim();
public CmdUnclaimall cmdUnclaimall = new CmdUnclaimall(); public CmdUnclaimall cmdUnclaimall = new CmdUnclaimall();
public CmdVersion cmdVersion = new CmdVersion(); public CmdVersion cmdVersion = new CmdVersion();
@ -92,6 +93,7 @@ public class FCmdRoot extends FCommand {
this.addSubCommand(this.cmdBoom); this.addSubCommand(this.cmdBoom);
this.addSubCommand(this.cmdBypass); this.addSubCommand(this.cmdBypass);
this.addSubCommand(this.cmdChat); this.addSubCommand(this.cmdChat);
this.addSubCommand(this.cmdToggleAllianceChat);
this.addSubCommand(this.cmdChatSpy); this.addSubCommand(this.cmdChatSpy);
this.addSubCommand(this.cmdClaim); this.addSubCommand(this.cmdClaim);
this.addSubCommand(this.cmdConfig); this.addSubCommand(this.cmdConfig);

View File

@ -67,6 +67,7 @@ public enum Permission {
STATUS("status"), STATUS("status"),
TAG("tag"), TAG("tag"),
TITLE("title"), TITLE("title"),
TOGGLE_ALLIANCE_CHAT("togglealliancechat"),
UNCLAIM("unclaim"), UNCLAIM("unclaim"),
UNCLAIM_ALL("unclaimall"), UNCLAIM_ALL("unclaimall"),
VERSION("version"), VERSION("version"),

View File

@ -79,7 +79,7 @@ public enum TL {
COMMAND_BYPASS_DISABLELOG(" has DISABLED admin bypass mode."), COMMAND_BYPASS_DISABLELOG(" has DISABLED admin bypass mode."),
COMMAND_BYPASS_DESCRIPTION("Enable admin bypass mode"), COMMAND_BYPASS_DESCRIPTION("Enable admin bypass mode"),
COMMAND_CHAT_DISABLED("<b>The built in chat chat channels are disabled on this server."), COMMAND_CHAT_DISABLED("<b>The built in chat channels are disabled on this server."),
COMMAND_CHAT_INVALIDMODE("<b>Unrecognised chat mode. <i>Please enter either 'a','f' or 'p'"), COMMAND_CHAT_INVALIDMODE("<b>Unrecognised chat mode. <i>Please enter either 'a','f' or 'p'"),
COMMAND_CHAT_DESCRIPTION("Change chat mode"), COMMAND_CHAT_DESCRIPTION("Change chat mode"),
@ -469,6 +469,10 @@ public enum TL {
COMMAND_TITLE_CHANGED("%1$s<i> changed a title: %2$s"), COMMAND_TITLE_CHANGED("%1$s<i> changed a title: %2$s"),
COMMAND_TITLE_DESCRIPTION("Set or remove a players title"), COMMAND_TITLE_DESCRIPTION("Set or remove a players title"),
COMMAND_TOGGLEALLIANCECHAT_DESCRIPTION("Toggles whether or not you will see alliance chat"),
COMMAND_TOGGLEALLIANCECHAT_IGNORE("Alliance chat is now ignored"),
COMMAND_TOGGLEALLIANCECHAT_UNIGNORE("Alliance chat is no longer ignored"),
COMMAND_TOP_DESCRIPTION("Sort Factions to see the top of some criteria."), COMMAND_TOP_DESCRIPTION("Sort Factions to see the top of some criteria."),
COMMAND_TOP_TOP("Top Factions by %s. Page %d/%d"), COMMAND_TOP_TOP("Top Factions by %s. Page %d/%d"),
COMMAND_TOP_LINE("%d. &6%s: &c%s"), // Rank. Faction: Value COMMAND_TOP_LINE("%d. &6%s: &c%s"), // Rank. Faction: Value