001 package org.bukkit.event.player; 002 003 import org.bukkit.block.Block; 004 import org.bukkit.entity.Player; 005 import org.bukkit.event.Cancellable; 006 import org.bukkit.event.HandlerList; 007 008 /** 009 * This event is fired when the player is almost about to enter the bed. 010 */ 011 public class PlayerBedEnterEvent extends PlayerEvent implements Cancellable { 012 private static final HandlerList handlers = new HandlerList(); 013 private boolean cancel = false; 014 private final Block bed; 015 016 public PlayerBedEnterEvent(final Player who, final Block bed) { 017 super(who); 018 this.bed = bed; 019 } 020 021 public boolean isCancelled() { 022 return cancel; 023 } 024 025 public void setCancelled(boolean cancel) { 026 this.cancel = cancel; 027 } 028 029 /** 030 * Returns the bed block involved in this event. 031 * 032 * @return the bed block involved in this event 033 */ 034 public Block getBed() { 035 return bed; 036 } 037 038 @Override 039 public HandlerList getHandlers() { 040 return handlers; 041 } 042 043 public static HandlerList getHandlerList() { 044 return handlers; 045 } 046 }