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 6c158793..9224d0a3 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/AttributesCopyCommand.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/AttributesCopyCommand.java @@ -25,6 +25,7 @@ import de.steamwar.command.SWCommand; import de.steamwar.linkage.Linked; import de.steamwar.linkage.MinVersion; import org.bukkit.FluidCollisionMode; +import org.bukkit.Material; import org.bukkit.block.Block; import org.bukkit.block.data.BlockData; import org.bukkit.entity.Player; @@ -53,9 +54,10 @@ public class AttributesCopyCommand extends SWCommand { linkIfNeeded(); Block block = player.getTargetBlockExact(8, FluidCollisionMode.ALWAYS); + if (block == null) return; ItemStack mainHand = player.getInventory().getItemInMainHand(); - if (mainHand.getType() != block.getType()) { - BauSystem.MESSAGE.send("ATTRIBUTES_CANT_COPY", player); + if (!isSame(block, mainHand)) { + BauSystem.MESSAGE.send("ATTRIBUTE_COPY_NOT_SAME", player); return; } BlockData blockData = block.getBlockData(); @@ -84,4 +86,10 @@ public class AttributesCopyCommand extends SWCommand { LinkageUtils.linkBlockAttributes(); isLinked = true; } + + private boolean isSame(Block block, ItemStack itemStack) { + if (block.getType() == itemStack.getType()) return true; + if (itemStack.getType() == Material.REDSTONE && block.getType() == Material.REDSTONE_WIRE) return true; + return false; + } }