mirror of
https://github.com/PikaMug/Quests.git
synced 2024-11-21 18:15:32 +01:00
Book titles can be null, fixes #2108
This commit is contained in:
parent
5b63533e7b
commit
8d4b39c9d7
@ -34,6 +34,7 @@ import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Objects;
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public class ItemUtil {
|
||||
@ -132,10 +133,13 @@ public class ItemUtil {
|
||||
if (one.getType().equals(Material.WRITTEN_BOOK)) {
|
||||
final BookMeta bMeta1 = (BookMeta) one.getItemMeta();
|
||||
final BookMeta bMeta2 = (BookMeta) two.getItemMeta();
|
||||
if (!bMeta1.getTitle().equals(bMeta2.getTitle())) {
|
||||
if (!bMeta1.getAuthor().equals(bMeta2.getAuthor())) {
|
||||
if (!bMeta1.getPages().equals(bMeta2.getPages())) {
|
||||
return -8;
|
||||
if (bMeta1 != null && bMeta2 != null) {
|
||||
// Title and author can be null
|
||||
if (Objects.equals(bMeta1.getTitle(), bMeta2.getTitle())) {
|
||||
if (Objects.equals(bMeta1.getAuthor(), bMeta2.getAuthor())) {
|
||||
if (!bMeta1.getPages().equals(bMeta2.getPages())) {
|
||||
return -8;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user