ShopUtils.java 文件源码

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

项目:ShopChest 作者:
/**
 * Get the amount of shops of a player
 * @param p Player, whose shops should be counted
 * @return The amount of a shops a player has (if {@link Config#exclude_admin_shops} is true, admin shops won't be counted)
 */
public int getShopAmount(OfflinePlayer p) {
    float shopCount = 0;

    for (Shop shop : getShops()) {
        if (shop.getVendor().equals(p)) {
            if (shop.getShopType() != Shop.ShopType.ADMIN || !plugin.getShopChestConfig().exclude_admin_shops) {
                shopCount++;

                InventoryHolder ih = shop.getInventoryHolder();

                if (ih instanceof DoubleChest)
                    shopCount -= 0.5;
            }
        }
    }

    return Math.round(shopCount);
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号