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

Public Member Functions

 Button (final int type)
 
 Button (final Material type)
 
 Button (final int type, final byte data)
 
 Button (final Material type, final byte data)
 
boolean isPowered ()
 
void setPowered (boolean bool)
 
BlockFace getAttachedFace ()
 
void setFacingDirection (BlockFace face)
 
String toString ()
 
Button clone ()
 
- Public Member Functions inherited from org.bukkit.material.SimpleAttachableMaterialData
 SimpleAttachableMaterialData (int type)
 
 SimpleAttachableMaterialData (int type, BlockFace direction)
 
 SimpleAttachableMaterialData (Material type, BlockFace direction)
 
 SimpleAttachableMaterialData (Material type)
 
 SimpleAttachableMaterialData (int type, byte data)
 
 SimpleAttachableMaterialData (Material type, byte data)
 
BlockFace getFacing ()
 
String toString ()
 
SimpleAttachableMaterialData 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 button

Definition at line 9 of file Button.java.

Constructor & Destructor Documentation

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

Definition at line 19 of file Button.java.

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

Definition at line 32 of file Button.java.

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

Definition at line 41 of file Button.java.

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

Member Function Documentation

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

Gets the face that this block is attached on

Returns
BlockFace attached to

Implements org.bukkit.material.Attachable.

Definition at line 70 of file Button.java.

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

70  {
71  byte data = (byte) (getData() & 0x7);
72 
73  switch (data) {
74  case 0x1:
75  return BlockFace.WEST;
76 
77  case 0x2:
78  return BlockFace.EAST;
79 
80  case 0x3:
81  return BlockFace.NORTH;
82 
83  case 0x4:
84  return BlockFace.SOUTH;
85  }
86 
87  return null;
88  }
boolean org.bukkit.material.Button.isPowered ( )

Gets the current state of this Material, indicating if it's powered or unpowered

Returns
true if powered, otherwise false

Implements org.bukkit.material.Redstone.

Definition at line 51 of file Button.java.

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

51  {
52  return (getData() & 0x8) == 0x8;
53  }
void org.bukkit.material.Button.setFacingDirection ( BlockFace  face)

Sets the direction this button is pointing toward

Implements org.bukkit.material.Directional.

Definition at line 93 of file Button.java.

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

93  {
94  byte data = (byte) (getData() & 0x8);
95 
96  switch (face) {
97  case EAST:
98  data |= 0x1;
99  break;
100 
101  case WEST:
102  data |= 0x2;
103  break;
104 
105  case SOUTH:
106  data |= 0x3;
107  break;
108 
109  case NORTH:
110  data |= 0x4;
111  break;
112  }
113 
114  setData(data);
115  }
void org.bukkit.material.Button.setPowered ( boolean  bool)

Sets the current state of this button

Parameters
boolwhether or not the button is powered

Definition at line 61 of file Button.java.

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

61  {
62  setData((byte) (bool ? (getData() | 0x8) : (getData() & ~0x8)));
63  }

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