9

I'm running a Minecraft 1.7.2 server with Craftbukkit. I need some command or plugin for the following purpose:-

When a Player dies he/she will lose all items, except the equipped items (action bar 1-9) which will still remain.

  • There is no standard bukkit command for this, but why would you want to do this? I mean you shouldn't lose or keep your item just because it's in the action bar or not... – Andalur Dec 19 '13 at 12:43
  • 2
    There is a way to make the entire inventory be retained, using /gamerule keepInventory true (as shown in this question), but I am not aware of any way to have only the hot bar saved, other than the use of Kits or KitSigns, but then the hotbar would always be the same (actually, I think there is a KitSign that can be set to the inventory of whoever uses it, but again the whole inventory, not just the hotbar) – The Ugly Dec 19 '13 at 14:26
  • Ignore these comments, hotbar, armor slots and regular inventory all have public attributes exposed in the bukkit API. See my answer. It wouldn't be difficult to mod existing plugins that are similar or make one from scratch. A little searching at dev.bukkit.org might even reveal a plugin better than the one i posted. – tremor Dec 19 '13 at 19:34
7

I've released a CraftBukkit plugin called DropProtect which does almost exactly what you're looking for. It protects all Armor slots (Helmet, Chestplate, Leggings, and Boots) as well as the 9 hotbar slots by default. It is configurable, so you can change the number of slots that are protected.

Before and after death with 9 protected-slots (covers the hotbar + armor):

Before and after death

Output of the /dropprotect command with 12 protected-slots:

Output of /dropprotect

Let me know if you have any questions :)

You can download DropProtect at https://github.com/pavben/Bukkit-DropProtect.

  • This is exactly what i was looking for :) Even better than my idea. I forgot about armors :) Is it works with 1.7.2 server? – Gereltod Jan 6 '14 at 10:14
  • @GereltOd: Yup, it's made for 1.7.2 and future releases :) – Pavel Jan 6 '14 at 18:01
5

Such a plugin doesn't exist.

You're better off asking for someone to make one here: http://forums.bukkit.org/forums/plugin-requests.13/

4

You might consider the plugin Death Control - http://dev.bukkit.org/bukkit-plugins/deathcontrol/

It is configurable to have player keep items on death among other things like XP. If it doesn't exactly work the way you want it to, the developer may be able to add your idea as a feature. It looks like it's for 1.6.4 but in my experience many bukkit plugins manage to work across game versions unless they are affected by new updates.

If all else, let me know, the API for inventory and death events are simple enough. http://jd.bukkit.org/rb/doxygen/d9/d20/enumorg_1_1bukkit_1_1event_1_1inventory_1_1InventoryType_1_1SlotType.html I could probably write this plugin in 15-20 minutes time.

  • Ty. I forgot about XP. Keeping XP would be nice too :) – Gereltod Dec 20 '13 at 15:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.