From 5176fe2fbf7efcc0d48e2d6a417fba1eaeb4fd89 Mon Sep 17 00:00:00 2001 From: Krakenied Date: Sat, 27 May 2023 16:01:17 +0200 Subject: Improve getConfigBoolean method --- .../java/com/leonardobishop/quests/bukkit/util/TaskUtils.java | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) (limited to 'bukkit/src') 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 cdfd4db3..cce1a4e3 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 @@ -81,13 +81,7 @@ public class TaskUtils { } public static boolean getConfigBoolean(Task task, String key, boolean def) { - Object configObject = task.getConfigValue(key); - - boolean bool = def; - if (configObject != null) { - bool = (boolean) task.getConfigValue(key, def); - } - return bool; + return task.getConfigValue(key) instanceof Boolean configBoolean ? configBoolean : def; } public static QuestItem getConfigQuestItem(Task task, String itemKey, String dataKey) { -- cgit v1.2.3-70-g09d2