diff --git a/BauSystem_Linkage/src/de/steamwar/linkage/types/BlockAttribute_GENERIC.java b/BauSystem_Linkage/src/de/steamwar/linkage/types/BlockAttribute_GENERIC.java deleted file mode 100644 index b898485b..00000000 --- a/BauSystem_Linkage/src/de/steamwar/linkage/types/BlockAttribute_GENERIC.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * 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/de/steamwar/bausystem/features/attributescopy/AttributeRemoveCommand.java b/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/AttributeRemoveCommand.java index f9217497..902d7c59 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/AttributeRemoveCommand.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/AttributeRemoveCommand.java @@ -36,7 +36,6 @@ import java.util.List; import java.util.stream.Collectors; @Linked -@MinVersion(18) public class AttributeRemoveCommand extends SWCommand { public AttributeRemoveCommand() { diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/AttributeUtils.java b/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/AttributeUtils.java new file mode 100644 index 00000000..246e4ab9 --- /dev/null +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/AttributeUtils.java @@ -0,0 +1,128 @@ +/* + * This file is a part of the SteamWar software. + * + * Copyright (C) 2023 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 lombok.experimental.UtilityClass; +import org.bukkit.block.data.BlockData; + +import java.lang.reflect.Method; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +@UtilityClass +public class AttributeUtils { + + private Map names = new HashMap<>(); + private Map, List> getters = new HashMap<>(); + private Map, Map> setters = new HashMap<>(); + + private void generate(BlockData blockData) { + Class clazz = blockData.getClass(); + if (getters.containsKey(clazz) && setters.containsKey(clazz)) return; + + Map> methods = new HashMap<>(); + for (Method declaredMethod : clazz.getMethods()) { + String s = declaredMethod.getName(); + if (s.startsWith("get") && declaredMethod.getParameterCount() == 0) { + methods.computeIfAbsent(s.substring(3), aClass -> new ArrayList<>()).add(declaredMethod); + } else if (s.startsWith("is") && declaredMethod.getParameterCount() == 0) { + methods.computeIfAbsent(s.substring(2), aClass -> new ArrayList<>()).add(declaredMethod); + } else if (s.startsWith("set") && declaredMethod.getParameterCount() == 1) { + methods.computeIfAbsent(s.substring(3), aClass -> new ArrayList<>()).add(declaredMethod); + } + } + for (Map.Entry> entry : methods.entrySet()) { + if (entry.getValue().size() != 2) continue; + for (Method method : entry.getValue()) { + names.put(method, entry.getKey()); + if (method.getName().startsWith("is") || method.getName().startsWith("get")) { + getters.computeIfAbsent(clazz, aClass -> new ArrayList<>()).add(method); + } else { + setters.computeIfAbsent(clazz, aClass -> new HashMap<>()).put(entry.getKey(), method); + } + } + } + } + + public void copy(BlockData blockData, List attributes) { + generate(blockData); + + getters.getOrDefault(blockData.getClass(), new ArrayList<>()).forEach(method -> { + try { + Object invoke = method.invoke(blockData); + if (invoke != null) { + attributes.add("§8-§7 " + names.get(method) + "§8:§7 " + convert(invoke)); + } + } catch (Exception e) { + // ignore + } + }); + } + + public void paste(BlockData blockData, List attributes) { + generate(blockData); + + for (String attribute : attributes) { + String[] split = attribute.split("§8:§7 "); + if (split.length != 2) continue; + String name = split[0].substring(6); + String value = split[1]; + Method method = setters.getOrDefault(blockData.getClass(), new HashMap<>()).get(name); + if (method == null) continue; + try { + method.invoke(blockData, convert(value, method.getParameterTypes()[0])); + } catch (Exception e) { + // ignore + } + } + } + + private String convert(Object o) { + if (o.getClass().isEnum()) { + return ((Enum) o).name(); + } else { + return o.toString(); + } + } + + private Object convert(String s, Class type) { + if (type.isEnum()) { + return Enum.valueOf((Class) type, s); + } else if (type == int.class || type == Integer.class) { + return Integer.parseInt(s); + } else if (type == double.class || type == Double.class) { + return Double.parseDouble(s); + } else if (type == float.class || type == Float.class) { + return Float.parseFloat(s); + } else if (type == long.class || type == Long.class) { + return Long.parseLong(s); + } else if (type == short.class || type == Short.class) { + return Short.parseShort(s); + } else if (type == byte.class || type == Byte.class) { + return Byte.parseByte(s); + } else if (type == boolean.class || type == Boolean.class) { + return Boolean.parseBoolean(s); + } else { + return s; + } + } +} diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/AttributesCopyCommand.java b/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/AttributesCopyCommand.java index d63204f3..01d652b4 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/AttributesCopyCommand.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/AttributesCopyCommand.java @@ -20,10 +20,8 @@ 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.Material; import org.bukkit.block.Block; @@ -36,40 +34,29 @@ 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", "ac"); } @Register public void genericCommand(Player player) { - linkIfNeeded(); - Block block = player.getTargetBlockExact(8, FluidCollisionMode.ALWAYS); if (block == null) return; ItemStack mainHand = player.getInventory().getItemInMainHand(); - if (!isSame(block, mainHand)) { + + if (!(block.getType().isItem() && block.getType() == mainHand.getType() || isSame(block, mainHand))) { BauSystem.MESSAGE.send("ATTRIBUTES_CANT_COPY", player); return; } + BlockData blockData = block.getBlockData(); List attributesToCopy = new ArrayList<>(); - if (needsType(block)) { - attributesToCopy.add("§8-§7 material " + block.getType().name().toLowerCase()); - } - for (BlockAttribute blockAttribute : blockAttributeList) { - if (blockAttribute.type().isInstance(blockData)) { - blockAttribute.copy(attributesToCopy, blockData); - } + if (block.getType() != mainHand.getType()) { + attributesToCopy.add("§8-§7 Material§8:§7 " + block.getType().name()); } + AttributeUtils.copy(blockData, attributesToCopy); if (attributesToCopy.isEmpty()) { BauSystem.MESSAGE.send("ATTRIBUTES_NO_COPY", player); return; @@ -83,15 +70,7 @@ public class AttributesCopyCommand extends SWCommand { BauSystem.MESSAGE.send("ATTRIBUTES_COPIED", player); } - private static boolean isLinked = false; - static void linkIfNeeded() { - if (isLinked) return; - LinkageUtils.linkBlockAttributes(); - isLinked = true; - } - private boolean isSame(Block block, ItemStack itemStack) { - if (block.getType() == itemStack.getType()) return true; if (itemStack.getType() == Material.REDSTONE && block.getType() == Material.REDSTONE_WIRE) return true; if (itemStack.getType() == Material.PLAYER_HEAD && block.getType() == Material.PLAYER_WALL_HEAD) return true; if (itemStack.getType() == Material.ZOMBIE_HEAD && block.getType() == Material.ZOMBIE_WALL_HEAD) return true; @@ -102,22 +81,8 @@ public class AttributesCopyCommand extends SWCommand { if (itemStack.getType() == Material.TORCH && block.getType() == Material.WALL_TORCH) return true; if (itemStack.getType() == Material.SOUL_TORCH && block.getType() == Material.SOUL_WALL_TORCH) return true; if (itemStack.getType() == Material.REDSTONE_TORCH && block.getType() == Material.REDSTONE_WALL_TORCH) return true; + if (itemStack.getType() == Material.WHEAT_SEEDS && block.getType() == Material.WHEAT) return true; if (itemStack.getType().name().contains("_BANNER") && block.getType().name().contains("_WALL_BANNER")) return true; return false; } - - private boolean needsType(Block block) { - if (block.getType().name().contains("WALL")) return true; - if (block.getType() == Material.PLAYER_HEAD) return true; - if (block.getType() == Material.ZOMBIE_HEAD) return true; - if (block.getType() == Material.CREEPER_HEAD) return true; - if (block.getType() == Material.DRAGON_HEAD) return true; - if (block.getType() == Material.SKELETON_SKULL) return true; - if (block.getType() == Material.WITHER_SKELETON_SKULL) return true; - if (block.getType() == Material.TORCH) return true; - if (block.getType() == Material.SOUL_TORCH) return true; - if (block.getType() == Material.REDSTONE_TORCH) return true; - if (block.getType().name().contains("_BANNER")) return true; - return false; - } } diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/AttributesPlaceListener.java b/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/AttributesPlaceListener.java index adcf545c..de4b192a 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/AttributesPlaceListener.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/AttributesPlaceListener.java @@ -21,7 +21,6 @@ package de.steamwar.bausystem.features.attributescopy; import de.steamwar.bausystem.BauSystem; import de.steamwar.linkage.Linked; -import de.steamwar.linkage.MinVersion; import org.bukkit.Bukkit; import org.bukkit.Material; import org.bukkit.OfflinePlayer; @@ -34,19 +33,13 @@ 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 AttributesPlaceListener implements Listener { @EventHandler public void onBlockPlace(BlockPlaceEvent event) { - AttributesCopyCommand.linkIfNeeded(); ItemStack itemStack = event.getItemInHand(); ItemMeta itemMeta = itemStack.getItemMeta(); if (itemMeta == null) return; @@ -64,12 +57,12 @@ public class AttributesPlaceListener implements Listener { event.setCancelled(true); Bukkit.getScheduler().runTaskLater(BauSystem.getInstance(), () -> { Material material = strings.stream() - .filter(s -> s.startsWith("§8-§7 material ")) - .map(s -> s.replace("§8-§7 material ", "")) + .filter(s -> s.startsWith("§8-§7 Material§8:§7 ")) + .map(s -> s.replace("§8-§7 Material§8:§7 ", "")) .map(String::toUpperCase) .map(s -> { try { - return Material.valueOf(s.toUpperCase()); + return Material.valueOf(s); } catch (Exception e) { return null; } @@ -77,7 +70,6 @@ public class AttributesPlaceListener implements Listener { .findFirst() .orElse(type); event.getBlock().setType(material, false); - Set attributesToPaste = new HashSet<>(strings); Block block = event.getBlock(); BlockData blockData = block.getBlockData(); Bukkit.getScheduler().runTaskLater(BauSystem.getInstance(), () -> { @@ -87,11 +79,7 @@ public class AttributesPlaceListener implements Listener { skull.update(true, false); } }, 1); - for (BlockAttribute blockAttribute : blockAttributeList) { - if (blockAttribute.type().isInstance(blockData)) { - blockAttribute.paste(attributesToPaste, blockData); - } - } + AttributeUtils.paste(blockData, strings); block.setBlockData(blockData, false); }, 1); } diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/BlockAttribute.java b/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/BlockAttribute.java deleted file mode 100644 index 13fbf86c..00000000 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/BlockAttribute.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * 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 deleted file mode 100644 index a52d6819..00000000 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/AgeableAttribute.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * 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 deleted file mode 100644 index 6d9c7df0..00000000 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/AnaloguePowerableAttribute.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * 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 deleted file mode 100644 index 05a716e9..00000000 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/AttachableAttribute.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * 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 deleted file mode 100644 index 31849b40..00000000 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/BisectedAttribute.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * 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 deleted file mode 100644 index c0e11fc8..00000000 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/DirectionalAttribute.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * 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 deleted file mode 100644 index 59f79a19..00000000 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/FaceAttachableAttribute.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * 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 deleted file mode 100644 index 8e26bb31..00000000 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/HangableAttribute.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * 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 deleted file mode 100644 index 6e60b601..00000000 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/LevelledAttribute.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * 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 deleted file mode 100644 index aa55a054..00000000 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/LightableAttribute.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * 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 deleted file mode 100644 index 262de53c..00000000 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/MultipleFacingAttribute.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * 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()) { - 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 deleted file mode 100644 index 2e440e67..00000000 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/OpenableAttribute.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * 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 deleted file mode 100644 index e70d8ab3..00000000 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/OrientableAttribute.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * 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.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 deleted file mode 100644 index 3aabee78..00000000 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/PowerableAttribute.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * 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 deleted file mode 100644 index e7ab4e76..00000000 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/RailAttribute.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * 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 deleted file mode 100644 index 94a1fa8d..00000000 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/RotatableAttribute.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * 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 deleted file mode 100644 index 71358651..00000000 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/SnowableAttribute.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * 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 deleted file mode 100644 index bd010c01..00000000 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/WaterloggedAttribute.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * 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 deleted file mode 100644 index c2182b03..00000000 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/type/BambooAttribute.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * 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 deleted file mode 100644 index b5fcb280..00000000 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/type/BellAttribute.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * 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 deleted file mode 100644 index a1ebef35..00000000 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/type/BigDripleafAttribute.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * 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 deleted file mode 100644 index 0e44b938..00000000 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/type/CakeAttribute.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * 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 deleted file mode 100644 index 9d5d9e3e..00000000 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/type/CampfireAttribute.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * 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 deleted file mode 100644 index a8e054d8..00000000 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/type/CandleAttribute.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * 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 deleted file mode 100644 index ecbaf271..00000000 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/type/CaveVinesPlantAttribute.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * 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 deleted file mode 100644 index 4342008e..00000000 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/type/ComparatorAttribute.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * 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 deleted file mode 100644 index 3c319987..00000000 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/type/DaylightDetectorAttribute.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * 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 deleted file mode 100644 index 1c7885af..00000000 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/type/DoorAttribute.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * 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 deleted file mode 100644 index 25f790a6..00000000 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/type/EndPortalFrameAttribute.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * 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 deleted file mode 100644 index b55971d4..00000000 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/type/FarmlandAttribute.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * 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 deleted file mode 100644 index 3f853135..00000000 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/type/GateAttribute.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * 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 deleted file mode 100644 index b64266a8..00000000 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/type/HopperAttribute.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * 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 deleted file mode 100644 index 492e2543..00000000 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/type/JigsawAttribute.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * 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 deleted file mode 100644 index 3ea0d701..00000000 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/type/LanternAttribute.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * 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 deleted file mode 100644 index 74f445f6..00000000 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/type/LeavesAttribute.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * 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 deleted file mode 100644 index 5b25834a..00000000 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/type/PointedDripstoneAttribute.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * 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 deleted file mode 100644 index a3049f2b..00000000 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/type/RedstoneWireAttribute.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * 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()) { - attributes.add(attribute + blockFace.name().toLowerCase() + " " + blockData.getFace(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 deleted file mode 100644 index 1f25d655..00000000 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/type/RepeaterAttribute.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * 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 attribute1 = "§8-§7 delay "; - private String attribute2 = "§8-§7 locked"; - - @Override - public Class type() { - return Repeater.class; - } - - @Override - public void copy(List attributes, Repeater blockData) { - attributes.add(attribute1 + blockData.getDelay()); - if (blockData.isLocked()) attributes.add(attribute2); - } - - @Override - public void paste(Set attributes, Repeater blockData) { - attributes.stream() - .filter(s -> s.startsWith(attribute1)) - .map(s -> s.replace(attribute1, "")) - .map(Integer::parseInt) - .findFirst() - .ifPresent(blockData::setDelay); - blockData.setLocked(attributes.contains(attribute2)); - } -} 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 deleted file mode 100644 index 646a14d8..00000000 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/type/RespawnAnchorAttribute.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * 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 deleted file mode 100644 index 3a15fc35..00000000 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/type/SaplingAttribute.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * 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 deleted file mode 100644 index 8da631d8..00000000 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/type/ScaffoldingAttribute.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * 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 deleted file mode 100644 index 8f974f40..00000000 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/type/SculkSensorAttribute.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * 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 deleted file mode 100644 index 7b3ddf57..00000000 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/type/SeaPickleAttribute.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * 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 deleted file mode 100644 index eca81bf4..00000000 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/type/SlabAttribute.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * 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 deleted file mode 100644 index 935e975d..00000000 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/type/SnowAttribute.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * 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 deleted file mode 100644 index 3686b506..00000000 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/type/StairsAttribute.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * 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().toLowerCase()); - } - - @Override - public void paste(Set attributes, Stairs blockData) { - for (Stairs.Shape shape : Stairs.Shape.values()) { - if (attributes.contains(attribute + shape.name().toLowerCase())) { - 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 deleted file mode 100644 index 34055ce9..00000000 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/type/StructureBlockAttribute.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * 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 deleted file mode 100644 index 14192eac..00000000 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/type/TNTAttribute.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * 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 deleted file mode 100644 index 27257568..00000000 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/type/TripwireAttribute.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * 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 deleted file mode 100644 index 478d1f75..00000000 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/type/TurtleEggAttribute.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * 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 deleted file mode 100644 index a72ed734..00000000 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/impl/type/WallAttribute.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - * 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) { - if (blockData.getHeight(face) == Wall.Height.NONE) continue; - attributes.add(attribute2 + face.name().toLowerCase() + " " + blockData.getHeight(face).name().toLowerCase()); - } - } - - @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; - } - } - } - } -}