SteamWar/BauSystem2.0
Archiviert
12
0

Hotfix SignEditFrom20
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful

Signed-off-by: yoyosource <yoyosource@nidido.de>
Dieser Commit ist enthalten in:
yoyosource 2023-09-24 18:10:09 +02:00
Ursprung 71c8b7c062
Commit 8da3c7bcf7

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;
}