mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-29 03:31:27 +01:00
Fixed various multiworld teleporting issues
By: Dinnerbone <dinnerbone@dinnerbone.com>
This commit is contained in:
parent
e304a85e74
commit
a56535ac56
@ -8,6 +8,8 @@ import net.minecraft.server.ItemInWorldManager;
|
|||||||
import net.minecraft.server.Packet;
|
import net.minecraft.server.Packet;
|
||||||
import net.minecraft.server.Packet3Chat;
|
import net.minecraft.server.Packet3Chat;
|
||||||
import net.minecraft.server.Packet6SpawnPosition;
|
import net.minecraft.server.Packet6SpawnPosition;
|
||||||
|
import net.minecraft.server.Packet9Respawn;
|
||||||
|
import net.minecraft.server.ServerConfigurationManager;
|
||||||
import net.minecraft.server.WorldServer;
|
import net.minecraft.server.WorldServer;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.craftbukkit.CraftServer;
|
import org.bukkit.craftbukkit.CraftServer;
|
||||||
@ -115,18 +117,27 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
|||||||
@Override
|
@Override
|
||||||
public void teleportTo(Location location) {
|
public void teleportTo(Location location) {
|
||||||
boolean worldChange = location.getWorld() != getWorld();
|
boolean worldChange = location.getWorld() != getWorld();
|
||||||
|
ServerConfigurationManager manager = server.getHandle();
|
||||||
|
|
||||||
if (worldChange) {
|
if (worldChange) {
|
||||||
// Unload player from current chunks
|
manager.c.k.a(entity);
|
||||||
server.getServer().f.d.b(entity);
|
manager.c.k.b(entity);
|
||||||
|
manager.d.b(entity);
|
||||||
|
entity.world.e(entity);
|
||||||
|
|
||||||
|
entity.world = ((CraftWorld)location.getWorld()).getHandle();
|
||||||
|
|
||||||
entity.c = new ItemInWorldManager(((CraftWorld)location.getWorld()).getHandle());
|
entity.c = new ItemInWorldManager(((CraftWorld)location.getWorld()).getHandle());
|
||||||
entity.c.a = entity;
|
entity.c.a = entity;
|
||||||
|
|
||||||
|
((WorldServer)entity.world).A.d((int) entity.locX >> 4, (int) entity.locZ >> 4);
|
||||||
}
|
}
|
||||||
entity.world = ((CraftWorld)location.getWorld()).getHandle();
|
|
||||||
entity.b(location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch());
|
entity.a.a(location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch());
|
||||||
|
|
||||||
if (worldChange) {
|
if (worldChange) {
|
||||||
// Forceload the chunks around player
|
manager.d.a(entity);
|
||||||
server.getServer().f.d.a(entity);
|
entity.world.a(entity);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user