mirror of
https://github.com/PaperMC/Paper.git
synced 2025-03-27 08:50:35 +01:00
Implements isBedSpawn() to the PlayerRespawnEvent.
This commit is contained in:
parent
138c70183d
commit
0648302078
1 changed files with 3 additions and 1 deletions
|
@ -217,10 +217,12 @@ public class ServerConfigurationManager {
|
||||||
EntityPlayer entityplayer1 = entityplayer;
|
EntityPlayer entityplayer1 = entityplayer;
|
||||||
|
|
||||||
if (location == null) {
|
if (location == null) {
|
||||||
|
boolean isBedSpawn = false;
|
||||||
CraftWorld cw = (CraftWorld) this.server.server.getWorld(entityplayer.spawnWorld);
|
CraftWorld cw = (CraftWorld) this.server.server.getWorld(entityplayer.spawnWorld);
|
||||||
if (cw != null && chunkcoordinates != null) {
|
if (cw != null && chunkcoordinates != null) {
|
||||||
ChunkCoordinates chunkcoordinates1 = EntityHuman.getBed(cw.getHandle(), chunkcoordinates);
|
ChunkCoordinates chunkcoordinates1 = EntityHuman.getBed(cw.getHandle(), chunkcoordinates);
|
||||||
if (chunkcoordinates1 != null) {
|
if (chunkcoordinates1 != null) {
|
||||||
|
isBedSpawn = true;
|
||||||
location = new Location(cw, chunkcoordinates1.x + 0.5, chunkcoordinates1.y, chunkcoordinates1.z + 0.5);
|
location = new Location(cw, chunkcoordinates1.x + 0.5, chunkcoordinates1.y, chunkcoordinates1.z + 0.5);
|
||||||
} else {
|
} else {
|
||||||
entityplayer1.netServerHandler.sendPacket(new Packet70Bed(0));
|
entityplayer1.netServerHandler.sendPacket(new Packet70Bed(0));
|
||||||
|
@ -234,7 +236,7 @@ public class ServerConfigurationManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
Player respawnPlayer = cserver.getPlayer(entityplayer);
|
Player respawnPlayer = cserver.getPlayer(entityplayer);
|
||||||
PlayerRespawnEvent respawnEvent = new PlayerRespawnEvent(respawnPlayer, location);
|
PlayerRespawnEvent respawnEvent = new PlayerRespawnEvent(respawnPlayer, location, isBedSpawn);
|
||||||
cserver.getPluginManager().callEvent(respawnEvent);
|
cserver.getPluginManager().callEvent(respawnEvent);
|
||||||
|
|
||||||
location = respawnEvent.getRespawnLocation();
|
location = respawnEvent.getRespawnLocation();
|
||||||
|
|
Loading…
Add table
Reference in a new issue