summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormd_5 <git@md-5.net>2018-10-27 08:15:41 +1100
committermd_5 <git@md-5.net>2018-10-27 08:15:41 +1100
commitd6b57bd96328eb4d11db12b8b9b309700d2fc9e6 (patch)
tree36760375dfeca093fbfbc16ac7c1425bdadb3277
parent4a47be61649e410294b504fede87199167821e99 (diff)
downloadcraftbukkit-d6b57bd96328eb4d11db12b8b9b309700d2fc9e6.tar
craftbukkit-d6b57bd96328eb4d11db12b8b9b309700d2fc9e6.tar.gz
craftbukkit-d6b57bd96328eb4d11db12b8b9b309700d2fc9e6.tar.lz
craftbukkit-d6b57bd96328eb4d11db12b8b9b309700d2fc9e6.tar.xz
craftbukkit-d6b57bd96328eb4d11db12b8b9b309700d2fc9e6.zip
SPIGOT-4446: Legacy rotation methods don't work for wall mounted skulls
-rw-r--r--src/main/java/org/bukkit/craftbukkit/block/CraftSkull.java13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftSkull.java b/src/main/java/org/bukkit/craftbukkit/block/CraftSkull.java
index ad7a2dd1..110e0459 100644
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftSkull.java
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftSkull.java
@@ -12,6 +12,8 @@ import org.bukkit.SkullType;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.block.Skull;
+import org.bukkit.block.data.BlockData;
+import org.bukkit.block.data.Directional;
import org.bukkit.block.data.Rotatable;
import org.bukkit.craftbukkit.entity.CraftPlayer;
@@ -106,13 +108,18 @@ public class CraftSkull extends CraftBlockEntityState<TileEntitySkull> implement
@Override
public BlockFace getRotation() {
- return ((Rotatable) getBlockData()).getRotation();
+ BlockData blockData = getBlockData();
+ return (blockData instanceof Rotatable) ? ((Rotatable) blockData).getRotation() : ((Directional) blockData).getFacing();
}
@Override
public void setRotation(BlockFace rotation) {
- Rotatable blockData = (Rotatable) getBlockData();
- blockData.setRotation(rotation);
+ BlockData blockData = getBlockData();
+ if (blockData instanceof Rotatable) {
+ ((Rotatable) blockData).setRotation(rotation);
+ } else {
+ ((Directional) blockData).setFacing(rotation);
+ }
setBlockData(blockData);
}