Added blacklisted-blocks config option to Instantaneous enchantment

This commit is contained in:
_OfTeN_ 2021-11-05 20:18:04 +03:00
parent ac2a19ec07
commit 7ca5c7300a
2 changed files with 18 additions and 2 deletions

View File

@ -2,6 +2,7 @@ package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
import com.willfp.eco.core.integrations.anticheat.AnticheatManager;
import com.willfp.ecoenchants.enchantments.EcoEnchant;
import com.willfp.ecoenchants.enchantments.EcoEnchants;
import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils;
import org.bukkit.Material;
@ -10,6 +11,9 @@ import org.bukkit.entity.Player;
import org.bukkit.event.block.BlockDamageEvent;
import org.jetbrains.annotations.NotNull;
import java.util.ArrayList;
import java.util.List;
public class Instantaneous extends EcoEnchant {
public Instantaneous() {
super(
@ -39,7 +43,13 @@ public class Instantaneous extends EcoEnchant {
return;
}
if (block.getType() == Material.BEDROCK) {
List<Material> blacklist = new ArrayList<>();
for (String s : this.getConfig().getStrings(EcoEnchants.CONFIG_LOCATION + "blacklisted-blocks")) {
blacklist.add(Material.getMaterial(s));
}
if (blacklist.contains(block.getType())) {
return;
}

View File

@ -28,4 +28,10 @@ general-config:
maximum-level: 7
config:
chance-per-level: 3
chance-per-level: 3
blacklisted-blocks:
- BEDROCK
- OBSIDIAN
- END_PORTAL
- END_PORTAL_GATE
- NETHER_PORTAL