Stop death due to hunger on hard difficulty.

Discussion in 'Archived: Plugin Requests' started by XanderCrews01, Jan 20, 2013.

  1. Offline

    XanderCrews01

    Potential Name: HardHunger, Hard Hunger, any name that has "Hunger" in it for search purposes.

    Purpose: Prevent players from dying due to hunger on hard difficulty. That's it.

    I like the added challenge of Hard mode, but do not think that my players should be penalized with death for forgetting to eat. For clarity, I should state that I still want them to lose hunger points over time.

    Plugin should be submitted to be released on dev.bukkit.org.

    Thanks for reading.
     
  2. Offline

    XanderCrews01

  3. Offline

    polaris120990

    XanderCrews01 I have quickly thrown this together and you can download it from my github here. (right click link and choose save target as). I will not be submitting this on bukkitdev because it is so incredibly simple. Also, here is my source which can also be found on my github.



    Code:
    package com.github.PhoenixReborn.nohungerdeath;
     
    import org.bukkit.event.EventHandler;
    import org.bukkit.event.Listener;
    import org.bukkit.event.entity.EntityDamageEvent;
    import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
    import org.bukkit.plugin.java.JavaPlugin;
     
    public class NoHungerDeath extends JavaPlugin implements Listener
    {
        public void onEnable()
        {
            getServer().getPluginManager().registerEvents(this, this);
        }
       
        @EventHandler
        public void onHungerDamage(EntityDamageEvent e)
        {
            if(e.getCause().equals(DamageCause.STARVATION))
            {
                e.setCancelled(true);
            }
        }
    }
    
     
    XanderCrews01 likes this.
  4. Offline

    XanderCrews01

    polaris120990

    Thank you so much. It's a simple plugin but it makes a big difference for my server.
     
  5. Offline

    polaris120990

    XanderCrews01 No problem, if you have any issues with it let me know and I will do what I can to remedy them.
     
  6. Offline

    XanderCrews01

  7. Offline

    polaris120990

    XanderCrews01 For some reason the download from github is messing it up, I just tested a version I compiled directly on my computer and it works fine but the one downloaded from github gives that error. Click here instead and you should get a jar that does not produce errors. Also, if it is working the hunger bar will empty completely but you will not take any damage from starvation.

    EDIT: If you want them to still take damage from not eating I can set that up just tell me where you want the damage to stop eg 1 heart, 2 hearts, .5 heart etc
     

Share This Page