diff --git a/src/main/scala/com/github/unchama/seichiassist/subsystems/seasonalevents/commands/EventCommand.scala b/src/main/scala/com/github/unchama/seichiassist/subsystems/seasonalevents/commands/EventCommand.scala index 73b4409b20..6bdfc81bec 100644 --- a/src/main/scala/com/github/unchama/seichiassist/subsystems/seasonalevents/commands/EventCommand.scala +++ b/src/main/scala/com/github/unchama/seichiassist/subsystems/seasonalevents/commands/EventCommand.scala @@ -7,11 +7,14 @@ import com.github.unchama.seichiassist.subsystems.seasonalevents.anniversary.Ann import com.github.unchama.seichiassist.subsystems.seasonalevents.christmas.ChristmasItemData._ import com.github.unchama.seichiassist.subsystems.seasonalevents.halloween.HalloweenItemData._ import com.github.unchama.seichiassist.subsystems.seasonalevents.newyear.NewYearItemData._ +import com.github.unchama.seichiassist.subsystems.seasonalevents.valentine.ValentineItemData.cookieOf import com.github.unchama.seichiassist.util.Util import com.github.unchama.targetedeffect.TargetedEffect._ import org.bukkit.command.TabExecutor import org.bukkit.entity.Player +import java.util.UUID + class EventCommand(implicit ioOnMainThread: OnMinecraftServerThread[IO]) { import com.github.unchama.targetedeffect._ @@ -46,6 +49,9 @@ class EventCommand(implicit ioOnMainThread: OnMinecraftServerThread[IO]) { anniversaryShovel ) + def valentineGrantEffect: TargetedEffect[Player] = + Util.grantItemStacksEffect(cookieOf("kinton", UUID.fromString("85dd5867-db09-4a2f-bae7-8d38d5a9c547"))) + val executor: TabExecutor = playerCommandBuilder .execution { context => val effect = context.args.yetToBeParsed match { @@ -53,6 +59,7 @@ class EventCommand(implicit ioOnMainThread: OnMinecraftServerThread[IO]) { case "christmas" :: _ => christsmasGrantEffect case "newyear" :: _ => newYearGrantEffect case "halloween" :: _ => halloweenGrantEffect + case "valentine" :: _ => valentineGrantEffect case _ => emptyEffect } diff --git a/src/main/scala/com/github/unchama/seichiassist/subsystems/seasonalevents/valentine/ValentineItemData.scala b/src/main/scala/com/github/unchama/seichiassist/subsystems/seasonalevents/valentine/ValentineItemData.scala index 42cdb6a243..f9e33b3a4d 100644 --- a/src/main/scala/com/github/unchama/seichiassist/subsystems/seasonalevents/valentine/ValentineItemData.scala +++ b/src/main/scala/com/github/unchama/seichiassist/subsystems/seasonalevents/valentine/ValentineItemData.scala @@ -3,7 +3,6 @@ package com.github.unchama.seichiassist.subsystems.seasonalevents.valentine import com.github.unchama.seichiassist.subsystems.seasonalevents.valentine.Valentine.{END_DATE, EVENT_YEAR} import de.tr7zw.itemnbtapi.NBTItem import org.bukkit.ChatColor._ -import org.bukkit.entity.Player import org.bukkit.inventory.ItemStack import org.bukkit.inventory.meta.SkullMeta import org.bukkit.{Bukkit, Material} @@ -66,8 +65,7 @@ object ValentineItemData { //region GiftedCookie -> 棒メニューでもらえるやつ - def cookieOf(player: Player): ItemStack = { - val playerName = player.getName + def cookieOf(playerName: String, playerUuid: UUID): ItemStack = { val loreList = { val header = List( "", @@ -90,7 +88,7 @@ object ValentineItemData { import item._ setByte(NBTTagConstants.typeIdTag, 2.toByte) setObject(NBTTagConstants.expiryDateTag, END_DATE) - setObject(NBTTagConstants.producerUuidTag, player.getUniqueId) + setObject(NBTTagConstants.producerUuidTag, playerUuid) setString(NBTTagConstants.producerNameTag, playerName) } .pipe(_.getItem) diff --git a/src/main/scala/com/github/unchama/seichiassist/subsystems/seasonalevents/valentine/ValentineListener.scala b/src/main/scala/com/github/unchama/seichiassist/subsystems/seasonalevents/valentine/ValentineListener.scala index 95f22ef3a6..ad366bbff5 100644 --- a/src/main/scala/com/github/unchama/seichiassist/subsystems/seasonalevents/valentine/ValentineListener.scala +++ b/src/main/scala/com/github/unchama/seichiassist/subsystems/seasonalevents/valentine/ValentineListener.scala @@ -102,7 +102,7 @@ class ValentineListener[ val effects = if (hasNotJoinedBeforeYet) SequentialEffect( - grantItemStacksEffect(cookieOf(player)), + grantItemStacksEffect(cookieOf(player.getName, playerUuid)), MessageEffect(s"${AQUA}チョコチップクッキーを付与しました。"), FocusedSoundEffect(Sound.BLOCK_ANVIL_PLACE, 1.0f, 1.0f)) else TargetedEffect.emptyEffect