Luigi726

SoupPlugin 1.8.8 School

Sep 25th, 2019
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.49 KB | None | 0 0
  1. package project_knockback.main;
  2.  
  3. import org.bukkit.Material;
  4. import org.bukkit.Sound;
  5. import org.bukkit.entity.Player;
  6. //import org.bukkit.event.Event;
  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. /*public static void soup(PlayerInteractEvent a) {
  14.  
  15. }*/
  16. static PlayerInteractEvent a;
  17.  
  18. public static void onInterac(PlayerInteractEvent e) {
  19. a=e;
  20. try {
  21.  
  22. System.out.println("Method Soup was activated.");
  23. Player p = e.getPlayer();
  24. /*if(p.getFoodLevel() != 20) {
  25. p.setFoodLevel(20);
  26. System.out.println("Zu wenig Essen.");
  27. }*/
  28. //if (p.getWorld().getName().equalsIgnoreCase("world")) {
  29. ItemStack i1 = new ItemStack(Material.BOWL);
  30. /*if (e.getAction() == org.bukkit.event.block.Action.RIGHT_CLICK_AIR
  31. || e.getAction() == org.bukkit.event.block.Action.RIGHT_CLICK_BLOCK) {*/
  32. System.out.println("Rechtsklick wurde erkannt");
  33. if (e.getItem().getType() == Material.MUSHROOM_SOUP) {
  34. double i = p.getHealth();
  35. if (i != 20) {
  36. if (i > 12) {
  37. p.setHealth(20);
  38. p.setItemInHand(i1);
  39. p.playSound(p.getLocation(), Sound.CHICKEN_EGG_POP, 1, 1);
  40. } else {
  41. p.setHealth(i + 7);
  42. p.setItemInHand(i1);
  43. p.playSound(p.getLocation(), Sound.CHICKEN_EGG_POP, 1, 1);
  44. }
  45. }
  46. }
  47. // }
  48.  
  49. } catch (Exception e1) {
  50.  
  51. }
  52.  
  53.  
  54.  
  55. }
  56.  
  57.  
  58. }
Advertisement
Add Comment
Please, Sign In to add comment