Archived
0

Tiny fixes

This commit is contained in:
Dico Karssiens
2018-10-04 10:24:13 +01:00
parent c4801757a2
commit e55c595e54
5 changed files with 54 additions and 10 deletions

View File

@@ -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)
}
}

View File

@@ -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
}
}