Use item display name for stage complete if available, fixes #1115

This commit is contained in:
PikaMug 2020-03-18 00:56:30 -04:00
parent 5c7b12c6cb
commit da24ff2bd0

View File

@ -2244,8 +2244,8 @@ public class Quester {
} else if (objective.equalsIgnoreCase("breakBlock")) { } else if (objective.equalsIgnoreCase("breakBlock")) {
String message = ChatColor.GREEN + "(" + Lang.get(p, "completed") + ") " + Lang.get(p, "break") + " <item>"; String message = ChatColor.GREEN + "(" + Lang.get(p, "completed") + ") " + Lang.get(p, "break") + " <item>";
message = message + " " + goal.getAmount() + "/" + goal.getAmount(); message = message + " " + goal.getAmount() + "/" + goal.getAmount();
if (plugin.getSettings().canTranslateNames() && !increment.hasItemMeta() if (plugin.getSettings().canTranslateNames() && !goal.hasItemMeta()
&& !increment.getItemMeta().hasDisplayName()) { && !goal.getItemMeta().hasDisplayName()) {
plugin.getLocaleQuery().sendMessage(p, message, increment.getType(), increment.getDurability(), null); plugin.getLocaleQuery().sendMessage(p, message, increment.getType(), increment.getDurability(), null);
} else { } else {
p.sendMessage(message.replace("<item>", ItemUtil.getName(increment))); p.sendMessage(message.replace("<item>", ItemUtil.getName(increment)));
@ -2254,8 +2254,8 @@ public class Quester {
String message = ChatColor.GREEN + "(" + Lang.get(p, "completed") + ") " + Lang.get(p, "damage") String message = ChatColor.GREEN + "(" + Lang.get(p, "completed") + ") " + Lang.get(p, "damage")
+ " <item>"; + " <item>";
message = message + " " + goal.getAmount() + "/" + goal.getAmount(); message = message + " " + goal.getAmount() + "/" + goal.getAmount();
if (plugin.getSettings().canTranslateNames() && !increment.hasItemMeta() if (plugin.getSettings().canTranslateNames() && !goal.hasItemMeta()
&& !increment.getItemMeta().hasDisplayName()) { && !goal.getItemMeta().hasDisplayName()) {
plugin.getLocaleQuery().sendMessage(p, message, increment.getType(), increment.getDurability(), null); plugin.getLocaleQuery().sendMessage(p, message, increment.getType(), increment.getDurability(), null);
} else { } else {
p.sendMessage(message.replace("<item>", ItemUtil.getName(increment))); p.sendMessage(message.replace("<item>", ItemUtil.getName(increment)));
@ -2263,8 +2263,8 @@ public class Quester {
} else if (objective.equalsIgnoreCase("placeBlock")) { } else if (objective.equalsIgnoreCase("placeBlock")) {
String message = ChatColor.GREEN + "(" + Lang.get(p, "completed") + ") " + Lang.get(p, "place") + " <item>"; String message = ChatColor.GREEN + "(" + Lang.get(p, "completed") + ") " + Lang.get(p, "place") + " <item>";
message = message + " " + goal.getAmount() + "/" + goal.getAmount(); message = message + " " + goal.getAmount() + "/" + goal.getAmount();
if (plugin.getSettings().canTranslateNames() && !increment.hasItemMeta() if (plugin.getSettings().canTranslateNames() && !goal.hasItemMeta()
&& !increment.getItemMeta().hasDisplayName()) { && !goal.getItemMeta().hasDisplayName()) {
plugin.getLocaleQuery().sendMessage(p, message, increment.getType(), increment.getDurability(), null); plugin.getLocaleQuery().sendMessage(p, message, increment.getType(), increment.getDurability(), null);
} else { } else {
p.sendMessage(message.replace("<item>", ItemUtil.getName(increment))); p.sendMessage(message.replace("<item>", ItemUtil.getName(increment)));
@ -2272,8 +2272,8 @@ public class Quester {
} else if (objective.equalsIgnoreCase("useBlock")) { } else if (objective.equalsIgnoreCase("useBlock")) {
String message = ChatColor.GREEN + "(" + Lang.get(p, "completed") + ") " + Lang.get(p, "use") + " <item>"; String message = ChatColor.GREEN + "(" + Lang.get(p, "completed") + ") " + Lang.get(p, "use") + " <item>";
message = message + " " + goal.getAmount() + "/" + goal.getAmount(); message = message + " " + goal.getAmount() + "/" + goal.getAmount();
if (plugin.getSettings().canTranslateNames() && !increment.hasItemMeta() if (plugin.getSettings().canTranslateNames() && !goal.hasItemMeta()
&& !increment.getItemMeta().hasDisplayName()) { && !goal.getItemMeta().hasDisplayName()) {
plugin.getLocaleQuery().sendMessage(p, message, increment.getType(), increment.getDurability(), null); plugin.getLocaleQuery().sendMessage(p, message, increment.getType(), increment.getDurability(), null);
} else { } else {
p.sendMessage(message.replace("<item>", ItemUtil.getName(increment))); p.sendMessage(message.replace("<item>", ItemUtil.getName(increment)));
@ -2281,8 +2281,8 @@ public class Quester {
} else if (objective.equalsIgnoreCase("cutBlock")) { } else if (objective.equalsIgnoreCase("cutBlock")) {
String message = ChatColor.GREEN + "(" + Lang.get(p, "completed") + ") " + Lang.get(p, "cut") + " <item>"; String message = ChatColor.GREEN + "(" + Lang.get(p, "completed") + ") " + Lang.get(p, "cut") + " <item>";
message = message + " " + goal.getAmount() + "/" + goal.getAmount(); message = message + " " + goal.getAmount() + "/" + goal.getAmount();
if (plugin.getSettings().canTranslateNames() && !increment.hasItemMeta() if (plugin.getSettings().canTranslateNames() && !goal.hasItemMeta()
&& !increment.getItemMeta().hasDisplayName()) { && !goal.getItemMeta().hasDisplayName()) {
plugin.getLocaleQuery().sendMessage(p, message, increment.getType(), increment.getDurability(), null); plugin.getLocaleQuery().sendMessage(p, message, increment.getType(), increment.getDurability(), null);
} else { } else {
p.sendMessage(message.replace("<item>", ItemUtil.getName(increment))); p.sendMessage(message.replace("<item>", ItemUtil.getName(increment)));
@ -2291,8 +2291,8 @@ public class Quester {
ItemStack is = getCurrentStage(quest).itemsToCraft.get(getCurrentStage(quest).itemsToCraft.indexOf(goal)); ItemStack is = getCurrentStage(quest).itemsToCraft.get(getCurrentStage(quest).itemsToCraft.indexOf(goal));
String message = ChatColor.GREEN + "(" + Lang.get(p, "completed") + ") " + Lang.get(p, "craft") + " <item> " String message = ChatColor.GREEN + "(" + Lang.get(p, "completed") + ") " + Lang.get(p, "craft") + " <item> "
+ is.getAmount() + "/" + is.getAmount(); + is.getAmount() + "/" + is.getAmount();
if (plugin.getSettings().canTranslateNames() && !increment.hasItemMeta() if (plugin.getSettings().canTranslateNames() && !goal.hasItemMeta()
&& !increment.getItemMeta().hasDisplayName()) { && !goal.getItemMeta().hasDisplayName()) {
plugin.getLocaleQuery().sendMessage(p, message, goal.getType(), goal.getDurability(), null); plugin.getLocaleQuery().sendMessage(p, message, goal.getType(), goal.getDurability(), null);
} else { } else {
p.sendMessage(message.replace("<item>", ItemUtil.getName(is))); p.sendMessage(message.replace("<item>", ItemUtil.getName(is)));
@ -2301,8 +2301,8 @@ public class Quester {
ItemStack is = getCurrentStage(quest).itemsToSmelt.get(getCurrentStage(quest).itemsToSmelt.indexOf(goal)); ItemStack is = getCurrentStage(quest).itemsToSmelt.get(getCurrentStage(quest).itemsToSmelt.indexOf(goal));
String message = ChatColor.GREEN + "(" + Lang.get(p, "completed") + ") " + Lang.get(p, "smelt") + " <item> " String message = ChatColor.GREEN + "(" + Lang.get(p, "completed") + ") " + Lang.get(p, "smelt") + " <item> "
+ is.getAmount() + "/" + is.getAmount(); + is.getAmount() + "/" + is.getAmount();
if (plugin.getSettings().canTranslateNames() && !increment.hasItemMeta() if (plugin.getSettings().canTranslateNames() && !goal.hasItemMeta()
&& !increment.getItemMeta().hasDisplayName()) { && !goal.getItemMeta().hasDisplayName()) {
plugin.getLocaleQuery().sendMessage(p, message, goal.getType(), goal.getDurability(), null); plugin.getLocaleQuery().sendMessage(p, message, goal.getType(), goal.getDurability(), null);
} else { } else {
p.sendMessage(message.replace("<item>", ItemUtil.getName(is))); p.sendMessage(message.replace("<item>", ItemUtil.getName(is)));
@ -2318,8 +2318,8 @@ public class Quester {
break; break;
} }
} }
if (plugin.getSettings().canTranslateNames() && !increment.hasItemMeta() if (plugin.getSettings().canTranslateNames() && !goal.hasItemMeta()
&& !increment.getItemMeta().hasDisplayName()) { && !goal.getItemMeta().hasDisplayName()) {
plugin.getLocaleQuery().sendMessage(p, message, increment.getType(), increment.getDurability(), ench); plugin.getLocaleQuery().sendMessage(p, message, increment.getType(), increment.getDurability(), ench);
} else { } else {
p.sendMessage(message.replace("<item>", ItemUtil.getName(increment)) p.sendMessage(message.replace("<item>", ItemUtil.getName(increment))
@ -2330,7 +2330,7 @@ public class Quester {
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().canTranslateNames() && goal.hasItemMeta() if (plugin.getSettings().canTranslateNames() && goal.hasItemMeta()
&& !increment.getItemMeta().hasDisplayName()) { && !goal.getItemMeta().hasDisplayName()) {
plugin.getLocaleQuery().sendMessage(p, message, goal.getType(), goal.getDurability(), null, plugin.getLocaleQuery().sendMessage(p, message, goal.getType(), goal.getDurability(), null,
goal.getItemMeta()); goal.getItemMeta());
} else { } else {
@ -2343,8 +2343,8 @@ public class Quester {
String message = ChatColor.GREEN + "(" + Lang.get(p, "completed") + ") " + obj; String message = ChatColor.GREEN + "(" + Lang.get(p, "completed") + ") " + obj;
ItemStack is = getCurrentStage(quest).itemsToDeliver.get(getCurrentStage(quest).itemsToDeliver ItemStack is = getCurrentStage(quest).itemsToDeliver.get(getCurrentStage(quest).itemsToDeliver
.indexOf(goal)); .indexOf(goal));
if (plugin.getSettings().canTranslateNames() && !increment.hasItemMeta() if (plugin.getSettings().canTranslateNames() && !goal.hasItemMeta()
&& !increment.getItemMeta().hasDisplayName()) { && !goal.getItemMeta().hasDisplayName()) {
plugin.getLocaleQuery().sendMessage(p, message, is.getType(), is.getDurability(), null); plugin.getLocaleQuery().sendMessage(p, message, is.getType(), is.getDurability(), null);
} else { } else {
p.sendMessage(message.replace("<item>", ItemUtil.getName(is))); p.sendMessage(message.replace("<item>", ItemUtil.getName(is)));