From 98395542a507e40a9058d2ed6332853ec20b23fc Mon Sep 17 00:00:00 2001 From: Dico Date: Mon, 24 Sep 2018 09:09:23 +0100 Subject: Fix compile errors --- .../io/dico/parcels2/command/ParcelCommandReceivers.kt | 7 ++----- .../io/dico/parcels2/listener/ParcelEntityTracker.kt | 14 +++++++++++--- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/src/main/kotlin/io/dico/parcels2/command/ParcelCommandReceivers.kt b/src/main/kotlin/io/dico/parcels2/command/ParcelCommandReceivers.kt index 443adfb..0ef5264 100644 --- a/src/main/kotlin/io/dico/parcels2/command/ParcelCommandReceivers.kt +++ b/src/main/kotlin/io/dico/parcels2/command/ParcelCommandReceivers.kt @@ -30,10 +30,7 @@ annotation class SuspensionTimeout(val millis: Int) open class WorldScope(val world: ParcelWorld) : ICommandReceiver open class ParcelScope(val parcel: Parcel) : WorldScope(parcel.world) { - fun checkCanManage(player: Player, action: String) = Validate.isTrue( - player.hasPermAdminManage || parcel.hasPrivilegeToManage(player), - "You must own this parcel to $action" - ) + fun checkCanManage(player: Player, action: String) = Validate.isTrue(parcel.canManage(player), "You must own this parcel to $action") } fun getParcelCommandReceiver(parcelProvider: ParcelProvider, context: ExecutionContext, method: Method, cmdName: String): ICommandReceiver { @@ -65,7 +62,7 @@ fun ParcelProvider.getParcelRequired(player: Player, privilege: Privilege? = nul OWNER -> Validate.isTrue(parcel.isOwner(player.uuid), "You must own this parcel to use that command") CAN_MANAGE -> - Validate.isTrue(parcel.hasPrivilegeToManage(player), "You must have management privileges on this parcel to use that command") + Validate.isTrue(parcel.canManage(player), "You must have management privileges on this parcel to use that command") } } diff --git a/src/main/kotlin/io/dico/parcels2/listener/ParcelEntityTracker.kt b/src/main/kotlin/io/dico/parcels2/listener/ParcelEntityTracker.kt index eaacf93..3785770 100644 --- a/src/main/kotlin/io/dico/parcels2/listener/ParcelEntityTracker.kt +++ b/src/main/kotlin/io/dico/parcels2/listener/ParcelEntityTracker.kt @@ -3,7 +3,6 @@ package io.dico.parcels2.listener import io.dico.parcels2.Parcel import io.dico.parcels2.ParcelProvider import io.dico.parcels2.util.ext.editLoop -import io.dico.parcels2.util.ext.isPresentAnd import org.bukkit.entity.Entity class ParcelEntityTracker(val parcelProvider: ParcelProvider) { @@ -29,11 +28,20 @@ class ParcelEntityTracker(val parcelProvider: ParcelProvider) { if (entity.isDead) { remove(); return@editLoop } - if (parcel.isPresentAnd { hasBlockVisitors }) { + + if (parcel != null && parcel.hasBlockVisitors) { remove() + + val newParcel = parcelProvider.getParcelAt(entity.location) + if (newParcel !== parcel && !(newParcel != null && newParcel.hasBlockVisitors)) { + entity.remove() + } + + return@editLoop } + val newParcel = parcelProvider.getParcelAt(entity.location) - if (newParcel !== parcel && !newParcel.isPresentAnd { hasBlockVisitors }) { + if (newParcel !== parcel && !(newParcel != null && newParcel.hasBlockVisitors)) { remove() entity.remove() } -- cgit v1.2.3