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
|
|
|
|
2014-04-04 20:55:21 +02:00
|
|
|
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;
|
|
|
|
senderMustBeModerator = false;
|
|
|
|
senderMustBeAdmin = 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.");
|
|
|
|
}
|
|
|
|
}
|
2011-03-22 15:45:41 +01:00
|
|
|
}
|