Added custom display-name for the item

This commit is contained in:
Alexander B
2021-01-05 21:02:56 +01:00
parent ff1d5d11d7
commit fd942d7d88
2 changed files with 7 additions and 0 deletions

View File

@@ -89,12 +89,15 @@ public class OnBlockBreak implements Listener {
// Set drop
if(success){
ConfigurationSection dropConfig = Main.config.getConfigurationSection("break.drop");
ItemStack item = new ItemStack(Material.MOB_SPAWNER);
CreatureSpawner cs = (CreatureSpawner)e.getBlock().getState();
BlockStateMeta bsm = (BlockStateMeta)item.getItemMeta();
bsm.setBlockState(cs);
bsm.setDisplayName(dropConfig.getString("item.name").replace("{mob-type}", cs.getSpawnedType().name()));
item.setItemMeta(bsm);
loc.getWorld().dropItem(loc, item);