aboutsummaryrefslogtreecommitdiffstats
path: root/bukkit/src/main/java/com/leonardobishop
diff options
context:
space:
mode:
authorKrakenied <Krakenied1@gmail.com>2024-09-06 21:17:15 +0200
committerKrakenied <46192742+Krakenied@users.noreply.github.com>2024-09-06 21:30:21 +0200
commit721bce0f58b6c90f520a84dace60c35dbe9bbacc (patch)
tree43a40ceb3184e56731e084ff7a3ec206e1a7d51c /bukkit/src/main/java/com/leonardobishop
parentc1a01536f7bd3fdffe46ecd24115c4515350a283 (diff)
Move the null check to a logically more proper place
Diffstat (limited to 'bukkit/src/main/java/com/leonardobishop')
-rw-r--r--bukkit/src/main/java/com/leonardobishop/quests/bukkit/tasktype/type/TradingTaskType.java12
1 files changed, 6 insertions, 6 deletions
diff --git a/bukkit/src/main/java/com/leonardobishop/quests/bukkit/tasktype/type/TradingTaskType.java b/bukkit/src/main/java/com/leonardobishop/quests/bukkit/tasktype/type/TradingTaskType.java
index 6fd4440c..ce74a327 100644
--- a/bukkit/src/main/java/com/leonardobishop/quests/bukkit/tasktype/type/TradingTaskType.java
+++ b/bukkit/src/main/java/com/leonardobishop/quests/bukkit/tasktype/type/TradingTaskType.java
@@ -104,7 +104,7 @@ public final class TradingTaskType extends BukkitTaskType {
}
}
- if (firstIngredient != null && task.hasConfigKey("first-ingredient")) {
+ if (task.hasConfigKey("first-ingredient")) {
QuestItem qi;
if ((qi = fixedQuestFirstIngredientCache.get(quest.getId(), task.getId())) == null) {
QuestItem fetchedItem = TaskUtils.getConfigQuestItem(task, "first-ingredient", "data");
@@ -112,16 +112,16 @@ public final class TradingTaskType extends BukkitTaskType {
qi = fetchedItem;
}
- super.debug("First ingredient was of type " + firstIngredient.getType(), quest.getId(), task.getId(), player.getUniqueId());
+ super.debug("First ingredient was of type " + (firstIngredient != null ? firstIngredient.getType() : null), quest.getId(), task.getId(), player.getUniqueId());
boolean exactMatch = TaskUtils.getConfigBoolean(task, "first-ingredient-exact-match", true);
- if (!qi.compareItemStack(firstIngredient, exactMatch)) {
+ if (firstIngredient == null || !qi.compareItemStack(firstIngredient, exactMatch)) {
super.debug("First ingredient does not match required item, continuing...", quest.getId(), task.getId(), player.getUniqueId());
continue;
}
}
- if (secondIngredient != null && task.hasConfigKey("second-ingredient")) {
+ if (task.hasConfigKey("second-ingredient")) {
QuestItem qi;
if ((qi = fixedQuestSecondIngredientCache.get(quest.getId(), task.getId())) == null) {
QuestItem fetchedItem = TaskUtils.getConfigQuestItem(task, "second-ingredient", "data");
@@ -129,10 +129,10 @@ public final class TradingTaskType extends BukkitTaskType {
qi = fetchedItem;
}
- super.debug("Second ingredient was of type " + secondIngredient.getType(), quest.getId(), task.getId(), player.getUniqueId());
+ super.debug("Second ingredient was of type " + (secondIngredient != null ? secondIngredient.getType() : null), quest.getId(), task.getId(), player.getUniqueId());
boolean exactMatch = TaskUtils.getConfigBoolean(task, "second-ingredient-exact-match", true);
- if (!qi.compareItemStack(secondIngredient, exactMatch)) {
+ if (secondIngredient == null || !qi.compareItemStack(secondIngredient, exactMatch)) {
super.debug("Second ingredient does not match required item, continuing...", quest.getId(), task.getId(), player.getUniqueId());
continue;
}