Skip to content

Commit

Permalink
refactor: swap to interaction-entity for furntiure seats
Browse files Browse the repository at this point in the history
  • Loading branch information
Boy0000 committed Oct 14, 2024
1 parent 6b52f4e commit 9fb338a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import org.bukkit.Location
import org.bukkit.Rotation
import org.bukkit.block.Block
import org.bukkit.block.BlockFace
import org.bukkit.entity.ArmorStand
import org.bukkit.entity.Interaction
import org.bukkit.entity.ItemDisplay
import org.bukkit.entity.ItemDisplay.ItemDisplayTransform.FIXED
import org.bukkit.entity.ItemDisplay.ItemDisplayTransform.NONE
Expand Down Expand Up @@ -100,14 +100,10 @@ object FurnitureHelpers {
furniture.toGeary().setPersisting(
BlockyAssociatedSeats(
seats.offsets.mapNotNull { seatOffset ->
furniture.location.add(seatOffset).spawn<ArmorStand> {
furniture.location.add(seatOffset).spawn<Interaction> {
isPersistent = false
isVisible = false
isMarker = true
isSilent = true
isSmall = true
setGravity(false)
setRotation(furniture.yaw, 0F)
interactionWidth = 0.1f
interactionHeight = 0.1f
}?.uniqueId
}.toMutableList()
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import io.th0rgal.protectionlib.ProtectionLib
import kotlinx.coroutines.delay
import org.bukkit.*
import org.bukkit.block.BlockFace
import org.bukkit.entity.ArmorStand
import org.bukkit.entity.Interaction
import org.bukkit.entity.ItemDisplay
import org.bukkit.entity.Player
import org.bukkit.event.Event
Expand Down Expand Up @@ -188,7 +188,7 @@ class BlockyFurnitureListener : Listener {

@EventHandler(priority = EventPriority.HIGHEST)
fun PlayerQuitEvent.onQuit() {
(player.vehicle as? ArmorStand)?.toGearyOrNull()?.get<BlockySeats>() ?: return
(player.vehicle as? Interaction)?.toGearyOrNull()?.get<BlockySeats>() ?: return
player.leaveVehicle()
}

Expand Down

0 comments on commit 9fb338a

Please sign in to comment.