更新
This commit is contained in:
@@ -6,51 +6,71 @@ import org.bukkit.event.Event;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
/**
|
||||
* The event called when a book is opened trough this Util
|
||||
*/
|
||||
public class CustomBookOpenEvent extends Event implements Cancellable {
|
||||
|
||||
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
private boolean cancelled;
|
||||
|
||||
/**
|
||||
* The player
|
||||
*/
|
||||
@Getter
|
||||
private final Player player;
|
||||
|
||||
/**
|
||||
* The hand used to open the book (the previous item will be restored after the opening)
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
private Hand hand;
|
||||
|
||||
/**
|
||||
* The actual book to be opened
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
private ItemStack book;
|
||||
|
||||
public Player getPlayer() {
|
||||
return player;
|
||||
}
|
||||
|
||||
public Hand getHand() {
|
||||
return hand;
|
||||
}
|
||||
|
||||
public ItemStack getBook() {
|
||||
return book;
|
||||
}
|
||||
|
||||
public void setHand(Hand hand) {
|
||||
this.hand = hand;
|
||||
}
|
||||
|
||||
public void setBook(ItemStack book) {
|
||||
this.book = book;
|
||||
}
|
||||
|
||||
public CustomBookOpenEvent(Player player, ItemStack book, boolean offHand) {
|
||||
this.player = player;
|
||||
this.book = book;
|
||||
this.hand = offHand ? Hand.OFF_HAND : Hand.MAIN_HAND;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCancelled() {
|
||||
return cancelled;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCancelled(boolean cancelled) {
|
||||
this.cancelled = cancelled;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
@@ -5,49 +5,47 @@ import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.bukkit.event.player.PlayerEvent;
|
||||
|
||||
public class DefaultEvent2 extends PlayerEvent
|
||||
{
|
||||
public class DefaultEvent2 extends PlayerEvent {
|
||||
|
||||
private static final HandlerList handlers;
|
||||
|
||||
|
||||
static {
|
||||
handlers = new HandlerList();
|
||||
}
|
||||
|
||||
|
||||
private DefaultEvent2(final Player who) {
|
||||
super(who);
|
||||
}
|
||||
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return DefaultEvent2.handlers;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
public HandlerList getHandlers() {
|
||||
return DefaultEvent2.handlers;
|
||||
}
|
||||
|
||||
public static class Pre extends DefaultEvent2 implements Cancellable
|
||||
{
|
||||
|
||||
public static class Pre extends DefaultEvent2 implements Cancellable {
|
||||
private boolean cancelled;
|
||||
|
||||
|
||||
public Pre(Player who) {
|
||||
super(who);
|
||||
this.cancelled = false;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean isCancelled() {
|
||||
public boolean isCancelled() {
|
||||
return this.cancelled;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void setCancelled(final boolean cancelled) {
|
||||
public void setCancelled(final boolean cancelled) {
|
||||
this.cancelled = cancelled;
|
||||
}
|
||||
}
|
||||
|
||||
public static class Post extends DefaultEvent2
|
||||
{
|
||||
|
||||
public static class Post extends DefaultEvent2 {
|
||||
public Post(Player who) {
|
||||
super(who);
|
||||
}
|
||||
|
||||
@@ -5,45 +5,37 @@ import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.Event;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
public class PlayerJumpEvent
|
||||
extends Event
|
||||
implements Cancellable
|
||||
{
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
private boolean isCancelled;
|
||||
private Player player;
|
||||
|
||||
public PlayerJumpEvent(boolean b, Player player)
|
||||
{
|
||||
this.isCancelled = false;
|
||||
this.player = player;
|
||||
}
|
||||
|
||||
public Player getPlayer()
|
||||
{
|
||||
return this.player;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCancelled()
|
||||
{
|
||||
return this.isCancelled;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCancelled(boolean e)
|
||||
{
|
||||
this.isCancelled = e;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers()
|
||||
{
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList()
|
||||
{
|
||||
return handlers;
|
||||
}
|
||||
public class PlayerJumpEvent extends Event implements Cancellable {
|
||||
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
private boolean isCancelled;
|
||||
private Player player;
|
||||
|
||||
public PlayerJumpEvent(boolean b, Player player) {
|
||||
this.isCancelled = false;
|
||||
this.player = player;
|
||||
}
|
||||
|
||||
public Player getPlayer() {
|
||||
return this.player;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCancelled() {
|
||||
return this.isCancelled;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCancelled(boolean e) {
|
||||
this.isCancelled = e;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,25 +5,25 @@ import org.bukkit.event.Event;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
public class PlayerLoadedEvent extends Event {
|
||||
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
private Player player;
|
||||
|
||||
public PlayerLoadedEvent(Player player) {
|
||||
super(true);
|
||||
this.player = player;
|
||||
}
|
||||
|
||||
public Player getPlayer() {
|
||||
return this.player;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
private Player player;
|
||||
|
||||
public PlayerLoadedEvent(Player player) {
|
||||
super(true);
|
||||
this.player = player;
|
||||
}
|
||||
|
||||
public Player getPlayer() {
|
||||
return this.player;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user