mirror of
https://github.com/songoda/UltimateStacker.git
synced 2025-02-06 06:21:22 +01:00
Added setting for auto adding spawners to inventory.
This commit is contained in:
parent
6c94c12a03
commit
3bd1937432
@ -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) {
|
||||
|
@ -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?");
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user