Advertisement
Guest User

Untitled

a guest
Feb 13th, 2016
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.27 KB | None | 0 0
  1. @EventHandler
  2. public void onPlayerPainkillerInteractEvent(PlayerInteractEvent e){
  3. Player p = e.getPlayer();
  4. if (p.getItemInHand() != null);
  5. if (p.getItemInHand().getType() == Material.FIREWORK_CHARGE){
  6. if (e.getAction() == Action.RIGHT_CLICK_AIR || e.getAction() == Action.RIGHT_CLICK_BLOCK){
  7. p.playSound(p.getLocation(), Sound.ZOMBIE_INFECT, 2, 1);
  8. if(p.getItemInHand().getAmount() > 1){
  9. p.setItemInHand(new ItemStack(p.getItemInHand().getType(), p.getItemInHand().getAmount() -1));
  10. } else {
  11. p.setItemInHand(new ItemStack(Material.AIR, 1));
  12. }
  13. p.addPotionEffect(new PotionEffect(PotionEffectType.CONFUSION, 140, 1));
  14. p.addPotionEffect(new PotionEffect(PotionEffectType.SLOW, 410, 1));
  15. p.addPotionEffect(new PotionEffect(PotionEffectType.REGENERATION, 410, 2));
  16. if (p.getInventory().getItemInHand().getType() == Material.FIREWORK_CHARGE)
  17. {
  18. e.setCancelled(true);
  19. }
  20. }
  21. }
  22. }
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement