From c2cd69058cbdc0e2443f949e6d100e24b998ae53 Mon Sep 17 00:00:00 2001 From: Krakenied Date: Wed, 28 Aug 2024 02:30:47 +0200 Subject: [PATCH] Get rid of unnecessary streams --- .../quests/bukkit/tasktype/type/FarmingTaskType.java | 2 +- .../quests/bukkit/tasktype/type/WalkingTaskType.java | 2 +- .../java/com/leonardobishop/quests/bukkit/util/TaskUtils.java | 3 ++- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/bukkit/src/main/java/com/leonardobishop/quests/bukkit/tasktype/type/FarmingTaskType.java b/bukkit/src/main/java/com/leonardobishop/quests/bukkit/tasktype/type/FarmingTaskType.java index a84e17d5..1fa0bfcf 100644 --- a/bukkit/src/main/java/com/leonardobishop/quests/bukkit/tasktype/type/FarmingTaskType.java +++ b/bukkit/src/main/java/com/leonardobishop/quests/bukkit/tasktype/type/FarmingTaskType.java @@ -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) diff --git a/bukkit/src/main/java/com/leonardobishop/quests/bukkit/tasktype/type/WalkingTaskType.java b/bukkit/src/main/java/com/leonardobishop/quests/bukkit/tasktype/type/WalkingTaskType.java index bb7f7429..12e865a2 100644 --- a/bukkit/src/main/java/com/leonardobishop/quests/bukkit/tasktype/type/WalkingTaskType.java +++ b/bukkit/src/main/java/com/leonardobishop/quests/bukkit/tasktype/type/WalkingTaskType.java @@ -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) diff --git a/bukkit/src/main/java/com/leonardobishop/quests/bukkit/util/TaskUtils.java b/bukkit/src/main/java/com/leonardobishop/quests/bukkit/util/TaskUtils.java index a202a933..20a8354d 100644 --- a/bukkit/src/main/java/com/leonardobishop/quests/bukkit/util/TaskUtils.java +++ b/bukkit/src/main/java/com/leonardobishop/quests/bukkit/util/TaskUtils.java @@ -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; @@ -1064,7 +1065,7 @@ public static > TaskType.ConfigValidator useEnumConfigValidato * @param paths a list of valid paths for task * @return config validator */ - public static TaskType.ConfigValidator useAcceptedValuesConfigValidator(TaskType type, List acceptedValues, String... paths) { + public static TaskType.ConfigValidator useAcceptedValuesConfigValidator(TaskType type, Collection acceptedValues, String... paths) { return (config, problems) -> { for (String path : paths) { Object configObject = config.get(path);