Skip to content

Commit

Permalink
Prevent some creative block pick false positives
Browse files Browse the repository at this point in the history
  • Loading branch information
NichtStudioCode committed Sep 26, 2024
1 parent ef7f400 commit 2632fae
Showing 1 changed file with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import org.bukkit.event.block.BlockPistonRetractEvent
import org.bukkit.event.entity.EntityChangeBlockEvent
import org.bukkit.event.entity.EntityExplodeEvent
import org.bukkit.event.inventory.InventoryCreativeEvent
import org.bukkit.event.inventory.InventoryType
import org.bukkit.inventory.EquipmentSlot
import org.bukkit.inventory.ItemStack
import xyz.xenondevs.nova.addon.AddonsInitializer
Expand Down Expand Up @@ -77,6 +78,9 @@ internal object BlockInteracting : Listener {

@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
private fun handleInventoryCreative(event: InventoryCreativeEvent) {
if (event.slotType != InventoryType.SlotType.QUICKBAR)
return

val player = event.whoClicked as Player
val reach = player.getAttribute(Attribute.PLAYER_BLOCK_INTERACTION_RANGE)?.value ?: 8.0
val rayTraceResult = player.rayTraceBlocks(reach)
Expand Down

0 comments on commit 2632fae

Please sign in to comment.