Skip to content

Commit

Permalink
pass context around more
Browse files Browse the repository at this point in the history
  • Loading branch information
mcmonkey4eva committed Mar 20, 2020
1 parent 81175fc commit c1db759
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
@@ -1,5 +1,6 @@
package com.denizenscript.depenizen.bukkit.events.askyblock;

import com.denizenscript.denizencore.utilities.CoreUtilities;
import com.wasteofplastic.askyblock.events.ChallengeCompleteEvent;
import com.denizenscript.denizen.utilities.implementation.BukkitScriptEntryData;
import com.denizenscript.denizen.events.BukkitScriptEvent;
Expand Down Expand Up @@ -38,7 +39,6 @@ public class PlayerCompletesSkyBlockChallengeScriptEvent extends BukkitScriptEve
public ElementTag challenge;
public ElementTag xp_reward;
public ElementTag money_reward;
public ListTag item_rewards;

public PlayerCompletesSkyBlockChallengeScriptEvent() {
instance = this;
Expand Down Expand Up @@ -71,6 +71,13 @@ else if (name.equals("money_reward")) {
return money_reward;
}
else if (name.equals("item_rewards")) {
ListTag item_rewards = new ListTag();
for (String i : event.getItemRewards()) {
ItemTag item = ItemTag.valueOf(i, CoreUtilities.basicContext);
if (item != null) {
item_rewards.addObject(item);
}
}
return item_rewards;
}
return super.getContext(name);
Expand All @@ -81,13 +88,6 @@ public void onPlayerCompletesSkyBlockChallenge(ChallengeCompleteEvent event) {
challenge = new ElementTag(event.getChallengeName());
xp_reward = new ElementTag(event.getExpReward());
money_reward = new ElementTag(event.getMoneyReward());
item_rewards = new ListTag();
for (String i : event.getItemRewards()) {
ItemTag item = ItemTag.valueOf(i);
if (item != null) {
item_rewards.addObject(item);
}
}
this.event = event;
fire(event);
}
Expand Down
Expand Up @@ -96,7 +96,7 @@ public String getAttribute(Attribute attribute) {
WorldEditPlugin worldEdit = (WorldEditPlugin) WorldEditBridge.instance.plugin;
ItemType itemType;
if (attribute.hasContext(1)) {
itemType = BukkitAdapter.asItemType(deLegacy(ItemTag.valueOf(attribute.getContext(1)).getMaterial().getMaterial()));
itemType = BukkitAdapter.asItemType(deLegacy(ItemTag.valueOf(attribute.getContext(1), attribute.context).getMaterial().getMaterial()));
}
else {
ItemStack itm = player.getEquipment().getItemInMainHand();
Expand Down

0 comments on commit c1db759

Please sign in to comment.