diff --git a/api/src/main/kotlin/com/artillexstudios/axminions/api/events/MinionPreBreakEvent.kt b/api/src/main/kotlin/com/artillexstudios/axminions/api/events/PreMinionPickupEvent.kt similarity index 81% rename from api/src/main/kotlin/com/artillexstudios/axminions/api/events/MinionPreBreakEvent.kt rename to api/src/main/kotlin/com/artillexstudios/axminions/api/events/PreMinionPickupEvent.kt index 5c3f851..e966037 100644 --- a/api/src/main/kotlin/com/artillexstudios/axminions/api/events/MinionPreBreakEvent.kt +++ b/api/src/main/kotlin/com/artillexstudios/axminions/api/events/PreMinionPickupEvent.kt @@ -5,7 +5,7 @@ import org.bukkit.entity.Player import org.bukkit.event.Cancellable import org.bukkit.event.HandlerList -class MinionPreBreakEvent(private val player: Player, minion: Minion) : MinionEvent(minion), Cancellable { +class PreMinionPickupEvent(private val player: Player, minion: Minion) : MinionEvent(minion), Cancellable { companion object { private val handlerList = HandlerList() @@ -16,7 +16,7 @@ class MinionPreBreakEvent(private val player: Player, minion: Minion) : MinionEv private var isCancelled = false override fun getHandlers(): HandlerList { - return MinionPreBreakEvent.handlerList + return PreMinionPickupEvent.handlerList } fun getPlayer(): Player { diff --git a/api/src/main/kotlin/com/artillexstudios/axminions/api/events/MinionPrePlaceEvent.kt b/api/src/main/kotlin/com/artillexstudios/axminions/api/events/PreMinionPlaceEvent.kt similarity index 90% rename from api/src/main/kotlin/com/artillexstudios/axminions/api/events/MinionPrePlaceEvent.kt rename to api/src/main/kotlin/com/artillexstudios/axminions/api/events/PreMinionPlaceEvent.kt index 44f0fc7..bf536c7 100644 --- a/api/src/main/kotlin/com/artillexstudios/axminions/api/events/MinionPrePlaceEvent.kt +++ b/api/src/main/kotlin/com/artillexstudios/axminions/api/events/PreMinionPlaceEvent.kt @@ -6,7 +6,7 @@ import org.bukkit.event.Cancellable import org.bukkit.event.Event import org.bukkit.event.HandlerList -class MinionPrePlaceEvent(private val player: Player, private val location: Location) : Cancellable, Event() { +class PreMinionPlaceEvent(private val player: Player, private val location: Location) : Cancellable, Event() { companion object { private val handlerList = HandlerList() @@ -18,7 +18,7 @@ class MinionPrePlaceEvent(private val player: Player, private val location: Loca private var shouldOverridePlayerLimit = false override fun getHandlers(): HandlerList { - return MinionPrePlaceEvent.handlerList + return PreMinionPlaceEvent.handlerList } override fun isCancelled(): Boolean { diff --git a/common/src/main/kotlin/com/artillexstudios/axminions/commands/AxMinionsCommand.kt b/common/src/main/kotlin/com/artillexstudios/axminions/commands/AxMinionsCommand.kt index a38d778..728e906 100644 --- a/common/src/main/kotlin/com/artillexstudios/axminions/commands/AxMinionsCommand.kt +++ b/common/src/main/kotlin/com/artillexstudios/axminions/commands/AxMinionsCommand.kt @@ -48,7 +48,7 @@ class AxMinionsCommand { receiver: Player ) { AxMinionsAPI.INSTANCE.getMinions().fastFor { - if(it.getOwnerUUID() == receiver.uniqueId) { + if (it.getOwnerUUID() == receiver.uniqueId) { it.remove() } } diff --git a/common/src/main/kotlin/com/artillexstudios/axminions/listeners/MinionPlaceListener.kt b/common/src/main/kotlin/com/artillexstudios/axminions/listeners/MinionPlaceListener.kt index bdf9e7f..3ce0552 100644 --- a/common/src/main/kotlin/com/artillexstudios/axminions/listeners/MinionPlaceListener.kt +++ b/common/src/main/kotlin/com/artillexstudios/axminions/listeners/MinionPlaceListener.kt @@ -20,7 +20,7 @@ import org.bukkit.event.player.PlayerInteractEvent import org.bukkit.inventory.ItemStack import org.bukkit.persistence.PersistentDataType import org.bukkit.event.block.BlockPlaceEvent -import com.artillexstudios.axminions.api.events.MinionPrePlaceEvent +import com.artillexstudios.axminions.api.events.PreMinionPlaceEvent import org.bukkit.Bukkit class MinionPlaceListener : Listener { @@ -47,7 +47,7 @@ class MinionPlaceListener : Listener { return } - val prePlaceEvent = MinionPrePlaceEvent(event.player, event.clickedBlock!!.location) + val prePlaceEvent = PreMinionPlaceEvent(event.player, event.clickedBlock!!.location) val level = meta.persistentDataContainer.get(Keys.LEVEL, PersistentDataType.INTEGER) ?: 0 val stats = meta.persistentDataContainer.get(Keys.STATISTICS, PersistentDataType.LONG) ?: 0 @@ -61,7 +61,7 @@ class MinionPlaceListener : Listener { if (meta.persistentDataContainer.has(Keys.PLACED, PersistentDataType.BYTE)) return Bukkit.getPluginManager().callEvent(prePlaceEvent) - if(prePlaceEvent.isCancelled) return + if (prePlaceEvent.isCancelled) return meta.persistentDataContainer.set(Keys.PLACED, PersistentDataType.BYTE, 0) item.itemMeta = meta diff --git a/common/src/main/kotlin/com/artillexstudios/axminions/minions/Minion.kt b/common/src/main/kotlin/com/artillexstudios/axminions/minions/Minion.kt index 4758f4c..84ba82e 100644 --- a/common/src/main/kotlin/com/artillexstudios/axminions/minions/Minion.kt +++ b/common/src/main/kotlin/com/artillexstudios/axminions/minions/Minion.kt @@ -16,8 +16,7 @@ import com.artillexstudios.axminions.AxMinionsPlugin import com.artillexstudios.axminions.api.AxMinionsAPI import com.artillexstudios.axminions.api.config.Config import com.artillexstudios.axminions.api.config.Messages -import com.artillexstudios.axminions.api.events.MinionPreBreakEvent -import com.artillexstudios.axminions.api.events.MinionPrePlaceEvent +import com.artillexstudios.axminions.api.events.PreMinionPickupEvent import com.artillexstudios.axminions.api.minions.Direction import com.artillexstudios.axminions.api.minions.Minion import com.artillexstudios.axminions.api.minions.miniontype.MinionType @@ -41,7 +40,6 @@ import org.bukkit.block.Container import org.bukkit.enchantments.Enchantment import org.bukkit.entity.EntityType import org.bukkit.entity.Player -import org.bukkit.inventory.CreativeCategory import org.bukkit.inventory.Inventory import org.bukkit.inventory.ItemStack import org.bukkit.inventory.meta.Damageable @@ -166,9 +164,9 @@ class Minion( } private fun breakMinion(event: PacketEntityInteractEvent) { - val preBreakEvent = MinionPreBreakEvent(event.player, this) + val preBreakEvent = PreMinionPickupEvent(event.player, this) Bukkit.getPluginManager().callEvent(preBreakEvent) - if(preBreakEvent.isCancelled) return + if (preBreakEvent.isCancelled) return LinkingListener.linking.remove(event.player) remove()