Whitespace + general cleanup

By: Erik Broes <erikbroes@grum.nl>
This commit is contained in:
Bukkit/Spigot
2011-05-14 23:22:54 +02:00
parent 8217ff1836
commit 855f4133b6
216 changed files with 1649 additions and 1637 deletions

View File

@@ -31,7 +31,9 @@ public abstract class Event implements Serializable {
}
private void exAssert(boolean b, String s) {
if(!b) throw new IllegalArgumentException(s);
if (!b) {
throw new IllegalArgumentException(s);
}
}
/**
@@ -40,40 +42,36 @@ public abstract class Event implements Serializable {
* @return Name of this event
*/
public final String getEventName() {
return ( type != Type.CUSTOM_EVENT) ? type.toString() : name;
return (type != Type.CUSTOM_EVENT) ? type.toString() : name;
}
/**
* Represents an events priority in execution
*/
public enum Priority {
/**
* Event call is of very low importance and should be ran first, to allow
* other plugins to further customise the outcome
*/
Lowest,
/**
* Event call is of low importance
*/
Low,
/**
* Event call is neither important or unimportant, and may be ran normally
*/
Normal,
/**
* Event call is of high importance
*/
High,
/**
* Event call is critical and must have the final say in what happens
* to the event
*/
Highest,
/**
* Event is listened to purely for monitoring the outcome of an event.
*
@@ -86,52 +84,44 @@ public abstract class Event implements Serializable {
* Represents a category used by Type
*/
public enum Category {
/**
* Represents Player-based events
* @see Category.LIVING_ENTITY
*/
PLAYER,
/**
* Represents Entity-based events
*/
ENTITY,
/**
* Represents Block-based events
*/
BLOCK,
/**
* Represents LivingEntity-based events
*/
LIVING_ENTITY,
/**
* Represents Weather-based events
*/
WEATHER,
/**
* Vehicle-based events
*/
VEHICLE,
/**
* Represents World-based events
*/
WORLD,
/**
* Represents Server and Plugin based events
*/
SERVER,
/**
* Represents Inventory-based events
*/
INVENTORY,
/**
* Any miscellaneous events
*/
@@ -144,6 +134,7 @@ public abstract class Event implements Serializable {
* @see org.bukkit.event.
*/
public enum Type {
/**
* PLAYER EVENTS
*/
@@ -154,154 +145,132 @@ public abstract class Event implements Serializable {
* @see org.bukkit.event.player.PlayerEvent
*/
PLAYER_JOIN (Category.PLAYER),
/**
* Called when a player is attempting to connect to the server
*
* @see org.bukkit.event.player.PlayerLoginEvent
*/
PLAYER_LOGIN (Category.PLAYER),
/**
* Called when a player has just been authenticated
*
* @see org.bukkit.event.player.PlayerPreLoginEvent
*/
PLAYER_PRELOGIN (Category.PLAYER),
/**
* Called when a player respawns
*
* @see org.bukkit.event.player.PlayerEvent
*/
PLAYER_RESPAWN (Category.PLAYER),
/**
* Called when a player gets kicked a server
*
* @see org.bukkit.event.player.PlayerEvent
*/
PLAYER_KICK (Category.PLAYER),
/**
* Called when a player sends a chat message
*
* @see org.bukkit.event.player.PlayerChatEvent
*/
PLAYER_CHAT (Category.PLAYER),
/**
* Called when a player early in the command handling process
*
* @see org.bukkit.event.player.PlayerChatEvent
*/
PLAYER_COMMAND_PREPROCESS (Category.PLAYER),
/**
* Called when a player leaves a server
*
* @see org.bukkit.event.player.PlayerEvent
*/
PLAYER_QUIT (Category.PLAYER),
/**
* Called when a player moves position in the world
*
* @see org.bukkit.event.player.PlayerMoveEvent
*/
PLAYER_MOVE (Category.PLAYER),
/**
* Called when a player undergoes an animation, such as arm swinging
*
* @see org.bukkit.event.player.PlayerAnimationEvent
*/
PLAYER_ANIMATION (Category.PLAYER),
/**
* Called when a player toggles sneak mode
*
* @todo: add javadoc see comment
*/
PLAYER_TOGGLE_SNEAK (Category.PLAYER),
/**
* Called when a player uses an item
*
* @see org.bukkit.event.player.PlayerItemEvent
*/
PLAYER_INTERACT (Category.PLAYER),
/**
* Called when a player right clicks an entity
*
* @see org.bukkit.event.player.PlayerInteractEntityEvent
*/
PLAYER_INTERACT_ENTITY (Category.PLAYER),
/**
* Called when a player throws an egg and it might hatch
*
* @see org.bukkit.event.player.PlayerEggThrowEvent
*/
PLAYER_EGG_THROW (Category.PLAYER),
/**
* Called when a player teleports from one position to another
*
* @see org.bukkit.event.player.PlayerMoveEvent
*/
PLAYER_TELEPORT (Category.PLAYER),
/**
* Called when a player changes their held item
*
* @see org.bukkit.event.player.PlayerItemHeldEvent
*/
PLAYER_ITEM_HELD (Category.PLAYER),
/**
* Called when a player drops an item
*
* @see org.bukkit.event.player.PlayerDropItemEvent
*/
PLAYER_DROP_ITEM (Category.PLAYER),
/**
* Called when a player picks an item up off the ground
*
* @see org.bukkit.event.player.PlayerPickupItemEvent
*/
PLAYER_PICKUP_ITEM (Category.PLAYER),
/**
* Called when a player empties a bucket
*
* @see org.bukkit.event.player.PlayerBucketEmptyEvent
*/
PLAYER_BUCKET_EMPTY(Category.PLAYER),
/**
* Called when a player fills a bucket
*
* @see org.bukkit.event.player.PlayerBucketFillEvent
*/
PLAYER_BUCKET_FILL(Category.PLAYER),
/**
* Called when a player interacts with the inventory
*
* @see org.bukkit.event.player.PlayerInventoryEvent
*/
PLAYER_INVENTORY(Category.PLAYER),
/**
* Called when a player enter a bed
*
* @see org.bukkit.event.player.PlayerBedEnterEvent
*/
PLAYER_BED_ENTER(Category.PLAYER),
/**
* Called when a player leaves a bed
*
@@ -319,7 +288,6 @@ public abstract class Event implements Serializable {
* @see org.bukkit.event.block.BlockDamageEvent
*/
BLOCK_DAMAGE (Category.BLOCK),
/**
* Called when a block is undergoing a universe physics
* check on whether it can be built
@@ -329,7 +297,6 @@ public abstract class Event implements Serializable {
* @see org.bukkit.event.block.BlockCanBuildEvent
*/
BLOCK_CANBUILD (Category.BLOCK),
/**
* Called when a block of water or lava attempts to flow into another
* block
@@ -337,7 +304,6 @@ public abstract class Event implements Serializable {
* @see org.bukkit.event.block.BlockFromToEvent
*/
BLOCK_FROMTO (Category.BLOCK),
/**
* Called when a block is being set on fire from another block, such as
* an adjacent block of fire attempting to set fire to wood
@@ -345,7 +311,6 @@ public abstract class Event implements Serializable {
* @see org.bukkit.event.block.BlockIgniteEvent
*/
BLOCK_IGNITE (Category.BLOCK),
/**
* Called when a block undergoes a physics check
*
@@ -355,42 +320,36 @@ public abstract class Event implements Serializable {
* @see org.bukkit.event.block.BlockPhysicsEvent
*/
BLOCK_PHYSICS (Category.BLOCK),
/**
* Called when a player is attempting to place a block
*
* @see org.bukkit.event.block.BlockPlaceEvent
*/
BLOCK_PLACE (Category.BLOCK),
/**
* Called when a block dispenses something
*
* @see org.bukkit.event.block.BlockPlaceEvent
*/
BLOCK_DISPENSE (Category.BLOCK),
/**
* Called when a block is destroyed from being burnt by fire
*
* @see org.bukkit.event.block.BlockBurnEvent
*/
BLOCK_BURN (Category.BLOCK),
/**
* Called when leaves are decaying naturally
*
* @see org.bukkit.event.block.LeavesDecayEvent
*/
LEAVES_DECAY (Category.BLOCK),
/**
* Called when a sign is changed
*
* @see org.bukkit.event.block.SignChangeEvent
*/
SIGN_CHANGE (Category.BLOCK),
/**
* Called when a block changes redstone current. Only triggered on blocks
* that are actually capable of transmitting or carrying a redstone
@@ -399,14 +358,12 @@ public abstract class Event implements Serializable {
* @see org.bukkit.event.block.BlockFromToEvent
*/
REDSTONE_CHANGE (Category.BLOCK),
/**
* Called when a block is destroyed by a player.
*
* @see org.bukkit.event.block.BlockBreakEvent
*/
BLOCK_BREAK (Category.BLOCK),
/**
* Called when world attempts to place a snow block during a snowfall
*
@@ -424,28 +381,24 @@ public abstract class Event implements Serializable {
* @todo: add javadoc see comment
*/
INVENTORY_OPEN (Category.INVENTORY),
/**
* Called when a player closes an inventory
*
* @todo: add javadoc see comment
*/
INVENTORY_CLOSE (Category.INVENTORY),
/**
* Called when a player clicks on an inventory slot
*
* @todo: add javadoc see comment
*/
INVENTORY_CLICK (Category.INVENTORY),
/**
* Called when an inventory slot changes values or type
*
* @todo: add javadoc see comment
*/
INVENTORY_CHANGE (Category.INVENTORY),
/**
* Called when a player is attempting to perform an inventory transaction
*
@@ -463,14 +416,12 @@ public abstract class Event implements Serializable {
* @see org.bukkit.event.server.PluginEvent
*/
PLUGIN_ENABLE (Category.SERVER),
/**
* Called when a plugin is disabled
*
* @see org.bukkit.event.server.PluginEvent
*/
PLUGIN_DISABLE (Category.SERVER),
/**
* Called when a server command is called
*
@@ -491,41 +442,35 @@ public abstract class Event implements Serializable {
* @see org.bukkit.event.world.ChunkLoadEvent
*/
CHUNK_LOAD (Category.WORLD),
/**
* Called when a chunk is unloaded
*
* @see org.bukkit.event.world.ChunkUnloadEvent
*/
CHUNK_UNLOAD (Category.WORLD),
/**
* Called when a chunk needs to be generated
*
* @todo: add javadoc see comment
*/
CHUNK_GENERATION (Category.WORLD),
/**
* Called when an ItemEntity spawns in the world
*
* @todo: add javadoc see comment
*/
ITEM_SPAWN (Category.WORLD),
/**
* Called when a World's spawn is changed
*
* @see org.bukkit.event.world.SpawnChangeEvent
*/
SPAWN_CHANGE (Category.WORLD),
/**
* Called when a world is saved
*
*/
WORLD_SAVE (Category.WORLD),
/**
* Called when a World is loaded
*/
@@ -541,7 +486,6 @@ public abstract class Event implements Serializable {
* @see org.bukkit.event.painting.PaintingCreateEvent
*/
PAINTING_PLACE (Category.ENTITY),
/**
* Called when a painting is removed
*
@@ -560,35 +504,30 @@ public abstract class Event implements Serializable {
* @todo: add javadoc see comment
*/
CREATURE_SPAWN (Category.LIVING_ENTITY),
/**
* Called when a LivingEntity is damaged with no source.
*
* @see org.bukkit.event.entity.EntityDamageEvent
*/
ENTITY_DAMAGE (Category.LIVING_ENTITY),
/**
* Called when a LivingEntity dies
*
* @todo: add javadoc see comment
*/
ENTITY_DEATH (Category.LIVING_ENTITY),
/**
* Called when a Skeleton or Zombie catch fire due to the sun
*
* @todo: add javadoc see comment
*/
ENTITY_COMBUST (Category.LIVING_ENTITY),
/**
* Called when an entity explodes, either TNT, Creeper, or Ghast Fireball
*
* @todo: add javadoc see comment
*/
ENTITY_EXPLODE (Category.LIVING_ENTITY),
/**
* Called when an entity has made a decision to explode.
*
@@ -602,14 +541,12 @@ public abstract class Event implements Serializable {
* @see org.bukkit.event.entity.EntityExplodeTriggerEvent
*/
EXPLOSION_PRIME (Category.LIVING_ENTITY),
/**
* Called when an entity targets another entity
*
* @see org.bukkit.event.entity.EntityTargetEvent
*/
ENTITY_TARGET (Category.LIVING_ENTITY),
/**
* Called when an entity interacts with a block
* This event specifically excludes player entities
@@ -617,14 +554,12 @@ public abstract class Event implements Serializable {
* @see org.bukkit.event.entity.EntityInteractEvent
*/
ENTITY_INTERACT (Category.LIVING_ENTITY),
/**
* Called when a creeper gains or loses a power shell
*
* @see org.bukkit.event.entity.CreeperPowerEvent
*/
CREEPER_POWER (Category.LIVING_ENTITY),
/**
* Called when a pig is zapped, zombifying it
*
@@ -642,14 +577,12 @@ public abstract class Event implements Serializable {
* @see org.bukkit.event.weather.LightningStrikeEvent
*/
LIGHTNING_STRIKE (Category.WEATHER),
/**
* Called when the weather in a world changes
*
* @see org.bukkit.event.weather.WeatherChangeEvent
*/
WEATHER_CHANGE (Category.WEATHER),
/**
* Called when the thunder state in a world changes
*
@@ -667,63 +600,54 @@ public abstract class Event implements Serializable {
* @see org.bukkit.event.vehicle.VehicleCreateEvent
*/
VEHICLE_CREATE (Category.VEHICLE),
/**
* Called when a vehicle is destroyed
*
* @see org.bukkit.event.vehicle.VehicleDestroyEvent
*/
VEHICLE_DESTROY (Category.VEHICLE),
/**
* Called when a vehicle is damaged by a LivingEntity
*
* @see org.bukkit.event.vehicle.VehicleDamageEvent
*/
VEHICLE_DAMAGE (Category.VEHICLE),
/**
* Called when a vehicle collides with an Entity
*
* @see org.bukkit.event.vehicle.VehicleCollisionEvent
*/
VEHICLE_COLLISION_ENTITY (Category.VEHICLE),
/**
* Called when a vehicle collides with a Block
*
* @see org.bukkit.event.vehicle.VehicleBlockCollisionEvent
*/
VEHICLE_COLLISION_BLOCK (Category.VEHICLE),
/**
* Called when a vehicle is entered by a LivingEntity
*
* @see org.bukkit.event.vehicle.VehicleEnterEvent
*/
VEHICLE_ENTER (Category.VEHICLE),
/**
* Called when a vehicle is exited by a LivingEntity
*
* @see org.bukkit.event.vehicle.VehicleExitEvent
*/
VEHICLE_EXIT (Category.VEHICLE),
/**
* Called when a vehicle moves position in the world
*
* @see org.bukkit.event.vehicle.VehicleMoveEvent
*/
VEHICLE_MOVE (Category.VEHICLE),
/**
* Called when a vehicle is going through an update cycle, rechecking itself
*
* @see org.bukkit.event.vehicle.VehicleUpdateEvent
*/
VEHICLE_UPDATE (Category.VEHICLE),
/**
* MISCELLANEOUS EVENTS
*/
@@ -750,19 +674,18 @@ public abstract class Event implements Serializable {
}
public enum Result {
/**
* Deny the event.
* Depending on the event, the action indicated by the event will either not take place or will be reverted.
* Some actions may not be denied.
*/
DENY,
/**
* Neither deny nor allow the event.
* The server will proceed with its normal handling.
*/
DEFAULT,
/**
* Allow / Force the event.
* The action indicated by the event will take place if possible, even if the server would not normally allow the action.