Skip to content
Closed
Changes from all 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 @@ -460,10 +460,13 @@ public ItemStack build() {
this.lore = new ArrayList<>();
}

for (String placeholder : placeholders.keySet()) {
Object value = placeholders.getOrDefault(placeholder, "NULL");
setName(this.name.replace(placeholder, value.toString()));
setLore(this.lore.stream().map((s) -> s.replace(placeholder, value.toString()))
for (Map.Entry<String, Object> entry : placeholders.entrySet()) {
// getOrDefault protegge solo dalla chiave assente: se il valore mappato e' null
// va comunque gestito qui, altrimenti value.toString() lancia NPE.
Object raw = entry.getValue();
String value = raw != null ? raw.toString() : "NULL";
setName(this.name.replace(entry.getKey(), value));
setLore(this.lore.stream().map((s) -> s.replace(entry.getKey(), value))
.collect(Collectors.toList()));
}
String name = this.name;
Expand Down