Skip to content

Commit

Permalink
Added EntityProvidedHolder
Browse files Browse the repository at this point in the history
  • Loading branch information
WillFP committed Jan 6, 2024
1 parent cb1366a commit 735ed00
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions core/src/main/kotlin/com/willfp/libreforge/Holder.kt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import com.willfp.eco.util.NamespacedKeyUtils
import com.willfp.libreforge.conditions.ConditionList
import com.willfp.libreforge.effects.EffectList
import org.bukkit.NamespacedKey
import org.bukkit.entity.Entity
import org.bukkit.entity.LivingEntity
import org.bukkit.entity.Player
import org.bukkit.inventory.ItemStack
import java.util.Objects
Expand Down Expand Up @@ -186,6 +188,27 @@ open class ItemProvidedHolder(
}
}

/**
* A provided holder for an entity.
*/
open class EntityProvidedHolder(
override val holder: Holder,
override val provider: Entity
) : ProvidedHolder {
override fun hashCode(): Int {
return Objects.hash(holder, provider)
}

override fun equals(other: Any?): Boolean {
if (other !is EntityProvidedHolder) {
return false
}

return other.holder == this.holder
&& other.provider == this.provider
}
}

// The current template ID, incremented every time a holder is created from a template.
private val currentTemplateID = AtomicInteger(0)

Expand Down

0 comments on commit 735ed00

Please sign in to comment.