Bukkit-API  1.7.9-R0.2
The inofficial Bukkit-API
org.bukkit.material.Sign Class Reference
Inheritance diagram for org.bukkit.material.Sign:
org.bukkit.material.MaterialData org.bukkit.material.Attachable org.bukkit.material.Directional

Public Member Functions

 Sign (final int type)
 
 Sign (final Material type)
 
 Sign (final int type, final byte data)
 
 Sign (final Material type, final byte data)
 
boolean isWallSign ()
 
BlockFace getAttachedFace ()
 
BlockFace getFacing ()
 
void setFacingDirection (BlockFace face)
 
String toString ()
 
Sign clone ()
 
- Public Member Functions inherited from org.bukkit.material.MaterialData
 MaterialData (final int type)
 
 MaterialData (final Material type)
 
 MaterialData (final int type, final byte data)
 
 MaterialData (final Material type, final byte data)
 
byte getData ()
 
void setData (byte data)
 
Material getItemType ()
 
int getItemTypeId ()
 
ItemStack toItemStack ()
 
ItemStack toItemStack (int amount)
 
String toString ()
 
int hashCode ()
 
boolean equals (Object obj)
 
MaterialData clone ()
 

Detailed Description

MaterialData for signs

Definition at line 9 of file material/Sign.java.

Constructor & Destructor Documentation

org.bukkit.material.Sign.Sign ( final int  type)
Deprecated:
Magic value

Definition at line 19 of file material/Sign.java.

19  {
20  super(type);
21  }
org.bukkit.material.Sign.Sign ( final int  type,
final byte  data 
)
Deprecated:
Magic value

Definition at line 32 of file material/Sign.java.

32  {
33  super(type, data);
34  }
org.bukkit.material.Sign.Sign ( final Material  type,
final byte  data 
)
Deprecated:
Magic value

Definition at line 41 of file material/Sign.java.

41  {
42  super(type, data);
43  }

Member Function Documentation

BlockFace org.bukkit.material.Sign.getAttachedFace ( )

Gets the face that this block is attached on

Returns
BlockFace attached to

Implements org.bukkit.material.Attachable.

Definition at line 60 of file material/Sign.java.

References org.bukkit.material.MaterialData.getData(), and org.bukkit.material.Sign.isWallSign().

Referenced by org.bukkit.material.Sign.getFacing().

60  {
61  if (isWallSign()) {
62  byte data = getData();
63 
64  switch (data) {
65  case 0x2:
66  return BlockFace.SOUTH;
67 
68  case 0x3:
69  return BlockFace.NORTH;
70 
71  case 0x4:
72  return BlockFace.EAST;
73 
74  case 0x5:
75  return BlockFace.WEST;
76  }
77 
78  return null;
79  } else {
80  return BlockFace.DOWN;
81  }
82  }
BlockFace org.bukkit.material.Sign.getFacing ( )

Gets the direction that this sign is currently facing

Returns
BlockFace indicating where this sign is facing

Implements org.bukkit.material.Directional.

Definition at line 89 of file material/Sign.java.

References org.bukkit.material.Sign.getAttachedFace(), org.bukkit.material.MaterialData.getData(), and org.bukkit.material.Sign.isWallSign().

89  {
90  byte data = getData();
91 
92  if (!isWallSign()) {
93  switch (data) {
94  case 0x0:
95  return BlockFace.SOUTH;
96 
97  case 0x1:
98  return BlockFace.SOUTH_SOUTH_WEST;
99 
100  case 0x2:
101  return BlockFace.SOUTH_WEST;
102 
103  case 0x3:
104  return BlockFace.WEST_SOUTH_WEST;
105 
106  case 0x4:
107  return BlockFace.WEST;
108 
109  case 0x5:
110  return BlockFace.WEST_NORTH_WEST;
111 
112  case 0x6:
113  return BlockFace.NORTH_WEST;
114 
115  case 0x7:
116  return BlockFace.NORTH_NORTH_WEST;
117 
118  case 0x8:
119  return BlockFace.NORTH;
120 
121  case 0x9:
122  return BlockFace.NORTH_NORTH_EAST;
123 
124  case 0xA:
125  return BlockFace.NORTH_EAST;
126 
127  case 0xB:
128  return BlockFace.EAST_NORTH_EAST;
129 
130  case 0xC:
131  return BlockFace.EAST;
132 
133  case 0xD:
134  return BlockFace.EAST_SOUTH_EAST;
135 
136  case 0xE:
137  return BlockFace.SOUTH_EAST;
138 
139  case 0xF:
140  return BlockFace.SOUTH_SOUTH_EAST;
141  }
142 
143  return null;
144  } else {
145  return getAttachedFace().getOppositeFace();
146  }
147  }
boolean org.bukkit.material.Sign.isWallSign ( )

Check if this sign is attached to a wall

Returns
true if this sign is attached to a wall, false if set on top of a block

Definition at line 51 of file material/Sign.java.

References org.bukkit.material.MaterialData.getItemType().

Referenced by org.bukkit.material.Sign.getAttachedFace(), org.bukkit.material.Sign.getFacing(), and org.bukkit.material.Sign.setFacingDirection().

51  {
52  return getItemType() == Material.WALL_SIGN;
53  }
void org.bukkit.material.Sign.setFacingDirection ( BlockFace  face)

Sets the direction that this block is facing in

Parameters
faceThe facing direction

Implements org.bukkit.material.Directional.

Definition at line 149 of file material/Sign.java.

References org.bukkit.material.Sign.isWallSign(), and org.bukkit.material.MaterialData.setData().

149  {
150  byte data;
151 
152  if (isWallSign()) {
153  switch (face) {
154  case NORTH:
155  data = 0x2;
156  break;
157 
158  case SOUTH:
159  data = 0x3;
160  break;
161 
162  case WEST:
163  data = 0x4;
164  break;
165 
166  case EAST:
167  default:
168  data = 0x5;
169  }
170  } else {
171  switch (face) {
172  case SOUTH:
173  data = 0x0;
174  break;
175 
176  case SOUTH_SOUTH_WEST:
177  data = 0x1;
178  break;
179 
180  case SOUTH_WEST:
181  data = 0x2;
182  break;
183 
184  case WEST_SOUTH_WEST:
185  data = 0x3;
186  break;
187 
188  case WEST:
189  data = 0x4;
190  break;
191 
192  case WEST_NORTH_WEST:
193  data = 0x5;
194  break;
195 
196  case NORTH_WEST:
197  data = 0x6;
198  break;
199 
200  case NORTH_NORTH_WEST:
201  data = 0x7;
202  break;
203 
204  case NORTH:
205  data = 0x8;
206  break;
207 
208  case NORTH_NORTH_EAST:
209  data = 0x9;
210  break;
211 
212  case NORTH_EAST:
213  data = 0xA;
214  break;
215 
216  case EAST_NORTH_EAST:
217  data = 0xB;
218  break;
219 
220  case EAST:
221  data = 0xC;
222  break;
223 
224  case EAST_SOUTH_EAST:
225  data = 0xD;
226  break;
227 
228  case SOUTH_SOUTH_EAST:
229  data = 0xF;
230  break;
231 
232  case SOUTH_EAST:
233  default:
234  data = 0xE;
235  }
236  }
237 
238  setData(data);
239  }

The documentation for this class was generated from the following file: