Bukkit-API  1.7.9-R0.2
The inofficial Bukkit-API
material/Command.java
1 package org.bukkit.material;
2 
3 import org.bukkit.Material;
4 
5 /**
6  * Represents a command block
7  */
8 public class Command extends MaterialData implements Redstone {
9  public Command() {
10  super(Material.COMMAND);
11  }
12 
13  /**
14  *
15  * @deprecated Magic value
16  */
17  @Deprecated
18  public Command(final int type) {
19  super(type);
20  }
21 
22  public Command(final Material type) {
23  super(type);
24  }
25 
26  /**
27  *
28  * @deprecated Magic value
29  */
30  @Deprecated
31  public Command(final int type, final byte data) {
32  super(type, data);
33  }
34 
35  /**
36  *
37  * @deprecated Magic value
38  */
39  @Deprecated
40  public Command(final Material type, final byte data) {
41  super(type, data);
42  }
43 
44  /**
45  * Gets the current state of this Material, indicating if it's powered or
46  * unpowered
47  *
48  * @return true if powered, otherwise false
49  */
50  public boolean isPowered() {
51  return (getData() & 1) != 0;
52  }
53 
54  /**
55  * Sets the current state of this Material
56  *
57  * @param bool
58  * whether or not the command block is powered
59  */
60  public void setPowered(boolean bool) {
61  setData((byte) (bool ? (getData() | 1) : (getData() & -2)));
62  }
63 
64  @Override
65  public String toString() {
66  return super.toString() + " " + (isPowered() ? "" : "NOT ") + "POWERED";
67  }
68 
69  @Override
70  public Command clone() {
71  return (Command) super.clone();
72  }
73 }
Command(final int type, final byte data)
Command(final Material type, final byte data)