Java Code Examples for org.bukkit.event.inventory.PrepareItemCraftEvent#getRecipe()
The following examples show how to use
org.bukkit.event.inventory.PrepareItemCraftEvent#getRecipe() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: RegionInteractListener.java From NovaGuilds with GNU General Public License v3.0 | 6 votes |
@EventHandler public void onPrepareItemCraft(PrepareItemCraftEvent event) { if(event.getViewers().isEmpty()) { return; } NovaPlayer nPlayer = PlayerManager.getPlayer(event.getViewers().get(0)); if(event.getRecipe() == null || event.getRecipe().getResult() == null || event.getRecipe().getResult().getType() != Material.SHIELD || !nPlayer.hasGuild() || nPlayer.getGuild().getBannerMeta().numberOfPatterns() == 0) { return; } for(ItemStack ingredient : event.getInventory().getContents()) { if(ingredient != null && ingredient.getType() == Material.SHIELD && ingredient.hasItemMeta()) { return; } } event.getInventory().setResult(BannerUtils.applyMeta(event.getRecipe().getResult(), nPlayer.getGuild().getBannerMeta())); }
Example 2
Source File: Recipes.java From ProRecipes with GNU General Public License v2.0 | 5 votes |
@EventHandler(priority = EventPriority.MONITOR) public void onCraftBlacklisted(PrepareItemCraftEvent event){ if(event.getRecipe() == null)return; String key = ItemUtils.getRecipeKey(event.getRecipe(), false); String key2 = ItemUtils.getRecipeKey(event.getRecipe(), true); if(ProRecipes.getPlugin().blacklisted.contains(key) || ProRecipes.getPlugin().blacklisted.contains(key2)){ event.getInventory().setItem(0, null); event.getInventory().setResult(new ItemStack(Material.AIR)); return; } }
Example 3
Source File: GoldenCarrotRecipeModule.java From UHC with MIT License | 5 votes |
@EventHandler public void on(PrepareItemCraftEvent event) { final Recipe recipe = event.getRecipe(); if (recipe.getResult().getType() != Material.GOLDEN_CARROT) return; if (RecipeUtil.hasRecipeGotMaterial(recipe, isEnabled() ? Material.GOLD_NUGGET : Material.GOLD_INGOT)) { event.getInventory().setResult(new ItemStack(Material.AIR)); } }
Example 4
Source File: GlisteringMelonRecipeModule.java From UHC with MIT License | 5 votes |
@EventHandler public void on(PrepareItemCraftEvent event) { final Recipe recipe = event.getRecipe(); if (recipe.getResult().getType() != Material.SPECKLED_MELON) return; if (RecipeUtil.hasRecipeGotMaterial(recipe, isEnabled() ? Material.GOLD_NUGGET : Material.GOLD_BLOCK)) { event.getInventory().setResult(new ItemStack(Material.AIR)); } }