2011-10-09 21:57:43 +02:00
|
|
|
package com.massivecraft.factions.cmd;
|
2011-03-22 15:45:41 +01:00
|
|
|
|
2011-09-10 06:26:15 +02:00
|
|
|
import com.massivecraft.factions.Conf;
|
2011-09-24 12:04:49 +02:00
|
|
|
import com.massivecraft.factions.struct.ChatMode;
|
2011-10-09 14:53:38 +02:00
|
|
|
import com.massivecraft.factions.struct.Permission;
|
2011-09-10 06:26:15 +02:00
|
|
|
|
2011-10-09 20:10:19 +02:00
|
|
|
public class CmdChat extends FCommand
|
2011-10-09 14:53:38 +02:00
|
|
|
{
|
2011-03-22 15:45:41 +01:00
|
|
|
|
2011-10-09 20:10:19 +02:00
|
|
|
public CmdChat()
|
2011-10-09 14:53:38 +02:00
|
|
|
{
|
|
|
|
super();
|
|
|
|
this.aliases.add("c");
|
|
|
|
this.aliases.add("chat");
|
2011-03-22 18:48:09 +01:00
|
|
|
|
2011-10-09 14:53:38 +02:00
|
|
|
//this.requiredArgs.add("");
|
|
|
|
this.optionalArgs.put("mode", "next");
|
2011-09-24 12:04:49 +02:00
|
|
|
|
2011-10-09 21:57:43 +02:00
|
|
|
this.permission = Permission.CHAT.node;
|
|
|
|
this.disableOnLock = false;
|
2011-10-09 14:53:38 +02:00
|
|
|
|
|
|
|
senderMustBePlayer = true;
|
|
|
|
senderMustBeMember = true;
|
|
|
|
senderMustBeModerator = false;
|
|
|
|
senderMustBeAdmin = false;
|
2011-03-22 15:45:41 +01:00
|
|
|
}
|
|
|
|
|
2011-06-21 07:38:31 +02:00
|
|
|
@Override
|
2011-10-09 14:53:38 +02:00
|
|
|
public void perform()
|
|
|
|
{
|
|
|
|
if ( ! Conf.factionOnlyChat )
|
|
|
|
{
|
|
|
|
sendMessageParsed("<b>Faction-only chat is disabled on this server.");
|
2011-09-10 06:26:15 +02:00
|
|
|
return;
|
|
|
|
}
|
2011-10-09 14:53:38 +02:00
|
|
|
|
2011-10-10 01:21:05 +02:00
|
|
|
String modeString = this.argAsString(0);
|
2011-10-09 14:53:38 +02:00
|
|
|
ChatMode modeTarget = fme.getChatMode().getNext();
|
|
|
|
|
|
|
|
if (modeString != null)
|
|
|
|
{
|
2011-10-10 01:21:05 +02:00
|
|
|
modeString.toLowerCase();
|
2011-10-09 14:53:38 +02:00
|
|
|
if(modeString.startsWith("p"))
|
|
|
|
{
|
|
|
|
modeTarget = ChatMode.PUBLIC;
|
|
|
|
}
|
|
|
|
else if (modeString.startsWith("a"))
|
|
|
|
{
|
|
|
|
modeTarget = ChatMode.ALLIANCE;
|
|
|
|
}
|
|
|
|
else if(modeString.startsWith("f"))
|
|
|
|
{
|
|
|
|
modeTarget = ChatMode.FACTION;
|
|
|
|
}
|
2011-10-10 01:21:05 +02:00
|
|
|
else
|
|
|
|
{
|
|
|
|
sendMessageParsed("<b>Unrecognised chat mode. <i>Please enter either 'a','f' or 'p'");
|
|
|
|
return;
|
|
|
|
}
|
2011-03-22 15:45:41 +01:00
|
|
|
}
|
|
|
|
|
2011-10-09 14:53:38 +02:00
|
|
|
fme.setChatMode(modeTarget);
|
2011-09-24 12:04:49 +02:00
|
|
|
|
2011-10-09 14:53:38 +02:00
|
|
|
if(fme.getChatMode() == ChatMode.PUBLIC)
|
|
|
|
{
|
|
|
|
sendMessageParsed("<i>Public chat mode.");
|
|
|
|
}
|
|
|
|
else if (fme.getChatMode() == ChatMode.ALLIANCE )
|
|
|
|
{
|
|
|
|
sendMessageParsed("<i>Alliance only chat mode.");
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
sendMessageParsed("<i>Faction only chat mode.");
|
2011-03-22 15:45:41 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|