Ignore block durability on 1.13+ servers, fixes #602

This commit is contained in:
BuildTools 2018-12-31 01:50:59 -05:00
parent 0857f1079d
commit 8440ab2b80
2 changed files with 34 additions and 1 deletions

View File

@ -49,6 +49,7 @@ import org.bukkit.inventory.meta.ItemMeta;
import me.blackvein.quests.util.ItemUtil;
import me.blackvein.quests.util.Lang;
import me.blackvein.quests.util.LocaleQuery;
import me.blackvein.quests.util.MiscUtil;
import net.citizensnpcs.api.npc.NPC;
@ -838,9 +839,13 @@ public class Quester {
for (ItemStack is : getQuestData(quest).blocksBroken) {
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 if (!LocaleQuery.oldVersion) {
//Ignore durability for 1.13+
broken = is;
}
} else {
//Blocks are not solid so ignore durability
@ -851,9 +856,13 @@ public class Quester {
for (ItemStack is : getCurrentStage(quest).blocksToBreak) {
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 if (!LocaleQuery.oldVersion) {
//Ignore durability for 1.13+
toBreak = is;
}
} else {
//Blocks are not solid so ignore durability
@ -885,6 +894,9 @@ public class Quester {
//Blocks are solid so check for durability
if (m.getDurability() == is.getDurability()) {
damaged = is;
} else if (!LocaleQuery.oldVersion) {
//Ignore durability for 1.13+
damaged = is;
}
} else {
//Blocks are not solid so ignore durability
@ -898,6 +910,9 @@ public class Quester {
//Blocks are solid so check for durability
if (m.getDurability() == is.getDurability()) {
toDamage = is;
} else if (!LocaleQuery.oldVersion) {
//Ignore durability for 1.13+
toDamage = is;
}
} else {
//Blocks are not solid so ignore durability
@ -929,6 +944,9 @@ public class Quester {
//Blocks are solid so check for durability
if (m.getDurability() == is.getDurability()) {
placed = is;
} else if (!LocaleQuery.oldVersion) {
//Ignore durability for 1.13+
placed = is;
}
} else {
//Blocks are not solid so ignore durability
@ -942,6 +960,9 @@ public class Quester {
//Blocks are solid so check for durability
if (m.getDurability() == is.getDurability()) {
toPlace = is;
} else if (!LocaleQuery.oldVersion) {
//Ignore durability for 1.13+
toPlace = is;
}
} else {
//Blocks are not solid so ignore durability
@ -973,6 +994,9 @@ public class Quester {
//Blocks are solid so check for durability
if (m.getDurability() == is.getDurability()) {
used = is;
} else if (!LocaleQuery.oldVersion) {
//Ignore durability for 1.13+
used = is;
}
} else {
//Blocks are not solid so ignore durability
@ -986,6 +1010,9 @@ public class Quester {
//Blocks are solid, so check durability
if (m.getDurability() == is.getDurability()) {
toUse = is;
} else if (!LocaleQuery.oldVersion) {
//Ignore durability for 1.13+
toUse = is;
}
} else {
//Blocks are not solid, so ignore durability
@ -1017,6 +1044,9 @@ public class Quester {
//Blocks are solid so check for durability
if (m.getDurability() == is.getDurability()) {
cut = is;
} else if (!LocaleQuery.oldVersion) {
//Ignore durability for 1.13+
cut = is;
}
} else {
//Blocks are not solid so ignore durability
@ -1030,6 +1060,9 @@ public class Quester {
//Blocks are solid so check for durability
if (m.getDurability() == is.getDurability()) {
toCut = is;
} else if (!LocaleQuery.oldVersion) {
//Ignore durability for 1.13+
toCut = is;
}
} else {
//Blocks are not solid so ignore durability

View File

@ -31,7 +31,7 @@ public class LocaleQuery {
private static Class<?> craftMagicNumbers = null;
private static Class<?> itemClazz = null;
private final Quests plugin;
private static boolean oldVersion = false;
public static boolean oldVersion = false;
public LocaleQuery(Quests plugin){
this.plugin = plugin;