Correct comparison of some Potion types, fixes #952

This commit is contained in:
PikaMug 2019-10-07 19:55:05 -04:00
parent 5739ce80a9
commit 79f97e8c98
3 changed files with 6 additions and 4 deletions

View File

@ -2165,9 +2165,10 @@ public class Quester {
ItemStack is = getCurrentStage(quest).itemsToBrew.get(getCurrentStage(quest).itemsToBrew.indexOf(goal));
String message = ChatColor.GREEN + "(" + Lang.get(p, "completed") + ") " + Lang.get(p, "brew") + " <item> "
+ is.getAmount() + "/" + is.getAmount();
if (plugin.getSettings().canTranslateItems() && !increment.hasItemMeta()
if (plugin.getSettings().canTranslateItems() && goal.hasItemMeta()
&& !increment.getItemMeta().hasDisplayName()) {
plugin.getLocaleQuery().sendMessage(p, message, goal.getType(), goal.getDurability(), null);
plugin.getLocaleQuery().sendMessage(p, message, goal.getType(), goal.getDurability(), null,
goal.getItemMeta());
} else {
p.sendMessage(message.replace("<item>", ItemUtil.getName(is)));
}

View File

@ -116,7 +116,7 @@ public class ItemUtil {
// Bukkit version is 1.9+
if (one.getType().equals(Material.POTION) || one.getType().equals(Material.LINGERING_POTION) || one.getType().equals(Material.SPLASH_POTION)) {
PotionMeta pmeta1 = (PotionMeta) one.getItemMeta();
PotionMeta pmeta2 = (PotionMeta) one.getItemMeta();
PotionMeta pmeta2 = (PotionMeta) two.getItemMeta();
if (pmeta1.getBasePotionData().getType().equals(pmeta2.getBasePotionData().getType()) == false) {
return -9;
}

View File

@ -137,7 +137,8 @@ public class LocaleQuery {
return false;
}
if (meta != null && meta instanceof PotionMeta) {
matKey = "item.minecraft.potion.effect." + ((PotionMeta)meta).getBasePotionData().getType().name().toLowerCase();
matKey = "item.minecraft.potion.effect." + ((PotionMeta)meta).getBasePotionData().getType().name().toLowerCase()
.replace("regen", "regeneration").replace("speed", "swiftness");
}
if (enchantments != null && !enchantments.isEmpty()) {
int count = 0;