From a23dfcdc7e86a921a6f854bb69b6c93b3c638925 Mon Sep 17 00:00:00 2001 From: Bukkit/Spigot Date: Thu, 16 Feb 2012 14:37:57 -0600 Subject: [PATCH] [Bleeding] Added Enchantment and misc tests to ItemStack (de)serialization By: Wesley Wolfe --- .../src/main/java/org/bukkit/event/Event.java | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/paper-api/src/main/java/org/bukkit/event/Event.java b/paper-api/src/main/java/org/bukkit/event/Event.java index 6f27a4a25e..8b91f92290 100644 --- a/paper-api/src/main/java/org/bukkit/event/Event.java +++ b/paper-api/src/main/java/org/bukkit/event/Event.java @@ -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 {