Files
DeltaZern/paper-api/src/main/java/org/bukkit/material/Command.java
T
Bukkit/Spigot 87f538df31 Fix MaterialData directions being incorrect. Fixes BUKKIT-3160
Prior to 49690f9, BlockFaces were mostly correct in their respective
MaterialData classes. However, a lot of things were not updated since
implementation and broke without being addressed.

This fixes any discrepancies with Block data.

By: feildmaster <admin@feildmaster.com>
2012-12-15 23:25:19 -06:00

59 lines
1.2 KiB
Java

package org.bukkit.material;
import org.bukkit.Material;
/**
* Represents a command block
*/
public class Command extends MaterialData implements Redstone {
public Command() {
super(Material.COMMAND);
}
public Command(final int type) {
super(type);
}
public Command(final Material type) {
super(type);
}
public Command(final int type, final byte data) {
super(type, data);
}
public Command(final Material type, final byte data) {
super(type, data);
}
/**
* Gets the current state of this Material, indicating if it's powered or
* unpowered
*
* @return true if powered, otherwise false
*/
public boolean isPowered() {
return (getData() & 1) != 0;
}
/**
* Sets the current state of this Material
*
* @param bool
* whether or not the command block is powered
*/
public void setPowered(boolean bool) {
setData((byte) (bool ? (getData() | 1) : (getData() & -2)));
}
@Override
public String toString() {
return super.toString() + " " + (isPowered() ? "" : "NOT ") + "POWERED";
}
@Override
public Command clone() {
return (Command) super.clone();
}
}