Skip to content

Commit

Permalink
Get rid of unnecessary streams
Browse files Browse the repository at this point in the history
  • Loading branch information
Krakenied committed Aug 28, 2024
1 parent 4f254f5 commit c2cd690
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public FarmingTaskType(BukkitQuestsPlugin plugin) {
super.addConfigValidator(TaskUtils.useBooleanConfigValidator(this, "check-playerblocktracker"));
super.addConfigValidator(TaskUtils.useBooleanConfigValidator(this, "check-coreprotect"));
super.addConfigValidator(TaskUtils.useIntegerConfigValidator(this, "check-coreprotect-time"));
super.addConfigValidator(TaskUtils.useAcceptedValuesConfigValidator(this, Mode.STRING_MODE_MAP.keySet().stream().toList(), "mode"));
super.addConfigValidator(TaskUtils.useAcceptedValuesConfigValidator(this, Mode.STRING_MODE_MAP.keySet(), "mode"));
}

@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public WalkingTaskType(BukkitQuestsPlugin plugin) {

super.addConfigValidator(TaskUtils.useRequiredConfigValidator(this, "distance"));
super.addConfigValidator(TaskUtils.useIntegerConfigValidator(this, "distance"));
super.addConfigValidator(TaskUtils.useAcceptedValuesConfigValidator(this, Mode.STRING_MODE_MAP.keySet().stream().toList(), "mode"));
super.addConfigValidator(TaskUtils.useAcceptedValuesConfigValidator(this, Mode.STRING_MODE_MAP.keySet(), "mode"));
}

@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.UUID;

Expand Down Expand Up @@ -1064,7 +1065,7 @@ public static <T extends Enum<T>> TaskType.ConfigValidator useEnumConfigValidato
* @param paths a list of valid paths for task
* @return config validator
*/
public static TaskType.ConfigValidator useAcceptedValuesConfigValidator(TaskType type, List<String> acceptedValues, String... paths) {
public static TaskType.ConfigValidator useAcceptedValuesConfigValidator(TaskType type, Collection<String> acceptedValues, String... paths) {
return (config, problems) -> {
for (String path : paths) {
Object configObject = config.get(path);
Expand Down

0 comments on commit c2cd690

Please sign in to comment.