diff options
| author | LMBishop <13875753+LMBishop@users.noreply.github.com> | 2021-06-05 15:14:40 +0100 |
|---|---|---|
| committer | LMBishop <13875753+LMBishop@users.noreply.github.com> | 2021-06-05 15:18:26 +0100 |
| commit | abb8c9c40cea3e252b6ad503a104181b957f34e0 (patch) | |
| tree | d07f1f00491e518bee87d27e70db53918648baad /src | |
| parent | 69ae583cfcee66f9edc78be8c38211335d4d32d3 (diff) | |
Add min-level to mythic mobs task type
- Closes #175
Diffstat (limited to 'src')
| -rw-r--r-- | src/main/java/com/leonardobishop/quests/quest/tasktype/type/dependent/MythicMobsKillingType.java | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/main/java/com/leonardobishop/quests/quest/tasktype/type/dependent/MythicMobsKillingType.java b/src/main/java/com/leonardobishop/quests/quest/tasktype/type/dependent/MythicMobsKillingType.java index 74b870d9..995a1345 100644 --- a/src/main/java/com/leonardobishop/quests/quest/tasktype/type/dependent/MythicMobsKillingType.java +++ b/src/main/java/com/leonardobishop/quests/quest/tasktype/type/dependent/MythicMobsKillingType.java @@ -28,6 +28,7 @@ public final class MythicMobsKillingType extends TaskType { super("mythicmobs_killing", TaskUtils.TASK_ATTRIBUTION_STRING, "Kill a set amount of a MythicMobs entity."); this.creatorConfigValues.add(new ConfigValue("amount", true, "Amount of mobs to be killed.")); this.creatorConfigValues.add(new ConfigValue("name", true, "The 'internal name' of the MythicMob.")); + this.creatorConfigValues.add(new ConfigValue("min-level", true, "The minimum level for the MythicMob.")); } @Override @@ -36,6 +37,7 @@ public final class MythicMobsKillingType extends TaskType { TaskUtils.configValidateExists(root + ".name", config.get("name"), problems, "name", super.getType()); if (TaskUtils.configValidateExists(root + ".amount", config.get("amount"), problems, "amount", super.getType())) TaskUtils.configValidateInt(root + ".amount", config.get("amount"), problems, false, true, "amount"); + TaskUtils.configValidateInt(root + ".min-level", config.get("min-level"), problems, true, true, "min-level"); return problems; } @@ -58,6 +60,7 @@ public final class MythicMobsKillingType extends TaskType { } String mobName = event.getMobType().getInternalName(); + double level = event.getMobLevel(); QPlayer qPlayer = QuestsAPI.getPlayerManager().getPlayer(killer.getUniqueId()); if (qPlayer == null) { @@ -78,8 +81,9 @@ public final class MythicMobsKillingType extends TaskType { } String configName = (String) task.getConfigValue("name"); + int minMobLevel = (int) task.getConfigValue("min-level", -1); - if (!mobName.equals(configName)) { + if (!mobName.equals(configName) || level < minMobLevel) { return; } |
