Skip to content

Commit

Permalink
Added Tameable entities to Entity#tryAsPlayer
Browse files Browse the repository at this point in the history
  • Loading branch information
WillFP committed Jan 3, 2022
1 parent 112d34d commit 9a1f999
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions eco-api/src/main/kotlin/com/willfp/libreforge/LibReforge.kt
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import org.bukkit.Bukkit
import org.bukkit.entity.Entity
import org.bukkit.entity.Player
import org.bukkit.entity.Projectile
import org.bukkit.entity.Tameable
import java.util.*

private val holderProviders = mutableSetOf<HolderProvider>()
Expand Down Expand Up @@ -209,6 +210,7 @@ fun Entity.tryAsPlayer(): Player? {
return when (this) {
is Projectile -> this.shooter as? Player
is Player -> this
is Tameable -> this.owner as? Player
else -> null
}
}

0 comments on commit 9a1f999

Please sign in to comment.