MaterialData for signs
| 7 | * MaterialData for signs |
| 8 | */ |
| 9 | public class Sign extends MaterialData implements Attachable { |
| 10 | public Sign() { |
| 11 | super(Material.SIGN_POST); |
| 12 | } |
| 13 | |
| 14 | public Sign(final int type) { |
| 15 | super(type); |
| 16 | } |
| 17 | |
| 18 | public Sign(final Material type) { |
| 19 | super(type); |
| 20 | } |
| 21 | |
| 22 | public Sign(final int type, final byte data) { |
| 23 | super(type, data); |
| 24 | } |
| 25 | |
| 26 | public Sign(final Material type, final byte data) { |
| 27 | super(type, data); |
| 28 | } |
| 29 | |
| 30 | /** |
| 31 | * Check if this sign is attached to a wall |
| 32 | * |
| 33 | * @return true if this sign is attached to a wall, false if set on top of a |
| 34 | * block |
| 35 | */ |
| 36 | public boolean isWallSign() { |
| 37 | return getItemType() == Material.WALL_SIGN; |
| 38 | } |
| 39 | |
| 40 | /** |
| 41 | * Gets the face that this block is attached on |
| 42 | * |
| 43 | * @return BlockFace attached to |
| 44 | */ |
| 45 | public BlockFace getAttachedFace() { |
| 46 | if (isWallSign()) { |
| 47 | byte data = getData(); |
| 48 | |
| 49 | switch (data) { |
| 50 | case 0x2: |
| 51 | return BlockFace.WEST; |
| 52 | |
| 53 | case 0x3: |
| 54 | return BlockFace.EAST; |
| 55 | |
| 56 | case 0x4: |
| 57 | return BlockFace.SOUTH; |
| 58 | |
| 59 | case 0x5: |
| 60 | return BlockFace.NORTH; |
| 61 | } |
| 62 | |
| 63 | return null; |
| 64 | } else { |
| 65 | return BlockFace.DOWN; |
| 66 | } |
nothing calls this directly
no outgoing calls
no test coverage detected