From 3a28f5c42f57353d016b9646c37b59ede9b925d2 Mon Sep 17 00:00:00 2001 From: yoyosource Date: Fri, 9 Dec 2022 22:14:09 +0100 Subject: [PATCH] Hotfix AttributesCopyCommand and AttributesPlaceListener Signed-off-by: yoyosource --- .../attributescopy/AttributesCopyCommand.java | 2 +- .../attributescopy/AttributesPlaceListener.java | 12 +++++++++--- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/AttributesCopyCommand.java b/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/AttributesCopyCommand.java index fb32c023..5538b73a 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/AttributesCopyCommand.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/AttributesCopyCommand.java @@ -63,7 +63,7 @@ public class AttributesCopyCommand extends SWCommand { BlockData blockData = block.getBlockData(); List attributesToCopy = new ArrayList<>(); if (needsType(block)) { - attributesToCopy.add("§8-§7 type " + block.getType().name().toLowerCase()); + attributesToCopy.add("§8-§7 material " + block.getType().name().toLowerCase()); } for (BlockAttribute blockAttribute : blockAttributeList) { if (blockAttribute.type().isInstance(blockData)) { diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/AttributesPlaceListener.java b/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/AttributesPlaceListener.java index 7976e5cd..0daed5af 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/AttributesPlaceListener.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/AttributesPlaceListener.java @@ -65,10 +65,16 @@ public class AttributesPlaceListener implements Listener { event.setCancelled(true); Bukkit.getScheduler().runTaskLater(BauSystem.getInstance(), () -> { Material material = strings.stream() - .filter(s -> s.startsWith("§8-§7 type ")) - .map(s -> s.replace("§8-§7 type ", "")) + .filter(s -> s.startsWith("§8-§7 material ")) + .map(s -> s.replace("§8-§7 material ", "")) .map(String::toUpperCase) - .map(Material::valueOf) + .map(s -> { + try { + return Material.valueOf(s.toUpperCase()); + } catch (Exception e) { + return null; + } + }) .findFirst() .orElse(type); event.getBlock().setType(material, false);