NoDrop

Discussion in 'Archived: Plugin Requests' started by HyrulesLegend, Oct 25, 2012.

  1. Offline

    HyrulesLegend

    Plugin category: MECH/ADMN

    Suggested name: NoDrops

    What I want: I'd like a plugin that disables every item from dropping on-death by default, and has a config.yml file of items that do drop. Pretty simple explanation. :p


    Ideas for commands: No commands needed for this plugin.

    Ideas for permissions: None.

    When I'd like it by: Take, your, time.
     
  2. Offline

    Hoolean

    Max_The_Link_Fan

    Not being a meany-meany-mo-feany here, of course anyone can request, but don't you make plugins?
     
  3. Offline

    Cassyx8

    Attached Files:

  4. Offline

    Greennose120

    which items should not be dropped?
     
  5. Offline

    HyrulesLegend

    Not sure How I would code this, :p
     
  6. Offline

    cman1885

  7. Offline

    Woobie

    Me: *Done!*
    *looks at the request 1 moar time*
    "dropping on death "
    Me: :'(
     
  8. Offline

    PogoStick29

    If no one else will do it, I will :3
    Or, Max_The_Link_Fan, I could teach you how.
     
  9. Offline

    HyrulesLegend

    And a config for items that DO drop-on-death. :eek:

    PogoStick29 could you do this? ;o

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

    RumbleIV

    http://dev.bukkit.org/server-mods/nodrop-bukkitdevuser/
    This might be similar or exactly what you are looking for.
     
  11. Offline

    HyrulesLegend

  12. Offline

    Greennose120

    what should be the difference to this plugin?
     
  13. Offline

    PogoStick29

    Sure, if no one else gets it before I get home. Once I'm done, I'll post the source code and probably post it on BukkitDev :)
     
  14. Offline

    HyrulesLegend

    A config of dropped items, disabled drop ONLY on death.
     
  15. Offline

    HyrulesLegend

  16. Offline

    calebbfmv

    If no one has done this yet, I have time to make it, but only this little plugin.
    I am currently swamped with requests so I will just add this to the list

    EDIT:

    Done with it, but I want to see someone else's
     
  17. Offline

    PogoStick29

    calebbfmv Max_The_Link_Fan
    Here's mine. I threw it together in like 2 mins, not sure if it'll work.
    Code:
    package me.pogostick29.deathdropsadvanced;
     
    import java.util.List;
     
    import org.bukkit.event.EventHandler;
    import org.bukkit.event.Listener;
    import org.bukkit.event.entity.PlayerDeathEvent;
    import org.bukkit.inventory.ItemStack;
    import org.bukkit.plugin.java.JavaPlugin;
     
    public class Main extends JavaPlugin implements Listener {
     
        public void onEnable() {
            getServer().getPluginManager().registerEvents(this, this);
        }
     
        @EventHandler
        public void onPlayerDeath(PlayerDeathEvent e) {
            List<ItemStack> drops = e.getDrops();
            for (ItemStack item : drops) {
                if (!getConfig().getStringList("allowed").contains(item.getType().toString().toLowerCase())) {
                    drops.remove(item);
                }
            }
        }
    }
     
  18. Offline

    calebbfmv

    It won't.
    You aren't generating a config file or making some defaults :p
     
  19. Offline

    PogoStick29

    It still works, I just didn't add the default values. I'll do that now.

    EDIT: Here :p
    Code:
    package me.pogostick29.deathdropsadvanced;
     
    import java.util.List;
     
    import org.bukkit.event.EventHandler;
    import org.bukkit.event.Listener;
    import org.bukkit.event.entity.PlayerDeathEvent;
    import org.bukkit.inventory.ItemStack;
    import org.bukkit.plugin.java.JavaPlugin;
     
    public class Main extends JavaPlugin implements Listener {
     
        public void onEnable() {
            getServer().getPluginManager().registerEvents(this, this);
            getConfig().options().copyDefaults(true);
            saveConfig();
        }
       
        @EventHandler
        public void onPlayerDeath(PlayerDeathEvent e) {
            List<ItemStack> drops = e.getDrops();
            for (ItemStack item : drops) {
                if (!getConfig().getStringList("allowed").contains(item.getType().toString().toLowerCase())) {
                    drops.remove(item);
                }
            }
        }
    }
     
  20. Offline

    calebbfmv

    Do you have a default config like you do he plugin.yml? I always hard code mine
     
  21. Offline

    PogoStick29

    Usually yes. For this one, I will.
     
  22. Offline

    Cassyx8

    Well he never specified.
     
  23. Offline

    HyrulesLegend

    It's not what I asked for, actually :p
    I asked for a plugin to simply not drop players items, but drop players items that are in a config
    (ALL on death).
     

Share This Page