[req] Despawn a player's inventory on death.

Discussion in 'Archived: Plugin Requests' started by mrhelton, Dec 27, 2012.

Thread Status:
Not open for further replies.
  1. Offline

    mrhelton

    I run an extreme difficulty server, and I'd like a plugin that destroys your inventory when you die so that you or a friend can't collect your items for you. If something like this exists, then I apologize and ask that you direct me there as I couldn't find it myself.

    To follow the format in the sticky:

    Plugin category: Player Death Handling

    Suggested name: No idea, maybe DeadLoot?

    What I want: I want a simple plugin that destroys all of your loot when you die so that you or a friend can't run and collect it. It would raise the stakes a bit on my super difficulty server.

    Ideas for commands: /deadloot restore playername (in case they die and shouldn't have? Not necessary at all.)

    Ideas for permissions: deadloot.override (players with this permission drop their inventory instead of it being destroyed with they die. Also not necessary)

    When I'd like it by: The sooner the better, but you're doing me a favor so who am I to give a time?

    I'd really appreciate this!
     
  2. Offline

    MistPhizzle

  3. Offline

    aciid

    All you need:
    Code:
        public void onDeath(PlayerDeathEvent event) {
            Player player;
            if (event.getEntity() != null
                && (player = event.getEntity()) instanceof Player
                && (!(player.hasPermission("exempt.permission")))) {
                event.getDrops().clear();
            }
        }
    
     
  4. Offline

    Mozio

    Done.

    BukkitDev: http://dev.bukkit.org/server-mods/xdrop/
    Download: <Edit by Moderator: Redacted mediafire url>
    Permission: xdrop.exempt - Player drops items when killed.

    Works on 1.4.6. If you have any problems be sure to PM me!
     
    Last edited by a moderator: Nov 8, 2016
  5. Offline

    MistPhizzle

    [quote uid=90755078 name="Bukr" post=1473943]Done.

    BukkitDev: http://dev.bukkit.org/server-mods/xdrop/
    Download: <Edit by Moderator: Redacted mediafire url>
    Permission: xdrop.exempt - Player drops items when killed.

    Works on 1.4.6. If you have any problems be sure to PM me![/quote]
    Not that I was first or anything :p
     
    Last edited by a moderator: Nov 8, 2016
    CeramicTitan likes this.
  6. Offline

    CeramicTitan

    sorry to break it to you but this code is horribly incorrect.

    it should look something like this:
    Code:
    public void onDeath(PlayerDeathEvent event) {
    if(event.getEntity().hasPermission("permission.node")){
    return;
         }else{
                event.getDrops().clear();
            }
        }
    
     
  7. Offline

    aciid

    What's wrong with a few extra checks to avoid possible errors, please explain?
     
  8. Offline

    CeramicTitan

    alright, your code is terribly messy and is hard to follow along with for such simple code. In this event, event.getEntity() returns a player so you don't need to check if it's an instanceof a player. Also on PlayerDeath how can the entity be null?
     
  9. Offline

    aciid

    Well easier to follow code is a down to your tastes, I find mine easy to read. I put those checks just incase the player got disconnected or incase any of the 1000s of things that could cause errors happened, I always thought it's good practice to put these kind of checks :(

    But my code isn't exactly "incorrect" is it? I'm relatively new to coding any real input to teach me something would be appreciated
     
  10. Offline

    Mozio

    Oh sorry man, if i noticed i wouldn't of done it, sorry!
     
  11. Offline

    MistPhizzle

    It's cool :)
     
  12. Offline

    mrhelton

    Thanks a ton to all of you, this is perfect!

    You guys are fast as hell too!
     
  13. Offline

    CeramicTitan

    I didn't mean to offend you or anything, but all of this is stated in your ide or check http://jd.bukkit.org
     
Thread Status:
Not open for further replies.

Share This Page