Dive Helmet
Dive Helmet
Give the ability for players to spend extended time underwater by using glass blocks as Dive Helmets.
Use:
Put stack of glass blocks on head just as if wearing a helmet. While wearing this "dive helmet". the player can take a breath underwater by entering sneak (pressing shift key normally). This breath will refill the air level and consume a glass block from the stack on head. Breaths can continue on until the blocks are used up. When stack of glass blocks gets low, it displays a warning, reminding to start heading for surface or load on some more glass blocks.
If a breath is not taken regularly, the character drowns as normal, but a breath can be still be taken while taking damage from drowning.
Installation:
Place DiveHelmet.jar in plugins folder and reload or restart. That's it, no commands, dependencies, configuration or permissions.
Notes:
This is my first public plugin. It is inspired by Party Hat (showed it possible to blocks on head) and Fishpeople ("breathing to by setting air to max) but is all original code. The concept is simple, but have not found it in any other plugin. I wanted a simple way for people to stay underwater for extended length of time.
The the single source file is embedded in the DiveHelmet.jar file.
Change Log:
1.0 Initial Public Release
1.1 First Update
- Fixed Delay in equipping dive helmet
- Now starts warning when down to 5 helmets (per carstorm's suggestion)
Known Bugs:
- When placing glass blocks on head, slight delay for head and cursor items to update. (fixed in 1.1)
Considerations and Interactions with other Plugins:
- If sneak is somehow disabled, this plugin will not operate.
- A character will drown if does not breathe regularly, so doing thing like crafting, chatting or other activities that take ability to enter sneak mode, the player can drown.
- Shift does not trigger sneak while typing in commands or chat, or while manipulating inventory. Careful while doing those tasks underwater.
- Additional stacks of glass blocks can be placed on head while underwater, for longer under water voyages. Each stack of 64 glass if well timed will last 10-12 minutes,
- Any plugin the alters the max air level of a player, using a dive helmet will only restore to normal max air level (300). If over normal max air level, will not consume a glass block nor increase air level
Future Plans:
- If response to plugin is good, will look at adding localization on warning message when using last glass block on head.
- look for way to improve visibility while underwater, may or may not be part of this plugin.
i love you work fine on 1.12.2 perfect !! did i say i love you humm... no i LOV YOU ... dam im crazy
does not work on spigot 1.6.2-R0.2
confirmed working with 1.3.2 R.02 (#2371)
Still working with 1.3.1 / 1.3.2 ?
Hello! would it be possible to had a few permission, or even one permission? i have a suggestion: when you type /dive while having a glass block in your hand, it will be set to your head slot, and give you a sort of godmode towards water/drowning.
a user permission would be quite helpful.
@Cecelo126
I agree with all your points.
Hi,
It would be nice if there are imaginary diving cylinders and can be set how much time you can stay underwater before returning in an air space to refill them, instead of loosing glass blocks.
e.p.: I can breath underwater for 5 minutes and then I'll drown if I don't exit from water, after that I can refill my diving cylinders in at least 5x5x5 air space.
P.S.: To improve the visibility while underwater it could be useful to make appear a light around the player with a set radius and for a set amount of time when he uses a predefined object like glowstone dust.
Thanks for reading
Cecio
@Raciper
KK Thank you for reading it. I know more options will make it apply to more people but till then I will use what I got.
@carstorm
I have the breathe option using sneak, because I want two things.
First to have the player constantly reminded they are underwater. Initially players use up the helmet very quickly, but soon learn to wait until the air is almost gone or even get the first damage hit before breathing, making the time under greatly extended. They also can take advantage of air pockets underwater.
Second to limit the impact on the server, currently it only intercepts two events, sneak toggle and crafting inventory mouse click, both are not very frequent. To automatically breathe requires timers, I am not aware of any "use air" events to attach to. There is a damage event that could trigger on first damage, but that occurs to all entities not just players.
(edit) As for auto-loading the next stack of glass blocks, not sure I want to use blocks the player may be reserving for other use; a command would be more disruptive than just using inventory; a per player toggle would require tracking the states of player, and add more complexity that wanted to the plugin. But I would like a quick way to equip all armor, not just the dive helmets, likely I will approach this issue with another plugin.
I am trying to hold off configurations and permissions to keep this plugin, plug and play. Likely though a config file will have to be built when language localization comes in. Much depends on how wide spread the plugin becomes, if popular, some configuration options definitely are warranted.
Thank you for adding my last suggestion (and mentioning me in the changelog :).
I got another suggestion for ya. Rather than people having to hit sneak to use the block, when you add the config file make an auto reload option.
Till than you should make an in game command such as dht (diving helmet toggle) and dhs (diving helmet status) which will let you change true/false option and see what it currently is respectively.
This should have two permission nodes: divinghelment.toggle and divinghelment.status
Sorry if this is alot but I feel it would make the plugin better for many people (and fit my needs also while leaving it up to other people weather they want the same config as me or not).
Thank you for adding that feature☺
@Raciper
K, thank you for reading my idea and (hopefully soon) implementing it ☺
Thanks for the suggestion,
Currently it warns only when last block is used, and more blocks can be placed on head while underwater, so pre-planning will allow very extended stay underwater.
Trying to use KISS principle with this plugin, but when localization goes in, a configuration file is inevitable, at that point putting a warn level would make sense.
Putting a count down of Dive Helmets when get lower than 5 might be a good idea. That would give a one minute notice that its time to surface, or equip more dive helmets.
You should add it so that it warns them when they are low on glass blocks on their head in case they are really low and need more than one block to make it back to the surface. It should be either 5 or configurable.
Nice Plugin so far. I think I will use this on my Server. People will love this because they build a lot under water and I dont want them stay under water all the time without having them "pay" anything for this special need. The idea with the glassblocks comes perfect here :)