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

View File

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

View File

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

View File

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

View File

@ -51,7 +51,14 @@ public class FactionsChatEarlyListener extends PlayerListener
myFaction.sendMessage(message); myFaction.sendMessage(message);
P.p.log(Level.INFO, ChatColor.stripColor("FactionChat "+me.getFaction().getTag()+": "+message)); 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); event.setCancelled(true);
return; return;
@ -69,7 +76,11 @@ public class FactionsChatEarlyListener extends PlayerListener
for (FPlayer fplayer : FPlayers.i.getOnline()) for (FPlayer fplayer : FPlayers.i.getOnline())
{ {
if(myFaction.getRelationTo(fplayer) == Relation.ALLY) if(myFaction.getRelationTo(fplayer) == Relation.ALLY)
fplayer.sendMessage(message); 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)); P.p.log(Level.INFO, ChatColor.stripColor("AllianceChat: "+message));

View File

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