Lose Half of your Items on Death

Discussion in 'Archived: Plugin Requests' started by Rungario, Jan 25, 2014.

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

    Rungario

    Suggested name: RPGDeath

    What I want: When a player dies, he drops half of his items and respawns with the other half.

    If you really wanted to make me happy, you could also add a configurable percent of items that the player keeps, and a blacklist for items that the player will always keep no matter what. However, this is optional and not really required.

    Ideas for commands: No commands needed for this plugin.
     
  2. Offline

    DividedByZero

    Alright this may be rather tricky to accomplish.
    It would be easier to make it a 50% chance to drop all items or drop none.
    Would this be ok..

    im a professional plugin developer that does custom plugins for servers. The reason this is tricky to do is because the way minecraft saves inventories.
    Code:java
    1. Inventory playerInv = player.getInventory().getContents();
    2. for(ItemStack i : playerInv) {
    3. this.getConfig().set("inv."+i.getType().getName()+",i.getAmmount());
    4. }

    thats how you save invetories. How could i loop through all that and determin to save only 50% of it. Its possible just very very unpractical. But if you willing to do it the other way i mentioned above. Ill get right to it.
    Ill also include full set of configurations. Including custom permissions and world permissions.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 6, 2016
  3. Offline

    Rungario

    The way you described it is fine, it'll accomplish the same function. Thanks for responding!
     
  4. Offline

    calebbfmv

    Rungario
    This is not hard at all really.
    Just do:
    p.getInventory().getContents() / 2;
     
  5. Offline

    DividedByZero

    Plans for version 2.0
    • Add command to change chance in game.
    • Add a command to enable/disable plugin in worlds.
    • Add an item blacklist.
    • Add a command to add items/remove items from blacklist.
     
  6. Offline

    johngianni


    Not sure if this is possible, but can't you do something where you make an ArrayList of the contents of the invetory and randomly remove parts of the inventory through a regular for loop and make the time it runs equal to the ArrayList size multiplied by .5 or some other decimal? Not really sure how the inventory works but I am guessing you would know better to explain it.
     
  7. Offline

    Rungario


    I totally misunderstood what you meant. I thought you meant it would go through each item individually then there'd be a 50 percent chance that item would be dropped.

    I'm making a runescape recreation, and I'm trying to recreate the system where when you die, you keep some of your stuff. The current way where theres a 50 percent chance you don't keep anything at all isn't going to work.

    If it's too much hassle, then don't worry about it.
     
  8. Offline

    johngianni


    Yea I thought you were referring to something like Runescape lol :p. I will give it a try soon if I got time and see how it goes.
     
  9. Offline

    DividedByZero

    I will work on that if you like.

    Actually this is not possible i beleive. Because bukkit can only do event.getDrops().clear();
    there is no possible way to select what items will be dropped.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 6, 2016
  10. Offline

    Desle

  11. Offline

    DividedByZero

    You actually stole that from me and I could report that because my plugin is All rights reserved. You bukkit dev account would be shut down. Please give me credit.
     
  12. Offline

    jthort

    He didn't steal anything, it was a public request anyone can take it
     
    timtower and L33m4n123 like this.
  13. Offline

    johngianni


    Some professional you are, you don't know what your talking about. He can do that and he doesn't need to give you credit no matter how many times you say please.
     
  14. Online

    timtower Administrator Administrator Moderator

    Those on bukkitdev are, but i don't think that you close a bukkitdev based on a dropbox link on a public request.
    There are loads of copies of plugins that are all rights reserved.
     
    DogeDev likes this.
  15. Offline

    DogeDev

    DividedByZero Anyone can create requested plugins. "Mr. Professional". If you're going to complain, go back to making private plugins and get off of bukkit, a public plugin making site. Anyone can create/attempt the requested plugin(s) in the thread.
     
    timtower likes this.
  16. Offline

    jthort

    johngianni, DogeDev and timtower like this.
  17. Offline

    Desle

    jthort DogeDev timtower johngianni DividedByZero

    Alright.. i was AFK for some time, and.. i'm kinda confused..?
    I understand that DividedByZero, you're mad.. but you said it wasn't possible, pretty much meaning you couldn't make it..
    + I don't see why i should give you credit, it's my own code.

    Did i do something wrong?
     
    AndyMcB1, timtower and johngianni like this.
  18. Offline

    DogeDev

    Desle You're perfectly fine, good job on the plugin :) Keep it up.
     
  19. Offline

    calebbfmv

    Desle
    Very nice plugin, I like it.
     
  20. Offline

    Rungario


    Just tested it out, and it doesn't work. On death, the player still loses all of his items. This is on a test server with essentials, vault, permissionsex and that's it. Also, the latest spigot version. No errors in console.

    I'm sorry to take up more of your time, but could you maybe take one more look at it? ;/

    Edit: So the player correctly only drops half of his items, however when he respawns he doesn't have the other half.
     
  21. Offline

    skore87

    You're quite arrogant aren't you? And if that was meant to be a joke then you're not funny either.
     
  22. Offline

    15987632

    spigot isnt supported :p this gonna get locked
     
  23. Offline

    skore87

    Yeah, the mods are quite anal about it. If you even hint at it they get a hard-on.
     
  24. Offline

    15987632

    I wouldn't say it like that... but they are overly strict about it
     
  25. Offline

    jthort

    I sense a lock in the future..
     
    15987632 likes this.
  26. Offline

    calebbfmv

    And here, I thought professionals were useful. Oh well, guess not all of we can be well at grammer
     
  27. Offline

    jthort

  28. Offline

    calebbfmv

    Lock please?
     
  29. Offline

    skore87

    Remind you of someone we know?
     
    calebbfmv likes this.
  30. Offline

    Necrodoom

    Locked since this thread is nothing more than throwing flames at each other and unofficial builds are not supported here.
     
Thread Status:
Not open for further replies.

Share This Page