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)); ItemStack is = getCurrentStage(quest).itemsToBrew.get(getCurrentStage(quest).itemsToBrew.indexOf(goal));
String message = ChatColor.GREEN + "(" + Lang.get(p, "completed") + ") " + Lang.get(p, "brew") + " <item> " String message = ChatColor.GREEN + "(" + Lang.get(p, "completed") + ") " + Lang.get(p, "brew") + " <item> "
+ is.getAmount() + "/" + is.getAmount(); + is.getAmount() + "/" + is.getAmount();
if (plugin.getSettings().canTranslateItems() && !increment.hasItemMeta() if (plugin.getSettings().canTranslateItems() && goal.hasItemMeta()
&& !increment.getItemMeta().hasDisplayName()) { && !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 { } else {
p.sendMessage(message.replace("<item>", ItemUtil.getName(is))); p.sendMessage(message.replace("<item>", ItemUtil.getName(is)));
} }

View File

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

View File

@ -137,7 +137,8 @@ public class LocaleQuery {
return false; return false;
} }
if (meta != null && meta instanceof PotionMeta) { 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()) { if (enchantments != null && !enchantments.isEmpty()) {
int count = 0; int count = 0;