Only show tameable mobs in list, allow Llamas, fixes #298

This commit is contained in:
HappyPikachu 2018-02-18 15:28:11 -05:00
parent 0e362c8537
commit 9663756211
2 changed files with 6 additions and 7 deletions

View File

@ -66,6 +66,7 @@ import org.bukkit.conversations.StringPrompt;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.entity.Tameable;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.PlayerInventory;
@ -3031,7 +3032,7 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
List<String> mobs = config.getStringList("quests." + questName + ".stages.ordered." + s2 + ".mobs-to-tame");
List<Integer> mobAmounts = config.getIntegerList("quests." + questName + ".stages.ordered." + s2 + ".mob-tame-amounts");
for (String mob : mobs) {
if (mob.equalsIgnoreCase("Wolf") || mob.equalsIgnoreCase("Ocelot") || mob.equalsIgnoreCase("Horse") || mob.equalsIgnoreCase("Parrot")) {
if (Tameable.class.isAssignableFrom(EntityType.valueOf(mob.toUpperCase()).getEntityClass())) {
oStage.mobsToTame.put(EntityType.valueOf(mob.toUpperCase()), mobAmounts.get(mobs.indexOf(mob)));
} else {
stageFailed("" + mob + " inside mobs-to-tame: inside Stage " + s2 + " of Quest " + quest.name + " is not a valid tameable mob!");

View File

@ -31,6 +31,7 @@ import org.bukkit.conversations.StringPrompt;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.entity.Tameable;
import org.bukkit.inventory.ItemStack;
import me.blackvein.quests.CustomObjective;
@ -2915,15 +2916,12 @@ public class CreateStagePrompt extends FixedSetPrompt {
final EntityType[] mobArr = EntityType.values();
for (int i = 0; i < mobArr.length; i++) {
final EntityType type = mobArr[i];
if (type.isAlive() == false) {
if (type.isAlive() == false || Tameable.class.isAssignableFrom(type.getEntityClass()) == false) {
continue;
}
if (i < (mobArr.length - 1)) {
mobs += MiscUtil.getProperMobName(mobArr[i]) + ", ";
} else {
mobs += MiscUtil.getProperMobName(mobArr[i]) + "\n";
}
mobs += MiscUtil.getProperMobName(mobArr[i]) + ", ";
}
mobs = mobs.substring(0, mobs.length() - 2) + "\n";
return mobs + ChatColor.YELLOW + Lang.get("stageEditorMobsPrompt");
}