Skip to content

Commit

Permalink
v1.8.3.6
Browse files Browse the repository at this point in the history
- Allow ItemBuilder loading from ConfigurationSection to skip importing a material if one isn't set. This requires that implementations set the material manually after, since default is set to AIR.
  • Loading branch information
Jake-Moore committed Nov 7, 2023
1 parent 61475a6 commit 2c8fa8a
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<groupId>com.kamikazejamplugins</groupId>
<artifactId>kamicommon</artifactId>
<version>1.8.3.5</version>
<version>1.8.3.6</version>
<packaging>jar</packaging>

<name>KamiCommon</name>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,14 +67,15 @@ public void loadBasicItem(ConfigurationSection config) {
this.name = config.getString("name");
this.lore = config.getStringList("lore");

String mat = config.getString("material", config.getString("type"));
String mat = config.getString("material", config.getString("type", null));
if (mat == null) { return; }

CustomStack customStack = CustomStack.getInstance(mat);

ItemStack item;
if (customStack != null) {
this.base = customStack.getItemStack();
}else {
this.material = XMaterial.matchXMaterial(config.getString("material", config.getString("type"))).orElseThrow(() -> new IllegalArgumentException("Invalid material: " + config.getString("material", config.getString("type"))));
this.material = XMaterial.matchXMaterial(mat).orElseThrow(() -> new IllegalArgumentException("Invalid material: " + config.getString("material", config.getString("type"))));
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,10 @@ public void loadBasicItem(ConfigurationSection config) {
short damage = (short) config.getInt("damage", 0);
int amount = config.getInt("amount", 1);

this.material = XMaterial.matchXMaterial(config.getString("material")).orElseThrow(() -> new IllegalArgumentException("Invalid material: " + config.getString("material")));
String mat = config.getString("material", config.getString("type", null));
if (mat != null) {
this.material = XMaterial.matchXMaterial(mat).orElseThrow(() -> new IllegalArgumentException("Invalid material: " + config.getString("material")));
}
this.amount = amount;
this.damage = damage;
this.name = config.getString("name");
Expand Down

0 comments on commit 2c8fa8a

Please sign in to comment.