From 37a3ce149cd37a55d974a6319e93d150f0fb670a Mon Sep 17 00:00:00 2001 From: rito528 <39003544+rito528@users.noreply.github.com> Date: Sun, 24 Sep 2023 01:25:06 +0900 Subject: [PATCH] =?UTF-8?q?refactor:=20findBySignedItemStacks=E3=81=AE?= =?UTF-8?q?=E4=BD=99=E5=88=86=E3=81=AA=E5=87=A6=E7=90=86=E3=82=92=E5=89=8A?= =?UTF-8?q?=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../minestack/bukkit/BukkitMineStackObjectList.scala | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/main/scala/com/github/unchama/seichiassist/subsystems/minestack/bukkit/BukkitMineStackObjectList.scala b/src/main/scala/com/github/unchama/seichiassist/subsystems/minestack/bukkit/BukkitMineStackObjectList.scala index bd0086ae55..215511cb9b 100644 --- a/src/main/scala/com/github/unchama/seichiassist/subsystems/minestack/bukkit/BukkitMineStackObjectList.scala +++ b/src/main/scala/com/github/unchama/seichiassist/subsystems/minestack/bukkit/BukkitMineStackObjectList.scala @@ -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)) }