diff options
| author | Krakenied <Krakenied1@gmail.com> | 2023-05-27 16:11:09 +0200 |
|---|---|---|
| committer | Krakenied <Krakenied1@gmail.com> | 2023-05-27 16:11:09 +0200 |
| commit | 924bba7da5912150c1273b0d0b32f23001dd1e6a (patch) | |
| tree | bbb00d0926d68caebe0a07d80ec5b0a07f5d1864 /bukkit/src/main/java | |
| parent | 5176fe2fbf7efcc0d48e2d6a417fba1eaeb4fd89 (diff) | |
Use getConfigBoolean method
Diffstat (limited to 'bukkit/src/main/java')
3 files changed, 10 insertions, 8 deletions
diff --git a/bukkit/src/main/java/com/leonardobishop/quests/bukkit/tasktype/type/BuildingTaskType.java b/bukkit/src/main/java/com/leonardobishop/quests/bukkit/tasktype/type/BuildingTaskType.java index 220818a5..1137a767 100644 --- a/bukkit/src/main/java/com/leonardobishop/quests/bukkit/tasktype/type/BuildingTaskType.java +++ b/bukkit/src/main/java/com/leonardobishop/quests/bukkit/tasktype/type/BuildingTaskType.java @@ -80,21 +80,23 @@ public final class BuildingTaskType extends BukkitTaskType { return; } + final Block block = event.getBlock(); + for (TaskUtils.PendingTask pendingTask : TaskUtils.getApplicableTasks(player, qPlayer, this, TaskUtils.TaskConstraint.WORLD)) { Quest quest = pendingTask.quest(); Task task = pendingTask.task(); TaskProgress taskProgress = pendingTask.taskProgress(); - super.debug("Player mined block " + event.getBlock().getType(), quest.getId(), task.getId(), event.getPlayer().getUniqueId()); + super.debug("Player mined block " + block.getType(), quest.getId(), task.getId(), event.getPlayer().getUniqueId()); - boolean reverseIfBroken = (boolean) task.getConfigValue("reverse-if-broken", false); + boolean reverseIfBroken = TaskUtils.getConfigBoolean(task, "reverse-if-broken"); if (!reverseIfBroken) { return; } super.debug("reverse-if-broken is enabled, checking block", quest.getId(), task.getId(), event.getPlayer().getUniqueId()); - if (!TaskUtils.matchBlock(this, pendingTask, event.getBlock(), player.getUniqueId())) { // TODO + if (!TaskUtils.matchBlock(this, pendingTask, block, player.getUniqueId())) { // TODO super.debug("Continuing...", quest.getId(), task.getId(), player.getUniqueId()); continue; } diff --git a/bukkit/src/main/java/com/leonardobishop/quests/bukkit/tasktype/type/MiningTaskType.java b/bukkit/src/main/java/com/leonardobishop/quests/bukkit/tasktype/type/MiningTaskType.java index 22e37fbb..18dab791 100644 --- a/bukkit/src/main/java/com/leonardobishop/quests/bukkit/tasktype/type/MiningTaskType.java +++ b/bukkit/src/main/java/com/leonardobishop/quests/bukkit/tasktype/type/MiningTaskType.java @@ -62,7 +62,7 @@ public final class MiningTaskType extends BukkitTaskType { super.debug("Player mined block " + material.name(), quest.getId(), task.getId(), event.getPlayer().getUniqueId()); - boolean allowSilkTouch = (boolean) task.getConfigValue("allow-silk-touch", true); + boolean allowSilkTouch = TaskUtils.getConfigBoolean(task, "allow-silk-touch", true); if (!allowSilkTouch && silkTouchPresent) { continue; } @@ -74,7 +74,7 @@ public final class MiningTaskType extends BukkitTaskType { continue; } - boolean playerBlockTrackerEnabled = (boolean) task.getConfigValue("check-playerblocktracker", false); + boolean playerBlockTrackerEnabled = TaskUtils.getConfigBoolean(task, "check-playerblocktracker"); if (playerBlockTrackerEnabled) { AbstractPlayerBlockTrackerHook playerBlockTrackerHook = plugin.getPlayerBlockTrackerHook(); @@ -104,7 +104,7 @@ public final class MiningTaskType extends BukkitTaskType { } }; - boolean coreProtectEnabled = (boolean) task.getConfigValue("check-coreprotect", false); + boolean coreProtectEnabled = TaskUtils.getConfigBoolean(task, "check-coreprotect"); int coreProtectTime = (int) task.getConfigValue("check-coreprotect-time", 3600); if (coreProtectEnabled) { @@ -159,7 +159,7 @@ public final class MiningTaskType extends BukkitTaskType { super.debug("Player placed block " + material.name(), quest.getId(), task.getId(), player.getUniqueId()); - boolean reverseIfPlaced = (boolean) task.getConfigValue("reverse-if-placed", false); + boolean reverseIfPlaced = TaskUtils.getConfigBoolean(task, "reverse-if-placed"); if (!reverseIfPlaced) { continue; } diff --git a/bukkit/src/main/java/com/leonardobishop/quests/bukkit/tasktype/type/PlaytimeTaskType.java b/bukkit/src/main/java/com/leonardobishop/quests/bukkit/tasktype/type/PlaytimeTaskType.java index 19c517cb..bccd7295 100644 --- a/bukkit/src/main/java/com/leonardobishop/quests/bukkit/tasktype/type/PlaytimeTaskType.java +++ b/bukkit/src/main/java/com/leonardobishop/quests/bukkit/tasktype/type/PlaytimeTaskType.java @@ -45,7 +45,7 @@ public final class PlaytimeTaskType extends BukkitTaskType { PlaytimeTaskType.super.debug("Polling playtime for player", quest.getId(), task.getId(), player.getUniqueId()); - boolean ignoreAfk = (boolean) task.getConfigValue("ignore-afk", false); + boolean ignoreAfk = TaskUtils.getConfigBoolean(task, "ignore-afk"); if (ignoreAfk && plugin.getEssentialsHook() == null) { PlaytimeTaskType.super.debug("ignore-afk is enabled, but Essentials is not detected on the server", quest.getId(), task.getId(), player.getUniqueId()); |
