Skip to content

Commit

Permalink
Remove some unnecessary limitations on faction's land (#1762)
Browse files Browse the repository at this point in the history
  • Loading branch information
Tems-py authored Oct 29, 2023
1 parent 2c9e56b commit af5b7d8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package com.dansplugins.factionsystem.listener
import com.dansplugins.factionsystem.MedievalFactions
import com.dansplugins.factionsystem.player.MfPlayer
import com.dansplugins.factionsystem.relationship.MfFactionRelationshipType
import org.bukkit.entity.Monster
import org.bukkit.entity.Player
import org.bukkit.entity.Projectile
import org.bukkit.event.EventHandler
Expand Down Expand Up @@ -32,6 +33,7 @@ class EntityDamageByEntityListener(private val plugin: MedievalFactions) : Liste
val damagedFaction = factionService.getFaction(claim.factionId) ?: return
if (!damagedFaction.flags[plugin.flags.enableMobProtection]) return
if (damagerFaction?.id == damagedFaction.id) return
if (damaged is Monster) return
event.isCancelled = true
return
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,10 @@ class PlayerInteractListener(private val plugin: MedievalFactions) : Listener {
val claim = claimService.getClaim(clickedBlock.chunk) ?: return
val factionService = plugin.services.factionService
val claimFaction = factionService.getFaction(claim.factionId) ?: return
val item = event.item
if (item != null) {
if (item.type.isEdible && !clickedBlock.type.isInteractable) return
}
if (!claimService.isInteractionAllowed(mfPlayer.id, claim)) {
if (mfPlayer.isBypassEnabled && event.player.hasPermission("mf.bypass")) {
event.player.sendMessage("$RED${plugin.language["FactionTerritoryProtectionBypassed"]}")
Expand Down

0 comments on commit af5b7d8

Please sign in to comment.