3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-12-18 20:40:08 +01:00

Made entering an end portal from The End move the player to their bed spawn if it exists. Fixes BUKKIT-1061

Dieser Commit ist enthalten in:
EvilSeph 2012-03-10 00:36:11 -05:00
Ursprung 6f40a22e16
Commit 08bd33a3ed

Datei anzeigen

@ -1093,11 +1093,19 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
public void a(Packet9Respawn packet9respawn) {
if (this.player.viewingCredits) {
// CraftBukkit start
CraftWorld cworld = (CraftWorld) this.server.getWorlds().get(0);
ChunkCoordinates chunkcoordinates = cworld.getHandle().getSpawn();
Location toLocation = new Location(cworld, chunkcoordinates.x + 0.5, chunkcoordinates.y, chunkcoordinates.z + 0.5);
org.bukkit.craftbukkit.PortalTravelAgent pta = new org.bukkit.craftbukkit.PortalTravelAgent();
Location toLocation;
if (this.player.getBukkitEntity().getBedSpawnLocation() == null) {
CraftWorld cworld = (CraftWorld) this.server.getWorlds().get(0);
ChunkCoordinates chunkcoordinates = cworld.getHandle().getSpawn();
toLocation = new Location(cworld, chunkcoordinates.x + 0.5, chunkcoordinates.y, chunkcoordinates.z + 0.5);
this.player.netServerHandler.sendPacket(new Packet70Bed(0, 0));
} else {
toLocation = this.player.getBukkitEntity().getBedSpawnLocation();
toLocation = new Location(toLocation.getWorld(), toLocation.getX() + 0.5, toLocation.getY(), toLocation.getZ() + 0.5);
}
PlayerPortalEvent event = new PlayerPortalEvent(this.player.getBukkitEntity(), this.player.getBukkitEntity().getLocation(), toLocation, pta, PlayerPortalEvent.TeleportCause.END_PORTAL);
event.useTravelAgent(false);