1 20 21 package freecs.commands; 22 import freecs.interfaces.ICommand; 23 import freecs.content.MessageState; 24 25 30 public class CmdQuestion extends AbstractCommand { 31 public final String cmd= "/aq"; 32 private static final ICommand selve=new CmdQuestion(); 33 34 private CmdQuestion () { } 35 36 public static ICommand getInstance () { 37 return selve; 38 } 39 40 public boolean execute (MessageState msgState, String param) { 41 if (isPunished (msgState)) 42 return false; 43 if (param.length () < 1) { 44 msgState.msgTemplate = "error.aq.noArg"; 45 msgState.sender.sendMessage (msgState.mp); 46 return false; 47 } 48 msgState.targetGroup = msgState.sender.getGroup (); 49 synchronized (msgState.targetGroup) { 50 msgState.targetGroup.incrementQuestionCounter (); 51 msgState.sender.incrementQuestionCounter (); 52 msgState.message = param; 53 msgState.msgTemplate = "message.aq"; 54 if (msgState.moderated) 55 msgState.sender.getGroup ().sendModeratorMessage (msgState.mp); 56 else 57 msgState.sender.getGroup ().sendMessage (msgState.mp); 58 } 59 return true; 60 } 61 } 62 | Popular Tags |