Description: I need a plugin to heal players if they spend a certain time in bed. Name of plugin: BedHospital Permissions: - bedhospital.instant # Anyone who has this permission, regenerates instantly, without waiting in bed. Configuration: Code: Regenerate each: 30 # Specified in seconds Regenerate Health: 5 # The complete health is 20 Message to get into bed: Your health will regenerate gradually. Message to get out of bed: Your health is regenerated in {%} points. # {%} Represents health has recovered, for example, "Your health is regenerated by 5 points" if you spent 30 seconds in bed. Is required special addition in the configuration, to select whether time passes or not when sleep: Code: Change the time when everyone is asleep: <true> / <false> # If in <false> though everyone is asleep in bed, time does not pass, continues to be night. Refrain from recommending the plugin "BedHealth" has bugs that can not solve their author. Greetings
Can try to do this! BUT not the config! it will give regeneration potion when asleep! can add the permission so only if you have permission it will work! Please PM me if you want it Oh Scratch that i'm doing it anyway! I will give you credit for the idea My verison will be different form what you want but it SHOULD be ok for you EDIT by Moderator: merged posts, please use the edit button instead of double posting.
AWITFC The code that chasechocolate shows makes much more sense, if you don't do it like that players are likely to go into the bed, exit the bed with the potion effect still on them
Yeah Thanks I will start coding this now! Thank you @chasechocolate Ok im confused Code: import org.bukkit.ChatColor; import org.bukkit.configuration.file.FileConfiguration; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; import org.bukkit.event.player.PlayerJoinEvent; import org.bukkit.plugin.java.JavaPlugin; public class Main extends JavaPlugin { public void onEnable(){ getLogger().info("Developed by AWITFC"); getLogger().info("If you had to pay for this plugin"); getLogger().info("Please contact AWITFC on BukkitDev"); saveDefaultConfig(); getServer().getPluginManager().registerEvents(new Listener(){ @EventHandler public void playerJoin(PlayerJoinEvent event){ if (event.getPlayer().isSleeping()){ event.getPlayer().setHealth(event.getPlayer().getHealth() + getConfig().getInt("Regeneration Level")); event.getPlayer().sendMessage(ChatColor.RED + "[BedHospital] You are now in hospital!"); } } } , this); FileConfiguration config = getConfig(); if (!config.getBoolean("Plugin Enabled", false)) { getPluginLoader().disablePlugin(this); } saveConfig(); } } Doesn't Work?? it Doesn't recognise when the player is in bed? EDIT by Moderator: merged posts, please use the edit button instead of double posting.
? srry Im not the best on listners Nearly Done!!! Xd thanks for all your help guys! will upload to bukkit dev later I gtg now Lummox http://dev.bukkit.org/server-mods/bedhospital/ Not Approved by Mods yet but it will be soon! Please take time to check out my other plugins please http://www.awitfc.eu EDIT by Moderator: merged posts, please use the edit button instead of double posting.
Thank you so much!, Wanting to try this now. Were you able to configure everything?, I mean, includes all these options in the configuration?: Code: Regenerate each: 30 # Specified in seconds Regenerate Health: 5 # The complete health is 20 Message to get into bed: Your health will regenerate gradually. Message to get out of bed: Your health is regenerated in {%} points. # {%} Represents health has recovered, for example, "Your health is regenerated by 5 points" if you spent 30 seconds in bed. Change the time when everyone is asleep: <true> / <false> # If in <false> though everyone is asleep in bed, time does not pass, continues to be night. By the way, in "BukkitDev" nickname "Q2Lummox" ... if you can change that ... : P
Hi and no there isn't a config YET. I am working on a project for my server at the moment and cant ocde tomorrow but VERY soon I will have a config! I am not sure if I can make the health go gradually and the time will change anyway there is nothing I can do about that I don't fink. B ut I can add the regeneration level and I can give it so if people have a certain permmison node they only regenerate then! oh and I can add it so you can disable the plugin! and yes I change your bukkit dev name on the project now!
Started this but don't have time to finish it atm, you might be able to use it. Code: public class BedHospital extends JavaPlugin implements Listener { private static HashMap<String, Boolean> isRegening = new HashMap<String, Boolean>(); @Override public void onEnable() { getServer().getPluginManager().registerEvents(this, this); getConfig().options().copyDefaults(true); saveConfig(); } @Override public void onDisable() { } @EventHandler public void onPlayerEnterBed(PlayerBedEnterEvent e) { String enterBedMessage = getConfig().getString("enterbedmessage"); Player p = e.getPlayer(); p.sendMessage(enterBedMessage); startRegen(p); isRegening.put(p.getName(), true); } @EventHandler public void onPlayerLeaveBed(PlayerBedLeaveEvent e) { String enterBedMessage = getConfig().getString("leavebedmessage"); Player p = e.getPlayer(); p.sendMessage(enterBedMessage); if(isRegening.containsKey(p.getName())) { isRegening.remove(p.getName()); } } public void startRegen(final Player p) { int time = getConfig().getInt("regen-each"); final int amount = getConfig().getInt("amount-per-regen"); getServer().getScheduler().scheduleSyncDelayedTask(this, new Runnable() { public void run() { if(isRegening.containsKey(p.getName())) { p.setHealth(p.getHealth() + amount); } } }, time*20L); if(isRegening.containsKey(p.getName())) { startRegen(p); } } }
The page of bukkit dev say this: This project has an abnormal status: Changes required.The description needs more information, you need to make it clear how to use the plugin. Be sure you include information on intended use/functionality, commands, permissions, etc. Please, can you fix this? and.... can you take the code of Cupcakes69 and add in the plugin?. Thank you
How I say on my first post: This plugin have a several bugs, and does not work well. (As you can see on page "dev.bukkit" I am Tester of the plugin )
The bukkit dev page, say this : This project has no files!Please check out our Getting started guide for more information on project management.Please note that your project will not syndicate until your project has at least one beta or release file and has been approved by a moderator.
Lummox BukkitDev just been Approved! like 5 seconds ago! http://dev.bukkit.org/server-mods/bedhospital/ HURRY UP AND APROVE THE F**KIN FILE! XD EDIT by Moderator: merged posts, please use the edit button instead of double posting.
The plugin seems to work but ... but lacks many features to look like the plugin ask. I need: 1) Ability to configure the amount of healing every X seconds (ability to configure, every few seconds regenerates health and how much health regenerates each time). 2) A message when you get in bed, and another when you go (to tell you how much health you have recovered) 3) And very importantly, that day is not made when using the bed, even when all players use the bed, not over time.
Lummox Not sure if you're happy with the version AWITFC made, but I think I could make a more customizable version with the features you want. Lemme know
I would really appreciate it if you try, at least ... I need that the "plugin" have the options I have said in my previous post. I await your response. Thanks in advance
Lummox Ok, seems easy enough. I'll start working on it tomorrow and it should be finished by the end of the day If anyone else can finish it faster, by all means go ahead.
SE Plugins Lummox Hi yeah I have NO IDEA how to make it so it doesn't turn it day! do be honest I don't fin that is possible! I have a message when you get into bed and I will add it so you can change the hearts it heals! Lol sorry my plugin was rubbish EDIT by Moderator: merged posts, please use the edit button instead of double posting.
Your plugin is not rubbish, the only thing is that it is a bit "simple". Not meets the needs I want. But I greatly appreciate your taking your time to do it. Greetings