Skip to content

Commit 627308f

Browse files
committed
Fixed deserializing items without lore
1 parent d8fea47 commit 627308f

File tree

3 files changed

+9
-4
lines changed

3 files changed

+9
-4
lines changed

README.MD

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ maven {
2121
url = 'https://repo.mikigal.pl/releases'
2222
}
2323
24-
compile group: 'pl.mikigal', name: 'ConfigAPI', version: '1.2.1'
24+
compile group: 'pl.mikigal', name: 'ConfigAPI', version: '1.2.2'
2525
```
2626

2727
#### Maven
@@ -34,7 +34,7 @@ compile group: 'pl.mikigal', name: 'ConfigAPI', version: '1.2.1'
3434
<dependency>
3535
<groupId>pl.mikigal</groupId>
3636
<artifactId>ConfigAPI</artifactId>
37-
<version>1.2.1</version>
37+
<version>1.2.2</version>
3838
<scope>compile</scope>
3939
</dependency>
4040
```

build.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ plugins {
44
}
55

66
group 'pl.mikigal'
7-
version '1.2.1'
7+
version '1.2.2'
88

99
publishing {
1010
repositories {

src/main/java/pl/mikigal/config/serializer/ItemStackSerializer.java

+6-1
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,12 @@ public ItemStack deserialize(String path, BukkitConfiguration configuration) {
7272
int amount = section.contains("amount") ? section.getInt("amount") : 1;
7373
short durability = section.contains("durability") ? (short) section.getInt("durability") : 0;
7474
String name = section.getString("name");
75-
List<String> lore = Serializers.of(List.class).deserialize(path + ".lore", configuration);
75+
76+
boolean hasLore = section.getConfigurationSection("lore") != null &&
77+
section.getConfigurationSection("lore").getString("structure") != null;
78+
List<String> lore = hasLore ?
79+
Serializers.of(List.class).deserialize(path + ".lore", configuration) :
80+
new ArrayList<>();
7681

7782
ItemStack itemStack = new ItemStack(material, amount, durability);
7883
ItemMeta itemMeta = itemStack.getItemMeta();

0 commit comments

Comments
 (0)