[INACTIVE][ADMIN/GEN] DropEdit v1.4.4 - Get different drops when destroying blocks [818]

Discussion in 'Inactive/Unsupported Plugins' started by NuxlyStardust, Apr 1, 2011.

  1. Offline

    NuxlyStardust

    DropEdit - Get different drops when destroying blocks
    Version: v1.4.4 (05/21/2011)
    Tested on: 798


    This is my first plugin. It allows you to define what your players get when
    they destroy certain types of blocks with a given tool.

    A good use for it is to allow your players to get sponge or nether blocks
    without having to use portals.

    This plugin was inspired by Jerry's NetherBlocks. I wanted the ability to
    add more blocks without having to edit the code every time. If you only want to use blocks from the Nether on a server where it can't be accessed, I recommend you to use his plugin instead, which will be more lightweight as its use is more specific.

    I would like to thank sk89q for his help, and all of you for your support and for reporting bugs.

    Features:
    • Make anything drop from broken or burned blocks, or decaying leaves.
    • A random number of items can be dropped.
    • You can define what percentage of chance players have to get a certain item.
    • Support for wool color and dye type.
    • Support for Permissions.
    • Support for CraftbukkitUpToDate.
    • Compatible with WorldGuard.
    How to configure:
    All details are given on the Wiki. A sample config file is joined with the plugin.

    Example:
    Code:
    items:
        GlowstoneDust:
            id: 348
            min: 1
            max: 3
            chance : 100
            groups:
                - *
    
    break:
        '2':
            '284':
                - GlowstoneDust
    With this setup, if you destroy (break) a grass ('2') block with a
    gold shovel ('284'), you will always (chance: 100) get
    1 to 3 (min: 1; max: 3) of glowstone dust (id: 348).

    For each item, only the "id" key is required, all other are optionals.

    Event
    The event here is "break". You can also use "burn", and "decay". These last two don't require a tool, so the list of items must appear in the block's section.

    Event > Block
    The block here is '2'. You can set it to '*', to refer to any block.
    You can also restrict the event to certain damage value by separating the two values with a comma. For example, '35,11' is a blue wool block.

    Event > Tool
    If you set the tool to * (or '*', both will work), the specified item will be dropped regardless of the tool used to destroy the block.
    Just like with the block, you can set a damage value.

    Item > Durability
    "durability" is optional (Default: 1). It allows you to select the wool color of type of dye
    you want.

    Item > Groups
    "groups" is optional (Default: '*'). It allows to define custom drops that will apply only for given groups. You need the Permissions plugin for that. This feature has been tested on Permissions 2.5.5.
    If Permissions is not installed, this field will be ignored.
    A list is expected, so you should use the list notation (as showed in the example above) even if you want to specify only one group.

    Item > Message
    "message" is optional (Default: none). It allows you to define a message that will be sent to the player. I strongly recommend that you use it only for very rare items, and only for the "break" event. Otherwise, the chat will overflow with messages from the plugin.

    Download:
    Important: The configuration file structure has changed in v1.4.0, do not forget to update your config.yml file.

    Latest version - Source Code - Wiki
    Old versions: 1.4.3 - 1.4.2 - 1.4.1 - 1.4.0 - 1.3 - 1.2 - 1.1

    Permissions Plugin

    Getting help & reporting problems:
    I 'll be glad to help you if you're having difficulties using my plugin, just post your questions in this thread.
    I will be able to help you faster if you provide the following:
    • A precise description of your problem, and explanations on what you are trying to do.
    • Your config file (if it is too long to post here, use codepaste.net).
    • A quick list of the other plugins you are using. Certain problems can be caused by conflicts between plugins.
    • Any particular output of my plugin visible in the logs (exceptions or other messages).
    Before you post, make sure that you are using the latest version of my plugin. The most recent version is indicated at the top of this post. I can't offer support for old versions. Also check that you are using the Bukkit's latest recommended build.

    Known Issues:
    • You will not always get items from burning blocks because they may be destroyed by the fire.
    • Exceptions will be thrown if the Permissions config file doesn't contain any group. This is a problem in the Permissions plugin, I can't do anything about it.
    • You can't use it to get spawners when you break them. If you need to work with spawners, I suggest CreatureBox.
    Todo:
    I can't tell for sure when the next version will be available.
    • iConomy support
    Information for developers:
    Used events: BLOCK_BREAK (High), BLOCK_BURN (High), LEAVES_DECAY (High)
    This plugin will not cancel any event.
    You can simulate any of these events using the appropriate methods in the plugin class (breakBlock, burnBlock, blockDecays).

    Changelog:
    Version 1.4.4 (05/21/2011)
    • Added "message" parameter, be careful with it (Requested by m5k).
    Version 1.4.3 (05/05/2011)
    • Fixed potential compatibility problem with the next versions of WorldGuard (thanks to sk89q)
    • Added methods to the main plugin class to allow other plugins to interact with DropEdit.
    Version 1.4.2 (05/02/2011)
    • Fixed compatibility problems with WorldGuard (Reported by JacKlink01).
    • Fixed potential compatibility problems with other plugins, Residence is likely working now.
    Version 1.4.1 (04/27/2011)
    • Fixed a bug that caused the Minecraft client to crash if the config file contained invalid YAML syntax. Yes, really.
    • Works with 733.
    Version 1.4.0 (04/24/2011)
    • Changed config file structure.
    • Added leaves decay event.
    • Added ability to restrict blocks and tools to a certain damage value.
    • Added support for CraftbukkitUpToDate (will be ready soon).
    • Added properly working way to make multiple items drop for the same event.
    • Tested on 684. Works.
    • Created a Wiki: https://github.com/NuxlyStardust/DropEdit/wiki
    Version 1.3.4 (04/14/2011)
    • Updated for 677.
    Version 1.3.3 (04/12/2011)
    • Fixed a bug that prevented the plugin from dropping multiple items of the same type.
    Version 1.3.2 (04/09/2011)
    • Fixed a bug that caused undefined blocks not to drop anything. (Reported by DjinnRutger)
    Version 1.3.1 (04/08/2011)
    • Fixed a bug that caused the iron hoe not to get damage when used to break blocks.
    • Fixed a bug that prevented the plugin from dropping multiple different items.
    • The config file structure has changed ! Make sure to update your file. This structure is temporary and will be replaced by a more tidy one in the next version.
    Version 1.3.0 (04/05/2011)
    • Added ability to make block drops a certain item regardless of the tool used. (Idea by Andrew0085)
    • Added ability to restrict drops to more than one group. (Requested by Andrew0085 and SpyDaniel)
      • Replaced "group" by "groups" in the configuration, do not forget to update your file !
    Version 1.2.1 (04/03/2011)
    • Fixed a bug that caused hoes to be unbreakable. (Reported by Leemur)
    Version 1.2.0 (04/03/2011)
    • Added ability to restrict drops to certain groups. Uses the Permissions plugin.
    Version 1.1.0 (04/02/2011)
    • Added ability to select what item is dropped when a block is destroyed by fire.
    • Added support for dyes/wool color.
    Version 1.0.1 (04/02/2011)
    • Renamed project to DropEdit.
    Version 1.0.0 (04/01/2011)
    • First build.
    _______________________________
    [​IMG] - Thanks a lot for your support !
     
  2. Offline

    Andrew0085

    I don't think it is possible to add new items, I added a few things and now the plugin doesn't work. It works fine with the original config, but you can't change anything.
     
  3. Offline

    weasel5i2

    You do know that I already released a plugin named BlockEdit a fortnight prior to yours, right? ;) Its purpose is "View/Edit Block Type/Data" .. Wouldn't a name like "DropEdit" be slightly more appropriate for your plugin? ^_^ Great work though, I think you'll learn (as I did) that writing plugins and manipulating Bukkit is loads of fun! I started out knowing very little about the structure of how the API works..

    Best regards,
    Weasel5i2
     
  4. Offline

    NuxlyStardust

    I'm using it on my server with many more items.
    Can I see your config file? Remember you have to use spaces to align data, not tabs.


    Oh I'm sorry for this, when I created that project I was away from home with no internet connection so I couldn't check if the name was already used.
    Edit: Problem fixed :)
     
  5. Offline

    oxide7

    Can you use this to add drops of things cocoa beans, since those are based on damage values...?
    I wanted cocoa beans to drop when i burned leaves so i used this, im unable to test at the moment.

    Code:
    '18':
            '51':
                min: 1
                max: 4
                drop: 351.12
                chance: 8
    
     
  6. Offline

    NuxlyStardust

    This plugin works when you destroy a block by hitting it. With the config you posted, you'd have to artificially get a fire item and hit the leaves with.

    I can add a feature to handle a burning block, but you'd set the whole forest on fire when trying to get cocoa beans.

    Also, 351.12 would not work. I didn't think about possible variations of items, I gotta add that.
     
  7. Offline

    oxide7

    I figured the fire made from the flint and steel would destroy the leaves so id get the item. I thought the destruction of the block was player independent.

    I may just be asking for too much haha!
    If those two features can be added, great if not, no worries I'll pick a different way to get coca beans :)

    THANKS a ton for the quick reply too!
     
    NuxlyStardust likes this.
  8. Offline

    NuxlyStardust

    No, you're absolutely right that it shouldn't depend on the player. I might work on it tonight if I have the time :)

    I added those features to the plugin.
    Here's how you should configure it to get cocoa beans from burned leaves:

    Code:
    drops:
        '18':
            '51':
                min: 1
                max: 1
                drop: 351
                durability: 3
                chance: 100
    Again, it will not always work because the beans might burn sometimes.
    Be careful not to set the whole map on fire :p

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

    oxide7

    Awesome, thanks!
    How do i determine the drop number, what makes it 351? what if i want to add yellow wool later or something, is it something I can get to?

    NM, read the post up top. Thanks again.


    It works pretty well. Though the majority of the beans burns up in the fire. Not that that has anything to do on your part.
    Bump up the drop rate and enough should survive to be fair.

    So again, thanks for the mod. great stuff.

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

    NuxlyStardust

    Thanks for your words.
    Glad you like it, let me know if you need more features :)
     
  11. Offline

    m5k

    Excellent plugin. I was waiting for this for a while, since I have a quest to obtain apples, though they're only obtainable from dungeons. Now leaves drop apples. What I'd love you to add though, was permissions support. For example, I have a group called Farmers and I want only them to be able to harvest apples. Could make them get double drops from all plants too, or other cool things with permissions.
     
  12. Offline

    NuxlyStardust

    Done :) See the OP for details.
    Thanks for your comment, let me know if you need something else :)
     
    m5k likes this.
  13. Offline

    Leemur

    hey can you set to decrease durability of foe when attacks leaves?
     
  14. Offline

    NuxlyStardust

    Thanks, there was a bug here :)
    It's fixed now, I updated the download link.
     
  15. Offline

    Leemur

    good job for update.
    but here is a problem in compatibility with plugin LevelCraft:
    http://forums.bukkit.org/threads/mech-levelcraft-v2-5-1-a-leveling-up-rp-plugin-617.2261/

    A bug between LevelCraft plugin and DropEdit plugin: For example: in levelcraft I am level 1 at mining. To collect gold from gold_ore I need lvl 20 at mining. In DropEdit I setted to drop diamond item from gold_ore. In this case, if I destroy the gold_ore, I get the diamond item, from the plugin DropEdit, and warning message from the LevelCraft (you need lvl 20 to destroy gold_ore). the gold_ore returns back, but diamond item still remains in inventar. If you can - fix please it.
     
  16. Offline

    jorisk322

    Could you please make it so that we also can choose a chance for drop rate? Like I destroy a block, and I have a 100% chance it drops one item, but also a 10% chance it drops an extra item.

    EDIT:
    Forgot to mention, but I'm definitely going to use this on my server!
     
  17. Offline

    NuxlyStardust

    Thanks for your comment :)
    You can configure several drops with the same block/tool combination:

    Code:
    drops:
    
        '1':
            '285':
                group: '*'
                drop: 87
                durability: 0
                min: 1
                max: 1
                chance: 100
    
        '1':
            '285':
                group: '*'
                drop: 89
                durability: 0
                min: 1
                max: 1
                chance: 10
    With this setup, destroying stone with a golden pickaxe will always drop netherrack, and has a 10% chance of also dropping a glowstone block.
     
  18. Offline

    jorisk322

    Oh, that's nice! I expected it to totally freak out, because of double information.
    But is doesn't, so thanks!

    jorisk322
     
  19. Offline

    Andrew0085

    fixed my earlier problem.
    is there a way to make something drop something else no matter what you destroy it with? And a way to make a drop apply to to more than one group, but not all of them?
    Also, your changelog has incorrect dates.
    EDIT:
    Oh, your changelog is fine, i was just reading 1/4 as January 4th instead of April 1st.
     
  20. Offline

    SpyDaniel

    Code:
    drops:
    # mobspawner drops mobspawner
        '52':
            '*':
                group: '*'
                drop: 52
                durability: 0
                min: 1
                max: 1
                chance: 100
    Doesn't seem to work, any idea why? I want a mobspawner to drop a mobspawner when any group destroys it with any tool.
     
  21. Offline

    NuxlyStardust

    Hello, it's not currently possible, I'll be working on it, stay tuned :)

    And sorry for the dates, I used the wrong format, gotta fix that.

    This is because of the '*' as tool. It doesn't work yet but I'm gonna add that feature.
    Now keep in mind that it will always drop pig spawners.
    I don't recommend you to use my plugin for this, CreatureBox might be much better for working with spawners: http://forums.bukkit.org/threads/fi...ves-and-monsters-and-critters-oh-my-617.6856/

    I've added those features you guys requested. Let me know if you need anything else :)

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

    deadlock989

    Hi, this is great, love the idea that I can make gold tools more useful. But having some very erratic behaviour, wonder if you can advise.

    • Leaves * Anything -> Leaves Block - doesn't work
    • Leaves * Gold Sword -> Apple - works :)
    • Leaves * Gold Hoe -> Apple - doesn't work
    • Redstore Ore * Gold Pick -> Redstone Dust (2-4) + Glowstone Dust - only glowstone dust :confused:
    • Ice * Gold Sword -> Ice Block - doesn't work
    • Log * Gold Axe -> Multiple Log Blocks - works :)
    Code below:

    Code:
    drops:
    # leaves
        '18':
            '*':
                drop: 18
                chance: 20
    
    #  leaves * gold hoe -> apple
        '18':
            '294':
                drop: 260
                chance: 10
    
    #  leaves * gold sword -> apple
        '18':
            '283':
                drop: 260
                chance: 10
    
    # redstoneore * gold pick -> redstone + glowstonedust
        '73':
            '285':
                drop: 331
                min: 2
                max: 4
    
        '73':
            '285':
                drop: 348
    
    # same but glowing
        '74':
            '285':
                drop: 331
                min: 2
                max: 4
    
        '74':
            '285':
                drop: 348
    
    # crops * gold hoe -> more wheat
        '59':
            '294':
                drop: 296
                min: 1
                max: 3
    
    # log * gold axe -> more logs
        '17':
            '286':
                drop: 17
                min: 1
                max: 3
    
    # ice * gold sword -> ice block
        '79':
            '283':
                drop: 79
                chance: 33
    
     # clayblock * gold shovel -> more clay
        '82':
            '284':
                drop: 337
                min: 1
                max: 3
     
  23. Offline

    NuxlyStardust

    Wow this one was subtle :p
    It took me hours of debugging just to figure out that it has to do with the way YAML is parsed.
    I was wrong when I said it was possible to have multiple items dropping by making multiple categories with the same numbers. While my plugin can handle it, SnakeYAML only use the last entry so if you have three possibilities for the same block, the first ones will be omitted.

    Here's how to fix your problem:
    Avoid having multiple sections with the same block ID.
    Replace this:
    Code:
    drops:
        '18':
            '*':
                drop: 18
                chance: 10
        '18':
            '294':
                drop: 260
                chance: 100
        '18':
            '285':
                drop: 260
                chance: 10
    With this:

    Code:
    drops:
        '18':
            '*':
                drop: 18
                chance: 10
    
            '294':
                drop: 260
                chance: 100
    
            '285':
                drop: 260
                chance: 10
    And it will work.

    I'm gonna work on something so we can have multiple drops for the same block/tool combination.
    Thanks for pointing this out.
     
  24. Offline

    deadlock989

    That's brilliant. I'm happy for gold picks to produce only glowstone from redstone ore for now. Thanks!
     
  25. Offline

    Leemur

    Iron Hoe still not decrease durability
     
  26. Offline

    Steve Cole

    this plugin has an issue with Residence.
    if you change the drop of a block then residence doesn't prevent that block from being destroyed. I already informed the Residence Dev about this and asked if they could look into it but if you could look into it too or help them that would be great as I really want to use this plugin but if it doesn't work with residence then i can't and that is disappointing.
     
  27. Offline

    Leemur

    how I need to write if I want to drop from mining gold ore, with gold pickaxe 50% 1-2 gold, and 50% 1-2 iron?
     
  28. Offline

    NuxlyStardust

    I'm gonna take a look at this problem, surely has something to do with the priority. I'm gonna see about this hoe problem too, thank you both for reporting those problems :)

    Unfortunately this is not currently possible due to the problem I found yesterday, I'll be working on this tonight or tomorrow, stay tuned :)
     
  29. Offline

    Steve Cole

    I couldn't get breaking one item with one tool to drop two different items, and for the love of god don't try to separate drops with a "," crashed the clients hard until i restored the map from a backup.
     
  30. Offline

    NuxlyStardust

    Really? Wow... Sorry for this, I'm gonna try and find what's wrong.
     

Share This Page