Skip to content

Commit

Permalink
Merge pull request #1370 from Lucky3028/hotfix/valentine-cookie
Browse files Browse the repository at this point in the history
配布されない原因不明のため、配布されるはずのチョコチップクッキーを決め打ちで生成し付与するコマンドを追加
  • Loading branch information
kory33 authored Feb 24, 2022
2 parents 6986221 + 4329526 commit 2fcf684
Showing 3 changed files with 10 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -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,13 +49,17 @@ 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 {
case "anniversary" :: _ => anniversaryGrantEffect
case "christmas" :: _ => christsmasGrantEffect
case "newyear" :: _ => newYearGrantEffect
case "halloween" :: _ => halloweenGrantEffect
case "valentine" :: _ => valentineGrantEffect
case _ => emptyEffect
}

Original file line number Diff line number Diff line change
@@ -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)
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 2fcf684

Please sign in to comment.