@EventHandler public void onCraft(CraftItemEvent e) { ShapedRecipe packedice = YOURRECIPE; if(e.getInventory().getSize() == 10 && e.getInventory().getResult().equals(packedice.getResult())) { if(e.getRawSlot() == 0) { ItemStack upleft = e.getInventory().getItem(1); if(upleft != null && upleft.hasItemMeta() && upleft.getItemMeta().hasLore()) { List<String> l = upleft.getItemMeta().getLore(); if(!l.get(0).equals("Line 1")) { e.setCancelled(true); } } } } }
/** * Prevents crafting of EnderChest unless the player has permission * * @param e - event */ @EventHandler(priority = EventPriority.LOW, ignoreCancelled = true) public void onCraft(CraftItemEvent e) { e.setCancelled(checkEnderChest((Player)e.getWhoClicked(), e.getRecipe().getResult().getType())); }
if(!neededLore.equals(item.getItemMeta().getLore())) event.setCancelled(true); return;
@EventHandler public void onCraft(CraftItemEvent e) { for (ItemStack item: e.getInventory().getContents()) { if (SlimefunItem.getByItem(item) != null && !(SlimefunItem.getByItem(item).isReplacing())) { e.setCancelled(true); Messages.local.sendTranslation((Player) e.getWhoClicked(), "workbench.not-enhanced", true); break; } } }
@EventHandler public void onCraft(CraftItemEvent cie) { Player player = (Player) cie.getWhoClicked(); Game game = BedwarsRel.getInstance().getGameManager().getGameOfPlayer(player); if (game == null) { return; } if (game.getState() == GameState.STOPPED) { return; } if (BedwarsRel.getInstance().getBooleanConfig("allow-crafting", false)) { return; } cie.setCancelled(true); }
@EventHandler public void onCraft(CraftItemEvent cie) { Player player = (Player) cie.getWhoClicked(); Game game = BedwarsRel.getInstance().getGameManager().getGameOfPlayer(player); if (game == null) { return; } if (game.getState() == GameState.STOPPED) { return; } if (BedwarsRel.getInstance().getBooleanConfig("allow-crafting", false)) { return; } cie.setCancelled(true); }
@EventHandler public void onCraftItem(CraftItemEvent event) { HumanEntity human = event.getWhoClicked(); if (!(human instanceof Player)) return; Player player = (Player)human; Mage mage = controller.getMage(player); // Don't allow crafting in the wand inventory. if (mage.hasStoredInventory()) { event.setCancelled(true); return; } ItemStack currentItem = event.getCurrentItem(); if (Wand.isWand(currentItem)) { CraftWandEvent castEvent = new CraftWandEvent(mage, controller.getWand(currentItem)); Bukkit.getPluginManager().callEvent(castEvent); } }