1.7 Soup

Discussion in 'Archived: Plugin Requests' started by HyrulesLegend, Oct 28, 2012.

  1. Offline

    HyrulesLegend

    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.
     
  2. Offline

    Woobie

    I was just playing on your server, if you have 7 or more hearts, it wont work either.
     
  3. Offline

    HyrulesLegend

    Would you know how to do this?

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 29, 2016
  4. Offline

    Woobie

    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 :)
     
  5. Offline

    HyrulesLegend

    Doesn't this just set it to 7? Or does it boost it by 3.5, :p
     
  6. Offline

    Woobie

    Boost by 7, which is 3.5 hearts.
    Also that code wont work, need to do some fixing, just a sec.
     
  7. Offline

    HyrulesLegend

    Also, if the player has full hearts, make it heal hunger by 3 bars. :p
     
  8. Offline

    Woobie

    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
     
  9. Offline

    HyrulesLegend

    Please do, :p
     
  10. Offline

    Woobie

    [quote uid=90697955 name="Max_The_Link_Fan" post=1391724]Please do, :p[/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 :D
     
    Last edited by a moderator: Nov 9, 2016
  11. Offline

    HyrulesLegend

    [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 :D[/quote]
    Lawl. :D

    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.
     
    Last edited by a moderator: Nov 9, 2016
  12. Offline

    Woobie

    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.
     
    Last edited by a moderator: May 29, 2016
  13. Offline

    HyrulesLegend

    Yes, if hearts are full, start healing hunger.
     
  14. Offline

    Woobie

    [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>
     
    Last edited by a moderator: Nov 9, 2016
  15. Offline

    HyrulesLegend

    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.
     
    Last edited by a moderator: May 29, 2016
  16. Offline

    Woobie

    Thats interesting.. only thing I did was made the hunger go -6 after the soup eat.
     
  17. Offline

    HyrulesLegend

    :p
     
  18. Offline

    Woobie

    I mean not go -6, but take 6 hunger away, which is 3 hunger bars.
     
  19. Offline

    HyrulesLegend

    lawl, :p
    [​IMG]

    Woobie how's it coming? :p

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 29, 2016
    Woobie likes this.
  20. Offline

    Woobie

    I have no idea what's the problem, still trying to figure out what's causing the bugs
     
  21. Offline

    HyrulesLegend

    D:
     
  22. Offline

    Woobie

    You need to get online, your server has like 30 people on, atleast 15 of them are hackers.. no admins or mods on -.-
     
  23. Offline

    HyrulesLegend

    :p, I'm online now.

    Woobie How's it going?

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 29, 2016
  24. Offline

    Woobie

    I'm not on my computer anymore, but I will try a different method tomorrow.
     
  25. Offline

    HyrulesLegend

    Did it work? :D
     
  26. Offline

    Muddr

    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
     
  27. Offline

    Woobie

    A lot wrong? I see no wrong, since it worked, but if player had 7 health, it didnt.
     
  28. Offline

    Hoolean Retired Staff

    Nom has customisable health and hunger healing for everything edible! It also works with 1.4.2 and the new added food items.
     
  29. Offline

    hhaammzzaa2

  30. Offline

    HyrulesLegend

Share This Page