aboutsummaryrefslogtreecommitdiffstats
path: root/bukkit/src/main
diff options
context:
space:
mode:
authorCoolLord22 <mastermodmaker@yahoo.com>2021-08-11 17:14:37 -0400
committerLMBishop <13875753+LMBishop@users.noreply.github.com>2021-08-11 23:04:25 +0100
commit1527617700928f0c76367905b6bd5806a070106e (patch)
tree560fc385507c78d1684922faac0b07193cb9d24d /bukkit/src/main
parenta7c955e1384a2e85d96629919c54079d4668a32a (diff)
Remove Essentials dependent code and use plugin hook
Uses EssentialsHook to check if user is AFK. Requires task to have config option "ignore-afk" to be true in order to proceed; default fallback is false so this does not pose issues on servers w/o Essentials.
Diffstat (limited to 'bukkit/src/main')
-rw-r--r--bukkit/src/main/java/com/leonardobishop/quests/bukkit/tasktype/type/PlaytimeTaskType.java11
1 files changed, 5 insertions, 6 deletions
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 ab0fb9e3..598b7647 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
@@ -1,6 +1,5 @@
package com.leonardobishop.quests.bukkit.tasktype.type;
-import com.earth2me.essentials.Essentials;
import com.leonardobishop.quests.bukkit.BukkitQuestsPlugin;
import com.leonardobishop.quests.bukkit.tasktype.BukkitTaskType;
import com.leonardobishop.quests.bukkit.util.TaskUtils;
@@ -41,8 +40,6 @@ public final class PlaytimeTaskType extends BukkitTaskType {
@Override
public void onReady() {
- boolean ignoreAFK = plugin.getQuestsConfig().getBoolean("options.playtime-ignores-afk", false);
- Essentials ess = (Essentials) Bukkit.getPluginManager().getPlugin("Essentials");
if (this.poll == null) {
this.poll = new BukkitRunnable() {
@Override
@@ -52,14 +49,16 @@ public final class PlaytimeTaskType extends BukkitTaskType {
if (qPlayer == null) {
continue;
}
- if (ignoreAFK && ess != null && ess.getUser(player).isAfk()) {
- continue; // user is AFK so we will not track progress
- }
for (Quest quest : PlaytimeTaskType.super.getRegisteredQuests()) {
if (qPlayer.hasStartedQuest(quest)) {
QuestProgress questProgress = qPlayer.getQuestProgressFile().getQuestProgress(quest);
for (Task task : quest.getTasksOfType(PlaytimeTaskType.super.getType())) {
+ if ((boolean) task.getConfigValue("ignore-afk", false)
+ && plugin.getEssentialsHook() != null
+ && plugin.getEssentialsHook().isAfk(player)) {
+ continue;
+ }
if (!TaskUtils.validateWorld(player, task)) continue;
TaskProgress taskProgress = questProgress.getTaskProgress(task.getId());