1
mirror of https://github.com/StarWishsama/Slimefun4.git synced 2024-09-20 11:45:51 +00:00

Update TalismanListener.java

This commit is contained in:
Nameless 2020-02-12 21:39:42 +08:00 committed by GitHub
parent c25a39c955
commit ef3c1f3d10
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -161,6 +161,7 @@ public class TalismanListener implements Listener {
if (!item.getEnchantments().containsKey(Enchantment.SILK_TOUCH) && MaterialCollections.getAllOres().contains(e.getBlock().getType()) && Talisman.checkFor(e, (SlimefunItemStack) SlimefunItems.TALISMAN_MINER)) { if (!item.getEnchantments().containsKey(Enchantment.SILK_TOUCH) && MaterialCollections.getAllOres().contains(e.getBlock().getType()) && Talisman.checkFor(e, (SlimefunItemStack) SlimefunItems.TALISMAN_MINER)) {
for (ItemStack drop : drops) { for (ItemStack drop : drops) {
if (!drop.getType().isBlock()) { if (!drop.getType().isBlock()) {
// Sometimes doubled amount is 0, So make amount at least equals 1
int amount = (fortune * 2) - drop.getAmount() == 0 ? 1 : (fortune * 2) - drop.getAmount(); int amount = (fortune * 2) - drop.getAmount() == 0 ? 1 : (fortune * 2) - drop.getAmount();
e.getPlayer().getInventory().addItem(new CustomItem(drop, amount)); e.getPlayer().getInventory().addItem(new CustomItem(drop, amount));
} }