Paper
Paper copied to clipboard
EnderDragonBattle#hasBeenPreviouslyKilled() returns true for a new created world
Expected behavior
When creating a new world the World#getEnderDragonBattle().hasBeenPreviouslyKilled() should return false.
Observed/Actual behavior
When world is created it first returns true. After a player go in the world and the ender dragon has spawned it returns false. After the death of the dragon it returns true.
Steps/models to reproduce
I used a simple plugin to output the result :
@Override
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, @NotNull String[] args) {
sender.sendMessage(Component.text("DEBUG").color(NamedTextColor.RED));
for (World world : Bukkit.getServer().getWorlds())
if(world.getEnvironment().equals(World.Environment.THE_END))
sender.sendMessage(Component.text("hasBeenPreviouslyKilled() ? " + (world.getEnderDragonBattle().hasBeenPreviouslyKilled())));
return true;
}
Steps :
- Create a new server
- Check hasBeenPreviouslyKilled() output
- Go to end
- Check hasBeenPreviouslyKilled() output again
https://user-images.githubusercontent.com/54907162/163856964-755e3423-053a-4fb2-bb4a-802eba14b8d1.mp4
Plugin and Datapack List

Paper version

Other
The issue occurs too when I use another plugin taht create worlds with the Bukkit#createWorld(WorldCreator).
Don't know if it can help but after going into the Paper code it seems the EndDragonFight(ServerLevel, long, CompoundTag) set by default the previouslyKilled field to true if the given CompoundTag doesn't contains "DragonKilled" key which could be the case for a new created world.