From 432952603091b49d8d11d80e1ff123ea02b7a4f4 Mon Sep 17 00:00:00 2001 From: Lucky3028 Date: Fri, 18 Feb 2022 14:15:15 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20=E9=85=8D=E5=B8=83=E3=81=95=E3=82=8C?= =?UTF-8?q?=E3=81=AA=E3=81=84=E5=8E=9F=E5=9B=A0=E4=B8=8D=E6=98=8E=E3=81=AE?= =?UTF-8?q?=E3=81=9F=E3=82=81=E3=80=81=E9=85=8D=E5=B8=83=E3=81=95=E3=82=8C?= =?UTF-8?q?=E3=82=8B=E3=81=AF=E3=81=9A=E3=81=AE=E3=83=81=E3=83=A7=E3=82=B3?= =?UTF-8?q?=E3=83=81=E3=83=83=E3=83=97=E3=82=AF=E3=83=83=E3=82=AD=E3=83=BC?= =?UTF-8?q?=E3=82=92=E6=B1=BA=E3=82=81=E6=89=93=E3=81=A1=E3=81=A7=E7=94=9F?= =?UTF-8?q?=E6=88=90=E3=81=97=E4=BB=98=E4=B8=8E=E3=81=99=E3=82=8B=E3=82=B3?= =?UTF-8?q?=E3=83=9E=E3=83=B3=E3=83=89=E3=82=92=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../subsystems/seasonalevents/commands/EventCommand.scala | 7 +++++++ .../seasonalevents/valentine/ValentineItemData.scala | 6 ++---- .../seasonalevents/valentine/ValentineListener.scala | 2 +- 3 files changed, 10 insertions(+), 5 deletions(-) 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 8d64a249ea..ca63d6d97e 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