2011-07-18 22:06:02 +02:00
|
|
|
package com.massivecraft.factions.commands;
|
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-09-10 06:26:15 +02:00
|
|
|
|
2011-10-08 23:22:02 +02:00
|
|
|
public class FCommandChat extends FCommand {
|
2011-03-22 15:45:41 +01:00
|
|
|
|
|
|
|
public FCommandChat() {
|
2011-03-22 18:48:09 +01:00
|
|
|
aliases.add("chat");
|
|
|
|
aliases.add("c");
|
|
|
|
|
2011-09-24 12:04:49 +02:00
|
|
|
optionalParameters.add("mode");
|
|
|
|
|
|
|
|
helpDescription = "Change chat mode";
|
2011-03-22 15:45:41 +01:00
|
|
|
}
|
|
|
|
|
2011-06-21 07:38:31 +02:00
|
|
|
@Override
|
2011-03-22 15:45:41 +01:00
|
|
|
public void perform() {
|
2011-09-13 05:36:59 +02:00
|
|
|
if ( ! Conf.factionOnlyChat ) {
|
|
|
|
sendMessage("Faction-only chat is disabled on this server.");
|
2011-09-10 06:26:15 +02:00
|
|
|
return;
|
|
|
|
}
|
2011-03-22 15:45:41 +01:00
|
|
|
if ( ! assertHasFaction()) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2011-09-24 12:04:49 +02:00
|
|
|
if( this.parameters.size() >= 1 ) {
|
|
|
|
String mode = this.parameters.get(0);
|
|
|
|
|
|
|
|
if(mode.startsWith("p")) {
|
|
|
|
me.setChatMode(ChatMode.PUBLIC);
|
|
|
|
sendMessage("Public chat mode.");
|
|
|
|
} else if(mode.startsWith("a")) {
|
|
|
|
me.setChatMode(ChatMode.ALLIANCE);
|
|
|
|
sendMessage("Alliance only chat mode.");
|
|
|
|
} else if(mode.startsWith("f")) {
|
|
|
|
me.setChatMode(ChatMode.FACTION);
|
|
|
|
sendMessage("Faction only chat mode.");
|
|
|
|
} else {
|
|
|
|
sendMessage("Unrecognised chat mode. Please enter either 'a','f' or 'p'");
|
|
|
|
}
|
|
|
|
|
2011-03-22 15:45:41 +01:00
|
|
|
} else {
|
2011-09-24 12:04:49 +02:00
|
|
|
|
|
|
|
if(me.getChatMode() == ChatMode.PUBLIC) {
|
|
|
|
me.setChatMode(ChatMode.ALLIANCE);
|
|
|
|
sendMessage("Alliance only chat mode.");
|
|
|
|
} else if (me.getChatMode() == ChatMode.ALLIANCE ) {
|
|
|
|
me.setChatMode(ChatMode.FACTION);
|
|
|
|
sendMessage("Faction only chat mode.");
|
|
|
|
} else {
|
|
|
|
me.setChatMode(ChatMode.PUBLIC);
|
|
|
|
sendMessage("Public chat mode.");
|
|
|
|
}
|
2011-03-22 15:45:41 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|