mirror of
https://github.com/PikaMug/Quests.git
synced 2025-01-03 06:57:58 +01:00
Ignore facing direction for block objectives, fixes #146. Bump version
This commit is contained in:
parent
e6224e47f3
commit
76f0076f9d
2
pom.xml
2
pom.xml
@ -3,7 +3,7 @@
|
||||
|
||||
<groupId>me.blackvein.quests</groupId>
|
||||
<artifactId>quests</artifactId>
|
||||
<version>3.2.0</version>
|
||||
<version>3.2.1</version>
|
||||
<name>quests</name>
|
||||
<url>https://github.com/FlyingPikachu/Quests/</url>
|
||||
<packaging>jar</packaging>
|
||||
|
@ -710,14 +710,30 @@ public class Quester {
|
||||
ItemStack broken = temp;
|
||||
ItemStack toBreak = temp;
|
||||
for (ItemStack is : getQuestData(quest).blocksBroken) {
|
||||
if (m.getType() == is.getType() && m.getDurability() == is.getDurability()) {
|
||||
if (m.getType() == is.getType()) {
|
||||
if (m.getType().isSolid() && is.getType().isSolid()) {
|
||||
//Blocks are solid so check for durability
|
||||
if (m.getDurability() == is.getDurability()) {
|
||||
broken = is;
|
||||
}
|
||||
} else {
|
||||
//Blocks are not solid so ignore durability
|
||||
broken = is;
|
||||
}
|
||||
}
|
||||
}
|
||||
for (ItemStack is : getCurrentStage(quest).blocksToBreak) {
|
||||
if (m.getType() == is.getType() && m.getDurability() == is.getDurability()) {
|
||||
if (m.getType() == is.getType()) {
|
||||
if (m.getType().isSolid() && is.getType().isSolid()) {
|
||||
//Blocks are solid so check for durability
|
||||
if (m.getDurability() == is.getDurability()) {
|
||||
toBreak = is;
|
||||
}
|
||||
} else {
|
||||
//Blocks are not solid so ignore durability
|
||||
toBreak = is;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (broken.getAmount() < toBreak.getAmount()) {
|
||||
ItemStack newBroken = broken;
|
||||
@ -735,14 +751,30 @@ public class Quester {
|
||||
ItemStack damaged = temp;
|
||||
ItemStack toDamage = temp;
|
||||
for (ItemStack is : getQuestData(quest).blocksDamaged) {
|
||||
if (m.getType() == is.getType() && m.getDurability() == is.getDurability()) {
|
||||
if (m.getType() == is.getType()) {
|
||||
if (m.getType().isSolid() && is.getType().isSolid()) {
|
||||
//Blocks are solid so check for durability
|
||||
if (m.getDurability() == is.getDurability()) {
|
||||
damaged = is;
|
||||
}
|
||||
} else {
|
||||
//Blocks are not solid so ignore durability
|
||||
damaged = is;
|
||||
}
|
||||
}
|
||||
}
|
||||
for (ItemStack is : getCurrentStage(quest).blocksToDamage) {
|
||||
if (m.getType() == is.getType() && m.getDurability() == is.getDurability()) {
|
||||
if (m.getType() == is.getType()) {
|
||||
if (m.getType().isSolid() && is.getType().isSolid()) {
|
||||
//Blocks are solid so check for durability
|
||||
if (m.getDurability() == is.getDurability()) {
|
||||
toDamage = is;
|
||||
}
|
||||
} else {
|
||||
//Blocks are not solid so ignore durability
|
||||
toDamage = is;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (damaged.getAmount() < toDamage.getAmount()) {
|
||||
ItemStack newDamaged = damaged;
|
||||
@ -760,14 +792,30 @@ public class Quester {
|
||||
ItemStack placed = temp;
|
||||
ItemStack toPlace = temp;
|
||||
for (ItemStack is : getQuestData(quest).blocksPlaced) {
|
||||
if (m.getType() == is.getType() && m.getDurability() == is.getDurability()) {
|
||||
if (m.getType() == is.getType()) {
|
||||
if (m.getType().isSolid() && is.getType().isSolid()) {
|
||||
//Blocks are solid so check for durability
|
||||
if (m.getDurability() == is.getDurability()) {
|
||||
placed = is;
|
||||
}
|
||||
} else {
|
||||
//Blocks are not solid so ignore durability
|
||||
placed = is;
|
||||
}
|
||||
}
|
||||
}
|
||||
for (ItemStack is : getCurrentStage(quest).blocksToPlace) {
|
||||
if (m.getType() == is.getType() && m.getDurability() == is.getDurability()) {
|
||||
if (m.getType() == is.getType()) {
|
||||
if (m.getType().isSolid() && is.getType().isSolid()) {
|
||||
//Blocks are solid so check for durability
|
||||
if (m.getDurability() == is.getDurability()) {
|
||||
toPlace = is;
|
||||
}
|
||||
} else {
|
||||
//Blocks are not solid so ignore durability
|
||||
toPlace = is;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (placed.getAmount() < toPlace.getAmount()) {
|
||||
ItemStack newplaced = placed;
|
||||
@ -785,14 +833,30 @@ public class Quester {
|
||||
ItemStack used = temp;
|
||||
ItemStack toUse = temp;
|
||||
for (ItemStack is : getQuestData(quest).blocksUsed) {
|
||||
if (m.getType() == is.getType() && m.getDurability() == is.getDurability()) {
|
||||
if (m.getType() == is.getType() ) {
|
||||
if (m.getType().isSolid() && is.getType().isSolid()) {
|
||||
//Blocks are solid so check for durability
|
||||
if (m.getDurability() == is.getDurability()) {
|
||||
used = is;
|
||||
}
|
||||
} else {
|
||||
//Blocks are not solid so ignore durability
|
||||
used = is;
|
||||
}
|
||||
}
|
||||
}
|
||||
for (ItemStack is : getCurrentStage(quest).blocksToUse) {
|
||||
if (m.getType() == is.getType() && m.getDurability() == is.getDurability()) {
|
||||
if (m.getType() == is.getType() ) {
|
||||
if (m.getType().isSolid() && is.getType().isSolid()) {
|
||||
//Blocks are solid, so check durability
|
||||
if (m.getDurability() == is.getDurability()) {
|
||||
toUse = is;
|
||||
}
|
||||
} else {
|
||||
//Blocks are not solid, so ignore durability
|
||||
toUse = is;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (used.getAmount() < toUse.getAmount()) {
|
||||
ItemStack newUsed = used;
|
||||
@ -810,14 +874,30 @@ public class Quester {
|
||||
ItemStack cut = temp;
|
||||
ItemStack toCut = temp;
|
||||
for (ItemStack is : getQuestData(quest).blocksCut) {
|
||||
if (m.getType() == is.getType() && m.getDurability() == is.getDurability()) {
|
||||
if (m.getType() == is.getType()) {
|
||||
if (m.getType().isSolid() && is.getType().isSolid()) {
|
||||
//Blocks are solid so check for durability
|
||||
if (m.getDurability() == is.getDurability()) {
|
||||
cut = is;
|
||||
}
|
||||
} else {
|
||||
//Blocks are not solid so ignore durability
|
||||
cut = is;
|
||||
}
|
||||
}
|
||||
}
|
||||
for (ItemStack is : getCurrentStage(quest).blocksToCut) {
|
||||
if (m.getType() == is.getType() && m.getDurability() == is.getDurability()) {
|
||||
if (m.getType() == is.getType()) {
|
||||
if (m.getType().isSolid() && is.getType().isSolid()) {
|
||||
//Blocks are solid so check for durability
|
||||
if (m.getDurability() == is.getDurability()) {
|
||||
toCut = is;
|
||||
}
|
||||
} else {
|
||||
//Blocks are not solid so ignore durability
|
||||
toCut = is;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (cut.getAmount() < toCut.getAmount()) {
|
||||
ItemStack newCut = cut;
|
||||
@ -1055,7 +1135,6 @@ public class Quester {
|
||||
* See CustomObjective class
|
||||
*/
|
||||
public void finishObjective(Quest quest, String objective, ItemStack material, ItemStack delivery, Enchantment enchantment, EntityType mob, String player, NPC npc, Location location, DyeColor color, String pass, CustomObjective co) {
|
||||
//TODO ItemStack material, is largely unnecessary as .name() can be obtained thru getQuestData(quest).blocksXXXX
|
||||
Player p = getPlayer();
|
||||
if (getCurrentStage(quest).objectiveOverride != null) {
|
||||
if (testComplete(quest)) {
|
||||
|
@ -187,16 +187,17 @@ public class ItemUtil {
|
||||
return text;
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public static String getName(ItemStack is) {
|
||||
String text = "";
|
||||
if (is.hasItemMeta() && is.getItemMeta().hasDisplayName()) {
|
||||
text = "" + ChatColor.DARK_AQUA + ChatColor.ITALIC + is.getItemMeta().getDisplayName();
|
||||
} else {
|
||||
try {
|
||||
text = ChatColor.AQUA + Items.itemByStack(is).getName();
|
||||
text = ChatColor.AQUA + Items.itemByType(is.getType()).getName();
|
||||
} catch (Exception ne) {
|
||||
text = ChatColor.AQUA + is.getType().name().toLowerCase().replace("_", " ");
|
||||
Bukkit.getLogger().severe("This error is caused by an incompatible version of Vault. Please consider updating.");
|
||||
text = ChatColor.AQUA + Quester.prettyItemString(is.getType().name());
|
||||
Bukkit.getLogger().severe("This error is likely caused by an incompatible version of Vault. Please consider updating.");
|
||||
ne.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user