Make block break whitelists / breakPlaceBlocks complement each other; resolves #616

This commit is contained in:
Daniel Saukel 2019-07-28 18:13:56 +02:00
parent a46ddbc1fc
commit 409de0d756

View File

@ -536,20 +536,15 @@ public class DGameWorld extends DInstanceWorld {
ExItem material = VanillaItem.get(block.getType()); ExItem material = VanillaItem.get(block.getType());
ExItem breakTool = caliburn.getExItem(player.getItemInHand()); ExItem breakTool = caliburn.getExItem(player.getItemInHand());
if (whitelist == null) { if (rules.canBreakPlacedBlocks() && placedBlocks.contains(block)) {
if (rules.canBreakPlacedBlocks()) {
return (!placedBlocks.contains(block));
} else if (rules.canBreakBlocks()) {
return false; return false;
} }
if (whitelist != null && whitelist.containsKey(material)
} else if (whitelist.containsKey(material) && whitelist.get(material) == null | whitelist.get(material).isEmpty() | whitelist.get(material).contains(breakTool)) { && (whitelist.get(material) == null
if (rules.canBreakPlacedBlocks()) { || whitelist.get(material).isEmpty()
return (!placedBlocks.contains(block)); || whitelist.get(material).contains(breakTool))) {
} else if (rules.canBreakBlocks()) {
return false; return false;
} }
}
return true; return true;
} }