Reworked chat completely. Added Herochat integration. New tag-parsing system. Non-monitor-breaking relation colored chat.

This commit is contained in:
Olof Larsson
2012-05-02 04:45:10 +02:00
parent 06d22549e2
commit 1459c9c057
14 changed files with 316 additions and 326 deletions

View File

@ -1,77 +0,0 @@
package com.massivecraft.factions.cmd;
import com.massivecraft.factions.Conf;
import com.massivecraft.factions.struct.ChatMode;
import com.massivecraft.factions.struct.Permission;
public class CmdChat extends FCommand
{
public CmdChat()
{
super();
this.aliases.add("c");
this.aliases.add("chat");
//this.requiredArgs.add("");
this.optionalArgs.put("mode", "next");
this.permission = Permission.CHAT.node;
this.disableOnLock = false;
senderMustBePlayer = true;
senderMustBeMember = true;
senderMustBeOfficer = false;
senderMustBeLeader = false;
}
@Override
public void perform()
{
if ( ! Conf.factionOnlyChat )
{
msg("<b>The built in chat chat channels are disabled on this server.");
return;
}
String modeString = this.argAsString(0);
ChatMode modeTarget = fme.getChatMode().getNext();
if (modeString != null)
{
modeString.toLowerCase();
if(modeString.startsWith("p"))
{
modeTarget = ChatMode.PUBLIC;
}
else if (modeString.startsWith("a"))
{
modeTarget = ChatMode.ALLIANCE;
}
else if(modeString.startsWith("f"))
{
modeTarget = ChatMode.FACTION;
}
else
{
msg("<b>Unrecognised chat mode. <i>Please enter either 'a','f' or 'p'");
return;
}
}
fme.setChatMode(modeTarget);
if(fme.getChatMode() == ChatMode.PUBLIC)
{
msg("<i>Public chat mode.");
}
else if (fme.getChatMode() == ChatMode.ALLIANCE )
{
msg("<i>Alliance only chat mode.");
}
else
{
msg("<i>Faction only chat mode.");
}
}
}

View File

@ -1,40 +0,0 @@
package com.massivecraft.factions.cmd;
import com.massivecraft.factions.P;
import com.massivecraft.factions.struct.Permission;
public class CmdChatSpy extends FCommand
{
public CmdChatSpy()
{
super();
this.aliases.add("chatspy");
this.optionalArgs.put("on/off", "flip");
this.permission = Permission.CHATSPY.node;
this.disableOnLock = false;
senderMustBePlayer = true;
senderMustBeMember = false;
senderMustBeOfficer = false;
senderMustBeLeader = false;
}
@Override
public void perform()
{
fme.setSpyingChat(this.argAsBool(0, ! fme.isSpyingChat()));
if ( fme.isSpyingChat())
{
fme.msg("<i>You have enabled chat spying mode.");
P.p.log(fme.getName() + " has ENABLED chat spying mode.");
}
else
{
fme.msg("<i>You have disabled chat spying mode.");
P.p.log(fme.getName() + " DISABLED chat spying mode.");
}
}
}

View File

@ -67,7 +67,6 @@ public class CmdHelp extends FCommand
pageLines.add( p.cmdBase.cmdPower.getUseageTemplate(true) );
pageLines.add( p.cmdBase.cmdJoin.getUseageTemplate(true) );
pageLines.add( p.cmdBase.cmdLeave.getUseageTemplate(true) );
pageLines.add( p.cmdBase.cmdChat.getUseageTemplate(true) );
pageLines.add( p.cmdBase.cmdHome.getUseageTemplate(true) );
pageLines.add( p.txt.parse("<i>Learn how to create a faction on the next page.") );
helpPages.add(pageLines);
@ -166,7 +165,6 @@ 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.cmdPowerBoost.getUseageTemplate(true) );
pageLines.add( p.cmdBase.cmdLock.getUseageTemplate(true) );
pageLines.add( p.cmdBase.cmdReload.getUseageTemplate(true) );

View File

@ -9,8 +9,6 @@ public class FCmdRoot extends FCommand
public CmdLeader cmdLeader = new CmdLeader();
public CmdAutoClaim cmdAutoClaim = new CmdAutoClaim();
public CmdAdmin cmdBypass = new CmdAdmin();
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();
@ -73,8 +71,6 @@ public class FCmdRoot extends FCommand
this.addSubCommand(this.cmdLeader);
this.addSubCommand(this.cmdAutoClaim);
this.addSubCommand(this.cmdBypass);
this.addSubCommand(this.cmdChat);
this.addSubCommand(this.cmdChatSpy);
this.addSubCommand(this.cmdClaim);
this.addSubCommand(this.cmdConfig);
this.addSubCommand(this.cmdCreate);