MCPcopy Create free account
hub / github.com/Bukkit/Bukkit / Door

Class Door

src/main/java/org/bukkit/material/Door.java:9–126  ·  view source on GitHub ↗

Represents a door.

Source from the content-addressed store, hash-verified

7 * Represents a door.
8 */
9public class Door extends MaterialData implements Directional {
10 public Door() {
11 super(Material.WOODEN_DOOR);
12 }
13
14 public Door(final int type) {
15 super(type);
16 }
17
18 public Door(final Material type) {
19 super(type);
20 }
21
22 public Door(final int type, final byte data) {
23 super(type, data);
24 }
25
26 public Door(final Material type, final byte data) {
27 super(type, data);
28 }
29
30 /**
31 * Check to see if the door is open.
32 * @return true if the door has swung counterclockwise around its hinge.
33 */
34 public boolean isOpen() {
35 return ((getData() & 0x4) == 0x4);
36 }
37
38 /**
39 * Configure this door to be either open or closed;
40 * @param isOpen True to open the door.
41 */
42 public void setOpen(boolean isOpen) {
43 setData((byte) (isOpen ? (getData() | 0x4) : (getData() & ~0x4)));
44 }
45
46 /**
47 * @return whether this is the top half of the door
48 */
49 public boolean isTopHalf() {
50 return ((getData() & 0x8) == 0x8);
51 }
52
53 /**
54 * Configure this part of the door to be either the top or the bottom half;
55 * @param isTopHalf True to make it the top half.
56 */
57 public void setTopHalf(boolean isTopHalf) {
58 setData((byte) (isTopHalf ? (getData() | 0x8) : (getData() & ~0x8)));
59 }
60
61 /**
62 * @return the location of the hinges
63 */
64 public BlockFace getHingeCorner() {
65 byte d = getData();
66

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected