summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDico <dico.karssiens@gmail.com>2018-09-24 09:09:23 +0100
committerDico <dico.karssiens@gmail.com>2018-09-24 09:09:23 +0100
commit98395542a507e40a9058d2ed6332853ec20b23fc (patch)
treec823479c6553b624b6214504d9fb21647839e86a
parentf2d88b3c54c83f1b826ebb3e483c599b64ad39bf (diff)
Fix compile errors
-rw-r--r--src/main/kotlin/io/dico/parcels2/command/ParcelCommandReceivers.kt7
-rw-r--r--src/main/kotlin/io/dico/parcels2/listener/ParcelEntityTracker.kt14
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()
}