From 787c680ed960a8fd2eafafe739e79d9dbeba640c Mon Sep 17 00:00:00 2001 From: Bukkit/Spigot Date: Tue, 28 Dec 2010 15:39:36 +0000 Subject: [PATCH] Removed server argument on events, renamed player events and commented out the rest for now By: Dinnerbone --- paper-api/src/org/bukkit/event/Event.java | 55 ++++------- .../src/org/bukkit/event/EventException.java | 94 +++++++++---------- .../org/bukkit/event/player/PlayerEvent.java | 5 +- 3 files changed, 66 insertions(+), 88 deletions(-) diff --git a/paper-api/src/org/bukkit/event/Event.java b/paper-api/src/org/bukkit/event/Event.java index 91ac0df20c..f9d8b46a09 100644 --- a/paper-api/src/org/bukkit/event/Event.java +++ b/paper-api/src/org/bukkit/event/Event.java @@ -1,30 +1,16 @@ package org.bukkit.event; -import org.bukkit.Player; -import org.bukkit.Server; -import org.bukkit.event.player.PlayerEvent; - /** * Represents an event */ public abstract class Event { - private final Server server; private final Type type; - protected Event(final Server instance, final Type type) { - server = instance; + protected Event(final Type type) { this.type = type; } - /** - * Gets the Server instance that triggered this event - * @return Server which this event was triggered on - */ - public final Server getServer() { - return server; - } - /** * Gets the Type of this event * @return Server which this event was triggered on @@ -79,21 +65,17 @@ public abstract class Event { /** * Player Events */ - LOGINCHECK (Category.PLAYER), - JOIN (Category.PLAYER), - CHAT (Category.PLAYER), - COMMAND (Category.PLAYER), - SERVERCOMMAND (Category.PLAYER), - BAN (Category.PLAYER), - IPBAN (Category.PLAYER), - KICK (Category.PLAYER), - QUIT (Category.PLAYER), + PLAYER_JOIN (Category.PLAYER), + PLAYER_LOGIN (Category.PLAYER), + PLAYER_CHAT (Category.PLAYER), + PLAYER_COMMAND (Category.PLAYER), + PLAYER_QUIT (Category.PLAYER), PLAYER_MOVE (Category.PLAYER), - ARM_SWING (Category.PLAYER), - TELEPORT (Category.PLAYER), + PLAYER_ANIMATION (Category.PLAYER), + PLAYER_TELEPORT (Category.PLAYER); /** * Block Events - */ + BLOCK_DESTROYED (Category.BLOCK), BLOCK_BROKEN (Category.BLOCK), BLOCK_PLACE (Category.BLOCK), @@ -102,27 +84,27 @@ public abstract class Event { BLOCK_PHYSICS (Category.BLOCK), /** * Item Events - */ + ITEM_DROP (Category.ITEM), ITEM_PICK_UP (Category.ITEM), ITEM_USE (Category.ITEM), /** * Environment Events - */ + IGNITE (Category.ENVIRONMENT), FLOW (Category.ENVIRONMENT), EXPLODE (Category.ENVIRONMENT), LIQUID_DESTROY (Category.ENVIRONMENT), /** * Non-player Entity Events - */ + MOB_SPAWN (Category.ENTITY), DAMAGE (Category.ENTITY), HEALTH_CHANGE (Category.ENTITY), ATTACK (Category.ENTITY), // Need to look into this category more /** * Vehicle Events - */ + VEHICLE_CREATE (Category.VEHICLE), VEHICLE_UPDATE (Category.VEHICLE), VEHICLE_DAMAGE (Category.VEHICLE), @@ -132,17 +114,14 @@ public abstract class Event { VEHICLE_POSITIONCHANGE (Category.VEHICLE), /** * Inventory Events - */ + OPEN_INVENTORY (Category.INVENTORY), /** * Sign Events (Item events??) - */ + SIGN_SHOW (Category.SIGN), - SIGN_CHANGE (Category.SIGN), - /** - * Custom Event Placeholder? - */ - CUSTOM_EVENT (Category.CUSTOM); + SIGN_CHANGE (Category.SIGN); + */ private Category category; diff --git a/paper-api/src/org/bukkit/event/EventException.java b/paper-api/src/org/bukkit/event/EventException.java index 2e1e86a2b5..25134cbc5f 100644 --- a/paper-api/src/org/bukkit/event/EventException.java +++ b/paper-api/src/org/bukkit/event/EventException.java @@ -1,47 +1,47 @@ -package org.bukkit.event; - -public class EventException extends Exception { - private final Throwable cause; - - /** - * Constructs a new EventException based on the given Exception - * - * @param throwable Exception that triggered this Exception - */ - public EventException(Throwable throwable) { - cause = throwable; - } - - /** - * Constructs a new EventException - */ - public EventException() { - cause = null; - } - - /** - * Constructs a new EventException with the given message - */ - public EventException(Throwable cause, String message) { - super(message); - this.cause = cause; - } - - /** - * Constructs a new EventException with the given message - */ - public EventException(String message) { - super(message); - cause = null; - } - - /** - * If applicable, returns the Exception that triggered this Exception - * - * @return Inner exception, or null if one does not exist - */ - @Override - public Throwable getCause() { - return cause; - } -} +package org.bukkit.event; + +public class EventException extends Exception { + private final Throwable cause; + + /** + * Constructs a new EventException based on the given Exception + * + * @param throwable Exception that triggered this Exception + */ + public EventException(Throwable throwable) { + cause = throwable; + } + + /** + * Constructs a new EventException + */ + public EventException() { + cause = null; + } + + /** + * Constructs a new EventException with the given message + */ + public EventException(Throwable cause, String message) { + super(message); + this.cause = cause; + } + + /** + * Constructs a new EventException with the given message + */ + public EventException(String message) { + super(message); + cause = null; + } + + /** + * If applicable, returns the Exception that triggered this Exception + * + * @return Inner exception, or null if one does not exist + */ + @Override + public Throwable getCause() { + return cause; + } +} diff --git a/paper-api/src/org/bukkit/event/player/PlayerEvent.java b/paper-api/src/org/bukkit/event/player/PlayerEvent.java index 034ccb2c84..87012ea574 100644 --- a/paper-api/src/org/bukkit/event/player/PlayerEvent.java +++ b/paper-api/src/org/bukkit/event/player/PlayerEvent.java @@ -2,7 +2,6 @@ package org.bukkit.event.player; import org.bukkit.Player; -import org.bukkit.Server; import org.bukkit.event.Event; /** @@ -11,8 +10,8 @@ import org.bukkit.event.Event; public class PlayerEvent extends Event { private final Player player; - public PlayerEvent(final Server server, Event.Type type, final Player who) { - super(server, type); + public PlayerEvent(final Event.Type type, final Player who) { + super(type); player = who; }