Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @EventHandler
- public void onSpawnItem(InventoryCreativeEvent ev) {
- // Ignore NPCs
- if (!(ev.getWhoClicked() instanceof Player)) return;
- ItemStack item = ev.getCursor();
- ItemMeta meta = item.getItemMeta();
- if (meta == null) return;
- Map<Enchantment, Integer> enchants = meta.getEnchants();
- for (Map.Entry<Enchantment, Integer> entry : enchants.entrySet()) {
- if (entry.getValue().intValue() > 5) {
- ev.setCancelled(true);
- Player p = (Player) ev.getWhoClicked();
- p.sendMessage("Nuh-uh-uh! Dirty cheater!");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement