Added setting for auto adding spawners to inventory.

This commit is contained in:
Brianna 2019-10-05 11:56:30 -04:00
parent 6c94c12a03
commit 3bd1937432
2 changed files with 13 additions and 3 deletions

View File

@ -89,7 +89,7 @@ public class BlockListeners implements Listener {
if (overflowItem != null) {
if (player.getInventory().firstEmpty() == -1)
block.getLocation().getWorld().dropItemNaturally(block.getLocation().add(.5, 0, .5), overflowItem);
block.getWorld().dropItemNaturally(block.getLocation().add(.5, 0, .5), overflowItem);
else
player.getInventory().addItem(overflowItem);
}
@ -180,8 +180,14 @@ public class BlockListeners implements Listener {
plugin.updateHologram(stack);
}
if (player.hasPermission("ultimatestacker.spawner.nosilkdrop") || item != null && item.getEnchantments().containsKey(Enchantment.SILK_TOUCH) && player.hasPermission("ultimatestacker.spawner.silktouch"))
block.getWorld().dropItemNaturally(block.getLocation(), Methods.getSpawnerItem(blockType, amt));
if (player.hasPermission("ultimatestacker.spawner.nosilkdrop") || item.getEnchantments().containsKey(Enchantment.SILK_TOUCH) && player.hasPermission("ultimatestacker.spawner.silktouch")) {
ItemStack spawner = Methods.getSpawnerItem(blockType, amt);
if (player.getInventory().firstEmpty() == -1 || !Settings.SPAWNERS_TO_INVENTORY.getBoolean())
block.getWorld().dropItemNaturally(block.getLocation().add(.5, 0, .5), spawner);
else
player.getInventory().addItem(spawner);
}
}
private int getSpawnerAmount(ItemStack item) {

View File

@ -215,6 +215,10 @@ public class Settings {
"Should eggs convert spawners? If enabled you will",
"still need to give perms for it to work.");
public static final ConfigSetting SPAWNERS_TO_INVENTORY = new ConfigSetting(config, "Spawners.Add Spawners To Inventory On Drop", false,
"Should broken spawners be added directly to the players inventory?",
"Alternatively they will drop to the ground?");
public static final ConfigSetting MAX_STACK_SPAWNERS = new ConfigSetting(config, "Spawners.Max Stack Size", 5,
"What should the max a spawner can stack to be?");