下面列出了怎么用org.bukkit.material.Dye的API类实例代码及写法,或者点击链接到github查看源代码。
@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;
}
public CutCleanListener(){
Dye d = new Dye();
d.setColor(DyeColor.BLUE);
this.lapis = d.toItemStack();
this.lapis.setAmount(64);
}