Skip to content

Commit

Permalink
remove the code that makes the displayitem a prize if nothing else is…
Browse files Browse the repository at this point in the history
… found
  • Loading branch information
ryderbelserion committed Sep 6, 2024
1 parent d044993 commit dfb8f3b
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 20 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@
- Updated the /crates additem command
- CrazyCrates now supports MiniMessage, regardless of the item format used.
- This is only happening, as legacy colors have been removed and I did some research.
- Updated Vital API
- Updated Vital API
- Removed the code, that if no `Items` or `Editor-Items` or `Commands` were found, that it would use the `DisplayItem`, `DisplayName` etc as a prize.
Original file line number Diff line number Diff line change
Expand Up @@ -79,15 +79,6 @@ public static void givePrize(@NotNull final Player player, @Nullable Prize prize
player.getWorld().dropItemNaturally(player.getLocation(), item.setPlayer(player).getStack());
}
}
} else {
// Only give them the display item as a reward if prize commands are empty.
if (prize.getCommands().isEmpty() && prize.getEditorItems().isEmpty()) {
if (!MiscUtils.isInventoryFull(player)) {
MiscUtils.addItem(player, prize.getPrizeItem().setPlayer(player).getStack());
} else {
player.getWorld().dropItemNaturally(player.getLocation(), prize.getPrizeItem().setPlayer(player).getStack());
}
}
}

for (final String command : crate.getPrizeCommands()) {
Expand Down
11 changes: 1 addition & 10 deletions src/main/java/com/badbones69/crazycrates/api/objects/Prize.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ public class Prize {

private List<String> permissions = new ArrayList<>();
private ItemBuilder displayItem = new ItemBuilder();
private ItemBuilder prizeItem = new ItemBuilder();
private boolean firework = false;
private String crateName = "";
private int maxRange = 100;
Expand Down Expand Up @@ -82,8 +81,7 @@ public Prize(@NotNull final ConfigurationSection section, List<ItemStack> editor
this.broadcastMessages = section.getStringList("Settings.Broadcast.Messages");
this.broadcastPermission = section.getString("Settings.Broadcast.Permission", "");

this.prizeItem = display();
this.displayItem = new ItemBuilder(this.prizeItem, true);
this.displayItem = display();

this.editorItems = editorItems;
}
Expand Down Expand Up @@ -164,13 +162,6 @@ public Prize(@NotNull final String prizeName, @NotNull final String sectionName,

return this.displayItem.setPlayer(player).setPersistentString(Keys.crate_prize.getNamespacedKey(), this.sectionName).getStack();
}

/**
* @return the ItemBuilder of the display item.
*/
public @NotNull final ItemBuilder getPrizeItem() {
return this.prizeItem;
}

/**
* @return the list of tiers the prize is in.
Expand Down

0 comments on commit dfb8f3b

Please sign in to comment.