Deprecation cleanup.

By: Erik Broes <erikbroes@grum.nl>
This commit is contained in:
Bukkit/Spigot
2012-01-30 21:32:48 +01:00
parent fe4de0bb01
commit 75fd934339
165 changed files with 409 additions and 4280 deletions

View File

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

View File

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

View File

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

View File

@@ -13,9 +13,9 @@ import org.bukkit.inventory.ItemStack;
@SuppressWarnings("serial")
public class PlayerBucketEmptyEvent extends PlayerBucketEvent {
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

View File

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

View File

@@ -13,8 +13,9 @@ import org.bukkit.inventory.ItemStack;
@SuppressWarnings("serial")
public class PlayerBucketFillEvent extends PlayerBucketEvent {
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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -9,11 +9,11 @@ import org.bukkit.event.HandlerList;
@SuppressWarnings("serial")
public class PlayerItemHeldEvent extends PlayerEvent {
private static final HandlerList handlers = new HandlerList();
private int previous;
private int current;
private final int previous;
private 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.current = current;
}

View File

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

View File

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

View File

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

View File

@@ -1,230 +0,0 @@
package org.bukkit.event.player;
import org.bukkit.event.Listener;
/**
* Handles all events thrown in relation to a Player
*/
@Deprecated
public class PlayerListener implements Listener {
public PlayerListener() {}
/**
* Called when a player joins a server
*
* @param event Relevant event details
*/
public void onPlayerJoin(PlayerJoinEvent event) {}
/**
* Called when a player leaves a server
*
* @param event Relevant event details
*/
public void onPlayerQuit(PlayerQuitEvent event) {}
/**
* Called when a player gets kicked from the server
*
* @param event Relevant event details
*/
public void onPlayerKick(PlayerKickEvent event) {}
/**
* Called when a player sends a chat message
*
* @param event Relevant event details
*/
public void onPlayerChat(PlayerChatEvent event) {}
/**
* Called early in the command handling process. This event is only
* for very exceptional cases and you should not normally use it.
*
* @param event Relevant event details
*/
public void onPlayerCommandPreprocess(PlayerCommandPreprocessEvent event) {}
/**
* Called when a player attempts to move location in a world
*
* @param event Relevant event details
*/
public void onPlayerMove(PlayerMoveEvent event) {}
/**
* Called before a player gets a velocity vector sent, which will "push"
* the player in a certain direction
*
* @param event Relevant event details
*/
public void onPlayerVelocity(PlayerVelocityEvent event) {}
/**
* Called when a player attempts to teleport to a new location in a world
*
* @param event Relevant event details
*/
public void onPlayerTeleport(PlayerTeleportEvent event) {}
/**
* Called when a player respawns
*
* @param event Relevant event details
*/
public void onPlayerRespawn(PlayerRespawnEvent event) {}
/**
* Called when a player interacts with an object or air.
*
* @param event Relevant event details
*/
public void onPlayerInteract(PlayerInteractEvent event) {}
/**
* Called when a player right clicks an entity.
*
* @param event Relevant event details
*/
public void onPlayerInteractEntity(PlayerInteractEntityEvent event) {}
/**
* Called when a player attempts to log in to the server
*
* @param event Relevant event details
*/
public void onPlayerLogin(PlayerLoginEvent event) {}
/**
* Called when a player has just been authenticated
*
* @param event Relevant event details
*/
public void onPlayerPreLogin(PlayerPreLoginEvent event) {}
/**
* Called when a player throws an egg and it might hatch
*
* @param event Relevant event details
*/
public void onPlayerEggThrow(PlayerEggThrowEvent event) {}
/**
* Called when a player plays an animation, such as an arm swing
*
* @param event Relevant event details
*/
public void onPlayerAnimation(PlayerAnimationEvent event) {}
/**
* Called when a player opens an inventory
*
* @param event Relevant event details
*/
public void onInventoryOpen(PlayerInventoryEvent event) {}
/**
* Called when a player changes their held item
*
* @param event Relevant event details
*/
public void onItemHeldChange(PlayerItemHeldEvent event) {}
/**
* Called when a player drops an item from their inventory
*
* @param event Relevant event details
*/
public void onPlayerDropItem(PlayerDropItemEvent event) {}
/**
* Called when a player picks an item up off the ground
*
* @param event Relevant event details
*/
public void onPlayerPickupItem(PlayerPickupItemEvent event) {}
/**
* Called when a player toggles sneak mode
*
* @param event Relevant event details
*/
public void onPlayerToggleSneak(PlayerToggleSneakEvent event) {}
/**
* Called when a player toggles sprint mode
*
* @param event Relevant event details
*/
public void onPlayerToggleSprint(PlayerToggleSprintEvent event) {}
/**
* Called when a player fills a bucket
*
* @param event Relevant event details
*/
public void onPlayerBucketFill(PlayerBucketFillEvent event) {}
/**
* Called when a player empties a bucket
*
* @param event Relevant event details
*/
public void onPlayerBucketEmpty(PlayerBucketEmptyEvent event) {}
/**
* Called when a player enters a bed
*
* @param event Relevant event details
*/
public void onPlayerBedEnter(PlayerBedEnterEvent event) {}
/**
* Called when a player leaves a bed
*
* @param event Relevant event details
*/
public void onPlayerBedLeave(PlayerBedLeaveEvent event) {}
/**
* Called when a player is teleporting in a portal (after the animation)
*
* @param event Relevant event details
*/
public void onPlayerPortal(PlayerPortalEvent event) {}
/**
* Called when a player is fishing
*
* @param event Relevant event details
*/
public void onPlayerFish(PlayerFishEvent event) {}
/**
* Called when a player's game mode is changed
*
* @param event Relevant event details
*/
public void onPlayerGameModeChange(PlayerGameModeChangeEvent event) {}
/**
* Called after a player changes to a new world
*
* @param event Relevant event details
*/
public void onPlayerChangedWorld(PlayerChangedWorldEvent event) {}
/**
* Called when a players level changes
*
* @param event Relevant event details
*/
public void onPlayerLevelChange(PlayerLevelChangeEvent event) {}
/**
* Called when a players experience changes naturally
*
* @param event Relevant event details
*/
public void onPlayerExpChange(PlayerExpChangeEvent event) {}
}

View File

@@ -9,17 +9,15 @@ import org.bukkit.event.HandlerList;
@SuppressWarnings("serial")
public class PlayerLoginEvent extends PlayerEvent {
private static final HandlerList handlers = new HandlerList();
private Result result;
private String message;
private Result result = Result.ALLOWED;
private String message = "";
public PlayerLoginEvent(final Player player) {
super(Type.PLAYER_LOGIN, player);
this.result = Result.ALLOWED;
this.message = "";
super(player);
}
public PlayerLoginEvent(final Type type, final Player player, final Result result, final String message) {
super(type, player);
public PlayerLoginEvent(final Player player, final Result result, final String message) {
this(player);
this.result = result;
this.message = message;
}

View File

@@ -3,7 +3,6 @@ package org.bukkit.event.player;
import org.bukkit.Location;
import org.bukkit.entity.Player;
import org.bukkit.event.Cancellable;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
/**
@@ -17,13 +16,7 @@ public class PlayerMoveEvent extends PlayerEvent implements Cancellable {
private Location to;
public PlayerMoveEvent(final Player player, final Location from, final Location to) {
super(Type.PLAYER_MOVE, player);
this.from = from;
this.to = to;
}
PlayerMoveEvent(final Event.Type type, final Player player, final Location from, final Location to) {
super(type, player);
super(player);
this.from = from;
this.to = to;
}

View File

@@ -13,10 +13,10 @@ public class PlayerPickupItemEvent extends PlayerEvent implements Cancellable {
private static final HandlerList handlers = new HandlerList();
private final Item item;
private boolean cancel = false;
private int remaining;
private final int remaining;
public PlayerPickupItemEvent(final Player player, final Item item, int remaining) {
super(Type.PLAYER_PICKUP_ITEM, player);
public PlayerPickupItemEvent(final Player player, final Item item, final int remaining) {
super(player);
this.item = item;
this.remaining = remaining;
}

View File

@@ -17,8 +17,8 @@ public class PlayerPortalEvent extends PlayerTeleportEvent {
protected Player player;
protected TravelAgent travelAgent;
public PlayerPortalEvent(Player player, Location from, Location to, TravelAgent pta) {
super(Type.PLAYER_PORTAL, player, from, to);
public PlayerPortalEvent(final Player player, final Location from, final Location to, final TravelAgent pta) {
super(player, from, to);
this.travelAgent = pta;
}

View File

@@ -12,11 +12,10 @@ public class PlayerPreLoginEvent extends Event {
private static final HandlerList handlers = new HandlerList();
private Result result;
private String message;
private String name;
private InetAddress ipAddress;
private final String name;
private final InetAddress ipAddress;
public PlayerPreLoginEvent(String name, InetAddress ipAddress) {
super(Type.PLAYER_PRELOGIN);
public PlayerPreLoginEvent(final String name, final InetAddress ipAddress) {
this.result = Result.ALLOWED;
this.message = "";
this.name = name;

View File

@@ -12,8 +12,8 @@ public class PlayerQuitEvent extends PlayerEvent {
private String quitMessage;
public PlayerQuitEvent(Player who, String quitMessage) {
super(Type.PLAYER_QUIT, who);
public PlayerQuitEvent(final Player who, final String quitMessage) {
super(who);
this.quitMessage = quitMessage;
}

View File

@@ -8,10 +8,10 @@ import org.bukkit.event.HandlerList;
public class PlayerRespawnEvent extends PlayerEvent {
private static final HandlerList handlers = new HandlerList();
private Location respawnLocation;
private boolean isBedSpawn;
private final boolean isBedSpawn;
public PlayerRespawnEvent(Player respawnPlayer, Location respawnLocation, boolean isBedSpawn) {
super(Type.PLAYER_RESPAWN, respawnPlayer);
public PlayerRespawnEvent(final Player respawnPlayer, final Location respawnLocation, final boolean isBedSpawn) {
super(respawnPlayer);
this.respawnLocation = respawnLocation;
this.isBedSpawn = isBedSpawn;
}

View File

@@ -12,10 +12,10 @@ import org.bukkit.event.HandlerList;
public class PlayerShearEntityEvent extends PlayerEvent implements Cancellable {
private static final HandlerList handlers = new HandlerList();
private boolean cancel;
private Entity what;
private final Entity what;
public PlayerShearEntityEvent(Player who, Entity what) {
super(Type.PLAYER_SHEAR_ENTITY, who);
public PlayerShearEntityEvent(final Player who, final Entity what) {
super(who);
this.cancel = false;
this.what = what;
}

View File

@@ -2,7 +2,6 @@ package org.bukkit.event.player;
import org.bukkit.Location;
import org.bukkit.entity.Player;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
/**
@@ -13,22 +12,12 @@ public class PlayerTeleportEvent extends PlayerMoveEvent {
private static final HandlerList handlers = new HandlerList();
private TeleportCause cause = TeleportCause.UNKNOWN;
public PlayerTeleportEvent(Player player, Location from, Location to) {
super(Type.PLAYER_TELEPORT, player, from, to);
public PlayerTeleportEvent(final Player player, final Location from, final Location to) {
super(player, from, to);
}
public PlayerTeleportEvent(Player player, Location from, Location to, TeleportCause cause) {
super(Type.PLAYER_TELEPORT, player, from, to);
this.cause = cause;
}
public PlayerTeleportEvent(final Event.Type type, Player player, Location from, Location to) {
super(type, player, from, to);
}
public PlayerTeleportEvent(final Event.Type type, Player player, Location from, Location to, TeleportCause cause) {
super(type, player, from, to);
public PlayerTeleportEvent(final Player player, final Location from, final Location to, final TeleportCause cause) {
this(player, from, to);
this.cause = cause;
}

View File

@@ -10,11 +10,11 @@ import org.bukkit.event.HandlerList;
@SuppressWarnings("serial")
public class PlayerToggleSneakEvent extends PlayerEvent implements Cancellable {
private static final HandlerList handlers = new HandlerList();
private boolean isSneaking;
private final boolean isSneaking;
private boolean cancel = false;
public PlayerToggleSneakEvent(final Player player, boolean isSneaking) {
super(Type.PLAYER_TOGGLE_SNEAK, player);
public PlayerToggleSneakEvent(final Player player, final boolean isSneaking) {
super(player);
this.isSneaking = isSneaking;
}

View File

@@ -10,11 +10,11 @@ import org.bukkit.event.HandlerList;
@SuppressWarnings("serial")
public class PlayerToggleSprintEvent extends PlayerEvent implements Cancellable {
private static final HandlerList handlers = new HandlerList();
private boolean isSprinting;
private final boolean isSprinting;
private boolean cancel = false;
public PlayerToggleSprintEvent(final Player player, boolean isSprinting) {
super(Type.PLAYER_TOGGLE_SPRINT, player);
public PlayerToggleSprintEvent(final Player player, final boolean isSprinting) {
super(player);
this.isSprinting = isSprinting;
}

View File

@@ -2,7 +2,6 @@ package org.bukkit.event.player;
import org.bukkit.entity.Player;
import org.bukkit.event.Cancellable;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
import org.bukkit.util.Vector;
@@ -17,12 +16,7 @@ public class PlayerVelocityEvent extends PlayerEvent implements Cancellable {
private Vector velocity;
public PlayerVelocityEvent(final Player player, final Vector velocity) {
super(Type.PLAYER_VELOCITY, player);
this.velocity = velocity;
}
PlayerVelocityEvent(final Event.Type type, final Player player, final Vector velocity) {
super(type, player);
super(player);
this.velocity = velocity;
}