mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-09 03:43:40 +01:00
[Bleeding] Added Enchantment and misc tests to ItemStack (de)serialization
By: Wesley Wolfe <weswolf@aol.com>
This commit is contained in:
parent
95dc319bed
commit
a23dfcdc7e
1 changed files with 7 additions and 8 deletions
|
@ -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 {
|
||||
|
|
Loading…
Reference in a new issue