Skip to content

Commit

Permalink
refactor: findBySignedItemStacksの余分な処理を削除
Browse files Browse the repository at this point in the history
  • Loading branch information
rito528 committed Sep 23, 2023
1 parent 9fce860 commit 37a3ce1
Showing 1 changed file with 3 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1110,15 +1110,12 @@ class BukkitMineStackObjectList[F[_]: Sync](
implicit val canBeSignedAsGachaPrize: CanBeSignedAsGachaPrize[ItemStack] =
gachaPrizeAPI.canBeSignedAsGachaPrize

val gachaPrizeWithSignedItemStacks = gachaPrizes.map { gachaPrize =>
gachaPrize -> gachaPrize.materializeWithOwnerSignature(player.getName)
val signedItemStacks = gachaPrizes.map { gachaPrize =>
gachaPrize.materializeWithOwnerSignature(player.getName)
}

itemStacks.map { _itemStack =>
val itemStack = gachaPrizeWithSignedItemStacks
.find { case (_, signedItemStack) => signedItemStack.isSimilar(_itemStack) }
.map(_._2)
.getOrElse(_itemStack)
val itemStack = signedItemStacks.find(_.isSimilar(_itemStack)).getOrElse(_itemStack)

mineStackObjects.find(_.itemStack.isSimilar(itemStack))
}
Expand Down

0 comments on commit 37a3ce1

Please sign in to comment.