1 18 package net.sf.drftpd.event; 19 20 import net.sf.drftpd.event.listeners.Trial; 21 import net.sf.drftpd.master.usermanager.User; 22 23 31 public class UserEvent extends Event { 32 public static String getCommandFromPeriod(int period) { 33 switch (period) { 34 case Trial.PERIOD_DAILY : 35 return "RESETDAY"; 36 case Trial.PERIOD_MONTHLY : 37 return "RESETMONTH"; 38 case Trial.PERIOD_WEEKLY : 39 return "RESETWEEK"; 40 default : 41 throw new RuntimeException (); 42 } 43 } 44 User user; 45 public UserEvent(User user, int period, long time) { 46 this(user, getCommandFromPeriod(period), time); 47 } 48 public UserEvent(User user, String command) { 49 this(user, command, System.currentTimeMillis()); 50 } 51 public UserEvent(User user, String command, long time) { 52 super(command, time); 53 this.user = user; 54 } 55 56 public User getUser() { 57 return user; 58 } 59 60 public void setUser(User user) { 61 this.user = user; 62 } 63 64 public String toString() { 65 return getClass().getName() 66 + "[user=" 67 + getUser() 68 + ",cmd=" 69 + getCommand() 70 + "]"; 71 } 72 } 73 | Popular Tags |