本文整理汇总了Java中org.bukkit.Material.COBBLESTONE属性的典型用法代码示例。如果您正苦于以下问题:Java Material.COBBLESTONE属性的具体用法?Java Material.COBBLESTONE怎么用?Java Material.COBBLESTONE使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.bukkit.Material
的用法示例。
在下文中一共展示了Material.COBBLESTONE属性的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addItem_FullInventoryAddsOneStack_NothingAdded
@Test
public void addItem_FullInventoryAddsOneStack_NothingAdded()
{
ItemStack filler = new ItemStack(Material.COBBLESTONE, 1);
for (int i = 0; i < inventory.getSize(); i++)
{
inventory.setItem(i, filler);
}
ItemStack stack = new ItemStack(Material.DIRT, 64);
ItemStack remaining = inventory.addItem(stack);
assertEquals(64, remaining.getAmount());
for (ItemStack stored : inventory.getContents())
{
assertEquals(1, stored.getAmount());
assertEquals(Material.COBBLESTONE, stored.getType());
}
}
示例2: addItem_PartiallyFilled_AddsOneStack_HalfAdded
@Test
public void addItem_PartiallyFilled_AddsOneStack_HalfAdded()
{
ItemStack filler = new ItemStack(Material.COBBLESTONE, 1);
for (int i = 2; i < inventory.getSize(); i++)
{
inventory.setItem(i, filler);
}
ItemStack preset = new ItemStack(Material.DIRT, 48);
inventory.setItem(0, preset);
inventory.setItem(2, preset);
preset.setAmount(64);
inventory.setItem(1, preset);
ItemStack store = new ItemStack(Material.DIRT, 64);
ItemStack remaining = inventory.addItem(store);
assertNotNull(remaining);
assertEquals(32, remaining.getAmount());
}
示例3: addItem_MultipleItems_ItemsAddedCorrectly
@Test
public void addItem_MultipleItems_ItemsAddedCorrectly()
{
ItemStack filler = new ItemStack(Material.COBBLESTONE, 1);
for (int i = 1; i < inventory.getSize(); i++)
{
inventory.setItem(i, filler);
}
ItemStack preset = new ItemStack(Material.DIRT, 48);
inventory.setItem(0, preset);
ItemStack item1 = new ItemStack(Material.COBBLESTONE, 64);
ItemStack item2 = new ItemStack(Material.DIRT, 64);
HashMap<Integer, ItemStack> map = inventory.addItem(item1, item2);
assertEquals(1, map.size());
assertTrue(map.containsKey(1));
assertEquals(48, map.get(1).getAmount());
}
示例4: setContents_OneItem_SetAndRestCleared
@Test
public void setContents_OneItem_SetAndRestCleared()
{
ItemStack filler = new ItemStack(Material.COBBLESTONE, 1);
for (int i = 1; i < inventory.getSize(); i++)
{
inventory.setItem(i, filler);
}
ItemStack item = new ItemStack(Material.DIRT, 32);
inventory.setContents(new ItemStack[] { item });
assertTrue(item.isSimilar(inventory.getItem(0)));
for (int i = 1; i < inventory.getSize(); i++)
{
assertNull(inventory.getItem(i));
}
}
示例5: onItemSpawn
/**
* Delete different type of certains blocks
*
* @param event Event
*/
@EventHandler
public void onItemSpawn(ItemSpawnEvent event)
{
if (event.getEntityType() != EntityType.DROPPED_ITEM)
return;
if (event.getEntity().hasMetadata("playerDrop"))
return;
Material material = event.getEntity().getItemStack().getType();
if (material == Material.LOG || material == Material.LOG_2)
event.getEntity().setItemStack(new ItemStack(Material.LOG, event.getEntity().getItemStack().getAmount()));
else if (material == Material.COBBLESTONE)
event.getEntity().setItemStack(new ItemStack(Material.COBBLESTONE, event.getEntity().getItemStack().getAmount()));
else if (material == Material.STONE)
event.getEntity().setItemStack(new ItemStack(Material.COBBLESTONE, event.getEntity().getItemStack().getAmount()));
}
示例6: onPlayerPickup
@EventHandler
public void onPlayerPickup(PlayerPickupItemEvent event){
Material type = event.getItem().getItemStack().getType();
if(type == Material.STONE || type == Material.COBBLESTONE){
if(disabled.contains(event.getPlayer())){
event.setCancelled(true);
}
}
}