1 20 21 package freecs.commands; 22 import java.util.Iterator ; 23 import java.util.Vector ; 24 25 import freecs.interfaces.ICommand; 26 import freecs.content.MessageState; 27 import freecs.core.User; 28 import freecs.Server; 29 30 35 public class CmdRespectUser extends AbstractCommand { 36 public final String cmd= "/rgag"; 37 private static final ICommand selve=new CmdRespectUser(); 38 39 private CmdRespectUser () { } 40 41 public static ICommand getInstance () { 42 return selve; 43 } 44 45 public boolean execute (MessageState msgState, String param) { 46 if (param.length () < 1) { 47 msgState.msgTemplate = "error.rig.noArg"; 48 msgState.sender.sendMessage (msgState.mp); 49 return false; 50 } 51 Vector found = getMultibleUsers(msgState, param); 52 for (Iterator e = found.iterator(); e.hasNext(); ) { 53 msgState.usercontext = (User) e.next(); 54 StringBuffer tsb = new StringBuffer ("User ").append (msgState.sender.getName ()).append (" is respecting ").append (msgState.usercontext.getName ()).append (" again"); 55 Server.log (this, tsb.toString (), Server.MSG_STATE, Server.LVL_VERBOSE); 56 msgState.sender.respectUser (msgState.usercontext); 57 } 58 if (found.size()==0) 59 return false; 60 if (found.size()==1) { 61 msgState.msgTemplate="message.rig.singular"; 62 } else { 63 msgState.msgTemplate="message.rig.plural"; 64 msgState.usrList = found.toArray(); 65 } 66 msgState.sender.sendMessage(msgState.mp); 67 return true; 68 } 69 70 public String toString () { 71 return ("[CmdRespectUser]"); 72 } 73 } 74 | Popular Tags |