Pulling all pending Bukkit-JavaDoc changes
A special thanks goes to @aerouk for almost all of the changes found here. By: Wesley Wolfe <weswolf@aol.com>
This commit is contained in:
@@ -17,12 +17,12 @@ public @interface EventHandler {
|
||||
* <p>
|
||||
* First priority to the last priority executed:
|
||||
* <ol>
|
||||
* <li>LOWEST</li>
|
||||
* <li>LOW</li>
|
||||
* <li>NORMAL</li>
|
||||
* <li>HIGH</li>
|
||||
* <li>HIGHEST</li>
|
||||
* <li>MONITOR</li>
|
||||
* <li>LOWEST
|
||||
* <li>LOW
|
||||
* <li>NORMAL
|
||||
* <li>HIGH
|
||||
* <li>HIGHEST
|
||||
* <li>MONITOR
|
||||
* </ol>
|
||||
*/
|
||||
EventPriority priority() default EventPriority.NORMAL;
|
||||
|
||||
@@ -29,7 +29,7 @@ public enum EventPriority {
|
||||
HIGHEST(4),
|
||||
/**
|
||||
* Event is listened to purely for monitoring the outcome of an event.
|
||||
* <p/>
|
||||
* <p>
|
||||
* No modifications to the event should be made under this priority
|
||||
*/
|
||||
MONITOR(5);
|
||||
|
||||
@@ -12,14 +12,15 @@ import java.util.Map.Entry;
|
||||
public class HandlerList {
|
||||
|
||||
/**
|
||||
* Handler array. This field being an array is the key to this system's speed.
|
||||
* Handler array. This field being an array is the key to this system's
|
||||
* speed.
|
||||
*/
|
||||
private volatile RegisteredListener[] handlers = null;
|
||||
|
||||
/**
|
||||
* Dynamic handler lists. These are changed using register() and
|
||||
* unregister() and are automatically baked to the handlers array any
|
||||
* time they have changed.
|
||||
* unregister() and are automatically baked to the handlers array any time
|
||||
* they have changed.
|
||||
*/
|
||||
private final EnumMap<EventPriority, ArrayList<RegisteredListener>> handlerslots;
|
||||
|
||||
@@ -84,7 +85,8 @@ public class HandlerList {
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new handler list and initialize using EventPriority
|
||||
* Create a new handler list and initialize using EventPriority.
|
||||
* <p>
|
||||
* The HandlerList is then added to meta-list for use in bakeAll()
|
||||
*/
|
||||
public HandlerList() {
|
||||
@@ -191,7 +193,8 @@ public class HandlerList {
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a specific plugin's registered listeners associated with this handler list
|
||||
* Get a specific plugin's registered listeners associated with this
|
||||
* handler list
|
||||
*
|
||||
* @param plugin the plugin to get the listeners of
|
||||
* @return the list of registered listeners
|
||||
|
||||
@@ -20,6 +20,14 @@ public enum Action {
|
||||
RIGHT_CLICK_AIR,
|
||||
/**
|
||||
* Stepping onto or into a block (Ass-pressure)
|
||||
*
|
||||
* Examples:
|
||||
* <ul>
|
||||
* <li>Jumping on soil
|
||||
* <li>Standing on pressure plate
|
||||
* <li>Triggering redstone ore
|
||||
* <li>Triggering tripwire
|
||||
* </ul>
|
||||
*/
|
||||
PHYSICAL,
|
||||
}
|
||||
|
||||
@@ -8,20 +8,23 @@ import org.bukkit.event.HandlerList;
|
||||
/**
|
||||
* Called when a block is broken by a player.
|
||||
* <p>
|
||||
* If you wish to have the block drop experience, you must set the experience value above 0.
|
||||
* By default, experience will be set in the event if:
|
||||
* If you wish to have the block drop experience, you must set the experience
|
||||
* value above 0. By default, experience will be set in the event if:
|
||||
* <ol>
|
||||
* <li />The player is not in creative or adventure mode
|
||||
* <li />The player can loot the block (ie: does not destroy it completely, by using the correct tool)
|
||||
* <li />The player does not have silk touch
|
||||
* <li />The block drops experience in vanilla Minecraft
|
||||
* <li>The player is not in creative or adventure mode
|
||||
* <li>The player can loot the block (ie: does not destroy it completely, by
|
||||
* using the correct tool)
|
||||
* <li>The player does not have silk touch
|
||||
* <li>The block drops experience in vanilla Minecraft
|
||||
* </ol>
|
||||
* <p>
|
||||
* Note:
|
||||
* Plugins wanting to simulate a traditional block drop should set the block to air and utilize their own methods for determining
|
||||
* what the default drop for the block being broken is and what to do about it, if anything.
|
||||
* Plugins wanting to simulate a traditional block drop should set the block
|
||||
* to air and utilize their own methods for determining what the default drop
|
||||
* for the block being broken is and what to do about it, if anything.
|
||||
* <p>
|
||||
* If a Block Break event is cancelled, the block will not break and experience will not drop.
|
||||
* If a Block Break event is cancelled, the block will not break and
|
||||
* experience will not drop.
|
||||
*/
|
||||
public class BlockBreakEvent extends BlockExpEvent implements Cancellable {
|
||||
private final Player player;
|
||||
|
||||
@@ -7,7 +7,8 @@ import org.bukkit.event.HandlerList;
|
||||
/**
|
||||
* Called when a block is destroyed as a result of being burnt by fire.
|
||||
* <p>
|
||||
* If a Block Burn event is cancelled, the block will not be destroyed as a result of being burnt by fire.
|
||||
* If a Block Burn event is cancelled, the block will not be destroyed as a
|
||||
* result of being burnt by fire.
|
||||
*/
|
||||
public class BlockBurnEvent extends BlockEvent implements Cancellable {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
|
||||
@@ -9,13 +9,16 @@ import org.bukkit.event.HandlerList;
|
||||
* <p>
|
||||
* Note:
|
||||
* <ul>
|
||||
* <li>The Block returned by getBlock() is the block we are trying to place on, not the block we are trying to place.</li>
|
||||
* <li>If you want to figure out what is being placed, use {@link #getMaterial()} or {@link #getMaterialId()} instead.</li>
|
||||
* <li>The Block returned by getBlock() is the block we are trying to place
|
||||
* on, not the block we are trying to place.
|
||||
* <li>If you want to figure out what is being placed, use {@link
|
||||
* #getMaterial()} or {@link #getMaterialId()} instead.
|
||||
* </ul>
|
||||
*/
|
||||
public class BlockCanBuildEvent extends BlockEvent {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
protected boolean buildable;
|
||||
|
||||
/**
|
||||
*
|
||||
* @deprecated Magic value
|
||||
@@ -36,7 +39,9 @@ public class BlockCanBuildEvent extends BlockEvent {
|
||||
|
||||
/**
|
||||
* Gets whether or not the block can be built here.
|
||||
* By default, returns Minecraft's answer on whether the block can be built here or not.
|
||||
* <p>
|
||||
* By default, returns Minecraft's answer on whether the block can be
|
||||
* built here or not.
|
||||
*
|
||||
* @return boolean whether or not the block can be built
|
||||
*/
|
||||
@@ -47,7 +52,8 @@ public class BlockCanBuildEvent extends BlockEvent {
|
||||
/**
|
||||
* Sets whether the block can be built here or not.
|
||||
*
|
||||
* @param cancel true if you want to allow the block to be built here despite Minecraft's default behaviour
|
||||
* @param cancel true if you want to allow the block to be built here
|
||||
* despite Minecraft's default behaviour
|
||||
*/
|
||||
public void setBuildable(boolean cancel) {
|
||||
this.buildable = cancel;
|
||||
|
||||
@@ -38,7 +38,8 @@ public class BlockDamageEvent extends BlockEvent implements Cancellable {
|
||||
/**
|
||||
* Gets if the block is set to instantly break when damaged by the player.
|
||||
*
|
||||
* @return true if the block should instantly break when damaged by the player
|
||||
* @return true if the block should instantly break when damaged by the
|
||||
* player
|
||||
*/
|
||||
public boolean getInstaBreak() {
|
||||
return instaBreak;
|
||||
@@ -47,7 +48,8 @@ public class BlockDamageEvent extends BlockEvent implements Cancellable {
|
||||
/**
|
||||
* Sets if the block should instantly break when damaged by the player.
|
||||
*
|
||||
* @param bool true if you want the block to instantly break when damaged by the player
|
||||
* @param bool true if you want the block to instantly break when damaged
|
||||
* by the player
|
||||
*/
|
||||
public void setInstaBreak(boolean bool) {
|
||||
this.instaBreak = bool;
|
||||
|
||||
@@ -9,7 +9,8 @@ import org.bukkit.util.Vector;
|
||||
/**
|
||||
* Called when an item is dispensed from a block.
|
||||
* <p>
|
||||
* If a Block Dispense event is cancelled, the block will not dispense the item.
|
||||
* If a Block Dispense event is cancelled, the block will not dispense the
|
||||
* item.
|
||||
*/
|
||||
public class BlockDispenseEvent extends BlockEvent implements Cancellable {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
@@ -24,8 +25,9 @@ public class BlockDispenseEvent extends BlockEvent implements Cancellable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the item that is being dispensed. Modifying the returned item
|
||||
* will have no effect, you must use {@link #setItem(org.bukkit.inventory.ItemStack)} instead.
|
||||
* Gets the item that is being dispensed. Modifying the returned item will
|
||||
* have no effect, you must use {@link
|
||||
* #setItem(org.bukkit.inventory.ItemStack)} instead.
|
||||
*
|
||||
* @return An ItemStack for the item being dispensed
|
||||
*/
|
||||
@@ -45,7 +47,8 @@ public class BlockDispenseEvent extends BlockEvent implements Cancellable {
|
||||
/**
|
||||
* Gets the velocity.
|
||||
* <p>
|
||||
* Note: Modifying the returned Vector will not change the velocity, you must use {@link #setVelocity(org.bukkit.util.Vector)} instead.
|
||||
* Note: Modifying the returned Vector will not change the velocity, you
|
||||
* must use {@link #setVelocity(org.bukkit.util.Vector)} instead.
|
||||
*
|
||||
* @return A Vector for the dispensed item's velocity
|
||||
*/
|
||||
|
||||
@@ -26,7 +26,8 @@ public class BlockExpEvent extends BlockEvent {
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the amount of experience dropped by the block after the event has processed
|
||||
* Set the amount of experience dropped by the block after the event has
|
||||
* processed
|
||||
*
|
||||
* @param exp 1 or higher to drop experience, else nothing will drop
|
||||
*/
|
||||
|
||||
@@ -10,12 +10,13 @@ import org.bukkit.event.HandlerList;
|
||||
* <p>
|
||||
* Examples:
|
||||
* <ul>
|
||||
* <li>Snow melting due to being near a light source.</li>
|
||||
* <li>Ice melting due to being near a light source.</li>
|
||||
* <li>Fire burning out after time, without destroying fuel block.</li>
|
||||
* <li>Snow melting due to being near a light source.
|
||||
* <li>Ice melting due to being near a light source.
|
||||
* <li>Fire burning out after time, without destroying fuel block.
|
||||
* </ul>
|
||||
* <p>
|
||||
* If a Block Fade event is cancelled, the block will not fade, melt or disappear.
|
||||
* If a Block Fade event is cancelled, the block will not fade, melt or
|
||||
* disappear.
|
||||
*/
|
||||
public class BlockFadeEvent extends BlockEvent implements Cancellable {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
@@ -29,9 +30,11 @@ public class BlockFadeEvent extends BlockEvent implements Cancellable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the state of the block that will be fading, melting or disappearing.
|
||||
* Gets the state of the block that will be fading, melting or
|
||||
* disappearing.
|
||||
*
|
||||
* @return The block state of the block that will be fading, melting or disappearing
|
||||
* @return The block state of the block that will be fading, melting or
|
||||
* disappearing
|
||||
*/
|
||||
public BlockState getNewState() {
|
||||
return newState;
|
||||
|
||||
@@ -7,12 +7,14 @@ import org.bukkit.event.HandlerList;
|
||||
|
||||
/**
|
||||
* Called when a block is formed or spreads based on world conditions.
|
||||
* Use {@link BlockSpreadEvent} to catch blocks that actually spread and don't just "randomly" form.
|
||||
* <p>
|
||||
* Use {@link BlockSpreadEvent} to catch blocks that actually spread and don't
|
||||
* just "randomly" form.
|
||||
* <p>
|
||||
* Examples:
|
||||
* <ul>
|
||||
* <li>Snow forming due to a snow storm.</li>
|
||||
* <li>Ice forming in a snowy Biome like Taiga or Tundra.</li>
|
||||
* <li>Snow forming due to a snow storm.
|
||||
* <li>Ice forming in a snowy Biome like Taiga or Tundra.
|
||||
* </ul>
|
||||
* <p>
|
||||
* If a Block Form event is cancelled, the block will not be formed.
|
||||
|
||||
@@ -6,10 +6,11 @@ import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
/**
|
||||
* Represents events with a source block and a destination block, currently only applies to liquid (lava and water)
|
||||
* and teleporting dragon eggs.
|
||||
* Represents events with a source block and a destination block, currently
|
||||
* only applies to liquid (lava and water) and teleporting dragon eggs.
|
||||
* <p>
|
||||
* If a Block From To event is cancelled, the block will not move (the liquid will not flow).
|
||||
* If a Block From To event is cancelled, the block will not move (the liquid
|
||||
* will not flow).
|
||||
*/
|
||||
public class BlockFromToEvent extends BlockEvent implements Cancellable {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
|
||||
@@ -10,11 +10,11 @@ import org.bukkit.event.HandlerList;
|
||||
* <p>
|
||||
* Examples:
|
||||
* <ul>
|
||||
* <li>Wheat</li>
|
||||
* <li>Sugar Cane</li>
|
||||
* <li>Cactus</li>
|
||||
* <li>Watermelon</li>
|
||||
* <li>Pumpkin</li>
|
||||
* <li>Wheat
|
||||
* <li>Sugar Cane
|
||||
* <li>Cactus
|
||||
* <li>Watermelon
|
||||
* <li>Pumpkin
|
||||
* </ul>
|
||||
* <p>
|
||||
* If a Block Grow event is cancelled, the block will not grow.
|
||||
|
||||
@@ -7,7 +7,8 @@ import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
/**
|
||||
* Called when a block is ignited. If you want to catch when a Player places fire, you need to use {@link BlockPlaceEvent}.
|
||||
* Called when a block is ignited. If you want to catch when a Player places
|
||||
* fire, you need to use {@link BlockPlaceEvent}.
|
||||
* <p>
|
||||
* If a Block Ignite event is cancelled, the block will not be ignited.
|
||||
*/
|
||||
@@ -19,7 +20,8 @@ public class BlockIgniteEvent extends BlockEvent implements Cancellable {
|
||||
private boolean cancel;
|
||||
|
||||
/**
|
||||
* Deprecated. Use {@link BlockIgniteEvent#BlockIgniteEvent(Block, IgniteCause, Entity)} instead.
|
||||
* @deprecated use {@link BlockIgniteEvent#BlockIgniteEvent(Block,
|
||||
* IgniteCause, Entity)} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
public BlockIgniteEvent(final Block theBlock, final IgniteCause cause, final Player thePlayer) {
|
||||
|
||||
@@ -5,6 +5,9 @@ import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.event.Cancellable;
|
||||
|
||||
/**
|
||||
* Called when a piston block is triggered
|
||||
*/
|
||||
public abstract class BlockPistonEvent extends BlockEvent implements Cancellable {
|
||||
private boolean cancelled;
|
||||
private final BlockFace direction;
|
||||
|
||||
@@ -8,6 +8,9 @@ import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
/**
|
||||
* Called when a piston extends
|
||||
*/
|
||||
public class BlockPistonExtendEvent extends BlockPistonEvent {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
private final int length;
|
||||
@@ -29,7 +32,8 @@ public class BlockPistonExtendEvent extends BlockPistonEvent {
|
||||
}
|
||||
|
||||
/**
|
||||
* Get an immutable list of the blocks which will be moved by the extending.
|
||||
* Get an immutable list of the blocks which will be moved by the
|
||||
* extending.
|
||||
*
|
||||
* @return Immutable list of the moved blocks.
|
||||
*/
|
||||
|
||||
@@ -5,6 +5,9 @@ import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
/**
|
||||
* Called when a piston retracts
|
||||
*/
|
||||
public class BlockPistonRetractEvent extends BlockPistonEvent {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
public BlockPistonRetractEvent(final Block block, final BlockFace direction) {
|
||||
@@ -12,8 +15,8 @@ public class BlockPistonRetractEvent extends BlockPistonEvent {
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the location where the possible moving block might be if the retracting
|
||||
* piston is sticky.
|
||||
* Gets the location where the possible moving block might be if the
|
||||
* retracting piston is sticky.
|
||||
*
|
||||
* @return The possible location of the possibly moving block.
|
||||
*/
|
||||
|
||||
@@ -49,8 +49,8 @@ public class BlockPlaceEvent extends BlockEvent implements Cancellable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Clarity method for getting the placed block. Not really needed
|
||||
* except for reasons of clarity.
|
||||
* Clarity method for getting the placed block. Not really needed except
|
||||
* for reasons of clarity.
|
||||
*
|
||||
* @return The Block that was placed
|
||||
*/
|
||||
@@ -59,7 +59,8 @@ public class BlockPlaceEvent extends BlockEvent implements Cancellable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the BlockState for the block which was replaced. Material type air mostly.
|
||||
* Gets the BlockState for the block which was replaced. Material type air
|
||||
* mostly.
|
||||
*
|
||||
* @return The BlockState for the block which was replaced.
|
||||
*/
|
||||
@@ -79,7 +80,8 @@ public class BlockPlaceEvent extends BlockEvent implements Cancellable {
|
||||
/**
|
||||
* Gets the item in the player's hand when they placed the block.
|
||||
*
|
||||
* @return The ItemStack for the item in the player's hand when they placed the block
|
||||
* @return The ItemStack for the item in the player's hand when they
|
||||
* placed the block
|
||||
*/
|
||||
public ItemStack getItemInHand() {
|
||||
return itemInHand;
|
||||
|
||||
@@ -6,12 +6,14 @@ import org.bukkit.event.HandlerList;
|
||||
|
||||
/**
|
||||
* Called when a block spreads based on world conditions.
|
||||
* Use {@link BlockFormEvent} to catch blocks that "randomly" form instead of actually spread.
|
||||
* <p>
|
||||
* Use {@link BlockFormEvent} to catch blocks that "randomly" form instead of
|
||||
* actually spread.
|
||||
* <p>
|
||||
* Examples:
|
||||
* <ul>
|
||||
* <li>Mushrooms spreading.</li>
|
||||
* <li>Fire spreading.</li>
|
||||
* <li>Mushrooms spreading.
|
||||
* <li>Fire spreading.
|
||||
* </ul>
|
||||
* <p>
|
||||
* If a Block Spread event is cancelled, the block will not spread.
|
||||
|
||||
@@ -9,7 +9,7 @@ import org.bukkit.entity.Entity;
|
||||
* <p>
|
||||
* Examples:
|
||||
* <ul>
|
||||
* <li>Snow formed by a {@link org.bukkit.entity.Snowman}.</li>
|
||||
* <li>Snow formed by a {@link org.bukkit.entity.Snowman}.
|
||||
* </ul>
|
||||
*/
|
||||
public class EntityBlockFormEvent extends BlockFormEvent {
|
||||
|
||||
@@ -7,7 +7,8 @@ import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
/**
|
||||
* Called when a note block is being played through player interaction or a redstone current.
|
||||
* Called when a note block is being played through player interaction or a
|
||||
* redstone current.
|
||||
*/
|
||||
public class NotePlayEvent extends BlockEvent implements Cancellable {
|
||||
|
||||
|
||||
@@ -13,7 +13,8 @@ import org.bukkit.inventory.InventoryView;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
/**
|
||||
* Called when an ItemStack is successfully enchanted (currently at enchantment table)
|
||||
* Called when an ItemStack is successfully enchanted (currently at
|
||||
* enchantment table)
|
||||
*/
|
||||
public class EnchantItemEvent extends InventoryEvent implements Cancellable {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
@@ -82,8 +83,9 @@ public class EnchantItemEvent extends InventoryEvent implements Cancellable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Get map of enchantment (levels, keyed by type) to be added to item (modify map returned to change values)
|
||||
* Note: Any enchantments not allowed for the item will be ignored
|
||||
* Get map of enchantment (levels, keyed by type) to be added to item
|
||||
* (modify map returned to change values). Note: Any enchantments not
|
||||
* allowed for the item will be ignored
|
||||
*
|
||||
* @return map of enchantment levels, keyed by enchantment
|
||||
*/
|
||||
|
||||
@@ -9,7 +9,8 @@ import org.bukkit.inventory.InventoryView;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
/**
|
||||
* Called when an ItemStack is inserted in an enchantment table - can be called multiple times
|
||||
* Called when an ItemStack is inserted in an enchantment table - can be
|
||||
* called multiple times
|
||||
*/
|
||||
public class PrepareItemEnchantEvent extends InventoryEvent implements Cancellable {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
@@ -58,7 +59,8 @@ public class PrepareItemEnchantEvent extends InventoryEvent implements Cancellab
|
||||
}
|
||||
|
||||
/**
|
||||
* Get list of offered exp level costs of the enchantment (modify values to change offer)
|
||||
* Get list of offered exp level costs of the enchantment (modify values
|
||||
* to change offer)
|
||||
*
|
||||
* @return experience level costs offered
|
||||
*/
|
||||
|
||||
@@ -53,7 +53,8 @@ public class CreatureSpawnEvent extends EntityEvent implements Cancellable {
|
||||
/**
|
||||
* Gets the type of creature being spawned.
|
||||
*
|
||||
* @return A CreatureType value detailing the type of creature being spawned
|
||||
* @return A CreatureType value detailing the type of creature being
|
||||
* spawned
|
||||
* @deprecated In favour of {@link #getEntityType()}.
|
||||
*/
|
||||
@Deprecated
|
||||
@@ -64,7 +65,8 @@ public class CreatureSpawnEvent extends EntityEvent implements Cancellable {
|
||||
/**
|
||||
* Gets the reason for why the creature is being spawned.
|
||||
*
|
||||
* @return A SpawnReason value detailing the reason for the creature being spawned
|
||||
* @return A SpawnReason value detailing the reason for the creature being
|
||||
* spawned
|
||||
*/
|
||||
public SpawnReason getSpawnReason() {
|
||||
return spawnReason;
|
||||
@@ -89,7 +91,8 @@ public class CreatureSpawnEvent extends EntityEvent implements Cancellable {
|
||||
*/
|
||||
NATURAL,
|
||||
/**
|
||||
* When an entity spawns as a jockey of another entity (mostly spider jockeys)
|
||||
* When an entity spawns as a jockey of another entity (mostly spider
|
||||
* jockeys)
|
||||
*/
|
||||
JOCKEY,
|
||||
/**
|
||||
|
||||
@@ -73,16 +73,19 @@ public class CreeperPowerEvent extends EntityEvent implements Cancellable {
|
||||
|
||||
/**
|
||||
* Power change caused by a lightning bolt
|
||||
* <p>
|
||||
* Powered state: true
|
||||
*/
|
||||
LIGHTNING,
|
||||
/**
|
||||
* Power change caused by something else (probably a plugin)
|
||||
* <p>
|
||||
* Powered state: true
|
||||
*/
|
||||
SET_ON,
|
||||
/**
|
||||
* Power change caused by something else (probably a plugin)
|
||||
* <p>
|
||||
* Powered state: false
|
||||
*/
|
||||
SET_OFF
|
||||
|
||||
@@ -8,7 +8,7 @@ import org.bukkit.entity.LivingEntity;
|
||||
/**
|
||||
* Called when an {@link Entity} breaks a door
|
||||
* <p>
|
||||
* Canceling the event will cause the event to be delayed
|
||||
* Cancelling the event will cause the event to be delayed
|
||||
*/
|
||||
public class EntityBreakDoorEvent extends EntityChangeBlockEvent {
|
||||
public EntityBreakDoorEvent(final LivingEntity entity, final Block targetBlock) {
|
||||
|
||||
@@ -22,7 +22,8 @@ public class EntityChangeBlockEvent extends EntityEvent implements Cancellable {
|
||||
* @param what the LivingEntity causing the change
|
||||
* @param block the block (before the change)
|
||||
* @param to the future material being changed to
|
||||
* @deprecated Provided as a backward compatibility before the data byte was provided, and type increased to all entities
|
||||
* @deprecated Provided as a backward compatibility before the data byte
|
||||
* was provided, and type increased to all entities
|
||||
*/
|
||||
@Deprecated
|
||||
public EntityChangeBlockEvent(final LivingEntity what, final Block block, final Material to) {
|
||||
|
||||
@@ -29,7 +29,8 @@ public class EntityCombustEvent extends EntityEvent implements Cancellable {
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the amount of time (in seconds) the combustee should be alight for
|
||||
* @return the amount of time (in seconds) the combustee should be alight
|
||||
* for
|
||||
*/
|
||||
public int getDuration() {
|
||||
return duration;
|
||||
@@ -38,7 +39,8 @@ public class EntityCombustEvent extends EntityEvent implements Cancellable {
|
||||
/**
|
||||
* The number of seconds the combustee should be alight for.
|
||||
* <p>
|
||||
* This value will only ever increase the combustion time, not decrease existing combustion times.
|
||||
* This value will only ever increase the combustion time, not decrease
|
||||
* existing combustion times.
|
||||
*
|
||||
* @param duration the time in seconds to be alight for.
|
||||
*/
|
||||
|
||||
@@ -161,7 +161,8 @@ public class EntityDamageEvent extends EntityEvent implements Cancellable {
|
||||
*/
|
||||
BLOCK_EXPLOSION,
|
||||
/**
|
||||
* Damage caused by being in the area when an entity, such as a Creeper, explodes.
|
||||
* Damage caused by being in the area when an entity, such as a
|
||||
* Creeper, explodes.
|
||||
* <p>
|
||||
* Damage: variable
|
||||
*/
|
||||
@@ -215,7 +216,8 @@ public class EntityDamageEvent extends EntityEvent implements Cancellable {
|
||||
*/
|
||||
FALLING_BLOCK,
|
||||
/**
|
||||
* Damage caused in retaliation to another attack by the Thorns enchantment.
|
||||
* Damage caused in retaliation to another attack by the Thorns
|
||||
* enchantment.
|
||||
* <p>
|
||||
* Damage: 1-4 (Thorns)
|
||||
*/
|
||||
|
||||
@@ -31,8 +31,8 @@ public class EntityDeathEvent extends EntityEvent {
|
||||
/**
|
||||
* Gets how much EXP should be dropped from this death.
|
||||
* <p>
|
||||
* This does not indicate how much EXP should be taken from the entity in question,
|
||||
* merely how much should be created after its death.
|
||||
* This does not indicate how much EXP should be taken from the entity in
|
||||
* question, merely how much should be created after its death.
|
||||
*
|
||||
* @return Amount of EXP to drop.
|
||||
*/
|
||||
@@ -43,8 +43,8 @@ public class EntityDeathEvent extends EntityEvent {
|
||||
/**
|
||||
* Sets how much EXP should be dropped from this death.
|
||||
* <p>
|
||||
* This does not indicate how much EXP should be taken from the entity in question,
|
||||
* merely how much should be created after its death.
|
||||
* This does not indicate how much EXP should be taken from the entity in
|
||||
* question, merely how much should be created after its death.
|
||||
*
|
||||
* @param exp Amount of EXP to drop.
|
||||
*/
|
||||
|
||||
@@ -35,8 +35,8 @@ public class EntityExplodeEvent extends EntityEvent implements Cancellable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the list of blocks that would have been removed or were
|
||||
* removed from the explosion event.
|
||||
* Returns the list of blocks that would have been removed or were removed
|
||||
* from the explosion event.
|
||||
*
|
||||
* @return All blown-up blocks
|
||||
*/
|
||||
@@ -46,8 +46,9 @@ public class EntityExplodeEvent extends EntityEvent implements Cancellable {
|
||||
|
||||
/**
|
||||
* Returns the location where the explosion happened.
|
||||
* It is not possible to get this value from the Entity as
|
||||
* the Entity no longer exists in the world.
|
||||
* <p>
|
||||
* It is not possible to get this value from the Entity as the Entity no
|
||||
* longer exists in the world.
|
||||
*
|
||||
* @return The location of the explosion
|
||||
*/
|
||||
|
||||
@@ -8,8 +8,8 @@ import org.bukkit.util.Vector;
|
||||
/**
|
||||
* Called before an entity exits a portal.
|
||||
* <p>
|
||||
* This event allows you to modify the velocity of the entity after they
|
||||
* have successfully exeted the portal.
|
||||
* This event allows you to modify the velocity of the entity after they have
|
||||
* successfully exited the portal.
|
||||
*/
|
||||
public class EntityPortalExitEvent extends EntityTeleportEvent {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
@@ -23,7 +23,8 @@ public class EntityPortalExitEvent extends EntityTeleportEvent {
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a copy of the velocity that the entity has before entering the portal.
|
||||
* Gets a copy of the velocity that the entity has before entering the
|
||||
* portal.
|
||||
*
|
||||
* @return velocity of entity before entering portal
|
||||
*/
|
||||
@@ -32,7 +33,8 @@ public class EntityPortalExitEvent extends EntityTeleportEvent {
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a copy of the velocity that the entity will have after exiting the portal.
|
||||
* Gets a copy of the velocity that the entity will have after exiting the
|
||||
* portal.
|
||||
*
|
||||
* @return velocity of entity after exiting portal
|
||||
*/
|
||||
|
||||
@@ -74,7 +74,8 @@ public class EntityRegainHealthEvent extends EntityEvent implements Cancellable
|
||||
/**
|
||||
* Gets the reason for why the entity is regaining health
|
||||
*
|
||||
* @return A RegainReason detailing the reason for the entity regaining health
|
||||
* @return A RegainReason detailing the reason for the entity regaining
|
||||
* health
|
||||
*/
|
||||
public RegainReason getRegainReason() {
|
||||
return regainReason;
|
||||
@@ -95,11 +96,13 @@ public class EntityRegainHealthEvent extends EntityEvent implements Cancellable
|
||||
public enum RegainReason {
|
||||
|
||||
/**
|
||||
* When a player regains health from regenerating due to Peaceful mode (difficulty=0)
|
||||
* When a player regains health from regenerating due to Peaceful mode
|
||||
* (difficulty=0)
|
||||
*/
|
||||
REGEN,
|
||||
/**
|
||||
* When a player regains health from regenerating due to their hunger being satisfied
|
||||
* When a player regains health from regenerating due to their hunger
|
||||
* being satisfied
|
||||
*/
|
||||
SATIATED,
|
||||
/**
|
||||
|
||||
@@ -30,7 +30,8 @@ public class EntityShootBowEvent extends EntityEvent implements Cancellable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the bow ItemStack used to fire the arrow; is null if the shooter is a skeleton
|
||||
* Gets the bow ItemStack used to fire the arrow; is null if the shooter
|
||||
* is a skeleton
|
||||
*
|
||||
* @return the bow involved in this event, or null
|
||||
*/
|
||||
|
||||
@@ -38,8 +38,9 @@ public class EntityTargetEvent extends EntityEvent implements Cancellable {
|
||||
|
||||
/**
|
||||
* Get the entity that this is targeting.
|
||||
* This will be null in the case that the event is called when
|
||||
* the mob forgets its target.
|
||||
* <p>
|
||||
* This will be null in the case that the event is called when the mob
|
||||
* forgets its target.
|
||||
*
|
||||
* @return The entity
|
||||
*/
|
||||
@@ -49,12 +50,13 @@ public class EntityTargetEvent extends EntityEvent implements Cancellable {
|
||||
|
||||
/**
|
||||
* Set the entity that you want the mob to target instead.
|
||||
* <p>
|
||||
* It is possible to be null, null will cause the entity to be
|
||||
* target-less.
|
||||
* <p>
|
||||
* This is different from cancelling the event. Cancelling the event
|
||||
* will cause the entity to keep an original target, while setting to be
|
||||
* null will cause the entity to be reset
|
||||
* This is different from cancelling the event. Cancelling the event will
|
||||
* cause the entity to keep an original target, while setting to be null
|
||||
* will cause the entity to be reset.
|
||||
*
|
||||
* @param target The entity to target
|
||||
*/
|
||||
@@ -96,15 +98,19 @@ public class EntityTargetEvent extends EntityEvent implements Cancellable {
|
||||
PIG_ZOMBIE_TARGET,
|
||||
/**
|
||||
* When the target is forgotten for whatever reason.
|
||||
* Currently only occurs in with spiders when there is a high brightness
|
||||
* <p>
|
||||
* Currently only occurs in with spiders when there is a high
|
||||
* brightness.
|
||||
*/
|
||||
FORGOT_TARGET,
|
||||
/**
|
||||
* When the target attacks the owner of the entity, so the entity targets it.
|
||||
* When the target attacks the owner of the entity, so the entity
|
||||
* targets it.
|
||||
*/
|
||||
TARGET_ATTACKED_OWNER,
|
||||
/**
|
||||
* When the owner of the entity attacks the target attacks, so the entity targets it.
|
||||
* When the owner of the entity attacks the target attacks, so the
|
||||
* entity targets it.
|
||||
*/
|
||||
OWNER_ATTACKED_TARGET,
|
||||
/**
|
||||
@@ -116,7 +122,7 @@ public class EntityTargetEvent extends EntityEvent implements Cancellable {
|
||||
*/
|
||||
DEFEND_VILLAGE,
|
||||
/**
|
||||
* For custom calls to the event
|
||||
* For custom calls to the event.
|
||||
*/
|
||||
CUSTOM
|
||||
}
|
||||
|
||||
@@ -4,7 +4,8 @@ import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
|
||||
/**
|
||||
* Called when an Entity targets a {@link LivingEntity} and can only target LivingEntity's.
|
||||
* Called when an Entity targets a {@link LivingEntity} and can only target
|
||||
* LivingEntity's.
|
||||
*/
|
||||
public class EntityTargetLivingEntityEvent extends EntityTargetEvent{
|
||||
public EntityTargetLivingEntityEvent(final Entity entity, final LivingEntity target, final TargetReason reason) {
|
||||
@@ -17,10 +18,11 @@ public class EntityTargetLivingEntityEvent extends EntityTargetEvent{
|
||||
|
||||
/**
|
||||
* Set the Entity that you want the mob to target.
|
||||
* <p>
|
||||
* It is possible to be null, null will cause the entity to be
|
||||
* target-less.
|
||||
* <p>
|
||||
* Must be a LivingEntity, or null
|
||||
* Must be a LivingEntity, or null.
|
||||
*
|
||||
* @param target The entity to target
|
||||
*/
|
||||
|
||||
@@ -6,8 +6,8 @@ import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
/**
|
||||
* Thrown when a non-player entity (such as an Enderman) tries to teleport from one
|
||||
* location to another.
|
||||
* Thrown when a non-player entity (such as an Enderman) tries to teleport
|
||||
* from one location to another.
|
||||
*/
|
||||
public class EntityTeleportEvent extends EntityEvent implements Cancellable {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
|
||||
@@ -1,73 +1,75 @@
|
||||
package org.bukkit.event.entity;
|
||||
|
||||
import org.bukkit.entity.ThrownExpBottle;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
/**
|
||||
* Called when a ThrownExpBottle hits and releases experience.
|
||||
*/
|
||||
public class ExpBottleEvent extends ProjectileHitEvent {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
private int exp;
|
||||
private boolean showEffect = true;
|
||||
|
||||
public ExpBottleEvent(final ThrownExpBottle bottle, final int exp) {
|
||||
super(bottle);
|
||||
this.exp = exp;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ThrownExpBottle getEntity() {
|
||||
return (ThrownExpBottle) entity;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method indicates if the particle effect should be shown.
|
||||
*
|
||||
* @return true if the effect will be shown, false otherwise
|
||||
*/
|
||||
public boolean getShowEffect() {
|
||||
return this.showEffect;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method sets if the particle effect will be shown.
|
||||
* This does not change the experience created.
|
||||
*
|
||||
* @param showEffect
|
||||
* true indicates the effect will be shown,
|
||||
* false indicates no effect will be shown
|
||||
*/
|
||||
public void setShowEffect(final boolean showEffect) {
|
||||
this.showEffect = showEffect;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method retrieves the amount of experience to be created.
|
||||
* The number indicates a total amount to be divided into orbs.
|
||||
*
|
||||
* @return the total amount of experience to be created
|
||||
*/
|
||||
public int getExperience() {
|
||||
return exp;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method sets the amount of experience to be created.
|
||||
* The number indicates a total amount to be divided into orbs.
|
||||
*
|
||||
* @param exp the total amount of experience to be created
|
||||
*/
|
||||
public void setExperience(final int exp) {
|
||||
this.exp = exp;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
}
|
||||
package org.bukkit.event.entity;
|
||||
|
||||
import org.bukkit.entity.ThrownExpBottle;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
/**
|
||||
* Called when a ThrownExpBottle hits and releases experience.
|
||||
*/
|
||||
public class ExpBottleEvent extends ProjectileHitEvent {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
private int exp;
|
||||
private boolean showEffect = true;
|
||||
|
||||
public ExpBottleEvent(final ThrownExpBottle bottle, final int exp) {
|
||||
super(bottle);
|
||||
this.exp = exp;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ThrownExpBottle getEntity() {
|
||||
return (ThrownExpBottle) entity;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method indicates if the particle effect should be shown.
|
||||
*
|
||||
* @return true if the effect will be shown, false otherwise
|
||||
*/
|
||||
public boolean getShowEffect() {
|
||||
return this.showEffect;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method sets if the particle effect will be shown.
|
||||
* <p>
|
||||
* This does not change the experience created.
|
||||
*
|
||||
* @param showEffect true indicates the effect will be shown, false
|
||||
* indicates no effect will be shown
|
||||
*/
|
||||
public void setShowEffect(final boolean showEffect) {
|
||||
this.showEffect = showEffect;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method retrieves the amount of experience to be created.
|
||||
* <p>
|
||||
* The number indicates a total amount to be divided into orbs.
|
||||
*
|
||||
* @return the total amount of experience to be created
|
||||
*/
|
||||
public int getExperience() {
|
||||
return exp;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method sets the amount of experience to be created.
|
||||
* <p>
|
||||
* The number indicates a total amount to be divided into orbs.
|
||||
*
|
||||
* @param exp the total amount of experience to be created
|
||||
*/
|
||||
public void setExperience(final int exp) {
|
||||
this.exp = exp;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,7 +23,8 @@ public class FoodLevelChangeEvent extends EntityEvent implements Cancellable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the resultant food level that the entity involved in this event should be set to.
|
||||
* Gets the resultant food level that the entity involved in this event
|
||||
* should be set to.
|
||||
* <p>
|
||||
* Where 20 is a full food bar and 0 is an empty one.
|
||||
*
|
||||
@@ -34,9 +35,11 @@ public class FoodLevelChangeEvent extends EntityEvent implements Cancellable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the resultant food level that the entity involved in this event should be set to
|
||||
* Sets the resultant food level that the entity involved in this event
|
||||
* should be set to
|
||||
*
|
||||
* @param level the resultant food level that the entity involved in this event should be set to
|
||||
* @param level the resultant food level that the entity involved in this
|
||||
* event should be set to
|
||||
*/
|
||||
public void setFoodLevel(int level) {
|
||||
if (level > 20) level = 20;
|
||||
|
||||
@@ -35,15 +35,15 @@ public class HorseJumpEvent extends EntityEvent implements Cancellable {
|
||||
* <p>
|
||||
* Power is a value that defines how much of the horse's jump strength
|
||||
* should be used for the jump. Power is effectively multiplied times
|
||||
* the horse's jump strength to determine how high the jump is;
|
||||
* 0 represents no jump strength while 1 represents full jump strength.
|
||||
* the horse's jump strength to determine how high the jump is; 0
|
||||
* represents no jump strength while 1 represents full jump strength.
|
||||
* Setting power to a value above 1 will use additional jump strength
|
||||
* that the horse does not usually have.
|
||||
* <p>
|
||||
* Power does not affect how high the horse is capable of jumping,
|
||||
* only how much of its jumping capability will be used in this jump.
|
||||
* To set the horse's overall jump strength, see
|
||||
* {@link Horse#setJumpStrength(double)}.
|
||||
* Power does not affect how high the horse is capable of jumping, only
|
||||
* how much of its jumping capability will be used in this jump. To set
|
||||
* the horse's overall jump strength, see {@link
|
||||
* Horse#setJumpStrength(double)}.
|
||||
*
|
||||
* @return jump strength
|
||||
*/
|
||||
@@ -54,12 +54,12 @@ public class HorseJumpEvent extends EntityEvent implements Cancellable {
|
||||
/**
|
||||
* Sets the power of the jump.
|
||||
* <p>
|
||||
* Jump power can be set to a value above 1.0 which will increase
|
||||
* the strength of this jump above the horse's actual jump strength.
|
||||
* Jump power can be set to a value above 1.0 which will increase the
|
||||
* strength of this jump above the horse's actual jump strength.
|
||||
* <p>
|
||||
* Setting the jump power to 0 will result in the jump animation
|
||||
* still playing, but the horse not leaving the ground. Only
|
||||
* canceling this event will result in no jump animation at all.
|
||||
* Setting the jump power to 0 will result in the jump animation still
|
||||
* playing, but the horse not leaving the ground. Only canceling this
|
||||
* event will result in no jump animation at all.
|
||||
*
|
||||
* @param power power of the jump
|
||||
*/
|
||||
|
||||
@@ -44,8 +44,8 @@ public class PigZapEvent extends EntityEvent implements Cancellable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the zombie pig that will replace the pig,
|
||||
* provided the event is not cancelled first.
|
||||
* Gets the zombie pig that will replace the pig, provided the event is
|
||||
* not cancelled first.
|
||||
*
|
||||
* @return resulting entity
|
||||
*/
|
||||
|
||||
@@ -1,93 +1,94 @@
|
||||
package org.bukkit.event.entity;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.commons.lang.Validate;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.ThrownPotion;
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
/**
|
||||
* Called when a splash potion hits an area
|
||||
*/
|
||||
public class PotionSplashEvent extends ProjectileHitEvent implements Cancellable {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
private boolean cancelled;
|
||||
private final Map<LivingEntity, Double> affectedEntities;
|
||||
|
||||
public PotionSplashEvent(final ThrownPotion potion, final Map<LivingEntity, Double> affectedEntities) {
|
||||
super(potion);
|
||||
|
||||
this.affectedEntities = affectedEntities;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ThrownPotion getEntity() {
|
||||
return (ThrownPotion) entity;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the potion which caused this event
|
||||
*
|
||||
* @return The thrown potion entity
|
||||
*/
|
||||
public ThrownPotion getPotion() {
|
||||
return (ThrownPotion) getEntity();
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves a list of all effected entities
|
||||
*
|
||||
* @return A fresh copy of the affected entity list
|
||||
*/
|
||||
public Collection<LivingEntity> getAffectedEntities() {
|
||||
return new ArrayList<LivingEntity>(affectedEntities.keySet());
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the intensity of the potion's effects for given entity;
|
||||
* This depends on the distance to the impact center
|
||||
*
|
||||
* @param entity Which entity to get intensity for
|
||||
* @return intensity relative to maximum effect; 0.0: not affected; 1.0: fully hit by potion effects
|
||||
*/
|
||||
public double getIntensity(LivingEntity entity) {
|
||||
Double intensity = affectedEntities.get(entity);
|
||||
return intensity != null ? intensity : 0.0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Overwrites the intensity for a given entity
|
||||
*
|
||||
* @param entity For which entity to define a new intensity
|
||||
* @param intensity relative to maximum effect
|
||||
*/
|
||||
public void setIntensity(LivingEntity entity, double intensity) {
|
||||
Validate.notNull(entity, "You must specify a valid entity.");
|
||||
if (intensity <= 0.0) {
|
||||
affectedEntities.remove(entity);
|
||||
} else {
|
||||
affectedEntities.put(entity, Math.min(intensity, 1.0));
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isCancelled() {
|
||||
return cancelled;
|
||||
}
|
||||
|
||||
public void setCancelled(boolean cancel) {
|
||||
cancelled = cancel;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
}
|
||||
package org.bukkit.event.entity;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.commons.lang.Validate;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.ThrownPotion;
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
/**
|
||||
* Called when a splash potion hits an area
|
||||
*/
|
||||
public class PotionSplashEvent extends ProjectileHitEvent implements Cancellable {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
private boolean cancelled;
|
||||
private final Map<LivingEntity, Double> affectedEntities;
|
||||
|
||||
public PotionSplashEvent(final ThrownPotion potion, final Map<LivingEntity, Double> affectedEntities) {
|
||||
super(potion);
|
||||
|
||||
this.affectedEntities = affectedEntities;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ThrownPotion getEntity() {
|
||||
return (ThrownPotion) entity;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the potion which caused this event
|
||||
*
|
||||
* @return The thrown potion entity
|
||||
*/
|
||||
public ThrownPotion getPotion() {
|
||||
return (ThrownPotion) getEntity();
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves a list of all effected entities
|
||||
*
|
||||
* @return A fresh copy of the affected entity list
|
||||
*/
|
||||
public Collection<LivingEntity> getAffectedEntities() {
|
||||
return new ArrayList<LivingEntity>(affectedEntities.keySet());
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the intensity of the potion's effects for given entity; This
|
||||
* depends on the distance to the impact center
|
||||
*
|
||||
* @param entity Which entity to get intensity for
|
||||
* @return intensity relative to maximum effect; 0.0: not affected; 1.0:
|
||||
* fully hit by potion effects
|
||||
*/
|
||||
public double getIntensity(LivingEntity entity) {
|
||||
Double intensity = affectedEntities.get(entity);
|
||||
return intensity != null ? intensity : 0.0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Overwrites the intensity for a given entity
|
||||
*
|
||||
* @param entity For which entity to define a new intensity
|
||||
* @param intensity relative to maximum effect
|
||||
*/
|
||||
public void setIntensity(LivingEntity entity, double intensity) {
|
||||
Validate.notNull(entity, "You must specify a valid entity.");
|
||||
if (intensity <= 0.0) {
|
||||
affectedEntities.remove(entity);
|
||||
} else {
|
||||
affectedEntities.put(entity, Math.min(intensity, 1.0));
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isCancelled() {
|
||||
return cancelled;
|
||||
}
|
||||
|
||||
public void setCancelled(boolean cancel) {
|
||||
cancelled = cancel;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,41 +1,41 @@
|
||||
package org.bukkit.event.entity;
|
||||
|
||||
import org.bukkit.entity.Sheep;
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
/**
|
||||
* Called when a sheep regrows its wool
|
||||
*/
|
||||
public class SheepRegrowWoolEvent extends EntityEvent implements Cancellable {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
private boolean cancel;
|
||||
|
||||
public SheepRegrowWoolEvent(final Sheep sheep) {
|
||||
super(sheep);
|
||||
this.cancel = false;
|
||||
}
|
||||
|
||||
public boolean isCancelled() {
|
||||
return cancel;
|
||||
}
|
||||
|
||||
public void setCancelled(boolean cancel) {
|
||||
this.cancel = cancel;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Sheep getEntity() {
|
||||
return (Sheep) entity;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
}
|
||||
package org.bukkit.event.entity;
|
||||
|
||||
import org.bukkit.entity.Sheep;
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
/**
|
||||
* Called when a sheep regrows its wool
|
||||
*/
|
||||
public class SheepRegrowWoolEvent extends EntityEvent implements Cancellable {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
private boolean cancel;
|
||||
|
||||
public SheepRegrowWoolEvent(final Sheep sheep) {
|
||||
super(sheep);
|
||||
this.cancel = false;
|
||||
}
|
||||
|
||||
public boolean isCancelled() {
|
||||
return cancel;
|
||||
}
|
||||
|
||||
public void setCancelled(boolean cancel) {
|
||||
this.cancel = cancel;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Sheep getEntity() {
|
||||
return (Sheep) entity;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -7,7 +7,8 @@ import org.bukkit.event.block.BlockEvent;
|
||||
import org.bukkit.inventory.BrewerInventory;
|
||||
|
||||
/**
|
||||
* Called when the brewing of the contents inside the Brewing Stand is complete.
|
||||
* Called when the brewing of the contents inside the Brewing Stand is
|
||||
* complete.
|
||||
*/
|
||||
public class BrewEvent extends BlockEvent implements Cancellable {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
|
||||
@@ -22,13 +22,11 @@ public enum ClickType {
|
||||
*/
|
||||
SHIFT_RIGHT,
|
||||
/**
|
||||
* Clicking the left mouse button on the grey area around the
|
||||
* inventory.
|
||||
* Clicking the left mouse button on the grey area around the inventory.
|
||||
*/
|
||||
WINDOW_BORDER_LEFT,
|
||||
/**
|
||||
* Clicking the right mouse button on the grey area around the
|
||||
* inventory.
|
||||
* Clicking the right mouse button on the grey area around the inventory.
|
||||
*/
|
||||
WINDOW_BORDER_RIGHT,
|
||||
/**
|
||||
@@ -57,8 +55,9 @@ public enum ClickType {
|
||||
CREATIVE,
|
||||
/**
|
||||
* A type of inventory manipulation not yet recognized by Bukkit.
|
||||
* This is only for transitional purposes on a new Minecraft update,
|
||||
* and should never be relied upon.
|
||||
* <p>
|
||||
* This is only for transitional purposes on a new Minecraft update, and
|
||||
* should never be relied upon.
|
||||
* <p>
|
||||
* Any ClickType.UNKNOWN is called on a best-effort basis.
|
||||
*/
|
||||
|
||||
@@ -1,18 +1,17 @@
|
||||
package org.bukkit.event.inventory;
|
||||
|
||||
/**
|
||||
* Represents the effect of a drag that will be applied to an Inventory in an
|
||||
* InventoryDragEvent.
|
||||
*/
|
||||
public enum DragType {
|
||||
/**
|
||||
* One item from the cursor is placed in each selected slot.
|
||||
*/
|
||||
SINGLE,
|
||||
/**
|
||||
* The cursor is split evenly across all selected slots, not to
|
||||
* exceed the Material's max stack size, with the remainder going to
|
||||
* the cursor.
|
||||
*/
|
||||
EVEN,
|
||||
}
|
||||
package org.bukkit.event.inventory;
|
||||
|
||||
/**
|
||||
* Represents the effect of a drag that will be applied to an Inventory in an
|
||||
* InventoryDragEvent.
|
||||
*/
|
||||
public enum DragType {
|
||||
/**
|
||||
* One item from the cursor is placed in each selected slot.
|
||||
*/
|
||||
SINGLE,
|
||||
/**
|
||||
* The cursor is split evenly across all selected slots, not to exceed the
|
||||
* Material's max stack size, with the remainder going to the cursor.
|
||||
*/
|
||||
EVEN,
|
||||
}
|
||||
|
||||
@@ -8,9 +8,8 @@ public enum InventoryAction {
|
||||
/**
|
||||
* Nothing will happen from the click.
|
||||
* <p>
|
||||
* There may be cases where nothing will happen and this is value is
|
||||
* not provided, but it is guaranteed that this value is accurate
|
||||
* when given.
|
||||
* There may be cases where nothing will happen and this is value is not
|
||||
* provided, but it is guaranteed that this value is accurate when given.
|
||||
*/
|
||||
NOTHING,
|
||||
/**
|
||||
@@ -67,8 +66,8 @@ public enum InventoryAction {
|
||||
*/
|
||||
MOVE_TO_OTHER_INVENTORY,
|
||||
/**
|
||||
* The clicked item is moved to the hotbar, and the item currently
|
||||
* there is re-added to the player's inventory.
|
||||
* The clicked item is moved to the hotbar, and the item currently there
|
||||
* is re-added to the player's inventory.
|
||||
*/
|
||||
HOTBAR_MOVE_AND_READD,
|
||||
/**
|
||||
@@ -80,8 +79,8 @@ public enum InventoryAction {
|
||||
*/
|
||||
CLONE_STACK,
|
||||
/**
|
||||
* The inventory is searched for the same material, and they are put
|
||||
* on the cursor up to {@link org.bukkit.Material#getMaxStackSize()}.
|
||||
* The inventory is searched for the same material, and they are put on
|
||||
* the cursor up to {@link org.bukkit.Material#getMaxStackSize()}.
|
||||
*/
|
||||
COLLECT_TO_CURSOR,
|
||||
/**
|
||||
|
||||
@@ -30,7 +30,8 @@ public class InventoryEvent extends Event {
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the list of players viewing the primary (upper) inventory involved in this event
|
||||
* Gets the list of players viewing the primary (upper) inventory involved
|
||||
* in this event
|
||||
*
|
||||
* @return A list of people viewing.
|
||||
*/
|
||||
|
||||
@@ -8,8 +8,8 @@ import org.bukkit.inventory.Inventory;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
/**
|
||||
* Called when some entity or block (e.g. hopper) tries to move items
|
||||
* directly from one inventory to another.
|
||||
* Called when some entity or block (e.g. hopper) tries to move items directly
|
||||
* from one inventory to another.
|
||||
* <p>
|
||||
* When this event is called, the initiator may already have removed the item
|
||||
* from the source inventory and is ready to move it into the destination
|
||||
@@ -18,11 +18,10 @@ import org.bukkit.inventory.ItemStack;
|
||||
* If this event is cancelled, the items will be returned to the source
|
||||
* inventory, if needed.
|
||||
* <p>
|
||||
* If this event is not cancelled, the initiator will try to put the
|
||||
* ItemStack into the destination inventory. If this is not possible and the
|
||||
* ItemStack has not been modified, the source inventory slot will be
|
||||
* restored to its former state. Otherwise any additional items will be
|
||||
* discarded.
|
||||
* If this event is not cancelled, the initiator will try to put the ItemStack
|
||||
* into the destination inventory. If this is not possible and the ItemStack
|
||||
* has not been modified, the source inventory slot will be restored to its
|
||||
* former state. Otherwise any additional items will be discarded.
|
||||
*/
|
||||
public class InventoryMoveItemEvent extends Event implements Cancellable {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
@@ -50,8 +49,8 @@ public class InventoryMoveItemEvent extends Event implements Cancellable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the ItemStack being moved; if modified, the original item will
|
||||
* not be removed from the source inventory.
|
||||
* Gets the ItemStack being moved; if modified, the original item will not
|
||||
* be removed from the source inventory.
|
||||
*
|
||||
* @return ItemStack
|
||||
*/
|
||||
@@ -81,8 +80,8 @@ public class InventoryMoveItemEvent extends Event implements Cancellable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the Inventory that initiated the transfer. This will always
|
||||
* be either the destination or source Inventory.
|
||||
* Gets the Inventory that initiated the transfer. This will always be
|
||||
* either the destination or source Inventory.
|
||||
*
|
||||
* @return Inventory that initiated the transfer
|
||||
*/
|
||||
|
||||
@@ -30,7 +30,8 @@ public class InventoryOpenEvent extends InventoryEvent implements Cancellable {
|
||||
* Gets the cancellation state of this event. A cancelled event will not
|
||||
* be executed in the server, but will still pass to other plugins.
|
||||
* <p>
|
||||
* If an inventory open event is cancelled, the inventory screen will not show.
|
||||
* If an inventory open event is cancelled, the inventory screen will not
|
||||
* show.
|
||||
*
|
||||
* @return true if this event is cancelled
|
||||
*/
|
||||
@@ -42,7 +43,8 @@ public class InventoryOpenEvent extends InventoryEvent implements Cancellable {
|
||||
* Sets the cancellation state of this event. A cancelled event will not
|
||||
* be executed in the server, but will still pass to other plugins.
|
||||
* <p>
|
||||
* If an inventory open event is cancelled, the inventory screen will not show.
|
||||
* If an inventory open event is cancelled, the inventory screen will not
|
||||
* show.
|
||||
*
|
||||
* @param cancel true if you wish to cancel this event
|
||||
*/
|
||||
|
||||
@@ -3,7 +3,8 @@ package org.bukkit.event.inventory;
|
||||
public enum InventoryType {
|
||||
|
||||
/**
|
||||
* A chest inventory, with 0, 9, 18, 27, 36, 45, or 54 slots of type CONTAINER.
|
||||
* A chest inventory, with 0, 9, 18, 27, 36, 45, or 54 slots of type
|
||||
* CONTAINER.
|
||||
*/
|
||||
CHEST(27,"Chest"),
|
||||
/**
|
||||
@@ -15,7 +16,8 @@ public enum InventoryType {
|
||||
*/
|
||||
DROPPER(9, "Dropper"),
|
||||
/**
|
||||
* A furnace inventory, with a RESULT slot, a CRAFTING slot, and a FUEL slot.
|
||||
* A furnace inventory, with a RESULT slot, a CRAFTING slot, and a FUEL
|
||||
* slot.
|
||||
*/
|
||||
FURNACE(3,"Furnace"),
|
||||
/**
|
||||
@@ -23,12 +25,13 @@ public enum InventoryType {
|
||||
*/
|
||||
WORKBENCH(10,"Crafting"),
|
||||
/**
|
||||
* A player's crafting inventory, with 4 CRAFTING slots and a RESULT slot. Also implies that the
|
||||
* 4 ARMOR slots are accessible.
|
||||
* A player's crafting inventory, with 4 CRAFTING slots and a RESULT slot.
|
||||
* Also implies that the 4 ARMOR slots are accessible.
|
||||
*/
|
||||
CRAFTING(5,"Crafting"),
|
||||
/**
|
||||
* An enchantment table inventory, with one CRAFTING slot and three enchanting buttons.
|
||||
* An enchantment table inventory, with one CRAFTING slot and three
|
||||
* enchanting buttons.
|
||||
*/
|
||||
ENCHANTING(1,"Enchanting"),
|
||||
/**
|
||||
@@ -36,13 +39,14 @@ public enum InventoryType {
|
||||
*/
|
||||
BREWING(4,"Brewing"),
|
||||
/**
|
||||
* A player's inventory, with 9 QUICKBAR slots, 27 CONTAINER slots, and 4 ARMOR slots. The
|
||||
* ARMOUR slots may not be visible to the player, though.
|
||||
* A player's inventory, with 9 QUICKBAR slots, 27 CONTAINER slots, and 4
|
||||
* ARMOR slots. The ARMOUR slots may not be visible to the player, though.
|
||||
*/
|
||||
PLAYER(36,"Player"),
|
||||
/**
|
||||
* The creative mode inventory, with only 9 QUICKBAR slots and nothing else. (The actual
|
||||
* creative interface with the items is client-side and cannot be altered by the server.)
|
||||
* The creative mode inventory, with only 9 QUICKBAR slots and nothing
|
||||
* else. (The actual creative interface with the items is client-side and
|
||||
* cannot be altered by the server.)
|
||||
*/
|
||||
CREATIVE(9,"Creative"),
|
||||
/**
|
||||
@@ -89,8 +93,9 @@ public enum InventoryType {
|
||||
*/
|
||||
RESULT,
|
||||
/**
|
||||
* A slot in the crafting matrix, or the input slot in a furnace inventory,
|
||||
* the potion slot in the brewing stand, or the enchanting slot.
|
||||
* A slot in the crafting matrix, or the input slot in a furnace
|
||||
* inventory, the potion slot in the brewing stand, or the enchanting
|
||||
* slot.
|
||||
*/
|
||||
CRAFTING,
|
||||
/**
|
||||
@@ -98,8 +103,8 @@ public enum InventoryType {
|
||||
*/
|
||||
ARMOR,
|
||||
/**
|
||||
* A regular slot in the container or the player's inventory; anything not covered
|
||||
* by the other enum values.
|
||||
* A regular slot in the container or the player's inventory; anything
|
||||
* not covered by the other enum values.
|
||||
*/
|
||||
CONTAINER,
|
||||
/**
|
||||
@@ -111,7 +116,8 @@ public enum InventoryType {
|
||||
*/
|
||||
OUTSIDE,
|
||||
/**
|
||||
* The fuel slot in a furnace inventory, or the ingredient slot in a brewing stand inventory.
|
||||
* The fuel slot in a furnace inventory, or the ingredient slot in a
|
||||
* brewing stand inventory.
|
||||
*/
|
||||
FUEL;
|
||||
}
|
||||
|
||||
@@ -17,8 +17,9 @@ public class PrepareItemCraftEvent extends InventoryEvent {
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the recipe that has been formed. If this event was triggered by a tool repair, this
|
||||
* will be a temporary shapeless recipe representing the repair.
|
||||
* Get the recipe that has been formed. If this event was triggered by a
|
||||
* tool repair, this will be a temporary shapeless recipe representing the
|
||||
* repair.
|
||||
*
|
||||
* @return The recipe being crafted.
|
||||
*/
|
||||
@@ -35,7 +36,8 @@ public class PrepareItemCraftEvent extends InventoryEvent {
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if this event was triggered by a tool repair operation rather than a crafting recipe.
|
||||
* Check if this event was triggered by a tool repair operation rather
|
||||
* than a crafting recipe.
|
||||
*
|
||||
* @return True if this is a repair.
|
||||
*/
|
||||
|
||||
@@ -6,7 +6,9 @@ import org.bukkit.entity.Painting;
|
||||
|
||||
/**
|
||||
* Triggered when a painting is removed by an entity
|
||||
* @deprecated Use {@link org.bukkit.event.hanging.HangingBreakByEntityEvent} instead.
|
||||
*
|
||||
* @deprecated Use {@link org.bukkit.event.hanging.HangingBreakByEntityEvent}
|
||||
* instead.
|
||||
*/
|
||||
@Deprecated
|
||||
@Warning(reason="This event has been replaced by HangingBreakByEntityEvent")
|
||||
|
||||
@@ -7,6 +7,7 @@ import org.bukkit.event.HandlerList;
|
||||
|
||||
/**
|
||||
* Triggered when a painting is removed
|
||||
*
|
||||
* @deprecated Use {@link org.bukkit.event.hanging.HangingBreakEvent} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
|
||||
@@ -6,6 +6,7 @@ import org.bukkit.event.Event;
|
||||
|
||||
/**
|
||||
* Represents a painting-related event.
|
||||
*
|
||||
* @deprecated Use {@link org.bukkit.event.hanging.HangingEvent} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
|
||||
@@ -10,6 +10,7 @@ import org.bukkit.event.HandlerList;
|
||||
|
||||
/**
|
||||
* Triggered when a painting is created in the world
|
||||
*
|
||||
* @deprecated Use {@link org.bukkit.event.hanging.HangingPlaceEvent} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
@@ -49,7 +50,8 @@ public class PaintingPlaceEvent extends PaintingEvent implements Cancellable {
|
||||
/**
|
||||
* Returns the face of the block that the painting was placed on
|
||||
*
|
||||
* @return BlockFace returns the face of the block the painting was placed on
|
||||
* @return BlockFace returns the face of the block the painting was placed
|
||||
* on
|
||||
*/
|
||||
public BlockFace getBlockFace() {
|
||||
return blockFace;
|
||||
|
||||
@@ -8,14 +8,20 @@ import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
/**
|
||||
* This event will sometimes fire synchronously, depending on how it was triggered.
|
||||
* The constructor provides a boolean to indicate if the event was fired synchronously or asynchronously.
|
||||
* When asynchronous, this event can be called from any thread, but the main thread, and has limited access to the API.<br>
|
||||
* <br>
|
||||
* If a player is the direct cause of this event by incoming packet, this event will be asynchronous.
|
||||
* If a plugin triggers this event by compelling a player to chat, this event will be synchronous.<br>
|
||||
* <br>
|
||||
* <b>Care should be taken to check {@link #isAsynchronous()} and treat the event appropriately.</b>
|
||||
* This event will sometimes fire synchronously, depending on how it was
|
||||
* triggered.
|
||||
* <p>
|
||||
* The constructor provides a boolean to indicate if the event was fired
|
||||
* synchronously or asynchronously. When asynchronous, this event can be
|
||||
* called from any thread, but the main thread, and has limited access to the
|
||||
* API.
|
||||
* <p>
|
||||
* If a player is the direct cause of this event by incoming packet, this
|
||||
* event will be asynchronous. If a plugin triggers this event by compelling a
|
||||
* player to chat, this event will be synchronous.
|
||||
* <p>
|
||||
* Care should be taken to check {@link #isAsynchronous()} and treat the event
|
||||
* appropriately.
|
||||
*/
|
||||
public class AsyncPlayerChatEvent extends PlayerEvent implements Cancellable {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
@@ -29,7 +35,8 @@ public class AsyncPlayerChatEvent extends PlayerEvent implements Cancellable {
|
||||
* @param async This changes the event to a synchronous state.
|
||||
* @param who the chat sender
|
||||
* @param message the message sent
|
||||
* @param players the players to receive the message. This may be a lazy or unmodifiable collection.
|
||||
* @param players the players to receive the message. This may be a lazy
|
||||
* or unmodifiable collection.
|
||||
*/
|
||||
public AsyncPlayerChatEvent(final boolean async, final Player who, final String message, final Set<Player> players) {
|
||||
super(who, async);
|
||||
@@ -38,7 +45,8 @@ public class AsyncPlayerChatEvent extends PlayerEvent implements Cancellable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the message that the player is attempting to send. This message will be used with {@link #getFormat()}.
|
||||
* Gets the message that the player is attempting to send. This message
|
||||
* will be used with {@link #getFormat()}.
|
||||
*
|
||||
* @return Message the player is attempting to send
|
||||
*/
|
||||
@@ -47,7 +55,8 @@ public class AsyncPlayerChatEvent extends PlayerEvent implements Cancellable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the message that the player will send. This message will be used with {@link #getFormat()}.
|
||||
* Sets the message that the player will send. This message will be used
|
||||
* with {@link #getFormat()}.
|
||||
*
|
||||
* @param message New message that the player will send
|
||||
*/
|
||||
@@ -57,9 +66,13 @@ public class AsyncPlayerChatEvent extends PlayerEvent implements Cancellable {
|
||||
|
||||
/**
|
||||
* Gets the format to use to display this chat message.
|
||||
* When this event finishes execution, the first format parameter is the {@link Player#getDisplayName()} and the second parameter is {@link #getMessage()}
|
||||
* <p>
|
||||
* When this event finishes execution, the first format parameter is the
|
||||
* {@link Player#getDisplayName()} and the second parameter is {@link
|
||||
* #getMessage()}
|
||||
*
|
||||
* @return {@link String#format(String, Object...)} compatible format string
|
||||
* @return {@link String#format(String, Object...)} compatible format
|
||||
* string
|
||||
*/
|
||||
public String getFormat() {
|
||||
return format;
|
||||
@@ -67,10 +80,15 @@ public class AsyncPlayerChatEvent extends PlayerEvent implements Cancellable {
|
||||
|
||||
/**
|
||||
* Sets the format to use to display this chat message.
|
||||
* When this event finishes execution, the first format parameter is the {@link Player#getDisplayName()} and the second parameter is {@link #getMessage()}
|
||||
* <p>
|
||||
* When this event finishes execution, the first format parameter is the
|
||||
* {@link Player#getDisplayName()} and the second parameter is {@link
|
||||
* #getMessage()}
|
||||
*
|
||||
* @param format {@link String#format(String, Object...)} compatible format string
|
||||
* @throws IllegalFormatException if the underlying API throws the exception
|
||||
* @param format {@link String#format(String, Object...)} compatible
|
||||
* format string
|
||||
* @throws IllegalFormatException if the underlying API throws the
|
||||
* exception
|
||||
* @throws NullPointerException if format is null
|
||||
* @see String#format(String, Object...)
|
||||
*/
|
||||
@@ -88,10 +106,14 @@ public class AsyncPlayerChatEvent extends PlayerEvent implements Cancellable {
|
||||
|
||||
/**
|
||||
* Gets a set of recipients that this chat message will be displayed to.
|
||||
* The set returned is not guaranteed to be mutable and may auto-populate on access.
|
||||
* Any listener accessing the returned set should be aware that it may reduce performance for a lazy set implementation.<br>
|
||||
* <br>
|
||||
* <b>Listeners should be aware that modifying the list may throw {@link UnsupportedOperationException} if the event caller provides an unmodifiable set.</b>
|
||||
* <p>
|
||||
* The set returned is not guaranteed to be mutable and may auto-populate
|
||||
* on access. Any listener accessing the returned set should be aware that
|
||||
* it may reduce performance for a lazy set implementation.
|
||||
* <p>
|
||||
* Listeners should be aware that modifying the list may throw {@link
|
||||
* UnsupportedOperationException} if the event caller provides an
|
||||
* unmodifiable set.
|
||||
*
|
||||
* @return All Players who will see this chat message
|
||||
*/
|
||||
|
||||
@@ -6,7 +6,8 @@ import org.bukkit.event.Event;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
/**
|
||||
* Stores details for players attempting to log in.<br>
|
||||
* Stores details for players attempting to log in.
|
||||
* <p>
|
||||
* This event is asynchronous, and not run using main thread.
|
||||
*/
|
||||
public class AsyncPlayerPreLoginEvent extends Event {
|
||||
@@ -37,7 +38,8 @@ public class AsyncPlayerPreLoginEvent extends Event {
|
||||
* Gets the current result of the login, as an enum
|
||||
*
|
||||
* @return Current Result of the login
|
||||
* @deprecated This method uses a deprecated enum from {@link PlayerPreLoginEvent}
|
||||
* @deprecated This method uses a deprecated enum from {@link
|
||||
* PlayerPreLoginEvent}
|
||||
* @see #getLoginResult()
|
||||
*/
|
||||
@Deprecated
|
||||
@@ -58,7 +60,8 @@ public class AsyncPlayerPreLoginEvent extends Event {
|
||||
* Sets the new result of the login, as an enum
|
||||
*
|
||||
* @param result New result to set
|
||||
* @deprecated This method uses a deprecated enum from {@link PlayerPreLoginEvent}
|
||||
* @deprecated This method uses a deprecated enum from {@link
|
||||
* PlayerPreLoginEvent}
|
||||
* @see #setLoginResult(Result)
|
||||
*/
|
||||
@Deprecated
|
||||
@@ -67,7 +70,8 @@ public class AsyncPlayerPreLoginEvent extends Event {
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the current kick message that will be used if getResult() != Result.ALLOWED
|
||||
* Gets the current kick message that will be used if getResult() !=
|
||||
* Result.ALLOWED
|
||||
*
|
||||
* @return Current kick message
|
||||
*/
|
||||
@@ -108,7 +112,8 @@ public class AsyncPlayerPreLoginEvent extends Event {
|
||||
*
|
||||
* @param result New result for disallowing the player
|
||||
* @param message Kick message to display to the user
|
||||
* @deprecated This method uses a deprecated enum from {@link PlayerPreLoginEvent}
|
||||
* @deprecated This method uses a deprecated enum from {@link
|
||||
* PlayerPreLoginEvent}
|
||||
* @see #disallow(Result, String)
|
||||
*/
|
||||
@Deprecated
|
||||
@@ -162,7 +167,8 @@ public class AsyncPlayerPreLoginEvent extends Event {
|
||||
*/
|
||||
KICK_BANNED,
|
||||
/**
|
||||
* The player is not allowed to log in, due to them not being on the white list
|
||||
* The player is not allowed to log in, due to them not being on the
|
||||
* white list
|
||||
*/
|
||||
KICK_WHITELIST,
|
||||
/**
|
||||
|
||||
@@ -1,30 +1,31 @@
|
||||
package org.bukkit.event.player;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
/**
|
||||
* This event is called after a player registers or unregisters a new plugin channel.
|
||||
*/
|
||||
public abstract class PlayerChannelEvent extends PlayerEvent {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
private final String channel;
|
||||
|
||||
public PlayerChannelEvent(final Player player, final String channel) {
|
||||
super(player);
|
||||
this.channel = channel;
|
||||
}
|
||||
|
||||
public final String getChannel() {
|
||||
return channel;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
}
|
||||
package org.bukkit.event.player;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
/**
|
||||
* This event is called after a player registers or unregisters a new plugin
|
||||
* channel.
|
||||
*/
|
||||
public abstract class PlayerChannelEvent extends PlayerEvent {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
private final String channel;
|
||||
|
||||
public PlayerChannelEvent(final Player player, final String channel) {
|
||||
super(player);
|
||||
this.channel = channel;
|
||||
}
|
||||
|
||||
public final String getChannel() {
|
||||
return channel;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,10 +12,13 @@ import org.bukkit.event.HandlerList;
|
||||
|
||||
/**
|
||||
* Holds information for player chat and commands
|
||||
* @deprecated This event will fire from the main thread and allows the use of all of the Bukkit API, unlike the {@link AsyncPlayerChatEvent}.<br>
|
||||
* <br>
|
||||
* Listening to this event forces chat to wait for the main thread which causes delays for chat.<br>
|
||||
* {@link AsyncPlayerChatEvent} is the encouraged alternative for thread safe implementations.
|
||||
*
|
||||
* @deprecated This event will fire from the main thread and allows the use of
|
||||
* all of the Bukkit API, unlike the {@link AsyncPlayerChatEvent}.
|
||||
* <p>
|
||||
* Listening to this event forces chat to wait for the main thread which
|
||||
* causes delays for chat. {@link AsyncPlayerChatEvent} is the encouraged
|
||||
* alternative for thread safe implementations.
|
||||
*/
|
||||
@Deprecated
|
||||
@Warning(reason="Listening to this event forces chat to wait for the main thread, delaying chat messages.")
|
||||
|
||||
@@ -40,7 +40,9 @@ public class PlayerChatTabCompleteEvent extends PlayerEvent {
|
||||
|
||||
/**
|
||||
* Gets the last 'token' of the message being tab-completed.
|
||||
* The token is the substring starting with the character after the last space in the message.
|
||||
* <p>
|
||||
* The token is the substring starting with the character after the last
|
||||
* space in the message.
|
||||
*
|
||||
* @return The last token for the chat message
|
||||
*/
|
||||
|
||||
@@ -75,7 +75,9 @@ public class PlayerCommandPreprocessEvent extends PlayerEvent implements Cancell
|
||||
|
||||
/**
|
||||
* Gets the command that the player is attempting to send.
|
||||
* All commands begin with a special character; implementations do not consider the first character when executing the content.
|
||||
* <p>
|
||||
* All commands begin with a special character; implementations do not
|
||||
* consider the first character when executing the content.
|
||||
*
|
||||
* @return Message the player is attempting to send
|
||||
*/
|
||||
@@ -85,7 +87,9 @@ public class PlayerCommandPreprocessEvent extends PlayerEvent implements Cancell
|
||||
|
||||
/**
|
||||
* Sets the command that the player will send.
|
||||
* All commands begin with a special character; implementations do not consider the first character when executing the content.
|
||||
* <p>
|
||||
* All commands begin with a special character; implementations do not
|
||||
* consider the first character when executing the content.
|
||||
*
|
||||
* @param command New message that the player will send
|
||||
* @throws IllegalArgumentException if command is null or empty
|
||||
@@ -110,7 +114,8 @@ public class PlayerCommandPreprocessEvent extends PlayerEvent implements Cancell
|
||||
/**
|
||||
* Gets the format to use to display this chat message
|
||||
*
|
||||
* @deprecated This method is provided for backward compatibility with no guarantee to the use of the format.
|
||||
* @deprecated This method is provided for backward compatibility with no
|
||||
* guarantee to the use of the format.
|
||||
* @return String.Format compatible format string
|
||||
*/
|
||||
@Deprecated
|
||||
@@ -121,7 +126,8 @@ public class PlayerCommandPreprocessEvent extends PlayerEvent implements Cancell
|
||||
/**
|
||||
* Sets the format to use to display this chat message
|
||||
*
|
||||
* @deprecated This method is provided for backward compatibility with no guarantee to the effect of modifying the format.
|
||||
* @deprecated This method is provided for backward compatibility with no
|
||||
* guarantee to the effect of modifying the format.
|
||||
* @param format String.Format compatible format string
|
||||
*/
|
||||
@Deprecated
|
||||
@@ -139,11 +145,16 @@ public class PlayerCommandPreprocessEvent extends PlayerEvent implements Cancell
|
||||
|
||||
/**
|
||||
* Gets a set of recipients that this chat message will be displayed to.
|
||||
* The set returned is not guaranteed to be mutable and may auto-populate on access.
|
||||
* Any listener accessing the returned set should be aware that it may reduce performance for a lazy set implementation.
|
||||
* Listeners should be aware that modifying the list may throw {@link UnsupportedOperationException} if the event caller provides an unmodifiable set.
|
||||
* <p>
|
||||
* The set returned is not guaranteed to be mutable and may auto-populate
|
||||
* on access. Any listener accessing the returned set should be aware that
|
||||
* it may reduce performance for a lazy set implementation. Listeners
|
||||
* should be aware that modifying the list may throw {@link
|
||||
* UnsupportedOperationException} if the event caller provides an
|
||||
* unmodifiable set.
|
||||
*
|
||||
* @deprecated This method is provided for backward compatibility with no guarantee to the effect of viewing or modifying the set.
|
||||
* @deprecated This method is provided for backward compatibility with no
|
||||
* guarantee to the effect of viewing or modifying the set.
|
||||
* @return All Players who will see this chat message
|
||||
*/
|
||||
@Deprecated
|
||||
|
||||
@@ -8,8 +8,8 @@ import org.bukkit.event.HandlerList;
|
||||
import org.bukkit.inventory.meta.BookMeta;
|
||||
|
||||
/**
|
||||
* Called when a player edits or signs a book and quill item. If the event
|
||||
* is cancelled, no changes are made to the BookMeta
|
||||
* Called when a player edits or signs a book and quill item. If the event is
|
||||
* cancelled, no changes are made to the BookMeta
|
||||
*/
|
||||
public class PlayerEditBookEvent extends PlayerEvent implements Cancellable {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
@@ -39,7 +39,7 @@ public class PlayerEditBookEvent extends PlayerEvent implements Cancellable {
|
||||
/**
|
||||
* Gets the book meta currently on the book.
|
||||
* <p>
|
||||
* Note: this is a copy of the book meta. You cannot use this object to
|
||||
* Note: this is a copy of the book meta. You cannot use this object to
|
||||
* change the existing book meta.
|
||||
*
|
||||
* @return the book meta currently on the book
|
||||
@@ -49,12 +49,11 @@ public class PlayerEditBookEvent extends PlayerEvent implements Cancellable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the book meta that the player is attempting to add to
|
||||
* the book.
|
||||
* Gets the book meta that the player is attempting to add to the book.
|
||||
* <p>
|
||||
* Note: this is a copy of the proposed new book meta. Use {@link
|
||||
* #setNewBookMeta(BookMeta)} to change what will actually be
|
||||
* added to the book.
|
||||
* #setNewBookMeta(BookMeta)} to change what will actually be added to the
|
||||
* book.
|
||||
*
|
||||
* @return the book meta that the player is attempting to add
|
||||
*/
|
||||
|
||||
@@ -51,8 +51,8 @@ public class PlayerEggThrowEvent extends PlayerEvent {
|
||||
/**
|
||||
* Sets whether the egg will hatch or not.
|
||||
*
|
||||
* @param hatching true if you want the egg to hatch
|
||||
* false if you want it not to
|
||||
* @param hatching true if you want the egg to hatch, false if you want it
|
||||
* not to
|
||||
*/
|
||||
public void setHatching(boolean hatching) {
|
||||
this.hatching = hatching;
|
||||
@@ -100,12 +100,13 @@ public class PlayerEggThrowEvent extends PlayerEvent {
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the number of mob hatches from the egg. By default the number
|
||||
* will be he number the server would've done
|
||||
* <p>
|
||||
* 7/8 chance of being 0
|
||||
* 31/256 ~= 1/8 chance to be 1
|
||||
* 1/256 chance to be 4
|
||||
* Get the number of mob hatches from the egg. By default the number will
|
||||
* be the number the server would've done
|
||||
* <ul>
|
||||
* <li>7/8 chance of being 0
|
||||
* <li>31/256 ~= 1/8 chance to be 1
|
||||
* <li>1/256 chance to be 4
|
||||
* </ul>
|
||||
*
|
||||
* @return The number of mobs going to be hatched by the egg
|
||||
*/
|
||||
@@ -116,8 +117,8 @@ public class PlayerEggThrowEvent extends PlayerEvent {
|
||||
/**
|
||||
* Change the number of mobs coming out of the hatched egg
|
||||
* <p>
|
||||
* The boolean hatching will override this number.
|
||||
* Ie. If hatching = false, this number will not matter
|
||||
* The boolean hatching will override this number. Ie. If hatching =
|
||||
* false, this number will not matter
|
||||
*
|
||||
* @param numHatches The number of mobs coming out of the egg
|
||||
*/
|
||||
|
||||
@@ -19,7 +19,7 @@ public class PlayerFishEvent extends PlayerEvent implements Cancellable {
|
||||
|
||||
/**
|
||||
* @deprecated replaced by {@link #PlayerFishEvent(Player, Entity, Fish,
|
||||
* State)} to include the {@link Fish} hook entity.
|
||||
* State)} to include the {@link Fish} hook entity.
|
||||
* @param player
|
||||
* @param entity
|
||||
* @param state
|
||||
@@ -39,7 +39,8 @@ public class PlayerFishEvent extends PlayerEvent implements Cancellable {
|
||||
/**
|
||||
* Gets the entity caught by the player
|
||||
*
|
||||
* @return Entity caught by the player, null if fishing, bobber has gotten stuck in the ground or nothing has been caught
|
||||
* @return Entity caught by the player, null if fishing, bobber has gotten
|
||||
* stuck in the ground or nothing has been caught
|
||||
*/
|
||||
public Entity getCaught() {
|
||||
return entity;
|
||||
@@ -65,7 +66,8 @@ public class PlayerFishEvent extends PlayerEvent implements Cancellable {
|
||||
/**
|
||||
* Gets the amount of experience received when fishing.
|
||||
* <p>
|
||||
* Note: This value has no default effect unless the event state is {@link State#CAUGHT_FISH}.
|
||||
* Note: This value has no default effect unless the event state is {@link
|
||||
* State#CAUGHT_FISH}.
|
||||
*
|
||||
* @return the amount of experience to drop
|
||||
*/
|
||||
@@ -76,7 +78,8 @@ public class PlayerFishEvent extends PlayerEvent implements Cancellable {
|
||||
/**
|
||||
* Sets the amount of experience received when fishing.
|
||||
* <p>
|
||||
* Note: This value has no default effect unless the event state is {@link State#CAUGHT_FISH}.
|
||||
* Note: This value has no default effect unless the event state is {@link
|
||||
* State#CAUGHT_FISH}.
|
||||
*
|
||||
* @param amount the amount of experience to drop
|
||||
*/
|
||||
@@ -124,7 +127,8 @@ public class PlayerFishEvent extends PlayerEvent implements Cancellable {
|
||||
*/
|
||||
IN_GROUND,
|
||||
/**
|
||||
* When a player fails to catch anything while fishing usually due to poor aiming or timing
|
||||
* When a player fails to catch anything while fishing usually due to
|
||||
* poor aiming or timing
|
||||
*/
|
||||
FAILED_ATTEMPT,
|
||||
}
|
||||
|
||||
@@ -42,8 +42,8 @@ public class PlayerInteractEvent extends PlayerEvent implements Cancellable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the cancellation state of this event. Set to true if you
|
||||
* want to prevent buckets from placing water and so forth
|
||||
* Gets the cancellation state of this event. Set to true if you want to
|
||||
* prevent buckets from placing water and so forth
|
||||
*
|
||||
* @return boolean cancellation state
|
||||
*/
|
||||
@@ -52,8 +52,8 @@ public class PlayerInteractEvent extends PlayerEvent implements Cancellable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the cancellation state of this event. A canceled event will not
|
||||
* be executed in the server, but will still pass to other plugins
|
||||
* Sets the cancellation state of this event. A canceled event will not be
|
||||
* executed in the server, but will still pass to other plugins
|
||||
* <p>
|
||||
* Canceling this event will prevent use of food (player won't lose the
|
||||
* food item), prevent bows/snowballs/eggs from firing, etc. (player won't
|
||||
@@ -76,8 +76,8 @@ public class PlayerInteractEvent extends PlayerEvent implements Cancellable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method. Returns the material of the item represented by this
|
||||
* event
|
||||
* Convenience method. Returns the material of the item represented by
|
||||
* this event
|
||||
*
|
||||
* @return Material the material of the item used
|
||||
*/
|
||||
@@ -108,8 +108,8 @@ public class PlayerInteractEvent extends PlayerEvent implements Cancellable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method to inform the user whether this was a block placement
|
||||
* event.
|
||||
* Convenience method to inform the user whether this was a block
|
||||
* placement event.
|
||||
*
|
||||
* @return boolean true if the item in hand was a block
|
||||
*/
|
||||
@@ -140,8 +140,9 @@ public class PlayerInteractEvent extends PlayerEvent implements Cancellable {
|
||||
}
|
||||
|
||||
/**
|
||||
* This controls the action to take with the block (if any) that was clicked on
|
||||
* This event gets processed for all blocks, but most don't have a default action
|
||||
* This controls the action to take with the block (if any) that was
|
||||
* clicked on. This event gets processed for all blocks, but most don't
|
||||
* have a default action
|
||||
*
|
||||
* @return the action to take with the interacted block
|
||||
*/
|
||||
@@ -157,9 +158,10 @@ public class PlayerInteractEvent extends PlayerEvent implements Cancellable {
|
||||
}
|
||||
|
||||
/**
|
||||
* This controls the action to take with the item the player is holding
|
||||
* This includes both blocks and items (such as flint and steel or records)
|
||||
* When this is set to default, it will be allowed if no action is taken on the interacted block
|
||||
* This controls the action to take with the item the player is holding.
|
||||
* This includes both blocks and items (such as flint and steel or
|
||||
* records). When this is set to default, it will be allowed if no action
|
||||
* is taken on the interacted block.
|
||||
*
|
||||
* @return the action to take with the item in hand
|
||||
*/
|
||||
|
||||
@@ -7,9 +7,12 @@ import org.bukkit.event.inventory.InventoryOpenEvent;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
|
||||
/**
|
||||
* Represents a player related inventory event; note that this event never actually did anything
|
||||
* @deprecated Use {@link InventoryClickEvent} or {@link InventoryOpenEvent} instead, or one of
|
||||
* the other inventory events in {@link org.bukkit.event.inventory}.
|
||||
* Represents a player related inventory event; note that this event never
|
||||
* actually did anything
|
||||
*
|
||||
* @deprecated Use {@link InventoryClickEvent} or {@link InventoryOpenEvent}
|
||||
* instead, or one of the other inventory events in {@link
|
||||
* org.bukkit.event.inventory}.
|
||||
*/
|
||||
@Deprecated
|
||||
public class PlayerInventoryEvent extends PlayerEvent {
|
||||
|
||||
@@ -6,8 +6,9 @@ import org.bukkit.inventory.ItemStack;
|
||||
|
||||
/**
|
||||
* Fired when a player's item breaks (such as a shovel or flint and steel).
|
||||
* The item that's breaking will exist in the inventory with a stack size of 0.
|
||||
* After the event, the item's durability will be reset to 0.
|
||||
* <p>
|
||||
* The item that's breaking will exist in the inventory with a stack size of
|
||||
* 0. After the event, the item's durability will be reset to 0.
|
||||
*/
|
||||
public class PlayerItemBreakEvent extends PlayerEvent {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
|
||||
@@ -32,11 +32,13 @@ public class PlayerLoginEvent extends PlayerEvent {
|
||||
}
|
||||
|
||||
/**
|
||||
* This constructor defaults message to an empty string, and result to ALLOWED
|
||||
* This constructor defaults message to an empty string, and result to
|
||||
* ALLOWED
|
||||
*
|
||||
* @param player The {@link Player} for this event
|
||||
* @param hostname The hostname that was used to connect to the server
|
||||
* @param address The address the player used to connect, provided for timing issues
|
||||
* @param address The address the player used to connect, provided for
|
||||
* timing issues
|
||||
*/
|
||||
public PlayerLoginEvent(final Player player, final String hostname, final InetAddress address) {
|
||||
super(player);
|
||||
@@ -45,7 +47,8 @@ public class PlayerLoginEvent extends PlayerEvent {
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Address and hostname should be provided in other constructor
|
||||
* @deprecated Address and hostname should be provided in other
|
||||
* constructor
|
||||
*/
|
||||
@Deprecated
|
||||
public PlayerLoginEvent(final Player player, final Result result, final String message) {
|
||||
@@ -57,7 +60,8 @@ public class PlayerLoginEvent extends PlayerEvent {
|
||||
*
|
||||
* @param player The {@link Player} for this event
|
||||
* @param hostname The hostname that was used to connect to the server
|
||||
* @param address The address the player used to connect, provided for timing issues
|
||||
* @param address The address the player used to connect, provided for
|
||||
* timing issues
|
||||
* @param result The result status for this event
|
||||
* @param message The message to be displayed if result denies login
|
||||
*/
|
||||
@@ -86,7 +90,8 @@ public class PlayerLoginEvent extends PlayerEvent {
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the current kick message that will be used if getResult() != Result.ALLOWED
|
||||
* Gets the current kick message that will be used if getResult() !=
|
||||
* Result.ALLOWED
|
||||
*
|
||||
* @return Current kick message
|
||||
*/
|
||||
@@ -104,7 +109,8 @@ public class PlayerLoginEvent extends PlayerEvent {
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the hostname that the player used to connect to the server, or blank if unknown
|
||||
* Gets the hostname that the player used to connect to the server, or
|
||||
* blank if unknown
|
||||
*
|
||||
* @return The hostname
|
||||
*/
|
||||
@@ -132,12 +138,12 @@ public class PlayerLoginEvent extends PlayerEvent {
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the {@link InetAddress} for the Player associated
|
||||
* with this event. This method is provided as a workaround for
|
||||
* player.getAddress() returning null during PlayerLoginEvent.
|
||||
* Gets the {@link InetAddress} for the Player associated with this event.
|
||||
* This method is provided as a workaround for player.getAddress()
|
||||
* returning null during PlayerLoginEvent.
|
||||
*
|
||||
* @return The address for this player. For legacy compatibility,
|
||||
* this may be null.
|
||||
* @return The address for this player. For legacy compatibility, this may
|
||||
* be null.
|
||||
*/
|
||||
public InetAddress getAddress() {
|
||||
return address;
|
||||
@@ -170,7 +176,8 @@ public class PlayerLoginEvent extends PlayerEvent {
|
||||
*/
|
||||
KICK_BANNED,
|
||||
/**
|
||||
* The player is not allowed to log in, due to them not being on the white list
|
||||
* The player is not allowed to log in, due to them not being on the
|
||||
* white list
|
||||
*/
|
||||
KICK_WHITELIST,
|
||||
/**
|
||||
|
||||
@@ -8,7 +8,10 @@ import org.bukkit.event.HandlerList;
|
||||
|
||||
/**
|
||||
* Stores details for players attempting to log in
|
||||
* @deprecated This event causes synchronization from the login thread; {@link AsyncPlayerPreLoginEvent} is preferred to keep the secondary threads asynchronous.
|
||||
*
|
||||
* @deprecated This event causes synchronization from the login thread; {@link
|
||||
* AsyncPlayerPreLoginEvent} is preferred to keep the secondary threads
|
||||
* asynchronous.
|
||||
*/
|
||||
@Deprecated
|
||||
@Warning(reason="This event causes a login thread to synchronize with the main thread")
|
||||
@@ -45,7 +48,8 @@ public class PlayerPreLoginEvent extends Event {
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the current kick message that will be used if getResult() != Result.ALLOWED
|
||||
* Gets the current kick message that will be used if getResult() !=
|
||||
* Result.ALLOWED
|
||||
*
|
||||
* @return Current kick message
|
||||
*/
|
||||
@@ -126,7 +130,8 @@ public class PlayerPreLoginEvent extends Event {
|
||||
*/
|
||||
KICK_BANNED,
|
||||
/**
|
||||
* The player is not allowed to log in, due to them not being on the white list
|
||||
* The player is not allowed to log in, due to them not being on the
|
||||
* white list
|
||||
*/
|
||||
KICK_WHITELIST,
|
||||
/**
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
package org.bukkit.event.player;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
/**
|
||||
* This is called immediately after a player registers for a plugin channel.
|
||||
*/
|
||||
public class PlayerRegisterChannelEvent extends PlayerChannelEvent {
|
||||
|
||||
public PlayerRegisterChannelEvent(final Player player, final String channel) {
|
||||
super(player, channel);
|
||||
}
|
||||
}
|
||||
package org.bukkit.event.player;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
/**
|
||||
* This is called immediately after a player registers for a plugin channel.
|
||||
*/
|
||||
public class PlayerRegisterChannelEvent extends PlayerChannelEvent {
|
||||
|
||||
public PlayerRegisterChannelEvent(final Player player, final String channel) {
|
||||
super(player, channel);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,6 +5,9 @@ import org.bukkit.Location;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
/**
|
||||
* Called when a player respawns.
|
||||
*/
|
||||
public class PlayerRespawnEvent extends PlayerEvent {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
private Location respawnLocation;
|
||||
|
||||
@@ -32,11 +32,13 @@ public class PlayerTeleportEvent extends PlayerMoveEvent {
|
||||
|
||||
public enum TeleportCause {
|
||||
/**
|
||||
* Indicates the teleporation was caused by a player throwing an Ender Pearl
|
||||
* Indicates the teleporation was caused by a player throwing an Ender
|
||||
* Pearl
|
||||
*/
|
||||
ENDER_PEARL,
|
||||
/**
|
||||
* Indicates the teleportation was caused by a player executing a command
|
||||
* Indicates the teleportation was caused by a player executing a
|
||||
* command
|
||||
*/
|
||||
COMMAND,
|
||||
/**
|
||||
@@ -44,15 +46,18 @@ public class PlayerTeleportEvent extends PlayerMoveEvent {
|
||||
*/
|
||||
PLUGIN,
|
||||
/**
|
||||
* Indicates the teleportation was caused by a player entering a Nether portal
|
||||
* Indicates the teleportation was caused by a player entering a
|
||||
* Nether portal
|
||||
*/
|
||||
NETHER_PORTAL,
|
||||
/**
|
||||
* Indicates the teleportation was caused by a player entering an End portal
|
||||
* Indicates the teleportation was caused by a player entering an End
|
||||
* portal
|
||||
*/
|
||||
END_PORTAL,
|
||||
/**
|
||||
* Indicates the teleportation was caused by an event not covered by this enum
|
||||
* Indicates the teleportation was caused by an event not covered by
|
||||
* this enum
|
||||
*/
|
||||
UNKNOWN;
|
||||
}
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
package org.bukkit.event.player;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
/**
|
||||
* This is called immediately after a player unregisters for a plugin channel.
|
||||
*/
|
||||
public class PlayerUnregisterChannelEvent extends PlayerChannelEvent {
|
||||
|
||||
public PlayerUnregisterChannelEvent(final Player player, final String channel) {
|
||||
super(player, channel);
|
||||
}
|
||||
}
|
||||
package org.bukkit.event.player;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
/**
|
||||
* This is called immediately after a player unregisters for a plugin channel.
|
||||
*/
|
||||
public class PlayerUnregisterChannelEvent extends PlayerChannelEvent {
|
||||
|
||||
public PlayerUnregisterChannelEvent(final Player player, final String channel) {
|
||||
super(player, channel);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,64 +1,55 @@
|
||||
package org.bukkit.event.player;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
public class PlayerVelocityEvent extends PlayerEvent implements Cancellable {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
private boolean cancel = false;
|
||||
private Vector velocity;
|
||||
|
||||
public PlayerVelocityEvent(final Player player, final Vector velocity) {
|
||||
super(player);
|
||||
this.velocity = velocity;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the cancellation state of this event. A cancelled event will not
|
||||
* be executed in the server, but will still pass to other plugins
|
||||
*
|
||||
* @return true if this event is cancelled
|
||||
*/
|
||||
public boolean isCancelled() {
|
||||
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
|
||||
*
|
||||
* @param cancel true if you wish to cancel this event
|
||||
*/
|
||||
public void setCancelled(boolean cancel) {
|
||||
this.cancel = cancel;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the velocity vector that will be sent to the player
|
||||
*
|
||||
* @return Vector the player will get
|
||||
*/
|
||||
public Vector getVelocity() {
|
||||
return velocity;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the velocity vector that will be sent to the player
|
||||
*
|
||||
* @param velocity The velocity vector that will be sent to the player
|
||||
*/
|
||||
public void setVelocity(Vector velocity) {
|
||||
this.velocity = velocity;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
}
|
||||
package org.bukkit.event.player;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
/**
|
||||
* Called when the velocity of a player changes.
|
||||
*/
|
||||
public class PlayerVelocityEvent extends PlayerEvent implements Cancellable {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
private boolean cancel = false;
|
||||
private Vector velocity;
|
||||
|
||||
public PlayerVelocityEvent(final Player player, final Vector velocity) {
|
||||
super(player);
|
||||
this.velocity = velocity;
|
||||
}
|
||||
|
||||
public boolean isCancelled() {
|
||||
return cancel;
|
||||
}
|
||||
|
||||
public void setCancelled(boolean cancel) {
|
||||
this.cancel = cancel;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the velocity vector that will be sent to the player
|
||||
*
|
||||
* @return Vector the player will get
|
||||
*/
|
||||
public Vector getVelocity() {
|
||||
return velocity;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the velocity vector that will be sent to the player
|
||||
*
|
||||
* @param velocity The velocity vector that will be sent to the player
|
||||
*/
|
||||
public void setVelocity(Vector velocity) {
|
||||
this.velocity = velocity;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -48,7 +48,8 @@ public class ServerCommandEvent extends ServerEvent {
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the command that the user is attempting to execute from the console
|
||||
* Gets the command that the user is attempting to execute from the
|
||||
* console
|
||||
*
|
||||
* @return Command the user is attempting to execute
|
||||
*/
|
||||
|
||||
@@ -80,9 +80,9 @@ public class ServerListPingEvent extends ServerEvent {
|
||||
* Sets the server-icon sent to the client.
|
||||
*
|
||||
* @param icon the icon to send to the client
|
||||
* @throws IllegalArgumentException if the {@link CachedServerIcon} is
|
||||
* not created by the caller of this event; null may be accepted for
|
||||
* some implementations
|
||||
* @throws IllegalArgumentException if the {@link CachedServerIcon} is not
|
||||
* created by the caller of this event; null may be accepted for some
|
||||
* implementations
|
||||
* @throws UnsupportedOperationException if the caller of this event does
|
||||
* not support setting the server icon
|
||||
*/
|
||||
|
||||
@@ -3,7 +3,8 @@ package org.bukkit.event.server;
|
||||
import org.bukkit.plugin.RegisteredServiceProvider;
|
||||
|
||||
/**
|
||||
* An event relating to a registered service. This is called in a {@link org.bukkit.plugin.ServicesManager}
|
||||
* An event relating to a registered service. This is called in a {@link
|
||||
* org.bukkit.plugin.ServicesManager}
|
||||
*/
|
||||
public abstract class ServiceEvent extends ServerEvent {
|
||||
private final RegisteredServiceProvider<?> provider;
|
||||
|
||||
@@ -4,9 +4,10 @@ import org.bukkit.event.HandlerList;
|
||||
import org.bukkit.plugin.RegisteredServiceProvider;
|
||||
|
||||
/**
|
||||
* This event is called when a service is registered.<br>
|
||||
* <b>Warning:</b> The order in which register and unregister
|
||||
* events are called should not be relied upon.
|
||||
* This event is called when a service is registered.
|
||||
* <p>
|
||||
* Warning: The order in which register and unregister events are called
|
||||
* should not be relied upon.
|
||||
*/
|
||||
public class ServiceRegisterEvent extends ServiceEvent {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
|
||||
@@ -4,9 +4,10 @@ import org.bukkit.event.HandlerList;
|
||||
import org.bukkit.plugin.RegisteredServiceProvider;
|
||||
|
||||
/**
|
||||
* This event is called when a service is unregistered.<br>
|
||||
* <b>Warning:</b> The order in which register and unregister
|
||||
* events are called should not be relied upon.
|
||||
* This event is called when a service is unregistered.
|
||||
* <p>
|
||||
* Warning: The order in which register and unregister events are called
|
||||
* should not be relied upon.
|
||||
*/
|
||||
public class ServiceUnregisterEvent extends ServiceEvent {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
|
||||
@@ -6,9 +6,9 @@ import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
/**
|
||||
* Raised when a vehicle is destroyed, which could be caused by either a player
|
||||
* or the environment. This is not raised if the boat is simply 'removed'
|
||||
* due to other means.
|
||||
* Raised when a vehicle is destroyed, which could be caused by either a
|
||||
* player or the environment. This is not raised if the boat is simply
|
||||
* 'removed' due to other means.
|
||||
*/
|
||||
public class VehicleDestroyEvent extends VehicleEvent implements Cancellable {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
|
||||
@@ -17,6 +17,7 @@ public class ChunkLoadEvent extends ChunkEvent {
|
||||
|
||||
/**
|
||||
* Gets if this chunk was newly created or not.
|
||||
* <p>
|
||||
* Note that if this chunk is new, it will not be populated at this time.
|
||||
*
|
||||
* @return true if the chunk is new, otherwise false
|
||||
|
||||
@@ -7,7 +7,8 @@ import org.bukkit.generator.BlockPopulator;
|
||||
/**
|
||||
* Thrown when a new chunk has finished being populated.
|
||||
* <p>
|
||||
* If your intent is to populate the chunk using this event, please see {@link BlockPopulator}
|
||||
* If your intent is to populate the chunk using this event, please see {@link
|
||||
* BlockPopulator}
|
||||
*/
|
||||
public class ChunkPopulateEvent extends ChunkEvent {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
|
||||
@@ -64,11 +64,13 @@ public class PortalCreateEvent extends WorldEvent implements Cancellable {
|
||||
*/
|
||||
public enum CreateReason {
|
||||
/**
|
||||
* When a portal is created 'traditionally' due to a portal frame being set on fire.
|
||||
* When a portal is created 'traditionally' due to a portal frame
|
||||
* being set on fire.
|
||||
*/
|
||||
FIRE,
|
||||
/**
|
||||
* When a portal is created as a destination for an existing portal when using the custom PortalTravelAgent
|
||||
* When a portal is created as a destination for an existing portal
|
||||
* when using the custom PortalTravelAgent
|
||||
*/
|
||||
OBC_DESTINATION
|
||||
}
|
||||
|
||||
@@ -5,8 +5,8 @@ import org.bukkit.Location;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
/**
|
||||
* An event that is called when a world's spawn changes. The
|
||||
* world's previous spawn location is included.
|
||||
* An event that is called when a world's spawn changes. The world's previous
|
||||
* spawn location is included.
|
||||
*/
|
||||
public class SpawnChangeEvent extends WorldEvent {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
|
||||
@@ -9,7 +9,8 @@ import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
/**
|
||||
* Event that is called when an organic structure attempts to grow (Sapling -> Tree), (Mushroom -> Huge Mushroom), naturally or using bonemeal.
|
||||
* Event that is called when an organic structure attempts to grow (Sapling ->
|
||||
* Tree), (Mushroom -> Huge Mushroom), naturally or using bonemeal.
|
||||
*/
|
||||
public class StructureGrowEvent extends WorldEvent implements Cancellable {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
@@ -39,7 +40,8 @@ public class StructureGrowEvent extends WorldEvent implements Cancellable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the species type (birch, normal, pine, red mushroom, brown mushroom)
|
||||
* Gets the species type (birch, normal, pine, red mushroom, brown
|
||||
* mushroom)
|
||||
*
|
||||
* @return Structure species
|
||||
*/
|
||||
@@ -59,7 +61,8 @@ public class StructureGrowEvent extends WorldEvent implements Cancellable {
|
||||
/**
|
||||
* Gets the player that created the structure.
|
||||
*
|
||||
* @return Player that created the structure, null if was not created manually
|
||||
* @return Player that created the structure, null if was not created
|
||||
* manually
|
||||
*/
|
||||
public Player getPlayer() {
|
||||
return player;
|
||||
|
||||
@@ -3,6 +3,9 @@ package org.bukkit.event.world;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
/**
|
||||
* Called when a World is saved.
|
||||
*/
|
||||
public class WorldSaveEvent extends WorldEvent {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user