Some more backwards incompatible changes (minor though), also a ton of small cleanup.

onPluginEnable(PluginEvent event)   -> onPluginEnable(PluginEnableEvent event)
onPluginDisable(PluginEvent event)  -> onPluginDisable(PluginDisableEvent event)
onVehicleUpdate(VehicleEvent event) -> onVehicleUpdate(VehicleUpdateEvent event)
onWorldSave(WorldEvent event)       -> onWorldSave(WorldSaveEvent event)
onWorldLoad(WorldEvent event)       -> onWorldLoad(WorldLoadEvent event)

By: Erik Broes <erikbroes@grum.nl>
This commit is contained in:
Bukkit/Spigot
2011-03-26 22:21:20 +01:00
parent f7b70eb07b
commit 020da84ad2
60 changed files with 312 additions and 376 deletions

View File

@@ -15,8 +15,8 @@ public class PlayerAnimationEvent extends PlayerEvent {
* @param type The event type
* @param player The player instance
*/
public PlayerAnimationEvent(final Type type, final Player player) {
super(type, player);
public PlayerAnimationEvent(final Player player) {
super(Type.PLAYER_ANIMATION, player);
// Only supported animation type for now:
animationType = PlayerAnimationType.ARM_SWING;
@@ -27,9 +27,8 @@ public class PlayerAnimationEvent extends PlayerEvent {
*
* @returns the animation type
*/
public PlayerAnimationType getAnimationType()
{
return animationType;
public PlayerAnimationType getAnimationType() {
return animationType;
}
}

View File

@@ -5,7 +5,6 @@ import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.entity.Player;
import org.bukkit.event.Cancellable;
import org.bukkit.event.Event.Type;
import org.bukkit.inventory.ItemStack;
public class PlayerBucketEmptyEvent extends PlayerEvent implements Cancellable {

View File

@@ -16,8 +16,8 @@ public class PlayerChatEvent extends PlayerEvent implements Cancellable {
private String format = "<%1$s> %2$s";
private final Set<Player> recipients;
public PlayerChatEvent(final Type type, final Player player, final String message) {
super(type, player);
public PlayerChatEvent(final Player player, final String message) {
super(Type.PLAYER_CHAT, player);
this.message = message;
recipients = new HashSet<Player>(Arrays.asList(player.getServer().getOnlinePlayers()));

View File

@@ -3,7 +3,6 @@ package org.bukkit.event.player;
import org.bukkit.entity.Item;
import org.bukkit.entity.Player;
import org.bukkit.event.Cancellable;
import org.bukkit.event.Event;
/**
* Thrown when a player drops an item from their inventory
@@ -13,7 +12,7 @@ public class PlayerDropItemEvent extends PlayerEvent implements Cancellable {
private boolean cancel = false;
public PlayerDropItemEvent(final Player player, final Item drop) {
super(Event.Type.PLAYER_DROP_ITEM, player);
super(Type.PLAYER_DROP_ITEM, player);
this.drop = drop;
}

View File

@@ -4,7 +4,6 @@ import org.bukkit.entity.CreatureType;
import org.bukkit.entity.Egg;
import org.bukkit.entity.Player;
/**
*
* @author tkelly
@@ -16,8 +15,8 @@ public class PlayerEggThrowEvent extends PlayerEvent {
private CreatureType hatchType;
private byte numHatches;
public PlayerEggThrowEvent(Type type, Player player, Egg egg, boolean hatching, byte numHatches, CreatureType hatchType) {
super(type, player);
public PlayerEggThrowEvent(Player player, Egg egg, boolean hatching, byte numHatches, CreatureType hatchType) {
super(Type.PLAYER_EGG_THROW, player);
this.egg = egg;
this.hatching = hatching;
this.numHatches = numHatches;

View File

@@ -6,7 +6,6 @@ import org.bukkit.inventory.ItemStack;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.event.Cancellable;
import org.bukkit.event.Event.Result;
import org.bukkit.event.block.Action;
/**

View File

@@ -10,8 +10,8 @@ import org.bukkit.inventory.Inventory;
public class PlayerInventoryEvent extends PlayerEvent {
protected Inventory inventory;
public PlayerInventoryEvent(final Type type, final Player player, final Inventory inventory) {
super(type, player);
public PlayerInventoryEvent(final Player player, final Inventory inventory) {
super(Type.PLAYER_INTERACT, player);
this.inventory = inventory;
}

View File

@@ -10,8 +10,8 @@ public class PlayerItemHeldEvent extends PlayerEvent {
private int previous;
private int current;
public PlayerItemHeldEvent(final Type type, final Player player, final int previous, final int current) {
super(type, player);
public PlayerItemHeldEvent(final Player player, final int previous, final int current) {
super(Type.PLAYER_ITEM_HELD, player);
this.previous = previous;
this.current = current;
}

View File

@@ -5,8 +5,8 @@ import org.bukkit.entity.Player;
public class PlayerJoinEvent extends PlayerEvent {
private String joinMessage;
public PlayerJoinEvent(Type eventType, Player playerJoined, String joinMessage) {
super(eventType, playerJoined);
public PlayerJoinEvent(Player playerJoined, String joinMessage) {
super(Type.PLAYER_JOIN, playerJoined);
this.joinMessage = joinMessage;
}

View File

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

View File

@@ -10,8 +10,8 @@ public class PlayerLoginEvent extends PlayerEvent {
private Result result;
private String message;
public PlayerLoginEvent(final Type type, final Player player) {
super(type, player);
public PlayerLoginEvent(final Player player) {
super(Type.PLAYER_LOGIN, player);
this.result = Result.ALLOWED;
this.message = "";
}

View File

@@ -4,7 +4,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;
/**
* Holds information for player movement and teleportation events
@@ -14,8 +13,8 @@ public class PlayerMoveEvent extends PlayerEvent implements Cancellable {
private Location from;
private Location to;
public PlayerMoveEvent(final Event.Type type, final Player player, final Location from, final Location to) {
super(type, player);
public PlayerMoveEvent(final Player player, final Location from, final Location to) {
super(Type.PLAYER_MOVE, player);
this.from = from;
this.to = to;
}

View File

@@ -4,7 +4,6 @@ package org.bukkit.event.player;
import org.bukkit.entity.Item;
import org.bukkit.entity.Player;
import org.bukkit.event.Cancellable;
import org.bukkit.event.Event;
/**
* Thrown when a player picks an item up from the ground
@@ -14,7 +13,7 @@ public class PlayerPickupItemEvent extends PlayerEvent implements Cancellable {
private boolean cancel = false;
public PlayerPickupItemEvent(final Player player, final Item item) {
super(Event.Type.PLAYER_PICKUP_ITEM, player);
super(Type.PLAYER_PICKUP_ITEM, player);
this.item = item;
}

View File

@@ -6,8 +6,8 @@ import org.bukkit.entity.Player;
public class PlayerRespawnEvent extends PlayerEvent {
private Location respawnLocation;
public PlayerRespawnEvent(Type type, Player respawnPlayer, Location respawnLocation) {
super(type, respawnPlayer);
public PlayerRespawnEvent(Player respawnPlayer, Location respawnLocation) {
super(Type.PLAYER_RESPAWN, respawnPlayer);
this.respawnLocation = respawnLocation;
}

View File

@@ -1,6 +1,5 @@
package org.bukkit.event.player;
import org.bukkit.entity.Player;
import org.bukkit.event.Cancellable;
@@ -11,10 +10,9 @@ import org.bukkit.event.Cancellable;
public class PlayerToggleSneakEvent extends PlayerEvent implements Cancellable{
private boolean cancel = false;
public PlayerToggleSneakEvent(final Type type, final Player player) {
super(type, player);
public PlayerToggleSneakEvent(final Player player) {
super(Type.PLAYER_TOGGLE_SNEAK, player);
}
/**
* Gets the cancellation state of this event. A cancelled event will not