Added custom display-name for the item
This commit is contained in:
parent
ff1d5d11d7
commit
fd942d7d88
@ -27,6 +27,10 @@ break:
|
||||
fail: '§7§oNothing happens, it seems you cannot break the spawner without the Silktouch-enchantment'
|
||||
|
||||
|
||||
drop:
|
||||
item:
|
||||
name: '{mob-type}-Spawner'
|
||||
|
||||
# Prerequisites for a successful drop of the spawner-item AFTER (and only if) it was broken
|
||||
# (if a player can break it, but the drop prerequisite is not met, the block is broken, but not item will drop -> Its lost)
|
||||
drop-prerequisite:
|
||||
|
@ -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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user