SPIGOT-7047: Add Player#getLastDeathLocation

By: Doc <nachito94@msn.com>
This commit is contained in:
CraftBukkit/Spigot
2022-06-10 09:56:52 +10:00
parent 70106be465
commit 85ee50d5f1
2 changed files with 26 additions and 0 deletions

View File

@@ -36,6 +36,7 @@ import org.bukkit.Material;
import org.bukkit.NamespacedKey;
import org.bukkit.block.Block;
import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.craftbukkit.entity.memory.CraftMemoryMapper;
import org.bukkit.craftbukkit.event.CraftEventFactory;
import org.bukkit.craftbukkit.inventory.CraftContainer;
import org.bukkit.craftbukkit.inventory.CraftInventory;
@@ -646,4 +647,18 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity {
public void setStarvationRate(int i) {
getHandle().getFoodData().starvationRate = i;
}
@Override
public Location getLastDeathLocation() {
return getHandle().getLastDeathLocation().map(CraftMemoryMapper::fromNms).orElse(null);
}
@Override
public void setLastDeathLocation(Location location) {
if (location == null) {
getHandle().setLastDeathLocation(Optional.empty());
} else {
getHandle().setLastDeathLocation(Optional.of(CraftMemoryMapper.toNms(location)));
}
}
}