Luigi726

SoupPlugin 1

Jul 13th, 2019
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.16 KB | None | 0 0
  1. package soup.main;
  2.  
  3. import org.bukkit.Material;
  4. import org.bukkit.Sound;
  5. import org.bukkit.entity.Player;
  6. import org.bukkit.event.EventHandler;
  7. import org.bukkit.event.Listener;
  8. import org.bukkit.event.player.PlayerInteractEvent;
  9. import org.bukkit.inventory.ItemStack;
  10.  
  11. public class Soup implements Listener {
  12.  
  13. @EventHandler
  14. public void onInterac(PlayerInteractEvent e) {
  15. try {
  16.  
  17. Player p = e.getPlayer();
  18. if(p.getWorld().getName().equalsIgnoreCase("world")) {
  19.  
  20.  
  21. if (e.getAction() == org.bukkit.event.block.Action.RIGHT_CLICK_AIR
  22. || e.getAction() == org.bukkit.event.block.Action.RIGHT_CLICK_BLOCK) {
  23. ItemStack i1 = new ItemStack(Material.BOWL);
  24. if (e.getItem().getType() == Material.MUSHROOM_SOUP) {
  25. double i = p.getHealth();
  26. if(i != 20) {
  27. if(i > 12) {
  28. p.setHealth(20);
  29. p.setItemInHand(i1);
  30. p.playSound(p.getLocation(), Sound.ENTITY_CHICKEN_EGG, 1, 1);
  31. }
  32. else {
  33. p.setHealth(i + 7);
  34. p.setItemInHand(i1);
  35. p.playSound(p.getLocation(), Sound.ENTITY_CHICKEN_EGG, 1, 1);
  36. }
  37. }
  38. }
  39. }
  40. }
  41. } catch (Exception e1) {
  42. }
  43. }
  44.  
  45. }
Advertisement
Add Comment
Please, Sign In to add comment