Bukkit
1.4.7-R1.0
Main Page
Related Pages
Classes
Files
File List
All
Classes
Namespaces
Files
Functions
Variables
Enumerator
Pages
Button.java
Go to the documentation of this file.
1
package
org.bukkit.material;
2
3
import
org.bukkit.block.BlockFace;
4
import
org.bukkit.Material;
5
9
public
class
Button
extends
SimpleAttachableMaterialData
implements
Redstone
{
10
public
Button
() {
11
super(
Material
.
STONE_BUTTON
);
12
}
13
14
public
Button
(
final
int
type) {
15
super(type);
16
}
17
18
public
Button
(
final
Material
type) {
19
super(type);
20
}
21
22
public
Button
(
final
int
type,
final
byte data) {
23
super(type, data);
24
}
25
26
public
Button
(
final
Material
type,
final
byte data) {
27
super(type, data);
28
}
29
36
public
boolean
isPowered
() {
37
return
(
getData
() & 0x8) == 0x8;
38
}
39
46
public
void
setPowered
(
boolean
bool
) {
47
setData
((byte) (
bool
? (
getData
() | 0x8) : (
getData
() & ~0x8)));
48
}
49
55
public
BlockFace
getAttachedFace
() {
56
byte data = (byte) (
getData
() & 0x7);
57
58
switch
(data) {
59
case
0x1:
60
return
BlockFace
.
WEST
;
61
62
case
0x2:
63
return
BlockFace
.
EAST
;
64
65
case
0x3:
66
return
BlockFace
.
NORTH
;
67
68
case
0x4:
69
return
BlockFace
.
SOUTH
;
70
}
71
72
return
null;
73
}
74
78
public
void
setFacingDirection
(
BlockFace
face) {
79
byte data = (byte) (
getData
() & 0x8);
80
81
switch
(face) {
82
case
EAST:
83
data |= 0x1;
84
break
;
85
86
case
WEST:
87
data |= 0x2;
88
break
;
89
90
case
SOUTH:
91
data |= 0x3;
92
break
;
93
94
case
NORTH:
95
data |= 0x4;
96
break
;
97
}
98
99
setData
(data);
100
}
101
102
@Override
103
public
String
toString
() {
104
return
super.toString() +
" "
+ (
isPowered
() ?
""
:
"NOT "
) +
"POWERED"
;
105
}
106
107
@Override
108
public
Button
clone
() {
109
return
(
Button
) super.
clone
();
110
}
111
}
org
bukkit
material
Button.java
Generated on Sat May 25 2013 10:16:34 for Bukkit by
1.8.2