@@ -6,14 +6,12 @@ import org.bukkit.event.Listener;
|
||||
* Handles all custom events
|
||||
*/
|
||||
public class CustomEventListener implements Listener {
|
||||
public CustomEventListener() {
|
||||
}
|
||||
public CustomEventListener() {}
|
||||
|
||||
/**
|
||||
* Called when a player joins a server
|
||||
*
|
||||
* @param event Relevant event details
|
||||
*/
|
||||
public void onCustomEvent(Event event) {
|
||||
}
|
||||
}
|
||||
public void onCustomEvent(Event event) {}
|
||||
}
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -1,9 +1,6 @@
|
||||
|
||||
package org.bukkit.event;
|
||||
|
||||
/**
|
||||
* Simple interface for tagging all EventListeners
|
||||
*/
|
||||
public interface Listener {
|
||||
|
||||
}
|
||||
public interface Listener {}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package org.bukkit.event.block;
|
||||
|
||||
public enum Action {
|
||||
|
||||
/**
|
||||
* Left-clicking a block
|
||||
*/
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
|
||||
|
||||
package org.bukkit.event.block;
|
||||
|
||||
import org.bukkit.block.Block;
|
||||
|
||||
@@ -39,7 +39,7 @@ public class BlockDamageEvent extends BlockEvent implements Cancellable {
|
||||
public boolean getInstaBreak() {
|
||||
return instaBreak;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set if the block should instantly break
|
||||
*/
|
||||
@@ -49,13 +49,12 @@ public class BlockDamageEvent extends BlockEvent implements Cancellable {
|
||||
|
||||
/**
|
||||
* Returns the ItemStack in hand
|
||||
*
|
||||
*
|
||||
* @return Currently wielding itemstack
|
||||
*/
|
||||
public ItemStack getItemInHand() {
|
||||
return itemstack;
|
||||
}
|
||||
|
||||
|
||||
public boolean isCancelled() {
|
||||
return cancel;
|
||||
|
||||
@@ -7,15 +7,15 @@ import org.bukkit.util.Vector;
|
||||
|
||||
/**
|
||||
* Event called on dispense of an item from a block.
|
||||
*
|
||||
*
|
||||
* @author sk89q
|
||||
*/
|
||||
public class BlockDispenseEvent extends BlockEvent implements Cancellable {
|
||||
|
||||
|
||||
private boolean cancelled = false;
|
||||
private ItemStack item;
|
||||
private Vector velocity;
|
||||
|
||||
|
||||
public BlockDispenseEvent(Block block, ItemStack dispensed, Vector velocity) {
|
||||
super(Type.BLOCK_DISPENSE, block);
|
||||
this.item = dispensed;
|
||||
@@ -25,7 +25,7 @@ public class BlockDispenseEvent extends BlockEvent implements Cancellable {
|
||||
/**
|
||||
* Get the item that is being dispensed. Modifying the returned item
|
||||
* will have no effect.
|
||||
*
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public ItemStack getItem() {
|
||||
@@ -34,26 +34,26 @@ public class BlockDispenseEvent extends BlockEvent implements Cancellable {
|
||||
|
||||
/**
|
||||
* Set the item being dispensed.
|
||||
*
|
||||
*
|
||||
* @param item
|
||||
*/
|
||||
public void setItem(ItemStack item) {
|
||||
this.item = item;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the velocity. Modifying the returned Vector will not
|
||||
* change the velocity.
|
||||
*
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public Vector getVelocity() {
|
||||
return velocity.clone();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set the velocity.
|
||||
*
|
||||
*
|
||||
* @param vel
|
||||
*/
|
||||
public void setVelocity(Vector vel) {
|
||||
@@ -73,5 +73,4 @@ public class BlockDispenseEvent extends BlockEvent implements Cancellable {
|
||||
public void setCancelled(boolean cancel) {
|
||||
cancelled = cancel;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ public class BlockFromToEvent extends BlockEvent implements Cancellable {
|
||||
|
||||
/**
|
||||
* Convenience method for getting the faced block
|
||||
*
|
||||
*
|
||||
* @return Block the faced block
|
||||
*/
|
||||
public Block getToBlock() {
|
||||
|
||||
@@ -55,8 +55,7 @@ public class BlockIgniteEvent extends BlockEvent implements Cancellable {
|
||||
* Gets the cause of block ignite.
|
||||
* @return An IgniteCause value detailing the cause of block ignition.
|
||||
*/
|
||||
public IgniteCause getCause()
|
||||
{
|
||||
public IgniteCause getCause() {
|
||||
return cause;
|
||||
}
|
||||
|
||||
@@ -73,6 +72,7 @@ public class BlockIgniteEvent extends BlockEvent implements Cancellable {
|
||||
* An enum to specify the cause of the ignite
|
||||
*/
|
||||
public enum IgniteCause {
|
||||
|
||||
/**
|
||||
* Block ignition caused by lava.
|
||||
*/
|
||||
@@ -90,5 +90,4 @@ public class BlockIgniteEvent extends BlockEvent implements Cancellable {
|
||||
*/
|
||||
LIGHTNING,
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -9,25 +9,23 @@ import org.bukkit.plugin.AuthorNagException;
|
||||
* @author durron597
|
||||
*/
|
||||
public class BlockListener implements Listener {
|
||||
|
||||
/**
|
||||
* Default Constructor
|
||||
*/
|
||||
public BlockListener() {
|
||||
}
|
||||
public BlockListener() {}
|
||||
|
||||
/**
|
||||
* Called when a block is damaged (or broken)
|
||||
*
|
||||
* @param event Relevant event details
|
||||
*/
|
||||
public void onBlockDamage(BlockDamageEvent event) {
|
||||
}
|
||||
public void onBlockDamage(BlockDamageEvent event) {}
|
||||
|
||||
/**
|
||||
* Called when we try to place a block, to see if we can build it
|
||||
*/
|
||||
public void onBlockCanBuild(BlockCanBuildEvent event) {
|
||||
}
|
||||
public void onBlockCanBuild(BlockCanBuildEvent event) {}
|
||||
|
||||
/**
|
||||
* Called when a block flows (water/lava)
|
||||
@@ -48,24 +46,21 @@ public class BlockListener implements Listener {
|
||||
*
|
||||
* @param event Relevant event details
|
||||
*/
|
||||
public void onBlockIgnite(BlockIgniteEvent event) {
|
||||
}
|
||||
public void onBlockIgnite(BlockIgniteEvent event) {}
|
||||
|
||||
/**
|
||||
* Called when block physics occurs
|
||||
*
|
||||
* @param event Relevant event details
|
||||
*/
|
||||
public void onBlockPhysics(BlockPhysicsEvent event) {
|
||||
}
|
||||
public void onBlockPhysics(BlockPhysicsEvent event) {}
|
||||
|
||||
/**
|
||||
* Called when a player places a block
|
||||
*
|
||||
* @param event Relevant event details
|
||||
*/
|
||||
public void onBlockPlace(BlockPlaceEvent event) {
|
||||
}
|
||||
public void onBlockPlace(BlockPlaceEvent event) {}
|
||||
|
||||
/**
|
||||
* Called when redstone changes
|
||||
@@ -74,54 +69,47 @@ public class BlockListener implements Listener {
|
||||
*
|
||||
* @param event Relevant event details
|
||||
*/
|
||||
public void onBlockRedstoneChange(BlockRedstoneEvent event) {
|
||||
}
|
||||
public void onBlockRedstoneChange(BlockRedstoneEvent event) {}
|
||||
|
||||
/**
|
||||
* Called when leaves are decaying naturally
|
||||
*
|
||||
* @param event Relevant event details
|
||||
*/
|
||||
public void onLeavesDecay(LeavesDecayEvent event) {
|
||||
}
|
||||
public void onLeavesDecay(LeavesDecayEvent event) {}
|
||||
|
||||
/**
|
||||
* Called when a sign is changed
|
||||
*
|
||||
* @param event Relevant event details
|
||||
*/
|
||||
public void onSignChange(SignChangeEvent event) {
|
||||
}
|
||||
public void onSignChange(SignChangeEvent event) {}
|
||||
|
||||
/**
|
||||
* Called when a block is destroyed from burning
|
||||
*
|
||||
* @param event Relevant event details
|
||||
*/
|
||||
public void onBlockBurn(BlockBurnEvent event) {
|
||||
}
|
||||
public void onBlockBurn(BlockBurnEvent event) {}
|
||||
|
||||
/**
|
||||
* Called when a block is destroyed by a player.
|
||||
*
|
||||
* @param event Relevant event details
|
||||
*/
|
||||
public void onBlockBreak(BlockBreakEvent event) {
|
||||
}
|
||||
public void onBlockBreak(BlockBreakEvent event) {}
|
||||
|
||||
/**
|
||||
* Called when a world is attempting to place a block during a snowfall
|
||||
*
|
||||
* @param event Relevant event details
|
||||
*/
|
||||
public void onSnowForm(SnowFormEvent event) {
|
||||
}
|
||||
|
||||
public void onSnowForm(SnowFormEvent event) {}
|
||||
|
||||
/**
|
||||
* Called when a block is dispensing an item
|
||||
*
|
||||
*
|
||||
* @param event Relevant event details
|
||||
*/
|
||||
public void onBlockDispense(BlockDispenseEvent event) {
|
||||
}
|
||||
public void onBlockDispense(BlockDispenseEvent event) {}
|
||||
}
|
||||
|
||||
@@ -75,7 +75,6 @@ public class BlockPlaceEvent extends BlockEvent implements Cancellable {
|
||||
return this.replacedBlockState;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the block that this block was placed against
|
||||
*
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
package org.bukkit.event.block;
|
||||
|
||||
import org.bukkit.block.Block;
|
||||
@@ -42,5 +41,4 @@ public class BlockRedstoneEvent extends BlockEvent {
|
||||
public void setNewCurrent(int newCurrent) {
|
||||
this.newCurrent = newCurrent;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
package org.bukkit.event.block;
|
||||
|
||||
import org.bukkit.block.Block;
|
||||
|
||||
@@ -23,7 +23,7 @@ public class SnowFormEvent extends BlockEvent implements Cancellable {
|
||||
*
|
||||
* @return the material being placed by a snowfall
|
||||
*/
|
||||
public Material getMaterial(){
|
||||
public Material getMaterial() {
|
||||
return material;
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@ public class SnowFormEvent extends BlockEvent implements Cancellable {
|
||||
*
|
||||
* @param material the material to be placed during a snowfall
|
||||
*/
|
||||
public void setMaterial(Material material){
|
||||
public void setMaterial(Material material) {
|
||||
this.material = material;
|
||||
}
|
||||
|
||||
@@ -41,7 +41,7 @@ public class SnowFormEvent extends BlockEvent implements Cancellable {
|
||||
*
|
||||
* @return the data of the block being placed by a snowfall
|
||||
*/
|
||||
public byte getData(){
|
||||
public byte getData() {
|
||||
return data;
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@ public class SnowFormEvent extends BlockEvent implements Cancellable {
|
||||
*
|
||||
* @param data
|
||||
*/
|
||||
public void setData(byte data){
|
||||
public void setData(byte data) {
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
@@ -73,4 +73,4 @@ public class SnowFormEvent extends BlockEvent implements Cancellable {
|
||||
public void setCancelled(boolean cancel) {
|
||||
this.cancel = cancel;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -56,4 +56,4 @@ public class CreatureSpawnEvent extends EntityEvent implements Cancellable {
|
||||
public CreatureType getCreatureType() {
|
||||
return creatureType;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -56,34 +56,33 @@ public class CreeperPowerEvent extends EntityEvent implements Cancellable {
|
||||
return bolt;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the cause of the creeper being (un)powered.
|
||||
* @return A PowerCause value detailing the cause of change in power.
|
||||
*/
|
||||
/**
|
||||
* Gets the cause of the creeper being (un)powered.
|
||||
* @return A PowerCause value detailing the cause of change in power.
|
||||
*/
|
||||
public PowerCause getCause() {
|
||||
return cause;
|
||||
}
|
||||
|
||||
/**
|
||||
* An enum to specify the cause of the change in power
|
||||
*/
|
||||
public enum PowerCause {
|
||||
/**
|
||||
* Power change caused by a lightning bolt
|
||||
* Powered state: true
|
||||
*/
|
||||
LIGHTNING,
|
||||
/**
|
||||
* An enum to specify the cause of the change in power
|
||||
*/
|
||||
public enum PowerCause {
|
||||
|
||||
/**
|
||||
* Power change caused by something else (probably a plugin)
|
||||
* Powered state: true
|
||||
*/
|
||||
SET_ON,
|
||||
|
||||
/**
|
||||
* Power change caused by something else (probably a plugin)
|
||||
* Powered state: false
|
||||
*/
|
||||
SET_OFF
|
||||
}
|
||||
/**
|
||||
* Power change caused by a lightning bolt
|
||||
* Powered state: true
|
||||
*/
|
||||
LIGHTNING,
|
||||
/**
|
||||
* Power change caused by something else (probably a plugin)
|
||||
* Powered state: true
|
||||
*/
|
||||
SET_ON,
|
||||
/**
|
||||
* Power change caused by something else (probably a plugin)
|
||||
* Powered state: false
|
||||
*/
|
||||
SET_OFF
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,9 +20,7 @@ public class EntityDamageByBlockEvent extends EntityDamageEvent implements Cance
|
||||
* Returns the block that damaged the player.
|
||||
* @return Block that damaged the player
|
||||
*/
|
||||
public Block getDamager()
|
||||
{
|
||||
public Block getDamager() {
|
||||
return damager;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -19,9 +19,7 @@ public class EntityDamageByEntityEvent extends EntityDamageEvent implements Canc
|
||||
* Returns the entity that damaged the defender.
|
||||
* @return Entity that damaged the defender.
|
||||
*/
|
||||
public Entity getDamager()
|
||||
{
|
||||
public Entity getDamager() {
|
||||
return damager;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -13,6 +13,7 @@ public class EntityDamageByProjectileEvent extends EntityDamageByEntityEvent {
|
||||
super(damager, damagee, cause, damage);
|
||||
this.projectile = projectile;
|
||||
Random random = new Random();
|
||||
|
||||
this.bounce = random.nextBoolean();
|
||||
}
|
||||
|
||||
@@ -24,12 +25,11 @@ public class EntityDamageByProjectileEvent extends EntityDamageByEntityEvent {
|
||||
return projectile;
|
||||
}
|
||||
|
||||
public void setBounce(boolean bounce){
|
||||
public void setBounce(boolean bounce) {
|
||||
this.bounce = bounce;
|
||||
}
|
||||
|
||||
public boolean getBounce(){
|
||||
public boolean getBounce() {
|
||||
return bounce;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -13,15 +13,13 @@ public class EntityDamageEvent extends EntityEvent implements Cancellable {
|
||||
private boolean cancelled;
|
||||
private DamageCause cause;
|
||||
|
||||
public EntityDamageEvent(Entity damagee, DamageCause cause, int damage)
|
||||
{
|
||||
public EntityDamageEvent(Entity damagee, DamageCause cause, int damage) {
|
||||
super(Event.Type.ENTITY_DAMAGE, damagee);
|
||||
this.cause = cause;
|
||||
this.damage = damage;
|
||||
}
|
||||
|
||||
protected EntityDamageEvent(Event.Type type, Entity damagee, DamageCause cause, int damage)
|
||||
{
|
||||
protected EntityDamageEvent(Event.Type type, Entity damagee, DamageCause cause, int damage) {
|
||||
super(type, damagee);
|
||||
this.cause = cause;
|
||||
this.damage = damage;
|
||||
@@ -57,8 +55,7 @@ public class EntityDamageEvent extends EntityEvent implements Cancellable {
|
||||
* Gets the amount of damage caused by the Block
|
||||
* @return The amount of damage caused by the Block
|
||||
*/
|
||||
public int getDamage()
|
||||
{
|
||||
public int getDamage() {
|
||||
return damage;
|
||||
}
|
||||
|
||||
@@ -74,16 +71,15 @@ public class EntityDamageEvent extends EntityEvent implements Cancellable {
|
||||
* Gets the cause of the damage.
|
||||
* @return A DamageCause value detailing the cause of the damage.
|
||||
*/
|
||||
public DamageCause getCause()
|
||||
{
|
||||
public DamageCause getCause() {
|
||||
return cause;
|
||||
}
|
||||
|
||||
/**
|
||||
* An enum to specify the cause of the damage
|
||||
*/
|
||||
public enum DamageCause
|
||||
{
|
||||
public enum DamageCause {
|
||||
|
||||
/**
|
||||
* Damage caused when an entity contacts a block such as a Cactus.
|
||||
*
|
||||
@@ -152,7 +148,7 @@ public class EntityDamageEvent extends EntityEvent implements Cancellable {
|
||||
VOID,
|
||||
/**
|
||||
* Damage caused by being struck by lightning
|
||||
*
|
||||
*
|
||||
* Damage: 5
|
||||
*/
|
||||
LIGHTNING,
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
package org.bukkit.event.entity;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -9,8 +9,7 @@ import org.bukkit.event.Event;
|
||||
public class EntityEvent extends Event {
|
||||
protected Entity entity;
|
||||
|
||||
public EntityEvent(final Event.Type type, final Entity what)
|
||||
{
|
||||
public EntityEvent(final Event.Type type, final Entity what) {
|
||||
super(type);
|
||||
entity = what;
|
||||
}
|
||||
@@ -19,8 +18,7 @@ public class EntityEvent extends Event {
|
||||
* Returns the Entity involved in this event
|
||||
* @return Entity who is involved in this event
|
||||
*/
|
||||
public final Entity getEntity()
|
||||
{
|
||||
public final Entity getEntity() {
|
||||
return entity;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
package org.bukkit.event.entity;
|
||||
|
||||
import java.util.List;
|
||||
@@ -17,7 +16,7 @@ public class EntityExplodeEvent extends EntityEvent implements Cancellable {
|
||||
private List<Block> blocks;
|
||||
private float yield = 0.3F;
|
||||
|
||||
public EntityExplodeEvent (Entity what, Location location, List<Block> blocks) {
|
||||
public EntityExplodeEvent(Entity what, Location location, List<Block> blocks) {
|
||||
super(Type.ENTITY_EXPLODE, what);
|
||||
this.location = location;
|
||||
this.cancel = false;
|
||||
@@ -51,12 +50,12 @@ public class EntityExplodeEvent extends EntityEvent implements Cancellable {
|
||||
|
||||
/**
|
||||
* Returns the percentage of blocks to drop from this explosion
|
||||
* @return
|
||||
* @return
|
||||
*/
|
||||
public float getYield() {
|
||||
return yield;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets the percentage of blocks to drop from this explosion
|
||||
*/
|
||||
|
||||
@@ -11,7 +11,7 @@ import org.bukkit.event.Cancellable;
|
||||
*/
|
||||
public class EntityInteractEvent extends EntityEvent implements Cancellable {
|
||||
protected Block block;
|
||||
|
||||
|
||||
private boolean cancelled;
|
||||
|
||||
public EntityInteractEvent(Entity entity, Block block) {
|
||||
@@ -51,4 +51,4 @@ public class EntityInteractEvent extends EntityEvent implements Cancellable {
|
||||
public Block getBlock() {
|
||||
return block;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,42 +8,29 @@ import org.bukkit.event.painting.PaintingBreakEvent;
|
||||
* Handles all events fired in relation to entities
|
||||
*/
|
||||
public class EntityListener implements Listener {
|
||||
public EntityListener() {
|
||||
}
|
||||
public EntityListener() {}
|
||||
|
||||
public void onCreatureSpawn(CreatureSpawnEvent event) {
|
||||
}
|
||||
public void onCreatureSpawn(CreatureSpawnEvent event) {}
|
||||
|
||||
public void onEntityCombust(EntityCombustEvent event) {
|
||||
}
|
||||
public void onEntityCombust(EntityCombustEvent event) {}
|
||||
|
||||
public void onEntityDamage(EntityDamageEvent event) {
|
||||
}
|
||||
public void onEntityDamage(EntityDamageEvent event) {}
|
||||
|
||||
public void onEntityExplode(EntityExplodeEvent event) {
|
||||
}
|
||||
public void onEntityExplode(EntityExplodeEvent event) {}
|
||||
|
||||
public void onExplosionPrime(ExplosionPrimeEvent event) {
|
||||
}
|
||||
public void onExplosionPrime(ExplosionPrimeEvent event) {}
|
||||
|
||||
public void onEntityDeath(EntityDeathEvent event) {
|
||||
}
|
||||
public void onEntityDeath(EntityDeathEvent event) {}
|
||||
|
||||
public void onEntityTarget(EntityTargetEvent event) {
|
||||
}
|
||||
public void onEntityTarget(EntityTargetEvent event) {}
|
||||
|
||||
public void onEntityInteract(EntityInteractEvent event) {
|
||||
}
|
||||
public void onEntityInteract(EntityInteractEvent event) {}
|
||||
|
||||
public void onPaintingPlace(PaintingPlaceEvent event){
|
||||
}
|
||||
public void onPaintingPlace(PaintingPlaceEvent event) {}
|
||||
|
||||
public void onPaintingBreak(PaintingBreakEvent event){
|
||||
}
|
||||
public void onPaintingBreak(PaintingBreakEvent event) {}
|
||||
|
||||
public void onPigZap(PigZapEvent event) {
|
||||
}
|
||||
public void onPigZap(PigZapEvent event) {}
|
||||
|
||||
public void onCreeperPower(CreeperPowerEvent event) {
|
||||
}
|
||||
public void onCreeperPower(CreeperPowerEvent event) {}
|
||||
}
|
||||
|
||||
@@ -66,8 +66,8 @@ public class EntityTargetEvent extends EntityEvent implements Cancellable {
|
||||
/**
|
||||
* An enum to specify the reason for the targeting
|
||||
*/
|
||||
public enum TargetReason
|
||||
{
|
||||
public enum TargetReason {
|
||||
|
||||
/**
|
||||
* When the entity's target has died, and so it no longer targets it
|
||||
*/
|
||||
|
||||
@@ -22,11 +22,11 @@ public class ExplosionPrimeEvent extends EntityEvent implements Cancellable {
|
||||
public void setCancelled(boolean cancel) {
|
||||
this.cancel = cancel;
|
||||
}
|
||||
|
||||
|
||||
public float getRadius() {
|
||||
return radius;
|
||||
}
|
||||
|
||||
|
||||
public void setRadius(float radius) {
|
||||
this.radius = radius;
|
||||
}
|
||||
@@ -38,5 +38,4 @@ public class ExplosionPrimeEvent extends EntityEvent implements Cancellable {
|
||||
public void setFire(boolean fire) {
|
||||
this.fire = fire;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ import org.bukkit.entity.Painting;
|
||||
* @author Tanel Suurhans
|
||||
*/
|
||||
|
||||
public class PaintingBreakByWorldEvent extends PaintingBreakEvent{
|
||||
public class PaintingBreakByWorldEvent extends PaintingBreakEvent {
|
||||
public PaintingBreakByWorldEvent(final Painting painting) {
|
||||
super(painting, RemoveCause.WORLD);
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ public class PaintingBreakEvent extends PaintingEvent implements Cancellable {
|
||||
this.cause = cause;
|
||||
}
|
||||
|
||||
public RemoveCause getCause(){
|
||||
public RemoveCause getCause() {
|
||||
return cause;
|
||||
}
|
||||
|
||||
@@ -41,12 +41,10 @@ public class PaintingBreakEvent extends PaintingEvent implements Cancellable {
|
||||
* Removed by an entity
|
||||
*/
|
||||
ENTITY,
|
||||
|
||||
/**
|
||||
* Removed by the world - block destroyed behind, water flowing over etc
|
||||
*/
|
||||
WORLD
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,5 +25,4 @@ public class PaintingEvent extends Event {
|
||||
public Painting getPainting() {
|
||||
return painting;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -30,4 +30,4 @@ public class PlayerAnimationEvent extends PlayerEvent {
|
||||
public PlayerAnimationType getAnimationType() {
|
||||
return animationType;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,5 +4,5 @@ package org.bukkit.event.player;
|
||||
* Differet types of player animations
|
||||
*/
|
||||
public enum PlayerAnimationType {
|
||||
ARM_SWING
|
||||
ARM_SWING
|
||||
}
|
||||
|
||||
@@ -7,11 +7,11 @@ import org.bukkit.event.Cancellable;
|
||||
/**
|
||||
* This event is fired when the player is almost about to enter the bed.
|
||||
* It can be cancelled.
|
||||
*
|
||||
*
|
||||
* @author sk89q
|
||||
*/
|
||||
public class PlayerBedEnterEvent extends PlayerEvent implements Cancellable {
|
||||
|
||||
|
||||
private boolean cancel = false;
|
||||
private Block bed;
|
||||
|
||||
@@ -37,14 +37,13 @@ public class PlayerBedEnterEvent extends PlayerEvent implements Cancellable {
|
||||
public void setCancelled(boolean cancel) {
|
||||
this.cancel = cancel;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the bed block.
|
||||
*
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public Block getBed() {
|
||||
return bed;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -5,25 +5,24 @@ import org.bukkit.entity.Player;
|
||||
|
||||
/**
|
||||
* This event is fired when the player is leaving a bed.
|
||||
*
|
||||
*
|
||||
* @author sk89q
|
||||
*/
|
||||
public class PlayerBedLeaveEvent extends PlayerEvent {
|
||||
|
||||
|
||||
private Block bed;
|
||||
|
||||
public PlayerBedLeaveEvent(Player who, Block bed) {
|
||||
super(Type.PLAYER_BED_LEAVE, who);
|
||||
this.bed = bed;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the bed block.
|
||||
*
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public Block getBed() {
|
||||
return bed;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
package org.bukkit.event.player;
|
||||
|
||||
import java.util.Arrays;
|
||||
@@ -20,7 +19,7 @@ public class PlayerChatEvent extends PlayerEvent implements Cancellable {
|
||||
public PlayerChatEvent(final Player player, final String message) {
|
||||
this(Type.PLAYER_CHAT, player, message);
|
||||
}
|
||||
|
||||
|
||||
protected PlayerChatEvent(final Type type, final Player player, final String message) {
|
||||
super(type, player);
|
||||
recipients = new HashSet<Player>(Arrays.asList(player.getServer().getOnlinePlayers()));
|
||||
|
||||
@@ -70,7 +70,6 @@ public class PlayerEggThrowEvent extends PlayerEvent {
|
||||
this.hatchType = hatchType;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the number of mob hatches from the egg. By default the number
|
||||
* will be he number the server would've done
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
package org.bukkit.event.player;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@@ -83,14 +83,16 @@ public class PlayerInteractEvent extends PlayerEvent implements Cancellable {
|
||||
* @return Material the material of the item used
|
||||
*/
|
||||
public Material getMaterial() {
|
||||
if (!hasItem()) return Material.AIR;
|
||||
if (!hasItem()) {
|
||||
return Material.AIR;
|
||||
}
|
||||
|
||||
return item.getType();
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if this event involved a block
|
||||
*
|
||||
*
|
||||
* return boolean true if it did
|
||||
*/
|
||||
public boolean hasBlock() {
|
||||
@@ -99,7 +101,7 @@ public class PlayerInteractEvent extends PlayerEvent implements Cancellable {
|
||||
|
||||
/**
|
||||
* Check if this event involved an item
|
||||
*
|
||||
*
|
||||
* return boolean true if it did
|
||||
*/
|
||||
public boolean hasItem() {
|
||||
@@ -113,7 +115,9 @@ public class PlayerInteractEvent extends PlayerEvent implements Cancellable {
|
||||
* @return boolean true if the item in hand was a block
|
||||
*/
|
||||
public boolean isBlockInHand() {
|
||||
if (!hasItem()) return false;
|
||||
if (!hasItem()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return item.getType().isBlock();
|
||||
}
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
package org.bukkit.event.player;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
package org.bukkit.event.player;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
package org.bukkit.event.player;
|
||||
|
||||
import org.bukkit.event.Listener;
|
||||
@@ -8,8 +7,7 @@ import org.bukkit.plugin.AuthorNagException;
|
||||
* Handles all events thrown in relation to a Player
|
||||
*/
|
||||
public class PlayerListener implements Listener {
|
||||
public PlayerListener() {
|
||||
}
|
||||
public PlayerListener() {}
|
||||
|
||||
/**
|
||||
* Called when a player joins a server
|
||||
@@ -17,7 +15,7 @@ public class PlayerListener implements Listener {
|
||||
* @param event Relevant event details
|
||||
*/
|
||||
public void onPlayerJoin(PlayerJoinEvent event) {
|
||||
onPlayerJoin((PlayerEvent)event);
|
||||
onPlayerJoin((PlayerEvent) event);
|
||||
throw new AuthorNagException("onPlayerJoin has been replaced with a new signature, (PlayerJoinEvent)");
|
||||
}
|
||||
|
||||
@@ -27,7 +25,7 @@ public class PlayerListener implements Listener {
|
||||
* @param event Relevant event details
|
||||
*/
|
||||
public void onPlayerQuit(PlayerQuitEvent event) {
|
||||
onPlayerQuit((PlayerEvent)event);
|
||||
onPlayerQuit((PlayerEvent) event);
|
||||
throw new AuthorNagException("onPlayerQuit has been replaced with a new signature, (PlayerQuitEvent)");
|
||||
}
|
||||
|
||||
@@ -36,16 +34,14 @@ public class PlayerListener implements Listener {
|
||||
*
|
||||
* @param event Relevant event details
|
||||
*/
|
||||
public void onPlayerKick(PlayerKickEvent event) {
|
||||
}
|
||||
public void onPlayerKick(PlayerKickEvent event) {}
|
||||
|
||||
/**
|
||||
* Called when a player sends a chat message
|
||||
*
|
||||
* @param event Relevant event details
|
||||
*/
|
||||
public void onPlayerChat(PlayerChatEvent event) {
|
||||
}
|
||||
public void onPlayerChat(PlayerChatEvent event) {}
|
||||
|
||||
/**
|
||||
* Called early in the command handling process. This event is only
|
||||
@@ -54,7 +50,7 @@ public class PlayerListener implements Listener {
|
||||
* @param event Relevant event details
|
||||
*/
|
||||
public void onPlayerCommandPreprocess(PlayerCommandPreprocessEvent event) {
|
||||
onPlayerCommandPreprocess((PlayerChatEvent)event);
|
||||
onPlayerCommandPreprocess((PlayerChatEvent) event);
|
||||
throw new AuthorNagException("onPlayerCommandPreprocess has been replaced with a new signature, (PlayerCommandPreprocessEvent)");
|
||||
}
|
||||
|
||||
@@ -63,8 +59,7 @@ public class PlayerListener implements Listener {
|
||||
*
|
||||
* @param event Relevant event details
|
||||
*/
|
||||
public void onPlayerMove(PlayerMoveEvent event) {
|
||||
}
|
||||
public void onPlayerMove(PlayerMoveEvent event) {}
|
||||
|
||||
/**
|
||||
* Called when a player attempts to teleport to a new location in a world
|
||||
@@ -72,7 +67,7 @@ public class PlayerListener implements Listener {
|
||||
* @param event Relevant event details
|
||||
*/
|
||||
public void onPlayerTeleport(PlayerTeleportEvent event) {
|
||||
onPlayerTeleport((PlayerMoveEvent)event);
|
||||
onPlayerTeleport((PlayerMoveEvent) event);
|
||||
throw new AuthorNagException("onPlayerTeleport has been replaced with a new signature, (PlayerTeleportEvent)");
|
||||
}
|
||||
|
||||
@@ -81,128 +76,112 @@ public class PlayerListener implements Listener {
|
||||
*
|
||||
* @param event Relevant event details
|
||||
*/
|
||||
public void onPlayerRespawn(PlayerRespawnEvent event) {
|
||||
}
|
||||
public void onPlayerRespawn(PlayerRespawnEvent event) {}
|
||||
|
||||
/**
|
||||
* Called when a player interacts
|
||||
*
|
||||
* @param event Relevant event details
|
||||
*/
|
||||
public void onPlayerInteract(PlayerInteractEvent event) {
|
||||
}
|
||||
public void onPlayerInteract(PlayerInteractEvent event) {}
|
||||
|
||||
/**
|
||||
* Called when a player right clicks an entity.
|
||||
*
|
||||
* @param event Relevant event details
|
||||
*/
|
||||
public void onPlayerInteractEntity(PlayerInteractEntityEvent event) {
|
||||
}
|
||||
public void onPlayerInteractEntity(PlayerInteractEntityEvent event) {}
|
||||
|
||||
/**
|
||||
* Called when a player attempts to log in to the server
|
||||
*
|
||||
* @param event Relevant event details
|
||||
*/
|
||||
public void onPlayerLogin(PlayerLoginEvent event) {
|
||||
}
|
||||
public void onPlayerLogin(PlayerLoginEvent event) {}
|
||||
|
||||
/**
|
||||
* Called when a player has just been authenticated
|
||||
*
|
||||
* @param event Relevant event details
|
||||
*/
|
||||
public void onPlayerPreLogin(PlayerPreLoginEvent event) {
|
||||
}
|
||||
public void onPlayerPreLogin(PlayerPreLoginEvent event) {}
|
||||
|
||||
/**
|
||||
* Called when a player throws an egg and it might hatch
|
||||
*
|
||||
* @param event Relevant event details
|
||||
*/
|
||||
public void onPlayerEggThrow(PlayerEggThrowEvent event) {
|
||||
}
|
||||
public void onPlayerEggThrow(PlayerEggThrowEvent event) {}
|
||||
|
||||
/**
|
||||
* Called when a player plays an animation, such as an arm swing
|
||||
*
|
||||
* @param event Relevant event details
|
||||
*/
|
||||
public void onPlayerAnimation(PlayerAnimationEvent event) {
|
||||
}
|
||||
public void onPlayerAnimation(PlayerAnimationEvent event) {}
|
||||
|
||||
/**
|
||||
* Called when a player opens an inventory
|
||||
*
|
||||
* @param event Relevant event details
|
||||
*/
|
||||
public void onInventoryOpen(PlayerInventoryEvent event) {
|
||||
}
|
||||
public void onInventoryOpen(PlayerInventoryEvent event) {}
|
||||
|
||||
/**
|
||||
* Called when a player changes their held item
|
||||
*
|
||||
* @param event Relevant event details
|
||||
*/
|
||||
public void onItemHeldChange(PlayerItemHeldEvent event) {
|
||||
}
|
||||
public void onItemHeldChange(PlayerItemHeldEvent event) {}
|
||||
|
||||
/**
|
||||
* Called when a player drops an item from their inventory
|
||||
*
|
||||
* @param event Relevant event details
|
||||
*/
|
||||
public void onPlayerDropItem(PlayerDropItemEvent event) {
|
||||
}
|
||||
public void onPlayerDropItem(PlayerDropItemEvent event) {}
|
||||
|
||||
/**
|
||||
* Called when a player picks an item up off the ground
|
||||
*
|
||||
* @param event Relevant event details
|
||||
*/
|
||||
public void onPlayerPickupItem(PlayerPickupItemEvent event) {
|
||||
}
|
||||
public void onPlayerPickupItem(PlayerPickupItemEvent event) {}
|
||||
|
||||
/**
|
||||
* Called when a player toggles sneak mode
|
||||
*
|
||||
* @param event Relevant event details
|
||||
*/
|
||||
public void onPlayerToggleSneak(PlayerToggleSneakEvent event) {
|
||||
}
|
||||
public void onPlayerToggleSneak(PlayerToggleSneakEvent event) {}
|
||||
|
||||
/**
|
||||
* Called when a player fills a bucket
|
||||
*
|
||||
* @param event Relevant event details
|
||||
*/
|
||||
public void onPlayerBucketFill(PlayerBucketFillEvent event) {
|
||||
}
|
||||
public void onPlayerBucketFill(PlayerBucketFillEvent event) {}
|
||||
|
||||
/**
|
||||
* Called when a player empties a bucket
|
||||
*
|
||||
* @param event Relevant event details
|
||||
*/
|
||||
public void onPlayerBucketEmpty(PlayerBucketEmptyEvent event) {
|
||||
}
|
||||
public void onPlayerBucketEmpty(PlayerBucketEmptyEvent event) {}
|
||||
|
||||
/**
|
||||
* Called when a player enters a bed
|
||||
*
|
||||
* @param event Relevant event details
|
||||
*/
|
||||
public void onPlayerBedEnter(PlayerBedEnterEvent event) {
|
||||
}
|
||||
public void onPlayerBedEnter(PlayerBedEnterEvent event) {}
|
||||
|
||||
/**
|
||||
* Called when a player leaves a bed
|
||||
*
|
||||
* @param event Relevant event details
|
||||
*/
|
||||
public void onPlayerBedLeave(PlayerBedLeaveEvent event) {
|
||||
}
|
||||
public void onPlayerBedLeave(PlayerBedLeaveEvent event) {}
|
||||
|
||||
// TODO: Remove after RB
|
||||
@Deprecated public void onPlayerQuit(PlayerEvent event) {}
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
package org.bukkit.event.player;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
@@ -81,26 +80,23 @@ public class PlayerLoginEvent extends PlayerEvent {
|
||||
* Basic kick reasons for communicating to plugins
|
||||
*/
|
||||
public enum Result {
|
||||
|
||||
/**
|
||||
* The player is allowed to log in
|
||||
*/
|
||||
ALLOWED,
|
||||
|
||||
/**
|
||||
* The player is not allowed to log in, due to the server being full
|
||||
*/
|
||||
KICK_FULL,
|
||||
|
||||
/**
|
||||
* The player is not allowed to log in, due to them being banned
|
||||
*/
|
||||
KICK_BANNED,
|
||||
|
||||
/**
|
||||
* The player is not allowed to log in, due to them not being on the white list
|
||||
*/
|
||||
KICK_WHITELIST,
|
||||
|
||||
/**
|
||||
* The player is not allowed to log in, for reasons undefined
|
||||
*/
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
package org.bukkit.event.player;
|
||||
|
||||
import org.bukkit.Location;
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
package org.bukkit.event.player;
|
||||
|
||||
import org.bukkit.entity.Item;
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
package org.bukkit.event.player;
|
||||
|
||||
import java.net.InetAddress;
|
||||
@@ -75,19 +74,19 @@ public class PlayerPreLoginEvent extends Event {
|
||||
this.result = result;
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the player name.
|
||||
*
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the player IP address.
|
||||
*
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public InetAddress getAddress() {
|
||||
@@ -98,26 +97,23 @@ public class PlayerPreLoginEvent extends Event {
|
||||
* Basic kick reasons for communicating to plugins
|
||||
*/
|
||||
public enum Result {
|
||||
|
||||
/**
|
||||
* The player is allowed to log in
|
||||
*/
|
||||
ALLOWED,
|
||||
|
||||
/**
|
||||
* The player is not allowed to log in, due to the server being full
|
||||
*/
|
||||
KICK_FULL,
|
||||
|
||||
/**
|
||||
* The player is not allowed to log in, due to them being banned
|
||||
*/
|
||||
KICK_BANNED,
|
||||
|
||||
/**
|
||||
* The player is not allowed to log in, due to them not being on the white list
|
||||
*/
|
||||
KICK_WHITELIST,
|
||||
|
||||
/**
|
||||
* The player is not allowed to log in, for reasons undefined
|
||||
*/
|
||||
|
||||
@@ -28,5 +28,4 @@ public class PlayerQuitEvent extends PlayerEvent {
|
||||
public void setQuitMessage(String quitMessage) {
|
||||
this.quitMessage = quitMessage;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ import org.bukkit.event.Cancellable;
|
||||
*
|
||||
* @author azi
|
||||
*/
|
||||
public class PlayerToggleSneakEvent extends PlayerEvent implements Cancellable{
|
||||
public class PlayerToggleSneakEvent extends PlayerEvent implements Cancellable {
|
||||
private boolean cancel = false;
|
||||
|
||||
public PlayerToggleSneakEvent(final Player player) {
|
||||
@@ -24,7 +24,6 @@ public class PlayerToggleSneakEvent extends PlayerEvent implements Cancellable{
|
||||
return cancel;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets the cancellation state of this event. A cancelled event will not
|
||||
* be executed in the server, but will still pass to other plugins
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
package org.bukkit.event.server;
|
||||
|
||||
import org.bukkit.plugin.Plugin;
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
package org.bukkit.event.server;
|
||||
|
||||
import org.bukkit.event.Event;
|
||||
@@ -10,4 +9,4 @@ public class ServerCommandEvent extends Event {
|
||||
public ServerCommandEvent() {
|
||||
super(Type.SERVER_COMMAND);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
package org.bukkit.event.server;
|
||||
|
||||
import org.bukkit.event.Event;
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
package org.bukkit.event.server;
|
||||
|
||||
import org.bukkit.event.Listener;
|
||||
@@ -8,13 +7,14 @@ import org.bukkit.plugin.AuthorNagException;
|
||||
* Handles all miscellaneous server events
|
||||
*/
|
||||
public class ServerListener implements Listener {
|
||||
|
||||
/**
|
||||
* Called when a plugin is enabled
|
||||
*
|
||||
* @param event Relevant event details
|
||||
*/
|
||||
public void onPluginEnable(PluginEnableEvent event) {
|
||||
onPluginEnable((PluginEvent)event);
|
||||
onPluginEnable((PluginEvent) event);
|
||||
throw new AuthorNagException("onPluginEnable has been replaced with a new signature, (PluginEnableEvent)");
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ public class ServerListener implements Listener {
|
||||
* @param event Relevant event details
|
||||
*/
|
||||
public void onPluginDisable(PluginDisableEvent event) {
|
||||
onPluginDisable((PluginEvent)event);
|
||||
onPluginDisable((PluginEvent) event);
|
||||
throw new AuthorNagException("onPluginDisable has been replaced with a new signature, (PluginDisableEvent)");
|
||||
}
|
||||
|
||||
@@ -33,10 +33,9 @@ public class ServerListener implements Listener {
|
||||
*
|
||||
* @param event Relevant event details
|
||||
*/
|
||||
public void onServerCommand(ServerCommandEvent event) {
|
||||
}
|
||||
public void onServerCommand(ServerCommandEvent event) {}
|
||||
|
||||
// TODO: Remove after RB
|
||||
// TODO: Remove after RB
|
||||
@Deprecated public void onPluginDisable(PluginEvent event) {}
|
||||
@Deprecated public void onPluginEnable(PluginEvent event) {}
|
||||
}
|
||||
|
||||
@@ -5,17 +5,17 @@ import org.bukkit.entity.Vehicle;
|
||||
|
||||
/**
|
||||
* Raised when a vehicle collides with a block.
|
||||
*
|
||||
*
|
||||
* @author sk89q
|
||||
*/
|
||||
public class VehicleBlockCollisionEvent extends VehicleCollisionEvent {
|
||||
private Block block;
|
||||
|
||||
|
||||
public VehicleBlockCollisionEvent(Vehicle vehicle, Block block) {
|
||||
super(Type.VEHICLE_COLLISION_BLOCK, vehicle);
|
||||
this.block = block;
|
||||
}
|
||||
|
||||
|
||||
public Block getBlock() {
|
||||
return block;
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ import org.bukkit.entity.Vehicle;
|
||||
|
||||
/**
|
||||
* Raised when a vehicle collides.
|
||||
*
|
||||
*
|
||||
* @author sk89q
|
||||
*/
|
||||
public class VehicleCollisionEvent extends VehicleEvent {
|
||||
|
||||
@@ -4,7 +4,7 @@ import org.bukkit.entity.Vehicle;
|
||||
|
||||
/**
|
||||
* Raised when a vehicle is created.
|
||||
*
|
||||
*
|
||||
* @author sk89q
|
||||
*/
|
||||
public class VehicleCreateEvent extends VehicleEvent {
|
||||
|
||||
@@ -6,31 +6,31 @@ import org.bukkit.event.Cancellable;
|
||||
|
||||
/**
|
||||
* Raised when a vehicle receives damage.
|
||||
*
|
||||
*
|
||||
* @author sk89q
|
||||
*/
|
||||
public class VehicleDamageEvent extends VehicleEvent implements Cancellable {
|
||||
private Entity attacker;
|
||||
private int damage;
|
||||
private boolean cancelled;
|
||||
|
||||
|
||||
public VehicleDamageEvent(Vehicle vehicle, Entity attacker, int damage) {
|
||||
super(Type.VEHICLE_DAMAGE, vehicle);
|
||||
this.attacker = attacker;
|
||||
this.damage = damage;
|
||||
}
|
||||
|
||||
|
||||
public Entity getAttacker() {
|
||||
return attacker;
|
||||
}
|
||||
|
||||
|
||||
public int getDamage() {
|
||||
return damage;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Change the damage.
|
||||
*
|
||||
*
|
||||
* @param damage
|
||||
*/
|
||||
public void setDamage(int damage) {
|
||||
@@ -44,5 +44,4 @@ public class VehicleDamageEvent extends VehicleEvent implements Cancellable {
|
||||
public void setCancelled(boolean cancel) {
|
||||
this.cancelled = cancel;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -12,12 +12,12 @@ import org.bukkit.event.Cancellable;
|
||||
public class VehicleDestroyEvent extends VehicleEvent implements Cancellable {
|
||||
private Entity attacker;
|
||||
private boolean cancelled;
|
||||
|
||||
|
||||
public VehicleDestroyEvent(Vehicle vehicle, Entity attacker) {
|
||||
super(Type.VEHICLE_DESTROY, vehicle);
|
||||
this.attacker = attacker;
|
||||
}
|
||||
|
||||
|
||||
public Entity getAttacker() {
|
||||
return attacker;
|
||||
}
|
||||
@@ -29,5 +29,4 @@ public class VehicleDestroyEvent extends VehicleEvent implements Cancellable {
|
||||
public void setCancelled(boolean cancel) {
|
||||
this.cancelled = cancel;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ import org.bukkit.event.Cancellable;
|
||||
|
||||
/**
|
||||
* Raised when an entity enters a vehicle.
|
||||
*
|
||||
*
|
||||
* @author sk89q
|
||||
*/
|
||||
public class VehicleEnterEvent extends VehicleEvent implements Cancellable {
|
||||
@@ -20,7 +20,7 @@ public class VehicleEnterEvent extends VehicleEvent implements Cancellable {
|
||||
|
||||
/**
|
||||
* Get the entity that entered the vehicle.
|
||||
*
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public Entity getEntered() {
|
||||
|
||||
@@ -6,7 +6,7 @@ import org.bukkit.event.Cancellable;
|
||||
|
||||
/**
|
||||
* Raised when a vehicle collides with an entity.
|
||||
*
|
||||
*
|
||||
* @author sk89q
|
||||
*/
|
||||
public class VehicleEntityCollisionEvent extends VehicleCollisionEvent implements Cancellable {
|
||||
@@ -14,12 +14,12 @@ public class VehicleEntityCollisionEvent extends VehicleCollisionEvent implement
|
||||
private boolean cancelled = false;
|
||||
private boolean cancelledPickup = false;
|
||||
private boolean cancelledCollision = false;
|
||||
|
||||
|
||||
public VehicleEntityCollisionEvent(Vehicle vehicle, Entity entity) {
|
||||
super(Type.VEHICLE_COLLISION_ENTITY, vehicle);
|
||||
this.entity = entity;
|
||||
}
|
||||
|
||||
|
||||
public Entity getEntity() {
|
||||
return entity;
|
||||
}
|
||||
@@ -31,19 +31,19 @@ public class VehicleEntityCollisionEvent extends VehicleCollisionEvent implement
|
||||
public void setCancelled(boolean cancel) {
|
||||
this.cancelled = cancel;
|
||||
}
|
||||
|
||||
|
||||
public boolean isPickupCancelled() {
|
||||
return cancelledPickup;
|
||||
}
|
||||
|
||||
|
||||
public void setPickupCancelled(boolean cancel) {
|
||||
cancelledPickup = cancel;
|
||||
}
|
||||
|
||||
|
||||
public boolean isCollisionCancelled() {
|
||||
return cancelledCollision;
|
||||
}
|
||||
|
||||
|
||||
public void setCollisionCancelled(boolean cancel) {
|
||||
cancelledCollision = cancel;
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ import org.bukkit.event.Event;
|
||||
|
||||
/**
|
||||
* Represents a vehicle-related event.
|
||||
*
|
||||
*
|
||||
* @author sk89q
|
||||
*/
|
||||
public class VehicleEvent extends Event {
|
||||
@@ -18,7 +18,7 @@ public class VehicleEvent extends Event {
|
||||
|
||||
/**
|
||||
* Get the vehicle.
|
||||
*
|
||||
*
|
||||
* @return the vehicle
|
||||
*/
|
||||
public final Vehicle getVehicle() {
|
||||
|
||||
@@ -6,7 +6,7 @@ import org.bukkit.event.Cancellable;
|
||||
|
||||
/**
|
||||
* Raised when a living entity exits a vehicle.
|
||||
*
|
||||
*
|
||||
* @author sk89q
|
||||
*/
|
||||
public class VehicleExitEvent extends VehicleEvent implements Cancellable {
|
||||
@@ -17,10 +17,10 @@ public class VehicleExitEvent extends VehicleEvent implements Cancellable {
|
||||
super(Type.VEHICLE_EXIT, vehicle);
|
||||
this.exited = exited;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the living entity that exited the vehicle.
|
||||
*
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public LivingEntity getExited() {
|
||||
|
||||
@@ -5,77 +5,68 @@ import org.bukkit.plugin.AuthorNagException;
|
||||
|
||||
/**
|
||||
* Listener for vehicle events.
|
||||
*
|
||||
*
|
||||
* @author sk89q
|
||||
*/
|
||||
public class VehicleListener implements Listener {
|
||||
public VehicleListener() {
|
||||
}
|
||||
|
||||
public VehicleListener() {}
|
||||
|
||||
/**
|
||||
* Called when a vehicle is created by a player. This hook will be called
|
||||
* for all vehicles created.
|
||||
*
|
||||
*
|
||||
* @param event
|
||||
*/
|
||||
public void onVehicleCreate(VehicleCreateEvent event) {
|
||||
}
|
||||
|
||||
public void onVehicleCreate(VehicleCreateEvent event) {}
|
||||
|
||||
/**
|
||||
* Called when a vehicle is damaged by the player.
|
||||
*
|
||||
*
|
||||
* @param event
|
||||
*/
|
||||
public void onVehicleDamage(VehicleDamageEvent event) {
|
||||
}
|
||||
|
||||
public void onVehicleDamage(VehicleDamageEvent event) {}
|
||||
|
||||
/**
|
||||
* Called when a vehicle collides with a block.
|
||||
*
|
||||
*
|
||||
* @param event
|
||||
*/
|
||||
public void onVehicleBlockCollision(VehicleBlockCollisionEvent event) {
|
||||
}
|
||||
|
||||
public void onVehicleBlockCollision(VehicleBlockCollisionEvent event) {}
|
||||
|
||||
/**
|
||||
* Called when a vehicle collides with an entity.
|
||||
*
|
||||
*
|
||||
* @param event
|
||||
*/
|
||||
public void onVehicleEntityCollision(VehicleEntityCollisionEvent event) {
|
||||
}
|
||||
|
||||
public void onVehicleEntityCollision(VehicleEntityCollisionEvent event) {}
|
||||
|
||||
/**
|
||||
* Called when an entity enters a vehicle.
|
||||
*
|
||||
*
|
||||
* @param event
|
||||
*/
|
||||
public void onVehicleEnter(VehicleEnterEvent event) {
|
||||
}
|
||||
|
||||
public void onVehicleEnter(VehicleEnterEvent event) {}
|
||||
|
||||
/**
|
||||
* Called when an entity exits a vehicle.
|
||||
*
|
||||
*
|
||||
* @param event
|
||||
*/
|
||||
public void onVehicleExit(VehicleExitEvent event) {
|
||||
}
|
||||
public void onVehicleExit(VehicleExitEvent event) {}
|
||||
|
||||
/**
|
||||
* Called when an vehicle moves.
|
||||
*
|
||||
* @param event
|
||||
*/
|
||||
public void onVehicleMove(VehicleMoveEvent event) {
|
||||
}
|
||||
public void onVehicleMove(VehicleMoveEvent event) {}
|
||||
|
||||
/**
|
||||
* Called when a vehicle is destroyed.
|
||||
*
|
||||
* @param event
|
||||
*/
|
||||
public void onVehicleDestroy(VehicleDestroyEvent event) {
|
||||
}
|
||||
public void onVehicleDestroy(VehicleDestroyEvent event) {}
|
||||
|
||||
/**
|
||||
* Called when a vehicle goes through an update cycle
|
||||
@@ -83,7 +74,7 @@ public class VehicleListener implements Listener {
|
||||
* @param event
|
||||
*/
|
||||
public void onVehicleUpdate(VehicleUpdateEvent event) {
|
||||
onVehicleUpdate((VehicleEvent)event);
|
||||
onVehicleUpdate((VehicleEvent) event);
|
||||
throw new AuthorNagException("onVehicleUpdate has been replaced with a new signature, (VehicleUpdateEvent)");
|
||||
}
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ import org.bukkit.entity.Vehicle;
|
||||
|
||||
/**
|
||||
* Raised when a vehicle moves.
|
||||
*
|
||||
*
|
||||
* @author sk89q
|
||||
*/
|
||||
public class VehicleMoveEvent extends VehicleEvent {
|
||||
@@ -18,19 +18,19 @@ public class VehicleMoveEvent extends VehicleEvent {
|
||||
this.from = from;
|
||||
this.to = to;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the previous position.
|
||||
*
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public Location getFrom() {
|
||||
return from;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the next position.
|
||||
*
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public Location getTo() {
|
||||
|
||||
@@ -48,5 +48,4 @@ public class LightningStrikeEvent extends WeatherEvent implements Cancellable {
|
||||
public LightningStrike getLightning() {
|
||||
return bolt;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -46,5 +46,4 @@ public class ThunderChangeEvent extends WeatherEvent implements Cancellable {
|
||||
public boolean toThunderState() {
|
||||
return to;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -46,5 +46,4 @@ public class WeatherChangeEvent extends WeatherEvent implements Cancellable {
|
||||
public boolean toWeatherState() {
|
||||
return to;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -6,16 +6,11 @@ import org.bukkit.event.Listener;
|
||||
* Handles all events fired in relation to weather
|
||||
*/
|
||||
public class WeatherListener implements Listener {
|
||||
public WeatherListener() {
|
||||
}
|
||||
public WeatherListener() {}
|
||||
|
||||
public void onWeatherChange(WeatherChangeEvent event) {
|
||||
}
|
||||
public void onWeatherChange(WeatherChangeEvent event) {}
|
||||
|
||||
public void onThunderChange(ThunderChangeEvent event) {
|
||||
}
|
||||
|
||||
public void onLightningStrike(LightningStrikeEvent event) {
|
||||
}
|
||||
public void onThunderChange(ThunderChangeEvent event) {}
|
||||
|
||||
public void onLightningStrike(LightningStrikeEvent event) {}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
package org.bukkit.event.world;
|
||||
|
||||
import org.bukkit.Chunk;
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
package org.bukkit.event.world;
|
||||
|
||||
import org.bukkit.Chunk;
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
package org.bukkit.event.world;
|
||||
|
||||
import org.bukkit.World;
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
package org.bukkit.event.world;
|
||||
|
||||
import org.bukkit.event.Listener;
|
||||
@@ -8,37 +7,35 @@ import org.bukkit.plugin.AuthorNagException;
|
||||
* Handles all World related events
|
||||
*/
|
||||
public class WorldListener implements Listener {
|
||||
|
||||
/**
|
||||
* Called when a chunk is loaded
|
||||
*
|
||||
* @param event Relevant event details
|
||||
*/
|
||||
public void onChunkLoad(ChunkLoadEvent event) {
|
||||
}
|
||||
public void onChunkLoad(ChunkLoadEvent event) {}
|
||||
|
||||
/**
|
||||
* Called when a chunk is unloaded
|
||||
*
|
||||
* @param event Relevant event details
|
||||
*/
|
||||
public void onChunkUnload(ChunkUnloadEvent event) {
|
||||
}
|
||||
public void onChunkUnload(ChunkUnloadEvent event) {}
|
||||
|
||||
/**
|
||||
* Called when a World's spawn is changed
|
||||
*
|
||||
* @param event Relevant event details
|
||||
*/
|
||||
public void onSpawnChange(SpawnChangeEvent event) {
|
||||
}
|
||||
public void onSpawnChange(SpawnChangeEvent event) {}
|
||||
|
||||
/**
|
||||
* Called when a world is saved
|
||||
*
|
||||
* @param event Relevant event details
|
||||
*/
|
||||
* Called when a world is saved
|
||||
*
|
||||
* @param event Relevant event details
|
||||
*/
|
||||
public void onWorldSave(WorldSaveEvent event) {
|
||||
onWorldSave((WorldEvent)event);
|
||||
onWorldSave((WorldEvent) event);
|
||||
throw new AuthorNagException("onWorldSave has been replaced with a new signature, (WorldSaveEvent)");
|
||||
}
|
||||
|
||||
@@ -48,7 +45,7 @@ public class WorldListener implements Listener {
|
||||
* @param event Relevant event details
|
||||
*/
|
||||
public void onWorldLoad(WorldLoadEvent event) {
|
||||
onWorldLoad((WorldEvent)event);
|
||||
onWorldLoad((WorldEvent) event);
|
||||
throw new AuthorNagException("onWorldLoad has been replaced with a new signature, (WorldLoadEvent)");
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user