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

Public Member Functions

 TripwireHook (final int type)
 
 TripwireHook (final int type, final byte data)
 
 TripwireHook (BlockFace dir)
 
boolean isConnected ()
 
void setConnected (boolean connected)
 
boolean isActivated ()
 
void setActivated (boolean act)
 
void setFacingDirection (BlockFace face)
 
BlockFace getAttachedFace ()
 
boolean isPowered ()
 
TripwireHook clone ()
 
String toString ()
 
- 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 the tripwire hook

Definition at line 9 of file TripwireHook.java.

Constructor & Destructor Documentation

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

Definition at line 20 of file TripwireHook.java.

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

Definition at line 29 of file TripwireHook.java.

29  {
30  super(type, data);
31  }

Member Function Documentation

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

Gets the face that this block is attached on

Returns
BlockFace attached to

Implements org.bukkit.material.Attachable.

Definition at line 101 of file TripwireHook.java.

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

101  {
102  switch (getData() & 0x3) {
103  case 0:
104  return BlockFace.NORTH;
105  case 1:
106  return BlockFace.EAST;
107  case 2:
108  return BlockFace.SOUTH;
109  case 3:
110  return BlockFace.WEST;
111  }
112  return null;
113  }
boolean org.bukkit.material.TripwireHook.isActivated ( )

Test if hook is currently activated

Returns
true if activated, false if not

Definition at line 65 of file TripwireHook.java.

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

Referenced by org.bukkit.material.TripwireHook.isPowered().

65  {
66  return (getData() & 0x8) != 0;
67  }
boolean org.bukkit.material.TripwireHook.isConnected ( )

Test if tripwire is connected

Returns
true if connected, false if not

Definition at line 43 of file TripwireHook.java.

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

43  {
44  return (getData() & 0x4) != 0;
45  }
boolean org.bukkit.material.TripwireHook.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 115 of file TripwireHook.java.

References org.bukkit.material.TripwireHook.isActivated().

115  {
116  return isActivated();
117  }
void org.bukkit.material.TripwireHook.setActivated ( boolean  act)

Set hook activated state

Parameters
act- true if activated, false if not

Definition at line 74 of file TripwireHook.java.

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

74  {
75  int dat = getData() & (0x4 | 0x3);
76  if (act) {
77  dat |= 0x8;
78  }
79  setData((byte) dat);
80  }
void org.bukkit.material.TripwireHook.setConnected ( boolean  connected)

Set tripwire connection state

Parameters
connected- true if connected, false if not

Definition at line 52 of file TripwireHook.java.

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

52  {
53  int dat = getData() & (0x8 | 0x3);
54  if (connected) {
55  dat |= 0x4;
56  }
57  setData((byte) dat);
58  }
void org.bukkit.material.TripwireHook.setFacingDirection ( BlockFace  face)

Sets the direction that this block is facing in

Parameters
faceThe facing direction

Implements org.bukkit.material.Directional.

Definition at line 82 of file TripwireHook.java.

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

82  {
83  int dat = getData() & 0xC;
84  switch (face) {
85  case WEST:
86  dat |= 0x1;
87  break;
88  case NORTH:
89  dat |= 0x2;
90  break;
91  case EAST:
92  dat |= 0x3;
93  break;
94  case SOUTH:
95  default:
96  break;
97  }
98  setData((byte) dat);
99  }

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