From 75ba8813d3eb24008e2d6c711ea87aac40f95a1c Mon Sep 17 00:00:00 2001 From: yoyosource Date: Thu, 8 Dec 2022 20:21:51 +0100 Subject: [PATCH] Add attributes copy feature Signed-off-by: yoyosource --- .../linkage/types/BlockAttribute_GENERIC.java | 40 +++++++ BauSystem_Main/src/BauSystem.properties | 10 ++ BauSystem_Main/src/BauSystem_de.properties | 9 ++ .../AttributeRemoveCommand.java | 102 ++++++++++++++++++ .../attributescopy/AttributesCopyCommand.java | 87 +++++++++++++++ .../AttributesCopyListener.java | 62 +++++++++++ .../attributescopy/BlockAttribute.java | 31 ++++++ .../attributescopy/impl/AgeableAttribute.java | 53 +++++++++ .../impl/AnaloguePowerableAttribute.java | 53 +++++++++ .../impl/AttachableAttribute.java | 48 +++++++++ .../impl/BisectedAttribute.java | 53 +++++++++ .../impl/DirectionalAttribute.java | 54 ++++++++++ .../impl/FaceAttachableAttribute.java | 53 +++++++++ .../impl/HangableAttribute.java | 51 +++++++++ .../impl/LevelledAttribute.java | 53 +++++++++ .../impl/LightableAttribute.java | 48 +++++++++ .../impl/MultipleFacingAttribute.java | 54 ++++++++++ .../impl/OpenableAttribute.java | 48 +++++++++ .../impl/OrientableAttribute.java | 55 ++++++++++ .../impl/PowerableAttribute.java | 48 +++++++++ .../attributescopy/impl/RailAttribute.java | 53 +++++++++ .../impl/RotatableAttribute.java | 54 ++++++++++ .../impl/SnowableAttribute.java | 48 +++++++++ .../impl/WaterloggedAttribute.java | 49 +++++++++ .../impl/type/BambooAttribute.java | 53 +++++++++ .../impl/type/BellAttribute.java | 53 +++++++++ .../impl/type/BigDripleafAttribute.java | 55 ++++++++++ .../impl/type/CakeAttribute.java | 53 +++++++++ .../impl/type/CampfireAttribute.java | 48 +++++++++ .../impl/type/CandleAttribute.java | 53 +++++++++ .../impl/type/CaveVinesPlantAttribute.java | 48 +++++++++ .../impl/type/ComparatorAttribute.java | 53 +++++++++ .../impl/type/DaylightDetectorAttribute.java | 48 +++++++++ .../impl/type/DoorAttribute.java | 53 +++++++++ .../impl/type/EndPortalFrameAttribute.java | 48 +++++++++ .../impl/type/FarmlandAttribute.java | 53 +++++++++ .../impl/type/GateAttribute.java | 48 +++++++++ .../impl/type/HopperAttribute.java | 48 +++++++++ .../impl/type/JigsawAttribute.java | 53 +++++++++ .../impl/type/LanternAttribute.java | 49 +++++++++ .../impl/type/LeavesAttribute.java | 48 +++++++++ .../impl/type/PointedDripstoneAttribute.java | 62 +++++++++++ .../impl/type/RedstoneWireAttribute.java | 60 +++++++++++ .../impl/type/RepeaterAttribute.java | 53 +++++++++ .../impl/type/RespawnAnchorAttribute.java | 53 +++++++++ .../impl/type/SaplingAttribute.java | 53 +++++++++ .../impl/type/ScaffoldingAttribute.java | 56 ++++++++++ .../impl/type/SculkSensorAttribute.java | 53 +++++++++ .../impl/type/SeaPickleAttribute.java | 53 +++++++++ .../impl/type/SlabAttribute.java | 53 +++++++++ .../impl/type/SnowAttribute.java | 53 +++++++++ .../impl/type/StairsAttribute.java | 53 +++++++++ .../impl/type/StructureBlockAttribute.java | 53 +++++++++ .../impl/type/TNTAttribute.java | 48 +++++++++ .../impl/type/TripwireAttribute.java | 48 +++++++++ .../impl/type/TurtleEggAttribute.java | 61 +++++++++++ .../impl/type/WallAttribute.java | 63 +++++++++++ .../steamwar/bausystem/utils/NMSWrapper.java | 1 - 58 files changed, 2955 insertions(+), 1 deletion(-) create mode 100644 BauSystem_Linkage/src/de/steamwar/linkage/types/BlockAttribute_GENERIC.java create mode 100644 BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/AttributeRemoveCommand.java create mode 100644 BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/AttributesCopyCommand.java create mode 100644 BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/AttributesCopyListener.java create mode 100644 BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/BlockAttribute.java create mode 100644 BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/AgeableAttribute.java create mode 100644 BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/AnaloguePowerableAttribute.java create mode 100644 BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/AttachableAttribute.java create mode 100644 BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/BisectedAttribute.java create mode 100644 BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/DirectionalAttribute.java create mode 100644 BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/FaceAttachableAttribute.java create mode 100644 BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/HangableAttribute.java create mode 100644 BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/LevelledAttribute.java create mode 100644 BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/LightableAttribute.java create mode 100644 BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/MultipleFacingAttribute.java create mode 100644 BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/OpenableAttribute.java create mode 100644 BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/OrientableAttribute.java create mode 100644 BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/PowerableAttribute.java create mode 100644 BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/RailAttribute.java create mode 100644 BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/RotatableAttribute.java create mode 100644 BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/SnowableAttribute.java create mode 100644 BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/WaterloggedAttribute.java create mode 100644 BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/type/BambooAttribute.java create mode 100644 BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/type/BellAttribute.java create mode 100644 BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/type/BigDripleafAttribute.java create mode 100644 BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/type/CakeAttribute.java create mode 100644 BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/type/CampfireAttribute.java create mode 100644 BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/type/CandleAttribute.java create mode 100644 BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/type/CaveVinesPlantAttribute.java create mode 100644 BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/type/ComparatorAttribute.java create mode 100644 BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/type/DaylightDetectorAttribute.java create mode 100644 BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/type/DoorAttribute.java create mode 100644 BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/type/EndPortalFrameAttribute.java create mode 100644 BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/type/FarmlandAttribute.java create mode 100644 BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/type/GateAttribute.java create mode 100644 BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/type/HopperAttribute.java create mode 100644 BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/type/JigsawAttribute.java create mode 100644 BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/type/LanternAttribute.java create mode 100644 BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/type/LeavesAttribute.java create mode 100644 BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/type/PointedDripstoneAttribute.java create mode 100644 BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/type/RedstoneWireAttribute.java create mode 100644 BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/type/RepeaterAttribute.java create mode 100644 BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/type/RespawnAnchorAttribute.java create mode 100644 BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/type/SaplingAttribute.java create mode 100644 BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/type/ScaffoldingAttribute.java create mode 100644 BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/type/SculkSensorAttribute.java create mode 100644 BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/type/SeaPickleAttribute.java create mode 100644 BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/type/SlabAttribute.java create mode 100644 BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/type/SnowAttribute.java create mode 100644 BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/type/StairsAttribute.java create mode 100644 BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/type/StructureBlockAttribute.java create mode 100644 BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/type/TNTAttribute.java create mode 100644 BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/type/TripwireAttribute.java create mode 100644 BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/type/TurtleEggAttribute.java create mode 100644 BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/type/WallAttribute.java diff --git a/BauSystem_Linkage/src/de/steamwar/linkage/types/BlockAttribute_GENERIC.java b/BauSystem_Linkage/src/de/steamwar/linkage/types/BlockAttribute_GENERIC.java new file mode 100644 index 00000000..b898485b --- /dev/null +++ b/BauSystem_Linkage/src/de/steamwar/linkage/types/BlockAttribute_GENERIC.java @@ -0,0 +1,40 @@ +/* + * This file is a part of the SteamWar software. + * + * Copyright (C) 2022 SteamWar.de-Serverteam + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +package de.steamwar.linkage.types; + +import de.steamwar.linkage.LinkageType; +import de.steamwar.linkage.plan.BuildPlan; +import de.steamwar.linkage.plan.MethodBuilder; + +import javax.lang.model.element.TypeElement; + +public class BlockAttribute_GENERIC implements LinkageType { + + @Override + public String method() { + return "linkBlockAttributes"; + } + + @Override + public void generateCode(BuildPlan buildPlan, MethodBuilder methodBuilder, String s, TypeElement typeElement) { + buildPlan.addImport("de.steamwar.bausystem.features.attributescopy.*"); + methodBuilder.addLine("AttributesCopyCommand.add(" + s + ");"); + } +} diff --git a/BauSystem_Main/src/BauSystem.properties b/BauSystem_Main/src/BauSystem.properties index b12123b3..4e48968d 100644 --- a/BauSystem_Main/src/BauSystem.properties +++ b/BauSystem_Main/src/BauSystem.properties @@ -81,6 +81,16 @@ REGION_TYPE_NORMAL = Normal REGION_TYPE_BUILD = Build area REGION_TYPE_ONLY_TB = Dummy +# AttributesCopy +ATTRIBUTES_CANT_COPY = §cYou need to hold the same item type and hover over the same block to copy. +ATTRIBUTES_NO_COPY = §cNo attributes to copy. +ATTRIBUTES_COPIED = §eAttributes copied. + +ATTRIBUTE_REMOVE_COMMAND_HELP = §8/§eattributeremove §8[§eattribute§8|§7all§8|§7*§8] +ATTRIBUTE_REMOVE_ALL = §eAll attributes removed. +ATTRIBUTE_REMOVE_SINGLE = §eAttribute §7{0}§e removed. +ATTRIBUTE_REMOVE_NOT_FOUND = §cAttribute not found + # AutoStart AUTOSTART_COMMAND_HELP = §8/§etimer §8- §7Retrieve AutostartTimer Tool AUTOSTART_ITEM_NAME = §eAutostartTimer diff --git a/BauSystem_Main/src/BauSystem_de.properties b/BauSystem_Main/src/BauSystem_de.properties index a67bab2b..6c9896f2 100644 --- a/BauSystem_Main/src/BauSystem_de.properties +++ b/BauSystem_Main/src/BauSystem_de.properties @@ -81,6 +81,15 @@ REGION_TYPE_NORMAL = Normal REGION_TYPE_BUILD = Baubereich REGION_TYPE_ONLY_TB = Testblock +# AttributesCopy +ATTRIBUTES_CANT_COPY = §cDu musst den Item Type in der Hand halten wo du auch drauf guckst. +ATTRIBUTES_NO_COPY = §cKeine Attribute kopiert. +ATTRIBUTES_COPIED = §eAttribute kopiert. + +ATTRIBUTE_REMOVE_ALL = §eAlle Attribute entfernt. +ATTRIBUTE_REMOVE_SINGLE = §eAttribut §7{0}§e entfernt. +ATTRIBUTE_REMOVE_NOT_FOUND = §cAttribut nicht gefunden + # AutoStart AUTOSTART_COMMAND_HELP = §8/§etimer §8- §7Legt den AutostartTimer ins Inventar AUTOSTART_ITEM_NAME = §eAutostartTimer diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/AttributeRemoveCommand.java b/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/AttributeRemoveCommand.java new file mode 100644 index 00000000..ab822fc2 --- /dev/null +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/AttributeRemoveCommand.java @@ -0,0 +1,102 @@ +/* + * This file is a part of the SteamWar software. + * + * Copyright (C) 2022 SteamWar.de-Serverteam + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +package de.steamwar.bausystem.features.attributescopy; + +import de.steamwar.bausystem.BauSystem; +import de.steamwar.command.SWCommand; +import de.steamwar.command.TypeMapper; +import de.steamwar.linkage.Linked; +import de.steamwar.linkage.MinVersion; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; +import org.bukkit.inventory.meta.ItemMeta; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; +import java.util.stream.Collectors; + +@Linked +@MinVersion(18) +public class AttributeRemoveCommand extends SWCommand { + + public AttributeRemoveCommand() { + super("removeattribute", "attributesremove"); + } + + @Register({"all"}) + @Register({"*"}) + public void genericCommand(Player player) { + ItemStack itemStack = player.getInventory().getItemInMainHand(); + ItemMeta itemMeta = itemStack.getItemMeta(); + itemMeta.setLore(new ArrayList<>()); + itemStack.setItemMeta(itemMeta); + BauSystem.MESSAGE.send("ATTRIBUTE_REMOVE_ALL", player); + } + + @Register(description = "ATTRIBUTE_REMOVE_COMMAND_HELP") + public void genericCommand(Player player, @Mapper("attribute") String attribute) { + ItemStack itemStack = player.getInventory().getItemInMainHand(); + ItemMeta itemMeta = itemStack.getItemMeta(); + List lore = itemMeta.getLore(); + if (lore.isEmpty()) { + BauSystem.MESSAGE.send("ATTRIBUTE_REMOVE_NOT_FOUND", player); + return; + } + if (!lore.get(0).equals("§eAttributes§8:")) { + BauSystem.MESSAGE.send("ATTRIBUTE_REMOVE_NOT_FOUND", player); + return; + } + lore.removeIf(s -> s.equals("§8-§7 " + attribute)); + if (lore.size() == 1) { + itemStack.setItemMeta(null); + } else { + itemMeta.setLore(lore); + itemStack.setItemMeta(itemMeta); + } + BauSystem.MESSAGE.send("ATTRIBUTE_REMOVE_SINGLE", player, attribute); + } + + @Mapper(value = "attribute", local = true) + public TypeMapper attribute() { + return new TypeMapper() { + @Override + public Collection tabCompletes(CommandSender commandSender, String[] strings, String s) { + Player player = (Player) commandSender; + ItemStack itemStack = player.getInventory().getItemInMainHand(); + ItemMeta itemMeta = itemStack.getItemMeta(); + List lore = itemMeta.getLore(); + if (lore.isEmpty()) return null; + if (!lore.get(0).equals("§eAttributes§8:")) return null; + return lore.stream() + .skip(1) + .map(s1 -> s1.substring(6)) + .map(s1 -> s1.replace(' ', '_')) + .collect(Collectors.toList()); + } + + @Override + public String map(CommandSender commandSender, String[] previousArguments, String s) { + return s.replace('_', ' '); + } + }; + } +} diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/AttributesCopyCommand.java b/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/AttributesCopyCommand.java new file mode 100644 index 00000000..6c158793 --- /dev/null +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/AttributesCopyCommand.java @@ -0,0 +1,87 @@ +/* + * This file is a part of the SteamWar software. + * + * Copyright (C) 2022 SteamWar.de-Serverteam + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +package de.steamwar.bausystem.features.attributescopy; + +import de.steamwar.bausystem.BauSystem; +import de.steamwar.bausystem.linkage.LinkageUtils; +import de.steamwar.command.SWCommand; +import de.steamwar.linkage.Linked; +import de.steamwar.linkage.MinVersion; +import org.bukkit.FluidCollisionMode; +import org.bukkit.block.Block; +import org.bukkit.block.data.BlockData; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; +import org.bukkit.inventory.meta.ItemMeta; + +import java.util.ArrayList; +import java.util.List; + +@Linked +@MinVersion(18) +public class AttributesCopyCommand extends SWCommand { + + static List> blockAttributeList = new ArrayList<>(); + + public static void add(BlockAttribute blockAttribute) { + blockAttributeList.add(blockAttribute); + } + + public AttributesCopyCommand() { + super("copyattributes", "attributescopy"); + } + + @Register + public void genericCommand(Player player) { + linkIfNeeded(); + + Block block = player.getTargetBlockExact(8, FluidCollisionMode.ALWAYS); + ItemStack mainHand = player.getInventory().getItemInMainHand(); + if (mainHand.getType() != block.getType()) { + BauSystem.MESSAGE.send("ATTRIBUTES_CANT_COPY", player); + return; + } + BlockData blockData = block.getBlockData(); + List attributesToCopy = new ArrayList<>(); + for (BlockAttribute blockAttribute : blockAttributeList) { + if (blockAttribute.type().isInstance(blockData)) { + blockAttribute.copy(attributesToCopy, blockData); + } + } + if (attributesToCopy.isEmpty()) { + BauSystem.MESSAGE.send("ATTRIBUTES_NO_COPY", player); + return; + } + ItemMeta itemMeta = mainHand.getItemMeta(); + List lore = new ArrayList<>(attributesToCopy); + lore.add(0, "§eAttributes§8:"); + itemMeta.setLore(lore); + mainHand.setItemMeta(itemMeta); + player.getInventory().setItemInMainHand(mainHand); + BauSystem.MESSAGE.send("ATTRIBUTES_COPIED", player); + } + + private static boolean isLinked = false; + static void linkIfNeeded() { + if (isLinked) return; + LinkageUtils.linkBlockAttributes(); + isLinked = true; + } +} diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/AttributesCopyListener.java b/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/AttributesCopyListener.java new file mode 100644 index 00000000..93ecf857 --- /dev/null +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/AttributesCopyListener.java @@ -0,0 +1,62 @@ +/* + * This file is a part of the SteamWar software. + * + * Copyright (C) 2022 SteamWar.de-Serverteam + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +package de.steamwar.bausystem.features.attributescopy; + +import de.steamwar.linkage.Linked; +import de.steamwar.linkage.MinVersion; +import org.bukkit.block.Block; +import org.bukkit.block.data.BlockData; +import org.bukkit.event.EventHandler; +import org.bukkit.event.Listener; +import org.bukkit.event.block.BlockPlaceEvent; +import org.bukkit.inventory.ItemStack; +import org.bukkit.inventory.meta.ItemMeta; + +import java.util.HashSet; +import java.util.List; +import java.util.Set; + +import static de.steamwar.bausystem.features.attributescopy.AttributesCopyCommand.blockAttributeList; + +@Linked +@MinVersion(18) +public class AttributesCopyListener implements Listener { + + @EventHandler + public void onBlockPlace(BlockPlaceEvent event) { + AttributesCopyCommand.linkIfNeeded(); + ItemStack itemStack = event.getItemInHand(); + ItemMeta itemMeta = itemStack.getItemMeta(); + if (itemMeta == null) return; + List strings = itemMeta.getLore(); + if (strings == null) return; + if (strings.isEmpty()) return; + if (!strings.get(0).equals("§eAttributes§8:")) return; + Set attributesToPaste = new HashSet<>(strings); + Block block = event.getBlock(); + BlockData blockData = block.getBlockData(); + for (BlockAttribute blockAttribute : blockAttributeList) { + if (blockAttribute.type().isInstance(blockData)) { + blockAttribute.paste(attributesToPaste, blockData); + } + } + block.setBlockData(blockData, false); + } +} diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/BlockAttribute.java b/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/BlockAttribute.java new file mode 100644 index 00000000..13fbf86c --- /dev/null +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/BlockAttribute.java @@ -0,0 +1,31 @@ +/* + * This file is a part of the SteamWar software. + * + * Copyright (C) 2022 SteamWar.de-Serverteam + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +package de.steamwar.bausystem.features.attributescopy; + +import org.bukkit.block.data.BlockData; + +import java.util.List; +import java.util.Set; + +public interface BlockAttribute { + Class type(); + void copy(List attributes, T blockData); + void paste(Set attributes, T blockData); +} diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/AgeableAttribute.java b/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/AgeableAttribute.java new file mode 100644 index 00000000..a52d6819 --- /dev/null +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/AgeableAttribute.java @@ -0,0 +1,53 @@ +/* + * This file is a part of the SteamWar software. + * + * Copyright (C) 2022 SteamWar.de-Serverteam + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +package de.steamwar.bausystem.features.attributescopy.impl; + +import de.steamwar.bausystem.features.attributescopy.BlockAttribute; +import de.steamwar.linkage.Linked; +import org.bukkit.block.data.Ageable; + +import java.util.List; +import java.util.Set; + +@Linked +public class AgeableAttribute implements BlockAttribute { + + private String attribute = "§8-§7 age "; + + @Override + public Class type() { + return Ageable.class; + } + + @Override + public void copy(List attributes, Ageable blockData) { + attributes.add(attribute + blockData.getAge()); + } + + @Override + public void paste(Set attributes, Ageable blockData) { + attributes.stream() + .filter(s -> s.startsWith(attribute)) + .map(s -> s.replace(attribute, "")) + .map(Integer::parseInt) + .findFirst() + .ifPresent(blockData::setAge); + } +} diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/AnaloguePowerableAttribute.java b/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/AnaloguePowerableAttribute.java new file mode 100644 index 00000000..6d9c7df0 --- /dev/null +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/AnaloguePowerableAttribute.java @@ -0,0 +1,53 @@ +/* + * This file is a part of the SteamWar software. + * + * Copyright (C) 2022 SteamWar.de-Serverteam + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +package de.steamwar.bausystem.features.attributescopy.impl; + +import de.steamwar.bausystem.features.attributescopy.BlockAttribute; +import de.steamwar.linkage.Linked; +import org.bukkit.block.data.AnaloguePowerable; + +import java.util.List; +import java.util.Set; + +@Linked +public class AnaloguePowerableAttribute implements BlockAttribute { + + private String attribute = "§8-§7 power "; + + @Override + public Class type() { + return AnaloguePowerable.class; + } + + @Override + public void copy(List attributes, AnaloguePowerable blockData) { + attributes.add(attribute + blockData.getPower()); + } + + @Override + public void paste(Set attributes, AnaloguePowerable blockData) { + attributes.stream() + .filter(s -> s.startsWith(attribute)) + .map(s -> s.replace(attribute, "")) + .map(Integer::parseInt) + .findFirst() + .ifPresent(blockData::setPower); + } +} diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/AttachableAttribute.java b/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/AttachableAttribute.java new file mode 100644 index 00000000..05a716e9 --- /dev/null +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/AttachableAttribute.java @@ -0,0 +1,48 @@ +/* + * This file is a part of the SteamWar software. + * + * Copyright (C) 2022 SteamWar.de-Serverteam + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +package de.steamwar.bausystem.features.attributescopy.impl; + +import de.steamwar.bausystem.features.attributescopy.BlockAttribute; +import de.steamwar.linkage.Linked; +import org.bukkit.block.data.Attachable; + +import java.util.List; +import java.util.Set; + +@Linked +public class AttachableAttribute implements BlockAttribute { + + private String attribute = "§8-§7 attached"; + + @Override + public Class type() { + return Attachable.class; + } + + @Override + public void copy(List attributes, Attachable blockData) { + if (blockData.isAttached()) attributes.add(attribute); + } + + @Override + public void paste(Set attributes, Attachable blockData) { + blockData.setAttached(attributes.contains(attribute)); + } +} diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/BisectedAttribute.java b/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/BisectedAttribute.java new file mode 100644 index 00000000..31849b40 --- /dev/null +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/BisectedAttribute.java @@ -0,0 +1,53 @@ +/* + * This file is a part of the SteamWar software. + * + * Copyright (C) 2022 SteamWar.de-Serverteam + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +package de.steamwar.bausystem.features.attributescopy.impl; + +import de.steamwar.bausystem.features.attributescopy.BlockAttribute; +import de.steamwar.linkage.Linked; +import org.bukkit.block.data.Bisected; + +import java.util.List; +import java.util.Set; + +@Linked +public class BisectedAttribute implements BlockAttribute { + + private String attribute = "§8-§7 half "; + + @Override + public Class type() { + return Bisected.class; + } + + @Override + public void copy(List attributes, Bisected blockData) { + attributes.add(attribute + blockData.getHalf().name().toLowerCase()); + } + + @Override + public void paste(Set attributes, Bisected blockData) { + for (Bisected.Half half : Bisected.Half.values()) { + if (attributes.contains(attribute + half.name().toLowerCase())) { + blockData.setHalf(half); + return; + } + } + } +} diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/DirectionalAttribute.java b/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/DirectionalAttribute.java new file mode 100644 index 00000000..c0e11fc8 --- /dev/null +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/DirectionalAttribute.java @@ -0,0 +1,54 @@ +/* + * This file is a part of the SteamWar software. + * + * Copyright (C) 2022 SteamWar.de-Serverteam + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +package de.steamwar.bausystem.features.attributescopy.impl; + +import de.steamwar.bausystem.features.attributescopy.BlockAttribute; +import de.steamwar.linkage.Linked; +import org.bukkit.block.BlockFace; +import org.bukkit.block.data.Directional; + +import java.util.List; +import java.util.Set; + +@Linked +public class DirectionalAttribute implements BlockAttribute { + + private String attribute = "§8-§7 facing "; + + @Override + public Class type() { + return Directional.class; + } + + @Override + public void copy(List attributes, Directional blockData) { + attributes.add(attribute + blockData.getFacing().name().toLowerCase()); + } + + @Override + public void paste(Set attributes, Directional blockData) { + for (BlockFace blockFace : blockData.getFaces()) { + if (attributes.contains(attribute + blockFace.name().toLowerCase())) { + blockData.setFacing(blockFace); + break; + } + } + } +} diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/FaceAttachableAttribute.java b/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/FaceAttachableAttribute.java new file mode 100644 index 00000000..59f79a19 --- /dev/null +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/FaceAttachableAttribute.java @@ -0,0 +1,53 @@ +/* + * This file is a part of the SteamWar software. + * + * Copyright (C) 2022 SteamWar.de-Serverteam + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +package de.steamwar.bausystem.features.attributescopy.impl; + +import de.steamwar.bausystem.features.attributescopy.BlockAttribute; +import de.steamwar.linkage.Linked; +import org.bukkit.block.data.FaceAttachable; + +import java.util.List; +import java.util.Set; + +@Linked +public class FaceAttachableAttribute implements BlockAttribute { + + private String attribute = "§8-§7 attached "; + + @Override + public Class type() { + return FaceAttachable.class; + } + + @Override + public void copy(List attributes, FaceAttachable blockData) { + attributes.add(attribute + blockData.getAttachedFace().name().toLowerCase()); + } + + @Override + public void paste(Set attributes, FaceAttachable blockData) { + for (FaceAttachable.AttachedFace attachedFace : FaceAttachable.AttachedFace.values()) { + if (attributes.contains(attribute + attachedFace.name().toLowerCase())) { + blockData.setAttachedFace(attachedFace); + break; + } + } + } +} diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/HangableAttribute.java b/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/HangableAttribute.java new file mode 100644 index 00000000..8e26bb31 --- /dev/null +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/HangableAttribute.java @@ -0,0 +1,51 @@ +/* + * This file is a part of the SteamWar software. + * + * Copyright (C) 2022 SteamWar.de-Serverteam + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +package de.steamwar.bausystem.features.attributescopy.impl; + +import de.steamwar.bausystem.features.attributescopy.BlockAttribute; +import de.steamwar.linkage.Linked; +import de.steamwar.linkage.MinVersion; +import org.bukkit.block.data.Hangable; + +import java.util.List; +import java.util.Set; + +@Linked +@MinVersion(19) +public class HangableAttribute implements BlockAttribute { + + private String attribute = "§8-§7 hanging"; + + @Override + public Class type() { + return Hangable.class; + } + + @Override + public void copy(List attributes, Hangable blockData) { + if (!blockData.isHanging()) return; + attributes.add(attribute); + } + + @Override + public void paste(Set attributes, Hangable blockData) { + blockData.setHanging(attributes.contains(attribute)); + } +} diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/LevelledAttribute.java b/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/LevelledAttribute.java new file mode 100644 index 00000000..6e60b601 --- /dev/null +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/LevelledAttribute.java @@ -0,0 +1,53 @@ +/* + * This file is a part of the SteamWar software. + * + * Copyright (C) 2022 SteamWar.de-Serverteam + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +package de.steamwar.bausystem.features.attributescopy.impl; + +import de.steamwar.bausystem.features.attributescopy.BlockAttribute; +import de.steamwar.linkage.Linked; +import org.bukkit.block.data.Levelled; + +import java.util.List; +import java.util.Set; + +@Linked +public class LevelledAttribute implements BlockAttribute { + + private String attribute = "§8-§7 level "; + + @Override + public Class type() { + return Levelled.class; + } + + @Override + public void copy(List attributes, Levelled blockData) { + attributes.add(attribute + blockData.getLevel()); + } + + @Override + public void paste(Set attributes, Levelled blockData) { + attributes.stream() + .filter(s -> s.startsWith(attribute)) + .map(s -> s.replace(attribute, "")) + .map(Integer::parseInt) + .findFirst() + .ifPresent(blockData::setLevel); + } +} diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/LightableAttribute.java b/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/LightableAttribute.java new file mode 100644 index 00000000..aa55a054 --- /dev/null +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/LightableAttribute.java @@ -0,0 +1,48 @@ +/* + * This file is a part of the SteamWar software. + * + * Copyright (C) 2022 SteamWar.de-Serverteam + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +package de.steamwar.bausystem.features.attributescopy.impl; + +import de.steamwar.bausystem.features.attributescopy.BlockAttribute; +import de.steamwar.linkage.Linked; +import org.bukkit.block.data.Lightable; + +import java.util.List; +import java.util.Set; + +@Linked +public class LightableAttribute implements BlockAttribute { + + private String attribute = "§8-§7 lit"; + + @Override + public Class type() { + return Lightable.class; + } + + @Override + public void copy(List attributes, Lightable blockData) { + if (blockData.isLit()) attributes.add(attribute); + } + + @Override + public void paste(Set attributes, Lightable blockData) { + blockData.setLit(attributes.contains(attribute)); + } +} diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/MultipleFacingAttribute.java b/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/MultipleFacingAttribute.java new file mode 100644 index 00000000..999fb0df --- /dev/null +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/MultipleFacingAttribute.java @@ -0,0 +1,54 @@ +/* + * This file is a part of the SteamWar software. + * + * Copyright (C) 2022 SteamWar.de-Serverteam + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +package de.steamwar.bausystem.features.attributescopy.impl; + +import de.steamwar.bausystem.features.attributescopy.BlockAttribute; +import de.steamwar.linkage.Linked; +import org.bukkit.block.BlockFace; +import org.bukkit.block.data.MultipleFacing; + +import java.util.List; +import java.util.Set; + +@Linked +public class MultipleFacingAttribute implements BlockAttribute { + + private String attribute = "§8-§7 connected "; + + @Override + public Class type() { + return MultipleFacing.class; + } + + @Override + public void copy(List attributes, MultipleFacing blockData) { + blockData.getFaces().forEach(blockFace -> { + attributes.add(attribute + blockFace.name().toLowerCase()); + }); + } + + @Override + public void paste(Set attributes, MultipleFacing blockData) { + for (BlockFace blockFace : BlockFace.values()) { + if (!blockData.getAllowedFaces().contains(blockFace)) continue; + blockData.setFace(blockFace, attributes.contains(attribute + blockFace.name().toLowerCase())); + } + } +} diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/OpenableAttribute.java b/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/OpenableAttribute.java new file mode 100644 index 00000000..2e440e67 --- /dev/null +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/OpenableAttribute.java @@ -0,0 +1,48 @@ +/* + * This file is a part of the SteamWar software. + * + * Copyright (C) 2022 SteamWar.de-Serverteam + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +package de.steamwar.bausystem.features.attributescopy.impl; + +import de.steamwar.bausystem.features.attributescopy.BlockAttribute; +import de.steamwar.linkage.Linked; +import org.bukkit.block.data.Openable; + +import java.util.List; +import java.util.Set; + +@Linked +public class OpenableAttribute implements BlockAttribute { + + private String attribute = "§8-§7 open"; + + @Override + public Class type() { + return Openable.class; + } + + @Override + public void copy(List attributes, Openable blockData) { + if (blockData.isOpen()) attributes.add(attribute); + } + + @Override + public void paste(Set attributes, Openable blockData) { + blockData.setOpen(attributes.contains(attribute)); + } +} diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/OrientableAttribute.java b/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/OrientableAttribute.java new file mode 100644 index 00000000..d11e6558 --- /dev/null +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/OrientableAttribute.java @@ -0,0 +1,55 @@ +/* + * This file is a part of the SteamWar software. + * + * Copyright (C) 2022 SteamWar.de-Serverteam + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +package de.steamwar.bausystem.features.attributescopy.impl; + +import de.steamwar.bausystem.features.attributescopy.BlockAttribute; +import de.steamwar.bausystem.features.script.command.logic.Or; +import de.steamwar.linkage.Linked; +import org.bukkit.Axis; +import org.bukkit.block.data.Orientable; + +import java.util.List; +import java.util.Set; + +@Linked +public class OrientableAttribute implements BlockAttribute { + + private String attribute = "§8-§7 orientation "; + + @Override + public Class type() { + return Orientable.class; + } + + @Override + public void copy(List attributes, Orientable blockData) { + attributes.add(attribute + blockData.getAxis().name().toLowerCase()); + } + + @Override + public void paste(Set attributes, Orientable blockData) { + for (Axis axis : Axis.values()) { + if (attributes.contains(attribute + axis.name().toLowerCase())) { + blockData.setAxis(axis); + return; + } + } + } +} diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/PowerableAttribute.java b/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/PowerableAttribute.java new file mode 100644 index 00000000..3aabee78 --- /dev/null +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/PowerableAttribute.java @@ -0,0 +1,48 @@ +/* + * This file is a part of the SteamWar software. + * + * Copyright (C) 2022 SteamWar.de-Serverteam + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +package de.steamwar.bausystem.features.attributescopy.impl; + +import de.steamwar.bausystem.features.attributescopy.BlockAttribute; +import de.steamwar.linkage.Linked; +import org.bukkit.block.data.Powerable; + +import java.util.List; +import java.util.Set; + +@Linked +public class PowerableAttribute implements BlockAttribute { + + private String attribute = "§8-§7 powered"; + + @Override + public Class type() { + return Powerable.class; + } + + @Override + public void copy(List attributes, Powerable blockData) { + if (blockData.isPowered()) attributes.add(attribute); + } + + @Override + public void paste(Set attributes, Powerable blockData) { + blockData.setPowered(attributes.contains(attribute)); + } +} diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/RailAttribute.java b/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/RailAttribute.java new file mode 100644 index 00000000..e7ab4e76 --- /dev/null +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/RailAttribute.java @@ -0,0 +1,53 @@ +/* + * This file is a part of the SteamWar software. + * + * Copyright (C) 2022 SteamWar.de-Serverteam + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +package de.steamwar.bausystem.features.attributescopy.impl; + +import de.steamwar.bausystem.features.attributescopy.BlockAttribute; +import de.steamwar.linkage.Linked; +import org.bukkit.block.data.Rail; + +import java.util.List; +import java.util.Set; + +@Linked +public class RailAttribute implements BlockAttribute { + + private String attribute = "§8-§7 rail shape "; + + @Override + public Class type() { + return Rail.class; + } + + @Override + public void copy(List attributes, Rail blockData) { + attributes.add(attribute + blockData.getShape().name().toLowerCase()); + } + + @Override + public void paste(Set attributes, Rail blockData) { + for (Rail.Shape shape : Rail.Shape.values()) { + if (attributes.contains(attribute + shape)) { + blockData.setShape(shape); + return; + } + } + } +} diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/RotatableAttribute.java b/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/RotatableAttribute.java new file mode 100644 index 00000000..94a1fa8d --- /dev/null +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/RotatableAttribute.java @@ -0,0 +1,54 @@ +/* + * This file is a part of the SteamWar software. + * + * Copyright (C) 2022 SteamWar.de-Serverteam + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +package de.steamwar.bausystem.features.attributescopy.impl; + +import de.steamwar.bausystem.features.attributescopy.BlockAttribute; +import de.steamwar.linkage.Linked; +import org.bukkit.block.BlockFace; +import org.bukkit.block.data.Rotatable; + +import java.util.List; +import java.util.Set; + +@Linked +public class RotatableAttribute implements BlockAttribute { + + private String attribute = "§8-§7 rotation "; + + @Override + public Class type() { + return Rotatable.class; + } + + @Override + public void copy(List attributes, Rotatable blockData) { + attributes.add(attribute + blockData.getRotation().name()); + } + + @Override + public void paste(Set attributes, Rotatable blockData) { + for (BlockFace face : BlockFace.values()) { + if (attributes.contains(attribute + face.name())) { + blockData.setRotation(face); + return; + } + } + } +} diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/SnowableAttribute.java b/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/SnowableAttribute.java new file mode 100644 index 00000000..71358651 --- /dev/null +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/SnowableAttribute.java @@ -0,0 +1,48 @@ +/* + * This file is a part of the SteamWar software. + * + * Copyright (C) 2022 SteamWar.de-Serverteam + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +package de.steamwar.bausystem.features.attributescopy.impl; + +import de.steamwar.bausystem.features.attributescopy.BlockAttribute; +import de.steamwar.linkage.Linked; +import org.bukkit.block.data.Snowable; + +import java.util.List; +import java.util.Set; + +@Linked +public class SnowableAttribute implements BlockAttribute { + + private String attribute = "§8-§7 snowy"; + + @Override + public Class type() { + return Snowable.class; + } + + @Override + public void copy(List attributes, Snowable blockData) { + if (blockData.isSnowy()) attributes.add(attribute); + } + + @Override + public void paste(Set attributes, Snowable blockData) { + blockData.setSnowy(attributes.contains(attribute)); + } +} diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/WaterloggedAttribute.java b/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/WaterloggedAttribute.java new file mode 100644 index 00000000..bd010c01 --- /dev/null +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/WaterloggedAttribute.java @@ -0,0 +1,49 @@ +/* + * This file is a part of the SteamWar software. + * + * Copyright (C) 2022 SteamWar.de-Serverteam + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +package de.steamwar.bausystem.features.attributescopy.impl; + +import de.steamwar.bausystem.features.attributescopy.BlockAttribute; +import de.steamwar.linkage.Linked; +import org.bukkit.block.data.Waterlogged; + +import java.util.List; +import java.util.Set; + +@Linked +public class WaterloggedAttribute implements BlockAttribute { + + private String attribute = "§8-§7 waterlogged"; + + @Override + public Class type() { + return Waterlogged.class; + } + + @Override + public void copy(List attributes, Waterlogged waterlogged) { + if (!waterlogged.isWaterlogged()) return; + attributes.add(attribute); + } + + @Override + public void paste(Set attributes, Waterlogged waterlogged) { + waterlogged.setWaterlogged(attributes.contains(attribute)); + } +} diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/type/BambooAttribute.java b/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/type/BambooAttribute.java new file mode 100644 index 00000000..c2182b03 --- /dev/null +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/type/BambooAttribute.java @@ -0,0 +1,53 @@ +/* + * This file is a part of the SteamWar software. + * + * Copyright (C) 2022 SteamWar.de-Serverteam + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +package de.steamwar.bausystem.features.attributescopy.impl.type; + +import de.steamwar.bausystem.features.attributescopy.BlockAttribute; +import de.steamwar.linkage.Linked; +import org.bukkit.block.data.type.Bamboo; + +import java.util.List; +import java.util.Set; + +@Linked +public class BambooAttribute implements BlockAttribute { + + private String attribute = "§8-§7 leaves "; + + @Override + public Class type() { + return Bamboo.class; + } + + @Override + public void copy(List attributes, Bamboo blockData) { + attributes.add(attribute + blockData.getLeaves()); + } + + @Override + public void paste(Set attributes, Bamboo blockData) { + for (Bamboo.Leaves leaves : Bamboo.Leaves.values()) { + if (attributes.contains(attribute + leaves)) { + blockData.setLeaves(leaves); + return; + } + } + } +} diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/type/BellAttribute.java b/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/type/BellAttribute.java new file mode 100644 index 00000000..b5fcb280 --- /dev/null +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/type/BellAttribute.java @@ -0,0 +1,53 @@ +/* + * This file is a part of the SteamWar software. + * + * Copyright (C) 2022 SteamWar.de-Serverteam + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +package de.steamwar.bausystem.features.attributescopy.impl.type; + +import de.steamwar.bausystem.features.attributescopy.BlockAttribute; +import de.steamwar.linkage.Linked; +import org.bukkit.block.data.type.Bell; + +import java.util.List; +import java.util.Set; + +@Linked +public class BellAttribute implements BlockAttribute { + + private String attribute = "§8-§7 attachament "; + + @Override + public Class type() { + return Bell.class; + } + + @Override + public void copy(List attributes, Bell blockData) { + attributes.add(attribute + blockData.getAttachment()); + } + + @Override + public void paste(Set attributes, Bell blockData) { + for (Bell.Attachment attachment : Bell.Attachment.values()) { + if (attributes.contains(attribute + attachment)) { + blockData.setAttachment(attachment); + return; + } + } + } +} diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/type/BigDripleafAttribute.java b/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/type/BigDripleafAttribute.java new file mode 100644 index 00000000..a1ebef35 --- /dev/null +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/type/BigDripleafAttribute.java @@ -0,0 +1,55 @@ +/* + * This file is a part of the SteamWar software. + * + * Copyright (C) 2022 SteamWar.de-Serverteam + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +package de.steamwar.bausystem.features.attributescopy.impl.type; + +import de.steamwar.bausystem.features.attributescopy.BlockAttribute; +import de.steamwar.linkage.Linked; +import de.steamwar.linkage.MinVersion; +import org.bukkit.block.data.type.BigDripleaf; + +import java.util.List; +import java.util.Set; + +@Linked +@MinVersion(18) +public class BigDripleafAttribute implements BlockAttribute { + + private String attribute = "§8-§7 tilt "; + + @Override + public Class type() { + return BigDripleaf.class; + } + + @Override + public void copy(List attributes, BigDripleaf blockData) { + attributes.add(attribute + blockData.getTilt()); + } + + @Override + public void paste(Set attributes, BigDripleaf blockData) { + for (BigDripleaf.Tilt tilt : BigDripleaf.Tilt.values()) { + if (attributes.contains(attribute + tilt)) { + blockData.setTilt(tilt); + return; + } + } + } +} diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/type/CakeAttribute.java b/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/type/CakeAttribute.java new file mode 100644 index 00000000..0e44b938 --- /dev/null +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/type/CakeAttribute.java @@ -0,0 +1,53 @@ +/* + * This file is a part of the SteamWar software. + * + * Copyright (C) 2022 SteamWar.de-Serverteam + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +package de.steamwar.bausystem.features.attributescopy.impl.type; + +import de.steamwar.bausystem.features.attributescopy.BlockAttribute; +import de.steamwar.linkage.Linked; +import org.bukkit.block.data.type.Cake; + +import java.util.List; +import java.util.Set; + +@Linked +public class CakeAttribute implements BlockAttribute { + + private String attribute = "§8-§7 bites "; + + @Override + public Class type() { + return Cake.class; + } + + @Override + public void copy(List attributes, Cake blockData) { + attributes.add(attribute + blockData.getBites()); + } + + @Override + public void paste(Set attributes, Cake blockData) { + attributes.stream() + .filter(s -> s.startsWith(attribute)) + .map(s -> s.replace(attribute, "")) + .map(Integer::parseInt) + .findFirst() + .ifPresent(blockData::setBites); + } +} diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/type/CampfireAttribute.java b/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/type/CampfireAttribute.java new file mode 100644 index 00000000..9d5d9e3e --- /dev/null +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/type/CampfireAttribute.java @@ -0,0 +1,48 @@ +/* + * This file is a part of the SteamWar software. + * + * Copyright (C) 2022 SteamWar.de-Serverteam + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +package de.steamwar.bausystem.features.attributescopy.impl.type; + +import de.steamwar.bausystem.features.attributescopy.BlockAttribute; +import de.steamwar.linkage.Linked; +import org.bukkit.block.data.type.Campfire; + +import java.util.List; +import java.util.Set; + +@Linked +public class CampfireAttribute implements BlockAttribute { + + private String attribute = "§8-§7 signal fire"; + + @Override + public Class type() { + return Campfire.class; + } + + @Override + public void copy(List attributes, Campfire blockData) { + if (blockData.isSignalFire()) attributes.add(attribute); + } + + @Override + public void paste(Set attributes, Campfire blockData) { + blockData.setSignalFire(attributes.contains(attribute)); + } +} diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/type/CandleAttribute.java b/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/type/CandleAttribute.java new file mode 100644 index 00000000..a8e054d8 --- /dev/null +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/type/CandleAttribute.java @@ -0,0 +1,53 @@ +/* + * This file is a part of the SteamWar software. + * + * Copyright (C) 2022 SteamWar.de-Serverteam + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +package de.steamwar.bausystem.features.attributescopy.impl.type; + +import de.steamwar.bausystem.features.attributescopy.BlockAttribute; +import de.steamwar.linkage.Linked; +import org.bukkit.block.data.type.Candle; + +import java.util.List; +import java.util.Set; + +@Linked +public class CandleAttribute implements BlockAttribute { + + private String attribute = "§8-§7 candles "; + + @Override + public Class type() { + return Candle.class; + } + + @Override + public void copy(List attributes, Candle blockData) { + if (blockData.getCandles() > 0) attributes.add(attribute + blockData.getCandles()); + } + + @Override + public void paste(Set attributes, Candle blockData) { + attributes.stream() + .filter(s -> s.startsWith(attribute)) + .map(s -> s.replace(attribute, "")) + .map(Integer::parseInt) + .findFirst() + .ifPresent(blockData::setCandles); + } +} diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/type/CaveVinesPlantAttribute.java b/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/type/CaveVinesPlantAttribute.java new file mode 100644 index 00000000..ecbaf271 --- /dev/null +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/type/CaveVinesPlantAttribute.java @@ -0,0 +1,48 @@ +/* + * This file is a part of the SteamWar software. + * + * Copyright (C) 2022 SteamWar.de-Serverteam + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +package de.steamwar.bausystem.features.attributescopy.impl.type; + +import de.steamwar.bausystem.features.attributescopy.BlockAttribute; +import de.steamwar.linkage.Linked; +import org.bukkit.block.data.type.CaveVinesPlant; + +import java.util.List; +import java.util.Set; + +@Linked +public class CaveVinesPlantAttribute implements BlockAttribute { + + private String attribute = "§8-§7 berries"; + + @Override + public Class type() { + return CaveVinesPlant.class; + } + + @Override + public void copy(List attributes, CaveVinesPlant blockData) { + if (blockData.isBerries()) attributes.add(attribute); + } + + @Override + public void paste(Set attributes, CaveVinesPlant blockData) { + blockData.setBerries(attributes.contains(attribute)); + } +} diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/type/ComparatorAttribute.java b/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/type/ComparatorAttribute.java new file mode 100644 index 00000000..4342008e --- /dev/null +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/type/ComparatorAttribute.java @@ -0,0 +1,53 @@ +/* + * This file is a part of the SteamWar software. + * + * Copyright (C) 2022 SteamWar.de-Serverteam + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +package de.steamwar.bausystem.features.attributescopy.impl.type; + +import de.steamwar.bausystem.features.attributescopy.BlockAttribute; +import de.steamwar.linkage.Linked; +import org.bukkit.block.data.type.Comparator; + +import java.util.List; +import java.util.Set; + +@Linked +public class ComparatorAttribute implements BlockAttribute { + + private String attribute = "§8-§7 mode "; + + @Override + public Class type() { + return Comparator.class; + } + + @Override + public void copy(List attributes, Comparator blockData) { + attributes.add(attribute + blockData.getMode().name()); + } + + @Override + public void paste(Set attributes, Comparator blockData) { + for (Comparator.Mode mode : Comparator.Mode.values()) { + if (attributes.contains(attribute + mode.name())) { + blockData.setMode(mode); + return; + } + } + } +} diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/type/DaylightDetectorAttribute.java b/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/type/DaylightDetectorAttribute.java new file mode 100644 index 00000000..3c319987 --- /dev/null +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/type/DaylightDetectorAttribute.java @@ -0,0 +1,48 @@ +/* + * This file is a part of the SteamWar software. + * + * Copyright (C) 2022 SteamWar.de-Serverteam + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +package de.steamwar.bausystem.features.attributescopy.impl.type; + +import de.steamwar.bausystem.features.attributescopy.BlockAttribute; +import de.steamwar.linkage.Linked; +import org.bukkit.block.data.type.DaylightDetector; + +import java.util.List; +import java.util.Set; + +@Linked +public class DaylightDetectorAttribute implements BlockAttribute { + + private String attribute = "§8-§7 inverted"; + + @Override + public Class type() { + return DaylightDetector.class; + } + + @Override + public void copy(List attributes, DaylightDetector blockData) { + if (blockData.isInverted()) attributes.add(attribute); + } + + @Override + public void paste(Set attributes, DaylightDetector blockData) { + blockData.setInverted(attributes.contains(attribute)); + } +} diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/type/DoorAttribute.java b/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/type/DoorAttribute.java new file mode 100644 index 00000000..1c7885af --- /dev/null +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/type/DoorAttribute.java @@ -0,0 +1,53 @@ +/* + * This file is a part of the SteamWar software. + * + * Copyright (C) 2022 SteamWar.de-Serverteam + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +package de.steamwar.bausystem.features.attributescopy.impl.type; + +import de.steamwar.bausystem.features.attributescopy.BlockAttribute; +import de.steamwar.linkage.Linked; +import org.bukkit.block.data.type.Door; + +import java.util.List; +import java.util.Set; + +@Linked +public class DoorAttribute implements BlockAttribute { + + private String attribute = "§8-§7 hinge "; + + @Override + public Class type() { + return Door.class; + } + + @Override + public void copy(List attributes, Door blockData) { + attributes.add(attribute + blockData.getHinge().toString().toLowerCase()); + } + + @Override + public void paste(Set attributes, Door blockData) { + for (Door.Hinge hinge : Door.Hinge.values()) { + if (attributes.contains(attribute + hinge.toString().toLowerCase())) { + blockData.setHinge(hinge); + break; + } + } + } +} diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/type/EndPortalFrameAttribute.java b/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/type/EndPortalFrameAttribute.java new file mode 100644 index 00000000..25f790a6 --- /dev/null +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/type/EndPortalFrameAttribute.java @@ -0,0 +1,48 @@ +/* + * This file is a part of the SteamWar software. + * + * Copyright (C) 2022 SteamWar.de-Serverteam + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +package de.steamwar.bausystem.features.attributescopy.impl.type; + +import de.steamwar.bausystem.features.attributescopy.BlockAttribute; +import de.steamwar.linkage.Linked; +import org.bukkit.block.data.type.EndPortalFrame; + +import java.util.List; +import java.util.Set; + +@Linked +public class EndPortalFrameAttribute implements BlockAttribute { + + private String attribute = "§8-§7 eye"; + + @Override + public Class type() { + return EndPortalFrame.class; + } + + @Override + public void copy(List attributes, EndPortalFrame blockData) { + if (blockData.hasEye()) attributes.add(attribute); + } + + @Override + public void paste(Set attributes, EndPortalFrame blockData) { + blockData.setEye(attributes.contains(attribute)); + } +} diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/type/FarmlandAttribute.java b/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/type/FarmlandAttribute.java new file mode 100644 index 00000000..b55971d4 --- /dev/null +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/type/FarmlandAttribute.java @@ -0,0 +1,53 @@ +/* + * This file is a part of the SteamWar software. + * + * Copyright (C) 2022 SteamWar.de-Serverteam + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +package de.steamwar.bausystem.features.attributescopy.impl.type; + +import de.steamwar.bausystem.features.attributescopy.BlockAttribute; +import de.steamwar.linkage.Linked; +import org.bukkit.block.data.type.Farmland; + +import java.util.List; +import java.util.Set; + +@Linked +public class FarmlandAttribute implements BlockAttribute { + + private String attribute = "§8-§7 moisture "; + + @Override + public Class type() { + return Farmland.class; + } + + @Override + public void copy(List attributes, Farmland blockData) { + attributes.add(attribute + blockData.getMoisture()); + } + + @Override + public void paste(Set attributes, Farmland blockData) { + attributes.stream() + .filter(s -> s.startsWith(attribute)) + .map(s -> s.replace(attribute, "")) + .map(Integer::parseInt) + .findFirst() + .ifPresent(blockData::setMoisture); + } +} diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/type/GateAttribute.java b/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/type/GateAttribute.java new file mode 100644 index 00000000..3f853135 --- /dev/null +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/type/GateAttribute.java @@ -0,0 +1,48 @@ +/* + * This file is a part of the SteamWar software. + * + * Copyright (C) 2022 SteamWar.de-Serverteam + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +package de.steamwar.bausystem.features.attributescopy.impl.type; + +import de.steamwar.bausystem.features.attributescopy.BlockAttribute; +import de.steamwar.linkage.Linked; +import org.bukkit.block.data.type.Gate; + +import java.util.List; +import java.util.Set; + +@Linked +public class GateAttribute implements BlockAttribute { + + private String attribute = "§8-§7 inWall"; + + @Override + public Class type() { + return Gate.class; + } + + @Override + public void copy(List attributes, Gate blockData) { + if (blockData.isInWall()) attributes.add(attribute); + } + + @Override + public void paste(Set attributes, Gate blockData) { + blockData.setInWall(attributes.contains(attribute)); + } +} diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/type/HopperAttribute.java b/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/type/HopperAttribute.java new file mode 100644 index 00000000..b64266a8 --- /dev/null +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/type/HopperAttribute.java @@ -0,0 +1,48 @@ +/* + * This file is a part of the SteamWar software. + * + * Copyright (C) 2022 SteamWar.de-Serverteam + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +package de.steamwar.bausystem.features.attributescopy.impl.type; + +import de.steamwar.bausystem.features.attributescopy.BlockAttribute; +import de.steamwar.linkage.Linked; +import org.bukkit.block.data.type.Hopper; + +import java.util.List; +import java.util.Set; + +@Linked +public class HopperAttribute implements BlockAttribute { + + private String attribute = "§8-§7 enabled"; + + @Override + public Class type() { + return Hopper.class; + } + + @Override + public void copy(List attributes, Hopper blockData) { + if (blockData.isEnabled()) attributes.add(attribute); + } + + @Override + public void paste(Set attributes, Hopper blockData) { + blockData.setEnabled(attributes.contains(attribute)); + } +} diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/type/JigsawAttribute.java b/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/type/JigsawAttribute.java new file mode 100644 index 00000000..492e2543 --- /dev/null +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/type/JigsawAttribute.java @@ -0,0 +1,53 @@ +/* + * This file is a part of the SteamWar software. + * + * Copyright (C) 2022 SteamWar.de-Serverteam + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +package de.steamwar.bausystem.features.attributescopy.impl.type; + +import de.steamwar.bausystem.features.attributescopy.BlockAttribute; +import de.steamwar.linkage.Linked; +import org.bukkit.block.data.type.Jigsaw; + +import java.util.List; +import java.util.Set; + +@Linked +public class JigsawAttribute implements BlockAttribute { + + private String attribute = "§8-§7 orientation "; + + @Override + public Class type() { + return Jigsaw.class; + } + + @Override + public void copy(List attributes, Jigsaw blockData) { + attributes.add(attribute + blockData.getOrientation()); + } + + @Override + public void paste(Set attributes, Jigsaw blockData) { + for (Jigsaw.Orientation orientation : Jigsaw.Orientation.values()) { + if (attributes.contains(attribute + orientation)) { + blockData.setOrientation(orientation); + return; + } + } + } +} diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/type/LanternAttribute.java b/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/type/LanternAttribute.java new file mode 100644 index 00000000..3ea0d701 --- /dev/null +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/type/LanternAttribute.java @@ -0,0 +1,49 @@ +/* + * This file is a part of the SteamWar software. + * + * Copyright (C) 2022 SteamWar.de-Serverteam + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +package de.steamwar.bausystem.features.attributescopy.impl.type; + +import de.steamwar.bausystem.features.attributescopy.BlockAttribute; +import de.steamwar.linkage.Linked; +import org.bukkit.block.data.type.Lantern; + +import java.util.List; +import java.util.Set; + +@Linked +public class LanternAttribute implements BlockAttribute { + + private String attribute = "§8-§7 lantern"; + + @Override + public Class type() { + return Lantern.class; + } + + @Override + public void copy(List attributes, Lantern lantern) { + if (!lantern.isHanging()) return; + attributes.add(attribute); + } + + @Override + public void paste(Set attributes, Lantern lantern) { + lantern.setHanging(attributes.contains(attribute)); + } +} diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/type/LeavesAttribute.java b/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/type/LeavesAttribute.java new file mode 100644 index 00000000..74f445f6 --- /dev/null +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/type/LeavesAttribute.java @@ -0,0 +1,48 @@ +/* + * This file is a part of the SteamWar software. + * + * Copyright (C) 2022 SteamWar.de-Serverteam + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +package de.steamwar.bausystem.features.attributescopy.impl.type; + +import de.steamwar.bausystem.features.attributescopy.BlockAttribute; +import de.steamwar.linkage.Linked; +import org.bukkit.block.data.type.Leaves; + +import java.util.List; +import java.util.Set; + +@Linked +public class LeavesAttribute implements BlockAttribute { + + private String attribute = "§8-§7 persistent"; + + @Override + public Class type() { + return Leaves.class; + } + + @Override + public void copy(List attributes, Leaves blockData) { + if (blockData.isPersistent()) attributes.add(attribute); + } + + @Override + public void paste(Set attributes, Leaves blockData) { + blockData.setPersistent(attributes.contains(attribute)); + } +} diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/type/PointedDripstoneAttribute.java b/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/type/PointedDripstoneAttribute.java new file mode 100644 index 00000000..5b25834a --- /dev/null +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/type/PointedDripstoneAttribute.java @@ -0,0 +1,62 @@ +/* + * This file is a part of the SteamWar software. + * + * Copyright (C) 2022 SteamWar.de-Serverteam + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +package de.steamwar.bausystem.features.attributescopy.impl.type; + +import de.steamwar.bausystem.features.attributescopy.BlockAttribute; +import de.steamwar.linkage.Linked; +import org.bukkit.block.BlockFace; +import org.bukkit.block.data.type.PointedDripstone; + +import java.util.List; +import java.util.Set; + +@Linked +public class PointedDripstoneAttribute implements BlockAttribute { + + private String attribute1 = "§8-§7 vertialDirection "; + private String attribute2 = "§8-§7 thickness "; + + @Override + public Class type() { + return PointedDripstone.class; + } + + @Override + public void copy(List attributes, PointedDripstone blockData) { + attributes.add(attribute1 + " " + blockData.getVerticalDirection().name().toLowerCase()); + attributes.add(attribute2 + " " + blockData.getThickness().name().toLowerCase()); + } + + @Override + public void paste(Set attributes, PointedDripstone blockData) { + for (BlockFace blockFace : blockData.getVerticalDirections()) { + if (attributes.contains(attribute1 + " " + blockFace.name().toLowerCase())) { + blockData.setVerticalDirection(blockFace); + break; + } + } + for (PointedDripstone.Thickness thickness : PointedDripstone.Thickness.values()) { + if (attributes.contains(attribute2 + " " + thickness.name().toLowerCase())) { + blockData.setThickness(thickness); + break; + } + } + } +} diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/type/RedstoneWireAttribute.java b/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/type/RedstoneWireAttribute.java new file mode 100644 index 00000000..03118c68 --- /dev/null +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/type/RedstoneWireAttribute.java @@ -0,0 +1,60 @@ +/* + * This file is a part of the SteamWar software. + * + * Copyright (C) 2022 SteamWar.de-Serverteam + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +package de.steamwar.bausystem.features.attributescopy.impl.type; + +import de.steamwar.bausystem.features.attributescopy.BlockAttribute; +import de.steamwar.linkage.Linked; +import org.bukkit.block.BlockFace; +import org.bukkit.block.data.type.RedstoneWire; + +import java.util.List; +import java.util.Set; + +@Linked +public class RedstoneWireAttribute implements BlockAttribute { + + private String attribute = "§8-§7 connection "; + + @Override + public Class type() { + return RedstoneWire.class; + } + + @Override + public void copy(List attributes, RedstoneWire blockData) { + for (BlockFace blockFace : blockData.getAllowedFaces()) { + RedstoneWire.Connection connection = blockData.getFace(blockFace); + if (connection != RedstoneWire.Connection.NONE) { + attributes.add(attribute + blockFace.name().toLowerCase() + " " + blockFace.name().toLowerCase()); + } + } + } + + @Override + public void paste(Set attributes, RedstoneWire blockData) { + for (BlockFace blockFace : blockData.getAllowedFaces()) { + for (RedstoneWire.Connection connection : RedstoneWire.Connection.values()) { + if (attributes.contains(attribute + blockFace.name().toLowerCase() + " " + connection.name().toLowerCase())) { + blockData.setFace(blockFace, connection); + } + } + } + } +} diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/type/RepeaterAttribute.java b/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/type/RepeaterAttribute.java new file mode 100644 index 00000000..b7639b96 --- /dev/null +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/type/RepeaterAttribute.java @@ -0,0 +1,53 @@ +/* + * This file is a part of the SteamWar software. + * + * Copyright (C) 2022 SteamWar.de-Serverteam + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +package de.steamwar.bausystem.features.attributescopy.impl.type; + +import de.steamwar.bausystem.features.attributescopy.BlockAttribute; +import de.steamwar.linkage.Linked; +import org.bukkit.block.data.type.Repeater; + +import java.util.List; +import java.util.Set; + +@Linked +public class RepeaterAttribute implements BlockAttribute { + + private String attribute = "§8-§7 delay "; + + @Override + public Class type() { + return Repeater.class; + } + + @Override + public void copy(List attributes, Repeater blockData) { + attributes.add(attribute + blockData.getDelay()); + } + + @Override + public void paste(Set attributes, Repeater blockData) { + attributes.stream() + .filter(s -> s.startsWith(attribute)) + .map(s -> s.replace(attribute, "")) + .map(Integer::parseInt) + .findFirst() + .ifPresent(blockData::setDelay); + } +} diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/type/RespawnAnchorAttribute.java b/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/type/RespawnAnchorAttribute.java new file mode 100644 index 00000000..646a14d8 --- /dev/null +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/type/RespawnAnchorAttribute.java @@ -0,0 +1,53 @@ +/* + * This file is a part of the SteamWar software. + * + * Copyright (C) 2022 SteamWar.de-Serverteam + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +package de.steamwar.bausystem.features.attributescopy.impl.type; + +import de.steamwar.bausystem.features.attributescopy.BlockAttribute; +import de.steamwar.linkage.Linked; +import org.bukkit.block.data.type.RespawnAnchor; + +import java.util.List; +import java.util.Set; + +@Linked +public class RespawnAnchorAttribute implements BlockAttribute { + + private String attribute = "§8-§7 charges "; + + @Override + public Class type() { + return RespawnAnchor.class; + } + + @Override + public void copy(List attributes, RespawnAnchor blockData) { + attributes.add(attribute + blockData.getCharges()); + } + + @Override + public void paste(Set attributes, RespawnAnchor blockData) { + attributes.stream() + .filter(s -> s.startsWith(attribute)) + .map(s -> s.replace(attribute, "")) + .map(Integer::parseInt) + .findFirst() + .ifPresent(blockData::setCharges); + } +} diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/type/SaplingAttribute.java b/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/type/SaplingAttribute.java new file mode 100644 index 00000000..3a15fc35 --- /dev/null +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/type/SaplingAttribute.java @@ -0,0 +1,53 @@ +/* + * This file is a part of the SteamWar software. + * + * Copyright (C) 2022 SteamWar.de-Serverteam + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +package de.steamwar.bausystem.features.attributescopy.impl.type; + +import de.steamwar.bausystem.features.attributescopy.BlockAttribute; +import de.steamwar.linkage.Linked; +import org.bukkit.block.data.type.Sapling; + +import java.util.List; +import java.util.Set; + +@Linked +public class SaplingAttribute implements BlockAttribute { + + private String attribute = "§8-§7 stage "; + + @Override + public Class type() { + return Sapling.class; + } + + @Override + public void copy(List attributes, Sapling blockData) { + attributes.add(attribute + blockData.getStage()); + } + + @Override + public void paste(Set attributes, Sapling blockData) { + attributes.stream() + .filter(s -> s.startsWith(attribute)) + .map(s -> s.replace(attribute, "")) + .map(Integer::parseInt) + .findFirst() + .ifPresent(blockData::setStage); + } +} diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/type/ScaffoldingAttribute.java b/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/type/ScaffoldingAttribute.java new file mode 100644 index 00000000..8da631d8 --- /dev/null +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/type/ScaffoldingAttribute.java @@ -0,0 +1,56 @@ +/* + * This file is a part of the SteamWar software. + * + * Copyright (C) 2022 SteamWar.de-Serverteam + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +package de.steamwar.bausystem.features.attributescopy.impl.type; + +import de.steamwar.bausystem.features.attributescopy.BlockAttribute; +import de.steamwar.linkage.Linked; +import org.bukkit.block.data.type.Scaffolding; + +import java.util.List; +import java.util.Set; + +@Linked +public class ScaffoldingAttribute implements BlockAttribute { + + private String attribute1 = "§8-§7 bottom"; + private String attribute2 = "§8-§7 distance "; + + @Override + public Class type() { + return Scaffolding.class; + } + + @Override + public void copy(List attributes, Scaffolding blockData) { + if (blockData.isBottom()) attributes.add(attribute1); + attributes.add(attribute2 + blockData.getDistance()); + } + + @Override + public void paste(Set attributes, Scaffolding blockData) { + blockData.setBottom(attributes.contains(attribute1)); + attributes.stream() + .filter(s -> s.startsWith(attribute2)) + .map(s -> s.replace(attribute2, "")) + .map(Integer::parseInt) + .findFirst() + .ifPresent(blockData::setDistance); + } +} diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/type/SculkSensorAttribute.java b/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/type/SculkSensorAttribute.java new file mode 100644 index 00000000..8f974f40 --- /dev/null +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/type/SculkSensorAttribute.java @@ -0,0 +1,53 @@ +/* + * This file is a part of the SteamWar software. + * + * Copyright (C) 2022 SteamWar.de-Serverteam + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +package de.steamwar.bausystem.features.attributescopy.impl.type; + +import de.steamwar.bausystem.features.attributescopy.BlockAttribute; +import de.steamwar.linkage.Linked; +import org.bukkit.block.data.type.SculkSensor; + +import java.util.List; +import java.util.Set; + +@Linked +public class SculkSensorAttribute implements BlockAttribute { + + private String attribute = "§8-§7 phase "; + + @Override + public Class type() { + return SculkSensor.class; + } + + @Override + public void copy(List attributes, SculkSensor blockData) { + attributes.add(attribute + blockData.getPhase()); + } + + @Override + public void paste(Set attributes, SculkSensor blockData) { + for (SculkSensor.Phase phase : SculkSensor.Phase.values()) { + if (attributes.contains(attribute + phase)) { + blockData.setPhase(phase); + return; + } + } + } +} diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/type/SeaPickleAttribute.java b/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/type/SeaPickleAttribute.java new file mode 100644 index 00000000..7b3ddf57 --- /dev/null +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/type/SeaPickleAttribute.java @@ -0,0 +1,53 @@ +/* + * This file is a part of the SteamWar software. + * + * Copyright (C) 2022 SteamWar.de-Serverteam + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +package de.steamwar.bausystem.features.attributescopy.impl.type; + +import de.steamwar.bausystem.features.attributescopy.BlockAttribute; +import de.steamwar.linkage.Linked; +import org.bukkit.block.data.type.SeaPickle; + +import java.util.List; +import java.util.Set; + +@Linked +public class SeaPickleAttribute implements BlockAttribute { + + private String attribute = "§8-§7 pickles "; + + @Override + public Class type() { + return SeaPickle.class; + } + + @Override + public void copy(List attributes, SeaPickle blockData) { + attributes.add(attribute + blockData.getPickles()); + } + + @Override + public void paste(Set attributes, SeaPickle blockData) { + attributes.stream() + .filter(s -> s.startsWith(attribute)) + .map(s -> s.replace(attribute, "")) + .map(Integer::parseInt) + .findFirst() + .ifPresent(blockData::setPickles); + } +} diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/type/SlabAttribute.java b/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/type/SlabAttribute.java new file mode 100644 index 00000000..eca81bf4 --- /dev/null +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/type/SlabAttribute.java @@ -0,0 +1,53 @@ +/* + * This file is a part of the SteamWar software. + * + * Copyright (C) 2022 SteamWar.de-Serverteam + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +package de.steamwar.bausystem.features.attributescopy.impl.type; + +import de.steamwar.bausystem.features.attributescopy.BlockAttribute; +import de.steamwar.linkage.Linked; +import org.bukkit.block.data.type.Slab; + +import java.util.List; +import java.util.Set; + +@Linked +public class SlabAttribute implements BlockAttribute { + + private String attribute = "§8-§7 type "; + + @Override + public Class type() { + return Slab.class; + } + + @Override + public void copy(List attributes, Slab blockData) { + attributes.add(attribute + blockData.getType()); + } + + @Override + public void paste(Set attributes, Slab blockData) { + for (Slab.Type type : Slab.Type.values()) { + if (attributes.contains(attribute + type)) { + blockData.setType(type); + return; + } + } + } +} diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/type/SnowAttribute.java b/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/type/SnowAttribute.java new file mode 100644 index 00000000..935e975d --- /dev/null +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/type/SnowAttribute.java @@ -0,0 +1,53 @@ +/* + * This file is a part of the SteamWar software. + * + * Copyright (C) 2022 SteamWar.de-Serverteam + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +package de.steamwar.bausystem.features.attributescopy.impl.type; + +import de.steamwar.bausystem.features.attributescopy.BlockAttribute; +import de.steamwar.linkage.Linked; +import org.bukkit.block.data.type.Snow; + +import java.util.List; +import java.util.Set; + +@Linked +public class SnowAttribute implements BlockAttribute { + + private String attribute = "§8-§7 layers "; + + @Override + public Class type() { + return Snow.class; + } + + @Override + public void copy(List attributes, Snow blockData) { + attributes.add(attribute + blockData.getLayers()); + } + + @Override + public void paste(Set attributes, Snow blockData) { + attributes.stream() + .filter(s -> s.startsWith(attribute)) + .map(s -> s.replace(attribute, "")) + .map(Integer::parseInt) + .findFirst() + .ifPresent(blockData::setLayers); + } +} diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/type/StairsAttribute.java b/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/type/StairsAttribute.java new file mode 100644 index 00000000..186369b1 --- /dev/null +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/type/StairsAttribute.java @@ -0,0 +1,53 @@ +/* + * This file is a part of the SteamWar software. + * + * Copyright (C) 2022 SteamWar.de-Serverteam + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +package de.steamwar.bausystem.features.attributescopy.impl.type; + +import de.steamwar.bausystem.features.attributescopy.BlockAttribute; +import de.steamwar.linkage.Linked; +import org.bukkit.block.data.type.Stairs; + +import java.util.List; +import java.util.Set; + +@Linked +public class StairsAttribute implements BlockAttribute { + + private String attribute = "§8-§7 shape "; + + @Override + public Class type() { + return Stairs.class; + } + + @Override + public void copy(List attributes, Stairs blockData) { + attributes.add(attribute + blockData.getShape().name()); + } + + @Override + public void paste(Set attributes, Stairs blockData) { + for (Stairs.Shape shape : Stairs.Shape.values()) { + if (attributes.contains(attribute + shape.name())) { + blockData.setShape(shape); + return; + } + } + } +} diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/type/StructureBlockAttribute.java b/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/type/StructureBlockAttribute.java new file mode 100644 index 00000000..34055ce9 --- /dev/null +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/type/StructureBlockAttribute.java @@ -0,0 +1,53 @@ +/* + * This file is a part of the SteamWar software. + * + * Copyright (C) 2022 SteamWar.de-Serverteam + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +package de.steamwar.bausystem.features.attributescopy.impl.type; + +import de.steamwar.bausystem.features.attributescopy.BlockAttribute; +import de.steamwar.linkage.Linked; +import org.bukkit.block.data.type.StructureBlock; + +import java.util.List; +import java.util.Set; + +@Linked +public class StructureBlockAttribute implements BlockAttribute { + + private String attribute = "§8-§7 mode "; + + @Override + public Class type() { + return StructureBlock.class; + } + + @Override + public void copy(List attributes, StructureBlock blockData) { + attributes.add(attribute + blockData.getMode().name()); + } + + @Override + public void paste(Set attributes, StructureBlock blockData) { + for (StructureBlock.Mode mode : StructureBlock.Mode.values()) { + if (attributes.contains(attribute + mode.name())) { + blockData.setMode(mode); + return; + } + } + } +} diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/type/TNTAttribute.java b/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/type/TNTAttribute.java new file mode 100644 index 00000000..14192eac --- /dev/null +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/type/TNTAttribute.java @@ -0,0 +1,48 @@ +/* + * This file is a part of the SteamWar software. + * + * Copyright (C) 2022 SteamWar.de-Serverteam + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +package de.steamwar.bausystem.features.attributescopy.impl.type; + +import de.steamwar.bausystem.features.attributescopy.BlockAttribute; +import de.steamwar.linkage.Linked; +import org.bukkit.block.data.type.TNT; + +import java.util.List; +import java.util.Set; + +@Linked +public class TNTAttribute implements BlockAttribute { + + private String attribute = "§8-§7 unstable"; + + @Override + public Class type() { + return TNT.class; + } + + @Override + public void copy(List attributes, TNT blockData) { + if (blockData.isUnstable()) attributes.add(attribute); + } + + @Override + public void paste(Set attributes, TNT blockData) { + blockData.setUnstable(attributes.contains(attribute)); + } +} diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/type/TripwireAttribute.java b/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/type/TripwireAttribute.java new file mode 100644 index 00000000..27257568 --- /dev/null +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/type/TripwireAttribute.java @@ -0,0 +1,48 @@ +/* + * This file is a part of the SteamWar software. + * + * Copyright (C) 2022 SteamWar.de-Serverteam + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +package de.steamwar.bausystem.features.attributescopy.impl.type; + +import de.steamwar.bausystem.features.attributescopy.BlockAttribute; +import de.steamwar.linkage.Linked; +import org.bukkit.block.data.type.Tripwire; + +import java.util.List; +import java.util.Set; + +@Linked +public class TripwireAttribute implements BlockAttribute { + + private String attribute = "§8-§7 disarmed"; + + @Override + public Class type() { + return Tripwire.class; + } + + @Override + public void copy(List attributes, Tripwire blockData) { + if (blockData.isDisarmed()) attributes.add(attribute); + } + + @Override + public void paste(Set attributes, Tripwire blockData) { + blockData.setDisarmed(attributes.contains(attribute)); + } +} diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/type/TurtleEggAttribute.java b/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/type/TurtleEggAttribute.java new file mode 100644 index 00000000..478d1f75 --- /dev/null +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/type/TurtleEggAttribute.java @@ -0,0 +1,61 @@ +/* + * This file is a part of the SteamWar software. + * + * Copyright (C) 2022 SteamWar.de-Serverteam + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +package de.steamwar.bausystem.features.attributescopy.impl.type; + +import de.steamwar.bausystem.features.attributescopy.BlockAttribute; +import de.steamwar.linkage.Linked; +import org.bukkit.block.data.type.TurtleEgg; + +import java.util.List; +import java.util.Set; + +@Linked +public class TurtleEggAttribute implements BlockAttribute { + + private String attribute1 = "§8-§7 eggs "; + private String attribute2 = "§8-§7 hatch "; + + @Override + public Class type() { + return TurtleEgg.class; + } + + @Override + public void copy(List attributes, TurtleEgg blockData) { + attributes.add(attribute1 + blockData.getEggs()); + attributes.add(attribute2 + blockData.getHatch()); + } + + @Override + public void paste(Set attributes, TurtleEgg blockData) { + attributes.stream() + .filter(s -> s.startsWith(attribute1)) + .map(s -> s.replace(attribute1, "")) + .map(Integer::parseInt) + .findFirst() + .ifPresent(blockData::setEggs); + attributes.stream() + .filter(s -> s.startsWith(attribute2)) + .map(s -> s.replace(attribute2, "")) + .map(Integer::parseInt) + .findFirst() + .ifPresent(blockData::setHatch); + } +} diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/type/WallAttribute.java b/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/type/WallAttribute.java new file mode 100644 index 00000000..708a6bbc --- /dev/null +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/type/WallAttribute.java @@ -0,0 +1,63 @@ +/* + * This file is a part of the SteamWar software. + * + * Copyright (C) 2022 SteamWar.de-Serverteam + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +package de.steamwar.bausystem.features.attributescopy.impl.type; + +import de.steamwar.bausystem.features.attributescopy.BlockAttribute; +import de.steamwar.linkage.Linked; +import org.bukkit.block.BlockFace; +import org.bukkit.block.data.type.Wall; + +import java.util.List; +import java.util.Set; + +@Linked +public class WallAttribute implements BlockAttribute { + + private BlockFace[] faces = new BlockFace[] {BlockFace.NORTH, BlockFace.EAST, BlockFace.SOUTH, BlockFace.WEST}; + + private String attribute1 = "§8-§7 up"; + private String attribute2 = "§8-§7 connected "; + + @Override + public Class type() { + return Wall.class; + } + + @Override + public void copy(List attributes, Wall blockData) { + if (blockData.isUp()) attributes.add(attribute1); + for (BlockFace face : faces) { + attributes.add(attribute2 + face.name().toLowerCase() + " " + blockData.getHeight(face)); + } + } + + @Override + public void paste(Set attributes, Wall blockData) { + blockData.setUp(attributes.contains(attribute1)); + for (BlockFace face : faces) { + for (Wall.Height height : Wall.Height.values()) { + if (attributes.contains(attribute2 + face.name().toLowerCase() + " " + height.name().toLowerCase())) { + blockData.setHeight(face, height); + break; + } + } + } + } +} diff --git a/BauSystem_Main/src/de/steamwar/bausystem/utils/NMSWrapper.java b/BauSystem_Main/src/de/steamwar/bausystem/utils/NMSWrapper.java index c3062009..ffdc6438 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/utils/NMSWrapper.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/utils/NMSWrapper.java @@ -27,7 +27,6 @@ import de.steamwar.bausystem.features.warp.AbstractWarpEntity; import de.steamwar.core.VersionDependent; import org.bukkit.GameMode; import org.bukkit.Material; -import org.bukkit.Particle; import org.bukkit.World; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack;