Bukkit-API  1.7.9-R0.2
The inofficial Bukkit-API
PlayerRespawnEvent.java
1 package org.bukkit.event.player;
2 
3 import org.apache.commons.lang.Validate;
4 import org.bukkit.Location;
5 import org.bukkit.entity.Player;
7 
8 /**
9  * Called when a player respawns.
10  */
11 public class PlayerRespawnEvent extends PlayerEvent {
12  private static final HandlerList handlers = new HandlerList();
13  private Location respawnLocation;
14  private final boolean isBedSpawn;
15 
16  public PlayerRespawnEvent(final Player respawnPlayer, final Location respawnLocation, final boolean isBedSpawn) {
17  super(respawnPlayer);
18  this.respawnLocation = respawnLocation;
19  this.isBedSpawn = isBedSpawn;
20  }
21 
22  /**
23  * Gets the current respawn location
24  *
25  * @return Location current respawn location
26  */
28  return this.respawnLocation;
29  }
30 
31  /**
32  * Sets the new respawn location
33  *
34  * @param respawnLocation new location for the respawn
35  */
36  public void setRespawnLocation(Location respawnLocation) {
37  Validate.notNull(respawnLocation, "Respawn location can not be null");
38  Validate.notNull(respawnLocation.getWorld(), "Respawn world can not be null");
39 
40  this.respawnLocation = respawnLocation;
41  }
42 
43  /**
44  * Gets whether the respawn location is the player's bed.
45  *
46  * @return true if the respawn location is the player's bed.
47  */
48  public boolean isBedSpawn() {
49  return this.isBedSpawn;
50  }
51 
52  @Override
53  public HandlerList getHandlers() {
54  return handlers;
55  }
56 
57  public static HandlerList getHandlerList() {
58  return handlers;
59  }
60 }
void setRespawnLocation(Location respawnLocation)