mirror of
https://github.com/PaperMC/Paper.git
synced 2026-11-24 18:09:41 -05:00
DyeColor used the wool data for getData(), which is very misleading based on class name. The old method has been deprecated and replaced with getWoolData() and getDyeData() for the appropriate types of data values. The MaterialData classes Dye and Wool were updated appropriately, especially Dye innapropriately using a DyeColor data value compensation. Unit tests were added for the new methods, as well as the getColor on Dye and Wool. By: Wesley Wolfe <weswolf@aol.com>
58 lines
1.1 KiB
Java
58 lines
1.1 KiB
Java
package org.bukkit.material;
|
|
|
|
import org.bukkit.DyeColor;
|
|
import org.bukkit.Material;
|
|
|
|
/**
|
|
* Represents dye
|
|
*/
|
|
public class Dye extends MaterialData implements Colorable {
|
|
public Dye() {
|
|
super(Material.INK_SACK);
|
|
}
|
|
|
|
public Dye(final int type) {
|
|
super(type);
|
|
}
|
|
|
|
public Dye(final Material type) {
|
|
super(type);
|
|
}
|
|
|
|
public Dye(final int type, final byte data) {
|
|
super(type, data);
|
|
}
|
|
|
|
public Dye(final Material type, final byte data) {
|
|
super(type, data);
|
|
}
|
|
|
|
/**
|
|
* Gets the current color of this dye
|
|
*
|
|
* @return DyeColor of this dye
|
|
*/
|
|
public DyeColor getColor() {
|
|
return DyeColor.getByDyeData(getData());
|
|
}
|
|
|
|
/**
|
|
* Sets the color of this dye
|
|
*
|
|
* @param color New color of this dye
|
|
*/
|
|
public void setColor(DyeColor color) {
|
|
setData(color.getDyeData());
|
|
}
|
|
|
|
@Override
|
|
public String toString() {
|
|
return getColor() + " DYE(" + getData() + ")";
|
|
}
|
|
|
|
@Override
|
|
public Dye clone() {
|
|
return (Dye) super.clone();
|
|
}
|
|
}
|