Only save invulnerable egg from platform regen

This commit is contained in:
J0nasL 2023-07-20 01:52:57 -04:00
parent b314f5e6f3
commit 0656016a01

View file

@ -156,10 +156,20 @@ public class EggDestroyListener implements Listener {
//as a workaround, allow egg blocks to be destroyed, but respawn the egg as an item
if (!eggs.isEmpty()) {
for (Block egg : eggs) {
EggController.spawnEggItem(egg.getLocation(), config, data);
if (config.getEggInvulnerable()) {
for (Block egg : eggs) {
EggController.spawnEggItem(egg.getLocation(), config, data);
}
logger.log("Egg overwritten by the end spawn platform, spawning egg item at block location");
} else {
for (Block b : eggs) {
Egg.removeEgg(b); //delete egg
}
log("Dragon egg was replaced");
EggController.eggDestroyed(config, data, logger);
}
logger.log("Egg overwritten by the end spawn platform, spawning egg item at block location");
}
}