Skip to content

Commit

Permalink
Merge pull request #253 from ToberoCat/projectile-protection
Browse files Browse the repository at this point in the history
Added projectile protection
  • Loading branch information
ToberoCat authored Dec 5, 2024
2 parents 7fab6dd + 2bf22f4 commit e066186
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package io.github.toberocat.improvedfactions.listeners.claim

import org.bukkit.entity.Player
import org.bukkit.event.EventHandler
import org.bukkit.event.entity.ProjectileHitEvent

class ClaimProjectileListener(zoneType: String) : ProtectionListener(zoneType) {
override fun namespace() = "projectiles"

@EventHandler
fun onProjectileHit(event: ProjectileHitEvent) {
val player = event.entity.shooter as? Player ?: return
protectChunk(event, event.entity, player)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ class ClaimProtectionListener(
register(ClaimEntityBreakHangingListener(zoneType))
register(ClaimEntitySpawnedByEggListener(zoneType))
register(ClaimArmorStandManipulateListener(zoneType))
register(ClaimProjectileListener(zoneType))
register(ClaimVehicleBreakListener(zoneType))

register(ClaimTntListener(zoneType))
Expand Down
6 changes: 6 additions & 0 deletions improved-factions/src/main/resources/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,7 @@ zones:

# Other protections
minecart-damage: true # Prevent minecarts being destroyed in a claim
projectiles: true # Prevent projectiles from damaging entities in a claim
safezone:
announce-title: true # True will allow this zone to send titles to the player - Faction claims and no faction claims
allow-claiming: false # Set to true will allow factions to claim their chunks in these regions
Expand Down Expand Up @@ -341,6 +342,8 @@ zones:
entity-interaction: true # Prevent interacting with entities in a claim
entity-break-hanging: true # Prevent breaking hanging entities (like paintings or itemframes) in a claim
entity-place: true # Prevent placing entities in a claim
projectiles: true # Prevent projectiles from damaging entities in a claim

warzone:
announce-title: true # True will allow this zone to send titles to the player - Faction claims and no faction claims
allow-claiming: false # Set to true will allow factions to claim their chunks in these regions
Expand Down Expand Up @@ -383,6 +386,8 @@ zones:
entity-interaction: true # Prevent interacting with entities in a claim
entity-break-hanging: true # Prevent breaking hanging entities (like paintings or itemframes) in a claim
entity-place: false # Prevent placing entities in a claim
projectiles: true # Prevent projectiles from damaging entities in a claim

unmanaged:
announce-title: false # True will allow this zone to send titles to the player - Faction claims and no faction claims
allow-claiming: false # Set to true will allow factions to claim their chunks in these regions
Expand Down Expand Up @@ -424,6 +429,7 @@ zones:
entity-interaction: false # Prevent interacting with entities in a claim
entity-break-hanging: false # Prevent breaking hanging entities (like paintings or itemframes) in a claim
entity-place: false # Prevent placing entities in a claim
projectiles: false # Prevent projectiles from damaging entities in a claim

performance:
thread-pool-size: 5 # Amount of thread that should be pooled waiting for operations
Expand Down
4 changes: 2 additions & 2 deletions improved-factions/version.properties
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#Thu Dec 05 21:04:31 CET 2024
buildIncrement=29
#Thu Dec 05 21:10:14 CET 2024
buildIncrement=30
versionName=2.3.0

0 comments on commit e066186

Please sign in to comment.