mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-02 13:07:06 +01:00
Close inventory on teleport. FIXES BUKKIT-3021.
This commit is contained in:
parent
d06e597ca5
commit
993e19b3fb
1 changed files with 5 additions and 4 deletions
|
@ -381,14 +381,15 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
|||
WorldServer fromWorld = ((CraftWorld) from.getWorld()).getHandle();
|
||||
WorldServer toWorld = ((CraftWorld) to.getWorld()).getHandle();
|
||||
|
||||
// Close any foreign inventory
|
||||
if (getHandle().activeContainer != getHandle().defaultContainer) {
|
||||
getHandle().closeInventory();
|
||||
}
|
||||
|
||||
// Check if the fromWorld and toWorld are the same.
|
||||
if (fromWorld == toWorld) {
|
||||
entity.playerConnection.teleport(to);
|
||||
} else {
|
||||
// Close any foreign inventory
|
||||
if (getHandle().activeContainer != getHandle().defaultContainer){
|
||||
getHandle().closeInventory();
|
||||
}
|
||||
server.getHandle().moveToWorld(entity, toWorld.dimension, true, to, true);
|
||||
}
|
||||
return true;
|
||||
|
|
Loading…
Reference in a new issue