[Bleeding] Added Enchantment and misc tests to ItemStack (de)serialization

By: Wesley Wolfe <weswolf@aol.com>
This commit is contained in:
Bukkit/Spigot 2012-02-16 14:37:57 -06:00
parent 95dc319bed
commit a23dfcdc7e

View file

@ -2,8 +2,6 @@ package org.bukkit.event;
import java.io.Serializable;
import org.apache.commons.lang.Validate;
/**
* Represents an event
*/
@ -12,17 +10,18 @@ public abstract class Event implements Serializable {
private final String name;
protected Event() {
this.name = getClass().getName();
this(null);
}
protected Event(final String name) {
Validate.notNull(name, "name cannot be null");
this.name = name;
if (name == null) {
this.name = getClass().getName();
} else {
this.name = name;
}
}
/**
* Gets the event's name. Should only be used if getType() == Type.CUSTOM
*
* @return Name of this event
*/
public final String getEventName() {
@ -30,7 +29,7 @@ public abstract class Event implements Serializable {
}
public HandlerList getHandlers() {
throw new IllegalStateException("Event must implement getHandlers()");
throw new IllegalStateException(getEventName() + " must implement getHandlers()");
}
public enum Result {