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 authored and renbinden committed Nov 5, 2023
1 parent 8230fea commit 0c63f9c
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 0c63f9c

Please sign in to comment.