SteamWar/BauSystem2.0
Archiviert
12
0

QOL #203

Zusammengeführt
YoyoNow hat 44 Commits von QOL nach master 2023-10-06 14:59:48 +02:00 zusammengeführt
Nur Änderungen aus Commit 8da3c7bcf7 werden angezeigt - Alle Commits anzeigen

Datei anzeigen

@ -31,6 +31,7 @@ import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.block.Sign;
import org.bukkit.block.data.BlockData;
import org.bukkit.block.data.Directional;
import org.bukkit.block.data.Rotatable;
import org.bukkit.block.sign.Side;
import org.bukkit.block.sign.SignSide;
@ -96,7 +97,15 @@ public class SignEditFrom20 implements Listener {
private Side signSide(Player entity, Block sign) {
Vector vector = entity.getEyeLocation().toVector().subtract(sign.getLocation().add(0.5, 0.5, 0.5).toVector());
BlockFace blockFace = ((org.bukkit.block.data.type.Sign) sign.getBlockData()).getRotation();
BlockData blockData = sign.getBlockData();
BlockFace blockFace = BlockFace.NORTH;
if (blockData instanceof Directional) {
blockFace = ((Directional) blockData).getFacing();
} else if (blockData instanceof Rotatable) {
blockFace = ((Rotatable) blockData).getRotation();
}
Vector signDirection = new Vector(blockFace.getModX(), blockFace.getModY(), blockFace.getModZ());
return vector.dot(signDirection) > 0 ? Side.FRONT : Side.BACK;
}