-
Bug
-
Resolution: Fixed
-
Minor
-
None
-
None
-
None
-
git-Spigot-0509002-7c03d25 (MC: 1.16.1)
-
Yes
A NullPointerException is thrown when a Lodestone Compass nms ItemStack is converted to a Bukkit ItemStack, if the world (this compass is pointing to) is no longer (or never has been) loaded.
And even if the exception would not occur it looks like the data would be lost in a nms -> Bukkit -> nms conversion.
Here's my example code to reproduce the issue:
public class TestPlugin extends JavaPlugin { @Override public void onEnable() { World world = Bukkit.createWorld(new WorldCreator("test")); ItemStack item = new ItemStack(Material.COMPASS); CompassMeta meta = (CompassMeta) item.getItemMeta(); meta.setLodestone(world.getSpawnLocation()); item.setItemMeta(meta); net.minecraft.server.v1_16_R1.ItemStack nmsItem = CraftItemStack.asNMSCopy(item); Bukkit.unloadWorld(world, false); CraftItemStack.asBukkitCopy(nmsItem); } }