[MECH] SlowHealth v3.2 - Auto Heal/Hurt Multi-World Permissions [1060]

Discussion in 'Inactive/Unsupported Plugins' started by ACTruncale, Jan 19, 2011.

  1. Offline

    ACTruncale

    SlowHealth v3.2.0

    Download: SlowHealth.jar
    Source included in JAR

    NOW WITH MULTI-WORLD AND PERMISSIONS SUPPORT
    NEW: ADDED BED HEALING


    Version:
    - v3.2.0 tested with CraftBukkit #122-1060​

    Description:
    - Adds health (configurable) every second (configurable) to players on the server.
    - Can hurt player if you make regen-amount negative
    - Can set maximum amount SlowHealth will heal the player by
    - Can set minimum amount SlowHealth will stop hurting the player by (if you set regen-amount to less than 0
    - Can set the starting altitude that slow health with start working
    - Multi-world support
    - Permissions support

    Instructions:
    - Save SlowHealth.jar to plug-in folder
    - Start and stop server to allow Slow Health to create the needed files.
    - Inside your plug-in folder there should be a SlowHealth Folder with three files
    - default.properties
    - world.properties (or whatever your default world is in your server.properties file)
    - WORLDLIST.txt
    - If you only have a single world just change the settings in your worlds property file.

    Adding Worlds to Slow Health:
    - For every world you have add the world name in the WORLDLIST.txt file. One world per line.
    - Run the server and let it create the properties file, then edit it to your liking.​
    - Any world not on the WORLDLIST.txt will use the setting in the default.properties file.​

    Customize Slow Health:
    All values must be in integer form (whole numbers)​
    - regen-rate:1
    - This value is how fast SlowHealth will heal you in second.​
    - regen-amount:1
    - This is how many 1/2 hearts SlowHealth will heal you for.​
    - Set this to a negative number to hurt the player :eek:
    - regen-max:20
    - Controls at what value SlowHealth will stop healing.​
    - regen-min:0
    - This is used if you are hurting the player instead of healing them.​
    - Controls when your stop hurting them. 0 will lead to death.​
    - regen-altitude:0
    - If a player goes below this depth, the will no longer be healed.​
    - Used if you want to make underground harder.​
    - sleep-heal:20
    - When players sleep through the night they get healed this amount.​

    Permissions:
    If using permissions use the node 'slowhealth' for everyone you want to be affected by this mod. Permissions is not needed to use this mod, Slow Health will default to everyone getting healed if not installed.​

    To be added:
    - Fix the plug-in to work if properties is set to spawn-monsters=false.
    - An option to have slow health heal you after a set amount of time after you take damage​
    - An option to heal you only when you are standing still (probably will be mutually exclusive of above option)​
    - Heal only when light is above a certain level​
    - Console controls to edit settings 'on the fly' (will support permissions)​
    - Suggest more please...

    Credits:
    - Code modified from Silence's SimpleGod code and Protected's SlowHealth 1.0.
    - Also credit to feverdream, Drakia, Edward Hand


    Change Log:

     
  2. Offline

    ACTruncale

    I am glad that fixed your problem. I agree with you, I don't think God should be part of this mod.
     
  3. Offline

    stevo

    @ACTruncale
    Maybe max damage amount, reverse of max heal amount.
    How about a threshold system where if you are below say... three hearts you slowly die, between 3-6 and you stay, above 6, you heal. Or a configurable amount for each variable.

    and/or a halo health regen mode where your health recharges quickly after a countdown of not getting hurt, but if you get hurt it stops it.

    so you get hurt... wait 20 seconds... starts recharging... you get hurt again... it stops recharging... wait 20 seconds starts recharging again... you get healed because you dug a hole and put a block on top... you jump out with full health and finish the zombie.
     
  4. Offline

    raw

    its not working for me, i got a half heart each second, here my server.properties:
    Code:
    spawn-protection-size=16
    natural-monsters=Spider,Zombie
    enable-health=true
    level-name=neosworld
    server-port=25565
    logging=false
    hellworld=false
    natural-animals=Sheep,Pig,Chicken,Cow
    server-ip=
    natural-spawn-rate=2
    whitelist-message=Not on whitelist.
    spawn-animals=true
    plugins=Permissions,Essentials,WorldGuard,MinecartManiaCore,WorldEdit,MinecartManiaStation,MinecartManiaSignCommands,MinecartManiaAutocart,SpawnMob,SlowHealth,TravelPortals
    online-mode=false
    pvp=false
    show-unknown-command=true
    save-homes=true
    max-players=20
    spawn-monsters=false
    data-source=flatfile
    motd=warp, time usw funktioniert wieder
    
    #slowhealth
    regen-rate=10000
    regen-amount=1
    
    it does heal a half heart each second, i would expect a half heart every 10 seconds.
    is it be conflicting with the stock heal rate? (auto-heal setting?)
     
  5. Offline

    ACTruncale

    I am not sure what you mean by stock heal rate. Bukkit or the current vanilla server does not have auto-heal implemented anymore. What version of Bukkit are you running?
     
  6. Offline

    RainRain

    Apparently the option to set regen rate and amount are not working, I have reinstalled craftbukkit many times, Any suggestions? I don't have any other mods that i could think could interfere with this, And i get no error, It just simply stays at a super fast regen rate
     
  7. Offline

    ACTruncale

    Ok I have posted a new jar file see if that works.

    what does your properties file look like? 1000 = 1 sec
     
  8. Offline

    kilimasdb

    Wow, I liked it.
    Thanks! :)
     
  9. Offline

    RainRain

    Didn't work for me, the new jar.

    Code:
    #Minecraft server properties
    #Fri Jan 28 14:35:05 CST 2011
    server-name=RainsMC
    level-name=world
    hellworld=false
    spawn-monsters=false
    online-mode=true
    spawn-animals=true
    max-players=20
    server-ip=
    pvp=true
    server-port=25565
    regen-rate=3000
    regen-amount=1
     
  10. Offline

    ACTruncale

    so you want the server to heal you a half heart every 3 seconds right?

    What version of Bukkit are you running?
     
  11. Offline

    RainRain

    Correcto, And the latest version.
     
  12. Offline

    ACTruncale

    I honestly don't know why it isn't working for you.

    Silly question: Is you server.properties located in the root of your Bukkit folder?

    I've posted the source code below. It works for most people, but if you think you can spot an error let me know.

    Code:
    package adam.SlowHealth;
    
    import java.io.File;
    import java.io.IOException;
    import java.util.Timer;
    import java.util.Properties;
    import java.io.FileInputStream;
    import org.bukkit.entity.Player;
    import org.bukkit.Server;
    import org.bukkit.plugin.PluginDescriptionFile;
    import org.bukkit.plugin.PluginLoader;
    import org.bukkit.plugin.java.JavaPlugin;
    
    public class SlowHealth extends JavaPlugin
    {
      private Timer m_Timer = new Timer(true);
      private int HP = 0;
      private int rate = 1000;
      private int healAmount = 1;
    
      public SlowHealth(PluginLoader pluginLoader, Server instance, PluginDescriptionFile desc, File folder, File plugin, ClassLoader cLoader)
      {
        super(pluginLoader, instance, desc, folder, plugin, cLoader);
      }
    
      public void onEnable()
      {
        PluginDescriptionFile pdfFile = this.getDescription();
    
        Properties props = new Properties();
        try {
            props.load(new FileInputStream("server.properties"));
            if (props.containsKey("regen-rate"))
                rate = Integer.parseInt(props.getProperty("regen-rate"));
            if (props.containsKey("regen-amount"))
                healAmount = Integer.parseInt(props.getProperty("regen-amount"));
        } catch (IOException ioe) {
            System.out.println( pdfFile.getName() + " : ERROR CAN/'T FIND server.properties" );
        }
        System.out.println( pdfFile.getName() + pdfFile.getVersion() + " is enabled! Regen-rate : " + rate + " secs | Regen-amount : " + healAmount);
        m_Timer.schedule(new SimpleTimer(this), 0, rate);
      }
    
      public void onDisable()
      {
        System.out.println("Goodbye world!");
      }
    
      public void handleHealth()
      {
          for ( Player player : getServer().getOnlinePlayers() )
          {
              HP = player.getHealth();
              if(HP<0)
                  player.setHealth(0);
    
              if(HP<20 && HP>0 && healAmount>0)
              {
                  player.setHealth(HP+healAmount);
                  if(HP>20)
                      player.setHealth(20);
              }
              else if(HP<=20 && HP>0 && healAmount<0)
              {
                  player.setHealth(HP+healAmount);
              }
            }
        }
    
      }
    Code:
    package adam.SlowHealth;
    
    import java.util.TimerTask;
    
    public class SimpleTimer extends TimerTask
    {
      private SlowHealth m_Plugin;
    
      SimpleTimer(SlowHealth plugin)
      {
        m_Plugin = plugin;
      }
    
      @Override
      public void run()
      {
        m_Plugin.handleHealth();
      }
    
    }
     
  13. Offline

    maddog0

    would it be possible to make it so this plugin will only take effect within certain user defined areas? I want to make it so that players will regen health when in town, but won't when they are exploring.
     
  14. Offline

    ACTruncale

    Yeah there would be away, but I will keep this plug-in simple. I'll work on something like you wanted and post it as another another thread/plugin.
     
  15. Offline

    maddog0

    cool, thanks
     
  16. Offline

    Nevlic

  17. Offline

    zwarmapapa

    Doesn't work with latest build... (188)
     
  18. Offline

    Jobsti

    It work's for me on #188!
     
  19. Offline

    ACTruncale

  20. Offline

    closer013

    I can't get this to work on the newest bukkit. I d/led the newest release about 20mins ago...
     
  21. Offline

    Aelux

    CB build 200+ has a new command handler method.
     
  22. Offline

    Mattie112

    Can you please add an option 'maximum health'.
    I want the plugin to auto-heal till 5 hearts, so food is still "needed".

    thanks in advance!
     
  23. Offline

    ACTruncale

    I just checked on version 239 and it us working fine. The new command handler shouldn't effect this plug-in at all (since there are no commands).

    Mattie I will work on the plug-in today (I got snowed in) and release a max heal amount right away. Expect a release soon.
    --- merged: Feb 4, 2011 4:46 PM ---
    Ok I have uploaded a new version.

    Now you can add a property = regen-max (0-20) to set the max the plug-in will heal you by.

    I have also changed regen-rate to now take seconds NOT milliseconds. So don't forget to divide your regen-rate by 1000.
     
  24. Offline

    rct2guy

    So, if my regeneration rate is at 1500 milliseconds, can I type in 1.5 and it'll work just fine?
     
  25. Offline

    ACTruncale

    no you'll have to set it to an integer like 1 or 2. I changed it because people kept getting confused. I could change it to a double if you want that fine of a control
     
  26. Offline

    feverdream

    Not seeing a regen-min setting.. will that be added?

    Its important for when the plugin is set to hurt instead of heal; For example I may wan t o hurt people down to 1hp and then no longer want to hurt them.
     
  27. Offline

    ACTruncale

    Ahh good idea! I'll work on that right away
     
  28. Offline

    feverdream

    @ACTruncale
    Since I coded the plugin before you added your version, and since I have dumped so many ideas into your threads on it, may I add this plugin to the list in my sig of the ones I "sort of help with" with a link to this thread?
     
  29. Offline

    ACTruncale

    Ok the new version 2.3 supports the regen-min and decimals for the time in seconds (ex 1.5)
    --- merged: Feb 4, 2011 11:03 PM ---
    Dude I don't care lol. I added you in the credits section anyway. Open source remember :)

    I just do this for fun I could honestly could care less about the credit
     
  30. Offline

    feverdream

    LOL, I actually use my sig a lot to find threads and its easier for me to find this thread if I just have it linked in my sig.. added.
     
  31. Offline

    sintri

    Could essentially use this as hunger to force people to eat, not that I would bit too much hassle having to find food all the time. Anyways, works fine here.
     

Share This Page