Fork of Poseidon providing Bukkit #1060 to older Beta versions (b1.0-b1.7.3)
1package org.bukkit.material;
2
3import org.bukkit.DyeColor;
4import org.bukkit.Material;
5
6/**
7 * Represents dye
8 */
9public class Dye extends MaterialData implements Colorable {
10 public Dye() {
11 super(Material.INK_SACK);
12 }
13
14 public Dye(final int type) {
15 super(type);
16 }
17
18 public Dye(final Material type) {
19 super(type);
20 }
21
22 public Dye(final int type, final byte data) {
23 super(type, data);
24 }
25
26 public Dye(final Material type, final byte data) {
27 super(type, data);
28 }
29
30 /**
31 * Gets the current color of this dye
32 *
33 * @return DyeColor of this dye
34 */
35 public DyeColor getColor() {
36 return DyeColor.getByData((byte) (15 - getData()));
37 }
38
39 /**
40 * Sets the color of this dye
41 *
42 * @param color New color of this dye
43 */
44 public void setColor(DyeColor color) {
45 setData((byte) (15 - color.getData()));
46 }
47
48 @Override
49 public String toString() {
50 return getColor() + " DYE(" + getData() + ")";
51 }
52}