本文整理汇总了Java中org.bukkit.event.inventory.CraftItemEvent.getRecipe方法的典型用法代码示例。如果您正苦于以下问题:Java CraftItemEvent.getRecipe方法的具体用法?Java CraftItemEvent.getRecipe怎么用?Java CraftItemEvent.getRecipe使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.bukkit.event.inventory.CraftItemEvent
的用法示例。
在下文中一共展示了CraftItemEvent.getRecipe方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onCraft
import org.bukkit.event.inventory.CraftItemEvent; //导入方法依赖的package包/类
@EventHandler
public void onCraft(CraftItemEvent e)
{
Player p = (Player) e.getWhoClicked();
if(e.getRecipe() instanceof ShapedRecipe)
{
ShapedRecipe sr = (ShapedRecipe) e.getRecipe();
if(Bukkit.getBukkitVersion().contains("1.11"))
{
for(BagBase bb : Util.getBags())
{
if(((ShapedRecipe)bb.getRecipe()).getShape().equals(sr.getShape()))
{
if(!hasPermission(new Permission("bag.craft." + bb.getName(), PermissionDefault.TRUE), p))
e.setCancelled(true);
}
}
}
else
if(sr.getKey().getNamespace().startsWith("bag_"))
{
if(!hasPermission(new Permission("bag.craft." + sr.getKey().getKey(), PermissionDefault.TRUE), p))
e.setCancelled(true);
}
}
}
示例2: stopVanillaCraft
import org.bukkit.event.inventory.CraftItemEvent; //导入方法依赖的package包/类
@EventHandler
public void stopVanillaCraft(CraftItemEvent e) {
if (!(e.getWhoClicked() instanceof Player)) return;
Player p = (Player) e.getWhoClicked();
if (!RUtils.isInInfectedWorld(p)) return;
Recipe rr = e.getRecipe();
ItemStack result = rr.getResult();
if (rr instanceof ShapedRecipe) {
ShapedRecipe srr = (ShapedRecipe) rr;
if (result.getType() == Material.BOW && !shapedRecipesMatch(srr, plugin.bowRecipe)) e.setCancelled(true);
if (Config.harderTorches && result.getType() == Material.TORCH && !srr.getIngredientMap().values().equals(plugin.torchRecipe.getIngredientList()))
e.setCancelled(true);
if (result.getType() == Material.ARROW && !srr.getIngredientMap().values().containsAll(plugin.arrowRecipe.getIngredientList()))
e.setCancelled(true);
}
if (e.isCancelled()) e.setResult(Event.Result.DENY);
}
示例3: onCraft
import org.bukkit.event.inventory.CraftItemEvent; //导入方法依赖的package包/类
@EventHandler
public void onCraft(CraftItemEvent e) {
Player player = (Player) e.getWhoClicked();
if (e.getRecipe() instanceof ShapedRecipe) {
ShapedRecipe recipe = (ShapedRecipe) e.getRecipe();
if (PlayerMeta.getMeta(player).getKit() != Kit.ARCHER) {
if (sameRecipe(recipe, arrowRecipe)) {
e.setCancelled(true);
}
}
}
}
示例4: onCraftItem
import org.bukkit.event.inventory.CraftItemEvent; //导入方法依赖的package包/类
@EventHandler
public void onCraftItem(CraftItemEvent event) {
SpleefPlayer player = getHeavySpleef().getSpleefPlayer(event.getWhoClicked());
if (!game.isIngame(player)) {
return;
}
Recipe recipe = event.getRecipe();
Material result = recipe.getResult().getType();
if (result == Material.SNOW_BLOCK) {
event.setCancelled(true);
}
}
示例5: onRefillBattery
import org.bukkit.event.inventory.CraftItemEvent; //导入方法依赖的package包/类
@EventHandler
public void onRefillBattery(CraftItemEvent e) {
if (!(e.getWhoClicked() instanceof Player)) return;
Player p = (Player) e.getWhoClicked();
if (!(RUtils.isInInfectedWorld(p)) || !(e.getRecipe() instanceof ShapelessRecipe)) return;
ShapelessRecipe slr = (ShapelessRecipe) e.getRecipe();
if (!shapelessRecipesMatch(slr, plugin.batteryRefill)) return;
PConfManager.getPConfManager(p).set("radio.battery", 100);
}