Removed server argument on events, renamed player events and commented out the rest for now

By: Dinnerbone <dinnerbone@dinnerbone.com>
This commit is contained in:
Bukkit/Spigot 2010-12-28 15:39:36 +00:00
parent f72da929e1
commit 787c680ed9
3 changed files with 66 additions and 88 deletions

View File

@ -1,30 +1,16 @@
package org.bukkit.event; package org.bukkit.event;
import org.bukkit.Player;
import org.bukkit.Server;
import org.bukkit.event.player.PlayerEvent;
/** /**
* Represents an event * Represents an event
*/ */
public abstract class Event { public abstract class Event {
private final Server server;
private final Type type; private final Type type;
protected Event(final Server instance, final Type type) { protected Event(final Type type) {
server = instance;
this.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 * Gets the Type of this event
* @return Server which this event was triggered on * @return Server which this event was triggered on
@ -79,21 +65,17 @@ public abstract class Event {
/** /**
* Player Events * Player Events
*/ */
LOGINCHECK (Category.PLAYER), PLAYER_JOIN (Category.PLAYER),
JOIN (Category.PLAYER), PLAYER_LOGIN (Category.PLAYER),
CHAT (Category.PLAYER), PLAYER_CHAT (Category.PLAYER),
COMMAND (Category.PLAYER), PLAYER_COMMAND (Category.PLAYER),
SERVERCOMMAND (Category.PLAYER), PLAYER_QUIT (Category.PLAYER),
BAN (Category.PLAYER),
IPBAN (Category.PLAYER),
KICK (Category.PLAYER),
QUIT (Category.PLAYER),
PLAYER_MOVE (Category.PLAYER), PLAYER_MOVE (Category.PLAYER),
ARM_SWING (Category.PLAYER), PLAYER_ANIMATION (Category.PLAYER),
TELEPORT (Category.PLAYER), PLAYER_TELEPORT (Category.PLAYER);
/** /**
* Block Events * Block Events
*/
BLOCK_DESTROYED (Category.BLOCK), BLOCK_DESTROYED (Category.BLOCK),
BLOCK_BROKEN (Category.BLOCK), BLOCK_BROKEN (Category.BLOCK),
BLOCK_PLACE (Category.BLOCK), BLOCK_PLACE (Category.BLOCK),
@ -102,27 +84,27 @@ public abstract class Event {
BLOCK_PHYSICS (Category.BLOCK), BLOCK_PHYSICS (Category.BLOCK),
/** /**
* Item Events * Item Events
*/
ITEM_DROP (Category.ITEM), ITEM_DROP (Category.ITEM),
ITEM_PICK_UP (Category.ITEM), ITEM_PICK_UP (Category.ITEM),
ITEM_USE (Category.ITEM), ITEM_USE (Category.ITEM),
/** /**
* Environment Events * Environment Events
*/
IGNITE (Category.ENVIRONMENT), IGNITE (Category.ENVIRONMENT),
FLOW (Category.ENVIRONMENT), FLOW (Category.ENVIRONMENT),
EXPLODE (Category.ENVIRONMENT), EXPLODE (Category.ENVIRONMENT),
LIQUID_DESTROY (Category.ENVIRONMENT), LIQUID_DESTROY (Category.ENVIRONMENT),
/** /**
* Non-player Entity Events * Non-player Entity Events
*/
MOB_SPAWN (Category.ENTITY), MOB_SPAWN (Category.ENTITY),
DAMAGE (Category.ENTITY), DAMAGE (Category.ENTITY),
HEALTH_CHANGE (Category.ENTITY), HEALTH_CHANGE (Category.ENTITY),
ATTACK (Category.ENTITY), // Need to look into this category more ATTACK (Category.ENTITY), // Need to look into this category more
/** /**
* Vehicle Events * Vehicle Events
*/
VEHICLE_CREATE (Category.VEHICLE), VEHICLE_CREATE (Category.VEHICLE),
VEHICLE_UPDATE (Category.VEHICLE), VEHICLE_UPDATE (Category.VEHICLE),
VEHICLE_DAMAGE (Category.VEHICLE), VEHICLE_DAMAGE (Category.VEHICLE),
@ -132,17 +114,14 @@ public abstract class Event {
VEHICLE_POSITIONCHANGE (Category.VEHICLE), VEHICLE_POSITIONCHANGE (Category.VEHICLE),
/** /**
* Inventory Events * Inventory Events
*/
OPEN_INVENTORY (Category.INVENTORY), OPEN_INVENTORY (Category.INVENTORY),
/** /**
* Sign Events (Item events??) * Sign Events (Item events??)
*/
SIGN_SHOW (Category.SIGN), SIGN_SHOW (Category.SIGN),
SIGN_CHANGE (Category.SIGN), SIGN_CHANGE (Category.SIGN);
/** */
* Custom Event Placeholder?
*/
CUSTOM_EVENT (Category.CUSTOM);
private Category category; private Category category;

View File

@ -1,47 +1,47 @@
package org.bukkit.event; package org.bukkit.event;
public class EventException extends Exception { public class EventException extends Exception {
private final Throwable cause; private final Throwable cause;
/** /**
* Constructs a new EventException based on the given Exception * Constructs a new EventException based on the given Exception
* *
* @param throwable Exception that triggered this Exception * @param throwable Exception that triggered this Exception
*/ */
public EventException(Throwable throwable) { public EventException(Throwable throwable) {
cause = throwable; cause = throwable;
} }
/** /**
* Constructs a new EventException * Constructs a new EventException
*/ */
public EventException() { public EventException() {
cause = null; cause = null;
} }
/** /**
* Constructs a new EventException with the given message * Constructs a new EventException with the given message
*/ */
public EventException(Throwable cause, String message) { public EventException(Throwable cause, String message) {
super(message); super(message);
this.cause = cause; this.cause = cause;
} }
/** /**
* Constructs a new EventException with the given message * Constructs a new EventException with the given message
*/ */
public EventException(String message) { public EventException(String message) {
super(message); super(message);
cause = null; cause = null;
} }
/** /**
* If applicable, returns the Exception that triggered this Exception * If applicable, returns the Exception that triggered this Exception
* *
* @return Inner exception, or null if one does not exist * @return Inner exception, or null if one does not exist
*/ */
@Override @Override
public Throwable getCause() { public Throwable getCause() {
return cause; return cause;
} }
} }

View File

@ -2,7 +2,6 @@
package org.bukkit.event.player; package org.bukkit.event.player;
import org.bukkit.Player; import org.bukkit.Player;
import org.bukkit.Server;
import org.bukkit.event.Event; import org.bukkit.event.Event;
/** /**
@ -11,8 +10,8 @@ import org.bukkit.event.Event;
public class PlayerEvent extends Event { public class PlayerEvent extends Event {
private final Player player; private final Player player;
public PlayerEvent(final Server server, Event.Type type, final Player who) { public PlayerEvent(final Event.Type type, final Player who) {
super(server, type); super(type);
player = who; player = who;
} }