Skip to content

Commit

Permalink
Add permission
Browse files Browse the repository at this point in the history
  • Loading branch information
SigureRuri committed May 21, 2022
1 parent 41aca50 commit e976435
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ plugins {
}

group = 'com.github.sigureruri'
version = '1.0-SNAPSHOT'
version = '1.1-SNAPSHOT'

repositories {
mavenCentral()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ class BlockListener : Listener {
if (blockOption.breakTool != itemInHand.type) return@forEach
if (blockOption.block != block.type) return@forEach

if (!event.player.hasPermission("ntublock.break.${blockOption.block.toString().lowercase()}")) return@forEach

block.type = Material.AIR

with(block.world) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,10 @@ class ParticleTask(private val player: Player, private val blockOption: BlockOpt
(-renderDistance..renderDistance).map { it + location.blockZ }.forEach { z ->
val searchedLocation = Location(location.world, x.toDouble(), y.toDouble(), z.toDouble())
if (searchedLocation.block.type == blockOption.block) {
val locationForParticle = searchedLocation.add(0.5, 0.5, 0.5)
player.spawnParticle(Particle.BLOCK_MARKER, locationForParticle, 1, searchedLocation.block.blockData)
if (player.hasPermission("ntublock.particle.${blockOption.block.toString().lowercase()}")) {
val locationForParticle = searchedLocation.add(0.5, 0.5, 0.5)
player.spawnParticle(Particle.BLOCK_MARKER, locationForParticle, 1, searchedLocation.block.blockData)
}
}
}
}
Expand Down

0 comments on commit e976435

Please sign in to comment.