Skip to content

Commit

Permalink
couple bug fixes (__player def, inventories)
Browse files Browse the repository at this point in the history
  • Loading branch information
mcmonkey4eva committed Apr 14, 2021
1 parent e8e47a6 commit 57306dc
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 10 deletions.
Expand Up @@ -1215,7 +1215,7 @@ public static void registerTags() {

// NOTE: Could just also convert items to an array and pass it all in at once...
for (ItemTag itm : items) {
List<ItemStack> leftovers = dummyInv.addWithLeftovers(0, true, itm.getItemStack());
List<ItemStack> leftovers = dummyInv.addWithLeftovers(0, true, itm.getItemStack().clone());
if (!leftovers.isEmpty()) {
return new ElementTag(false);
}
Expand Down Expand Up @@ -1262,7 +1262,7 @@ public static void registerTags() {
attribute.fulfill(1);
}
for (ItemTag item: items) {
dummyInv.add(0, item.getItemStack());
dummyInv.add(0, item.getItemStack().clone());
}
return dummyInv;
});
Expand Down
Expand Up @@ -570,10 +570,7 @@ public boolean setSpecialDef(String def, ScriptQueue queue, ObjectTag value) {
if (baseData == null) {
return true;
}
PlayerTag player = value.asType(PlayerTag.class, baseData.getTagContext());
if (player == null) {
return false;
}
PlayerTag player = value == null ? null : value.asType(PlayerTag.class, baseData.getTagContext());
if (queue.getLastEntryExecuted() != null) {
((BukkitScriptEntryData) queue.getLastEntryExecuted().entryData).setPlayer(player);
}
Expand All @@ -587,10 +584,7 @@ else if (def.equals("__npc")) {
if (baseData == null) {
return true;
}
NPCTag npc = value.asType(NPCTag.class, baseData.getTagContext());
if (npc == null) {
return false;
}
NPCTag npc = value == null ? null : value.asType(NPCTag.class, baseData.getTagContext());
if (queue.getLastEntryExecuted() != null) {
((BukkitScriptEntryData) queue.getLastEntryExecuted().entryData).setNPC(npc);
}
Expand Down

0 comments on commit 57306dc

Please sign in to comment.