mirror of
https://github.com/Artillex-Studios/AxMinions.git
synced 2024-12-01 13:03:43 +01:00
requested changes
This commit is contained in:
parent
0d2725ec8d
commit
d26f2c0da0
@ -5,7 +5,7 @@ import org.bukkit.entity.Player
|
|||||||
import org.bukkit.event.Cancellable
|
import org.bukkit.event.Cancellable
|
||||||
import org.bukkit.event.HandlerList
|
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 {
|
companion object {
|
||||||
private val handlerList = HandlerList()
|
private val handlerList = HandlerList()
|
||||||
|
|
||||||
@ -16,7 +16,7 @@ class MinionPreBreakEvent(private val player: Player, minion: Minion) : MinionEv
|
|||||||
private var isCancelled = false
|
private var isCancelled = false
|
||||||
|
|
||||||
override fun getHandlers(): HandlerList {
|
override fun getHandlers(): HandlerList {
|
||||||
return MinionPreBreakEvent.handlerList
|
return PreMinionPickupEvent.handlerList
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getPlayer(): Player {
|
fun getPlayer(): Player {
|
@ -6,7 +6,7 @@ import org.bukkit.event.Cancellable
|
|||||||
import org.bukkit.event.Event
|
import org.bukkit.event.Event
|
||||||
import org.bukkit.event.HandlerList
|
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 {
|
companion object {
|
||||||
private val handlerList = HandlerList()
|
private val handlerList = HandlerList()
|
||||||
|
|
||||||
@ -18,7 +18,7 @@ class MinionPrePlaceEvent(private val player: Player, private val location: Loca
|
|||||||
private var shouldOverridePlayerLimit = false
|
private var shouldOverridePlayerLimit = false
|
||||||
|
|
||||||
override fun getHandlers(): HandlerList {
|
override fun getHandlers(): HandlerList {
|
||||||
return MinionPrePlaceEvent.handlerList
|
return PreMinionPlaceEvent.handlerList
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun isCancelled(): Boolean {
|
override fun isCancelled(): Boolean {
|
@ -20,7 +20,7 @@ import org.bukkit.event.player.PlayerInteractEvent
|
|||||||
import org.bukkit.inventory.ItemStack
|
import org.bukkit.inventory.ItemStack
|
||||||
import org.bukkit.persistence.PersistentDataType
|
import org.bukkit.persistence.PersistentDataType
|
||||||
import org.bukkit.event.block.BlockPlaceEvent
|
import org.bukkit.event.block.BlockPlaceEvent
|
||||||
import com.artillexstudios.axminions.api.events.MinionPrePlaceEvent
|
import com.artillexstudios.axminions.api.events.PreMinionPlaceEvent
|
||||||
import org.bukkit.Bukkit
|
import org.bukkit.Bukkit
|
||||||
|
|
||||||
class MinionPlaceListener : Listener {
|
class MinionPlaceListener : Listener {
|
||||||
@ -47,7 +47,7 @@ class MinionPlaceListener : Listener {
|
|||||||
return
|
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 level = meta.persistentDataContainer.get(Keys.LEVEL, PersistentDataType.INTEGER) ?: 0
|
||||||
val stats = meta.persistentDataContainer.get(Keys.STATISTICS, PersistentDataType.LONG) ?: 0
|
val stats = meta.persistentDataContainer.get(Keys.STATISTICS, PersistentDataType.LONG) ?: 0
|
||||||
|
@ -16,8 +16,7 @@ import com.artillexstudios.axminions.AxMinionsPlugin
|
|||||||
import com.artillexstudios.axminions.api.AxMinionsAPI
|
import com.artillexstudios.axminions.api.AxMinionsAPI
|
||||||
import com.artillexstudios.axminions.api.config.Config
|
import com.artillexstudios.axminions.api.config.Config
|
||||||
import com.artillexstudios.axminions.api.config.Messages
|
import com.artillexstudios.axminions.api.config.Messages
|
||||||
import com.artillexstudios.axminions.api.events.MinionPreBreakEvent
|
import com.artillexstudios.axminions.api.events.PreMinionPickupEvent
|
||||||
import com.artillexstudios.axminions.api.events.MinionPrePlaceEvent
|
|
||||||
import com.artillexstudios.axminions.api.minions.Direction
|
import com.artillexstudios.axminions.api.minions.Direction
|
||||||
import com.artillexstudios.axminions.api.minions.Minion
|
import com.artillexstudios.axminions.api.minions.Minion
|
||||||
import com.artillexstudios.axminions.api.minions.miniontype.MinionType
|
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.enchantments.Enchantment
|
||||||
import org.bukkit.entity.EntityType
|
import org.bukkit.entity.EntityType
|
||||||
import org.bukkit.entity.Player
|
import org.bukkit.entity.Player
|
||||||
import org.bukkit.inventory.CreativeCategory
|
|
||||||
import org.bukkit.inventory.Inventory
|
import org.bukkit.inventory.Inventory
|
||||||
import org.bukkit.inventory.ItemStack
|
import org.bukkit.inventory.ItemStack
|
||||||
import org.bukkit.inventory.meta.Damageable
|
import org.bukkit.inventory.meta.Damageable
|
||||||
@ -166,7 +164,7 @@ class Minion(
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun breakMinion(event: PacketEntityInteractEvent) {
|
private fun breakMinion(event: PacketEntityInteractEvent) {
|
||||||
val preBreakEvent = MinionPreBreakEvent(event.player, this)
|
val preBreakEvent = PreMinionPickupEvent(event.player, this)
|
||||||
Bukkit.getPluginManager().callEvent(preBreakEvent)
|
Bukkit.getPluginManager().callEvent(preBreakEvent)
|
||||||
if (preBreakEvent.isCancelled) return
|
if (preBreakEvent.isCancelled) return
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user