Skip to content
Draft
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
11 changes: 11 additions & 0 deletions src/main/java/com/froobworld/farmcontrol/config/FcConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down Expand Up @@ -120,6 +123,14 @@ public static class ExclusionSettings extends ConfigSection {

}


public static class InclusionSettings extends ConfigSection {

@Entry(key = "type")
public final ConfigEntry<List<String>> type = ConfigEntries.stringListEntry();

}

public static class ActionSettings extends ConfigSection {

@SectionMap(key = "undo-on", defaultKey = "default")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ public ExclusionManager(FarmControl farmControl) {
}

public Predicate<SnapshotEntity> 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<String> excludeMeta = exclusionSettings.metadata.get();
Expand All @@ -27,7 +29,14 @@ public Predicate<SnapshotEntity> getExclusionPredicate(World world) {
long excludeTicksLived = exclusionSettings.youngerThan.get();
boolean excludePickupable = exclusionSettings.pickupable.get();
boolean excludeMounted = exclusionSettings.mounted.get();
List<String> alwaysIncludeType = inclusionSettings.type.get();
return snapshotEntity -> {
for (String type : alwaysIncludeType) {
if (snapshotEntity.getEntityType().toString().equalsIgnoreCase(type)) {
return false;
}
}

if (excludeLeashed && snapshotEntity.isLeashed()) {
return true;
}
Expand Down
7 changes: 7 additions & 0 deletions src/main/resources/resources/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down