From a1fca372fc81005846a5697e4ef5264f61a8a22e Mon Sep 17 00:00:00 2001 From: MoBrot <90271578+MoBrot@users.noreply.github.com> Date: Sun, 10 Jul 2022 21:11:53 +0200 Subject: [PATCH 1/4] SchematicSelector.renderItem can not be null --- .../src/de/steamwar/inventory/SchematicSelector.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/SpigotCore_Main/src/de/steamwar/inventory/SchematicSelector.java b/SpigotCore_Main/src/de/steamwar/inventory/SchematicSelector.java index 0f6ba59..63d5ffe 100644 --- a/SpigotCore_Main/src/de/steamwar/inventory/SchematicSelector.java +++ b/SpigotCore_Main/src/de/steamwar/inventory/SchematicSelector.java @@ -235,6 +235,10 @@ public class SchematicSelector { private SWListInv.SWListEntry renderItem(SchematicNode node) { Material m = SWItem.getMaterial(node.getItem()); + if(m == null) { + m = Material.AIR; + } + String name = Core.MESSAGE.parse(filter.name == null?"SCHEM_SELECTOR_ITEM_NAME":"SCHEM_SELECTOR_ITEM_NAME_FILTER", player, node.getName()); if(filter.getName() != null) { From 568d21a50d0e48b14d3c0079ef45e35add8af570 Mon Sep 17 00:00:00 2001 From: MoBrot <90271578+MoBrot@users.noreply.github.com> Date: Sun, 10 Jul 2022 21:25:14 +0200 Subject: [PATCH 2/4] SchematicSelector.renderItem null material replaced to Barrier --- .../src/de/steamwar/inventory/SchematicSelector.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SpigotCore_Main/src/de/steamwar/inventory/SchematicSelector.java b/SpigotCore_Main/src/de/steamwar/inventory/SchematicSelector.java index 63d5ffe..4af18cf 100644 --- a/SpigotCore_Main/src/de/steamwar/inventory/SchematicSelector.java +++ b/SpigotCore_Main/src/de/steamwar/inventory/SchematicSelector.java @@ -236,7 +236,7 @@ public class SchematicSelector { Material m = SWItem.getMaterial(node.getItem()); if(m == null) { - m = Material.AIR; + m = Material.BARRIER; } String name = Core.MESSAGE.parse(filter.name == null?"SCHEM_SELECTOR_ITEM_NAME":"SCHEM_SELECTOR_ITEM_NAME_FILTER", player, node.getName()); From 50a58afa6ae0db7689b8c4890e73612dcb83593a Mon Sep 17 00:00:00 2001 From: MoBrot <90271578+MoBrot@users.noreply.github.com> Date: Tue, 12 Jul 2022 22:08:00 +0200 Subject: [PATCH 3/4] SWItem can not be null --- .../src/de/steamwar/inventory/SWItem.java | 14 ++++++++++---- .../de/steamwar/inventory/SchematicSelector.java | 4 ---- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/SpigotCore_Main/src/de/steamwar/inventory/SWItem.java b/SpigotCore_Main/src/de/steamwar/inventory/SWItem.java index 9f7c2b0..b66d610 100644 --- a/SpigotCore_Main/src/de/steamwar/inventory/SWItem.java +++ b/SpigotCore_Main/src/de/steamwar/inventory/SWItem.java @@ -89,11 +89,17 @@ public class SWItem { @SuppressWarnings("deprecation") public SWItem(Material material, byte meta, String name, List lore, boolean enchanted, InvCallback c) { - try { - itemStack = new ItemStack(material, 1, (short)0, meta); - } catch (IllegalArgumentException e) { - itemStack = new ItemStack(material, 1); + + if(material != null) { + try { + itemStack = new ItemStack(material, 1, (short) 0, meta); + } catch (IllegalArgumentException e) { + itemStack = new ItemStack(material, 1); + } + }else { + itemStack = new ItemStack(Material.BARRIER, 1); } + itemMeta = itemStack.getItemMeta(); if (itemMeta != null) { diff --git a/SpigotCore_Main/src/de/steamwar/inventory/SchematicSelector.java b/SpigotCore_Main/src/de/steamwar/inventory/SchematicSelector.java index 4af18cf..0f6ba59 100644 --- a/SpigotCore_Main/src/de/steamwar/inventory/SchematicSelector.java +++ b/SpigotCore_Main/src/de/steamwar/inventory/SchematicSelector.java @@ -235,10 +235,6 @@ public class SchematicSelector { private SWListInv.SWListEntry renderItem(SchematicNode node) { Material m = SWItem.getMaterial(node.getItem()); - if(m == null) { - m = Material.BARRIER; - } - String name = Core.MESSAGE.parse(filter.name == null?"SCHEM_SELECTOR_ITEM_NAME":"SCHEM_SELECTOR_ITEM_NAME_FILTER", player, node.getName()); if(filter.getName() != null) { From 5076ef955b5cc12acd28e61a139a89573ef46550 Mon Sep 17 00:00:00 2001 From: MoBrot <90271578+MoBrot@users.noreply.github.com> Date: Thu, 21 Jul 2022 12:43:59 +0200 Subject: [PATCH 4/4] SWItem.getMaterial can not be null --- .../src/de/steamwar/inventory/SWItem.java | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/SpigotCore_Main/src/de/steamwar/inventory/SWItem.java b/SpigotCore_Main/src/de/steamwar/inventory/SWItem.java index b66d610..d9f9c23 100644 --- a/SpigotCore_Main/src/de/steamwar/inventory/SWItem.java +++ b/SpigotCore_Main/src/de/steamwar/inventory/SWItem.java @@ -51,7 +51,11 @@ public class SWItem { public static Material getMaterial(String material){ try{ - return FlatteningWrapper.impl.getMaterial(material); + Material m = FlatteningWrapper.impl.getMaterial(material); + if(m == null) + return Material.BARRIER; + + return m; }catch(IllegalArgumentException e){ return Material.STONE; } @@ -90,14 +94,10 @@ public class SWItem { @SuppressWarnings("deprecation") public SWItem(Material material, byte meta, String name, List lore, boolean enchanted, InvCallback c) { - if(material != null) { - try { - itemStack = new ItemStack(material, 1, (short) 0, meta); - } catch (IllegalArgumentException e) { - itemStack = new ItemStack(material, 1); - } - }else { - itemStack = new ItemStack(Material.BARRIER, 1); + try { + itemStack = new ItemStack(material, 1, (short)0, meta); + } catch (IllegalArgumentException e) { + itemStack = new ItemStack(material, 1); } itemMeta = itemStack.getItemMeta();