Skip to content

Commit

Permalink
Only set glow if the config contains it.
Browse files Browse the repository at this point in the history
  • Loading branch information
ryderbelserion committed Jan 17, 2025
1 parent 82afacb commit 0188731
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,9 @@ private void send(final Player target, final Crate crate) {

//builder.addLorePlaceholder("%chance%", this.getTotalChance());

builder.setGlowing(this.section.getBoolean("Glowing", false));
if (this.section.contains("Glowing")) {
builder.setGlowing(this.section.getBoolean("Glowing", false));
}

builder.setDamage(this.section.getInt("DisplayDamage", 0));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public void open() {

case "custom-model-data" -> item.setCustomModelData(Methods.tryParseInt(value).orElse(-1).intValue());

case "glowing" -> item.setGlowing(Methods.tryParseBoolean(value).orElse(null));
case "glowing" -> item.setGlowing(Methods.tryParseBoolean(value).orElse(false));

case "slot" -> slot = Methods.tryParseInt(value).orElse(-1).intValue();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,9 @@ public static String getKey(@NotNull final PersistentDataContainerView container
}

public static @NotNull ItemBuilder getItem(@NotNull final ConfigurationSection section, @NotNull final ItemBuilder builder) {
builder.setGlowing(section.contains("Glowing") ? section.getBoolean("Glowing") : null);
if (section.contains("Glowing")) {
builder.setGlowing(section.getBoolean("Glowing", false));
}

builder.setDamage(section.getInt("DisplayDamage", 0));

Expand Down Expand Up @@ -239,7 +241,7 @@ public static ItemBuilder convertString(String itemString, String section) {
itemBuilder.setEntityType(type);
}
}
case "glowing" -> itemBuilder.setGlowing(Boolean.parseBoolean(value));
case "glowing" -> itemBuilder.setGlowing(Methods.tryParseBoolean(value).orElse(false));
case "amount" -> {
final Optional<Number> amount = Methods.tryParseInt(value);
itemBuilder.setAmount(amount.map(Number::intValue).orElse(1));
Expand Down

0 comments on commit 0188731

Please sign in to comment.