Skip to content
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,10 @@ public boolean applyDetermination(ScriptPath path, ObjectTag determinationObj) {
}
for (int i = 0; i < offers.size(); i++) {
MapTag map = MapTag.getMapFor(offers.getObject(i), getTagContext(path));
if (map.isEmpty()){
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing another space here - generally we recommend using an IDE like Intellji IDEA which can help with the formatting/do it for you, a lot easier than managing it manually.

event.getOffers()[i] = null;
continue;
}
event.getOffers()[i].setCost(map.getElement("cost").asInt());
EnchantmentTag enchantment = map.getObjectAs("enchantment_type", EnchantmentTag.class, getTagContext(path));
if (enchantment == null) {
Expand Down Expand Up @@ -108,6 +112,10 @@ public ObjectTag getContext(String name) {
case "offers":
ListTag output = new ListTag();
for (EnchantmentOffer offer : event.getOffers()) {
if (offer == null) {
output.addObject(new MapTag());
continue;
}
MapTag map = new MapTag();
map.putObject("cost", new ElementTag(offer.getCost()));
map.putObject("enchantment", new ElementTag(offer.getEnchantment().getKey().getKey()));
Expand Down