本文整理汇总了Java中org.bukkit.inventory.BrewerInventory.setItem方法的典型用法代码示例。如果您正苦于以下问题:Java BrewerInventory.setItem方法的具体用法?Java BrewerInventory.setItem怎么用?Java BrewerInventory.setItem使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.bukkit.inventory.BrewerInventory
的用法示例。
在下文中一共展示了BrewerInventory.setItem方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onBrewComplete
import org.bukkit.inventory.BrewerInventory; //导入方法依赖的package包/类
/**
* This event makes sure that any acid bottles become potions without the
* warning
*
* @param e
*/
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void onBrewComplete(final BrewEvent e) {
if (DEBUG)
plugin.getLogger().info("DEBUG: " + e.getEventName());
if (e.getBlock().getWorld().getName().equalsIgnoreCase(Settings.worldName)) {
//if (Settings.acidBottle && Settings.acidDamage>0 && e.getBlock().getWorld().getName().equalsIgnoreCase(Settings.worldName)) {
plugin.getLogger().info("DEBUG: Brew Event called");
BrewerInventory inv = e.getContents();
int i = 0;
for (ItemStack item : inv.getContents()) {
if (item != null) {
// Remove lore
ItemMeta meta = item.getItemMeta();
plugin.getLogger().info("DEBUG: " + meta.getDisplayName());
meta.setDisplayName(null);
inv.setItem(i, item);
}
i++;
}
}
}
示例2: fillWaterBottle
import org.bukkit.inventory.BrewerInventory; //导入方法依赖的package包/类
private boolean fillWaterBottle(BrewerInventory brewingInventory, InventoryManager manager) {
if (!(manager.findMaterial(Material.WATER_BUCKET) && manager.findMaterial(Material.GLASS_BOTTLE)))
return false;
for (int i = 0; i < 3; i++) {
ItemStack item = brewingInventory.getItem(i);
if (item == null || item.getType() == Material.AIR) {
// Add potion to the first empty potion slot in the brewing
// stand.
item = new ItemStack(Material.POTION);
brewingInventory.setItem(i, item);
manager.decrement();
age = 0;
return true;
}
}
return false;
}