Skip to content

Commit

Permalink
Prevent filling bucket on claimed land
Browse files Browse the repository at this point in the history
  • Loading branch information
Tems-py committed Nov 2, 2023
1 parent d27f785 commit edbe215
Showing 1 changed file with 13 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,12 @@ import org.bukkit.ChatColor
import org.bukkit.event.EventHandler
import org.bukkit.event.Listener
import org.bukkit.event.player.PlayerBucketEmptyEvent
import org.bukkit.event.player.PlayerBucketEvent
import org.bukkit.event.player.PlayerBucketFillEvent
import java.util.logging.Level

class PlayerBucketListener(private val plugin: MedievalFactions) : Listener {
@EventHandler
fun playerBucketEmptyEvent(event: PlayerBucketEmptyEvent) {
fun handleProtection(event: PlayerBucketEvent) {
val gateService = plugin.services.gateService
val blockPosition = MfBlockPosition.fromBukkitBlock(event.block)
val gates = gateService.getGatesAt(blockPosition)
Expand Down Expand Up @@ -51,4 +52,14 @@ class PlayerBucketListener(private val plugin: MedievalFactions) : Listener {
}
}
}

@EventHandler
fun playerBuckeEmptytEvent(event: PlayerBucketEmptyEvent) {
handleProtection(event)
}

@EventHandler
fun playerBucketFillEvent(event: PlayerBucketFillEvent) {
handleProtection(event)
}
}

0 comments on commit edbe215

Please sign in to comment.