diff --git a/build.sbt b/build.sbt index ccbe6cfc4c..cab4dad518 100644 --- a/build.sbt +++ b/build.sbt @@ -4,7 +4,7 @@ import sbt.Keys.baseDirectory import java.io._ ThisBuild / scalaVersion := "2.13.1" -ThisBuild / version := "1.8.3" +ThisBuild / version := "1.8.4" ThisBuild / organization := "click.seichi" ThisBuild / description := "ギガンティック☆整地鯖の独自要素を司るプラグイン" diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index 4e6f3ef7e5..c3c1852bb2 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -95,7 +95,7 @@ commands: permission-message: *denied fly: description: This is a fly command. - usage: / + usage: / <操作> (詳細については/fly helpを参照してください) permission-message: *denied permission: seichiassist.fly stickmenu: @@ -162,4 +162,4 @@ permissions: - seichiassist.present.grant - seichiassist.present.revoke - seichiassist.present.define - - seichiassist.present.delete \ No newline at end of file + - seichiassist.present.delete diff --git a/src/main/scala/com/github/unchama/buildassist/PlayerInventoryListener.scala b/src/main/scala/com/github/unchama/buildassist/PlayerInventoryListener.scala index ab6c66e8b6..4df81f16a9 100644 --- a/src/main/scala/com/github/unchama/buildassist/PlayerInventoryListener.scala +++ b/src/main/scala/com/github/unchama/buildassist/PlayerInventoryListener.scala @@ -63,7 +63,7 @@ class PlayerInventoryListener(implicit effectEnvironment: EffectEnvironment, if (itemstackcurrent.getType == Material.SKULL_ITEM) { //ホームメニューへ帰還 - effectEnvironment.runAsyncTargetedEffect(player)( + effectEnvironment.unsafeRunAsyncTargetedEffect(player)( SequentialEffect( CommonSoundEffects.menuTransitionFenceSound, ioCanOpenBuildMainMenu.open(BuildMainMenu) diff --git a/src/main/scala/com/github/unchama/fs2/workaround/Topic.scala b/src/main/scala/com/github/unchama/fs2/workaround/Topic.scala index a27d4494fc..6797528b7c 100644 --- a/src/main/scala/com/github/unchama/fs2/workaround/Topic.scala +++ b/src/main/scala/com/github/unchama/fs2/workaround/Topic.scala @@ -1,6 +1,6 @@ package com.github.unchama.fs2.workaround -import cats.effect.Concurrent +import cats.effect.{Concurrent, Sync} import cats.effect.concurrent.{Deferred, Ref} import cats.implicits._ import fs2.Stream._ @@ -9,6 +9,7 @@ import fs2.{Sink, Stream} /* Code directly copied from https://github.com/typelevel/fs2/blob/4ddd75a2dc032b7604dc1205c86d7d6adc993859/core/shared/src/main/scala/fs2/concurrent/Topic.scala. +and then generalized to a more generic version. This is due to https://github.com/typelevel/fs2/issues/1406, and the recommended workaround was to switch back to an old implementation of Topic which is better in terms of performance. @@ -116,7 +117,7 @@ abstract class Topic[F[_], A] { object Topic { - def apply[F[_], A](initial: A)(implicit F: Concurrent[F]): F[Topic[F, A]] = { + def in[G[_], F[_], A](initial: A)(implicit G: Sync[G], F: Concurrent[F]): G[Topic[F, A]] = { // Id identifying each subscriber uniquely class ID @@ -133,9 +134,9 @@ object Topic { } Ref - .of[F, (A, Vector[Subscriber])]((initial, Vector.empty[Subscriber])) + .in[G, F, (A, Vector[Subscriber])]((initial, Vector.empty[Subscriber])) .flatMap { state => - SignallingRef[F, Int](0).map { subSignal => + SignallingRef.in[G, F, Int](0).map { subSignal => def mkSubscriber(maxQueued: Int): F[Subscriber] = for { q <- InspectableQueue.bounded[F, A](maxQueued) @@ -200,4 +201,6 @@ object Topic { } } } + + def apply[F[_], A](initial: A)(implicit F: Concurrent[F]): F[Topic[F, A]] = in[F, F, A](initial) } diff --git a/src/main/scala/com/github/unchama/generic/effect/concurrent/AsymmetricSignallingRef.scala b/src/main/scala/com/github/unchama/generic/effect/concurrent/AsymmetricSignallingRef.scala index d8cdf8fde0..8d9e4babb1 100644 --- a/src/main/scala/com/github/unchama/generic/effect/concurrent/AsymmetricSignallingRef.scala +++ b/src/main/scala/com/github/unchama/generic/effect/concurrent/AsymmetricSignallingRef.scala @@ -8,8 +8,9 @@ import com.github.unchama.generic.effect.EffectExtra import com.github.unchama.generic.effect.stream.ReorderingPipe import com.github.unchama.generic.effect.stream.ReorderingPipe.TimeStamped import com.github.unchama.generic.{ContextCoercion, Token} +import com.github.unchama.fs2.workaround.Topic import fs2.Stream -import fs2.concurrent.{Signal, Topic} +import fs2.concurrent.Signal /** * 更新が [[Stream]] により読め出せるような可変参照セル。 diff --git a/src/main/scala/com/github/unchama/generic/effect/unsafe/EffectEnvironment.scala b/src/main/scala/com/github/unchama/generic/effect/unsafe/EffectEnvironment.scala index a520b48b82..962303a9fb 100644 --- a/src/main/scala/com/github/unchama/generic/effect/unsafe/EffectEnvironment.scala +++ b/src/main/scala/com/github/unchama/generic/effect/unsafe/EffectEnvironment.scala @@ -15,10 +15,8 @@ trait EffectEnvironment { * 理想的には、これはプログラムの最も外側にて「一度だけ」呼び出されるべきである。 * * このメソッドの実装は `context` を用いて実行に関するロギングを行ってよい。 - * - * TODO rename to unsafeRunEffectAsync */ - def runEffectAsync[U, F[_] : Effect](context: String, program: F[U]): Unit + def unsafeRunEffectAsync[U, F[_] : Effect](context: String, program: F[U]): Unit /** * `receiver`を`effect`に適用して得られる`IO`を例外を補足して実行する。 @@ -30,7 +28,7 @@ trait EffectEnvironment { * @tparam T レシーバの型 * @deprecated use [[EffectEnvironment]] */ - def runAsyncTargetedEffect[T](receiver: T)(effect: TargetedEffect[T], context: String): Unit = - runEffectAsync(context, effect(receiver)) + def unsafeRunAsyncTargetedEffect[T](receiver: T)(effect: TargetedEffect[T], context: String): Unit = + unsafeRunEffectAsync(context, effect(receiver)) } diff --git a/src/main/scala/com/github/unchama/menuinventory/MenuHandler.scala b/src/main/scala/com/github/unchama/menuinventory/MenuHandler.scala index c4d7308711..540a8746c3 100644 --- a/src/main/scala/com/github/unchama/menuinventory/MenuHandler.scala +++ b/src/main/scala/com/github/unchama/menuinventory/MenuHandler.scala @@ -37,7 +37,7 @@ class MenuHandler(implicit val cs: NonServerThreadContextShift[IO], env: EffectE return } - env.runEffectAsync( + env.unsafeRunEffectAsync( "メニューのクリックを非同期で処理する", for { currentLayout <- holder.currentLayout.get diff --git a/src/main/scala/com/github/unchama/seichiassist/DefaultEffectEnvironment.scala b/src/main/scala/com/github/unchama/seichiassist/DefaultEffectEnvironment.scala index bfaa4bbee7..93e8fa4dd7 100644 --- a/src/main/scala/com/github/unchama/seichiassist/DefaultEffectEnvironment.scala +++ b/src/main/scala/com/github/unchama/seichiassist/DefaultEffectEnvironment.scala @@ -7,7 +7,7 @@ import com.github.unchama.generic.effect.unsafe.EffectEnvironment // TODO prepare alternative environment that uses dedicated Logger for effect execution object DefaultEffectEnvironment extends EffectEnvironment { - override def runEffectAsync[U, F[_] : Effect](context: String, program: F[U]): Unit = { + override def unsafeRunEffectAsync[U, F[_] : Effect](context: String, program: F[U]): Unit = { import cats.effect.implicits._ program diff --git a/src/main/scala/com/github/unchama/seichiassist/listener/BuildMainMenuOpener.scala b/src/main/scala/com/github/unchama/seichiassist/listener/BuildMainMenuOpener.scala index 98cdc38539..8a992fc3e4 100644 --- a/src/main/scala/com/github/unchama/seichiassist/listener/BuildMainMenuOpener.scala +++ b/src/main/scala/com/github/unchama/seichiassist/listener/BuildMainMenuOpener.scala @@ -32,7 +32,7 @@ class BuildMainMenuOpener(implicit effectEnvironment: EffectEnvironment, if (!hasStickOnMainHand || !actionWasOnMainHand) return } - effectEnvironment.runAsyncTargetedEffect(player)( + effectEnvironment.unsafeRunAsyncTargetedEffect(player)( SequentialEffect( CommonSoundEffects.menuTransitionFenceSound, ioCanOpenBuildMainMenu.open(BuildMainMenu) diff --git a/src/main/scala/com/github/unchama/seichiassist/listener/EntityListener.scala b/src/main/scala/com/github/unchama/seichiassist/listener/EntityListener.scala index 21d9add46e..c54a52fcee 100644 --- a/src/main/scala/com/github/unchama/seichiassist/listener/EntityListener.scala +++ b/src/main/scala/com/github/unchama/seichiassist/listener/EntityListener.scala @@ -6,9 +6,9 @@ import com.github.unchama.minecraft.actions.OnMinecraftServerThread import com.github.unchama.seichiassist.MaterialSets.{BlockBreakableBySkill, BreakTool} import com.github.unchama.seichiassist._ import com.github.unchama.seichiassist.seichiskill.{BlockSearching, BreakArea} +import com.github.unchama.seichiassist.subsystems.discordnotification.DiscordNotificationAPI import com.github.unchama.seichiassist.subsystems.mana.ManaApi import com.github.unchama.seichiassist.subsystems.mana.domain.ManaAmount -import com.github.unchama.seichiassist.subsystems.discordnotification.DiscordNotificationAPI import com.github.unchama.seichiassist.task.GiganticBerserkTask import com.github.unchama.seichiassist.util.{BreakUtil, Util} import org.bukkit._ @@ -150,7 +150,7 @@ class EntityListener(implicit effectEnvironment: EffectEnvironment, //元ブロックの真ん中の位置 val centerOfBlock = hitBlock.getLocation.add(0.5, 0.5, 0.5) - effectEnvironment.runEffectAsync( + effectEnvironment.unsafeRunEffectAsync( "破壊エフェクトを再生する", playerData.skillEffectState.selection .runBreakEffect(player, selectedSkill, tool, breakBlocks.toSet, breakArea, centerOfBlock) diff --git a/src/main/scala/com/github/unchama/seichiassist/listener/PlayerBlockBreakListener.scala b/src/main/scala/com/github/unchama/seichiassist/listener/PlayerBlockBreakListener.scala index 805e2bb87b..bbd762268c 100644 --- a/src/main/scala/com/github/unchama/seichiassist/listener/PlayerBlockBreakListener.scala +++ b/src/main/scala/com/github/unchama/seichiassist/listener/PlayerBlockBreakListener.scala @@ -230,11 +230,11 @@ class PlayerBlockBreakListener(implicit effectEnvironment: EffectEnvironment, if (!tool.getItemMeta.isUnbreakable) tool.setDurability(toolDamageToSet.toShort) } - effectEnvironment.runEffectAsync( + effectEnvironment.unsafeRunEffectAsync( "複数破壊エフェクトを実行する", effectPrograms.toList.sequence[IO, Fiber[IO, Unit]] ) - effectEnvironment.runEffectAsync( + effectEnvironment.unsafeRunEffectAsync( "複数破壊エフェクトの後処理を実行する", adjustManaAndDurability >> availabilityFlagManipulation ) @@ -251,7 +251,7 @@ class PlayerBlockBreakListener(implicit effectEnvironment: EffectEnvironment, BreakUtil.blockCountWeight(event.getPlayer.getWorld) * BreakUtil.totalBreakCount(Seq(block.getType)) } - effectEnvironment.runEffectAsync( + effectEnvironment.unsafeRunEffectAsync( "通常破壊されたブロックを整地量に計上する", SeichiAssist.instance .breakCountSystem.api diff --git a/src/main/scala/com/github/unchama/seichiassist/listener/PlayerClickListener.scala b/src/main/scala/com/github/unchama/seichiassist/listener/PlayerClickListener.scala index b2d048cf8d..beed9d979e 100644 --- a/src/main/scala/com/github/unchama/seichiassist/listener/PlayerClickListener.scala +++ b/src/main/scala/com/github/unchama/seichiassist/listener/PlayerClickListener.scala @@ -106,8 +106,8 @@ class PlayerClickListener(implicit effectEnvironment: EffectEnvironment, val arrowEffect = playerData.skillEffectState.selection.arrowEffect(player) - effectEnvironment.runEffectAsync("スキルのクールダウンの状態を戻す", controlSkillAvailability) - effectEnvironment.runEffectAsync("ArrowEffectを非同期で実行する", arrowEffect) + effectEnvironment.unsafeRunEffectAsync("スキルのクールダウンの状態を戻す", controlSkillAvailability) + effectEnvironment.unsafeRunEffectAsync("ArrowEffectを非同期で実行する", arrowEffect) case _ => } } @@ -393,7 +393,7 @@ class PlayerClickListener(implicit effectEnvironment: EffectEnvironment, if (event.getHand == EquipmentSlot.OFF_HAND) return event.setCancelled(true) - effectEnvironment.runAsyncTargetedEffect(player)( + effectEnvironment.unsafeRunAsyncTargetedEffect(player)( SequentialEffect( CommonSoundEffects.menuTransitionFenceSound, ioCanOpenStickMenu.open(StickMenu.firstPage) diff --git a/src/main/scala/com/github/unchama/seichiassist/listener/PlayerInventoryListener.scala b/src/main/scala/com/github/unchama/seichiassist/listener/PlayerInventoryListener.scala index fc3f4faa57..08f8f927f4 100644 --- a/src/main/scala/com/github/unchama/seichiassist/listener/PlayerInventoryListener.scala +++ b/src/main/scala/com/github/unchama/seichiassist/listener/PlayerInventoryListener.scala @@ -10,7 +10,6 @@ import com.github.unchama.seichiassist.data.{GachaSkullData, ItemData, MenuInven import com.github.unchama.seichiassist.effects.player.CommonSoundEffects import com.github.unchama.seichiassist.listener.invlistener.OnClickTitleMenu import com.github.unchama.seichiassist.menus.achievement.AchievementMenu -import com.github.unchama.seichiassist.menus.ranking.RankingRootMenu import com.github.unchama.seichiassist.menus.stickmenu.{FirstPage, StickMenu} import com.github.unchama.seichiassist.subsystems.mana.ManaApi import com.github.unchama.seichiassist.task.VotingFairyTask @@ -232,7 +231,7 @@ class PlayerInventoryListener(implicit effectEnvironment: EffectEnvironment, val ticketsToGive = Seq.fill(ticketAmount)(exchangeTicket) if (ticketsToGive.nonEmpty) { - effectEnvironment.runAsyncTargetedEffect(player)( + effectEnvironment.unsafeRunAsyncTargetedEffect(player)( SequentialEffect( Util.grantItemStacksEffect(ticketsToGive: _*), FocusedSoundEffect(Sound.BLOCK_ANVIL_PLACE, 1f, 1f), @@ -257,7 +256,7 @@ class PlayerInventoryListener(implicit effectEnvironment: EffectEnvironment, }.++(rejectedItems) //返却処理 - effectEnvironment.runAsyncTargetedEffect(player)( + effectEnvironment.unsafeRunAsyncTargetedEffect(player)( Util.grantItemStacksEffect(itemStacksToReturn: _*), "鉱石交換でのアイテム返却を行う" ) @@ -516,7 +515,7 @@ class PlayerInventoryListener(implicit effectEnvironment: EffectEnvironment, player.closeInventory() } else if (isSkull && itemstackcurrent.getItemMeta.asInstanceOf[SkullMeta].getOwner == "MHF_ArrowLeft") { - effectEnvironment.runAsyncTargetedEffect(player)( + effectEnvironment.unsafeRunAsyncTargetedEffect(player)( SequentialEffect( CommonSoundEffects.menuTransitionFenceSound, ioCanOpenFirstPage.open(StickMenu.firstPage) diff --git a/src/main/scala/com/github/unchama/seichiassist/listener/invlistener/OnClickTitleMenu.scala b/src/main/scala/com/github/unchama/seichiassist/listener/invlistener/OnClickTitleMenu.scala index febadaa211..8734835786 100644 --- a/src/main/scala/com/github/unchama/seichiassist/listener/invlistener/OnClickTitleMenu.scala +++ b/src/main/scala/com/github/unchama/seichiassist/listener/invlistener/OnClickTitleMenu.scala @@ -107,7 +107,7 @@ object OnClickTitleMenu { case _ if isSkull && isApplicableAsPrevPageButton(current) => - effectEnvironment.runAsyncTargetedEffect(player)( + effectEnvironment.unsafeRunAsyncTargetedEffect(player)( SequentialEffect( CommonSoundEffects.menuTransitionFenceSound, ioCanOpenAchievementMenu.open(AchievementMenu) diff --git a/src/main/scala/com/github/unchama/seichiassist/menus/skill/ActiveSkillMenu.scala b/src/main/scala/com/github/unchama/seichiassist/menus/skill/ActiveSkillMenu.scala index e9a37d0c40..0de1867cee 100644 --- a/src/main/scala/com/github/unchama/seichiassist/menus/skill/ActiveSkillMenu.scala +++ b/src/main/scala/com/github/unchama/seichiassist/menus/skill/ActiveSkillMenu.scala @@ -355,7 +355,7 @@ object ActiveSkillMenu extends Menu { MessageEffect(s"$YELLOW${BOLD}全てのスキルを習得し、アサルト・アーマーを解除しました"), Kleisli.liftF(DiscordNotificationAPI[F].send(notificationMessage).toIO), Kleisli.liftF(IO { - Util.sendMessageToEveryoneIgnoringPreference(notificationMessage) + Util.sendMessageToEveryoneIgnoringPreference(s"$GOLD$BOLD$notificationMessage") }), BroadcastSoundEffect(Sound.ENTITY_ENDERDRAGON_DEATH, 1.0f, 1.2f), ) diff --git a/src/main/scala/com/github/unchama/seichiassist/seichiskill/assault/AssaultRoutine.scala b/src/main/scala/com/github/unchama/seichiassist/seichiskill/assault/AssaultRoutine.scala index 100d2bcb30..328314a8fa 100644 --- a/src/main/scala/com/github/unchama/seichiassist/seichiskill/assault/AssaultRoutine.scala +++ b/src/main/scala/com/github/unchama/seichiassist/seichiskill/assault/AssaultRoutine.scala @@ -147,7 +147,7 @@ object AssaultRoutine { // ブロックを書き換える if (shouldBreakAllBlocks) { (foundWaters ++ foundLavas).foreach(_.setType(Material.AIR)) - DefaultEffectEnvironment.runEffectAsync( + DefaultEffectEnvironment.unsafeRunEffectAsync( "ブロックを大量破壊する", BreakUtil.massBreakBlock(player, foundBlocks, player.getLocation, toolToBeUsed, shouldPlayBreakSound = false) ) diff --git a/src/main/scala/com/github/unchama/seichiassist/subsystems/bookedachivement/bukkit/listener/GrantBookedAchievementListener.scala b/src/main/scala/com/github/unchama/seichiassist/subsystems/bookedachivement/bukkit/listener/GrantBookedAchievementListener.scala index dab97cf6ad..3681c0723e 100644 --- a/src/main/scala/com/github/unchama/seichiassist/subsystems/bookedachivement/bukkit/listener/GrantBookedAchievementListener.scala +++ b/src/main/scala/com/github/unchama/seichiassist/subsystems/bookedachivement/bukkit/listener/GrantBookedAchievementListener.scala @@ -39,6 +39,6 @@ class GrantBookedAchievementListener[F[_] : ConcurrentEffect : NonServerThreadCo }.sequence) } yield () - effectEnvironment.runEffectAsync("未受け取りの予約実績を読み込み、付与する", program) + effectEnvironment.unsafeRunEffectAsync("未受け取りの予約実績を読み込み、付与する", program) } } diff --git a/src/main/scala/com/github/unchama/seichiassist/subsystems/expbottlestack/bukkit/listeners/ExpBottleStackUsageController.scala b/src/main/scala/com/github/unchama/seichiassist/subsystems/expbottlestack/bukkit/listeners/ExpBottleStackUsageController.scala index 9d08c72a4f..5c59538916 100644 --- a/src/main/scala/com/github/unchama/seichiassist/subsystems/expbottlestack/bukkit/listeners/ExpBottleStackUsageController.scala +++ b/src/main/scala/com/github/unchama/seichiassist/subsystems/expbottlestack/bukkit/listeners/ExpBottleStackUsageController.scala @@ -49,7 +49,7 @@ class ExpBottleStackUsageController[ val bottleCount = BottleCount(playerInventory.getItemInMainHand.getAmount) val bottleResource = Resources.bottleResourceSpawningAt[F](player.getLocation, bottleCount) - effectEnvironment.runEffectAsync( + effectEnvironment.unsafeRunEffectAsync( "経験値瓶の消費を待つ", managedBottleScope.useTracked[ThrownExpBottle, Nothing](bottleResource) { _ => Effect[F].never } ) diff --git a/src/main/scala/com/github/unchama/seichiassist/subsystems/fourdimensionalpocket/bukkit/listeners/OpenPocketInventoryOnPlacingEnderPortalFrame.scala b/src/main/scala/com/github/unchama/seichiassist/subsystems/fourdimensionalpocket/bukkit/listeners/OpenPocketInventoryOnPlacingEnderPortalFrame.scala index 2f1c2994a9..e2b52fea6f 100644 --- a/src/main/scala/com/github/unchama/seichiassist/subsystems/fourdimensionalpocket/bukkit/listeners/OpenPocketInventoryOnPlacingEnderPortalFrame.scala +++ b/src/main/scala/com/github/unchama/seichiassist/subsystems/fourdimensionalpocket/bukkit/listeners/OpenPocketInventoryOnPlacingEnderPortalFrame.scala @@ -32,7 +32,7 @@ class OpenPocketInventoryOnPlacingEnderPortalFrame[ //設置をキャンセル event.setCancelled(true) - effectEnvironment.runEffectAsync( + effectEnvironment.unsafeRunEffectAsync( "ポケットインベントリを開く", api.openPocketInventory(player) ) diff --git a/src/main/scala/com/github/unchama/seichiassist/subsystems/manabar/application/ManaBarManipulation.scala b/src/main/scala/com/github/unchama/seichiassist/subsystems/manabar/application/ManaBarManipulation.scala index 8d462707ed..fafcae7d92 100644 --- a/src/main/scala/com/github/unchama/seichiassist/subsystems/manabar/application/ManaBarManipulation.scala +++ b/src/main/scala/com/github/unchama/seichiassist/subsystems/manabar/application/ManaBarManipulation.scala @@ -13,7 +13,7 @@ object ManaBarManipulation { // 3桁毎カンマ区切り、小数点以下一桁を表示 private def formatAmount(manaAmount: ManaAmount): String = { - val decimalFormat = new DecimalFormat("#,###.0") + val decimalFormat = new DecimalFormat("#,##0.0") decimalFormat.format(manaAmount.value) } diff --git a/src/main/scala/com/github/unchama/seichiassist/subsystems/mebius/bukkit/listeners/MebiusDropTrialListener.scala b/src/main/scala/com/github/unchama/seichiassist/subsystems/mebius/bukkit/listeners/MebiusDropTrialListener.scala index 6600f2b574..4a3ac7cc0b 100644 --- a/src/main/scala/com/github/unchama/seichiassist/subsystems/mebius/bukkit/listeners/MebiusDropTrialListener.scala +++ b/src/main/scala/com/github/unchama/seichiassist/subsystems/mebius/bukkit/listeners/MebiusDropTrialListener.scala @@ -3,8 +3,8 @@ package com.github.unchama.seichiassist.subsystems.mebius.bukkit.listeners import cats.effect.{IO, SyncEffect, SyncIO, Timer} import com.github.unchama.datarepository.bukkit.player.PlayerDataRepository import com.github.unchama.generic.effect.unsafe.EffectEnvironment -import com.github.unchama.seichiassist.MaterialSets import com.github.unchama.seichiassist.ManagedWorld._ +import com.github.unchama.seichiassist.MaterialSets import com.github.unchama.seichiassist.subsystems.mebius.bukkit.codec.BukkitMebiusItemStackCodec import com.github.unchama.seichiassist.subsystems.mebius.domain.MebiusDrop import com.github.unchama.seichiassist.subsystems.mebius.domain.speech.{MebiusSpeech, MebiusSpeechStrength} @@ -18,8 +18,8 @@ import org.bukkit.ChatColor._ import org.bukkit.Sound import org.bukkit.event.block.BlockBreakEvent import org.bukkit.event.{EventHandler, EventPriority, Listener} -import java.util.concurrent.TimeUnit +import java.util.concurrent.TimeUnit import scala.concurrent.duration.FiniteDuration class MebiusDropTrialListener[ @@ -49,7 +49,7 @@ class MebiusDropTrialListener[ player.sendMessage(s"$RESET$YELLOW${BOLD}MEBIUSはプレイヤーと共に成長するヘルメットです。") player.sendMessage(s"$RESET$YELLOW${BOLD}あなただけのMEBIUSを育てましょう!") - effectEnvironment.runEffectAsync( + effectEnvironment.unsafeRunEffectAsync( "Mebiusのドロップ時メッセージを再生する", serviceRepository(player).makeSpeechIgnoringBlockage( droppedMebiusProperty, diff --git a/src/main/scala/com/github/unchama/seichiassist/subsystems/mebius/bukkit/listeners/MebiusInteractionResponder.scala b/src/main/scala/com/github/unchama/seichiassist/subsystems/mebius/bukkit/listeners/MebiusInteractionResponder.scala index 133bedba02..13f22e1bd6 100644 --- a/src/main/scala/com/github/unchama/seichiassist/subsystems/mebius/bukkit/listeners/MebiusInteractionResponder.scala +++ b/src/main/scala/com/github/unchama/seichiassist/subsystems/mebius/bukkit/listeners/MebiusInteractionResponder.scala @@ -69,7 +69,7 @@ class MebiusInteractionResponder(implicit serviceRepository: PlayerDataRepositor import cats.implicits._ - effectEnvironment.runEffectAsync( + effectEnvironment.unsafeRunEffectAsync( "Mebius破壊時のエフェクトを再生する", MebiusMessages.onMebiusBreak.pickOne[SyncIO].toIO.flatMap { message => speechService.makeSpeechIgnoringBlockage( diff --git a/src/main/scala/com/github/unchama/seichiassist/subsystems/mebius/bukkit/listeners/MebiusLevelUpTrialListener.scala b/src/main/scala/com/github/unchama/seichiassist/subsystems/mebius/bukkit/listeners/MebiusLevelUpTrialListener.scala index 0cc8c07d6a..b539e747ed 100644 --- a/src/main/scala/com/github/unchama/seichiassist/subsystems/mebius/bukkit/listeners/MebiusLevelUpTrialListener.scala +++ b/src/main/scala/com/github/unchama/seichiassist/subsystems/mebius/bukkit/listeners/MebiusLevelUpTrialListener.scala @@ -36,7 +36,7 @@ class MebiusLevelUpTrialListener(implicit serviceRepository: PlayerDataRepositor } import cats.implicits._ - effectEnvironment.runEffectAsync( + effectEnvironment.unsafeRunEffectAsync( "Mebiusのレベルアップ時の通知を行う", serviceRepository(player).makeSpeechIgnoringBlockage( newMebiusProperty, diff --git a/src/main/scala/com/github/unchama/seichiassist/subsystems/mebius/bukkit/listeners/MebiusPlayerJoinGreeter.scala b/src/main/scala/com/github/unchama/seichiassist/subsystems/mebius/bukkit/listeners/MebiusPlayerJoinGreeter.scala index caea62c292..cc6bcd44dc 100644 --- a/src/main/scala/com/github/unchama/seichiassist/subsystems/mebius/bukkit/listeners/MebiusPlayerJoinGreeter.scala +++ b/src/main/scala/com/github/unchama/seichiassist/subsystems/mebius/bukkit/listeners/MebiusPlayerJoinGreeter.scala @@ -1,7 +1,5 @@ package com.github.unchama.seichiassist.subsystems.mebius.bukkit.listeners -import java.util.concurrent.TimeUnit - import cats.effect.{Effect, IO, SyncIO, Timer} import com.github.unchama.datarepository.bukkit.player.PlayerDataRepository import com.github.unchama.generic.effect.unsafe.EffectEnvironment @@ -12,6 +10,7 @@ import com.github.unchama.targetedeffect.DelayEffect import org.bukkit.event.player.PlayerJoinEvent import org.bukkit.event.{EventHandler, EventPriority, Listener} +import java.util.concurrent.TimeUnit import scala.concurrent.duration.FiniteDuration class MebiusPlayerJoinGreeter[F[_] : Effect](implicit effectEnvironment: EffectEnvironment, @@ -27,7 +26,7 @@ class MebiusPlayerJoinGreeter[F[_] : Effect](implicit effectEnvironment: EffectE BukkitMebiusItemStackCodec .decodePropertyOfOwnedMebius(player)(player.getInventory.getHelmet) .foreach { property => - effectEnvironment.runEffectAsync( + effectEnvironment.unsafeRunEffectAsync( "参加時のMebiusのメッセージを送信する", DelayEffect(FiniteDuration(500, TimeUnit.MILLISECONDS)).run(player) >> speechServiceRepository(player) diff --git a/src/main/scala/com/github/unchama/seichiassist/subsystems/seasonalevents/anniversary/AnniversaryListener.scala b/src/main/scala/com/github/unchama/seichiassist/subsystems/seasonalevents/anniversary/AnniversaryListener.scala index 97b64ad775..1291a65e06 100644 --- a/src/main/scala/com/github/unchama/seichiassist/subsystems/seasonalevents/anniversary/AnniversaryListener.scala +++ b/src/main/scala/com/github/unchama/seichiassist/subsystems/seasonalevents/anniversary/AnniversaryListener.scala @@ -22,7 +22,6 @@ import org.bukkit.event.{EventHandler, Listener} import org.bukkit.inventory.EquipmentSlot import org.bukkit.{Material, Sound, TreeType} -import java.time.LocalDate import scala.jdk.CollectionConverters._ import scala.util.Random @@ -51,7 +50,7 @@ class AnniversaryListener(implicit effectEnvironment: EffectEnvironment, val playerData: PlayerData = SeichiAssist.playermap(player.getUniqueId) if (playerData.anniversary) return - effectEnvironment.runAsyncTargetedEffect(player)( + effectEnvironment.unsafeRunAsyncTargetedEffect(player)( SequentialEffect( grantItemStacksEffect(mineHead), MessageEffect(s"${BLUE}ギガンティック☆整地鯖${ANNIVERSARY_COUNT}周年の記念品を入手しました。"), diff --git a/src/main/scala/com/github/unchama/seichiassist/subsystems/seasonalevents/limitedlogin/LimitedLoginBonusGifter.scala b/src/main/scala/com/github/unchama/seichiassist/subsystems/seasonalevents/limitedlogin/LimitedLoginBonusGifter.scala index fbd92acf6b..2e7ea10538 100644 --- a/src/main/scala/com/github/unchama/seichiassist/subsystems/seasonalevents/limitedlogin/LimitedLoginBonusGifter.scala +++ b/src/main/scala/com/github/unchama/seichiassist/subsystems/seasonalevents/limitedlogin/LimitedLoginBonusGifter.scala @@ -67,7 +67,7 @@ class LimitedLoginBonusGifter(implicit ioOnMainThread: OnMinecraftServerThread[I private def giveItem(itemName: String, amount: Int, item: ItemStack)(implicit player: Player): Unit = { import cats.implicits._ - DefaultEffectEnvironment.runEffectAsync( + DefaultEffectEnvironment.unsafeRunEffectAsync( s"${itemName}を付与する", List.fill(amount)( grantItemStacksEffect(item) diff --git a/src/main/scala/com/github/unchama/seichiassist/subsystems/seasonalevents/newyear/NewYearListener.scala b/src/main/scala/com/github/unchama/seichiassist/subsystems/seasonalevents/newyear/NewYearListener.scala index 6a82d2c3f5..5686fad935 100644 --- a/src/main/scala/com/github/unchama/seichiassist/subsystems/seasonalevents/newyear/NewYearListener.scala +++ b/src/main/scala/com/github/unchama/seichiassist/subsystems/seasonalevents/newyear/NewYearListener.scala @@ -76,7 +76,7 @@ class NewYearListener[ }) } yield () - effectEnvironment.runEffectAsync("大晦日ログインボーナスヘッドを付与するかどうかを判定する", program) + effectEnvironment.unsafeRunEffectAsync("大晦日ログインボーナスヘッドを付与するかどうかを判定する", program) } @EventHandler 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 8c13146b3a..356d11e683 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 @@ -105,7 +105,7 @@ class ValentineListener[ }) } yield () - effectEnvironment.runEffectAsync("チョコチップクッキーを付与するかどうかを判定する", program) + effectEnvironment.unsafeRunEffectAsync("チョコチップクッキーを付与するかどうかを判定する", program) } @EventHandler diff --git a/src/main/scala/com/github/unchama/seichiassist/util/BreakUtil.scala b/src/main/scala/com/github/unchama/seichiassist/util/BreakUtil.scala index e57f779159..d1decbd78a 100644 --- a/src/main/scala/com/github/unchama/seichiassist/util/BreakUtil.scala +++ b/src/main/scala/com/github/unchama/seichiassist/util/BreakUtil.scala @@ -130,7 +130,7 @@ object BreakUtil { tool: BreakTool, shouldPlayBreakSound: Boolean) (implicit effectEnvironment: EffectEnvironment): Unit = - effectEnvironment.runEffectAsync( + effectEnvironment.unsafeRunEffectAsync( "単一ブロックを破壊する", massBreakBlock(player, Set(targetBlock), dropLocation, tool, shouldPlayBreakSound) ) diff --git a/src/main/scala/com/github/unchama/seichiassist/util/Util.scala b/src/main/scala/com/github/unchama/seichiassist/util/Util.scala index 2ca026ea3e..803ea24ff1 100644 --- a/src/main/scala/com/github/unchama/seichiassist/util/Util.scala +++ b/src/main/scala/com/github/unchama/seichiassist/util/Util.scala @@ -14,8 +14,8 @@ import enumeratum._ import org.bukkit.ChatColor._ import org.bukkit._ import org.bukkit.block.{Block, Skull} -import org.bukkit.entity.{EntityType, Firework, Player} import org.bukkit.entity.EntityType._ +import org.bukkit.entity.{EntityType, Firework, Player} import org.bukkit.inventory.meta.SkullMeta import org.bukkit.inventory.{ItemFlag, ItemStack, PlayerInventory} @@ -79,7 +79,7 @@ object Util { // Javaから呼ばれているのでimplicitが使いづらい grantItemStacksEffectに置き換えたい import PluginExecutionContexts.onMainThread - DefaultEffectEnvironment.runEffectAsync( + DefaultEffectEnvironment.unsafeRunEffectAsync( "アイテムスタックを付与する", grantItemStacksEffect(itemStack).run(player) )