[FUN] Gills v3.1 - let players breathe underwater [1000]

Discussion in 'Inactive/Unsupported Plugins' started by Hretsam, Apr 18, 2011.

  1. Offline

    Hretsam

    Gills - Let players breathe underwater
    Version: v3.1

    This plugin stated simple, but it has been improved a lot.
    Same as the previous versions, Gills allows you to make sets of items that make players able to stay under water for a longer period of time.
    So you can make it so that a pumpkin can act like scuba gear, needing slimeballs 'store' the air. You can make any combination you like, it also knows the difference between orange and black wool.

    If your just interested in the water related damage you can simply remove the itemsets and that will stop them from working.
    Gills got permissions support, but its not needed. You can also set it to all users or just ops.
    Also Gills will fire the EntityDamageEvent when a player gets damage from Gills.
    Below you can find how to catch the event, and how you can see what damage has been done.x

    Biome damage:
    "The freezing winds are not kind for the brave miner, as he the ground crumbles he falls into the freezing sea.
    His body starts to hurt as he gets deeper into the abyssal plain.
    The minor realizes that if he doesn't get to shore soon, he will not be able to leave the sea."

    Biome damage is done when a player enters the water in a cold biome, the biomes that are considered cold are: ICE_DESERT, TUNDRA & TAIGA.
    You can make some itemsets reduce the amount of damage taken, as the player gets deeper into the water, the damage will also increase.

    Lava damage:
    "When the miner enters the water spring to refresh himself, he feels the heat the nearby magma is providing.
    But as he feels he is getting dragged by the water, he notices he is getting closer to the source of the heat.
    The temprature of the water starts to skyrocket.
    The miner uses the last of his energy to out the water fast before its to late."

    The player will get lava damage when he/she is in the water to close to a lava source (the range is adjustable). The water will get to 'hot' for the player and he will start taking damage.

    Coreheat damage:
    "After days of digging trough the rough stone and hordes of monsters, the miner is getting closer to the center of the world.
    As he find himself stuck above the unbreakable stones that seem to protect the center, he creates a little pool to refresh himself.
    But as he enters the water, he find that its getting hotter by the second. Good think he found out early, otherwise the miner would have a lot more problems."

    The idea behind coreheat damage, is that the core of the world (the void) is hot. So any water that is close to it should be warmed up. Players will receive damage when in water to close to the void.


    If you got some feature you want added, reply below and i will see what i can do.
    I want to thank Lunarius Haberdash for his suggestions, and the rest for the support.x

    Features:
    • Breathe underwater
    • Set usage of items, in return for air
    • Added possibility for Wetsuit, water breathing helmet (idea for RP server?)
    • Fully customizable
    • Permissions support
    • Possible to reload config file runtime (by server, or with permissions)
    • Clean config file on first startup
    • Adjustable depth & altitude
    • Biome, lava, coreheat water-damage
    • Combined itemsets (With items that are consumed & conserved)
    • Force armour wear (making the user to wear the armour in the itemset)
    • World blacklist (define in what world it shouldn't work)
    • Adjustable altitude (only works on given altitude)
    • Consumed empty buckets will be replace with a water bucket!
    Download file here. (version 3.1)

    Source code (GitHub, fork it!)

    Default config file, if you want it:
    config.yml (v3) (open)
    Code:
    ---
    ## Version of the config file, do not touch
    configversion: 3
    
    ## Permissions node:
    ## These can be used with or without the permissions plugin
    ## set to something you like (for example 'gills.admin') to make use it in Permissions
    ## set it to 'x' to disable the node
    ## set it to 'all' to make the node available to all users
    ## set it to 'op' to make the node available to op's
    
    permission:
      ## Permissions node, this allows the user to reload the config file.
      admin node: gills.admin
      ## Permissions node, this allows the user to use gills
      user node: gills.user
      ## Permissions node, this allows the user to stay underwater forever (without itemsets)
      unlimited node: gills.unlimited
      ## No biome damage, this will prevent the user of being damaged in the water.
      no damage node: gills.noDamage
    
    ## Does damage if your in the water, and comply with one of these settings
    damage:
      ## The time between each damage event, in miliseconds
      ## If you set this to a very low value, it can kill the player very fast.
      interval: 1000
    
      ## Biome related damge
      ## This is damage dont in 'cold' biomes
      ## Biomes that are considerd cold are: ICE_DESERT, TUNDRA & TAIGA
      biome:
        enable: false
        ## Multiplyer for depth. Basedamage = Depth * multiplyer
        ## Depth = amount of water blocks above the player
        depth multiplyer: 1.1
    
      ## Lava related damage
      ## This damage is applied when there is a lava source near the player
      lava:
        enable: false
        ## The radius of the warming effects of lava
        radius: 4
        ## Damage the lava will do
        basedamage: 3
    
      ## CoreHeat related damage
      ## This damage is applied if the player is close to the void.
      coreheat:
        enable: false
        ## The last layer that is considerd 'close to the core'.
        till layer: 10
        ## Damage the coreheat will do
        basedamage: 3
    
    ## Sets of items which you need to stay underwater, can be multiple
    itemsets:
      ## This name doesn't matter as long its unique
      ## This set will require you to wear full leather armour, and have 2 slimballs for each air refill.
      set1:
        ## The consumed items needed for this itemset to work
        items:
          ## Like slimeballs
          consume:
            ## Slimeballs
            - 341
            ## Slimeballs
          ## The conserved items needed for this itemset to work
          ## Like armour
          conserve:
            ## Leather Helmet
            - 298
            ## Leather Chestplate
            - 299
            ## Leather Leggins
            - 300
            ## Leather Boots
            - 301
        ## permission node, see discription above
        node: all
        ## Set this to true, if any armour items must be worn to make it work!
        armour must be worn: true
        ## Damage reduction for damage types
        damage reduction:
          ## This overrides the above biome damage, if set to 100 or higher no damage is done.
          biome: 50
          ## This overrides the above lava damage, if set to 100 or higher no damage is done.
          lava: 20
          ## This overrides the above coreheat damage, if set to 100 or higher no damage is done.
          coreheat: 25
    
        conditions:
          ## The depth where this itemset will work.
          ## 0 = any, you can set range like (0-40)
          depth range: 0
          ## The altitude (from bedrock) where this itemset will work.
          ## 0 = any, you can set range like (0-40)
          altitude range: 0-10
          ## Blocklist of world where this itemset should not work
          worldBlacklist:
            - nether
    
      ## A set that allows the player to breathe with empty (air) buckets
      ## The empty bucket is not taken, but replace with a water bucket!
      set2:
        items:
          consume:
            ## Empty bucket
            - 325
    
        node: all
        conditions:
          depth range: 0-5
          altitude range: 0
    
    ...
    
    Example code for GillsDamageEvent (open)
    Code:
        @Override
         public void onEntityDamage(EntityDamageEvent event) {
             if (event.isCancelled()){
                 return;
             }
    
             // Check if its a gills damage event
             if (event instanceof GillsDamageEvent){
                 // Create the gills damaga event
                 GillsDamageEvent gevent = (GillsDamageEvent) event;
                 // Switch between the damage types
                 switch (gevent.getGillsDamageType()){
                     case BIOME_DAMAGE:
                         // Biome damage
                         break;
                     case COREHEAT_DAMAGE:
                         // Coreheat damage;
                         break;
                     case LAVA_DAMAGE:
                         // Lava damage;
                         break;
                 }
             }
         }

    Changelog:

    Version 3.1:
    • Old config files will be renamed (added .old behind it
    • itemsets can now include items that are consumed or conservered
    • You can set that armour must be worn to take effect
    • Added biome damage (damage the player in cold biomes)
    • Added lava damage (damage the player if near lava source)
    • Added coreheat damage (damage the player if near the center of the World)
    • Added itemsets world blacklist (disable on these worlds)
    • Added set altitude (so you can set that it only works on a couple of layers)
    • Fixed bug where it would crash if itemsets are empty
    • Revised access to config variables
    • Added Intrange to store variables like depth & altitude.
    Version 3.0:
    • Updated to 3.0!
    • Updated for 1.7.3 (DinnerBone's build)
    • Fixed bug where items not taken
    • Fixed bug where items not calculated correctly
    • Changed config file, to make it more clear
    • Fixed bug where bubbles are not updated
    • Added possibility to limit it to a certain depth
    • Fixed permissions for server without the Permissions plugin
    • Fixed bug with error message on shutdown
    Version 2.3:
    • Update to 766
    Older versions (open)
    Version 2.2:
    • Fixed bugs when using items
    • Fixed bug with everyone can use Gills
    • Fixed bug where items where not taken
    • Updated to 733
    • Updated config file, and added uptodate check
    • Added to CraftBukkitUpToDate
    Version 2.1:
    • Update to 703, but added some bugs
    Version 2.0:
    • Added config
    • Added permission support
    • Added item usage
    • Uploaded source to githut
    Version 1.0:
    • Initial Release
     
    Xordaii and seiji_kun like this.
  2. Offline

    Unstable_Flight

    no problem, I look forward to the update
     
  3. Offline

    Mr_Oklahomie

    Hi there, I am trying to run this plugin on my server with only specific groups being able to access it. I cannot seem to get it working properly. All of the groups have unlimited underwater breathing, and no items are taken out whenever they surface above the water. Here is my config.yml file for it:

    ## Version of the config file, do not touch
    configversion: 1
    ## The player needs items to breathe underwater, if false unlimited underwater time
    useitems: true
    ## The player needs all items to breathe underwater
    needall: true
    ## Items need to be consumed after useage
    consume items: true

    ## Permissions nodes: set to 'null' if not used
    ## Permissions node, this allows the user to reload the config file. (if set to null, only server can)
    admin node: gills.admin
    ## Permissions node, this allows the user to use gills (if set to null, everyone can)
    user node: gills.user
    ## Permissions node, this allows the user to stay underwater forever (without items)
    unlimited node: gills.unlimited

    ## the items needed to stay underwater (can be several)
    items:
    #Diamond
    - 264

    Any help would be appreciated :)
     
  4. Offline

    Hretsam

    y
    turn "needall" to false
     
  5. Offline

    DMK95921

    I don't get how to use this. I have the latest build, 766, on my server. When I'm underwater I still take damage. I am using the default config and even with slime balls and buckets in my inventory I still take damage. What am I doing wrong?
     
  6. Offline

    Xordaii

    I would check your permissions node for gills.user and make sure 1) the user you are testing with has that permission or is an op or else 2) set that node in the config file from gills.user to null.

    Keep in mind, your "air" will run out, looking like you are taking damage, when really once you run out, you don't get damaged at all. Sounds confusing, but wait for the air to run out before thinking it isn't working. Works for me, only I still get the bug where it doesn't consume items. Running 815.
     
  7. Offline

    fyrus12345

    does it work with Permissions 3.0???

    Because all the players have the required permissions but they still drown.

    Also when I close my server I get this:

    [SEVERE] [Gills] - Error on startup. Shutting plugin Gills down now!

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

    alomo34

    all i get is a zip file how do I get it installed
     
  9. Offline

    Xordaii

    IE sometimes misreads the file type as .zip. rename it to Gills.jar and you are good to go. I use Firefox, and if you hover over the link, it does correctly name the link as a jar file.

    I am not running Permissions, I use essentials, so not sure if it works with 3.0 at all. They haven't updated Essentials yet, so just waiting on that to test it more. It works as stand alone mod with rc818 without Essentials just fine, with the above problem that anyone can use it, and nothing is used up.
    I have been getting this since rc 740. Since it only shows up on shutdown, it doesn't seem to affect the thing working. Author may want to look into it, as it might have something to do with why this doesn't work as intended.
     
  10. Offline

    sukosevato

    Did anything change in 2.3? Except for the CB number?

    Great plugin btw, my users love it.

    I've configured a golden helmet with iron boots and a leater body / legs as scuba gear.
     
  11. Problem:
    I'm not using permissions, and have useitems/needall set to true. It doesn't make me need items to breathe water, and yes I have the latest build of Craftbukkit. Here's my config, though I can't possibly figure out what's weird here.

    Config:
    Show Spoiler
    Show Spoiler

    ## Version of the config file, do not touch
    configversion: 1
    ## The player needs items to breathe underwater, if false unlimited underwater time
    useitems: true
    ## The player needs all items to breathe underwater
    needall: true
    ## Items need to be consumed after useage
    consume items: false

    ## Permissions nodes: set to 'null' if not used
    ## Permissions node, this allows the user to reload the config file. (if set to null, only server can)
    admin node: null
    ## Permissions node, this allows the user to use gills (if set to null, everyone can)
    user node: null
    ## Permissions node, this allows the user to stay underwater forever (without items)
    unlimited node: null

    ## the items needed to stay underwater (can be several)
    items:
    #Bucket
    - 325
    #Slime balls
    #- 341


    What I'd like to do is change the 'items needed' section to read:
    Show Spoiler
    Show Spoiler

    ## the items needed to stay underwater (can be several)
    items:
    #Leather Helmet

    - 298

    #Leather armor

    - 299
    #Leather leggings
    - 300
    #Iron Boots
    - 309
    #Sugar Cane
    - 338


    But I seem to have trouble getting it to require *an* item let alone requiring a full set.


    Suggestions:
    State requirements:
    • Indicate whether an item must be worn/held to be effective, make it item by item.
    You must be wearing a leather helmet, leather armor, leather leggings, iron boots, and have a slime ball in your inventory to breathe water. (A stop-gap wet-suit idea)​

    • Make it depth dependent
    1. Wearing a leather helmet while holding a sugar cane lets you breathe in water no deeper than 3 squares. (Snorkling helmet)
    2. Wearing a leather helmet, leather armor, leather leggings, and iron boots while having a slime ball in your inventory lets you breathe in any depth.
    • Make some items consumable, others not.
    1. The leather helmet, armor, leggings, and iron boots do not get consumed. The slime ball does.
    • Make items consumed over time, and make that time limit adjustable:
    1. One slime ball gets consumed every 300 seconds.
    • Related yet not ideas:
      1. Biome modifiers: Swimming in a cold biome? Take damage every x seconds.
      2. Different requirement per Biome: Must have coal/nether rack on you to prevent damage in cold biome. Coal/Charcoal gets consumed.
      3. Varying consumption rates: Nether rack doesn't decay to keep you warm, Coal does every x seconds. (Consumption obviously only happens underwater.)
      4. Action restrictions: Underwater? Can't eat food, sorry.
     
  12. Offline

    kahlilnc

    Hm 953?
     
  13. Offline

    Hretsam

    Hi everyone,

    Sorry for the late update, i had some personal stuff i needed to take care off. I just hadn't got the time to work on my plugins.

    Anyways here is 3.0, this works with the craftbukkit i got from DinnerBone (the one he posted on twitter) so i dont really know what version it is.
    But it should work for all craftbukkit versions from at least build 900.

    I hope you enjoy it, and please report any bugs you find

    Thank you!

    Hretsam

    I like your biome things, i'll see if i can make that happen.
    And thank you for the depth idea, i added it right away when i was updating it.
    Dont know if it should work on water depth, or if the depth should be relative to sea level. (so you can make items only work above or below sea level)
     
    kahlilnc likes this.
  14. Could you also make it so that wearable items have to be worn to be effective?
    IE ~ If the required item is a piece of armor, you should have to be wearing it. This is important if you somehow get damaged enough to lose that piece of equipment and suddenly 'oh shit my helmet is leaking'.

    My thoughts:
    Configurable for:
    • Straight Depth (Tiles of water over your head)
    • Biome related (Cold Biome water SUCKS)
    • Altitude Related
      • Water near the bedrock can do scalding damage from proximity to 'core'
      • At high altitudes even warm biome water is cold enough to hurt. (altitudes configurable)
    • Environmental
      • Water near Lava is treated as hot (radius configurable)
     
  15. Awesome work man. :)
    The only thing is with the new configurable is you seem to have it separated into:
    "Consumable sets" and "non-Consumable sets"

    Suggestions:
    1. Hybrid sets made of consumed and non-consumed items. (Full leather armor suit (non-consumed) with slime balls (consumed).

    2. Depth sensitive water-based damage. If you're past a certain depth without a particular set, you start taking damage.
     
  16. Offline

    Hretsam

    I think i can make that work. Currently working on Biome damage.
     
    Lunarius Haberdash likes this.
  17. I've been getting this error on booting:

    Gills 3.0 Error (open)

    [Gills] - Your using an old config file, please update!
    2011-07-16 08:03:46 [SEVERE] Error occurred while enabling Gills v3.0 (Is it up to date?): null
    java.lang.NullPointerException
    at com.bukkit.hretsam.gills.GillsConfig.setupConfig(GillsConfig.java:71)
    at com.bukkit.hretsam.gills.GillsConfig.<init>(GillsConfig.java:54)
    at com.bukkit.hretsam.gills.Gills.onEnable(Gills.java:39)
    at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:126)
    at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:857)
    at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:264)
    at org.bukkit.craftbukkit.CraftServer.loadPlugin(CraftServer.java:151)
    at org.bukkit.craftbukkit.CraftServer.enablePlugins(CraftServer.java:136)
    at net.minecraft.server.MinecraftServer.e(MinecraftServer.java:284)
    at net.minecraft.server.MinecraftServer.a(MinecraftServer.java:271)
    at net.minecraft.server.MinecraftServer.init(MinecraftServer.java:148)
    at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:335)
    at net.minecraft.server.ThreadServerApplication.run(SourceFile:422)


    Any idea what's throwing this?
     
  18. Offline

    Hretsam

    Yes its missing the itemsets. Will fix that bug
     
  19. So is that bug fixed?
     
  20. Offline

    Hretsam

    I've been a bit busy with 2 other projects i am currently working on, so i haven't had much time to work on Gills.

    So add the itemsets back to the config, and you should be fine. But i will release a new version with this fixed soon and (hopefully) today.
     
  21. Only problem is, the itemsets don't work right now.
     
  22. Offline

    Hretsam

    They work, you just need to have some in your config file.
    I'm currently working on a couple of things.
    I'll list them in the post
     
  23. I'm going to post my config file then, cause I don't know what I'm doing wrong.

    Config (open)

    ## Version of the config file, do not touch
    configversion: 2

    ## Permissions node:
    ## These can be used with or without the permissions plugin
    ## set to something you like (for example 'gills.admin') to make use it in Permissions
    ## set it to 'x' to disable the node
    ## set it to 'all' to make the node available to all users
    ## set it to 'op' to make the node available to op's

    ## Permissions node, this allows the user to reload the config file. (if set to null, only server can)
    admin node: gills.admin
    ## Permissions node, this allows the user to use gills (if set to null, everyone can)
    user node: gills.user
    ## Permissions node, this allows the user to stay underwater forever (without items)
    unlimited node: gills.unlimited

    ## Sets of items which you need to stay underwater, can be multiple
    itemsets:
    set1:
    items:
    ## Sugar Cane
    - 338
    consume: false
    node: gills.itemsets.set1
    mindepth: 0
    maxdepth: 4

    set2:
    items:
    ## Slime Ball
    - 341
    consume: true
    node: gills.itemsets.set2
    mindepth: 0
    maxdepth: 10

    set3:
    items:
    ## Gold Helmet
    - 314
    ## Leather Chestplate
    - 299
    ## Leather Leggins
    - 300
    ## Iron Boots
    - 309
    consume: false
    node: gills.itemsets.set3
    mindepth: 0
    maxdepth: 0


    Any idea what's wrong here?
     
  24. Offline

    Hretsam

    Only thing i can come up with is the spaces
    Try this:
    Show Spoiler
    Code:
    ## Version of the config file, do not touch
    configversion: 2
    
    ## Permissions node:
    ## These can be used with or without the permissions plugin
    ## set to something you like (for example 'gills.admin') to make use it in Permissions
    ## set it to 'x' to disable the node
    ## set it to 'all' to make the node available to all users
    ## set it to 'op' to make the node available to op's
    
    ## Permissions node, this allows the user to reload the config file. (if set to null, only server can)
    admin node: gills.admin
    ## Permissions node, this allows the user to use gills (if set to null, everyone can)
    user node: gills.user
    ## Permissions node, this allows the user to stay underwater forever (without items)
    unlimited node: gills.unlimited
    
    ## Sets of items which you need to stay underwater, can be multiple
    itemsets:
        set1:
            items:
            ## Sugar Cane
            - 338
            consume: false
            node: gills.itemsets.set1
            mindepth: 0
            maxdepth: 4
    
        set2:
            items:
            ## Slime Ball
            - 341
            consume: true
            node: gills.itemsets.set2
            mindepth: 0
            maxdepth: 10
    
        set3:
            items:
            ## Gold Helmet
            - 314
            ## Leather Chestplate
            - 299
            ## Leather Leggins
            - 300
            ## Iron Boots
            - 309
            consume: false
            node: gills.itemsets.set3
            mindepth: 0
            maxdepth: 0


    Updated to 3.1!

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

    7eggert

    I did not yet install this plugin, but looking at the default config, I think it should not just consume things like empty buckets for air, but also give back buckets full of water.
     
  26. Offline

    Hretsam

    I think i didn't set that clear, but it already does that.
    Empty buckets are taken and water buckets are returned.
     
  27. Offline

    kevinjail

    how do you set the config to allow all users to breathe underwater without any item sets and permissions?
     
  28. Offline

    Hretsam

    Give your players access to the unlimited node, (default is "gills.unlimited") or set the unlimited node in the gills config to all.
     
  29. Offline

    Misoa

    Ok im stupid and dont know how this works :p
    so what would I type in configuration to make it where you can breathe with a pumpkin? and how would you use the slimeballs to keep air?
     
  30. Offline

    Hretsam

    Make a new itemset
    add to consume
    - 341 # a slimeball
    and to conserver
    - 86 # a pumpkin

    so if you dont use the damage system

    Note: its not possible yet to force the pumpkin to be worn.

    Code:
    misoaset:
         items:
           consume:
             ## Slimeballs
            - 341
           conserve:
             ## Pumpkin
             - 86
          node: all
    
         conditions:
           depth range: 0
           altitude range: 0
    
     
  31. Offline

    mrvertigo27

    please list your permissions node in your plugin.yml so we may extract them regularly and stay updated using permissionshelper
     

Share This Page