Bukkit-API  1.7.9-R0.2
The inofficial Bukkit-API
Door.java
1 package org.bukkit.material;
2 
3 import org.bukkit.Material;
5 
6 /**
7  * Represents a door.
8  *
9  * @deprecated No longer functions. Do not use.
10  */
11 @Deprecated
12 public class Door extends MaterialData implements Directional, Openable {
13  public Door() {
14  super(Material.WOODEN_DOOR);
15  }
16 
17  /**
18  *
19  * @deprecated Magic value
20  */
21  @Deprecated
22  public Door(final int type) {
23  super(type);
24  }
25 
26  public Door(final Material type) {
27  super(type);
28  }
29 
30  /**
31  *
32  * @deprecated Magic value
33  */
34  @Deprecated
35  public Door(final int type, final byte data) {
36  super(type, data);
37  }
38 
39  /**
40  *
41  * @deprecated Magic value
42  */
43  @Deprecated
44  public Door(final Material type, final byte data) {
45  super(type, data);
46  }
47 
48  /**
49  * @deprecated Does not work (correctly) anymore
50  */
51  @Deprecated
52  public boolean isOpen() {
53  return ((getData() & 0x4) == 0x4);
54  }
55 
56  /**
57  * @deprecated Does not work (correctly) anymore
58  */
59  @Deprecated
60  public void setOpen(boolean isOpen) {
61  setData((byte) (isOpen ? (getData() | 0x4) : (getData() & ~0x4)));
62  }
63 
64  /**
65  * @return whether this is the top half of the door
66  */
67  public boolean isTopHalf() {
68  return ((getData() & 0x8) == 0x8);
69  }
70 
71  /**
72  * Configure this part of the door to be either the top or the bottom half
73  *
74  * @param isTopHalf True to make it the top half.
75  * @deprecated Shouldn't be used anymore
76  */
77  @Deprecated
78  public void setTopHalf(boolean isTopHalf) {
79  setData((byte) (isTopHalf ? (getData() | 0x8) : (getData() & ~0x8)));
80  }
81 
82  /**
83  * @return BlockFace.SELF
84  * @deprecated Does not work (correctly) anymore
85  */
86  @Deprecated
88  byte d = getData();
89 
90  if ((d & 0x3) == 0x3) {
91  return BlockFace.NORTH_WEST;
92  } else if ((d & 0x1) == 0x1) {
93  return BlockFace.SOUTH_EAST;
94  } else if ((d & 0x2) == 0x2) {
95  return BlockFace.SOUTH_WEST;
96  }
97 
98  return BlockFace.NORTH_EAST;
99  }
100 
101  @Override
102  public String toString() {
103  return (isTopHalf() ? "TOP" : "BOTTOM") + " half of " + super.toString();
104  }
105 
106  /**
107  * Set the direction that this door should is facing.
108  *
109  * @param face the direction
110  * @deprecated Does not work (correctly) anymore
111  */
112  @Deprecated
113  public void setFacingDirection(BlockFace face) {
114  byte data = (byte) (getData() & 0x12);
115  switch (face) {
116  case NORTH:
117  data |= 0x1;
118  break;
119 
120  case EAST:
121  data |= 0x2;
122  break;
123 
124  case SOUTH:
125  data |= 0x3;
126  break;
127  }
128  setData(data);
129  }
130 
131  /**
132  * Get the direction that this door is facing.
133  *
134  * @return the direction
135  * @deprecated Does not work (correctly) anymore
136  */
137  @Deprecated
138  public BlockFace getFacing() {
139  byte data = (byte) (getData() & 0x3);
140  switch (data) {
141  case 0:
142  return BlockFace.WEST;
143 
144  case 1:
145  return BlockFace.NORTH;
146 
147  case 2:
148  return BlockFace.EAST;
149 
150  case 3:
151  return BlockFace.SOUTH;
152  }
153  return null; // shouldn't happen
154  }
155 
156  @Override
157  public Door clone() {
158  return (Door) super.clone();
159  }
160 }
Door(final Material type, final byte data)
Definition: Door.java:44
boolean isTopHalf()
Definition: Door.java:67
BlockFace getHingeCorner()
Definition: Door.java:87
void setTopHalf(boolean isTopHalf)
Definition: Door.java:78
void setFacingDirection(BlockFace face)
Definition: Door.java:113
BlockFace getFacing()
Definition: Door.java:138
Door(final int type)
Definition: Door.java:22
Door(final int type, final byte data)
Definition: Door.java:35
void setOpen(boolean isOpen)
Definition: Door.java:60