Skip to content

Commit e5a86b6

Browse files
author
TheProgramSrc
committed
Fixed SimpleItem not applying placeholders.
1 parent 27f7247 commit e5a86b6

File tree

3 files changed

+7
-3
lines changed

3 files changed

+7
-3
lines changed

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
<groupId>xyz.theprogramsrc</groupId>
88
<artifactId>SuperCoreAPI</artifactId>
9-
<version>4.2.7</version>
9+
<version>4.2.8</version>
1010
<packaging>jar</packaging>
1111

1212
<name>SuperCoreAPI</name>

src/main/java/xyz/theprogramsrc/supercoreapi/Base.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public void onCheckFail() {
2424

2525
@Override
2626
public void onCheckSuccess(String lastVersion) {
27-
String currentVersion = "4.2.7";
27+
String currentVersion = "4.2.8";
2828
int latest = Integer.parseInt(lastVersion.split(" ")[0].replaceAll("\\.", ""));
2929
int current = Integer.parseInt(currentVersion.split(" ")[0].replaceAll("\\.", ""));
3030
if(latest > current){

src/main/java/xyz/theprogramsrc/supercoreapi/spigot/items/SimpleItem.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -446,6 +446,10 @@ public SimpleItem setPlaceholders(Map<String, String> placeholders){
446446
* @return the {@link ItemStack ItemStack} of this SimpleItem
447447
*/
448448
public ItemStack build(){
449+
String name = this.getDisplayName();
450+
LinkedList<String> lore = this.getLore();
451+
this.setDisplayName(new StringUtils(name).placeholders(this.placeholders).get());
452+
this.setLore(lore.stream().map(s-> new StringUtils(s).placeholders(this.placeholders).get()).toArray(String[]::new));
449453
return new ItemStack(this.item);
450454
}
451455

@@ -454,7 +458,7 @@ public ItemStack build(){
454458
* @return this SimpleItem duplicated
455459
*/
456460
public SimpleItem duplicate(){
457-
return new SimpleItem(this.item);
461+
return new SimpleItem(this.item).setPlaceholders(this.placeholders);
458462
}
459463

460464
/**

0 commit comments

Comments
 (0)