From f7187410449c8deb6433fad6314a3d054c235dbd Mon Sep 17 00:00:00 2001 From: wysohn Date: Sat, 17 Jun 2017 20:16:09 -0700 Subject: [PATCH] HandlerList should be present in every Events. (It's static you know) --- .../experience/McMMOPlayerExperienceEvent.java | 13 ------------- .../experience/McMMOPlayerLevelDownEvent.java | 12 ++++++++++++ .../events/experience/McMMOPlayerLevelUpEvent.java | 12 ++++++++++++ .../events/experience/McMMOPlayerXpGainEvent.java | 12 ++++++++++++ 4 files changed, 36 insertions(+), 13 deletions(-) diff --git a/src/main/java/com/gmail/nossr50/events/experience/McMMOPlayerExperienceEvent.java b/src/main/java/com/gmail/nossr50/events/experience/McMMOPlayerExperienceEvent.java index e9e38c1ef..f33a332b6 100644 --- a/src/main/java/com/gmail/nossr50/events/experience/McMMOPlayerExperienceEvent.java +++ b/src/main/java/com/gmail/nossr50/events/experience/McMMOPlayerExperienceEvent.java @@ -2,7 +2,6 @@ package com.gmail.nossr50.events.experience; import org.bukkit.entity.Player; import org.bukkit.event.Cancellable; -import org.bukkit.event.HandlerList; import org.bukkit.event.player.PlayerEvent; import com.gmail.nossr50.datatypes.skills.SkillType; @@ -64,16 +63,4 @@ public abstract class McMMOPlayerExperienceEvent extends PlayerEvent implements public void setCancelled(boolean cancelled) { this.cancelled = cancelled; } - - /** Rest of file is required boilerplate for custom events **/ - private static final HandlerList handlers = new HandlerList(); - - @Override - public HandlerList getHandlers() { - return handlers; - } - - public static HandlerList getHandlerList() { - return handlers; - } } diff --git a/src/main/java/com/gmail/nossr50/events/experience/McMMOPlayerLevelDownEvent.java b/src/main/java/com/gmail/nossr50/events/experience/McMMOPlayerLevelDownEvent.java index 31ca5a5c7..4bdf32844 100644 --- a/src/main/java/com/gmail/nossr50/events/experience/McMMOPlayerLevelDownEvent.java +++ b/src/main/java/com/gmail/nossr50/events/experience/McMMOPlayerLevelDownEvent.java @@ -1,6 +1,7 @@ package com.gmail.nossr50.events.experience; import org.bukkit.entity.Player; +import org.bukkit.event.HandlerList; import com.gmail.nossr50.datatypes.skills.SkillType; import com.gmail.nossr50.datatypes.skills.XPGainReason; @@ -46,4 +47,15 @@ public class McMMOPlayerLevelDownEvent extends McMMOPlayerLevelChangeEvent { public int getLevelsLost() { return levelsLost; } + + private static final HandlerList handlers = new HandlerList(); + + @Override + public HandlerList getHandlers() { + return handlers; + } + + public static HandlerList getHandlerList() { + return handlers; + } } diff --git a/src/main/java/com/gmail/nossr50/events/experience/McMMOPlayerLevelUpEvent.java b/src/main/java/com/gmail/nossr50/events/experience/McMMOPlayerLevelUpEvent.java index 07f945acf..7351f6915 100644 --- a/src/main/java/com/gmail/nossr50/events/experience/McMMOPlayerLevelUpEvent.java +++ b/src/main/java/com/gmail/nossr50/events/experience/McMMOPlayerLevelUpEvent.java @@ -1,6 +1,7 @@ package com.gmail.nossr50.events.experience; import org.bukkit.entity.Player; +import org.bukkit.event.HandlerList; import com.gmail.nossr50.datatypes.skills.SkillType; import com.gmail.nossr50.datatypes.skills.XPGainReason; @@ -46,4 +47,15 @@ public class McMMOPlayerLevelUpEvent extends McMMOPlayerLevelChangeEvent { public int getLevelsGained() { return levelsGained; } + + private static final HandlerList handlers = new HandlerList(); + + @Override + public HandlerList getHandlers() { + return handlers; + } + + public static HandlerList getHandlerList() { + return handlers; + } } diff --git a/src/main/java/com/gmail/nossr50/events/experience/McMMOPlayerXpGainEvent.java b/src/main/java/com/gmail/nossr50/events/experience/McMMOPlayerXpGainEvent.java index b7247f133..53e28971f 100644 --- a/src/main/java/com/gmail/nossr50/events/experience/McMMOPlayerXpGainEvent.java +++ b/src/main/java/com/gmail/nossr50/events/experience/McMMOPlayerXpGainEvent.java @@ -1,6 +1,7 @@ package com.gmail.nossr50.events.experience; import org.bukkit.entity.Player; +import org.bukkit.event.HandlerList; import com.gmail.nossr50.datatypes.skills.SkillType; import com.gmail.nossr50.datatypes.skills.XPGainReason; @@ -51,4 +52,15 @@ public class McMMOPlayerXpGainEvent extends McMMOPlayerExperienceEvent { public void setXpGained(int xpGained) { this.xpGained = xpGained; } + + private static final HandlerList handlers = new HandlerList(); + + @Override + public HandlerList getHandlers() { + return handlers; + } + + public static HandlerList getHandlerList() { + return handlers; + } }