Added option to prerequisite for always fail

This commit is contained in:
Alexander B
2021-01-05 23:03:22 +01:00
parent a2e4ba1c9d
commit 3fe40117c6
2 changed files with 19 additions and 1 deletions

View File

@@ -47,9 +47,14 @@ public class OnBlockBreak implements Listener {
// # Break-Prerequisite
ConfigurationSection breakPreConfig = Main.config.getConfigurationSection("break.break-prerequisite."+ bSource);
boolean success = true;
// CanBreak
if(!breakPreConfig.getBoolean("canBreak"))
success = false;
// Allowed-items
List<String> allowed_items = (List<String>) breakPreConfig.getList("allowed-items");
if(allowed_items != null){
if(success && allowed_items != null){
boolean found = false;
for(String allowed_item : allowed_items){
if(p.getItemInHand().getType().name().equalsIgnoreCase(allowed_item)){
@@ -95,6 +100,11 @@ public class OnBlockBreak implements Listener {
// # Drop-Prerequisite
ConfigurationSection dropPreConfig = Main.config.getConfigurationSection("break.drop-prerequisite."+ bSource);
boolean success = true;
// WillDrop
if(!dropPreConfig.getBoolean("willDrop"))
success = false;
// Allowed-items
List<String> allowed_items = (List<String>) dropPreConfig.getList("allowed-items");
if(allowed_items != null){