13
0
geforkt von Mirrors/Paper

Deprecation cleanup.

By: Erik Broes <erikbroes@grum.nl>
Dieser Commit ist enthalten in:
Bukkit/Spigot 2012-01-30 21:32:48 +01:00
Ursprung fe4de0bb01
Commit 75fd934339
165 geänderte Dateien mit 409 neuen und 4280 gelöschten Zeilen

Datei anzeigen

@ -47,20 +47,6 @@ public enum Achievement {
return id; return id;
} }
/**
* Gets the achievement associated with the given ID.
* <p />
* Note that the ID must already be offset using {@link #STATISTIC_OFFSET}
*
* @param id ID of the achievement to return
* @return Achievement with the given ID
* @deprecated use {@link Achievement#getById(int)}
*/
@Deprecated
public static Achievement getAchievement(int id) {
return BY_ID.get(id);
}
/** /**
* Gets the achievement associated with the given ID. * Gets the achievement associated with the given ID.
* <p /> * <p />

Datei anzeigen

@ -1,18 +1,16 @@
package org.bukkit; package org.bukkit;
import com.avaje.ebean.config.ServerConfig;
import java.io.File; import java.io.File;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
import java.util.UUID; import java.util.UUID;
import java.util.logging.Logger; import java.util.logging.Logger;
import org.bukkit.World.Environment;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.command.ConsoleCommandSender; import org.bukkit.command.ConsoleCommandSender;
import org.bukkit.command.PluginCommand; import org.bukkit.command.PluginCommand;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.generator.ChunkGenerator;
import org.bukkit.inventory.Recipe; import org.bukkit.inventory.Recipe;
import org.bukkit.map.MapView; import org.bukkit.map.MapView;
import org.bukkit.plugin.PluginManager; import org.bukkit.plugin.PluginManager;
@ -20,6 +18,8 @@ import org.bukkit.plugin.ServicesManager;
import org.bukkit.plugin.messaging.Messenger; import org.bukkit.plugin.messaging.Messenger;
import org.bukkit.scheduler.BukkitScheduler; import org.bukkit.scheduler.BukkitScheduler;
import com.avaje.ebean.config.ServerConfig;
/** /**
* Represents the Bukkit core, for version and Server singleton handling * Represents the Bukkit core, for version and Server singleton handling
*/ */
@ -136,26 +136,6 @@ public final class Bukkit {
return server.getWorlds(); return server.getWorlds();
} }
@Deprecated
public static World createWorld(String name, Environment environment) {
return server.createWorld(name, environment);
}
@Deprecated
public static World createWorld(String name, Environment environment, long seed) {
return server.createWorld(name, environment, seed);
}
@Deprecated
public static World createWorld(String name, Environment environment, ChunkGenerator generator) {
return server.createWorld(name, environment, generator);
}
@Deprecated
public static World createWorld(String name, Environment environment, long seed, ChunkGenerator generator) {
return server.createWorld(name, environment, seed, generator);
}
public static World createWorld(WorldCreator options) { public static World createWorld(WorldCreator options) {
return server.createWorld(options); return server.createWorld(options);
} }

Datei anzeigen

