1 20 21 package freecs.commands; 22 import java.util.Enumeration ; 23 import java.util.Vector ; 24 25 import freecs.interfaces.ICommand; 26 import freecs.content.MessageState; 27 import freecs.core.GroupManager; 28 29 34 public class CmdListBan extends AbstractCommand { 35 public final String cmd= "/wban"; 36 private static final ICommand selve=new CmdListBan(); 37 38 private CmdListBan () { } 39 40 public static ICommand getInstance () { 41 return selve; 42 } 43 44 public boolean execute (MessageState msgState, String param) { 45 if (isPunished (msgState)) return false; 46 if (param != null && param.length() > 1) { 47 msgState.targetGroup = GroupManager.mgr.getGroup(param); 48 if (msgState.targetGroup == null) { 49 msgState.msgTemplate="error.group.notExisting"; 50 msgState.param = param; 51 msgState.sender.sendMessage(msgState.mp); 52 return false; 53 } 54 } else 55 msgState.targetGroup = msgState.sender.getGroup(); 56 57 63 Vector bl = msgState.targetGroup.bannedUsers(); 64 StringBuffer sb = new StringBuffer (); 65 StringBuffer tsb = new StringBuffer (); 66 for (Enumeration e = bl.elements(); e.hasMoreElements(); ) { 67 String uname = (String ) e.nextElement(); 68 sb.append ("<a HREF='/SEND?message=/uban "); 69 sb.append (uname); 70 sb.append ("' target=dummy>"); 71 sb.append (uname); 72 sb.append ("</a>"); 73 tsb.append (" "); 74 tsb.append (uname); 75 if (e.hasMoreElements()) 76 sb.append (", "); 77 } 78 if (sb.length() < 1) { 79 msgState.msgTemplate = "error.wban.nobodyBanned"; 80 msgState.sender.sendMessage (msgState.mp); 81 return false; 82 } 83 sb.append ("<br><a HREF='/SEND?message=/uban"); 84 sb.append (tsb); 85 sb.append ("' target=dummy>"); 86 sb.append ("<b>ubanall</b>"); 87 sb.append ("</a>"); 88 89 msgState.message = sb.toString(); 90 msgState.msgTemplate="message.wban"; 91 msgState.sender.sendMessage (msgState.mp); 92 return false; 93 } 94 } 95 | Popular Tags |