Working some one the MCore event classes. I will lie and say that all events are cancellable. In situations where we dont want them to be cancellable we can simply not care about that boolean.

This commit is contained in:
Olof Larsson 2013-04-19 15:13:30 +02:00
parent 59b133284e
commit 2b7b45b7d3
5 changed files with 20 additions and 17 deletions

View File

@ -12,6 +12,7 @@ public class MCoreAfterPlayerRespawnEvent extends Event implements Runnable
// -------------------------------------------- //
// REQUIRED EVENT CODE
// -------------------------------------------- //
private static final HandlerList handlers = new HandlerList();
@Override public HandlerList getHandlers() { return handlers; }
public static HandlerList getHandlerList() { return handlers; }

View File

@ -14,6 +14,7 @@ public class MCoreAfterPlayerTeleportEvent extends Event implements Runnable
// -------------------------------------------- //
// REQUIRED EVENT CODE
// -------------------------------------------- //
private static final HandlerList handlers = new HandlerList();
@Override public HandlerList getHandlers() { return handlers; }
public static HandlerList getHandlerList() { return handlers; }

View File

@ -1,15 +0,0 @@
package com.massivecraft.mcore.event;
import org.bukkit.event.Cancellable;
public abstract class MCoreCancellableEvent extends MCoreEvent implements Cancellable
{
// -------------------------------------------- //
// FIELDS
// -------------------------------------------- //
private boolean cancelled = false;
@Override public boolean isCancelled() { return this.cancelled; }
@Override public void setCancelled(boolean cancelled) { this.cancelled = cancelled; }
}

View File

@ -1,12 +1,27 @@
package com.massivecraft.mcore.event;
import java.util.LinkedHashMap;
import java.util.Map;
import org.bukkit.Bukkit;
import org.bukkit.event.Cancellable;
import org.bukkit.event.Event;
public abstract class MCoreEvent extends Event implements Runnable
public abstract class MCoreEvent extends Event implements Runnable, Cancellable
{
// -------------------------------------------- //
// RUN
// FIELDS
// -------------------------------------------- //
private final Map<String, Object> customData = new LinkedHashMap<String, Object>();
public Map<String, Object> getCustomData() { return this.customData; }
private boolean cancelled = false;
@Override public boolean isCancelled() { return this.cancelled; }
@Override public void setCancelled(boolean cancelled) { this.cancelled = cancelled; }
// -------------------------------------------- //
// OVERRIDE: RUNNABLE
// -------------------------------------------- //
@Override

View File

@ -23,6 +23,7 @@ public class MCorePlayerLeaveEvent extends Event implements Runnable
// -------------------------------------------- //
// REQUIRED EVENT CODE
// -------------------------------------------- //
private static final HandlerList handlers = new HandlerList();
@Override public HandlerList getHandlers() { return handlers; }
public static HandlerList getHandlerList() { return handlers; }