1 20 21 package freecs.commands; 22 import java.util.Iterator ; 23 import java.util.Vector ; 24 25 import freecs.Server; 26 import freecs.interfaces.*; 27 import freecs.content.MessageState; 28 import freecs.core.User; 29 30 35 public class CmdShowIp extends AbstractCommand { 36 public final String cmd= "/ip"; 37 private static final ICommand selve=new CmdShowIp(); 38 39 private CmdShowIp () { } 40 41 public static ICommand getInstance () { 42 return selve; 43 } 44 45 public boolean execute (MessageState msgState, String param) { 46 if (isPunished(msgState)) 47 return false; 48 if (!msgState.sender.hasRight(IUserStates.ROLE_VIP)) { 49 msgState.msgTemplate = "error.noRight.noVipAdmin"; 50 msgState.sender.sendMessage(msgState.mp); 51 return false; 52 } 53 if (param.length() < 1) { 54 msgState.msgTemplate = "error.ip.noArg"; 55 msgState.sender.sendMessage(msgState.mp); 56 return false; 57 } 58 Vector found = getMultibleUsers(msgState, param); 59 msgState.useRenderCache=false; 60 msgState.msgTemplate="message.ip"; 61 for (Iterator i = found.iterator(); i.hasNext(); ) { 62 User cu = (User) i.next(); 63 msgState.usercontext = cu; 64 msgState.sender.sendMessage(msgState.mp); 65 if (Server.checkLogLvl(Server.MSG_STATE, Server.LVL_MINOR)) { 66 StringBuffer sb = new StringBuffer (); 67 sb.append("User "); 68 sb.append(msgState.sender.getName()); 69 sb.append(" has queried the IP-Address of User "); 70 sb.append(cu.getName()); 71 Server.log (this, sb.toString(), Server.MSG_STATE, Server.LVL_MINOR); 72 } 73 } 74 return true; 75 } 76 77 public String toString() { 78 return "[CmdShowIp]"; 79 } 80 } 81 | Popular Tags |