Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package project_knockback.main;
- import org.bukkit.Material;
- import org.bukkit.Sound;
- import org.bukkit.entity.Player;
- //import org.bukkit.event.Event;
- import org.bukkit.event.Listener;
- import org.bukkit.event.player.PlayerInteractEvent;
- import org.bukkit.inventory.ItemStack;
- public class Soup implements Listener{
- /*public static void soup(PlayerInteractEvent a) {
- }*/
- static PlayerInteractEvent a;
- public static void onInterac(PlayerInteractEvent e) {
- a=e;
- try {
- System.out.println("Method Soup was activated.");
- Player p = e.getPlayer();
- /*if(p.getFoodLevel() != 20) {
- p.setFoodLevel(20);
- System.out.println("Zu wenig Essen.");
- }*/
- //if (p.getWorld().getName().equalsIgnoreCase("world")) {
- ItemStack i1 = new ItemStack(Material.BOWL);
- /*if (e.getAction() == org.bukkit.event.block.Action.RIGHT_CLICK_AIR
- || e.getAction() == org.bukkit.event.block.Action.RIGHT_CLICK_BLOCK) {*/
- System.out.println("Rechtsklick wurde erkannt");
- if (e.getItem().getType() == Material.MUSHROOM_SOUP) {
- double i = p.getHealth();
- if (i != 20) {
- if (i > 12) {
- p.setHealth(20);
- p.setItemInHand(i1);
- p.playSound(p.getLocation(), Sound.CHICKEN_EGG_POP, 1, 1);
- } else {
- p.setHealth(i + 7);
- p.setItemInHand(i1);
- p.playSound(p.getLocation(), Sound.CHICKEN_EGG_POP, 1, 1);
- }
- }
- }
- // }
- } catch (Exception e1) {
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment