@@ -30,4 +30,4 @@ public class PlayerAnimationEvent extends PlayerEvent {
|
||||
public PlayerAnimationType getAnimationType() {
|
||||
return animationType;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,5 +4,5 @@ package org.bukkit.event.player;
|
||||
* Differet types of player animations
|
||||
*/
|
||||
public enum PlayerAnimationType {
|
||||
ARM_SWING
|
||||
ARM_SWING
|
||||
}
|
||||
|
||||
@@ -7,11 +7,11 @@ import org.bukkit.event.Cancellable;
|
||||
/**
|
||||
* This event is fired when the player is almost about to enter the bed.
|
||||
* It can be cancelled.
|
||||
*
|
||||
*
|
||||
* @author sk89q
|
||||
*/
|
||||
public class PlayerBedEnterEvent extends PlayerEvent implements Cancellable {
|
||||
|
||||
|
||||
private boolean cancel = false;
|
||||
private Block bed;
|
||||
|
||||
@@ -37,14 +37,13 @@ public class PlayerBedEnterEvent extends PlayerEvent implements Cancellable {
|
||||
public void setCancelled(boolean cancel) {
|
||||
this.cancel = cancel;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the bed block.
|
||||
*
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public Block getBed() {
|
||||
return bed;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -5,25 +5,24 @@ import org.bukkit.entity.Player;
|
||||
|
||||
/**
|
||||
* This event is fired when the player is leaving a bed.
|
||||
*
|
||||
*
|
||||
* @author sk89q
|
||||
*/
|
||||
public class PlayerBedLeaveEvent extends PlayerEvent {
|
||||
|
||||
|
||||
private Block bed;
|
||||
|
||||
public PlayerBedLeaveEvent(Player who, Block bed) {
|
||||
super(Type.PLAYER_BED_LEAVE, who);
|
||||
this.bed = bed;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the bed block.
|
||||
*
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public Block getBed() {
|
||||
return bed;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
package org.bukkit.event.player;
|
||||
|
||||
import java.util.Arrays;
|
||||
@@ -20,7 +19,7 @@ public class PlayerChatEvent extends PlayerEvent implements Cancellable {
|
||||
public PlayerChatEvent(final Player player, final String message) {
|
||||
this(Type.PLAYER_CHAT, player, message);
|
||||
}
|
||||
|
||||
|
||||
protected PlayerChatEvent(final Type type, final Player player, final String message) {
|
||||
super(type, player);
|
||||
recipients = new HashSet<Player>(Arrays.asList(player.getServer().getOnlinePlayers()));
|
||||
|
||||
@@ -70,7 +70,6 @@ public class PlayerEggThrowEvent extends PlayerEvent {
|
||||
this.hatchType = hatchType;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the number of mob hatches from the egg. By default the number
|
||||
* will be he number the server would've done
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
package org.bukkit.event.player;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@@ -83,14 +83,16 @@ public class PlayerInteractEvent extends PlayerEvent implements Cancellable {
|
||||
* @return Material the material of the item used
|
||||
*/
|
||||
public Material getMaterial() {
|
||||
if (!hasItem()) return Material.AIR;
|
||||
if (!hasItem()) {
|
||||
return Material.AIR;
|
||||
}
|
||||
|
||||
return item.getType();
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if this event involved a block
|
||||
*
|
||||
*
|
||||
* return boolean true if it did
|
||||
*/
|
||||
public boolean hasBlock() {
|
||||
@@ -99,7 +101,7 @@ public class PlayerInteractEvent extends PlayerEvent implements Cancellable {
|
||||
|
||||
/**
|
||||
* Check if this event involved an item
|
||||
*
|
||||
*
|
||||
* return boolean true if it did
|
||||
*/
|
||||
public boolean hasItem() {
|
||||
@@ -113,7 +115,9 @@ public class PlayerInteractEvent extends PlayerEvent implements Cancellable {
|
||||
* @return boolean true if the item in hand was a block
|
||||
*/
|
||||
public boolean isBlockInHand() {
|
||||
if (!hasItem()) return false;
|
||||
if (!hasItem()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return item.getType().isBlock();
|
||||
}
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
package org.bukkit.event.player;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
package org.bukkit.event.player;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
package org.bukkit.event.player;
|
||||
|
||||
import org.bukkit.event.Listener;
|
||||
@@ -8,8 +7,7 @@ import org.bukkit.plugin.AuthorNagException;
|
||||
* Handles all events thrown in relation to a Player
|
||||
*/
|
||||
public class PlayerListener implements Listener {
|
||||
public PlayerListener() {
|
||||
}
|
||||
public PlayerListener() {}
|
||||
|
||||
/**
|
||||
* Called when a player joins a server
|
||||
@@ -17,7 +15,7 @@ public class PlayerListener implements Listener {
|
||||
* @param event Relevant event details
|
||||
*/
|
||||
public void onPlayerJoin(PlayerJoinEvent event) {
|
||||
onPlayerJoin((PlayerEvent)event);
|
||||
onPlayerJoin((PlayerEvent) event);
|
||||
throw new AuthorNagException("onPlayerJoin has been replaced with a new signature, (PlayerJoinEvent)");
|
||||
}
|
||||
|
||||
@@ -27,7 +25,7 @@ public class PlayerListener implements Listener {
|
||||
* @param event Relevant event details
|
||||
*/
|
||||
public void onPlayerQuit(PlayerQuitEvent event) {
|
||||
onPlayerQuit((PlayerEvent)event);
|
||||
onPlayerQuit((PlayerEvent) event);
|
||||
throw new AuthorNagException("onPlayerQuit has been replaced with a new signature, (PlayerQuitEvent)");
|
||||
}
|
||||
|
||||
@@ -36,16 +34,14 @@ public class PlayerListener implements Listener {
|
||||
*
|
||||
* @param event Relevant event details
|
||||
*/
|
||||
public void onPlayerKick(PlayerKickEvent event) {
|
||||
}
|
||||
public void onPlayerKick(PlayerKickEvent event) {}
|
||||
|
||||
/**
|
||||
* Called when a player sends a chat message
|
||||
*
|
||||
* @param event Relevant event details
|
||||
*/
|
||||
public void onPlayerChat(PlayerChatEvent event) {
|
||||
}
|
||||
public void onPlayerChat(PlayerChatEvent event) {}
|
||||
|
||||
/**
|
||||
* Called early in the command handling process. This event is only
|
||||
@@ -54,7 +50,7 @@ public class PlayerListener implements Listener {
|
||||
* @param event Relevant event details
|
||||
*/
|
||||
public void onPlayerCommandPreprocess(PlayerCommandPreprocessEvent event) {
|
||||
onPlayerCommandPreprocess((PlayerChatEvent)event);
|
||||
onPlayerCommandPreprocess((PlayerChatEvent) event);
|
||||
throw new AuthorNagException("onPlayerCommandPreprocess has been replaced with a new signature, (PlayerCommandPreprocessEvent)");
|
||||
}
|
||||
|
||||
@@ -63,8 +59,7 @@ public class PlayerListener implements Listener {
|
||||
*
|
||||
* @param event Relevant event details
|
||||
*/
|
||||
public void onPlayerMove(PlayerMoveEvent event) {
|
||||
}
|
||||
public void onPlayerMove(PlayerMoveEvent event) {}
|
||||
|
||||
/**
|
||||
* Called when a player attempts to teleport to a new location in a world
|
||||
@@ -72,7 +67,7 @@ public class PlayerListener implements Listener {
|
||||
* @param event Relevant event details
|
||||
*/
|
||||
public void onPlayerTeleport(PlayerTeleportEvent event) {
|
||||
onPlayerTeleport((PlayerMoveEvent)event);
|
||||
onPlayerTeleport((PlayerMoveEvent) event);
|
||||
throw new AuthorNagException("onPlayerTeleport has been replaced with a new signature, (PlayerTeleportEvent)");
|
||||
}
|
||||
|
||||
@@ -81,128 +76,112 @@ public class PlayerListener implements Listener {
|
||||
*
|
||||
* @param event Relevant event details
|
||||
*/
|
||||
public void onPlayerRespawn(PlayerRespawnEvent event) {
|
||||
}
|
||||
public void onPlayerRespawn(PlayerRespawnEvent event) {}
|
||||
|
||||
/**
|
||||
* Called when a player interacts
|
||||
*
|
||||
* @param event Relevant event details
|
||||
*/
|
||||
public void onPlayerInteract(PlayerInteractEvent event) {
|
||||
}
|
||||
public void onPlayerInteract(PlayerInteractEvent event) {}
|
||||
|
||||
/**
|
||||
* Called when a player right clicks an entity.
|
||||
*
|
||||
* @param event Relevant event details
|
||||
*/
|
||||
public void onPlayerInteractEntity(PlayerInteractEntityEvent event) {
|
||||
}
|
||||
public void onPlayerInteractEntity(PlayerInteractEntityEvent event) {}
|
||||
|
||||
/**
|
||||
* Called when a player attempts to log in to the server
|
||||
*
|
||||
* @param event Relevant event details
|
||||
*/
|
||||
public void onPlayerLogin(PlayerLoginEvent event) {
|
||||
}
|
||||
public void onPlayerLogin(PlayerLoginEvent event) {}
|
||||
|
||||
/**
|
||||
* Called when a player has just been authenticated
|
||||
*
|
||||
* @param event Relevant event details
|
||||
*/
|
||||
public void onPlayerPreLogin(PlayerPreLoginEvent event) {
|
||||
}
|
||||
public void onPlayerPreLogin(PlayerPreLoginEvent event) {}
|
||||
|
||||
/**
|
||||
* Called when a player throws an egg and it might hatch
|
||||
*
|
||||
* @param event Relevant event details
|
||||
*/
|
||||
public void onPlayerEggThrow(PlayerEggThrowEvent event) {
|
||||
}
|
||||
public void onPlayerEggThrow(PlayerEggThrowEvent event) {}
|
||||
|
||||
/**
|
||||
* Called when a player plays an animation, such as an arm swing
|
||||
*
|
||||
* @param event Relevant event details
|
||||
*/
|
||||
public void onPlayerAnimation(PlayerAnimationEvent event) {
|
||||
}
|
||||
public void onPlayerAnimation(PlayerAnimationEvent event) {}
|
||||
|
||||
/**
|
||||
* Called when a player opens an inventory
|
||||
*
|
||||
* @param event Relevant event details
|
||||
*/
|
||||
public void onInventoryOpen(PlayerInventoryEvent event) {
|
||||
}
|
||||
public void onInventoryOpen(PlayerInventoryEvent event) {}
|
||||
|
||||
/**
|
||||
* Called when a player changes their held item
|
||||
*
|
||||
* @param event Relevant event details
|
||||
*/
|
||||
public void onItemHeldChange(PlayerItemHeldEvent event) {
|
||||
}
|
||||
public void onItemHeldChange(PlayerItemHeldEvent event) {}
|
||||
|
||||
/**
|
||||
* Called when a player drops an item from their inventory
|
||||
*
|
||||
* @param event Relevant event details
|
||||
*/
|
||||
public void onPlayerDropItem(PlayerDropItemEvent event) {
|
||||
}
|
||||
public void onPlayerDropItem(PlayerDropItemEvent event) {}
|
||||
|
||||
/**
|
||||
* Called when a player picks an item up off the ground
|
||||
*
|
||||
* @param event Relevant event details
|
||||
*/
|
||||
public void onPlayerPickupItem(PlayerPickupItemEvent event) {
|
||||
}
|
||||
public void onPlayerPickupItem(PlayerPickupItemEvent event) {}
|
||||
|
||||
/**
|
||||
* Called when a player toggles sneak mode
|
||||
*
|
||||
* @param event Relevant event details
|
||||
*/
|
||||
public void onPlayerToggleSneak(PlayerToggleSneakEvent event) {
|
||||
}
|
||||
public void onPlayerToggleSneak(PlayerToggleSneakEvent event) {}
|
||||
|
||||
/**
|
||||
* Called when a player fills a bucket
|
||||
*
|
||||
* @param event Relevant event details
|
||||
*/
|
||||
public void onPlayerBucketFill(PlayerBucketFillEvent event) {
|
||||
}
|
||||
public void onPlayerBucketFill(PlayerBucketFillEvent event) {}
|
||||
|
||||
/**
|
||||
* Called when a player empties a bucket
|
||||
*
|
||||
* @param event Relevant event details
|
||||
*/
|
||||
public void onPlayerBucketEmpty(PlayerBucketEmptyEvent event) {
|
||||
}
|
||||
public void onPlayerBucketEmpty(PlayerBucketEmptyEvent event) {}
|
||||
|
||||
/**
|
||||
* Called when a player enters a bed
|
||||
*
|
||||
* @param event Relevant event details
|
||||
*/
|
||||
public void onPlayerBedEnter(PlayerBedEnterEvent event) {
|
||||
}
|
||||
public void onPlayerBedEnter(PlayerBedEnterEvent event) {}
|
||||
|
||||
/**
|
||||
* Called when a player leaves a bed
|
||||
*
|
||||
* @param event Relevant event details
|
||||
*/
|
||||
public void onPlayerBedLeave(PlayerBedLeaveEvent event) {
|
||||
}
|
||||
public void onPlayerBedLeave(PlayerBedLeaveEvent event) {}
|
||||
|
||||
// TODO: Remove after RB
|
||||
@Deprecated public void onPlayerQuit(PlayerEvent event) {}
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
package org.bukkit.event.player;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
@@ -81,26 +80,23 @@ public class PlayerLoginEvent extends PlayerEvent {
|
||||
* Basic kick reasons for communicating to plugins
|
||||
*/
|
||||
public enum Result {
|
||||
|
||||
/**
|
||||
* The player is allowed to log in
|
||||
*/
|
||||
ALLOWED,
|
||||
|
||||
/**
|
||||
* The player is not allowed to log in, due to the server being full
|
||||
*/
|
||||
KICK_FULL,
|
||||
|
||||
/**
|
||||
* The player is not allowed to log in, due to them being banned
|
||||
*/
|
||||
KICK_BANNED,
|
||||
|
||||
/**
|
||||
* The player is not allowed to log in, due to them not being on the white list
|
||||
*/
|
||||
KICK_WHITELIST,
|
||||
|
||||
/**
|
||||
* The player is not allowed to log in, for reasons undefined
|
||||
*/
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
package org.bukkit.event.player;
|
||||
|
||||
import org.bukkit.Location;
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
package org.bukkit.event.player;
|
||||
|
||||
import org.bukkit.entity.Item;
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
package org.bukkit.event.player;
|
||||
|
||||
import java.net.InetAddress;
|
||||
@@ -75,19 +74,19 @@ public class PlayerPreLoginEvent extends Event {
|
||||
this.result = result;
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the player name.
|
||||
*
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the player IP address.
|
||||
*
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public InetAddress getAddress() {
|
||||
@@ -98,26 +97,23 @@ public class PlayerPreLoginEvent extends Event {
|
||||
* Basic kick reasons for communicating to plugins
|
||||
*/
|
||||
public enum Result {
|
||||
|
||||
/**
|
||||
* The player is allowed to log in
|
||||
*/
|
||||
ALLOWED,
|
||||
|
||||
/**
|
||||
* The player is not allowed to log in, due to the server being full
|
||||
*/
|
||||
KICK_FULL,
|
||||
|
||||
/**
|
||||
* The player is not allowed to log in, due to them being banned
|
||||
*/
|
||||
KICK_BANNED,
|
||||
|
||||
/**
|
||||
* The player is not allowed to log in, due to them not being on the white list
|
||||
*/
|
||||
KICK_WHITELIST,
|
||||
|
||||
/**
|
||||
* The player is not allowed to log in, for reasons undefined
|
||||
*/
|
||||
|
||||
@@ -28,5 +28,4 @@ public class PlayerQuitEvent extends PlayerEvent {
|
||||
public void setQuitMessage(String quitMessage) {
|
||||
this.quitMessage = quitMessage;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ import org.bukkit.event.Cancellable;
|
||||
*
|
||||
* @author azi
|
||||
*/
|
||||
public class PlayerToggleSneakEvent extends PlayerEvent implements Cancellable{
|
||||
public class PlayerToggleSneakEvent extends PlayerEvent implements Cancellable {
|
||||
private boolean cancel = false;
|
||||
|
||||
public PlayerToggleSneakEvent(final Player player) {
|
||||
@@ -24,7 +24,6 @@ public class PlayerToggleSneakEvent extends PlayerEvent implements Cancellable{
|
||||
return cancel;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets the cancellation state of this event. A cancelled event will not
|
||||
* be executed in the server, but will still pass to other plugins
|
||||
|
||||
Reference in New Issue
Block a user