Add more durability checks, fixes #401. Bump version number

This commit is contained in:
HappyPikachu 2016-08-17 21:06:42 -04:00
parent e706dbd490
commit b1b1b16788
3 changed files with 13 additions and 9 deletions

View File

@ -3,7 +3,7 @@
<groupId>me.blackvein.quests</groupId>
<artifactId>quests</artifactId>
<version>2.7.1</version>
<version>2.7.2</version>
<name>quests</name>
<url>https://github.com/FlyingPikachu/Quests/</url>
<packaging>jar</packaging>

View File

@ -432,7 +432,7 @@ public class Quester {
for (ItemStack e2 : getQuestData(quest).blocksDamaged) {
if (e2.getType().equals(e.getType())) {
if (e2.getType().equals(e.getType()) && e2.getDurability() == e.getDurability()) {
if (e2.getAmount() < e.getAmount()) {
@ -453,15 +453,14 @@ public class Quester {
for (ItemStack e : getCurrentStage(quest).blocksToBreak) {
for (ItemStack e2 : getQuestData(quest).blocksBroken) {
if (e2.getType().equals(e.getType())) {
if (e2.getType().equals(e.getType()) && e2.getDurability() == e.getDurability()) {
if (e2.getAmount() < e.getAmount()) {
unfinishedObjectives.add(ChatColor.GREEN + Lang.get("break") + " " + Items.itemByStack(e2).getName() + ": " + e2.getAmount() + "/" + e.getAmount());
} else {
finishedObjectives.add(ChatColor.GRAY + Lang.get("break") + " " + Items.itemByStack(e2).getName() + ": " + e2.getAmount() + "/" + e.getAmount());
}
@ -476,7 +475,7 @@ public class Quester {
for (ItemStack e2 : getQuestData(quest).blocksPlaced) {
if (e2.getType().equals(e.getType())) {
if (e2.getType().equals(e.getType()) && e2.getDurability() == e.getDurability()) {
if (e2.getAmount() < e.getAmount()) {
@ -498,7 +497,7 @@ public class Quester {
for (ItemStack e2 : getQuestData(quest).blocksUsed) {
if (e2.getType().equals(e.getType())) {
if (e2.getType().equals(e.getType()) && e2.getDurability() == e.getDurability()) {
if (e2.getAmount() < e.getAmount()) {
@ -520,7 +519,7 @@ public class Quester {
for (ItemStack e2 : getQuestData(quest).blocksCut) {
if (e2.getType().equals(e.getType())) {
if (e2.getType().equals(e.getType()) && e2.getDurability() == e.getDurability()) {
if (e2.getAmount() < e.getAmount()) {
@ -2046,6 +2045,8 @@ Material m = null;
return capitalized;
}
//TODO eliminate and replace all with Items.itemByStack(is).getName()
public static String prettyItemString(String itemName) {
String baseString = Material.matchMaterial(itemName).toString();
String[] substrings = baseString.split("_");

View File

@ -2,8 +2,11 @@ package me.blackvein.quests.util;
import java.util.LinkedList;
import java.util.Map.Entry;
import me.blackvein.quests.Quester;
import me.blackvein.quests.Quests;
import net.milkbowl.vault.item.Items;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.enchantments.Enchantment;
@ -214,7 +217,7 @@ public class ItemUtil implements ColorUtil {
if (is.hasItemMeta() && is.getItemMeta().hasDisplayName()) {
text = "" + DARKAQUA + ITALIC + is.getItemMeta().getDisplayName();
} else {
text = AQUA + Quester.prettyItemString(is.getType().name());
text = AQUA + Items.itemByStack(is).getName();
}
return text;