Skip to content

Commit

Permalink
Updated config.yml, added effects.use-setblock-break
Browse files Browse the repository at this point in the history
  • Loading branch information
WillFP committed Jul 13, 2023
1 parent c7dc332 commit bedffe5
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ object EffectTelekinesis : Effect<NoCompileData>("telekinesis") {
fun handle(event: EntityDeathByEntityEvent) {
val victim = event.victim

if (victim is Player && plugin.configYml.getBool("telekinesis.on-players")) {
if (victim is Player && plugin.configYml.getBool("effects.telekinesis.on-players")) {
return
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import com.willfp.libreforge.effects.Effect
import com.willfp.libreforge.plugin
import com.willfp.libreforge.triggers.TriggerData
import com.willfp.libreforge.triggers.TriggerParameter
import org.bukkit.Material
import org.bukkit.block.Block
import org.bukkit.entity.Player

Expand All @@ -20,11 +21,15 @@ abstract class MineBlockEffect<T : Any>(id: String) : Effect<T>(id) {
}

protected fun Player.breakBlocksSafely(blocks: Collection<Block>) {
this.runExempted {
for (block in blocks) {
block.setMetadata("block-ignore", plugin.createMetadataValue(true))
this.breakBlock(block)
block.removeMetadata("block-ignore", plugin)
if (plugin.configYml.getBool("effects.use-setblock-break")) {
blocks.forEach { it.type = Material.AIR }
} else {
this.runExempted {
for (block in blocks) {
block.setMetadata("block-ignore", plugin.createMetadataValue(true))
this.breakBlock(block)
block.removeMetadata("block-ignore", plugin)
}
}
}
}
Expand Down
14 changes: 12 additions & 2 deletions core/src/main/resources/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -91,5 +91,15 @@ point-names: # If you have point names that look ugly (e.g. souls) then you can

raytrace-distance: 80 # The distance that alt_click should check for a location

telekinesis:
on-players: true # Whether telekinesis should work on players
effects:
telekinesis:
on-players: true # Whether telekinesis should work on players

# If this is set to true, effects like mine_radius, drill, etc. will simply set the block to air
# instead of actually breaking it. This **will** break compatibility with things, but will also majorly
# improve performance under load.
# Setting this to true means that not only will mine_block and block_item_drop not be triggered, but also
# that other plugins will not be able to interact with the event (e.g. no skill experience will be gained).
# Only set this option to true if you know what you're doing!
use-setblock-break: false

0 comments on commit bedffe5

Please sign in to comment.