From e73ae9210ce9c59513796770257c8e90cda8314a Mon Sep 17 00:00:00 2001 From: Chaoscaot Date: Sat, 27 Nov 2021 15:12:54 +0100 Subject: [PATCH] Fix Default Signed-off-by: Chaoscaot --- SpigotCore_Main/src/de/steamwar/sql/SchematicNode.java | 6 +++++- SpigotCore_Main/src/de/steamwar/util/SchematicSelector.java | 6 +----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/SpigotCore_Main/src/de/steamwar/sql/SchematicNode.java b/SpigotCore_Main/src/de/steamwar/sql/SchematicNode.java index f850a03..4e959a3 100644 --- a/SpigotCore_Main/src/de/steamwar/sql/SchematicNode.java +++ b/SpigotCore_Main/src/de/steamwar/sql/SchematicNode.java @@ -22,6 +22,7 @@ package de.steamwar.sql; import com.sk89q.worldedit.extent.clipboard.Clipboard; import de.steamwar.core.Core; import de.steamwar.core.WorldEditWrapper; +import de.steamwar.inventory.SWItem; import org.bukkit.entity.Player; import java.io.ByteArrayInputStream; @@ -321,7 +322,7 @@ public class SchematicNode { if (currentNode == null) { node = SchematicNode.getSchematicsAccessibleByUser(user.getId(), 0).stream().filter(node1 -> node1.getName().equals(layers[finalI])).findAny(); } else { - node = Optional.of(SchematicNode.getSchematicNode(layers[i], currentNode.getId())); + node = Optional.ofNullable(SchematicNode.getSchematicNode(layers[i], currentNode.getId())); } if (!node.isPresent()) { return null; @@ -401,6 +402,9 @@ public class SchematicNode { } public String getItem() { + if (item.isEmpty()) { + return isDir ? "CHEST" : "CAULDRON_ITEM"; + } return item; } diff --git a/SpigotCore_Main/src/de/steamwar/util/SchematicSelector.java b/SpigotCore_Main/src/de/steamwar/util/SchematicSelector.java index 9518707..90f62c7 100644 --- a/SpigotCore_Main/src/de/steamwar/util/SchematicSelector.java +++ b/SpigotCore_Main/src/de/steamwar/util/SchematicSelector.java @@ -144,11 +144,7 @@ public class SchematicSelector { } private SWListInv.SWListEntry renderItem(SchematicNode node) { - Material m; - if (node.getItem().isEmpty()) - m = node.isDir()?SWItem.getMaterial("CHEST"):SWItem.getMaterial("CAULDRON_ITEM"); - else - m = SWItem.getMaterial(node.getItem()); + Material m = SWItem.getMaterial(node.getItem()); String name = Core.MESSAGE.parse(filter.name == null?"SCHEM_SELECTOR_ITEM_NAME":"SCHEM_SELECTOR_ITEM_NAME_FILTER", player, node.getName());