(courtesy of eXeC64) Added chat spy feature for admins

This commit is contained in:
Brettflan 2012-01-15 01:42:56 -06:00
parent 64f47b01fb
commit fb32fc7f51
6 changed files with 28 additions and 6 deletions

View File

@ -1,5 +1,5 @@
name: Factions
version: 1.6.2
version: 1.6.3_dev
main: com.massivecraft.factions.P
authors: [Olof Larsson, Brett Flannigan]
softdepend: [PermissionsEx, Permissions, Essentials, EssentialsChat, HeroChat, iChat, LocalAreaChat, nChat, ChatManager, CAPI, AuthMe, Register, Spout, WorldEdit, WorldGuard]
@ -31,7 +31,7 @@ permissions:
factions.sethome.any: true
factions.money.*: true
factions.kit.halfmod:
description: Zones, bypassing, and kicking
description: Zones, bypassing, kicking, and chatspy
children:
factions.kit.fullplayer: true
factions.managesafezone: true
@ -39,6 +39,7 @@ permissions:
factions.bypass: true
factions.kick.any: true
factions.ownershipbypass: true
factions.chatspy: true
factions.kit.fullplayer:
default: true
description: Can also create new factions.
@ -87,6 +88,8 @@ permissions:
description: enable admin bypass mode
factions.chat:
description: change chat mode
factions.chatspy:
description: enable admin chat spy mode
factions.claim:
description: claim land where you are standing
factions.config:

View File

@ -136,6 +136,11 @@ public class FPlayer extends PlayerEntity implements EconomyParticipator
return chatMode;
}
// FIELD: chatSpy
private transient boolean spyingChat = false;
public void setSpyingChat(boolean chatSpying) { this.spyingChat = chatSpying; }
public boolean isSpyingChat() { return spyingChat; }
// FIELD: account
public MethodAccount getAccount()
{

View File

@ -171,12 +171,12 @@ public class CmdHelp extends FCommand
pageLines = new ArrayList<String>();
pageLines.add(p.txt.parse("<i>More commands for server admins:"));
pageLines.add( p.cmdBase.cmdChatSpy.getUseageTemplate(true) );
pageLines.add( p.cmdBase.cmdPermanent.getUseageTemplate(true) );
pageLines.add( p.cmdBase.cmdPermanentPower.getUseageTemplate(true) );
pageLines.add( p.cmdBase.cmdLock.getUseageTemplate(true) );
pageLines.add( p.cmdBase.cmdReload.getUseageTemplate(true) );
pageLines.add( p.cmdBase.cmdSaveAll.getUseageTemplate(true) );
pageLines.add( p.cmdBase.cmdVersion.getUseageTemplate(true) );
pageLines.add( p.cmdBase.cmdConfig.getUseageTemplate(true) );
helpPages.add(pageLines);
}

View File

@ -11,6 +11,7 @@ public class FCmdRoot extends FCommand
public CmdBoom cmdBoom = new CmdBoom();
public CmdBypass cmdBypass = new CmdBypass();
public CmdChat cmdChat = new CmdChat();
public CmdChatSpy cmdChatSpy = new CmdChatSpy();
public CmdClaim cmdClaim = new CmdClaim();
public CmdConfig cmdConfig = new CmdConfig();
public CmdCreate cmdCreate = new CmdCreate();
@ -77,6 +78,7 @@ public class FCmdRoot extends FCommand
this.addSubCommand(this.cmdBoom);
this.addSubCommand(this.cmdBypass);
this.addSubCommand(this.cmdChat);
this.addSubCommand(this.cmdChatSpy);
this.addSubCommand(this.cmdClaim);
this.addSubCommand(this.cmdConfig);
this.addSubCommand(this.cmdCreate);

View File

@ -52,6 +52,13 @@ public class FactionsChatEarlyListener extends PlayerListener
P.p.log(Level.INFO, ChatColor.stripColor("FactionChat "+me.getFaction().getTag()+": "+message));
//Send to any players who are spying chat
for (FPlayer fplayer : FPlayers.i.getOnline())
{
if(fplayer.isSpyingChat() && fplayer.getFaction() != myFaction)
fplayer.sendMessage("[FCspy] "+me.getFaction().getTag()+": "+message);
}
event.setCancelled(true);
return;
@ -70,6 +77,10 @@ public class FactionsChatEarlyListener extends PlayerListener
{
if(myFaction.getRelationTo(fplayer) == Relation.ALLY)
fplayer.sendMessage(message);
//Send to any players who are spying chat
else if(fplayer.isSpyingChat())
fplayer.sendMessage("[ACspy]: " + message);
}
P.p.log(Level.INFO, ChatColor.stripColor("AllianceChat: "+message));

View File

@ -13,6 +13,7 @@ public enum Permission
AUTOCLAIM("autoclaim"),
BYPASS("bypass"),
CHAT("chat"),
CHATSPY("chatspy"),
CLAIM("claim"),
CONFIG("config"),
CREATE("create"),