Made teleporting between worlds 'smoother'. Thanks Raphfrk!

By: EvilSeph <evilseph@unaligned.org>
This commit is contained in:
CraftBukkit/Spigot 2011-05-04 22:16:26 -04:00
parent 8dcebbc6fd
commit c06f71942e

View file

@ -12,6 +12,7 @@ import net.minecraft.server.Packet54PlayNoteBlock;
import net.minecraft.server.Packet6SpawnPosition;
import net.minecraft.server.ServerConfigurationManager;
import net.minecraft.server.WorldServer;
import net.minecraft.server.ChunkCoordIntPair;
import org.bukkit.Achievement;
import org.bukkit.Location;
import org.bukkit.Material;
@ -194,6 +195,16 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
if (teleportSuccess) {
manager.server.tracker.trackPlayer(entity);
manager.server.tracker.untrackEntity(entity);
int cx = (int) location.getBlockX() >> 4;
int cz = (int) location.getBlockZ() >> 4;
for (int x = -10 ; x <= 10 ; x++ ) {
for (int z = -10 ; z <= 10 ; z++ ) {
ChunkCoordIntPair chunkPosition = new ChunkCoordIntPair(cx + x, cz + z);
if (entity.g.remove(chunkPosition)) {
newEntity.g.add(chunkPosition);
}
}
}
oldWorld.manager.removePlayer(entity);
manager.players.remove(entity);
oldWorld.removeEntity(entity);