mirror of
https://github.com/Xiao-MoMi/Custom-Crops.git
synced 2025-12-27 19:09:09 +00:00
Season condition should check the greenhouse
This commit is contained in:
@@ -421,17 +421,6 @@ public abstract class AbstractRequirementManager<T> implements RequirementManage
|
||||
}
|
||||
|
||||
protected void registerSeasonRequirement() {
|
||||
registerRequirement((args, actions, runActions) -> {
|
||||
Set<String> seasons = new HashSet<>(ListUtils.toList(args).stream().map(it -> it.toUpperCase(Locale.ENGLISH)).toList());
|
||||
return context -> {
|
||||
Location location = requireNonNull(context.arg(ContextKeys.LOCATION));
|
||||
Season season = plugin.getWorldManager().getSeason(location.getWorld());
|
||||
if (season == Season.DISABLE) return true;
|
||||
if (seasons.contains(season.name())) return true;
|
||||
if (runActions) ActionManager.trigger(context, actions);
|
||||
return false;
|
||||
};
|
||||
}, "season");
|
||||
registerRequirement((args, actions, runActions) -> {
|
||||
Set<String> seasons = new HashSet<>(ListUtils.toList(args).stream().map(it -> it.toUpperCase(Locale.ENGLISH)).toList());
|
||||
return context -> {
|
||||
@@ -468,7 +457,7 @@ public abstract class AbstractRequirementManager<T> implements RequirementManage
|
||||
if (runActions) ActionManager.trigger(context, actions);
|
||||
return false;
|
||||
};
|
||||
}, "suitable-season", "suitable_season");
|
||||
}, "suitable-season", "suitable_season", "season");
|
||||
registerRequirement((args, actions, runActions) -> {
|
||||
Set<String> seasons = new HashSet<>(ListUtils.toList(args).stream().map(it -> it.toUpperCase(Locale.ENGLISH)).toList());
|
||||
return context -> {
|
||||
|
||||
Reference in New Issue
Block a user