From fff26d4ffff36d1a47b32f0900eacd8ad62bfffa Mon Sep 17 00:00:00 2001 From: rito528 <39003544+rito528@users.noreply.github.com> Date: Sun, 17 Sep 2023 00:32:34 +0900 Subject: [PATCH] style: apply scalafix and fmt --- .../seichiassist/menus/RegionMenu.scala | 3 +- .../menus/gridregion/GridRegionMenu.scala | 8 ++- .../bukkit/actions/BukkitDrawGacha.scala | 68 +++++++++---------- .../bukkit/BukkitRegionOperations.scala | 8 ++- .../MebiusCommandExecutorProvider.scala | 12 ++-- .../unchama/seichiassist/util/BreakUtil.scala | 1 - .../util/external/WorldEditWrapper.scala | 3 +- .../util/external/WorldGuardWrapper.scala | 1 - 8 files changed, 54 insertions(+), 50 deletions(-) diff --git a/src/main/scala/com/github/unchama/seichiassist/menus/RegionMenu.scala b/src/main/scala/com/github/unchama/seichiassist/menus/RegionMenu.scala index 2c3d17728b..8f8c5e5b2a 100644 --- a/src/main/scala/com/github/unchama/seichiassist/menus/RegionMenu.scala +++ b/src/main/scala/com/github/unchama/seichiassist/menus/RegionMenu.scala @@ -67,11 +67,10 @@ object RegionMenu extends Menu { import player._ import environment._ - val computeButtonToClaimRegion: IO[Button] = for { regionCount <- gridRegionAPI.regionCount(player) } yield { - val openerData = SeichiAssist.playermap(player.getUniqueId) + SeichiAssist.playermap(player.getUniqueId) val selection = WorldEdit .getInstance() .getSessionManager diff --git a/src/main/scala/com/github/unchama/seichiassist/menus/gridregion/GridRegionMenu.scala b/src/main/scala/com/github/unchama/seichiassist/menus/gridregion/GridRegionMenu.scala index 9e619a26db..e4db598c75 100644 --- a/src/main/scala/com/github/unchama/seichiassist/menus/gridregion/GridRegionMenu.scala +++ b/src/main/scala/com/github/unchama/seichiassist/menus/gridregion/GridRegionMenu.scala @@ -143,7 +143,7 @@ object GridRegionMenu extends Menu { case HorizontalAxisAlignedSubjectiveDirection.Right => "右へ" } - val stainedGlassPaneDurability = relativeDirection match { + relativeDirection match { case HorizontalAxisAlignedSubjectiveDirection.Ahead => 14 case HorizontalAxisAlignedSubjectiveDirection.Left => 10 case HorizontalAxisAlignedSubjectiveDirection.Behind => 13 @@ -169,8 +169,10 @@ object GridRegionMenu extends Menu { } Button( - new IconItemStackBuilder(Material.GLASS_PANE - ).title(s"$DARK_GREEN${relativeDirectionString}ユニット増やす/減らす").lore(lore).build(), + new IconItemStackBuilder(Material.GLASS_PANE) + .title(s"$DARK_GREEN${relativeDirectionString}ユニット増やす/減らす") + .lore(lore) + .build(), LeftClickButtonEffect(updateCurrentRegionShapeTo(expandedShape)), RightClickButtonEffect(updateCurrentRegionShapeTo(contractedShape)) ) diff --git a/src/main/scala/com/github/unchama/seichiassist/subsystems/gacha/bukkit/actions/BukkitDrawGacha.scala b/src/main/scala/com/github/unchama/seichiassist/subsystems/gacha/bukkit/actions/BukkitDrawGacha.scala index dda6fead55..8352dc87a4 100644 --- a/src/main/scala/com/github/unchama/seichiassist/subsystems/gacha/bukkit/actions/BukkitDrawGacha.scala +++ b/src/main/scala/com/github/unchama/seichiassist/subsystems/gacha/bukkit/actions/BukkitDrawGacha.scala @@ -47,44 +47,44 @@ class BukkitDrawGacha[F[_]: Sync]( case GachaRarity.Gigantic => val prizeItem = gachaPrize.itemStack - val localizedEnchantmentList = - prizeItem.getItemMeta.getEnchants.asScala.toSeq.map { - case (enchantment, level) => - s"$GRAY${EnchantNameToJapanese.getEnchantName(enchantment.getKey.toString, level)}" - } + val localizedEnchantmentList = + prizeItem.getItemMeta.getEnchants.asScala.toSeq.map { + case (enchantment, level) => + s"$GRAY${EnchantNameToJapanese.getEnchantName(enchantment.getKey.toString, level)}" + } - import scala.util.chaining._ - val message = - new TextComponent().tap { c => - import c._ - setText( - s"$AQUA${prizeItem.getItemMeta.getDisplayName}${GOLD}を引きました!おめでとうございます!" - ) - setHoverEvent { - new HoverEvent( - HoverEvent.Action.SHOW_TEXT, - new Text( - s" ${prizeItem.getItemMeta.getDisplayName}\n" + - ListFormatters.getDescFormat(localizedEnchantmentList.toList) + - ListFormatters - .getDescFormat(prizeItem.getItemMeta.getLore.asScala.toList) - ) + import scala.util.chaining._ + val message = + new TextComponent().tap { c => + import c._ + setText( + s"$AQUA${prizeItem.getItemMeta.getDisplayName}${GOLD}を引きました!おめでとうございます!" + ) + setHoverEvent { + new HoverEvent( + HoverEvent.Action.SHOW_TEXT, + new Text( + s" ${prizeItem.getItemMeta.getDisplayName}\n" + + ListFormatters.getDescFormat(localizedEnchantmentList.toList) + + ListFormatters + .getDescFormat(prizeItem.getItemMeta.getLore.asScala.toList) ) - } + ) } - Sync[F].delay { - player.sendMessage(s"${RED}おめでとう!!!!!Gigantic☆大当たり!$additionalMessage") - player.spigot().sendMessage(message) - sendMessageToEveryone(s"$GOLD${player.getName}がガチャでGigantic☆大当たり!")( - forString[IO] - ) - sendMessageToEveryone(message)(forTextComponent[IO]) - SendSoundEffect.sendEverySoundWithoutIgnore( - Sound.ENTITY_ENDER_DRAGON_DEATH, - 0.5f, - 2f - ) } + Sync[F].delay { + player.sendMessage(s"${RED}おめでとう!!!!!Gigantic☆大当たり!$additionalMessage") + player.spigot().sendMessage(message) + sendMessageToEveryone(s"$GOLD${player.getName}がガチャでGigantic☆大当たり!")( + forString[IO] + ) + sendMessageToEveryone(message)(forTextComponent[IO]) + SendSoundEffect.sendEverySoundWithoutIgnore( + Sound.ENTITY_ENDER_DRAGON_DEATH, + 0.5f, + 2f + ) + } case GachaRarity.Big => Sync[F].delay { player.playSound(player.getLocation, Sound.ENTITY_WITHER_SPAWN, 0.8f, 1f) diff --git a/src/main/scala/com/github/unchama/seichiassist/subsystems/gridregion/bukkit/BukkitRegionOperations.scala b/src/main/scala/com/github/unchama/seichiassist/subsystems/gridregion/bukkit/BukkitRegionOperations.scala index 05b9a52c70..15b490c378 100644 --- a/src/main/scala/com/github/unchama/seichiassist/subsystems/gridregion/bukkit/BukkitRegionOperations.scala +++ b/src/main/scala/com/github/unchama/seichiassist/subsystems/gridregion/bukkit/BukkitRegionOperations.scala @@ -9,7 +9,7 @@ import com.github.unchama.seichiassist.subsystems.gridregion.domain.HorizontalAx import com.github.unchama.seichiassist.subsystems.gridregion.domain._ import com.github.unchama.util.external.{WorldEditWrapper, WorldGuardWrapper} import com.sk89q.worldedit.math.BlockVector3 -import com.sk89q.worldguard.protection.regions.{ProtectedCuboidRegion, ProtectedRegion} +import com.sk89q.worldguard.protection.regions.ProtectedCuboidRegion import org.bukkit.Location import org.bukkit.entity.Player @@ -77,7 +77,11 @@ class BukkitRegionOperations[F[_]: Sync]( wgManager = WorldGuardWrapper.getRegionManager(player.getWorld) selection = WorldEditWrapper.getSelection(player) regionName = s"${player.getName}_${regionCount.value}" - region = new ProtectedCuboidRegion(regionName, BlockVector3.at(selection.getBlockX, 0, selection.getBlockZ), BlockVector3.at(selection.getBlockX, 255, selection.getBlockZ)) + region = new ProtectedCuboidRegion( + regionName, + BlockVector3.at(selection.getBlockX, 0, selection.getBlockZ), + BlockVector3.at(selection.getBlockX, 255, selection.getBlockZ) + ) regionCreateResult <- Sync[F].delay { wgManager.addRegion(region) } diff --git a/src/main/scala/com/github/unchama/seichiassist/subsystems/mebius/bukkit/command/MebiusCommandExecutorProvider.scala b/src/main/scala/com/github/unchama/seichiassist/subsystems/mebius/bukkit/command/MebiusCommandExecutorProvider.scala index b5b9b3b232..49195bf506 100644 --- a/src/main/scala/com/github/unchama/seichiassist/subsystems/mebius/bukkit/command/MebiusCommandExecutorProvider.scala +++ b/src/main/scala/com/github/unchama/seichiassist/subsystems/mebius/bukkit/command/MebiusCommandExecutorProvider.scala @@ -111,12 +111,12 @@ class MebiusCommandExecutorProvider( val convertExecutor: ContextualExecutor = playerCommandBuilder.buildWith { context => val mainHand = context.sender.getInventory.getItemInMainHand - BukkitMebiusItemStackCodec.decodeMebiusProperty(mainHand) match { - case Some(property) => - if (property.level.isMaximum) { - val newProperty = property.toggleForcedMaterial - val newItem = - BukkitMebiusItemStackCodec.materialize(newProperty) + BukkitMebiusItemStackCodec.decodeMebiusProperty(mainHand) match { + case Some(property) => + if (property.level.isMaximum) { + val newProperty = property.toggleForcedMaterial + val newItem = + BukkitMebiusItemStackCodec.materialize(newProperty) val newMaterialName = newProperty.forcedMaterial match { case MebiusForcedMaterial.None => "ダイヤモンド" 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 e8b041f2a1..e908a77173 100644 --- a/src/main/scala/com/github/unchama/seichiassist/util/BreakUtil.scala +++ b/src/main/scala/com/github/unchama/seichiassist/util/BreakUtil.scala @@ -3,7 +3,6 @@ package com.github.unchama.seichiassist.util import cats.Monad import cats.effect.{IO, SyncIO} import com.github.unchama.generic.ApplicativeExtra.whenAOrElse -import com.github.unchama.generic.effect.unsafe.EffectEnvironment import com.github.unchama.seichiassist.MaterialSets.{BlockBreakableBySkill, BreakTool} import com.github.unchama.seichiassist._ import com.github.unchama.seichiassist.concurrent.PluginExecutionContexts diff --git a/src/main/scala/com/github/unchama/util/external/WorldEditWrapper.scala b/src/main/scala/com/github/unchama/util/external/WorldEditWrapper.scala index ad926ede93..8b40674e36 100644 --- a/src/main/scala/com/github/unchama/util/external/WorldEditWrapper.scala +++ b/src/main/scala/com/github/unchama/util/external/WorldEditWrapper.scala @@ -14,6 +14,7 @@ object WorldEditWrapper { /** * @return `player`が選択している範囲 */ - def getSelection(player: Player): BlockVector3 = plugin.getSession(player).getPlacementPosition(plugin.wrapPlayer(player)) + def getSelection(player: Player): BlockVector3 = + plugin.getSession(player).getPlacementPosition(plugin.wrapPlayer(player)) } diff --git a/src/main/scala/com/github/unchama/util/external/WorldGuardWrapper.scala b/src/main/scala/com/github/unchama/util/external/WorldGuardWrapper.scala index 00745d4be4..c6a2e642b3 100644 --- a/src/main/scala/com/github/unchama/util/external/WorldGuardWrapper.scala +++ b/src/main/scala/com/github/unchama/util/external/WorldGuardWrapper.scala @@ -37,7 +37,6 @@ object WorldGuardWrapper { .toList } - def getRegions(world: World): List[ProtectedRegion] = { worldGuard .getPlatform