This repository has been archived by the owner on Dec 28, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 124
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
ninja
authored and
SpigotMC
committed
Jun 26, 2014
1 parent
b8ad3ea
commit 0cf705d
Showing
1 changed file
with
50 additions
and
0 deletions.
There are no files selected for viewing
50 changes: 50 additions & 0 deletions
50
src/main/java/org/spigotmc/event/player/PlayerSpawnLocationEvent.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
package org.spigotmc.event.player; | ||
|
||
import org.bukkit.Location; | ||
import org.bukkit.entity.Entity; | ||
import org.bukkit.entity.Player; | ||
import org.bukkit.event.HandlerList; | ||
import org.bukkit.event.player.PlayerEvent; | ||
|
||
/** | ||
* Called when player is about to spawn in a world after joining the server. | ||
*/ | ||
public class PlayerSpawnLocationEvent extends PlayerEvent { | ||
private static final HandlerList handlers = new HandlerList(); | ||
private Location spawnLocation; | ||
|
||
public PlayerSpawnLocationEvent(final Player who, Location spawnLocation) { | ||
super(who); | ||
this.spawnLocation = spawnLocation; | ||
} | ||
|
||
|
||
/** | ||
* Gets player's spawn location. | ||
* If the player {@link Player#hasPlayedBefore()}, it's going to default to the location inside player.dat file. | ||
* For new players, the default spawn location is spawn of the main Bukkit world. | ||
* | ||
* @return the spawn location | ||
*/ | ||
public Location getSpawnLocation() { | ||
return spawnLocation; | ||
} | ||
|
||
/** | ||
* Sets player's spawn location. | ||
* | ||
* @param location the spawn location | ||
*/ | ||
public void setSpawnLocation(Location location) { | ||
this.spawnLocation = location; | ||
} | ||
|
||
@Override | ||
public HandlerList getHandlers() { | ||
return handlers; | ||
} | ||
|
||
public static HandlerList getHandlerList() { | ||
return handlers; | ||
} | ||
} |