Skip to content

Commit

Permalink
fix: コンパイルエラーを修正
Browse files Browse the repository at this point in the history
  • Loading branch information
rito528 committed Oct 22, 2023
1 parent 2ad9408 commit 7d62907
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 53 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ object GridRegionMenu extends Menu {
for {
currentLengthChangePerClick <- gridRegionAPI.lengthChangePerClick(player)
} yield {
val iconItemStack = new IconItemStackBuilder(Material.STAINED_GLASS_PANE, 1)
val iconItemStack = new IconItemStackBuilder(Material.GLASS_PANE)
.title(s"${GREEN}拡張単位の変更")
.lore(
List(
Expand Down Expand Up @@ -169,9 +169,7 @@ object GridRegionMenu extends Menu {
}

Button(
new IconItemStackBuilder(
Material.STAINED_GLASS_PANE,
stainedGlassPaneDurability.toShort
new IconItemStackBuilder(Material.GLASS_PANE
).title(s"$DARK_GREEN${relativeDirectionString}ユニット増やす/減らす").lore(lore).build(),
LeftClickButtonEffect(updateCurrentRegionShapeTo(expandedShape)),
RightClickButtonEffect(updateCurrentRegionShapeTo(contractedShape))
Expand All @@ -194,7 +192,7 @@ object GridRegionMenu extends Menu {
}

val resetSettingButton: Button = {
val itemStack = new IconItemStackBuilder(Material.STAINED_GLASS_PANE, 4)
val itemStack = new IconItemStackBuilder(Material.GLASS_PANE)
.title(s"${RED}全設定リセット")
.lore(List(s"$RED${UNDERLINE}取り扱い注意!!"))
.build()
Expand Down Expand Up @@ -228,7 +226,7 @@ object GridRegionMenu extends Menu {
s"${GRAY}保護ユニット上限値:$RED${gridRegionAPI.regionUnitLimit(worldName).limit}"
)

val itemStack = new IconItemStackBuilder(Material.STAINED_GLASS_PANE, 11)
val itemStack = new IconItemStackBuilder(Material.GLASS_PANE)
.title(s"${DARK_GREEN}設定")
.lore(lore)
.build()
Expand All @@ -245,7 +243,7 @@ object GridRegionMenu extends Menu {
canCreateRegionResult match {
case RegionCreationResult.Success =>
Button(
new IconItemStackBuilder(Material.WOOL, 11)
new IconItemStackBuilder(Material.LIGHT_BLUE_WOOL)
.title(s"${GREEN}保護作成")
.lore(List(s"${DARK_GREEN}保護作成可能です", s"$RED${UNDERLINE}クリックで作成"))
.build(),
Expand All @@ -257,14 +255,14 @@ object GridRegionMenu extends Menu {
)
case RegionCreationResult.WorldProhibitsRegionCreation =>
Button(
new IconItemStackBuilder(Material.WOOL, 14)
new IconItemStackBuilder(Material.RED_WOOL)
.title(s"${RED}保護作成")
.lore(List(s"$RED${UNDERLINE}このワールドでは保護を作成できません"))
.build()
)
case RegionCreationResult.Error =>
Button(
new IconItemStackBuilder(Material.WOOL, 1)
new IconItemStackBuilder(Material.RED_WOOL)
.title(s"${RED}以下の原因により保護の作成できません")
.lore(
List(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ object BukkitStaticGachaPrizeFactory extends StaticGachaPrizeFactory[ItemStack]
setItemMeta(meta)
}

override val expBottle: ItemStack = new ItemStack(Material.EXP_BOTTLE, 20)
override val expBottle: ItemStack = new ItemStack(Material.EXPERIENCE_BOTTLE, 20)

override val mineHeadItem: ItemStack =
new ItemStack(Material.CARROT_ON_A_STICK, 1, 1.toShort).tap { itemStack =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ import com.github.unchama.seichiassist.subsystems.gridregion.domain.CardinalDire
import com.github.unchama.seichiassist.subsystems.gridregion.domain.HorizontalAxisAlignedSubjectiveDirection.Ahead
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 org.bukkit.Location
import org.bukkit.entity.Player

Expand Down Expand Up @@ -72,21 +74,12 @@ class BukkitRegionOperations[F[_]: Sync](

override def tryCreatingSelectedWorldGuardRegion(player: Player): F[Unit] = for {
regionCount <- regionCountRepository(player).get
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))
regionCreateResult <- Sync[F].delay {
WorldEditWrapper
.getSelection(player)
.map { selection =>
val regionName = s"${player.getName}_${regionCount.value}"

WorldGuardWrapper.tryCreateRegion(
regionName,
player,
player.getWorld,
selection.getNativeMinimumPoint.toBlockVector,
selection.getNativeMaximumPoint.toBlockVector
)
}
.getOrElse(())
wgManager.addRegion(region)
}
_ <- regionCountRepository(player).update(_.increment)
} yield regionCreateResult
Expand All @@ -103,27 +96,18 @@ class BukkitRegionOperations[F[_]: Sync](
result <-
if (!SeichiAssist.seichiAssistConfig.isGridProtectionEnabled(world)) {
Sync[F].pure(RegionCreationResult.WorldProhibitsRegionCreation)
} else if (selection.isEmpty || wgManager.isEmpty) {
} else if (regionCount.value >= WorldGuardWrapper.getWorldMaxRegion(player.getWorld)) {
Sync[F].pure(RegionCreationResult.Error)
} else {
Sync[F].delay {
val regions = WorldGuardWrapper.getApplicableRegionCount(
world,
s"${player.getName}_${regionCount.value}",
selection.get.getNativeMinimumPoint.toBlockVector,
selection.get.getNativeMaximumPoint.toBlockVector
)
if (regions != 0) {
wgManager.getApplicableRegions(selection)
val maxRegionCount = WorldGuardWrapper.getWorldMaxRegion(world)
val regionCountPerPlayer = WorldGuardWrapper.getNumberOfRegions(player, world)

if (maxRegionCount >= 0 && regionCountPerPlayer >= maxRegionCount) {
RegionCreationResult.Error
} else {
val maxRegionCount = WorldGuardWrapper.getMaxRegionCount(player, world)
val regionCountPerPlayer = WorldGuardWrapper.getRegionCountOfPlayer(player, world)

if (maxRegionCount >= 0 && regionCountPerPlayer >= maxRegionCount) {
RegionCreationResult.Error
} else {
RegionCreationResult.Success
}
RegionCreationResult.Success
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,21 +111,12 @@ class MebiusCommandExecutorProvider(
val convertExecutor: ContextualExecutor = playerCommandBuilder.buildWith { context =>
val mainHand = context.sender.getInventory.getItemInMainHand

<<<<<<< HEAD
BukkitMebiusItemStackCodec.decodeMebiusProperty(mainHand) match {
case Some(property) =>
if (property.level.isMaximum) {
val newProperty = property.toggleForcedMaterial
val newItem =
BukkitMebiusItemStackCodec.materialize(newProperty, mainHand.getDurability)
=======
BukkitMebiusItemStackCodec.decodeMebiusProperty(mainHand) match {
case Some(property) =>
if (property.level.isMaximum) {
val newProperty = property.toggleForcedMaterial
val newItem =
BukkitMebiusItemStackCodec.materialize(newProperty)
>>>>>>> 39af292b1 (tidy up 1.18)

val newMaterialName = newProperty.forcedMaterial match {
case MebiusForcedMaterial.None => "ダイヤモンド"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.github.unchama.util.external

import com.sk89q.worldedit.bukkit.WorldEditPlugin
import com.sk89q.worldedit.bukkit.selections.Selection
import com.sk89q.worldedit.math.BlockVector3
import org.bukkit.entity.Player

object WorldEditWrapper {
Expand All @@ -14,6 +14,6 @@ object WorldEditWrapper {
/**
* @return `player`が選択している範囲
*/
def getSelection(player: Player): Option[Selection] = Option(plugin.getSelection(player))
def getSelection(player: Player): BlockVector3 = plugin.getSession(player).getPlacementPosition(plugin.wrapPlayer(player))

}
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
package com.github.unchama.util.external

import com.sk89q.worldedit.bukkit.BukkitAdapter
import com.sk89q.worldguard.{LocalPlayer, WorldGuard}
import com.sk89q.worldguard.protection.managers.RegionManager
import com.sk89q.worldguard.protection.regions.{ProtectedCuboidRegion, ProtectedRegion}
import com.sk89q.worldguard.protection.util.DomainInputResolver
import com.sk89q.worldguard.{LocalPlayer, WorldGuard}
import org.bukkit.entity.Player
import org.bukkit.{Location, World}

Expand Down

0 comments on commit 7d62907

Please sign in to comment.