Plugin category: FUN Suggested name: ClassicSoup, OldSoup, etc What I want: I'd like a plugin that adds the old 1.7 soup feature. You could instantly eat it, and it would heal your hearts by 3.5 hearts. (Yes, I realize there's FastSoup, but it heals Hunger first, and if you have less than 3 hearts, it doesn't heal at all.) Ideas for commands: No commands needed for this plugin. Ideas for permissions: None, have the fast-soup default to all. When I'd like it by: Anytime.
Would you know how to do this? EDIT by Moderator: merged posts, please use the edit button instead of double posting.
Of course not. Code: @EventHandler public void onInteract(PlayerInteractEvent e){ if(e.getAction().equals(Action.RIGHT_CLICK_AIR) || e.getAction().equals(Action.RIGHT_CLICK_BLOCK)){ if(e.getPlayer().getItemInHand().getType() == (Material.MUSHROOM_SOUP)){ e.getPlayer().setHealth(+7); } if(e.getPlayer().getHealth() > 13){ e.getPlayer().setHealth(20); } else if(e.getPlayer().getHealth() < 2){ e.getPlayer().setHealth(+7); } } } } Might work, havent tested yet
Code: @EventHandler public void onInteract(PlayerInteractEvent e){ if(e.getAction().equals(Action.RIGHT_CLICK_AIR) || e.getAction().equals(Action.LEFT_CLICK_BLOCK)){ if(e.getPlayer().getItemInHand().getType() == (Material.MUSHROOM_SOUP)){ e.getPlayer().setHealth(+7); e.getPlayer().getInventory().removeItem(new ItemStack(Material.MUSHROOM_SOUP, 1)); } if(e.getPlayer().getItemInHand().getType() == (Material.MUSHROOM_SOUP)){ if(e.getPlayer().getHealth() > 13){ e.getPlayer().setHealth(20); } else if(e.getPlayer().getItemInHand().getType() == (Material.MUSHROOM_SOUP)){ if(e.getPlayer().getHealth() < 2){ e.getPlayer().setHealth(+7); } } else if(e.getPlayer().getItemInHand().getType() == (Material.MUSHROOM_SOUP)){ if(e.getPlayer().getHealth() == 20){ e.getPlayer().setFoodLevel(+6); } } } } } } Should work Do you want me to compile it? EDIT: WAITWAIT.. still not done XD
[quote uid=90697955 name="Max_The_Link_Fan" post=1391724]Please do, [/quote] Hope it works lol <Edit by Moderator: Redacted mediafire url> EDIT: If it creates a config file, ignore it.. I always copy the onEnable stuff from my old projects
[quote uid=90712918 name="Woobie" post=1391734]Hope it works lol <Edit by Moderator: Redacted mediafire url> EDIT: If it creates a config file, ignore it.. I always copy the onEnable stuff from my old projects [/quote] Lawl. Woobie Found some bugs: * Hunger goes first, not hearts. * hearts don't heal if you have 3 hearts gone, EDIT by Moderator: merged posts, please use the edit button instead of double posting.
hearts don't heal if you have 3 hearts gone, Oops I put it 3.5 hearts. Just a sec. Do you want it to heal hunger at all? EDIT by Moderator: merged posts, please use the edit button instead of double posting.
[quote uid=90697955 name="Max_The_Link_Fan" post=1391749]Yes, if hearts are full, start healing hunger.[/quote] Okay this should fix both of the "bugs" <Edit by Moderator: Redacted mediafire url>
Woah, it's worse. Heals hunger to max, then just makes hunger bars go to 0 Doesn't even heal hearts at all, just damages the player..? Woobie EDIT by Moderator: merged posts, please use the edit button instead of double posting.
lawl, Woobie how's it coming? EDIT by Moderator: merged posts, please use the edit button instead of double posting.
You need to get online, your server has like 30 people on, atleast 15 of them are hackers.. no admins or mods on -.-
, I'm online now. Woobie How's it going? EDIT by Moderator: merged posts, please use the edit button instead of double posting.
There's a lot wrong here.. ha ha try something like this, I think it's along the line of what you're looking for.. There's a link below the code if you wanna test it. Code: @EventHandler public void onInteract(PlayerInteractEvent event) { Action action = event.getAction(); Player player = event.getPlayer(); boolean foodUsed = false; int change_amount_health = 7; int change_amount_hunger = 6; int health = player.getHealth(); int hunger = player.getFoodLevel(); int maxhealth = player.getMaxHealth(); int maxhunger = 20; int newhealth = health + change_amount_health; int newhunger = hunger + change_amount_hunger; ItemStack iteminhand = event.getItem(); if ((action == Action.RIGHT_CLICK_AIR || action == Action.RIGHT_CLICK_BLOCK) && iteminhand.getType() == Material.MUSHROOM_SOUP) { if ((health == maxhealth)) { if (hunger < maxhunger) { newhunger = (newhunger > maxhunger ? maxhunger : newhunger); player.setFoodLevel(newhunger); foodUsed = true; } } else { newhealth = (newhealth > maxhealth ? maxhealth : newhealth); player.setHealth(newhealth); foodUsed = true; } if (foodUsed) { iteminhand.setType(Material.BOWL); } } } https://dl.dropbox.com/u/18835236/Games/Minecraft/classicsoup.jar
Nom has customisable health and hunger healing for everything edible! It also works with 1.4.2 and the new added food items.