mirror of
https://github.com/Artillex-Studios/AxMinions.git
synced 2024-11-29 12:45:18 +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.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 {
|
@ -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 {
|
@ -48,7 +48,7 @@ class AxMinionsCommand {
|
||||
receiver: Player
|
||||
) {
|
||||
AxMinionsAPI.INSTANCE.getMinions().fastFor {
|
||||
if(it.getOwnerUUID() == receiver.uniqueId) {
|
||||
if (it.getOwnerUUID() == receiver.uniqueId) {
|
||||
it.remove()
|
||||
}
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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()
|
||||
|
Loading…
Reference in New Issue
Block a user