@ -95,16 +95,6 @@ public enum ChatColor {
this.toString = new String(new char[] {COLOR_CHAR, code}); this.toString = new String(new char[] {COLOR_CHAR, code});
} }
/**
* Gets the data value associated with this color
*
* @return An integer value of this color code
* @deprecated Use {@link #getChar()}
*/
public int getCode() {
return intCode;
}
/** /**
* Gets the char value associated with this color * Gets the char value associated with this color
* *
@ -119,17 +109,6 @@ public enum ChatColor {
return toString; return toString;
} }
/**
* Gets the color represented by the specified color code
*
* @param code Code to check
* @return Associative {@link org.bukkit.ChatColor} with the given code, or null if it doesn't exist
* @deprecated Use {@link #getByChar(char)}
*/
public static ChatColor getByCode(final int code) {
return BY_ID.get(code);
}
/** /**
* Gets the color represented by the specified color code * Gets the color represented by the specified color code
* *

Datei anzeigen

@ -85,18 +85,6 @@ public class Note {
} }
} }
/**
* Returns the tone to id. Also returning the semitones.
*
* @param id the id of the tone.
* @return the tone to id.
* @deprecated use {@link #getById(byte)}
*/
@Deprecated
public static Tone getToneById(byte id) {
return BY_DATA.get(id);
}
/** /**
* Returns the tone to id. Also returning the semitones. * Returns the tone to id. Also returning the semitones.
* *

Datei anzeigen

@ -1,22 +1,18 @@
package org.bukkit; package org.bukkit;
import org.bukkit.generator.ChunkGenerator; import java.io.File;
import com.avaje.ebean.config.ServerConfig;
import org.bukkit.entity.Player;
import org.bukkit.inventory.Recipe;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
import java.util.UUID; import java.util.UUID;
import java.util.logging.Logger; import java.util.logging.Logger;
import java.io.File;
import org.bukkit.command.CommandException; import org.bukkit.command.CommandException;
import org.bukkit.command.PluginCommand;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.command.ConsoleCommandSender; import org.bukkit.command.ConsoleCommandSender;
import org.bukkit.command.PluginCommand;
import org.bukkit.entity.Player;
import org.bukkit.inventory.Recipe;
import org.bukkit.map.MapView; import org.bukkit.map.MapView;
import org.bukkit.plugin.PluginManager; import org.bukkit.plugin.PluginManager;
import org.bukkit.plugin.ServicesManager; import org.bukkit.plugin.ServicesManager;
@ -24,6 +20,8 @@ import org.bukkit.plugin.messaging.Messenger;
import org.bukkit.plugin.messaging.PluginMessageRecipient; import org.bukkit.plugin.messaging.PluginMessageRecipient;
import org.bukkit.scheduler.BukkitScheduler; import org.bukkit.scheduler.BukkitScheduler;
import com.avaje.ebean.config.ServerConfig;
/** /**
* Represents a server implementation * Represents a server implementation
*/ */
@ -277,62 +275,6 @@ public interface Server extends PluginMessageRecipient {
*/ */
public List<World> getWorlds(); public List<World> getWorlds();
/**
* Creates or loads a world with the given name.
* If the world is already loaded, it will just return the equivalent of
* getWorld(name)
*
* @param name Name of the world to load
* @param environment Environment type of the world
* @return Newly created or loaded World
* @deprecated Use {@link #createWorld(org.bukkit.WorldCreator)}
*/
@Deprecated
public World createWorld(String name, World.Environment environment);
/**
* Creates or loads a world with the given name.
* If the world is already loaded, it will just return the equivalent of
* getWorld(name)
*
* @param name Name of the world to load
* @param environment Environment type of the world
* @param seed Seed value to create the world with
* @return Newly created or loaded World
* @deprecated Use {@link #createWorld(org.bukkit.WorldCreator)}
*/
@Deprecated
public World createWorld(String name, World.Environment environment, long seed);
/**
* Creates or loads a world with the given name.
* If the world is already loaded, it will just return the equivalent of
* getWorld(name)
*
* @param name Name of the world to load
* @param environment Environment type of the world
* @param generator ChunkGenerator to use in the construction of the new world
* @return Newly created or loaded World
* @deprecated Use {@link #createWorld(org.bukkit.WorldCreator)}
*/
@Deprecated
public World createWorld(String name, World.Environment environment, ChunkGenerator generator);
/**
* Creates or loads a world with the given name.
* If the world is already loaded, it will just return the equivalent of
* getWorld(name)
*
* @param name Name of the world to load
* @param environment Environment type of the world
* @param seed Seed value to create the world with
* @param generator ChunkGenerator to use in the construction of the new world
* @return Newly created or loaded World
* @deprecated Use {@link #createWorld(org.bukkit.WorldCreator)}
*/
@Deprecated
public World createWorld(String name, World.Environment environment, long seed, ChunkGenerator generator);
/** /**
* Creates or loads a world with the given name using the specified options. * Creates or loads a world with the given name using the specified options.
* <p> * <p>

Datei anzeigen

@ -66,18 +66,6 @@ public enum Statistic {
return isSubstat && isBlock; return isSubstat && isBlock;
} }
/**
* Gets the statistic associated with the given ID.
*
* @param id ID of the statistic to return
* @return statistic with the given ID
* @deprecated See {@link #getById(int)}
*/
@Deprecated
public static Statistic getStatistic(int id) {
return BY_ID.get(id);
}
/** /**
* Gets the statistic associated with the given ID. * Gets the statistic associated with the given ID.
* *

Datei anzeigen

@ -370,18 +370,6 @@ public interface World extends PluginMessageRecipient {
*/ */
public UUID getUID(); public UUID getUID();
/**
* Gets a semi-unique identifier for this world.
* <p />
* While it is highly unlikely that this may be shared with another World,
* it is not guaranteed to be unique
*
* @deprecated Replaced with {@link #getUID()}
* @return Id of this world
*/
@Deprecated
public long getId();
/** /**
* Gets the default spawn {@link Location} of this world * Gets the default spawn {@link Location} of this world
* *

Datei anzeigen

@ -23,18 +23,6 @@ public interface Block {
*/ */
byte getData(); byte getData();
/**
* @deprecated use {@link #getRelative(BlockFace face)}
*/
@Deprecated
Block getFace(BlockFace face);
/**
* @deprecated use {@link #getRelative(BlockFace face, int distance)}
*/
@Deprecated
Block getFace(BlockFace face, int distance);
/** /**
* Gets the block at the given offsets * Gets the block at the given offsets
* *

Datei anzeigen

@ -1,5 +1,9 @@
package org.bukkit.command.defaults; package org.bukkit.command.defaults;
import java.io.File;
import java.io.IOException;
import java.io.PrintStream;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.command.Command; import org.bukkit.command.Command;
@ -10,10 +14,6 @@ import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.RegisteredListener; import org.bukkit.plugin.RegisteredListener;
import org.bukkit.plugin.TimedRegisteredListener; import org.bukkit.plugin.TimedRegisteredListener;
import java.io.File;
import java.io.IOException;
import java.io.PrintStream;
public class TimingsCommand extends Command { public class TimingsCommand extends Command {
public TimingsCommand(String name) { public TimingsCommand(String name) {
super(name); super(name);

Datei anzeigen

@ -364,28 +364,6 @@ public interface Player extends HumanEntity, CommandSender, OfflinePlayer, Plugi
*/ */
public void setExp(float exp); public void setExp(float exp);
/**
* Gets the players current experience points towards the next level.
* <p>
* This is a percentage value. 0 is "no progress" and 1 is "next level".
*
* @return Current experience points
* @deprecated use {@link #getExp()} - this method is unsafe to use!
*/
@Deprecated
public int getExperience();
/**
* Sets the players current experience points towards the next level
* <p>
* This is a percentage value. 0 is "no progress" and 1 is "next level".
*
* @param exp New experience points
* @deprecated use {@link #setExp(float)} - this method is unsafe to use!
*/
@Deprecated
public void setExperience(int exp);
/** /**
* Gets the players current experience level * Gets the players current experience level
* *

Datei anzeigen

@ -1,17 +0,0 @@
package org.bukkit.event;
/**
* Handles all custom events
*/
@Deprecated
public class CustomEventListener implements Listener {
private static final HandlerList handlers = new HandlerList();
public CustomEventListener() {}
/**
* Called when a custom event is fired
*
* @param event Relevant event details
*/
public void onCustomEvent(Event event) {}
}

Datei anzeigen

@ -1,64 +1,25 @@
package org.bukkit.event; package org.bukkit.event;
import java.io.Serializable; import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;
import org.bukkit.event.block.*; import org.apache.commons.lang.Validate;
import org.bukkit.event.entity.*;
import org.bukkit.event.inventory.*;
import org.bukkit.event.painting.*;
import org.bukkit.event.player.*;
import org.bukkit.event.server.*;
import org.bukkit.event.vehicle.*;
import org.bukkit.event.weather.*;
import org.bukkit.event.world.*;
/** /**
* Represents an event * Represents an event
*/ */
@SuppressWarnings("serial") @SuppressWarnings("serial")
public abstract class Event implements Serializable { public abstract class Event implements Serializable {
@Deprecated
private final static Map<String, HandlerList> customHandlers = new HashMap<String, HandlerList>();
@Deprecated
private final Type type;
private final String name; private final String name;
protected Event(final Type type) {
exAssert(type != null, "type is null");
exAssert(type != Type.CUSTOM_EVENT, "use Event(String) to make custom events");
this.type = type;
this.name = getClass().getName();
}
protected Event() { protected Event() {
this.type = Type.FIXED_EVENT;
this.name = getClass().getName(); this.name = getClass().getName();
} }
protected Event(final String name) { protected Event(final String name) {
exAssert(name != null, "name is null"); Validate.notNull(name, "name is cannot be null");
this.type = Type.CUSTOM_EVENT;
this.name = name; this.name = name;
} }
/**
* Gets the Type of this event
*
* @return Event type that this object represents
*/
@Deprecated
public final Type getType() {
return type;
}
private void exAssert(boolean b, String s) {
if (!b) {
throw new IllegalArgumentException(s);
}
}
/** /**
* Gets the event's name. Should only be used if getType() == Type.CUSTOM * Gets the event's name. Should only be used if getType() == Type.CUSTOM
* *
@ -69,901 +30,7 @@ public abstract class Event implements Serializable {
} }
public HandlerList getHandlers() { public HandlerList getHandlers() {
if (type == Type.CUSTOM_EVENT) { throw new IllegalStateException("Event must implement getHandlers()");
HandlerList result = customHandlers.get(getEventName());
if (result == null) {
result = new HandlerList();
customHandlers.put(getEventName(), result);
}
return result;
} else {
throw new IllegalStateException("Event must implement getHandlers()");
}
}
/**
* Represents an events priority in execution
*/
@Deprecated
public enum Priority {
/**
* Event call is of very low importance and should be ran first, to allow
* other plugins to further customise the outcome
*/
Lowest(EventPriority.LOWEST),
/**
* Event call is of low importance
*/
Low(EventPriority.LOW),
/**
* Event call is neither important or unimportant, and may be ran normally
*/
Normal(EventPriority.NORMAL),
/**
* Event call is of high importance
*/
High(EventPriority.HIGH),
/**
* Event call is critical and must have the final say in what happens
* to the event
*/
Highest(EventPriority.HIGHEST),
/**
* Event is listened to purely for monitoring the outcome of an event.
* <p />
* No modifications to the event should be made under this priority
*/
Monitor(EventPriority.MONITOR);
private final EventPriority priority;
private Priority(EventPriority priority) {
this.priority = priority;
}
public EventPriority getNewPriority() {
return priority;
}
}
/**
* Represents a category used by Type
*/
@Deprecated
public enum Category {
/**
* Represents Player-based events
*
* @see #LIVING_ENTITY
*/
PLAYER,
/**
* Represents Entity-based events
*/
ENTITY,
/**
* Represents Block-based events
*/
BLOCK,
/**
* Represents LivingEntity-based events
*/
LIVING_ENTITY,
/**
* Represents Weather-based events
*/
WEATHER,
/**
* Represents Vehicle-based events
*/
VEHICLE,
/**
* Represents World-based events
*/
WORLD,
/**
* Represents Server and Plugin based events
*/
SERVER,
/**
* Represents Inventory-based events
*/
INVENTORY,
/**
* Represents any miscellaneous events
*/
MISCELLANEOUS;
}
/**
* Provides a lookup for all core events
*/
@Deprecated
public enum Type {
/**
* PLAYER EVENTS
*/
/**
* Called when a player enters the world on a server
*
* @see org.bukkit.event.player.PlayerJoinEvent
*/
PLAYER_JOIN(Category.PLAYER, PlayerJoinEvent.class),
/**
* Called when a player is attempting to connect to the server
*
* @see org.bukkit.event.player.PlayerLoginEvent
*/
PLAYER_LOGIN(Category.PLAYER, PlayerLoginEvent.class),
/**
* Called when a player has just been authenticated
*
* @see org.bukkit.event.player.PlayerPreLoginEvent
*/
PLAYER_PRELOGIN(Category.PLAYER, PlayerPreLoginEvent.class),
/**
* Called when a player respawns
*
* @see org.bukkit.event.player.PlayerRespawnEvent
*/
PLAYER_RESPAWN(Category.PLAYER, PlayerRespawnEvent.class),
/**
* Called when a player gets kicked from the server
*
* @see org.bukkit.event.player.PlayerKickEvent
*/
PLAYER_KICK(Category.PLAYER, PlayerKickEvent.class),
/**
* Called when a player sends a chat message
*
* @see org.bukkit.event.player.PlayerChatEvent
*/
PLAYER_CHAT(Category.PLAYER, PlayerChatEvent.class),
/**
* Called when a player uses a command (early in the command handling process)
*
* @see org.bukkit.event.player.PlayerCommandPreprocessEvent
*/
PLAYER_COMMAND_PREPROCESS(Category.PLAYER, PlayerCommandPreprocessEvent.class),
/**
* Called when a player leaves the server
*
* @see org.bukkit.event.player.PlayerQuitEvent
*/
PLAYER_QUIT(Category.PLAYER, PlayerQuitEvent.class),
/**
* Called when a player moves position in the world
*
* @see org.bukkit.event.player.PlayerMoveEvent
*/
PLAYER_MOVE(Category.PLAYER, PlayerMoveEvent.class),
/**
* Called before a player gets a velocity vector sent, which will instruct him to
* get "pushed" into a specific direction, e.g. after an explosion
*
* @see org.bukkit.event.player.PlayerVelocityEvent
*/
PLAYER_VELOCITY(Category.PLAYER, PlayerVelocityEvent.class),
/**
* Called when a player undergoes an animation (Arm Swing is the only animation currently supported)
*
* @see org.bukkit.event.player.PlayerAnimationEvent
*/
PLAYER_ANIMATION(Category.PLAYER, PlayerAnimationEvent.class),
/**
* Called when a player toggles sneak mode
*
* @see org.bukkit.event.player.PlayerToggleSneakEvent
*/
PLAYER_TOGGLE_SNEAK(Category.PLAYER, PlayerToggleSneakEvent.class),
/**
* Called when a player toggles sprint mode
*
* @see org.bukkit.event.player.PlayerToggleSprintEvent
*/
PLAYER_TOGGLE_SPRINT(Category.PLAYER, PlayerToggleSprintEvent.class),
/**
* Called when a player interacts with an object or air
*
* @see org.bukkit.event.player.PlayerInteractEvent
*/
PLAYER_INTERACT(Category.PLAYER, PlayerInteractEvent.class),
/**
* Called when a player right clicks an entity
*
* @see org.bukkit.event.player.PlayerInteractEntityEvent
*/
PLAYER_INTERACT_ENTITY(Category.PLAYER, PlayerInteractEntityEvent.class),
/**
* Called when a player throws an egg
*
* @see org.bukkit.event.player.PlayerEggThrowEvent
*/
PLAYER_EGG_THROW(Category.PLAYER, PlayerEggThrowEvent.class),
/**
* Called when a player teleports from one position to another
*
* @see org.bukkit.event.player.PlayerTeleportEvent
*/
PLAYER_TELEPORT(Category.PLAYER, PlayerTeleportEvent.class),
/**
* Called when a player completes the portaling process by standing in a portal
*
* @see org.bukkit.event.player.PlayerPortalEvent
*/
PLAYER_PORTAL(Category.PLAYER, PlayerPortalEvent.class),
/**
* Called when a player changes their held item
*
* @see org.bukkit.event.player.PlayerItemHeldEvent
*/
PLAYER_ITEM_HELD(Category.PLAYER, PlayerItemHeldEvent.class),
/**
* Called when a player drops an item
*
* @see org.bukkit.event.player.PlayerDropItemEvent
*/
PLAYER_DROP_ITEM(Category.PLAYER, PlayerDropItemEvent.class),
/**
* Called when a player picks an item up off the ground
*
* @see org.bukkit.event.player.PlayerPickupItemEvent
*/
PLAYER_PICKUP_ITEM(Category.PLAYER, PlayerPickupItemEvent.class),
/**
* Called when a player empties a bucket
*
* @see org.bukkit.event.player.PlayerBucketEmptyEvent
*/
PLAYER_BUCKET_EMPTY(Category.PLAYER, PlayerBucketEmptyEvent.class),
/**
* Called when a player fills a bucket
*
* @see org.bukkit.event.player.PlayerBucketFillEvent
*/
PLAYER_BUCKET_FILL(Category.PLAYER, PlayerBucketFillEvent.class),
/**
* Called when a player interacts with the inventory
*
* @see org.bukkit.event.player.PlayerInventoryEvent
*/
PLAYER_INVENTORY(Category.PLAYER, PlayerInventoryEvent.class),
/**
* Called when a player enter a bed
*
* @see org.bukkit.event.player.PlayerBedEnterEvent
*/
PLAYER_BED_ENTER(Category.PLAYER, PlayerBedEnterEvent.class),
/**
* Called when a player leaves a bed
*
* @see org.bukkit.event.player.PlayerBedLeaveEvent
*/
PLAYER_BED_LEAVE(Category.PLAYER, PlayerBedLeaveEvent.class),
/**
* Called when a player is fishing
*
* @see org.bukkit.event.player.PlayerFishEvent
*/
PLAYER_FISH(Category.PLAYER, PlayerFishEvent.class),
/**
* Called when the game mode of a player is changed
*
* @see org.bukkit.event.player.PlayerGameModeChangeEvent
*/
PLAYER_GAME_MODE_CHANGE(Category.PLAYER, PlayerGameModeChangeEvent.class),
/**
* Called after a player has changed to a new world
*
* @see org.bukkit.event.player.PlayerChangedWorldEvent
*/
PLAYER_CHANGED_WORLD(Category.PLAYER, PlayerChangedWorldEvent.class),
/**
* Called when a players level changes
*
* @see org.bukkit.event.player.PlayerLevelChangeEvent
*/
PLAYER_LEVEL_CHANGE(Category.PLAYER, PlayerLevelChangeEvent.class),
/**
* Called when a players experience changes naturally
*
* @see org.bukkit.event.player.PlayerExpChangeEvent
*/
PLAYER_EXP_CHANGE(Category.PLAYER, PlayerExpChangeEvent.class),
/**
* Called when a player shears an entity
*
* @see org.bukkit.event.player.PlayerShearEntityEvent
*/
PLAYER_SHEAR_ENTITY(Category.LIVING_ENTITY, PlayerShearEntityEvent.class),
/**
* BLOCK EVENTS
*/
/**
* Called when a block is damaged (hit by a player)
*
* @see org.bukkit.event.block.BlockDamageEvent
*/
BLOCK_DAMAGE(Category.BLOCK, BlockDamageEvent.class),
/**
* Called when a block is undergoing a universe physics
* check on whether it can be built
* <p />
* For example, cacti cannot be built on grass unless overridden here
*
* @see org.bukkit.event.block.BlockCanBuildEvent
*/
BLOCK_CANBUILD(Category.BLOCK, BlockCanBuildEvent.class),
/**
* Called when a block of water or lava attempts to flow into another
* block
*
* @see org.bukkit.event.block.BlockFromToEvent
*/
BLOCK_FROMTO(Category.BLOCK, BlockFromToEvent.class),
/**
* Called when a block is being set on fire from another block, such as
* an adjacent block of fire attempting to set fire to wood
*
* @see org.bukkit.event.block.BlockIgniteEvent
*/
BLOCK_IGNITE(Category.BLOCK, BlockIgniteEvent.class),
/**
* Called when a block undergoes a physics check
* <p />
* A physics check is commonly called when an adjacent block changes
* type
*
* @see org.bukkit.event.block.BlockPhysicsEvent
*/
BLOCK_PHYSICS(Category.BLOCK, BlockPhysicsEvent.class),
/**
* Called when a player is attempting to place a block
*
* @see org.bukkit.event.block.BlockPlaceEvent
*/
BLOCK_PLACE(Category.BLOCK, BlockPlaceEvent.class),
/**
* Called when a block dispenses something
*
* @see org.bukkit.event.block.BlockDispenseEvent
*/
BLOCK_DISPENSE(Category.BLOCK, BlockDispenseEvent.class),
/**
* Called when a block is destroyed from being burnt by fire
*
* @see org.bukkit.event.block.BlockBurnEvent
*/
BLOCK_BURN(Category.BLOCK, BlockBurnEvent.class),
/**
* Called when leaves are decaying naturally
*
* @see org.bukkit.event.block.LeavesDecayEvent
*/
LEAVES_DECAY(Category.BLOCK, LeavesDecayEvent.class),
/**
* Called when a sign is changed
*
* @see org.bukkit.event.block.SignChangeEvent
*/
SIGN_CHANGE(Category.BLOCK, SignChangeEvent.class),
/**
* Called when a block changes redstone current. Only triggered on blocks
* that are actually capable of transmitting or carrying a redstone
* current
*
* @see org.bukkit.event.block.BlockRedstoneEvent
*/
REDSTONE_CHANGE(Category.BLOCK, BlockRedstoneEvent.class),
/**
* Called when a block is broken by a player
*
* @see org.bukkit.event.block.BlockBreakEvent
*/
BLOCK_BREAK(Category.BLOCK, BlockBreakEvent.class),
/**
* Called when a block is formed based on world conditions
*
* @see org.bukkit.event.block.BlockFormEvent
*/
BLOCK_FORM(Category.BLOCK, BlockFormEvent.class),
/**
* Called when a block spreads based on world conditions
*
* @see org.bukkit.event.block.BlockSpreadEvent
*/
BLOCK_SPREAD(Category.BLOCK, BlockSpreadEvent.class),
/**
* Called when a block fades, melts or disappears based on world conditions
*
* @see org.bukkit.event.block.BlockFadeEvent
*/
BLOCK_FADE(Category.BLOCK, BlockFadeEvent.class),
/**
* Called when a piston extends
*
* @see org.bukkit.event.block.BlockPistonExtendEvent
*/
BLOCK_PISTON_EXTEND(Category.BLOCK, BlockPistonExtendEvent.class),
/**
* Called when a piston retracts
*
* @see org.bukkit.event.block.BlockPistonRetractEvent
*/
BLOCK_PISTON_RETRACT(Category.BLOCK, BlockPistonRetractEvent.class),
/**
* INVENTORY EVENTS
*/
/**
* Called when a player opens an inventory
*
* @todo: add javadoc see comment
*/
INVENTORY_OPEN(Category.INVENTORY, null),
/**
* Called when a player closes an inventory
*
* @todo: add javadoc see comment
*/
INVENTORY_CLOSE(Category.INVENTORY, null),
/**
* Called when a player clicks on an inventory slot
*
* @todo: add javadoc see comment
*/
INVENTORY_CLICK(Category.INVENTORY, null),
/**
* Called when an inventory slot changes values or type
*
* @todo: add javadoc see comment
*/
INVENTORY_CHANGE(Category.INVENTORY, null),
/**
* Called when a player is attempting to perform an inventory transaction
*
* @todo: add javadoc see comment
*/
INVENTORY_TRANSACTION(Category.INVENTORY, null),
/**
* Called when an ItemStack is successfully smelted in a furnace.
*
* @see org.bukkit.event.inventory.FurnaceSmeltEvent
*/
FURNACE_SMELT(Category.INVENTORY, FurnaceSmeltEvent.class),
/**
* Called when an ItemStack is successfully burned as fuel in a furnace.
*
* @see org.bukkit.event.inventory.FurnaceBurnEvent
*/
FURNACE_BURN(Category.INVENTORY, FurnaceBurnEvent.class),
/**
* SERVER EVENTS
*/
/**
* Called when a plugin is enabled
*
* @see org.bukkit.event.server.PluginEnableEvent
*/
PLUGIN_ENABLE(Category.SERVER, PluginEnableEvent.class),
/**
* Called when a plugin is disabled
*
* @see org.bukkit.event.server.PluginDisableEvent
*/
PLUGIN_DISABLE(Category.SERVER, PluginDisableEvent.class),
/**
* Called when a server command is called
*
* @see org.bukkit.event.server.ServerCommandEvent
*/
SERVER_COMMAND(Category.SERVER, ServerCommandEvent.class),
/**
* Called when a remote server command is called
*
* @see org.bukkit.event.server.ServerCommandEvent
*/
REMOTE_COMMAND(Category.SERVER, ServerCommandEvent.class),
/**
* Called when a map is initialized (created or loaded into memory)
*
* @see org.bukkit.event.server.MapInitializeEvent
*/
MAP_INITIALIZE(Category.SERVER, MapInitializeEvent.class),
/**
* Called when a client pings a server.
*
* @see org.bukkit.event.server.ServerListPingEvent
*/
SERVER_LIST_PING(Category.SERVER, ServerListPingEvent.class),
/**
* WORLD EVENTS
*/
/**
* Called when a chunk is loaded
* <p />
* If a new chunk is being generated for loading, it will call
* Type.CHUNK_GENERATION and then Type.CHUNK_LOADED upon completion
*
* @see org.bukkit.event.world.ChunkLoadEvent
*/
CHUNK_LOAD(Category.WORLD, ChunkLoadEvent.class),
/**
* Called when a chunk is unloaded
*
* @see org.bukkit.event.world.ChunkUnloadEvent
*/
CHUNK_UNLOAD(Category.WORLD, ChunkUnloadEvent.class),
/**
* Called when a newly created chunk has been populated.
* <p />
* If your intent is to populate the chunk using this event, please see {@link org.bukkit.generator.BlockPopulator}
*
* @see org.bukkit.event.world.ChunkPopulateEvent
*/
CHUNK_POPULATED(Category.WORLD, ChunkPopulateEvent.class),
/**
* Called when an ItemEntity spawns in the world
*
* @see org.bukkit.event.entity.ItemSpawnEvent
*/
ITEM_SPAWN(Category.WORLD, ItemSpawnEvent.class),
/**
* Called when a World's spawn is changed
*
* @see org.bukkit.event.world.SpawnChangeEvent
*/
SPAWN_CHANGE(Category.WORLD, SpawnChangeEvent.class),
/**
* Called when a world is saved
*
* @see org.bukkit.event.world.WorldSaveEvent
*/
WORLD_SAVE(Category.WORLD, WorldSaveEvent.class),
/**
* Called when a World is initializing
*
* @see org.bukkit.event.world.WorldInitEvent
*/
WORLD_INIT(Category.WORLD, WorldInitEvent.class),
/**
* Called when a World is loaded
*
* @see org.bukkit.event.world.WorldLoadEvent
*/
WORLD_LOAD(Category.WORLD, WorldLoadEvent.class),
/**
* Called when a World is unloaded
*
* @see org.bukkit.event.world.WorldUnloadEvent
*/
WORLD_UNLOAD(Category.WORLD, WorldUnloadEvent.class),
/**
* Called when world attempts to create a matching end to a portal
*
* @see org.bukkit.event.world.PortalCreateEvent
*/
PORTAL_CREATE(Category.WORLD, PortalCreateEvent.class),
/**
* Called when an organic structure attempts to grow (Sapling -> Tree), (Mushroom -> Huge Mushroom), naturally or using bonemeal.
*
* @see org.bukkit.event.world.StructureGrowEvent
*/
STRUCTURE_GROW(Category.WORLD, StructureGrowEvent.class),
/**
* Called when an item despawns from a world
*
* @see org.bukkit.event.entity.ItemDespawnEvent
*/
ITEM_DESPAWN(Category.WORLD, ItemDespawnEvent.class),
/**
* ENTITY EVENTS
*/
/**
* Called when a painting is placed by player
*
* @see org.bukkit.event.painting.PaintingPlaceEvent
*/
PAINTING_PLACE(Category.ENTITY, PaintingPlaceEvent.class),
/**
* Called when a painting is removed
*
* @see org.bukkit.event.painting.PaintingBreakEvent
*/
PAINTING_BREAK(Category.ENTITY, PaintingBreakEvent.class),
/**
* Called when an entity touches a portal block
*
* @see org.bukkit.event.entity.EntityPortalEnterEvent
*/
ENTITY_PORTAL_ENTER(Category.ENTITY, EntityPortalEnterEvent.class),
/**
* LIVING_ENTITY EVENTS
*/
/**
* Called when a creature, either hostile or neutral, attempts to spawn
* in the world "naturally"
*
* @see org.bukkit.event.entity.CreatureSpawnEvent
*/
CREATURE_SPAWN(Category.LIVING_ENTITY, CreatureSpawnEvent.class),
/**
* Called when a LivingEntity is damaged with no source.
*
* @see org.bukkit.event.entity.EntityDamageEvent
*/
ENTITY_DAMAGE(Category.LIVING_ENTITY, EntityDamageEvent.class),
/**
* Called when a LivingEntity dies
*
* @see org.bukkit.event.entity.EntityDeathEvent
*/
ENTITY_DEATH(Category.LIVING_ENTITY, EntityDeathEvent.class),
/**
* Called when a Skeleton or Zombie catch fire due to the sun
*
* @see org.bukkit.event.entity.EntityCombustEvent
*/
ENTITY_COMBUST(Category.LIVING_ENTITY, EntityCombustEvent.class),
/**
* Called when an entity explodes, either TNT, Creeper, or Ghast Fireball
*
* @see org.bukkit.event.entity.EntityExplodeEvent
*/
ENTITY_EXPLODE(Category.LIVING_ENTITY, EntityExplodeEvent.class),
/**
* Called when an entity has made a decision to explode.
* <p />
* Provides an opportunity to act on the entity, change the explosion radius,
* or to change the fire-spread flag.
* <p />
* Canceling the event negates the entity's decision to explode.
* For EntityCreeper, this resets the fuse but does not kill the Entity.
* For EntityFireball and EntityTNTPrimed....?
*
* @see org.bukkit.event.entity.ExplosionPrimeEvent
*/
EXPLOSION_PRIME(Category.LIVING_ENTITY, ExplosionPrimeEvent.class),
/**
* Called when an entity targets another entity
*
* @see org.bukkit.event.entity.EntityTargetEvent
*/
ENTITY_TARGET(Category.LIVING_ENTITY, EntityTargetEvent.class),
/**
* Called when a sheep regrows its wool
*
* @see org.bukkit.event.entity.SheepRegrowWoolEvent
*/
SHEEP_REGROW_WOOL(Category.LIVING_ENTITY, SheepRegrowWoolEvent.class),
/**
* Called when a sheep's wool is dyed
*
* @see org.bukkit.event.entity.SheepDyeWoolEvent
*/
SHEEP_DYE_WOOL(Category.LIVING_ENTITY, SheepDyeWoolEvent.class),
/**
* Called when an entity interacts with a block
* This event specifically excludes player entities
*
* @see org.bukkit.event.entity.EntityInteractEvent
*/
ENTITY_INTERACT(Category.LIVING_ENTITY, EntityInteractEvent.class),
/**
* Called when a creeper gains or loses a power shell
*
* @see org.bukkit.event.entity.CreeperPowerEvent
*/
CREEPER_POWER(Category.LIVING_ENTITY, CreeperPowerEvent.class),
/**
* Called when a pig is zapped, zombifying it
*
* @see org.bukkit.event.entity.PigZapEvent
*/
PIG_ZAP(Category.LIVING_ENTITY, PigZapEvent.class),
/**
* Called when a LivingEntity is tamed
*
* @see org.bukkit.event.entity.EntityTameEvent
*/
ENTITY_TAME(Category.LIVING_ENTITY, EntityTameEvent.class),
/**
* Called when a LivingEntity changes a block
*
* This event specifically excludes player entities
*
* @see org.bukkit.event.entity.EntityChangeBlockEvent
*/
ENTITY_CHANGE_BLOCK(Category.LIVING_ENTITY, EntityChangeBlockEvent.class),
/**
* Called when a {@link Projectile} hits something
*
* @see org.bukkit.event.entity.ProjectileHitEvent
*/
PROJECTILE_HIT(Category.ENTITY, ProjectileHitEvent.class),
/**
* Called when a splash potion hits an area
*
* @see org.bukkit.event.entity.PotionSplashEvent
*/
POTION_SPLASH(Category.ENTITY, PotionSplashEvent.class),
/**
* Called when a Slime splits into smaller Slimes upon death
*
* @see org.bukkit.event.entity.SlimeSplitEvent
*/
SLIME_SPLIT(Category.LIVING_ENTITY, SlimeSplitEvent.class),
/**
* Called when a LivingEntity is regains health
*
* @see org.bukkit.event.entity.EntityRegainHealthEvent
*/
ENTITY_REGAIN_HEALTH(Category.LIVING_ENTITY, EntityRegainHealthEvent.class),
/**
* Called when an Enderman picks a block up
*
* @see org.bukkit.event.entity.EndermanPickupEvent
*/
ENDERMAN_PICKUP(Category.LIVING_ENTITY, EndermanPickupEvent.class),
/**
* Called when an Enderman places a block
*
* @see org.bukkit.event.entity.EndermanPlaceEvent
*/
ENDERMAN_PLACE(Category.LIVING_ENTITY, EndermanPlaceEvent.class),
/**
* Called when a non-player LivingEntity teleports
*
* @see org.bukkit.event.entity.EntityTeleportEvent
*/
ENTITY_TELEPORT(Category.LIVING_ENTITY, EntityTeleportEvent.class),
/**
* Called when a human entity's food level changes
*
* @see org.bukkit.event.entity.FoodLevelChangeEvent
*/
FOOD_LEVEL_CHANGE(Category.LIVING_ENTITY, FoodLevelChangeEvent.class),
/**
* Called when an entity creates a portal in a world
*
* @see org.bukkit.event.entity.EntityCreatePortalEvent
*/
ENTITY_CREATE_PORTAL(Category.LIVING_ENTITY, EntityCreatePortalEvent.class),
/**
* Called when a LivingEntity shoots a bow firing an arrow
*
* @see org.bukkit.event.entity.EntityShootBowEvent
*/
ENTITY_SHOOT_BOW(Category.LIVING_ENTITY, EntityShootBowEvent.class),
/**
* WEATHER EVENTS
*/
/**
* Called when a lightning entity strikes somewhere
*
* @see org.bukkit.event.weather.LightningStrikeEvent
*/
LIGHTNING_STRIKE(Category.WEATHER, LightningStrikeEvent.class),
/**
* Called when the weather in a world changes
*
* @see org.bukkit.event.weather.WeatherChangeEvent
*/
WEATHER_CHANGE(Category.WEATHER, WeatherChangeEvent.class),
/**
* Called when the thunder state in a world changes
*
* @see org.bukkit.event.weather.ThunderChangeEvent
*/
THUNDER_CHANGE(Category.WEATHER, ThunderChangeEvent.class),
/**
* VEHICLE EVENTS
*/
/**
* Called when a vehicle is placed by a player
*
* @see org.bukkit.event.vehicle.VehicleCreateEvent
*/
VEHICLE_CREATE(Category.VEHICLE, VehicleCreateEvent.class),
/**
* Called when a vehicle is destroyed
*
* @see org.bukkit.event.vehicle.VehicleDestroyEvent
*/
VEHICLE_DESTROY(Category.VEHICLE, VehicleDestroyEvent.class),
/**
* Called when a vehicle is damaged by a LivingEntity
*
* @see org.bukkit.event.vehicle.VehicleDamageEvent
*/
VEHICLE_DAMAGE(Category.VEHICLE, VehicleDamageEvent.class),
/**
* Called when a vehicle collides with an Entity
*
* @see org.bukkit.event.vehicle.VehicleCollisionEvent
*/
VEHICLE_COLLISION_ENTITY(Category.VEHICLE, VehicleEntityCollisionEvent.class),
/**
* Called when a vehicle collides with a Block
*
* @see org.bukkit.event.vehicle.VehicleBlockCollisionEvent
*/
VEHICLE_COLLISION_BLOCK(Category.VEHICLE, VehicleBlockCollisionEvent.class),
/**
* Called when a vehicle is entered by a LivingEntity
*
* @see org.bukkit.event.vehicle.VehicleEnterEvent
*/
VEHICLE_ENTER(Category.VEHICLE, VehicleEnterEvent.class),
/**
* Called when a vehicle is exited by a LivingEntity
*
* @see org.bukkit.event.vehicle.VehicleExitEvent
*/
VEHICLE_EXIT(Category.VEHICLE, VehicleExitEvent.class),
/**
* Called when a vehicle moves position in the world
*
* @see org.bukkit.event.vehicle.VehicleMoveEvent
*/
VEHICLE_MOVE(Category.VEHICLE, VehicleMoveEvent.class),
/**
* Called when a vehicle is going through an update cycle, rechecking itself
*
* @see org.bukkit.event.vehicle.VehicleUpdateEvent
*/
VEHICLE_UPDATE(Category.VEHICLE, VehicleUpdateEvent.class),
/**
* MISCELLANEOUS EVENTS
*/
/**
* Represents a custom event, isn't actually used
*/
CUSTOM_EVENT(Category.MISCELLANEOUS, TransitionalCustomEvent.class),
/**
* Represents an event using the new, Event.Type-less event system to avoid NPE-ing
*/
FIXED_EVENT(Category.MISCELLANEOUS, Event.class);
private final Category category;
private final Class<? extends Event> clazz;
private Type(Category category, Class<? extends Event> clazz) {
this.category = category;
this.clazz = clazz;
}
/**
* Gets the Category assigned to this event
*
* @return Category of this Event.Type
*/
public Category getCategory() {
return category;
}
public Class<? extends Event> getEventClass() {
return clazz;
}
} }
public enum Result { public enum Result {

Datei anzeigen

@ -1,7 +1,6 @@
package org.bukkit.event; package org.bukkit.event;
public class EventException extends Exception { public class EventException extends Exception {
private static final HandlerList handlers = new HandlerList();
private static final long serialVersionUID = 3532808232324183999L; private static final long serialVersionUID = 3532808232324183999L;
private final Throwable cause; private final Throwable cause;

Datei anzeigen

@ -1,18 +0,0 @@
package org.bukkit.event;
/**
* A transitional class to avoid breaking plugins using custom events.
*/
@Deprecated
public class TransitionalCustomEvent extends Event {
private static final HandlerList handlers = new HandlerList();
@Override
public HandlerList getHandlers() {
return handlers;
}
public static HandlerList getHandlerList() {
return handlers;
}
}

Datei anzeigen

@ -18,11 +18,11 @@ import org.bukkit.event.HandlerList;
public class BlockBreakEvent extends BlockEvent implements Cancellable { public class BlockBreakEvent extends BlockEvent implements Cancellable {
private static final HandlerList handlers = new HandlerList(); private static final HandlerList handlers = new HandlerList();
private Player player; private final Player player;
private boolean cancel; private boolean cancel;
public BlockBreakEvent(final Block theBlock, Player player) { public BlockBreakEvent(final Block theBlock, final Player player) {
super(Type.BLOCK_BREAK, theBlock); super(theBlock);
this.player = player; this.player = player;
this.cancel = false; this.cancel = false;
} }

Datei anzeigen

@ -14,8 +14,8 @@ public class BlockBurnEvent extends BlockEvent implements Cancellable {
private static final HandlerList handlers = new HandlerList(); private static final HandlerList handlers = new HandlerList();
private boolean cancelled; private boolean cancelled;
public BlockBurnEvent(Block block) { public BlockBurnEvent(final Block block) {
super(Type.BLOCK_BURN, block); super(block);
this.cancelled = false; this.cancelled = false;
} }

Datei anzeigen

@ -19,8 +19,8 @@ public class BlockCanBuildEvent extends BlockEvent {
protected boolean buildable; protected boolean buildable;
protected int material; protected int material;
public BlockCanBuildEvent(Block block, int id, boolean canBuild) { public BlockCanBuildEvent(final Block block, final int id, final boolean canBuild) {
super(Type.BLOCK_CANBUILD, block); super(block);
buildable = canBuild; buildable = canBuild;
material = id; material = id;
} }

Datei anzeigen

@ -14,13 +14,13 @@ import org.bukkit.inventory.ItemStack;
@SuppressWarnings("serial") @SuppressWarnings("serial")
public class BlockDamageEvent extends BlockEvent implements Cancellable { public class BlockDamageEvent extends BlockEvent implements Cancellable {
private static final HandlerList handlers = new HandlerList(); private static final HandlerList handlers = new HandlerList();
private Player player; private final Player player;
private boolean instaBreak; private boolean instaBreak;
private boolean cancel; private boolean cancel;
private ItemStack itemstack; private final ItemStack itemstack;
public BlockDamageEvent(Player player, Block block, ItemStack itemInHand, boolean instaBreak) { public BlockDamageEvent(final Player player, final Block block, final ItemStack itemInHand, final boolean instaBreak) {
super(Type.BLOCK_DAMAGE, block); super(block);
this.instaBreak = instaBreak; this.instaBreak = instaBreak;
this.player = player; this.player = player;
this.itemstack = itemInHand; this.itemstack = itemInHand;

Datei anzeigen

@ -19,8 +19,8 @@ public class BlockDispenseEvent extends BlockEvent implements Cancellable {
private ItemStack item; private ItemStack item;
private Vector velocity; private Vector velocity;
public BlockDispenseEvent(Block block, ItemStack dispensed, Vector velocity) { public BlockDispenseEvent(final Block block, final ItemStack dispensed, final Vector velocity) {
super(Type.BLOCK_DISPENSE, block); super(block);
this.item = dispensed; this.item = dispensed;
this.velocity = velocity; this.velocity = velocity;
} }

Datei anzeigen

@ -10,8 +10,7 @@ import org.bukkit.event.Event;
public abstract class BlockEvent extends Event { public abstract class BlockEvent extends Event {
protected Block block; protected Block block;
public BlockEvent(final Event.Type type, final Block theBlock) { public BlockEvent(final Block theBlock) {
super(type);
block = theBlock; block = theBlock;
} }

Datei anzeigen

@ -20,10 +20,10 @@ import org.bukkit.event.HandlerList;
public class BlockFadeEvent extends BlockEvent implements Cancellable { public class BlockFadeEvent extends BlockEvent implements Cancellable {
private static final HandlerList handlers = new HandlerList(); private static final HandlerList handlers = new HandlerList();
private boolean cancelled; private boolean cancelled;
private BlockState newState; private final BlockState newState;
public BlockFadeEvent(Block block, BlockState newState) { public BlockFadeEvent(final Block block, final BlockState newState) {
super(Type.BLOCK_FADE, block); super(block);
this.newState = newState; this.newState = newState;
this.cancelled = false; this.cancelled = false;
} }

Datei anzeigen

@ -23,17 +23,10 @@ import org.bukkit.event.HandlerList;
public class BlockFormEvent extends BlockEvent implements Cancellable { public class BlockFormEvent extends BlockEvent implements Cancellable {
private static final HandlerList handlers = new HandlerList(); private static final HandlerList handlers = new HandlerList();
private boolean cancelled; private boolean cancelled;
private BlockState newState; private final BlockState newState;
public BlockFormEvent(Block block, BlockState newState) { public BlockFormEvent(final Block block, final BlockState newState) {
super(Type.BLOCK_FORM, block); super(block);
this.block = block;
this.newState = newState;
this.cancelled = false;
}
public BlockFormEvent(Type type, Block block, BlockState newState) {
super(type, block);
this.block = block; this.block = block;
this.newState = newState; this.newState = newState;
this.cancelled = false; this.cancelled = false;

Datei anzeigen

@ -18,7 +18,7 @@ public class BlockFromToEvent extends BlockEvent implements Cancellable {
protected boolean cancel; protected boolean cancel;
public BlockFromToEvent(final Block block, final BlockFace face) { public BlockFromToEvent(final Block block, final BlockFace face) {
super(Type.BLOCK_FROMTO, block); super(block);
this.face = face; this.face = face;
this.cancel = false; this.cancel = false;
} }

Datei anzeigen

@ -3,7 +3,6 @@ package org.bukkit.event.block;
import org.bukkit.block.Block; import org.bukkit.block.Block;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.Cancellable; import org.bukkit.event.Cancellable;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList; import org.bukkit.event.HandlerList;
/** /**
@ -14,12 +13,12 @@ import org.bukkit.event.HandlerList;
@SuppressWarnings("serial") @SuppressWarnings("serial")
public class BlockIgniteEvent extends BlockEvent implements Cancellable { public class BlockIgniteEvent extends BlockEvent implements Cancellable {
private static final HandlerList handlers = new HandlerList(); private static final HandlerList handlers = new HandlerList();
private IgniteCause cause; private final IgniteCause cause;
private boolean cancel; private boolean cancel;
private Player thePlayer; private final Player thePlayer;
public BlockIgniteEvent(Block theBlock, IgniteCause cause, Player thePlayer) { public BlockIgniteEvent(final Block theBlock, final IgniteCause cause, final Player thePlayer) {
super(Event.Type.BLOCK_IGNITE, theBlock); super(theBlock);
this.cause = cause; this.cause = cause;
this.thePlayer = thePlayer; this.thePlayer = thePlayer;
this.cancel = false; this.cancel = false;

Datei anzeigen

@ -1,191 +0,0 @@
package org.bukkit.event.block;
import org.bukkit.event.Listener;
/**
* Handles all events thrown in relation to Blocks
*/
@Deprecated
public class BlockListener implements Listener {
/**
* Default Constructor
*/
public BlockListener() {}
/**
* Called when a block is damaged by a player.
* <p />
* If a Block Damage event is cancelled, the block will not be damaged.
*
* @param event Relevant event details
*/
public void onBlockDamage(BlockDamageEvent event) {}
/**
* Called when we try to place a block, to see if we can build it here or not.
* <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 BlockCanBuildEvent#getMaterial()} or {@link BlockCanBuildEvent#getMaterialId()} instead.</li>
* </ul>
*
* @param event Relevant event details
*/
public void onBlockCanBuild(BlockCanBuildEvent event) {}
/**
* Represents events with a source block and a destination block, currently only applies to liquid (lava and water).
* <p />
* If a Block From To event is cancelled, the block will not move (the liquid will not flow).
*
* @param event Relevant event details
*/
public void onBlockFromTo(BlockFromToEvent event) {}
/**
* 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.
*
* @param event Relevant event details
*/
public void onBlockIgnite(BlockIgniteEvent event) {}
/**
* Called when block physics occurs.
*
* @param event Relevant event details
*/
public void onBlockPhysics(BlockPhysicsEvent event) {}
/**
* Called when a block is placed by a player.
* <p />
* If a Block Place event is cancelled, the block will not be placed.
*
* @param event Relevant event details
*/
public void onBlockPlace(BlockPlaceEvent event) {}
/**
* Called when redstone changes.<br />
* From: the source of the redstone change.<br />
* To: The redstone dust that changed.
*
* @param event Relevant event details
*/
public void onBlockRedstoneChange(BlockRedstoneEvent event) {}
/**
* Called when leaves are decaying naturally.
* <p />
* If a Leaves Decay event is cancelled, the leaves will not decay.
*
* @param event Relevant event details
*/
public void onLeavesDecay(LeavesDecayEvent event) {}
/**
* Called when a sign is changed by a player.
* <p />
* If a Sign Change event is cancelled, the sign will not be changed.
*
* @param event Relevant event details
*/
public void onSignChange(SignChangeEvent event) {}
/**
* 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.
*
* @param event Relevant event details
*/
public void onBlockBurn(BlockBurnEvent event) {}
/**
* Called when a block is broken by a player.
* <p />
* Note:
* Plugins wanting to simulate a traditional block drop should set the block to air and utilise 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.
*
* @param event Relevant event details
*/
public void onBlockBreak(BlockBreakEvent event) {}
/**
* 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 />
* Examples:
* <ul>
* <li>Snow forming due to a snow storm.</li>
* <li>Ice forming in a snowy Biome like Tiga or Tundra.</li>
* </ul>
* <p />
* If a Block Form event is cancelled, the block will not be formed or will not spread.
*
* @see BlockSpreadEvent
* @param event Relevant event details
*/
public void onBlockForm(BlockFormEvent event) {}
/**
* Called when a block spreads based on world conditions.
* Use {@link BlockFormEvent} to catch blocks that "randomly" form instead of actually spread.
* <p />
* Examples:
* <ul>
* <li>Mushrooms spreading.</li>
* <li>Fire spreading.</li>
* </ul>
* <p />
* If a Block Spread event is cancelled, the block will not spread.
*
* @param event Relevant event details
*/
public void onBlockSpread(BlockSpreadEvent event) {}
/**
* Called when a block fades, melts or disappears based on world conditions
* <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>
* </ul>
* <p />
* If a Block Fade event is cancelled, the block will not fade, melt or disappear.
*
* @param event Relevant event details
*/
public void onBlockFade(BlockFadeEvent event) {}
/**
* Called when an item is dispensed from a block.
* <p />
* If a Block Dispense event is cancelled, the block will not dispense the item.
*
* @param event Relevant event details
*/
public void onBlockDispense(BlockDispenseEvent event) {}
/**
* Called when a piston retracts
*
* @param event Relevant event details
*/
public void onBlockPistonRetract(BlockPistonRetractEvent event) {}
/**
* Called when a piston extends
*
* @param event Relevant event details
*/
public void onBlockPistonExtend(BlockPistonExtendEvent event) {}
}

Datei anzeigen

@ -15,7 +15,7 @@ public class BlockPhysicsEvent extends BlockEvent implements Cancellable {
private boolean cancel = false; private boolean cancel = false;
public BlockPhysicsEvent(final Block block, final int changed) { public BlockPhysicsEvent(final Block block, final int changed) {
super(Type.BLOCK_PHYSICS, block); super(block);
this.changed = changed; this.changed = changed;
} }

Datei anzeigen

@ -8,10 +8,10 @@ import org.bukkit.event.Cancellable;
@SuppressWarnings("serial") @SuppressWarnings("serial")
public abstract class BlockPistonEvent extends BlockEvent implements Cancellable { public abstract class BlockPistonEvent extends BlockEvent implements Cancellable {
private boolean cancelled; private boolean cancelled;
private BlockFace direction; private final BlockFace direction;
public BlockPistonEvent(Type type, Block block, BlockFace direction) { public BlockPistonEvent(final Block block, final BlockFace direction) {
super(type, block); super(block);
this.direction = direction; this.direction = direction;
} }

Datei anzeigen

@ -11,11 +11,11 @@ import org.bukkit.event.HandlerList;
@SuppressWarnings("serial") @SuppressWarnings("serial")
public class BlockPistonExtendEvent extends BlockPistonEvent { public class BlockPistonExtendEvent extends BlockPistonEvent {
private static final HandlerList handlers = new HandlerList(); private static final HandlerList handlers = new HandlerList();
private int length; private final int length;
private List<Block> blocks; private List<Block> blocks;
public BlockPistonExtendEvent(Block block, int length, BlockFace direction) { public BlockPistonExtendEvent(final Block block, final int length, final BlockFace direction) {
super(Type.BLOCK_PISTON_EXTEND, block, direction); super(block, direction);
this.length = length; this.length = length;
} }

Datei anzeigen

@ -8,8 +8,8 @@ import org.bukkit.event.HandlerList;
@SuppressWarnings("serial") @SuppressWarnings("serial")
public class BlockPistonRetractEvent extends BlockPistonEvent { public class BlockPistonRetractEvent extends BlockPistonEvent {
private static final HandlerList handlers = new HandlerList(); private static final HandlerList handlers = new HandlerList();
public BlockPistonRetractEvent(Block block, BlockFace direction) { public BlockPistonRetractEvent(final Block block, final BlockFace direction) {
super(Type.BLOCK_PISTON_RETRACT, block, direction); super(block, direction);
} }
/** /**

Datei anzeigen

@ -22,8 +22,8 @@ public class BlockPlaceEvent extends BlockEvent implements Cancellable {
protected ItemStack itemInHand; protected ItemStack itemInHand;
protected Player player; protected Player player;
public BlockPlaceEvent(Block placedBlock, BlockState replacedBlockState, Block placedAgainst, ItemStack itemInHand, Player thePlayer, boolean canBuild) { public BlockPlaceEvent(final Block placedBlock, final BlockState replacedBlockState, final Block placedAgainst, final ItemStack itemInHand, final Player thePlayer, final boolean canBuild) {
super(Type.BLOCK_PLACE, placedBlock); super(placedBlock);
this.placedAgainst = placedAgainst; this.placedAgainst = placedAgainst;
this.itemInHand = itemInHand; this.itemInHand = itemInHand;
this.player = thePlayer; this.player = thePlayer;

Datei anzeigen

@ -9,11 +9,11 @@ import org.bukkit.event.HandlerList;
@SuppressWarnings("serial") @SuppressWarnings("serial")
public class BlockRedstoneEvent extends BlockEvent { public class BlockRedstoneEvent extends BlockEvent {
private static final HandlerList handlers = new HandlerList(); private static final HandlerList handlers = new HandlerList();
private int oldCurrent; private final int oldCurrent;
private int newCurrent; private int newCurrent;
public BlockRedstoneEvent(Block block, int oldCurrent, int newCurrent) { public BlockRedstoneEvent(final Block block, final int oldCurrent, final int newCurrent) {
super(Type.REDSTONE_CHANGE, block); super(block);
this.oldCurrent = oldCurrent; this.oldCurrent = oldCurrent;
this.newCurrent = newCurrent; this.newCurrent = newCurrent;
} }

Datei anzeigen

@ -21,10 +21,10 @@ import org.bukkit.event.HandlerList;
@SuppressWarnings("serial") @SuppressWarnings("serial")
public class BlockSpreadEvent extends BlockFormEvent { public class BlockSpreadEvent extends BlockFormEvent {
private static final HandlerList handlers = new HandlerList(); private static final HandlerList handlers = new HandlerList();
private Block source; private final Block source;
public BlockSpreadEvent(Block block, Block source, BlockState newState) { public BlockSpreadEvent(final Block block, final Block source, final BlockState newState) {
super(Type.BLOCK_SPREAD, block, newState); super(block, newState);
this.source = source; this.source = source;
} }

Datei anzeigen

@ -14,9 +14,9 @@ import org.bukkit.entity.Entity;
*/ */
@SuppressWarnings("serial") @SuppressWarnings("serial")
public class EntityBlockFormEvent extends BlockFormEvent { public class EntityBlockFormEvent extends BlockFormEvent {
private Entity entity; private final Entity entity;
public EntityBlockFormEvent(Entity entity, Block block, BlockState blockstate) { public EntityBlockFormEvent(final Entity entity, final Block block, final BlockState blockstate) {
super(block, blockstate); super(block, blockstate);
this.entity = entity; this.entity = entity;

Datei anzeigen

@ -15,7 +15,7 @@ public class LeavesDecayEvent extends BlockEvent implements Cancellable {
private boolean cancel = false; private boolean cancel = false;
public LeavesDecayEvent(final Block block) { public LeavesDecayEvent(final Block block) {
super(Type.LEAVES_DECAY, block); super(block);
} }
public boolean isCancelled() { public boolean isCancelled() {

Datei anzeigen

@ -14,11 +14,11 @@ import org.bukkit.event.HandlerList;
public class SignChangeEvent extends BlockEvent implements Cancellable { public class SignChangeEvent extends BlockEvent implements Cancellable {
private static final HandlerList handlers = new HandlerList(); private static final HandlerList handlers = new HandlerList();
private boolean cancel = false; private boolean cancel = false;
private Player player; private final Player player;
private String[] lines; private final String[] lines;
public SignChangeEvent(final Block theBlock, final Player thePlayer, String[] theLines) { public SignChangeEvent(final Block theBlock, final Player thePlayer, final String[] theLines) {
super(Type.SIGN_CHANGE, theBlock); super(theBlock);
this.player = thePlayer; this.player = thePlayer;
this.lines = theLines; this.lines = theLines;
} }

Datei anzeigen

@ -17,14 +17,14 @@ import org.bukkit.inventory.ItemStack;
@SuppressWarnings("serial") @SuppressWarnings("serial")
public class EnchantItemEvent extends Event implements Cancellable { public class EnchantItemEvent extends Event implements Cancellable {
private static final HandlerList handlers = new HandlerList(); private static final HandlerList handlers = new HandlerList();
private Block table; private final Block table;
private ItemStack item; private final ItemStack item;
private int level; private int level;
private boolean cancelled; private boolean cancelled;
private Map<Enchantment,Integer> enchants; private final Map<Enchantment,Integer> enchants;
private Player enchanter; private final Player enchanter;
public EnchantItemEvent(Player enchanter, Block table, ItemStack item, int level, Map<Enchantment, Integer> enchants) { public EnchantItemEvent(final Player enchanter, final Block table, final ItemStack item, final int level, final Map<Enchantment, Integer> enchants) {
this.enchanter = enchanter; this.enchanter = enchanter;
this.table = table; this.table = table;
this.item = item; this.item = item;

Datei anzeigen

@ -13,14 +13,14 @@ import org.bukkit.inventory.ItemStack;
@SuppressWarnings("serial") @SuppressWarnings("serial")
public class PrepareItemEnchantEvent extends Event implements Cancellable { public class PrepareItemEnchantEvent extends Event implements Cancellable {
private static final HandlerList handlers = new HandlerList(); private static final HandlerList handlers = new HandlerList();
private Block table; private final Block table;
private ItemStack item; private final ItemStack item;
private int[] levelsOffered; private final int[] levelsOffered;
private int bonus; private final int bonus;
private boolean cancelled; private boolean cancelled;
private Player enchanter; private final Player enchanter;
public PrepareItemEnchantEvent(Player enchanter, Block table, ItemStack item, int[] levelsOffered, int bonus) { public PrepareItemEnchantEvent(final Player enchanter, final Block table, final ItemStack item, final int[] levelsOffered, final int bonus) {
this.enchanter = enchanter; this.enchanter = enchanter;
this.table = table; this.table = table;
this.item = item; this.item = item;

Datei anzeigen

@ -15,13 +15,13 @@ import org.bukkit.event.HandlerList;
public class CreatureSpawnEvent extends EntityEvent implements Cancellable { public class CreatureSpawnEvent extends EntityEvent implements Cancellable {
private static final HandlerList handlers = new HandlerList(); private static final HandlerList handlers = new HandlerList();
private Location location; private final Location location;
private boolean canceled; private boolean canceled;
private CreatureType creatureType; private final CreatureType creatureType;
private SpawnReason spawnReason; private final SpawnReason spawnReason;
public CreatureSpawnEvent(Entity spawnee, CreatureType mobtype, Location loc, SpawnReason spawnReason) { public CreatureSpawnEvent(final Entity spawnee, final CreatureType mobtype, final Location loc, final SpawnReason spawnReason) {
super(Type.CREATURE_SPAWN, spawnee); super(spawnee);
this.creatureType = mobtype; this.creatureType = mobtype;
this.location = loc; this.location = loc;
this.spawnReason = spawnReason; this.spawnReason = spawnReason;

Datei anzeigen

@ -14,19 +14,17 @@ public class CreeperPowerEvent extends EntityEvent implements Cancellable {
private static final HandlerList handlers = new HandlerList(); private static final HandlerList handlers = new HandlerList();
private boolean canceled; private boolean canceled;
private PowerCause cause; private final PowerCause cause;
private Entity bolt; private Entity bolt;
public CreeperPowerEvent(Entity creeper, Entity bolt, PowerCause cause) { public CreeperPowerEvent(final Entity creeper, final Entity bolt, final PowerCause cause) {
super(Type.CREEPER_POWER, creeper); this(creeper, cause);
this.bolt = bolt; this.bolt = bolt;
this.cause = cause;
} }
public CreeperPowerEvent(Entity creeper, PowerCause cause) { public CreeperPowerEvent(final Entity creeper, final PowerCause cause) {
super(Type.CREEPER_POWER, creeper); super(creeper);
this.cause = cause; this.cause = cause;
this.bolt = null;
} }
public boolean isCancelled() { public boolean isCancelled() {

Datei anzeigen

@ -14,10 +14,10 @@ public class EndermanPickupEvent extends EntityEvent implements Cancellable {
private static final HandlerList handlers = new HandlerList(); private static final HandlerList handlers = new HandlerList();
private boolean cancel; private boolean cancel;
private Block block; private final Block block;
public EndermanPickupEvent(Entity what, Block block) { public EndermanPickupEvent(final Entity what, final Block block) {
super(Type.ENDERMAN_PICKUP, what); super(what);
this.block = block; this.block = block;
this.cancel = false; this.cancel = false;
} }

Datei anzeigen

@ -16,10 +16,10 @@ public class EndermanPlaceEvent extends EntityEvent implements Cancellable {
private static final HandlerList handlers = new HandlerList(); private static final HandlerList handlers = new HandlerList();
private boolean cancel; private boolean cancel;
private Location location; private final Location location;
public EndermanPlaceEvent(Entity what, Location location) { public EndermanPlaceEvent(final Entity what, final Location location) {
super(Type.ENDERMAN_PLACE, what); super(what);
this.location = location; this.location = location;
this.cancel = false; this.cancel = false;
} }

Datei anzeigen

@ -14,12 +14,12 @@ import org.bukkit.event.HandlerList;
*/ */
public class EntityChangeBlockEvent extends EntityEvent implements Cancellable { public class EntityChangeBlockEvent extends EntityEvent implements Cancellable {
private static final HandlerList handlers = new HandlerList(); private static final HandlerList handlers = new HandlerList();
private Block block; private final Block block;
private boolean cancel; private boolean cancel;
private Material to; private final Material to;
public EntityChangeBlockEvent(Entity what, Block block, Material to) { public EntityChangeBlockEvent(final Entity what, final Block block, final Material to) {
super(Type.ENTITY_CHANGE_BLOCK, what); super(what);
this.block = block; this.block = block;
this.cancel = false; this.cancel = false;
this.to = to; this.to = to;

Datei anzeigen

@ -6,9 +6,9 @@ import org.bukkit.entity.Entity;
@SuppressWarnings("serial") @SuppressWarnings("serial")
public class EntityCombustByBlockEvent extends EntityCombustEvent { public class EntityCombustByBlockEvent extends EntityCombustEvent {
private Block combuster; private final Block combuster;
public EntityCombustByBlockEvent(Block combuster, Entity combustee, int duration) { public EntityCombustByBlockEvent(final Block combuster, final Entity combustee, final int duration) {
super(combustee, duration); super(combustee, duration);
this.combuster = combuster; this.combuster = combuster;
} }

Datei anzeigen

@ -5,9 +5,9 @@ import org.bukkit.entity.Entity;
@SuppressWarnings("serial") @SuppressWarnings("serial")
public class EntityCombustByEntityEvent extends EntityCombustEvent { public class EntityCombustByEntityEvent extends EntityCombustEvent {
private Entity combuster; private final Entity combuster;
public EntityCombustByEntityEvent(Entity combuster, Entity combustee, int duration) { public EntityCombustByEntityEvent(final Entity combuster, final Entity combustee, final int duration) {
super(combustee, duration); super(combustee, duration);
this.combuster = combuster; this.combuster = combuster;
} }

Datei anzeigen

@ -15,8 +15,8 @@ public class EntityCombustEvent extends EntityEvent implements Cancellable {
private int duration; private int duration;
private boolean cancel; private boolean cancel;
public EntityCombustEvent(Entity combustee, int duration) { public EntityCombustEvent(final Entity combustee, final int duration) {
super(Type.ENTITY_COMBUST, combustee); super(combustee);
this.duration = duration; this.duration = duration;
this.cancel = false; this.cancel = false;
} }

Datei anzeigen

@ -13,12 +13,12 @@ import org.bukkit.event.HandlerList;
@SuppressWarnings("serial") @SuppressWarnings("serial")
public class EntityCreatePortalEvent extends EntityEvent implements Cancellable { public class EntityCreatePortalEvent extends EntityEvent implements Cancellable {
private static final HandlerList handlers = new HandlerList(); private static final HandlerList handlers = new HandlerList();
private List<BlockState> blocks; private final List<BlockState> blocks;
private boolean cancelled = false; private boolean cancelled = false;
private PortalType type = PortalType.CUSTOM; private PortalType type = PortalType.CUSTOM;
public EntityCreatePortalEvent(Entity what, List<BlockState> blocks, PortalType type) { public EntityCreatePortalEvent(final Entity what, final List<BlockState> blocks, final PortalType type) {
super(Type.ENTITY_CREATE_PORTAL, what); super(what);
this.blocks = blocks; this.blocks = blocks;
this.type = type; this.type = type;

Datei anzeigen

@ -9,10 +9,10 @@ import org.bukkit.entity.Entity;
@SuppressWarnings("serial") @SuppressWarnings("serial")
public class EntityDamageByBlockEvent extends EntityDamageEvent { public class EntityDamageByBlockEvent extends EntityDamageEvent {
private Block damager; private final Block damager;
public EntityDamageByBlockEvent(Block damager, Entity damagee, DamageCause cause, int damage) { public EntityDamageByBlockEvent(final Block damager, final Entity damagee, final DamageCause cause, final int damage) {
super(Type.ENTITY_DAMAGE, damagee, cause, damage); super(damagee, cause, damage);
this.damager = damager; this.damager = damager;
} }

Datei anzeigen

@ -8,10 +8,10 @@ import org.bukkit.entity.Entity;
@SuppressWarnings("serial") @SuppressWarnings("serial")
public class EntityDamageByEntityEvent extends EntityDamageEvent { public class EntityDamageByEntityEvent extends EntityDamageEvent {
private Entity damager; private final Entity damager;
public EntityDamageByEntityEvent(Entity damager, Entity damagee, DamageCause cause, int damage) { public EntityDamageByEntityEvent(final Entity damager, final Entity damagee, final DamageCause cause, final int damage) {
super(Type.ENTITY_DAMAGE, damagee, cause, damage); super(damagee, cause, damage);
this.damager = damager; this.damager = damager;
} }

Datei anzeigen

@ -1,42 +0,0 @@
package org.bukkit.event.entity;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Projectile;
/**
* Called when an entity is damaged by a projectile
*
* @deprecated use {@link EntityDamageByEntityEvent} instead, where {@link EntityDamageByEntityEvent#getDamager()} will return the {@link Projectile}
*/
@SuppressWarnings("serial")
@Deprecated
public class EntityDamageByProjectileEvent extends EntityDamageByEntityEvent {
private Projectile projectile;
public EntityDamageByProjectileEvent(Entity damagee, Projectile projectile, DamageCause cause, int damage) {
this(projectile.getShooter(), damagee, projectile, cause, damage);
}
public EntityDamageByProjectileEvent(Entity damager, Entity damagee, Projectile projectile, DamageCause cause, int damage) {
super(damager, projectile, DamageCause.PROJECTILE, damage);
this.projectile = projectile;
}
/**
* The projectile used to cause the event
*
* @return the projectile
*/
public Projectile getProjectile() {
return projectile;
}
public void setBounce(boolean bounce) {
projectile.setBounce(bounce);
}
public boolean getBounce() {
return projectile.doesBounce();
}
}

Datei anzeigen

@ -3,7 +3,6 @@ package org.bukkit.event.entity;
import org.bukkit.entity.ComplexEntityPart; import org.bukkit.entity.ComplexEntityPart;
import org.bukkit.entity.Entity; import org.bukkit.entity.Entity;
import org.bukkit.event.Cancellable; import org.bukkit.event.Cancellable;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList; import org.bukkit.event.HandlerList;
/** /**
@ -15,14 +14,10 @@ public class EntityDamageEvent extends EntityEvent implements Cancellable {
private int damage; private int damage;
private boolean cancelled; private boolean cancelled;
private DamageCause cause; private final DamageCause cause;
public EntityDamageEvent(Entity damagee, DamageCause cause, int damage) { public EntityDamageEvent(final Entity damagee, final DamageCause cause, final int damage) {
this(Event.Type.ENTITY_DAMAGE, damagee, cause, damage); super(damagee);
}
protected EntityDamageEvent(Event.Type type, Entity damagee, DamageCause cause, int damage) {
super(type, damagee);
this.cause = cause; this.cause = cause;
this.damage = damage; this.damage = damage;

Datei anzeigen

@ -11,15 +11,15 @@ import org.bukkit.inventory.ItemStack;
@SuppressWarnings("serial") @SuppressWarnings("serial")
public class EntityDeathEvent extends EntityEvent { public class EntityDeathEvent extends EntityEvent {
private static final HandlerList handlers = new HandlerList(); private static final HandlerList handlers = new HandlerList();
private List<ItemStack> drops; private final List<ItemStack> drops;
private int dropExp = 0; private int dropExp = 0;
public EntityDeathEvent(final Entity entity, final List<ItemStack> drops) { public EntityDeathEvent(final Entity entity, final List<ItemStack> drops) {
this(entity, drops, 0); this(entity, drops, 0);
} }
public EntityDeathEvent(final Entity what, final List<ItemStack> drops, int droppedExp) { public EntityDeathEvent(final Entity what, final List<ItemStack> drops, final int droppedExp) {
super(Type.ENTITY_DEATH, what); super(what);
this.drops = drops; this.drops = drops;
this.dropExp = droppedExp; this.dropExp = droppedExp;
} }

Datei anzeigen

@ -10,8 +10,7 @@ import org.bukkit.event.Event;
public abstract class EntityEvent extends Event { public abstract class EntityEvent extends Event {
protected Entity entity; protected Entity entity;
public EntityEvent(final Event.Type type, final Entity what) { public EntityEvent(final Entity what) {
super(type);
entity = what; entity = what;
} }

Datei anzeigen

@ -15,17 +15,12 @@ import java.util.List;
public class EntityExplodeEvent extends EntityEvent implements Cancellable { public class EntityExplodeEvent extends EntityEvent implements Cancellable {
private static final HandlerList handlers = new HandlerList(); private static final HandlerList handlers = new HandlerList();
private boolean cancel; private boolean cancel;
private Location location; private final Location location;
private List<Block> blocks; private final List<Block> blocks;
private float yield; private float yield;
@Deprecated public EntityExplodeEvent(final Entity what, final Location location, final List<Block> blocks, final float yield) {
public EntityExplodeEvent(Entity what, Location location, List<Block> blocks) { super(what);
this(what, location, blocks, 0.3F);
}
public EntityExplodeEvent(Entity what, Location location, List<Block> blocks, float yield) {
super(Type.ENTITY_EXPLODE, what);
this.location = location; this.location = location;
this.blocks = blocks; this.blocks = blocks;
this.yield = yield; this.yield = yield;

Datei anzeigen

@ -15,8 +15,8 @@ public class EntityInteractEvent extends EntityEvent implements Cancellable {
private boolean cancelled; private boolean cancelled;
public EntityInteractEvent(Entity entity, Block block) { public EntityInteractEvent(final Entity entity, final Block block) {
super(Type.ENTITY_INTERACT, entity); super(entity);
this.block = block; this.block = block;
} }

Datei anzeigen

@ -1,187 +0,0 @@
package org.bukkit.event.entity;
import org.bukkit.event.Listener;
import org.bukkit.event.painting.PaintingPlaceEvent;
import org.bukkit.event.painting.PaintingBreakEvent;
/**
* Handles all events fired in relation to entities
*/
@Deprecated
public class EntityListener implements Listener {
public EntityListener() {}
/**
* Called when a creature is spawned into a world.
* <p />
* If a Creature Spawn event is cancelled, the creature will not spawn.
*
* @param event Relevant event details
*/
public void onCreatureSpawn(CreatureSpawnEvent event) {}
/**
* Called when an item is spawned into a world
*
* @param event Relevant event details
*/
public void onItemSpawn(ItemSpawnEvent event) {}
/**
* Called when an entity combusts.
* <p />
* If an Entity Combust event is cancelled, the entity will not combust.
*
* @param event Relevant event details
*/
public void onEntityCombust(EntityCombustEvent event) {}
/**
* Called when an entity is damaged
*
* @param event Relevant event details
*/
public void onEntityDamage(EntityDamageEvent event) {}
/**
* Called when an entity explodes
*
* @param event Relevant event details
*/
public void onEntityExplode(EntityExplodeEvent event) {}
/**
* Called when an entity's fuse is lit
*
* @param event Relevant event details
*/
public void onExplosionPrime(ExplosionPrimeEvent event) {}
/**
* Called when an entity dies
*
* @param event Relevant event details
*/
public void onEntityDeath(EntityDeathEvent event) {}
/**
* Called when a creature targets another entity
*
* @param event Relevant event details
*/
public void onEntityTarget(EntityTargetEvent event) {}
/**
* Called when an entity interacts with an object
*
* @param event Relevant event details
*/
public void onEntityInteract(EntityInteractEvent event) {}
/**
* Called when an entity enters a portal
*
* @param event Relevant event details
*/
public void onEntityPortalEnter(EntityPortalEnterEvent event) {}
/**
* Called when a painting is placed
*
* @param event Relevant event details
*/
public void onPaintingPlace(PaintingPlaceEvent event) {}
/**
* Called when a painting is broken
*
* @param event Relevant event details
*/
public void onPaintingBreak(PaintingBreakEvent event) {}
/**
* Called when a Pig is struck by lightning
*
* @param event Relevant event details
*/
public void onPigZap(PigZapEvent event) {}
/**
* Called when a Creeper is struck by lightning.
* <p />
* If a Creeper Power event is cancelled, the Creeper will not be powered.
*
* @param event Relevant event details
*/
public void onCreeperPower(CreeperPowerEvent event) {}
/**
* Called when an entity is tamed (currently only applies to Wolves)
*
* @param event Relevant event details
*/
public void onEntityTame(EntityTameEvent event) {}
/**
* Called when an entity regains health (currently only applies to Players)
*
* @param event Relevant event details
*/
public void onEntityRegainHealth(EntityRegainHealthEvent event) {}
/**
* Called when a project hits an object
*
* @param event Relevant event details
*/
public void onProjectileHit(ProjectileHitEvent event) {}
/**
* Called when an Enderman picks a block up
*
* @param event Relevant event details
*/
public void onEndermanPickup(EndermanPickupEvent event) {}
/**
* Called when an Enderman places a block
*
* @param event Relevant event details
*/
public void onEndermanPlace(EndermanPlaceEvent event) {}
/**
* Called when a human entity's food level changes
*
* @param event Relevant event details
*/
public void onFoodLevelChange(FoodLevelChangeEvent event) {}
/**
* Called when a LivingEntity shoots a bow firing an arrow
*
* @param event Relevant event details
*/
public void onEntityShootBow(EntityShootBowEvent event) {}
/**
* Called when a Slime splits into smaller Slimes upon death
*
* @param event Relevant event details
*/
public void onSlimeSplit(SlimeSplitEvent event) {}
/**
* Called when an item despawns from a world
*
* @param event Relevant event details
*/
public void onItemDespawn(ItemDespawnEvent event) {}
/**
* Called when an entity creates a portal.
*
* @param event Relevant event details
*/
public void onEntityCreatePortalEvent(EntityCreatePortalEvent event) {}
}

Datei anzeigen

@ -11,10 +11,10 @@ import org.bukkit.event.HandlerList;
public class EntityPortalEnterEvent extends EntityEvent { public class EntityPortalEnterEvent extends EntityEvent {
private static final HandlerList handlers = new HandlerList(); private static final HandlerList handlers = new HandlerList();
private Location location; private final Location location;
public EntityPortalEnterEvent(Entity entity, Location location) { public EntityPortalEnterEvent(final Entity entity, final Location location) {
super(Type.ENTITY_PORTAL_ENTER, entity); super(entity);
this.location = location; this.location = location;
} }

Datei anzeigen

@ -2,7 +2,6 @@ package org.bukkit.event.entity;
import org.bukkit.entity.Entity; import org.bukkit.entity.Entity;
import org.bukkit.event.Cancellable; import org.bukkit.event.Cancellable;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList; import org.bukkit.event.HandlerList;
/** /**
@ -14,10 +13,10 @@ public class EntityRegainHealthEvent extends EntityEvent implements Cancellable
private boolean cancelled; private boolean cancelled;
private int amount; private int amount;
private RegainReason regainReason; private final RegainReason regainReason;
public EntityRegainHealthEvent(Entity entity, int amount, RegainReason regainReason) { public EntityRegainHealthEvent(final Entity entity, final int amount, final RegainReason regainReason) {
super(Event.Type.ENTITY_REGAIN_HEALTH, entity); super(entity);
this.amount = amount; this.amount = amount;
this.regainReason = regainReason; this.regainReason = regainReason;
} }

Datei anzeigen

@ -14,13 +14,13 @@ import org.bukkit.inventory.ItemStack;
public class EntityShootBowEvent extends EntityEvent implements Cancellable { public class EntityShootBowEvent extends EntityEvent implements Cancellable {
private static final HandlerList handlers = new HandlerList(); private static final HandlerList handlers = new HandlerList();
private ItemStack bow; private final ItemStack bow;
private Entity projectile; private Entity projectile;
private float force; private final float force;
private boolean cancelled; private boolean cancelled;
public EntityShootBowEvent(LivingEntity shooter, ItemStack bow, Projectile projectile, float force) { public EntityShootBowEvent(final LivingEntity shooter, final ItemStack bow, final Projectile projectile, final float force) {
super(Type.ENTITY_SHOOT_BOW, shooter); super(shooter);
this.bow = bow; this.bow = bow;
this.projectile = projectile; this.projectile = projectile;
this.force = force; this.force = force;

Datei anzeigen

@ -12,10 +12,10 @@ import org.bukkit.event.HandlerList;
public class EntityTameEvent extends EntityEvent implements Cancellable { public class EntityTameEvent extends EntityEvent implements Cancellable {
private static final HandlerList handlers = new HandlerList(); private static final HandlerList handlers = new HandlerList();
private boolean cancelled; private boolean cancelled;
private AnimalTamer owner; private final AnimalTamer owner;
public EntityTameEvent(Entity entity, AnimalTamer owner) { public EntityTameEvent(final Entity entity, final AnimalTamer owner) {
super(Type.ENTITY_TAME, entity); super(entity);
this.owner = owner; this.owner = owner;
} }

Datei anzeigen

@ -12,10 +12,10 @@ public class EntityTargetEvent extends EntityEvent implements Cancellable {
private static final HandlerList handlers = new HandlerList(); private static final HandlerList handlers = new HandlerList();
private boolean cancel; private boolean cancel;
private Entity target; private Entity target;
private TargetReason reason; private final TargetReason reason;
public EntityTargetEvent(Entity entity, Entity target, TargetReason reason) { public EntityTargetEvent(final Entity entity, final Entity target, final TargetReason reason) {
super(Type.ENTITY_TARGET, entity); super(entity);
this.target = target; this.target = target;
this.cancel = false; this.cancel = false;
this.reason = reason; this.reason = reason;

Datei anzeigen

@ -15,14 +15,14 @@ public class ExplosionPrimeEvent extends EntityEvent implements Cancellable {
private float radius; private float radius;
private boolean fire; private boolean fire;
public ExplosionPrimeEvent(Entity what, float radius, boolean fire) { public ExplosionPrimeEvent(final Entity what, final float radius, final boolean fire) {
super(Type.EXPLOSION_PRIME, what); super(what);
this.cancel = false; this.cancel = false;
this.radius = radius; this.radius = radius;
this.fire = fire; this.fire = fire;
} }
public ExplosionPrimeEvent(Explosive explosive) { public ExplosionPrimeEvent(final Explosive explosive) {
this(explosive, explosive.getYield(), explosive.isIncendiary()); this(explosive, explosive.getYield(), explosive.isIncendiary());
} }

Datei anzeigen

@ -13,8 +13,8 @@ public class FoodLevelChangeEvent extends EntityEvent implements Cancellable {
private boolean cancel = false; private boolean cancel = false;
private int level; private int level;
public FoodLevelChangeEvent(Entity what, int level) { public FoodLevelChangeEvent(final Entity what, final int level) {
super(Type.FOOD_LEVEL_CHANGE, what); super(what);
this.level = level; this.level = level;
} }

Datei anzeigen

@ -9,10 +9,10 @@ import org.bukkit.event.HandlerList;
public class ItemDespawnEvent extends EntityEvent implements Cancellable { public class ItemDespawnEvent extends EntityEvent implements Cancellable {
private static final HandlerList handlers = new HandlerList(); private static final HandlerList handlers = new HandlerList();
private boolean canceled; private boolean canceled;
private Location location; private final Location location;
public ItemDespawnEvent(Entity spawnee, Location loc) { public ItemDespawnEvent(final Entity spawnee, final Location loc) {
super(Type.ITEM_DESPAWN, spawnee); super(spawnee);
location = loc; location = loc;
} }

Datei anzeigen

@ -12,11 +12,11 @@ import org.bukkit.event.HandlerList;
public class ItemSpawnEvent extends EntityEvent implements Cancellable { public class ItemSpawnEvent extends EntityEvent implements Cancellable {
private static final HandlerList handlers = new HandlerList(); private static final HandlerList handlers = new HandlerList();
private Location location; private final Location location;
private boolean canceled; private boolean canceled;
public ItemSpawnEvent(Entity spawnee, Location loc) { public ItemSpawnEvent(final Entity spawnee, final Location loc) {
super(Type.ITEM_SPAWN, spawnee); super(spawnee);
this.location = loc; this.location = loc;
} }

Datei anzeigen

@ -12,11 +12,11 @@ public class PigZapEvent extends EntityEvent implements Cancellable {
private static final HandlerList handlers = new HandlerList(); private static final HandlerList handlers = new HandlerList();
private boolean canceled; private boolean canceled;
private Entity pigzombie; private final Entity pigzombie;
private Entity bolt; private final Entity bolt;
public PigZapEvent(Entity pig, Entity bolt, Entity pigzombie) { public PigZapEvent(final Entity pig, final Entity bolt, final Entity pigzombie) {
super(Type.PIG_ZAP, pig); super(pig);
this.bolt = bolt; this.bolt = bolt;
this.pigzombie = pigzombie; this.pigzombie = pigzombie;
} }

Datei anzeigen

@ -16,15 +16,15 @@ public class PlayerDeathEvent extends EntityDeathEvent {
private int newTotalExp = 0; private int newTotalExp = 0;
private boolean keepLevel = false; private boolean keepLevel = false;
public PlayerDeathEvent(Player player, List<ItemStack> drops, int droppedExp, String deathMessage) { public PlayerDeathEvent(final Player player, final List<ItemStack> drops, final int droppedExp, final String deathMessage) {
this(player, drops, droppedExp, 0, deathMessage); this(player, drops, droppedExp, 0, deathMessage);
} }
public PlayerDeathEvent(Player player, List<ItemStack> drops, int droppedExp, int newExp, String deathMessage) { public PlayerDeathEvent(final Player player, final List<ItemStack> drops, final int droppedExp, final int newExp, final String deathMessage) {
this(player, drops, droppedExp, newExp, 0, 0, deathMessage); this(player, drops, droppedExp, newExp, 0, 0, deathMessage);
} }
public PlayerDeathEvent(Player player, List<ItemStack> drops, int droppedExp, int newExp, int newTotalExp, int newLevel, String deathMessage) { public PlayerDeathEvent(final Player player, final List<ItemStack> drops, final int droppedExp, final int newExp, final int newTotalExp, final int newLevel, final String deathMessage) {
super(player, drops, droppedExp); super(player, drops, droppedExp);
this.newExp = newExp; this.newExp = newExp;
this.newTotalExp = newTotalExp; this.newTotalExp = newTotalExp;

Datei anzeigen

@ -17,10 +17,10 @@ import org.bukkit.event.HandlerList;
public class PotionSplashEvent extends ProjectileHitEvent implements Cancellable { public class PotionSplashEvent extends ProjectileHitEvent implements Cancellable {
private static final HandlerList handlers = new HandlerList(); private static final HandlerList handlers = new HandlerList();
private boolean cancelled; private boolean cancelled;
private Map<LivingEntity, Double> affectedEntities; private final Map<LivingEntity, Double> affectedEntities;
public PotionSplashEvent(ThrownPotion potion, Map<LivingEntity, Double> affectedEntities) { public PotionSplashEvent(final ThrownPotion potion, final Map<LivingEntity, Double> affectedEntities) {
super(Type.POTION_SPLASH, potion); super(potion);
this.affectedEntities = affectedEntities; this.affectedEntities = affectedEntities;
} }

Datei anzeigen

@ -10,12 +10,8 @@ import org.bukkit.event.HandlerList;
public class ProjectileHitEvent extends EntityEvent { public class ProjectileHitEvent extends EntityEvent {
private static final HandlerList handlers = new HandlerList(); private static final HandlerList handlers = new HandlerList();
public ProjectileHitEvent(Projectile projectile) { public ProjectileHitEvent(final Projectile projectile) {
super(Type.PROJECTILE_HIT, projectile); super(projectile);
}
public ProjectileHitEvent(Type type, Projectile projectile) {
super(type, projectile);
} }
@Override @Override

Datei anzeigen

@ -14,8 +14,8 @@ public class SheepDyeWoolEvent extends EntityEvent implements Cancellable {
private boolean cancel; private boolean cancel;
private DyeColor color; private DyeColor color;
public SheepDyeWoolEvent(Entity what, DyeColor color) { public SheepDyeWoolEvent(final Entity what, final DyeColor color) {
super(Type.SHEEP_DYE_WOOL, what); super(what);
this.cancel = false; this.cancel = false;
this.color = color; this.color = color;
} }

Datei anzeigen

@ -12,8 +12,8 @@ public class SheepRegrowWoolEvent extends EntityEvent implements Cancellable {
private static final HandlerList handlers = new HandlerList(); private static final HandlerList handlers = new HandlerList();
private boolean cancel; private boolean cancel;
public SheepRegrowWoolEvent(Entity what) { public SheepRegrowWoolEvent(final Entity what) {
super(Type.SHEEP_REGROW_WOOL, what); super(what);
this.cancel = false; this.cancel = false;
} }

Datei anzeigen

@ -13,8 +13,8 @@ public class SlimeSplitEvent extends EntityEvent implements Cancellable {
private boolean cancel; private boolean cancel;
private int count; private int count;
public SlimeSplitEvent(Entity what, int count) { public SlimeSplitEvent(final Entity what, final int count) {
super(Type.SLIME_SPLIT, what); super(what);
this.cancel = false; this.cancel = false;
this.count = count; this.count = count;
} }

Datei anzeigen

@ -12,15 +12,13 @@ import org.bukkit.inventory.ItemStack;
@SuppressWarnings("serial") @SuppressWarnings("serial")
public class FurnaceBurnEvent extends Event implements Cancellable { public class FurnaceBurnEvent extends Event implements Cancellable {
private static final HandlerList handlers = new HandlerList(); private static final HandlerList handlers = new HandlerList();
private Block furnace; private final Block furnace;
private ItemStack fuel; private final ItemStack fuel;
private int burnTime; private int burnTime;
private boolean cancelled; private boolean cancelled;
private boolean burning; private boolean burning;
public FurnaceBurnEvent(Block furnace, ItemStack fuel, int burnTime) { public FurnaceBurnEvent(final Block furnace, final ItemStack fuel, final int burnTime) {
super(Type.FURNACE_BURN);
this.furnace = furnace; this.furnace = furnace;
this.fuel = fuel; this.fuel = fuel;
this.burnTime = burnTime; this.burnTime = burnTime;

Datei anzeigen

@ -12,14 +12,12 @@ import org.bukkit.inventory.ItemStack;
@SuppressWarnings("serial") @SuppressWarnings("serial")
public class FurnaceSmeltEvent extends Event implements Cancellable { public class FurnaceSmeltEvent extends Event implements Cancellable {
private static final HandlerList handlers = new HandlerList(); private static final HandlerList handlers = new HandlerList();
private Block furnace; private final Block furnace;
private ItemStack source; private final ItemStack source;
private ItemStack result; private ItemStack result;
private boolean cancelled; private boolean cancelled;
public FurnaceSmeltEvent(Block furnace, ItemStack source, ItemStack result) { public FurnaceSmeltEvent(final Block furnace, final ItemStack source, final ItemStack result) {
super(Type.FURNACE_SMELT);
this.furnace = furnace; this.furnace = furnace;
this.source = source; this.source = source;
this.result = result; this.result = result;

Datei anzeigen

@ -1,25 +0,0 @@
package org.bukkit.event.inventory;
import org.bukkit.event.Listener;
/**
* Handles all events thrown in relation to Blocks
*/
@Deprecated
public class InventoryListener implements Listener {
public InventoryListener() {}
/**
* Called when an ItemStack is successfully smelted in a furnace.
*
* @param event Relevant event details
*/
public void onFurnaceSmelt(FurnaceSmeltEvent event) {}
/**
* Called when an ItemStack is successfully burned as fuel in a furnace.
*
* @param event Relevant event details
*/
public void onFurnaceBurn(FurnaceBurnEvent event) {}
}

Datei anzeigen

@ -8,7 +8,7 @@ import org.bukkit.entity.Painting;
*/ */
@SuppressWarnings("serial") @SuppressWarnings("serial")
public class PaintingBreakByEntityEvent extends PaintingBreakEvent { public class PaintingBreakByEntityEvent extends PaintingBreakEvent {
private Entity remover; private final Entity remover;
public PaintingBreakByEntityEvent(final Painting painting, final Entity remover) { public PaintingBreakByEntityEvent(final Painting painting, final Entity remover) {
super(painting, RemoveCause.ENTITY); super(painting, RemoveCause.ENTITY);

Datei anzeigen

@ -12,10 +12,10 @@ public class PaintingBreakEvent extends PaintingEvent implements Cancellable {
private static final HandlerList handlers = new HandlerList(); private static final HandlerList handlers = new HandlerList();
private boolean cancelled; private boolean cancelled;
private RemoveCause cause; private final RemoveCause cause;
public PaintingBreakEvent(final Painting painting, RemoveCause cause) { public PaintingBreakEvent(final Painting painting, final RemoveCause cause) {
super(Type.PAINTING_BREAK, painting); super(painting);
this.cause = cause; this.cause = cause;
} }

Datei anzeigen

@ -11,8 +11,7 @@ public abstract class PaintingEvent extends Event {
protected Painting painting; protected Painting painting;
protected PaintingEvent(final Type type, final Painting painting) { protected PaintingEvent(final Painting painting) {
super(type);
this.painting = painting; this.painting = painting;
} }

Datei anzeigen

@ -5,7 +5,6 @@ import org.bukkit.block.BlockFace;
import org.bukkit.entity.Painting; import org.bukkit.entity.Painting;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.Cancellable; import org.bukkit.event.Cancellable;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList; import org.bukkit.event.HandlerList;
/** /**
@ -17,12 +16,12 @@ public class PaintingPlaceEvent extends PaintingEvent implements Cancellable {
private boolean cancelled; private boolean cancelled;
private Player player; private final Player player;
private Block block; private final Block block;
private BlockFace blockFace; private final BlockFace blockFace;
public PaintingPlaceEvent(final Painting painting, final Player player, Block block, BlockFace blockFace) { public PaintingPlaceEvent(final Painting painting, final Player player, final Block block, final BlockFace blockFace) {
super(Event.Type.PAINTING_PLACE, painting); super(painting);
this.player = player; this.player = player;
this.block = block; this.block = block;
this.blockFace = blockFace; this.blockFace = blockFace;

Datei anzeigen

@ -11,7 +11,7 @@ import org.bukkit.event.HandlerList;
public class PlayerAnimationEvent extends PlayerEvent implements Cancellable { public class PlayerAnimationEvent extends PlayerEvent implements Cancellable {
private static final HandlerList handlers = new HandlerList(); private static final HandlerList handlers = new HandlerList();
private PlayerAnimationType animationType; private final PlayerAnimationType animationType;
private boolean isCancelled = false; private boolean isCancelled = false;
/** /**
@ -20,7 +20,7 @@ public class PlayerAnimationEvent extends PlayerEvent implements Cancellable {
* @param player The player instance * @param player The player instance
*/ */
public PlayerAnimationEvent(final Player player) { public PlayerAnimationEvent(final Player player) {
super(Type.PLAYER_ANIMATION, player); super(player);
// Only supported animation type for now: // Only supported animation type for now:
animationType = PlayerAnimationType.ARM_SWING; animationType = PlayerAnimationType.ARM_SWING;

Datei anzeigen

@ -13,10 +13,10 @@ public class PlayerBedEnterEvent extends PlayerEvent implements Cancellable {
private static final HandlerList handlers = new HandlerList(); private static final HandlerList handlers = new HandlerList();
private boolean cancel = false; private boolean cancel = false;
private Block bed; private final Block bed;
public PlayerBedEnterEvent(Player who, Block bed) { public PlayerBedEnterEvent(final Player who, final Block bed) {
super(Type.PLAYER_BED_ENTER, who); super(who);
this.bed = bed; this.bed = bed;
} }

Datei anzeigen

@ -11,10 +11,10 @@ import org.bukkit.event.HandlerList;
public class PlayerBedLeaveEvent extends PlayerEvent { public class PlayerBedLeaveEvent extends PlayerEvent {
private static final HandlerList handlers = new HandlerList(); private static final HandlerList handlers = new HandlerList();
private Block bed; private final Block bed;
public PlayerBedLeaveEvent(Player who, Block bed) { public PlayerBedLeaveEvent(final Player who, final Block bed) {
super(Type.PLAYER_BED_LEAVE, who); super(who);
this.bed = bed; this.bed = bed;
} }

Datei anzeigen

@ -13,9 +13,9 @@ import org.bukkit.inventory.ItemStack;
@SuppressWarnings("serial") @SuppressWarnings("serial")
public class PlayerBucketEmptyEvent extends PlayerBucketEvent { public class PlayerBucketEmptyEvent extends PlayerBucketEvent {
private static final HandlerList handlers = new HandlerList(); private static final HandlerList handlers = new HandlerList();
public PlayerBucketEmptyEvent(Player who, Block blockClicked, BlockFace blockFace, Material bucket, ItemStack itemInHand) {
super(Type.PLAYER_BUCKET_EMPTY, who, blockClicked, blockFace, bucket, itemInHand);
public PlayerBucketEmptyEvent(final Player who, final Block blockClicked, final BlockFace blockFace, final Material bucket, final ItemStack itemInHand) {
super(who, blockClicked, blockFace, bucket, itemInHand);
} }
@Override @Override

Datei anzeigen

@ -12,12 +12,12 @@ public abstract class PlayerBucketEvent extends PlayerEvent implements Cancellab
private ItemStack itemStack; private ItemStack itemStack;
private boolean cancelled = false; private boolean cancelled = false;
private Block blockClicked; private final Block blockClicked;
private BlockFace blockFace; private final BlockFace blockFace;
private Material bucket; private final Material bucket;
public PlayerBucketEvent(Type type, Player who, Block blockClicked, BlockFace blockFace, Material bucket, ItemStack itemInHand) { public PlayerBucketEvent(final Player who, final Block blockClicked, final BlockFace blockFace, final Material bucket, final ItemStack itemInHand) {
super(type, who); super(who);
this.blockClicked = blockClicked; this.blockClicked = blockClicked;
this.blockFace = blockFace; this.blockFace = blockFace;
this.itemStack = itemInHand; this.itemStack = itemInHand;

Datei anzeigen

@ -13,8 +13,9 @@ import org.bukkit.inventory.ItemStack;
@SuppressWarnings("serial") @SuppressWarnings("serial")
public class PlayerBucketFillEvent extends PlayerBucketEvent { public class PlayerBucketFillEvent extends PlayerBucketEvent {
private static final HandlerList handlers = new HandlerList(); private static final HandlerList handlers = new HandlerList();
public PlayerBucketFillEvent(Player who, Block blockClicked, BlockFace blockFace, Material bucket, ItemStack itemInHand) {
super(Type.PLAYER_BUCKET_FILL, who, blockClicked, blockFace, bucket, itemInHand); public PlayerBucketFillEvent(final Player who, final Block blockClicked, final BlockFace blockFace, final Material bucket, final ItemStack itemInHand) {
super(who, blockClicked, blockFace, bucket, itemInHand);
} }
@Override @Override

Datei anzeigen

@ -10,8 +10,8 @@ public class PlayerChangedWorldEvent extends PlayerEvent {
private final World from; private final World from;
public PlayerChangedWorldEvent(Player player, World from) { public PlayerChangedWorldEvent(final Player player, final World from) {
super(Type.PLAYER_CHANGED_WORLD, player); super(player);
this.from = from; this.from = from;
} }

Datei anzeigen

@ -20,12 +20,8 @@ public class PlayerChatEvent extends PlayerEvent implements Cancellable {
private final Set<Player> recipients; private final Set<Player> recipients;
public PlayerChatEvent(final Player player, final String message) { public PlayerChatEvent(final Player player, final String message) {
this(Type.PLAYER_CHAT, player, message); super(player);
} this.recipients = new HashSet<Player>(Arrays.asList(player.getServer().getOnlinePlayers()));
protected PlayerChatEvent(final Type type, final Player player, final String message) {
super(type, player);
recipients = new HashSet<Player>(Arrays.asList(player.getServer().getOnlinePlayers()));
this.message = message; this.message = message;
} }

Datei anzeigen

@ -10,8 +10,9 @@ import org.bukkit.event.HandlerList;
@SuppressWarnings("serial") @SuppressWarnings("serial")
public class PlayerCommandPreprocessEvent extends PlayerChatEvent { public class PlayerCommandPreprocessEvent extends PlayerChatEvent {
private static final HandlerList handlers = new HandlerList(); private static final HandlerList handlers = new HandlerList();
public PlayerCommandPreprocessEvent(final Player player, final String message) { public PlayerCommandPreprocessEvent(final Player player, final String message) {
super(Type.PLAYER_COMMAND_PREPROCESS, player, message); super(player, message);
} }
@Override @Override

Datei anzeigen

@ -15,7 +15,7 @@ public class PlayerDropItemEvent extends PlayerEvent implements Cancellable {
private boolean cancel = false; private boolean cancel = false;
public PlayerDropItemEvent(final Player player, final Item drop) { public PlayerDropItemEvent(final Player player, final Item drop) {
super(Type.PLAYER_DROP_ITEM, player); super(player);
this.drop = drop; this.drop = drop;
} }

Datei anzeigen

@ -11,13 +11,13 @@ import org.bukkit.event.HandlerList;
@SuppressWarnings("serial") @SuppressWarnings("serial")
public class PlayerEggThrowEvent extends PlayerEvent { public class PlayerEggThrowEvent extends PlayerEvent {
private static final HandlerList handlers = new HandlerList(); private static final HandlerList handlers = new HandlerList();
private Egg egg; private final Egg egg;
private boolean hatching; private boolean hatching;
private CreatureType hatchType; private CreatureType hatchType;
private byte numHatches; private byte numHatches;
public PlayerEggThrowEvent(Player player, Egg egg, boolean hatching, byte numHatches, CreatureType hatchType) { public PlayerEggThrowEvent(final Player player, final Egg egg, final boolean hatching, final byte numHatches, final CreatureType hatchType) {
super(Type.PLAYER_EGG_THROW, player); super(player);
this.egg = egg; this.egg = egg;
this.hatching = hatching; this.hatching = hatching;
this.numHatches = numHatches; this.numHatches = numHatches;

Datei anzeigen

@ -10,8 +10,7 @@ import org.bukkit.event.Event;
public abstract class PlayerEvent extends Event { public abstract class PlayerEvent extends Event {
protected Player player; protected Player player;
public PlayerEvent(final Event.Type type, final Player who) { public PlayerEvent(final Player who) {
super(type);
player = who; player = who;
} }

Datei anzeigen

@ -6,12 +6,13 @@ import org.bukkit.event.HandlerList;
/** /**
* Called when a players experience changes naturally * Called when a players experience changes naturally
*/ */
@SuppressWarnings("serial")
public class PlayerExpChangeEvent extends PlayerEvent { public class PlayerExpChangeEvent extends PlayerEvent {
private static final HandlerList handlers = new HandlerList(); private static final HandlerList handlers = new HandlerList();
private int exp; private int exp;
public PlayerExpChangeEvent(Player player, int expAmount) { public PlayerExpChangeEvent(final Player player, final int expAmount) {
super(Type.PLAYER_EXP_CHANGE, player); super(player);
exp = expAmount; exp = expAmount;
} }
@ -33,6 +34,7 @@ public class PlayerExpChangeEvent extends PlayerEvent {
exp = amount; exp = amount;
} }
@Override
public HandlerList getHandlers() { public HandlerList getHandlers() {
return handlers; return handlers;
} }

Datei anzeigen

@ -13,10 +13,10 @@ public class PlayerFishEvent extends PlayerEvent implements Cancellable {
private static final HandlerList handlers = new HandlerList(); private static final HandlerList handlers = new HandlerList();
private final Entity entity; private final Entity entity;
private boolean cancel = false; private boolean cancel = false;
private State state; private final State state;
public PlayerFishEvent(final Player player, final Entity entity, State state) { public PlayerFishEvent(final Player player, final Entity entity, final State state) {
super(Type.PLAYER_FISH, player); super(player);
this.entity = entity; this.entity = entity;
this.state = state; this.state = state;
} }

Datei anzeigen

@ -10,10 +10,10 @@ public class PlayerGameModeChangeEvent extends PlayerEvent implements Cancellabl
private static final HandlerList handlers = new HandlerList(); private static final HandlerList handlers = new HandlerList();
private boolean cancelled; private boolean cancelled;
private GameMode newGameMode; private final GameMode newGameMode;
public PlayerGameModeChangeEvent(Player player, GameMode newGameMode) { public PlayerGameModeChangeEvent(final Player player, final GameMode newGameMode) {
super(Type.PLAYER_GAME_MODE_CHANGE, player); super(player);
this.newGameMode = newGameMode; this.newGameMode = newGameMode;
} }

Datei anzeigen

@ -14,8 +14,8 @@ public class PlayerInteractEntityEvent extends PlayerEvent implements Cancellabl
protected Entity clickedEntity; protected Entity clickedEntity;
boolean cancelled = false; boolean cancelled = false;
public PlayerInteractEntityEvent(Player who, Entity clickedEntity) { public PlayerInteractEntityEvent(final Player who, final Entity clickedEntity) {
super(Type.PLAYER_INTERACT_ENTITY, who); super(who);
this.clickedEntity = clickedEntity; this.clickedEntity = clickedEntity;
} }

Datei anzeigen

@ -23,8 +23,8 @@ public class PlayerInteractEvent extends PlayerEvent implements Cancellable {
private Result useClickedBlock; private Result useClickedBlock;
private Result useItemInHand; private Result useItemInHand;
public PlayerInteractEvent(Player who, Action action, ItemStack item, Block clickedBlock, BlockFace clickedFace) { public PlayerInteractEvent(final Player who, final Action action, final ItemStack item, final Block clickedBlock, final BlockFace clickedFace) {
super(Type.PLAYER_INTERACT, who); super(who);
this.action = action; this.action = action;
this.item = item; this.item = item;
this.blockClicked = clickedBlock; this.blockClicked = clickedBlock;

Datei anzeigen

@ -13,7 +13,7 @@ public class PlayerInventoryEvent extends PlayerEvent {
protected Inventory inventory; protected Inventory inventory;
public PlayerInventoryEvent(final Player player, final Inventory inventory) { public PlayerInventoryEvent(final Player player, final Inventory inventory) {
super(Type.PLAYER_INVENTORY, player); super(player);
this.inventory = inventory; this.inventory = inventory;
} }

Datei anzeigen

@ -9,11 +9,11 @@ import org.bukkit.event.HandlerList;
@SuppressWarnings("serial") @SuppressWarnings("serial")
public class PlayerItemHeldEvent extends PlayerEvent { public class PlayerItemHeldEvent extends PlayerEvent {
private static final HandlerList handlers = new HandlerList(); private static final HandlerList handlers = new HandlerList();
private int previous; private final int previous;
private int current; private final int current;
public PlayerItemHeldEvent(final Player player, final int previous, final int current) { public PlayerItemHeldEvent(final Player player, final int previous, final int current) {
super(Type.PLAYER_ITEM_HELD, player); super(player);
this.previous = previous; this.previous = previous;
this.current = current; this.current = current;
} }

Datei anzeigen

@ -11,8 +11,8 @@ public class PlayerJoinEvent extends PlayerEvent {
private static final HandlerList handlers = new HandlerList(); private static final HandlerList handlers = new HandlerList();
private String joinMessage; private String joinMessage;
public PlayerJoinEvent(Player playerJoined, String joinMessage) { public PlayerJoinEvent(final Player playerJoined, final String joinMessage) {
super(Type.PLAYER_JOIN, playerJoined); super(playerJoined);
this.joinMessage = joinMessage; this.joinMessage = joinMessage;
} }

Datei anzeigen

@ -14,8 +14,8 @@ public class PlayerKickEvent extends PlayerEvent implements Cancellable {
private String kickReason; private String kickReason;
private Boolean cancel; private Boolean cancel;
public PlayerKickEvent(Player playerKicked, String kickReason, String leaveMessage) { public PlayerKickEvent(final Player playerKicked, final String kickReason, final String leaveMessage) {
super(Type.PLAYER_KICK, playerKicked); super(playerKicked);
this.kickReason = kickReason; this.kickReason = kickReason;
this.leaveMessage = leaveMessage; this.leaveMessage = leaveMessage;
this.cancel = false; this.cancel = false;

Datei anzeigen

@ -6,13 +6,14 @@ import org.bukkit.event.HandlerList;
/** /**
* Called when a players level changes * Called when a players level changes
*/ */
@SuppressWarnings("serial")
public class PlayerLevelChangeEvent extends PlayerEvent { public class PlayerLevelChangeEvent extends PlayerEvent {
private static final HandlerList handlers = new HandlerList(); private static final HandlerList handlers = new HandlerList();
private int oldLevel; private final int oldLevel;
private int newLevel; private final int newLevel;
public PlayerLevelChangeEvent(Player player, int oldLevel, int newLevel) { public PlayerLevelChangeEvent(final Player player, final int oldLevel, final int newLevel) {
super(Type.PLAYER_LEVEL_CHANGE, player); super(player);
this.oldLevel = oldLevel; this.oldLevel = oldLevel;
this.newLevel = newLevel; this.newLevel = newLevel;
} }
@ -35,6 +36,7 @@ public class PlayerLevelChangeEvent extends PlayerEvent {
return newLevel; return newLevel;
} }
@Override
public HandlerList getHandlers() { public HandlerList getHandlers() {
return handlers; return handlers;
} }

Einige Dateien werden nicht angezeigt, da zu viele Dateien in diesem Diff geändert wurden Mehr anzeigen