Finish acquiring item-names thru Vault, fixes #195. Bump version number

This commit is contained in:
HappyPikachu 2018-01-01 22:28:02 -05:00
parent 746685b583
commit 567f5dcd8d
6 changed files with 29 additions and 30 deletions

View File

@ -3,11 +3,10 @@
<groupId>me.blackvein.quests</groupId>
<artifactId>quests</artifactId>
<version>3.1.7</version>
<version>3.1.8</version>
<name>quests</name>
<url>https://github.com/FlyingPikachu/Quests/</url>
<packaging>jar</packaging>
<description></description>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

View File

@ -81,7 +81,7 @@ public class NpcListener implements Listener {
if (hand.hasItemMeta()) {
text += ChatColor.LIGHT_PURPLE + "" + ChatColor.ITALIC + (hand.getItemMeta().hasDisplayName() ? hand.getItemMeta().getDisplayName() + ChatColor.GRAY + " (" : "");
}
text += ChatColor.AQUA + Quester.prettyItemString(hand.getType().name()) + (hand.getDurability() != 0 ? (":" + ChatColor.BLUE + hand.getDurability()) : "") + ChatColor.GRAY;
text += ChatColor.AQUA + ItemUtil.getName(hand) + (hand.getDurability() != 0 ? (":" + ChatColor.BLUE + hand.getDurability()) : "") + ChatColor.GRAY;
if (hand.hasItemMeta()) {
text += (hand.getItemMeta().hasDisplayName() ? ")" : "");
}

View File

@ -200,42 +200,42 @@ public class PlayerListener implements Listener {
Block block = evt.getClickedBlock();
Location loc = block.getLocation();
plugin.questFactory.selectedBlockStarts.put(evt.getPlayer().getUniqueId(), block);
evt.getPlayer().sendMessage(ChatColor.GOLD + Lang.get("questSelectedLocation") + " " + ChatColor.AQUA + loc.getWorld().getName() + ": " + loc.getX() + ", " + loc.getY() + ", " + loc.getZ() + ChatColor.GOLD + " (" + ChatColor.GREEN + Quester.prettyItemString(block.getType().name()) + ChatColor.GOLD + ")");
evt.getPlayer().sendMessage(ChatColor.GOLD + Lang.get("questSelectedLocation") + " " + ChatColor.AQUA + loc.getWorld().getName() + ": " + loc.getX() + ", " + loc.getY() + ", " + loc.getZ() + ChatColor.GOLD + " (" + ChatColor.GREEN + ItemUtil.getName(new ItemStack(block.getType())) + ChatColor.GOLD + ")");
} else if (plugin.eventFactory.selectedExplosionLocations.containsKey(evt.getPlayer().getUniqueId())) {
Block block = evt.getClickedBlock();
Location loc = block.getLocation();
plugin.eventFactory.selectedExplosionLocations.put(evt.getPlayer().getUniqueId(), block);
evt.getPlayer().sendMessage(ChatColor.GOLD + Lang.get("questSelectedLocation") + " " + ChatColor.AQUA + loc.getWorld().getName() + ": " + loc.getX() + ", " + loc.getY() + ", " + loc.getZ() + ChatColor.GOLD + " (" + ChatColor.GREEN + Quester.prettyItemString(block.getType().name()) + ChatColor.GOLD + ")");
evt.getPlayer().sendMessage(ChatColor.GOLD + Lang.get("questSelectedLocation") + " " + ChatColor.AQUA + loc.getWorld().getName() + ": " + loc.getX() + ", " + loc.getY() + ", " + loc.getZ() + ChatColor.GOLD + " (" + ChatColor.GREEN + ItemUtil.getName(new ItemStack(block.getType())) + ChatColor.GOLD + ")");
} else if (plugin.eventFactory.selectedEffectLocations.containsKey(evt.getPlayer().getUniqueId())) {
Block block = evt.getClickedBlock();
Location loc = block.getLocation();
plugin.eventFactory.selectedEffectLocations.put(evt.getPlayer().getUniqueId(), block);
evt.getPlayer().sendMessage(ChatColor.GOLD + Lang.get("questSelectedLocation") + " " + ChatColor.AQUA + loc.getWorld().getName() + ": " + loc.getX() + ", " + loc.getY() + ", " + loc.getZ() + ChatColor.GOLD + " (" + ChatColor.GREEN + Quester.prettyItemString(block.getType().name()) + ChatColor.GOLD + ")");
evt.getPlayer().sendMessage(ChatColor.GOLD + Lang.get("questSelectedLocation") + " " + ChatColor.AQUA + loc.getWorld().getName() + ": " + loc.getX() + ", " + loc.getY() + ", " + loc.getZ() + ChatColor.GOLD + " (" + ChatColor.GREEN + ItemUtil.getName(new ItemStack(block.getType())) + ChatColor.GOLD + ")");
} else if (plugin.eventFactory.selectedMobLocations.containsKey(evt.getPlayer().getUniqueId())) {
Block block = evt.getClickedBlock();
Location loc = block.getLocation();
plugin.eventFactory.selectedMobLocations.put(evt.getPlayer().getUniqueId(), block);
evt.getPlayer().sendMessage(ChatColor.GOLD + Lang.get("questSelectedLocation") + " " + ChatColor.AQUA + loc.getWorld().getName() + ": " + loc.getX() + ", " + loc.getY() + ", " + loc.getZ() + ChatColor.GOLD + " (" + ChatColor.GREEN + Quester.prettyItemString(block.getType().name()) + ChatColor.GOLD + ")");
evt.getPlayer().sendMessage(ChatColor.GOLD + Lang.get("questSelectedLocation") + " " + ChatColor.AQUA + loc.getWorld().getName() + ": " + loc.getX() + ", " + loc.getY() + ", " + loc.getZ() + ChatColor.GOLD + " (" + ChatColor.GREEN + ItemUtil.getName(new ItemStack(block.getType()))+ ChatColor.GOLD + ")");
} else if (plugin.eventFactory.selectedLightningLocations.containsKey(evt.getPlayer().getUniqueId())) {
Block block = evt.getClickedBlock();
Location loc = block.getLocation();
plugin.eventFactory.selectedLightningLocations.put(evt.getPlayer().getUniqueId(), block);
evt.getPlayer().sendMessage(ChatColor.GOLD + Lang.get("questSelectedLocation") + " " + ChatColor.AQUA + loc.getWorld().getName() + ": " + loc.getX() + ", " + loc.getY() + ", " + loc.getZ() + ChatColor.GOLD + " (" + ChatColor.GREEN + Quester.prettyItemString(block.getType().name()) + ChatColor.GOLD + ")");
evt.getPlayer().sendMessage(ChatColor.GOLD + Lang.get("questSelectedLocation") + " " + ChatColor.AQUA + loc.getWorld().getName() + ": " + loc.getX() + ", " + loc.getY() + ", " + loc.getZ() + ChatColor.GOLD + " (" + ChatColor.GREEN + ItemUtil.getName(new ItemStack(block.getType())) + ChatColor.GOLD + ")");
} else if (plugin.eventFactory.selectedTeleportLocations.containsKey(evt.getPlayer().getUniqueId())) {
Block block = evt.getClickedBlock();
Location loc = block.getLocation();
plugin.eventFactory.selectedTeleportLocations.put(evt.getPlayer().getUniqueId(), block);
evt.getPlayer().sendMessage(ChatColor.GOLD + Lang.get("questSelectedLocation") + " " + ChatColor.AQUA + loc.getWorld().getName() + ": " + loc.getX() + ", " + loc.getY() + ", " + loc.getZ() + ChatColor.GOLD + " (" + ChatColor.GREEN + Quester.prettyItemString(block.getType().name()) + ChatColor.GOLD + ")");
evt.getPlayer().sendMessage(ChatColor.GOLD + Lang.get("questSelectedLocation") + " " + ChatColor.AQUA + loc.getWorld().getName() + ": " + loc.getX() + ", " + loc.getY() + ", " + loc.getZ() + ChatColor.GOLD + " (" + ChatColor.GREEN + ItemUtil.getName(new ItemStack(block.getType())) + ChatColor.GOLD + ")");
} else if (plugin.questFactory.selectedKillLocations.containsKey(evt.getPlayer().getUniqueId())) {
Block block = evt.getClickedBlock();
Location loc = block.getLocation();
plugin.questFactory.selectedKillLocations.put(evt.getPlayer().getUniqueId(), block);
evt.getPlayer().sendMessage(ChatColor.GOLD + Lang.get("questSelectedLocation") + " " + ChatColor.AQUA + loc.getWorld().getName() + ": " + loc.getX() + ", " + loc.getY() + ", " + loc.getZ() + ChatColor.GOLD + " (" + ChatColor.GREEN + Quester.prettyItemString(block.getType().name()) + ChatColor.GOLD + ")");
evt.getPlayer().sendMessage(ChatColor.GOLD + Lang.get("questSelectedLocation") + " " + ChatColor.AQUA + loc.getWorld().getName() + ": " + loc.getX() + ", " + loc.getY() + ", " + loc.getZ() + ChatColor.GOLD + " (" + ChatColor.GREEN + ItemUtil.getName(new ItemStack(block.getType())) + ChatColor.GOLD + ")");
} else if (plugin.questFactory.selectedReachLocations.containsKey(evt.getPlayer().getUniqueId())) {
Block block = evt.getClickedBlock();
Location loc = block.getLocation();
plugin.questFactory.selectedReachLocations.put(evt.getPlayer().getUniqueId(), block);
evt.getPlayer().sendMessage(ChatColor.GOLD + Lang.get("questSelectedLocation") + " " + ChatColor.AQUA + loc.getWorld().getName() + ": " + loc.getX() + ", " + loc.getY() + ", " + loc.getZ() + ChatColor.GOLD + " (" + ChatColor.GREEN + Quester.prettyItemString(block.getType().name()) + ChatColor.GOLD + ")");
evt.getPlayer().sendMessage(ChatColor.GOLD + Lang.get("questSelectedLocation") + " " + ChatColor.AQUA + loc.getWorld().getName() + ": " + loc.getX() + ", " + loc.getY() + ", " + loc.getZ() + ChatColor.GOLD + " (" + ChatColor.GREEN + ItemUtil.getName(new ItemStack(block.getType())) + ChatColor.GOLD + ")");
} else if (player.isConversing() == false) {
for (final Quest q : plugin.quests) {
if (q.blockStart != null) {

View File

@ -379,15 +379,15 @@ public class Quest {
}
} else if (i.getDurability() != 0) {
if (i.getEnchantments().isEmpty()) {
player.sendMessage("- " + ChatColor.DARK_GREEN + Quester.prettyItemString(i.getType().name()) + ":" + i.getDurability() + ChatColor.GRAY + " x " + i.getAmount());
player.sendMessage("- " + ChatColor.DARK_GREEN + ItemUtil.getName(i) + ":" + i.getDurability() + ChatColor.GRAY + " x " + i.getAmount());
} else {
player.sendMessage("- " + ChatColor.DARK_GREEN + Quester.prettyItemString(i.getType().name()) + ":" + i.getDurability() + ChatColor.GRAY + " x " + i.getAmount() + ChatColor.DARK_PURPLE + " " + Lang.get("enchantedItem"));
player.sendMessage("- " + ChatColor.DARK_GREEN + ItemUtil.getName(i) + ":" + i.getDurability() + ChatColor.GRAY + " x " + i.getAmount() + ChatColor.DARK_PURPLE + " " + Lang.get("enchantedItem"));
}
} else {
if (i.getEnchantments().isEmpty()) {
player.sendMessage("- " + ChatColor.DARK_GREEN + Quester.prettyItemString(i.getType().name()) + ChatColor.GRAY + " x " + i.getAmount());
player.sendMessage("- " + ChatColor.DARK_GREEN + ItemUtil.getName(i) + ChatColor.GRAY + " x " + i.getAmount());
} else {
player.sendMessage("- " + ChatColor.DARK_GREEN + Quester.prettyItemString(i.getType().name()) + ChatColor.GRAY + " x " + i.getAmount() + ChatColor.DARK_PURPLE + " " + Lang.get("enchantedItem"));
player.sendMessage("- " + ChatColor.DARK_GREEN + ItemUtil.getName(i) + ChatColor.GRAY + " x " + i.getAmount() + ChatColor.DARK_PURPLE + " " + Lang.get("enchantedItem"));
}
}
none = null;
@ -401,15 +401,15 @@ public class Quest {
}
} else if (i.getDurability() != 0) {
if (i.getEnchantments().isEmpty()) {
player.sendMessage("- " + ChatColor.DARK_GREEN + Quester.prettyItemString(i.getType().name()) + ":" + i.getDurability() + ChatColor.GRAY + " x " + i.getAmount());
player.sendMessage("- " + ChatColor.DARK_GREEN + ItemUtil.getName(i) + ":" + i.getDurability() + ChatColor.GRAY + " x " + i.getAmount());
} else {
player.sendMessage("- " + ChatColor.DARK_GREEN + Quester.prettyItemString(i.getType().name()) + ":" + i.getDurability() + ChatColor.GRAY + " x " + i.getAmount() + ChatColor.DARK_PURPLE + " " + Lang.get("enchantedItem"));
player.sendMessage("- " + ChatColor.DARK_GREEN + ItemUtil.getName(i) + ":" + i.getDurability() + ChatColor.GRAY + " x " + i.getAmount() + ChatColor.DARK_PURPLE + " " + Lang.get("enchantedItem"));
}
} else {
if (i.getEnchantments().isEmpty()) {
player.sendMessage("- " + ChatColor.DARK_GREEN + Quester.prettyItemString(i.getType().name()) + ChatColor.GRAY + " x " + i.getAmount());
player.sendMessage("- " + ChatColor.DARK_GREEN + ItemUtil.getName(i) + ChatColor.GRAY + " x " + i.getAmount());
} else {
player.sendMessage("- " + ChatColor.DARK_GREEN + Quester.prettyItemString(i.getType().name()) + ChatColor.GRAY + " x " + i.getAmount() + ChatColor.DARK_PURPLE + " " + Lang.get("enchantedItem"));
player.sendMessage("- " + ChatColor.DARK_GREEN + ItemUtil.getName(i) + ChatColor.GRAY + " x " + i.getAmount() + ChatColor.DARK_PURPLE + " " + Lang.get("enchantedItem"));
}
}
none = null;

View File

@ -468,12 +468,12 @@ public class Quester {
if (enchantment2 == enchantment) {
if (num1 < num2) {
String obj = Lang.get("enchantItem");
obj = obj.replaceAll("<item>", Quester.prettyItemString(mat.name()));
obj = obj.replaceAll("<item>", ItemUtil.getName(new ItemStack(mat)));
obj = obj.replaceAll("<enchantment>", Quester.prettyEnchantmentString(enchantment));
unfinishedObjectives.add(ChatColor.GREEN + obj + ChatColor.GREEN + ": " + num1 + "/" + num2);
} else {
String obj = Lang.get("enchantItem");
obj = obj.replaceAll("<item>", Quester.prettyItemString(mat.name()));
obj = obj.replaceAll("<item>", ItemUtil.getName(new ItemStack(mat)));
obj = obj.replaceAll("<enchantment>", Quester.prettyEnchantmentString(enchantment));
finishedObjectives.add(ChatColor.GRAY + obj + ChatColor.GRAY + ": " + num1 + "/" + num2);
}
@ -1074,7 +1074,7 @@ public class Quester {
quest.nextStage(this);
}
} else if (objective.equalsIgnoreCase("breakBlock")) {
String message = ChatColor.GREEN + "(" + Lang.get("completed") + ") " + Lang.get("break") + " " + prettyItemString(material.getType().name());
String message = ChatColor.GREEN + "(" + Lang.get("completed") + ") " + Lang.get("break") + " " + ItemUtil.getName(material);
String stack = getQuestData(quest).blocksBroken.toString();
String amount = stack.substring(stack.lastIndexOf(" x ") + 3).replace("}]", "");
message = message + " " + amount + "/" + amount;
@ -1083,7 +1083,7 @@ public class Quester {
quest.nextStage(this);
}
} else if (objective.equalsIgnoreCase("damageBlock")) {
String message = ChatColor.GREEN + "(" + Lang.get("completed") + ") " + Lang.get("damage") + " " + prettyItemString(material.getType().name());
String message = ChatColor.GREEN + "(" + Lang.get("completed") + ") " + Lang.get("damage") + " " + ItemUtil.getName(material);
String stack = getQuestData(quest).blocksDamaged.toString();
String amount = stack.substring(stack.lastIndexOf(" x ") + 3).replace("}]", "");
message = message + " " + amount + "/" + amount;
@ -1091,7 +1091,7 @@ public class Quester {
quest.nextStage(this);
}
} else if (objective.equalsIgnoreCase("placeBlock")) {
String message = ChatColor.GREEN + "(" + Lang.get("completed") + ") " + Lang.get("place") + " " + prettyItemString(material.getType().name());
String message = ChatColor.GREEN + "(" + Lang.get("completed") + ") " + Lang.get("place") + " " + ItemUtil.getName(material);
String stack = getQuestData(quest).blocksPlaced.toString();
String amount = stack.substring(stack.lastIndexOf(" x ") + 3).replace("}]", "");
message = message + " " + amount + "/" + amount;
@ -1100,7 +1100,7 @@ public class Quester {
quest.nextStage(this);
}
} else if (objective.equalsIgnoreCase("useBlock")) {
String message = ChatColor.GREEN + "(" + Lang.get("completed") + ") " + Lang.get("use") + " " + prettyItemString(material.getType().name());
String message = ChatColor.GREEN + "(" + Lang.get("completed") + ") " + Lang.get("use") + " " + ItemUtil.getName(material);
String stack = getQuestData(quest).blocksUsed.toString();
String amount = stack.substring(stack.lastIndexOf(" x ") + 3).replace("}]", "");
message = message + " " + amount + "/" + amount;
@ -1109,7 +1109,7 @@ public class Quester {
quest.nextStage(this);
}
} else if (objective.equalsIgnoreCase("cutBlock")) {
String message = ChatColor.GREEN + "(" + Lang.get("completed") + ") " + Lang.get("cut") + " " + prettyItemString(material.getType().name());
String message = ChatColor.GREEN + "(" + Lang.get("completed") + ") " + Lang.get("cut") + " " + ItemUtil.getName(material);
String stack = getQuestData(quest).blocksCut.toString();
String amount = stack.substring(stack.lastIndexOf(" x ") + 3).replace("}]", "");
message = message + " " + amount + "/" + amount;
@ -1126,7 +1126,7 @@ public class Quester {
}
} else if (objective.equalsIgnoreCase("enchantItem")) {
String obj = Lang.get("enchantItem");
obj = obj.replaceAll("<item>", prettyItemString(material.getType().name()));
obj = obj.replaceAll("<item>", ItemUtil.getName(material));
obj = obj.replaceAll("<enchantment>", Quester.prettyEnchantmentString(enchantment));
String message = ChatColor.GREEN + "(" + Lang.get("completed") + ") " + obj;
for (Map<Enchantment, Material> map : getCurrentStage(quest).itemsToEnchant.keySet()) {
@ -1500,7 +1500,7 @@ public class Quester {
return capitalized;
}
// TODO eliminate and replace all with Items.itemByType(is.getType()).getName()
// NOTE: Use ItemUtil.getString(itemStack) instead if possible
public static String prettyItemString(String itemName) {
String baseString = Material.matchMaterial(itemName).toString();
String[] substrings = baseString.split("_");

View File

@ -161,7 +161,7 @@ public class ItemUtil {
if (is.hasItemMeta() && is.getItemMeta().hasDisplayName()) {
text = "" + ChatColor.DARK_AQUA + ChatColor.ITALIC + is.getItemMeta().getDisplayName() + ChatColor.RESET + ChatColor.AQUA + " x " + is.getAmount();
} else {
text = ChatColor.AQUA + Quester.prettyItemString(is.getType().name());
text = ChatColor.AQUA + getName(is);
if (is.getDurability() != 0) {
text += ChatColor.AQUA + ":" + is.getDurability();
}
@ -178,7 +178,7 @@ public class ItemUtil {
if (is.hasItemMeta() && is.getItemMeta().hasDisplayName()) {
text = "" + ChatColor.DARK_AQUA + ChatColor.ITALIC + is.getItemMeta().getDisplayName() + ChatColor.RESET + ChatColor.AQUA + " x " + is.getAmount();
} else {
text = ChatColor.AQUA + Quester.prettyItemString(is.getType().name());
text = ChatColor.AQUA + getName(is);
if (is.getDurability() != 0) {
text += ChatColor.AQUA + ":" + is.getDurability();
}