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

Public Member Functions

 Gate (int type, byte data)
 
 Gate (byte data)
 
void setFacingDirection (BlockFace face)
 
BlockFace getFacing ()
 
boolean isOpen ()
 
void setOpen (boolean isOpen)
 
String toString ()
 
Gate 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

Represents a fence gate

Definition at line 9 of file Gate.java.

Member Function Documentation

BlockFace org.bukkit.material.Gate.getFacing ( )

Gets the direction this block is facing

Returns
the direction this block is facing

Implements org.bukkit.material.Directional.

Definition at line 51 of file Gate.java.

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

51  {
52  switch (getData() & DIR_BIT) {
53  case GATE_SOUTH:
54  return BlockFace.EAST;
55  case GATE_WEST:
56  return BlockFace.SOUTH;
57  case GATE_NORTH:
58  return BlockFace.WEST;
59  case GATE_EAST:
60  return BlockFace.NORTH;
61  }
62 
63  return BlockFace.EAST;
64  }
boolean org.bukkit.material.Gate.isOpen ( )

Check to see if the door is open.

Returns
true if the door has swung counterclockwise around its hinge.

Implements org.bukkit.material.Openable.

Definition at line 66 of file Gate.java.

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

66  {
67  return (getData() & OPEN_BIT) > 0;
68  }
void org.bukkit.material.Gate.setFacingDirection ( BlockFace  face)

Sets the direction that this block is facing in

Parameters
faceThe facing direction

Implements org.bukkit.material.Directional.

Definition at line 29 of file Gate.java.

References org.bukkit.material.MaterialData.getData(), and org.bukkit.material.MaterialData.setData().

29  {
30  byte data = (byte) (getData() &~ DIR_BIT);
31 
32  switch (face) {
33  default:
34  case EAST:
35  data |= GATE_SOUTH;
36  break;
37  case SOUTH:
38  data |= GATE_WEST;
39  break;
40  case WEST:
41  data |= GATE_NORTH;
42  break;
43  case NORTH:
44  data |= GATE_EAST;
45  break;
46  }
47 
48  setData(data);
49  }
void org.bukkit.material.Gate.setOpen ( boolean  isOpen)

Configure this door to be either open or closed;

Parameters
isOpenTrue to open the door.

Implements org.bukkit.material.Openable.

Definition at line 70 of file Gate.java.

References org.bukkit.material.MaterialData.getData(), and org.bukkit.material.MaterialData.setData().

70  {
71  byte data = getData();
72 
73  if (isOpen) {
74  data |= OPEN_BIT;
75  } else {
76  data &= ~OPEN_BIT;
77  }
78 
79  setData(data);
80  }

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