Signed-off-by: yoyosource <yoyosource@nidido.de>
Dieser Commit ist enthalten in:
Ursprung
71c8b7c062
Commit
8da3c7bcf7
@ -31,6 +31,7 @@ import org.bukkit.block.Block;
|
|||||||
import org.bukkit.block.BlockFace;
|
import org.bukkit.block.BlockFace;
|
||||||
import org.bukkit.block.Sign;
|
import org.bukkit.block.Sign;
|
||||||
import org.bukkit.block.data.BlockData;
|
import org.bukkit.block.data.BlockData;
|
||||||
|
import org.bukkit.block.data.Directional;
|
||||||
import org.bukkit.block.data.Rotatable;
|
import org.bukkit.block.data.Rotatable;
|
||||||
import org.bukkit.block.sign.Side;
|
import org.bukkit.block.sign.Side;
|
||||||
import org.bukkit.block.sign.SignSide;
|
import org.bukkit.block.sign.SignSide;
|
||||||
@ -96,7 +97,15 @@ public class SignEditFrom20 implements Listener {
|
|||||||
|
|
||||||
private Side signSide(Player entity, Block sign) {
|
private Side signSide(Player entity, Block sign) {
|
||||||
Vector vector = entity.getEyeLocation().toVector().subtract(sign.getLocation().add(0.5, 0.5, 0.5).toVector());
|
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());
|
Vector signDirection = new Vector(blockFace.getModX(), blockFace.getModY(), blockFace.getModZ());
|
||||||
return vector.dot(signDirection) > 0 ? Side.FRONT : Side.BACK;
|
return vector.dot(signDirection) > 0 ? Side.FRONT : Side.BACK;
|
||||||
}
|
}
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren