1 18 package net.sf.drftpd.event; 19 20 import java.util.Iterator ; 21 import java.util.List ; 22 import java.util.Map ; 23 24 import net.sf.drftpd.master.usermanager.User; 25 26 import org.drftpd.plugins.SiteBot; 27 import org.jdom.Element; 28 29 34 public class NukeEvent extends UserEvent { 35 private int multiplier; 36 private long nukedAmount; 37 private Map nukees; 38 private String path; 39 40 private String reason; 41 private long size; 42 43 public NukeEvent( 44 User user, 45 String command, 46 String path, 47 long size, 48 long nukedAmount, 49 int multiplier, 50 String reason, 51 Map nukees) { 52 this( 53 user, 54 command, 55 path, 56 System.currentTimeMillis(), 57 size, 58 nukedAmount, 59 multiplier, 60 reason, 61 nukees); 62 } 63 69 public NukeEvent( 70 User user, 71 String command, 72 String path, 73 long time, 74 long size, 75 long nukedAmount, 76 int multiplier, 77 String reason, 78 Map nukees) { 79 super(user, command, time); 80 this.multiplier = multiplier; 81 this.reason = reason; 82 this.path = path; 83 this.nukees = nukees; 84 this.size = size; 85 this.nukedAmount = nukedAmount; 86 } 87 88 public int getMultiplier() { 89 return multiplier; 90 } 91 92 public long getNukedAmount() { 93 return nukedAmount; 94 } 95 96 101 public Map getNukees() { 102 return nukees; 103 } 104 105 110 public List getNukees2() { 111 return SiteBot.map2nukees(nukees); 112 } 113 114 public String getPath() { 115 return path; 116 } 117 118 public String getReason() { 119 return reason; 120 } 121 122 public long getSize() { 123 return size; 124 } 125 126 public void setReason(String string) { 127 reason = string; 128 } 129 130 public Element toJDOM() { 131 Element element = new Element("nuke"); 132 element.addContent( 133 new Element("user").setText(this.getUser().getUsername())); 134 element.addContent(new Element("path").setText(this.getPath())); 135 element.addContent( 136 new Element("multiplier").setText( 137 Integer.toString(this.getMultiplier()))); 138 element.addContent(new Element("reason").setText(this.getReason())); 139 element.addContent( 140 new Element("time").setText(Long.toString(this.getTime()))); 141 142 element.addContent( 143 new Element("size").setText(Long.toString(getSize()))); 144 element.addContent( 145 new Element("nukedAmount").setText( 146 Long.toString(getNukedAmount()))); 147 148 Element nukees = new Element("nukees"); 149 for (Iterator iter = this.getNukees().entrySet().iterator(); 150 iter.hasNext(); 151 ) { 152 Map.Entry entry = (Map.Entry ) iter.next(); 153 String username = (String ) entry.getKey(); 154 Long amount = (Long ) entry.getValue(); 155 Element nukee = new Element("nukee"); 156 nukee.addContent(new Element("username").setText(username)); 157 nukee.addContent(new Element("amount").setText(amount.toString())); 158 nukees.addContent(nukee); 159 } 160 element.addContent(nukees); 161 return element; 162 } 163 164 public String toString() { 165 return "[NUKE:" + getPath() + ",multiplier=" + getMultiplier() + "]"; 166 } 167 168 } 169 | Popular Tags |