From 0ad3867630517b1016b9368a9d9f589ceeaf1009 Mon Sep 17 00:00:00 2001 From: Chaos Date: Sat, 5 Mar 2022 22:49:25 +0100 Subject: [PATCH] fix(schematics): Some Fixes Signed-off-by: Chaos --- .../src/de/steamwar/inventory/SchematicSelector.java | 7 ++++++- SpigotCore_Main/src/de/steamwar/sql/SchematicNode.java | 2 -- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/SpigotCore_Main/src/de/steamwar/inventory/SchematicSelector.java b/SpigotCore_Main/src/de/steamwar/inventory/SchematicSelector.java index 7676de2..1d40716 100644 --- a/SpigotCore_Main/src/de/steamwar/inventory/SchematicSelector.java +++ b/SpigotCore_Main/src/de/steamwar/inventory/SchematicSelector.java @@ -157,6 +157,11 @@ public class SchematicSelector { } private SchematicNode dirUp(SchematicNode parent) { + if(parent == null) { + // Gracefully handle unexpected Updir in Root Folder + depth = 0; + return null; + } if(!singleDirOpen) { if(NodeMember.getNodeMember(parent.getId(), user.getId()) != null) { return null; @@ -239,7 +244,7 @@ public class SchematicSelector { SWItem item = new SWItem(m, name, Collections.singletonList(node.isDir() ? (Core.MESSAGE.parse("SCHEM_SELECTOR_DIR", player)) : Core.MESSAGE.parse("SCHEM_SELECTOR_ITEM_LORE_TYPE", player, node.getSchemtype().name())), !node.isDir() && !node.getSchemtype().writeable(), click -> { }); if(!node.isDir() && node.getRank() > 0) { - item.setLore(Arrays.asList(Core.MESSAGE.parse("SCHEM_SELECTOR_ITEM_LORE_TYPE", player, node.getSchemtype().name()), Core.MESSAGE.parse("SCHEM_SELECTOR_RANK", player))); + item.setLore(Arrays.asList(Core.MESSAGE.parse("SCHEM_SELECTOR_ITEM_LORE_TYPE", player, node.getSchemtype().name()), Core.MESSAGE.parse("SCHEM_SELECTOR_RANK", player, node.getRank()))); } return new SWListInv.SWListEntry<>(item, node); } diff --git a/SpigotCore_Main/src/de/steamwar/sql/SchematicNode.java b/SpigotCore_Main/src/de/steamwar/sql/SchematicNode.java index e6fa356..5331270 100644 --- a/SpigotCore_Main/src/de/steamwar/sql/SchematicNode.java +++ b/SpigotCore_Main/src/de/steamwar/sql/SchematicNode.java @@ -287,8 +287,6 @@ public class SchematicNode { @Deprecated public String getType() { - if(isDir) - throw new SecurityException("Node is Directory"); return type; }