Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion src/main/kotlin/net/pdevita/creeperheal2/CreeperHeal2.kt
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,10 @@ import net.pdevita.creeperheal2.core.ExplosionManager
import net.pdevita.creeperheal2.core.Gravity
import net.pdevita.creeperheal2.listeners.Explode
import net.pdevita.creeperheal2.utils.Stats
import org.bukkit.Material
import org.bukkit.block.Block
import org.bukkit.entity.Entity
import org.bukkit.inventory.ItemStack
import org.bukkit.plugin.java.JavaPlugin
import java.io.File
import java.util.*
Expand Down Expand Up @@ -68,7 +70,19 @@ class CreeperHeal2 : JavaPlugin() {
return null
}

val newBlockList = LinkedList(blockList.filter { settings.blockList.allowMaterial(it.type) })
val newBlockList = LinkedList<Block>()
for (block in blockList) {
if (settings.blockList.allowMaterial(block.type)) {
if (block.type != Material.BEDROCK && block.type != Material.AIR && block.type != Material.WATER) {
newBlockList.add(block)
}
} else {
if (settings.general.dropBlacklisted) {
block.breakNaturally()
block.world.dropItemNaturally(block.location, ItemStack(block.type))
}
}
}

if (newBlockList.isEmpty()) {
return null
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ class General(config: FileConfiguration) {
val turboCap = config.getInt("turbo-cap", 10).coerceAtMost(1000)
val entityType = config.getBoolean("entity-type", true)
val disableContainers = config.getBoolean("disable-containers", false)
val dropBlacklisted = config.getBoolean("always-drop-blacklisted-items", false)
}

class ExplosionTypes(config: FileConfiguration) {
Expand Down
4 changes: 3 additions & 1 deletion src/main/resources/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ disable-containers: false
# Support entity-type blocks (Paintings, Item Frames, Armor Stands)
entity-type: true

always-drop-blacklisted-items: false

# Turbo Mode
# Turbo Mode can help repair larger explosions faster.
# The minimum number of blocks an explosion should involve before turbo mode is activated
Expand Down Expand Up @@ -64,4 +66,4 @@ factions:
bstats: true

# Enable debug mode
debug: false
debug: false