Minecraft – How to get rid of an Ender Dragon on a Realm

minecraft-commandsminecraft-java-edition

So, I accidentally spawned an Ender Dragon on my realm. I tried multiple commands and nothing is working. I even tried using the existing commands on my realm. But it is still not working. So how do I get rid of it on my realm?

I tried the following, which didn't work:

/kill ender_dragon

With the following error:

Entity ender_dragon could not be found

Best Answer

You've inserted "ender_dragon" as a literal player name. If you want to target generic entities, you will need to use the @e (entity) selector, and specify the savegame ID in the type parameter:

/kill @e[type=ender_dragon]