diff --git a/src/main/java/com/froobworld/farmcontrol/config/FcConfig.java b/src/main/java/com/froobworld/farmcontrol/config/FcConfig.java index 4e6b518..269486c 100644 --- a/src/main/java/com/froobworld/farmcontrol/config/FcConfig.java +++ b/src/main/java/com/froobworld/farmcontrol/config/FcConfig.java @@ -44,6 +44,9 @@ public static class WorldSettings extends ConfigSection { @Section(key = "exclusion-settings") public final ExclusionSettings exclusionSettings = new ExclusionSettings(); + @Section(key = "inclusion-settings") + public final InclusionSettings inclusionSettings = new InclusionSettings(); + @Section(key = "action-settings") public final ActionSettings actionSettings = new ActionSettings(); @@ -120,6 +123,14 @@ public static class ExclusionSettings extends ConfigSection { } + + public static class InclusionSettings extends ConfigSection { + + @Entry(key = "type") + public final ConfigEntry> type = ConfigEntries.stringListEntry(); + + } + public static class ActionSettings extends ConfigSection { @SectionMap(key = "undo-on", defaultKey = "default") diff --git a/src/main/java/com/froobworld/farmcontrol/controller/ExclusionManager.java b/src/main/java/com/froobworld/farmcontrol/controller/ExclusionManager.java index 6948eec..ad8924c 100644 --- a/src/main/java/com/froobworld/farmcontrol/controller/ExclusionManager.java +++ b/src/main/java/com/froobworld/farmcontrol/controller/ExclusionManager.java @@ -16,7 +16,9 @@ public ExclusionManager(FarmControl farmControl) { } public Predicate getExclusionPredicate(World world) { - FcConfig.WorldSettings.ExclusionSettings exclusionSettings = farmControl.getFcConfig().worldSettings.of(world).exclusionSettings; + var cfg = farmControl.getFcConfig().worldSettings.of(world); + FcConfig.WorldSettings.ExclusionSettings exclusionSettings = cfg.exclusionSettings; + FcConfig.WorldSettings.InclusionSettings inclusionSettings = cfg.inclusionSettings; boolean excludeLeashed = exclusionSettings.leashed.get(); boolean excludeLoveMode = exclusionSettings.loveMode.get(); List excludeMeta = exclusionSettings.metadata.get(); @@ -27,7 +29,14 @@ public Predicate getExclusionPredicate(World world) { long excludeTicksLived = exclusionSettings.youngerThan.get(); boolean excludePickupable = exclusionSettings.pickupable.get(); boolean excludeMounted = exclusionSettings.mounted.get(); + List alwaysIncludeType = inclusionSettings.type.get(); return snapshotEntity -> { + for (String type : alwaysIncludeType) { + if (snapshotEntity.getEntityType().toString().equalsIgnoreCase(type)) { + return false; + } + } + if (excludeLeashed && snapshotEntity.isLeashed()) { return true; } diff --git a/src/main/resources/resources/config.yml b/src/main/resources/resources/config.yml index e83019b..e575c06 100644 --- a/src/main/resources/resources/config.yml +++ b/src/main/resources/resources/config.yml @@ -94,6 +94,13 @@ world-settings: - trident # - villager + inclusion-settings: + # Which types of mobs should we always perform actions on, + # even if they would normally be excluded by the exclusion settings? + type: + - villager + + # For which metadata should we not perform actions on a mob? # * Some plugins will add metadata to mobs that they spawn or use. This setting allows you to exclude those mobs # from having actions performed on them by this plugin.