SteamWar/BauSystem2.0
Archiviert
12
0

Hotfix AttributeRemoveCommand
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful

Signed-off-by: yoyosource <yoyosource@nidido.de>
Dieser Commit ist enthalten in:
yoyosource 2022-12-08 20:38:58 +01:00
Ursprung 9c788a27d6
Commit 2b959228db

Datei anzeigen

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