Signed-off-by: yoyosource <yoyosource@nidido.de>
Dieser Commit ist enthalten in:
Ursprung
9c788a27d6
Commit
2b959228db
@ -25,6 +25,7 @@ import de.steamwar.command.SWCommand;
|
||||
import de.steamwar.linkage.Linked;
|
||||
import de.steamwar.linkage.MinVersion;
|
||||
import org.bukkit.FluidCollisionMode;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.data.BlockData;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -53,9 +54,10 @@ public class AttributesCopyCommand extends SWCommand {
|
||||
linkIfNeeded();
|
||||
|
||||
Block block = player.getTargetBlockExact(8, FluidCollisionMode.ALWAYS);
|
||||
if (block == null) return;
|
||||
ItemStack mainHand = player.getInventory().getItemInMainHand();
|
||||
if (mainHand.getType() != block.getType()) {
|
||||
BauSystem.MESSAGE.send("ATTRIBUTES_CANT_COPY", player);
|
||||
if (!isSame(block, mainHand)) {
|
||||
BauSystem.MESSAGE.send("ATTRIBUTE_COPY_NOT_SAME", player);
|
||||
return;
|
||||
}
|
||||
BlockData blockData = block.getBlockData();
|
||||
@ -84,4 +86,10 @@ public class AttributesCopyCommand extends SWCommand {
|
||||
LinkageUtils.linkBlockAttributes();
|
||||
isLinked = true;
|
||||
}
|
||||
|
||||
private boolean isSame(Block block, ItemStack itemStack) {
|
||||
if (block.getType() == itemStack.getType()) return true;
|
||||
if (itemStack.getType() == Material.REDSTONE && block.getType() == Material.REDSTONE_WIRE) return true;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren