Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @EventHandler
- public void blockBreakingSnowBlock(BlockBreakEvent event)
- {
- Player p = event.getPlayer();
- if(p.getGameMode() == GameMode.CREATIVE)
- return;
- int id = p.getItemInHand().getTypeId();
- if((id == 273 || id == 278 || id == 256 || id == 284 || id == 277) && event.getBlock().getType() == Material.SNOW_BLOCK)
- if(p.hasPermission("machidrop.use.snow"))
- {
- ItemStack hand = p.getItemInHand();
- hand.setDurability((short)(p.getItemInHand().getDurability() + 2));
- p.setItemInHand(hand.getDurability() <= hand.getType().getMaxDurability() ? hand : null);
- event.getBlock().getWorld().dropItemNaturally(event.getBlock().getLocation(), new ItemStack(Material.SNOW_BLOCK, 1));
- event.getBlock().setType(Material.AIR);
- } else
- {
- p.sendMessage((new StringBuilder()).append(ChatColor.RED).append("[MachiDrop] You don't have permission to use this tool").toString());
- }
- }
Add Comment
Please, Sign In to add comment