@@ -1,52 +1,52 @@
|
||||
package org.bukkit.event.player;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
public class PlayerBucketEmptyEvent extends PlayerEvent implements Cancellable {
|
||||
ItemStack itemStack;
|
||||
boolean cancelled = false;
|
||||
Block blockClicked;
|
||||
BlockFace blockFace;
|
||||
Material bucket;
|
||||
|
||||
public PlayerBucketEmptyEvent(Player who, Block blockClicked, BlockFace blockFace, Material bucket, ItemStack itemInHand) {
|
||||
super(Type.PLAYER_BUCKET_EMPTY, who);
|
||||
this.blockClicked = blockClicked;
|
||||
this.blockFace = blockFace;
|
||||
this.itemStack = itemInHand;
|
||||
this.bucket = bucket;
|
||||
}
|
||||
|
||||
public Material getBucket() {
|
||||
return bucket;
|
||||
}
|
||||
|
||||
public ItemStack getItemStack() {
|
||||
return itemStack;
|
||||
}
|
||||
|
||||
public Block getBlockClicked() {
|
||||
return blockClicked;
|
||||
}
|
||||
|
||||
public BlockFace getBlockFace() {
|
||||
return blockFace;
|
||||
}
|
||||
|
||||
public void setItemStack(ItemStack itemStack) {
|
||||
this.itemStack = itemStack;
|
||||
}
|
||||
|
||||
public boolean isCancelled() {
|
||||
return cancelled;
|
||||
}
|
||||
|
||||
public void setCancelled(boolean cancel) {
|
||||
this.cancelled = cancel;
|
||||
}
|
||||
}
|
||||
package org.bukkit.event.player;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
public class PlayerBucketEmptyEvent extends PlayerEvent implements Cancellable {
|
||||
ItemStack itemStack;
|
||||
boolean cancelled = false;
|
||||
Block blockClicked;
|
||||
BlockFace blockFace;
|
||||
Material bucket;
|
||||
|
||||
public PlayerBucketEmptyEvent(Player who, Block blockClicked, BlockFace blockFace, Material bucket, ItemStack itemInHand) {
|
||||
super(Type.PLAYER_BUCKET_EMPTY, who);
|
||||
this.blockClicked = blockClicked;
|
||||
this.blockFace = blockFace;
|
||||
this.itemStack = itemInHand;
|
||||
this.bucket = bucket;
|
||||
}
|
||||
|
||||
public Material getBucket() {
|
||||
return bucket;
|
||||
}
|
||||
|
||||
public ItemStack getItemStack() {
|
||||
return itemStack;
|
||||
}
|
||||
|
||||
public Block getBlockClicked() {
|
||||
return blockClicked;
|
||||
}
|
||||
|
||||
public BlockFace getBlockFace() {
|
||||
return blockFace;
|
||||
}
|
||||
|
||||
public void setItemStack(ItemStack itemStack) {
|
||||
this.itemStack = itemStack;
|
||||
}
|
||||
|
||||
public boolean isCancelled() {
|
||||
return cancelled;
|
||||
}
|
||||
|
||||
public void setCancelled(boolean cancel) {
|
||||
this.cancelled = cancel;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
package org.bukkit.event.player;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class PlayerCommandPreprocessEvent extends PlayerChatEvent {
|
||||
public PlayerCommandPreprocessEvent(Player player, String message) {
|
||||
super(player, message);
|
||||
}
|
||||
}
|
||||
package org.bukkit.event.player;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class PlayerCommandPreprocessEvent extends PlayerChatEvent {
|
||||
public PlayerCommandPreprocessEvent(Player player, String message) {
|
||||
super(player, message);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,104 +1,104 @@
|
||||
|
||||
package org.bukkit.event.player;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
/**
|
||||
* Stores details for players attempting to log in
|
||||
*/
|
||||
public class PlayerLoginEvent extends PlayerEvent {
|
||||
private Result result;
|
||||
private String message;
|
||||
|
||||
public PlayerLoginEvent(final Player player) {
|
||||
super(Type.PLAYER_LOGIN, player);
|
||||
this.result = Result.ALLOWED;
|
||||
this.message = "";
|
||||
}
|
||||
|
||||
public PlayerLoginEvent(final Type type, final Player player, final Result result, final String message) {
|
||||
super(type, player);
|
||||
this.result = result;
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the current result of the login, as an enum
|
||||
*
|
||||
* @return Current Result of the login
|
||||
*/
|
||||
public Result getResult() {
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the new result of the login, as an enum
|
||||
*
|
||||
* @param result New result to set
|
||||
*/
|
||||
public void setResult(final Result result) {
|
||||
this.result = result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the current kick message that will be used if getResult() != Result.ALLOWED
|
||||
*
|
||||
* @return Current kick message
|
||||
*/
|
||||
public String getKickMessage() {
|
||||
return message;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the kick message to display if getResult() != Result.ALLOWED
|
||||
*
|
||||
* @param message New kick message
|
||||
*/
|
||||
public void setKickMessage(final String message) {
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
/**
|
||||
* Allows the player to log in
|
||||
*/
|
||||
public void allow() {
|
||||
result = Result.ALLOWED;
|
||||
message = "";
|
||||
}
|
||||
|
||||
/**
|
||||
* Disallows the player from logging in, with the given reason
|
||||
*
|
||||
* @param result New result for disallowing the player
|
||||
* @param message Kick message to display to the user
|
||||
*/
|
||||
public void disallow(final Result result, final String message) {
|
||||
this.result = result;
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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, for reasons undefined
|
||||
*/
|
||||
KICK_OTHER
|
||||
}
|
||||
}
|
||||
|
||||
package org.bukkit.event.player;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
/**
|
||||
* Stores details for players attempting to log in
|
||||
*/
|
||||
public class PlayerLoginEvent extends PlayerEvent {
|
||||
private Result result;
|
||||
private String message;
|
||||
|
||||
public PlayerLoginEvent(final Player player) {
|
||||
super(Type.PLAYER_LOGIN, player);
|
||||
this.result = Result.ALLOWED;
|
||||
this.message = "";
|
||||
}
|
||||
|
||||
public PlayerLoginEvent(final Type type, final Player player, final Result result, final String message) {
|
||||
super(type, player);
|
||||
this.result = result;
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the current result of the login, as an enum
|
||||
*
|
||||
* @return Current Result of the login
|
||||
*/
|
||||
public Result getResult() {
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the new result of the login, as an enum
|
||||
*
|
||||
* @param result New result to set
|
||||
*/
|
||||
public void setResult(final Result result) {
|
||||
this.result = result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the current kick message that will be used if getResult() != Result.ALLOWED
|
||||
*
|
||||
* @return Current kick message
|
||||
*/
|
||||
public String getKickMessage() {
|
||||
return message;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the kick message to display if getResult() != Result.ALLOWED
|
||||
*
|
||||
* @param message New kick message
|
||||
*/
|
||||
public void setKickMessage(final String message) {
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
/**
|
||||
* Allows the player to log in
|
||||
*/
|
||||
public void allow() {
|
||||
result = Result.ALLOWED;
|
||||
message = "";
|
||||
}
|
||||
|
||||
/**
|
||||
* Disallows the player from logging in, with the given reason
|
||||
*
|
||||
* @param result New result for disallowing the player
|
||||
* @param message Kick message to display to the user
|
||||
*/
|
||||
public void disallow(final Result result, final String message) {
|
||||
this.result = result;
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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, for reasons undefined
|
||||
*/
|
||||
KICK_OTHER
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,85 +1,85 @@
|
||||
|
||||
package org.bukkit.event.player;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Cancellable;
|
||||
|
||||
/**
|
||||
* Holds information for player movement and teleportation events
|
||||
*/
|
||||
public class PlayerMoveEvent extends PlayerEvent implements Cancellable {
|
||||
private boolean cancel = false;
|
||||
private Location from;
|
||||
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;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the cancellation state of this event. A cancelled event will not
|
||||
* be executed in the server, but will still pass to other plugins
|
||||
*
|
||||
* If a move or teleport event is cancelled, the player will be moved or
|
||||
* teleported back to the Location as defined by getFrom(). This will not
|
||||
* fire an event
|
||||
*
|
||||
* @return true if this event is cancelled
|
||||
*/
|
||||
public boolean isCancelled() {
|
||||
return cancel;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the cancellation state of this event. A cancelled event will not
|
||||
* be executed in the server, but will still pass to other plugins
|
||||
*
|
||||
* If a move or teleport event is cancelled, the player will be moved or
|
||||
* teleported back to the Location as defined by getFrom(). This will not
|
||||
* fire an event
|
||||
*
|
||||
* @param cancel true if you wish to cancel this event
|
||||
*/
|
||||
public void setCancelled(boolean cancel) {
|
||||
this.cancel = cancel;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the location this player moved from
|
||||
*
|
||||
* @return Location the player moved from
|
||||
*/
|
||||
public Location getFrom() {
|
||||
return from;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the location to mark as where the player moved from
|
||||
*
|
||||
* @param from New location to mark as the players previous location
|
||||
*/
|
||||
public void setFrom(Location from) {
|
||||
this.from = from;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the location this player moved to
|
||||
*
|
||||
* @return Location the player moved to
|
||||
*/
|
||||
public Location getTo() {
|
||||
return to;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the location that this player will move to
|
||||
*
|
||||
* @param to New Location this player will move to
|
||||
*/
|
||||
public void setTo(Location to) {
|
||||
this.to = to;
|
||||
}
|
||||
}
|
||||
|
||||
package org.bukkit.event.player;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Cancellable;
|
||||
|
||||
/**
|
||||
* Holds information for player movement and teleportation events
|
||||
*/
|
||||
public class PlayerMoveEvent extends PlayerEvent implements Cancellable {
|
||||
private boolean cancel = false;
|
||||
private Location from;
|
||||
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;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the cancellation state of this event. A cancelled event will not
|
||||
* be executed in the server, but will still pass to other plugins
|
||||
*
|
||||
* If a move or teleport event is cancelled, the player will be moved or
|
||||
* teleported back to the Location as defined by getFrom(). This will not
|
||||
* fire an event
|
||||
*
|
||||
* @return true if this event is cancelled
|
||||
*/
|
||||
public boolean isCancelled() {
|
||||
return cancel;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the cancellation state of this event. A cancelled event will not
|
||||
* be executed in the server, but will still pass to other plugins
|
||||
*
|
||||
* If a move or teleport event is cancelled, the player will be moved or
|
||||
* teleported back to the Location as defined by getFrom(). This will not
|
||||
* fire an event
|
||||
*
|
||||
* @param cancel true if you wish to cancel this event
|
||||
*/
|
||||
public void setCancelled(boolean cancel) {
|
||||
this.cancel = cancel;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the location this player moved from
|
||||
*
|
||||
* @return Location the player moved from
|
||||
*/
|
||||
public Location getFrom() {
|
||||
return from;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the location to mark as where the player moved from
|
||||
*
|
||||
* @param from New location to mark as the players previous location
|
||||
*/
|
||||
public void setFrom(Location from) {
|
||||
this.from = from;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the location this player moved to
|
||||
*
|
||||
* @return Location the player moved to
|
||||
*/
|
||||
public Location getTo() {
|
||||
return to;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the location that this player will move to
|
||||
*
|
||||
* @param to New Location this player will move to
|
||||
*/
|
||||
public void setTo(Location to) {
|
||||
this.to = to;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
package org.bukkit.event.player;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class PlayerQuitEvent extends PlayerEvent {
|
||||
public PlayerQuitEvent(Player who) {
|
||||
super(Type.PLAYER_QUIT, who);
|
||||
}
|
||||
}
|
||||
package org.bukkit.event.player;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class PlayerQuitEvent extends PlayerEvent {
|
||||
public PlayerQuitEvent(Player who) {
|
||||
super(Type.PLAYER_QUIT, who);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
package org.bukkit.event.player;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class PlayerTeleportEvent extends PlayerMoveEvent {
|
||||
public PlayerTeleportEvent(Player player, Location from, Location to) {
|
||||
super(player, from, to);
|
||||
}
|
||||
}
|
||||
package org.bukkit.event.player;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class PlayerTeleportEvent extends PlayerMoveEvent {
|
||||
public PlayerTeleportEvent(Player player, Location from, Location to) {
|
||||
super(player, from, to);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user