Skip to content

Commit

Permalink
Merge pull request #36 from TeamFelnull/fix/equipmentgroup
Browse files Browse the repository at this point in the history
装備グループの制限確認処理を修正
  • Loading branch information
MORIMORI0317 authored Jan 1, 2024
2 parents 52a3609 + cb4b1a2 commit 6026542
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -118,14 +118,16 @@ private boolean isMatch(@NotNull ItemStack stack1, @NotNull ItemStack stack2) {
* @return 制限がかかるかどうか
*/
public boolean isRestricted(@NotNull @Unmodifiable List<ItemStack> hotbarStacks) {
int maxHotbarCount = restriction().maxHotbarExistsCount();

if (restriction().maxHotbarExistsCount() >= 0) {
if (maxHotbarCount >= 0) {
// ホットバーのアイテム数確認
int hotbarCount = (int) hotbarStacks.stream()
.filter(this::isBelongs)
.limit(maxHotbarCount + 1) // 最大数以上は確認不要
.count();

return hotbarCount > restriction().maxHotbarExistsCount();
return hotbarCount > maxHotbarCount;
}

return false;
Expand Down

0 comments on commit 6026542

Please sign in to comment.