Guest User

Untitled

a guest
Nov 16th, 2018
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.07 KB | None | 0 0
  1. @EventHandler
  2. public void blockBreakingSnowBlock(BlockBreakEvent event)
  3. {
  4. Player p = event.getPlayer();
  5. if(p.getGameMode() == GameMode.CREATIVE)
  6. return;
  7. int id = p.getItemInHand().getTypeId();
  8. if((id == 273 || id == 278 || id == 256 || id == 284 || id == 277) && event.getBlock().getType() == Material.SNOW_BLOCK)
  9. if(p.hasPermission("machidrop.use.snow"))
  10. {
  11. ItemStack hand = p.getItemInHand();
  12. hand.setDurability((short)(p.getItemInHand().getDurability() + 2));
  13. p.setItemInHand(hand.getDurability() <= hand.getType().getMaxDurability() ? hand : null);
  14. event.getBlock().getWorld().dropItemNaturally(event.getBlock().getLocation(), new ItemStack(Material.SNOW_BLOCK, 1));
  15. event.getBlock().setType(Material.AIR);
  16. } else
  17. {
  18. p.sendMessage((new StringBuilder()).append(ChatColor.RED).append("[MachiDrop] You don't have permission to use this tool").toString());
  19. }
  20. }
Add Comment
Please, Sign In to add comment