1 20 21 package freecs.commands; 22 import freecs.interfaces.ICommand; 23 import freecs.content.MessageState; 24 25 30 public class CmdReplyMessage extends AbstractCommand { 31 public final String cmd= "/r"; 32 private static final ICommand selve=new CmdReplyMessage(); 33 34 private CmdReplyMessage () { } 35 36 public static ICommand getInstance () { 37 return selve; 38 } 39 40 public boolean execute (MessageState msgState, String param) { 41 msgState.usercontext = msgState.sender.getForeignPrivateUser(); 42 if (msgState.usercontext == null) 43 return false; 44 if (msgState.usercontext.isLoggedOut ()) { 45 msgState.param = msgState.usercontext.getName() ; 46 msgState.msgTemplate = "error.user.notOnServer.singular"; 47 msgState.sender.sendMessage (msgState.mp); 48 msgState.sender.setPrivateUser(null); 49 return false; 50 } 51 if (param.length () < 1) { 52 msgState.msgTemplate = "error.m.noMessage"; 53 msgState.sender.sendMessage (msgState.mp); 54 return false; 55 } 56 msgState.message=param; 57 sendPrivateMessage (msgState, msgState.usercontext, param); 58 return true; 59 } 60 } 61 | Popular Tags |