All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.skillw.pouvoir.api.feature.selector.target.LocTarget.kt Maven / Gradle / Ivy

There is a newer version: 1.6.7-beta-6
Show newest version
package com.skillw.pouvoir.api.feature.selector.target

import com.skillw.pouvoir.api.feature.selector.Target
import org.bukkit.Location
import org.bukkit.entity.Entity
import org.bukkit.entity.LivingEntity

/**
 * @className EntityTarget
 *
 * @author Glom
 * @date 2023/1/9 7:36 Copyright 2024 Glom.
 */
open class LocTarget(location: Location) : Target("LocTarget$$location", location) {

    override fun equals(other: Any?): Boolean {
        if (this === other) return true
        if (other !is LocTarget) return false

        if (location != other.location) return false
        return true
    }

    override fun hashCode(): Int {
        return location.hashCode()
    }

    override fun toString(): String {
        return "LocTarget(loc=$location)"
    }

    companion object {
        fun Entity.targetLoc(): Location {
            return if (this is LivingEntity) eyeLocation.clone() else location.clone()
        }
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy