mirror of
https://github.com/craftaro/EpicSpawners.git
synced 2025-01-08 11:37:51 +08:00
giveOldEgg function
This change is to add a function that will give the player the egg of the old mob of the spawner when they change the mob. It also adds an option in the config.yml to either enable or disable it.
This commit is contained in:
parent
ca78215100
commit
90fec80bb3
@ -146,7 +146,14 @@ public class InteractListeners implements Listener {
|
||||
spawner.getCreatureSpawner().setSpawnedType(EntityType.DROPPED_ITEM);
|
||||
}
|
||||
spawner.getCreatureSpawner().update();
|
||||
|
||||
|
||||
if (plugin.getConfig().getBoolean("giveOldEgg")) {
|
||||
CreatureSpawner creatureSpawner = (CreatureSpawner) block.getState();
|
||||
ItemStack oldEgg = new ItemStack(item.getType(), 1);
|
||||
((SpawnEggMeta) oldEgg.getItemMeta()).setSpawnedType(creatureSpawner.getSpawnedType());
|
||||
player.getInventory().addItem(oldEgg);
|
||||
}
|
||||
|
||||
plugin.processChange(block);
|
||||
ItemUtils.takeActiveItem(player, CompatibleHand.getHand(event), bmulti);
|
||||
}
|
||||
@ -231,4 +238,4 @@ public class InteractListeners implements Listener {
|
||||
EpicSpawners.getInstance().getDataManager().createSpawner(spawner);
|
||||
return spawner;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user