AntiNegativeItemDupe.java 文件源码

java
阅读 21 收藏 0 点赞 0 评论 0

项目:NeverLag 作者:
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
public void onBlockDispense(BlockDispenseEvent e) {
    if (!cm.isAntiNegativeItemDupe) {
        return;
    }
    Inventory content = null;
    if (e.getBlock().getState() instanceof InventoryHolder) {
        content = ((InventoryHolder) e.getBlock().getState()).getInventory();
    }
    if (content == null || content.getSize() == 0) {
        return;
    }
    for (ItemStack item : content.getContents()) {
        if (item != null && item.getType() != Material.AIR) {
            if (item.getAmount() <= 0) {
                item.setType(Material.AIR);
            }
        }
    }
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号