org.bukkit.material.Dye Java Examples

The following examples show how to use org.bukkit.material.Dye. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: BukkitPlayer.java    From FastAsyncWorldedit with GNU General Public License v3.0 5 votes vote down vote up
@Override
public BaseBlock getBlockInHand() throws WorldEditException {
    ItemStack itemStack = player.getItemInHand();
    if (itemStack == null) {
        return EditSession.nullBlock;
    }
    final int typeId = itemStack.getTypeId();
    switch (typeId) {
        case 0:
            return EditSession.nullBlock;
        case ItemID.INK_SACK:
            final Dye materialData = (Dye) itemStack.getData();
            if (materialData.getColor() == DyeColor.BROWN) {
                return FaweCache.getBlock(BlockID.COCOA_PLANT, 0);
            }
            break;
        case ItemID.HEAD:
            return new SkullBlock(0, (byte) itemStack.getDurability());

        default:
            final BaseBlock baseBlock = BlockType.getBlockForItem(typeId, itemStack.getDurability());
            if (baseBlock != null) {
                return baseBlock;
            }
            break;
    }
    BaseBlock block = FaweCache.getBlock(typeId, itemStack.getType().getMaxDurability() != 0 ? 0 : Math.max(0, itemStack.getDurability()));
    if (Settings.IMP.EXPERIMENTAL.PERSISTENT_BRUSHES && Fawe.<FaweBukkit>imp().getItemUtil() != null) {
        return new BrushBoundBaseBlock(this, WorldEdit.getInstance().getSession(this), itemStack);
    }
    return block;
}
 
Example #2
Source File: CutCleanListener.java    From UhcCore with GNU General Public License v3.0 4 votes vote down vote up
public CutCleanListener(){
    Dye d = new Dye();
    d.setColor(DyeColor.BLUE);
    this.lapis = d.toItemStack();
    this.lapis.setAmount(64);
}