Skip to content

Commit

Permalink
update display reward above chests
Browse files Browse the repository at this point in the history
  • Loading branch information
ryderbelserion committed Jul 18, 2024
1 parent d375800 commit 82d7980
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -96,18 +96,17 @@ public void onChestClick(PlayerInteractEvent event) {
display.setItemMeta(itemMeta);

// Convert the item stack to item builder.
// The max integer prevents it from stacking.
final ItemStack itemStack = ItemUtils.convertItemStack(display).addDisplayLore(ThreadLocalRandom.current().nextInt(Integer.MAX_VALUE) + "").getStack();
final ItemStack itemStack = ItemUtils.convertItemStack(display).getStack();

// Drop the item.
final Item reward = player.getWorld().dropItem(block.getLocation().add(.5, 1, .5), itemStack);

// Set data
reward.setMetadata("betterdrops_ignore", new FixedMetadataValue(plugin, true));
reward.setVelocity(new Vector(0, .2, 0));
reward.customName(itemMeta.displayName());
reward.setCustomNameVisible(true);
reward.setPickupDelay(Integer.MAX_VALUE);
reward.setCanMobPickup(false);
reward.setCanPlayerPickup(false);

// Add open crates
session.getCratesOpened().put(block.getLocation(), true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,11 +151,11 @@ public void open(@NotNull final KeyType type, final boolean checkHand) {
return;
}

reward.setMetadata("betterdrops_ignore", new FixedMetadataValue(this.plugin, true));
reward.setVelocity(new Vector(0, .2, 0));
reward.customName(AdvUtil.parse(prize.getPrizeName()));
reward.setCustomNameVisible(true);
reward.setPickupDelay(-1);
reward.setCanMobPickup(false);
reward.setCanPlayerPickup(false);

this.crateManager.addReward(player, reward);

Expand Down

0 comments on commit 82d7980

Please sign in to comment.