Fix loading of underscored mobs-to-tame, fixes #2084

This commit is contained in:
PikaMug 2023-04-02 13:01:20 -04:00
parent 3c8acea21a
commit e5322074b8
1 changed files with 5 additions and 5 deletions

View File

@ -3413,18 +3413,18 @@ public class Quests extends JavaPlugin implements QuestsAPI {
final List<Integer> mobAmounts = config.getIntegerList("quests." + questKey + ".stages.ordered." final List<Integer> mobAmounts = config.getIntegerList("quests." + questKey + ".stages.ordered."
+ stageNum + ".mob-tame-amounts"); + stageNum + ".mob-tame-amounts");
for (final String mob : mobs) { for (final String mob : mobs) {
if (mob != null) { final EntityType type = MiscUtil.getProperMobType(mob);
final Class<? extends Entity> ec = EntityType.valueOf(mob.toUpperCase()) if (type != null) {
.getEntityClass(); final Class<? extends Entity> ec = type.getEntityClass();
if (ec != null && Tameable.class.isAssignableFrom(ec)) { if (ec != null && Tameable.class.isAssignableFrom(ec)) {
oStage.addMobToTame(EntityType.valueOf(mob.toUpperCase())); oStage.addMobToTame(type);
oStage.addMobNumToTame(mobAmounts.get(mobs.indexOf(mob))); oStage.addMobNumToTame(mobAmounts.get(mobs.indexOf(mob)));
} else { } else {
throw new StageFormatException("mobs-to-tame has invalid tameable mob " + mob, throw new StageFormatException("mobs-to-tame has invalid tameable mob " + mob,
quest, stageNum); quest, stageNum);
} }
} else { } else {
throw new StageFormatException("mobs-to-tame has invalid mob", quest, stageNum); throw new StageFormatException("mobs-to-tame has invalid mob name " + mob, quest, stageNum);
} }
} }
} else { } else {