当前位置: 首页>>代码示例>>Java>>正文


Java CraftItemEvent.getRecipe方法代码示例

本文整理汇总了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);
		}
	}
}
 
开发者ID:benfah,项目名称:Bags2,代码行数:27,代码来源:CraftListener.java

示例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);
}
 
开发者ID:RoyalDev,项目名称:RoyalSurvivors,代码行数:18,代码来源:SurvivorsListener.java

示例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);
            }
        }
    }
}
 
开发者ID:cancabron,项目名称:Annihilation,代码行数:13,代码来源:CraftingListener.java

示例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);
    }
}
 
开发者ID:xaniox,项目名称:HeavySpleef,代码行数:15,代码来源:FlagSnowballs.java

示例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);
}
 
开发者ID:RoyalDev,项目名称:RoyalSurvivors,代码行数:10,代码来源:SurvivorsListener.java


注:本文中的org.bukkit.event.inventory.CraftItemEvent.getRecipe方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。