Fixed placed crates

This commit is contained in:
Auxilor
2022-05-01 21:19:31 +01:00
parent 60aa5692fe
commit 3b78d1416a

View File

@@ -1,7 +1,6 @@
package com.willfp.ecocrates.util
import com.willfp.eco.core.EcoPlugin
import com.willfp.eco.core.integrations.economy.EconomyManager
import com.willfp.ecocrates.crate.OpenMethod
import com.willfp.ecocrates.crate.placed.PlacedCrates
import org.bukkit.event.EventHandler
@@ -9,8 +8,7 @@ import org.bukkit.event.Listener
import org.bukkit.event.block.Action
import org.bukkit.event.block.BlockBreakEvent
import org.bukkit.event.player.PlayerInteractEvent
import org.bukkit.event.world.ChunkUnloadEvent
import java.util.UUID
import java.util.*
class PlacedCrateListener(
private val plugin: EcoPlugin
@@ -23,10 +21,6 @@ class PlacedCrateListener(
val player = event.player
val block = event.clickedBlock ?: return
if (player.isSneaking) {
return
}
if (preventDoubles.contains(player.uniqueId)) {
return
}
@@ -43,6 +37,11 @@ class PlacedCrateListener(
OpenMethod.MONEY
}
if (player.isSneaking) {
event.isCancelled = true
return
}
when (event.action) {
Action.LEFT_CLICK_BLOCK -> crate.previewForPlayer(player)
Action.RIGHT_CLICK_BLOCK -> crate.openPlaced(