summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDico Karssiens <dico.karssiens@gmail.com>2018-10-04 10:24:13 +0100
committerDico Karssiens <dico.karssiens@gmail.com>2018-10-04 10:24:13 +0100
commite55c595e54116961798cec03f6404d0c8d986e6d (patch)
tree0ef21b8f58d694c5a6a5b5455e501126a92dbb02 /src
parentc4801757a2fda147e1cee65f70f80fb215047525 (diff)
Tiny fixes
Diffstat (limited to 'src')
-rw-r--r--src/main/kotlin/io/dico/parcels2/command/ParcelParameterTypes.kt10
-rw-r--r--src/main/kotlin/io/dico/parcels2/listener/ParcelListeners.kt10
2 files changed, 17 insertions, 3 deletions
diff --git a/src/main/kotlin/io/dico/parcels2/command/ParcelParameterTypes.kt b/src/main/kotlin/io/dico/parcels2/command/ParcelParameterTypes.kt
index a9f5498..c7083a1 100644
--- a/src/main/kotlin/io/dico/parcels2/command/ParcelParameterTypes.kt
+++ b/src/main/kotlin/io/dico/parcels2/command/ParcelParameterTypes.kt
@@ -9,6 +9,7 @@ import io.dico.parcels2.*
import io.dico.parcels2.command.ProfileKind.Companion.ANY
import io.dico.parcels2.command.ProfileKind.Companion.FAKE
import io.dico.parcels2.command.ProfileKind.Companion.REAL
+import org.bukkit.Location
import org.bukkit.command.CommandSender
import org.bukkit.entity.Player
@@ -70,4 +71,13 @@ class ProfileParameterType : ParameterType<PlayerProfile, Int>(PlayerProfile::cl
return PlayerProfile.byName(input, allowReal, allowFake)
}
+ override fun complete(
+ parameter: Parameter<PlayerProfile, Int>,
+ sender: CommandSender,
+ location: Location?,
+ buffer: ArgumentBuffer
+ ): MutableList<String> {
+ logger.info("Completing PlayerProfile: ${buffer.next()}")
+ return super.complete(parameter, sender, location, buffer)
+ }
}
diff --git a/src/main/kotlin/io/dico/parcels2/listener/ParcelListeners.kt b/src/main/kotlin/io/dico/parcels2/listener/ParcelListeners.kt
index 59d10e7..9c9bdc2 100644
--- a/src/main/kotlin/io/dico/parcels2/listener/ParcelListeners.kt
+++ b/src/main/kotlin/io/dico/parcels2/listener/ParcelListeners.kt
@@ -266,6 +266,8 @@ class ParcelListeners(
}
}
+ // private val blockPlaceInteractItems = EnumSet.of(LAVA_BUCKET, WATER_BUCKET, BUCKET, FLINT_AND_STEEL)
+
@Suppress("NON_EXHAUSTIVE_WHEN")
private fun onPlayerRightClick(event: PlayerInteractEvent, world: ParcelWorld, parcel: Parcel?) {
if (event.hasItem()) {
@@ -275,9 +277,11 @@ class ParcelListeners(
event.isCancelled = true; return
}
- if (!canBuildOnArea(event.player, parcel)) {
- when (item) {
- LAVA_BUCKET, WATER_BUCKET, BUCKET, FLINT_AND_STEEL -> {
+ when (item) {
+ LAVA_BUCKET, WATER_BUCKET, BUCKET, FLINT_AND_STEEL -> {
+ val block = event.clickedBlock.getRelative(event.blockFace)
+ val otherParcel = world.getParcelAt(block)
+ if (!canBuildOnArea(event.player, otherParcel)) {
event.isCancelled = true
}
}