Fixed breaking crates

This commit is contained in:
Auxilor
2022-05-30 17:29:46 +01:00
parent d127844404
commit dcb294b75b

View File

@@ -3,6 +3,7 @@ package com.willfp.ecocrates.util
import com.willfp.eco.core.EcoPlugin
import com.willfp.ecocrates.crate.OpenMethod
import com.willfp.ecocrates.crate.placed.PlacedCrates
import org.bukkit.GameMode
import org.bukkit.event.EventHandler
import org.bukkit.event.Listener
import org.bukkit.event.block.Action
@@ -42,6 +43,11 @@ class PlacedCrateListener(
return
}
// Fix breaking
if (player.gameMode == GameMode.CREATIVE && player.isSneaking && event.action == Action.LEFT_CLICK_BLOCK) {
return
}
when (event.action) {
Action.LEFT_CLICK_BLOCK -> crate.previewForPlayer(player)
Action.RIGHT_CLICK_BLOCK -> crate.openPlaced(