Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package soup.main;
- import org.bukkit.Material;
- import org.bukkit.Sound;
- import org.bukkit.entity.Player;
- import org.bukkit.event.EventHandler;
- import org.bukkit.event.Listener;
- import org.bukkit.event.player.PlayerInteractEvent;
- import org.bukkit.inventory.ItemStack;
- public class Soup implements Listener {
- @EventHandler
- public void onInterac(PlayerInteractEvent e) {
- try {
- Player p = e.getPlayer();
- if(p.getWorld().getName().equalsIgnoreCase("world")) {
- if (e.getAction() == org.bukkit.event.block.Action.RIGHT_CLICK_AIR
- || e.getAction() == org.bukkit.event.block.Action.RIGHT_CLICK_BLOCK) {
- ItemStack i1 = new ItemStack(Material.BOWL);
- 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.ENTITY_CHICKEN_EGG, 1, 1);
- }
- else {
- p.setHealth(i + 7);
- p.setItemInHand(i1);
- p.playSound(p.getLocation(), Sound.ENTITY_CHICKEN_EGG, 1, 1);
- }
- }
- }
- }
- }
- } catch (Exception e1) {
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment