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;
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;

View file

@ -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;
}
}

View file

@ -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;
}