Inactive [MECH] Stackable 0.5.1 - Control the stackability of any item [766]

Discussion in 'Inactive/Unsupported Plugins' started by DjDCH, Jan 18, 2011.

  1. Offline

    DjDCH

    Hello everybody,

    Since I started this topic to request a plugin who make sign stackable, I decide to make this plugin it myself. So, this is it!

    Stackable - Version 0.5.1

    This plugin provide you the ability to choose the stack size of any item in the game. You have the possibility to increase a stack size, reduce it or even disable it. Also, set a stack size to zero removed completely any stack of this item from the inventory.

    How to install:
    The only thing you need to do is download the zip containing the jar and unzip it in the plugins directory.

    How to configure:
    If you want to configure this plugin, edit the stackable.properties inside the directory Stackable, which is inside the plugins directory. You may want to remove or add item. Just use the enum name (from the class Material of Bukkit) or the item ID for the property name and the stack size for the property value. Any undefined item in the configuration file will use its default stack size value. For the items group, they are all listed in the default config file. You may want to remove it or edit the stack size value of any items group. Notice that define a item stack size who is contains in a items group will overwrite the value of the items group.

    How to use:
    While the proper events that I need are not implemented yet, you will need to use the command /stackable (or the aliases /s or /stack) to rebuild your item stacks (automatically rebuild inside your inventory) or the rebuild the chest content that you are aiming at. If your inventory or the chest become filled at any moment during the process, all supplementary item will be dropped in front of you/chest.

    Stack Protection feature:
    DeNarr make me notice that stacked item can be lost when using it. This is applying to item that is normally unstackable. In fact, these items weren't design to be used when stacked. So, I have come with this idea, to make something to protect stacks from being lost. This feature will split any stack of tools, weapons, buckets and soup when they are used. Notice that buckets will always be drop since a minecraft bug prevent me from adding the splited stack to the inventory. Notice also that the Stack Protection will not always working for tools and weapons when damaging a entity.

    Pickup event rebuilded:
    With this new update, the pickup event is now properly handled. When you will pickup an item, it will be added to any existent stack while respecting the stack size values from the config file.

    Todo:
    * Todo, etc. on my redmine
    * Add a configuration file
    * Re-organize configuration file
    * Re-organize source code
    * Implement all event hooks
    * Improve server log
    * Add sources and Javadoc
    * Add items group
    * Add Stack Protection feature

    Default configuration file:
    Code:
    # Enable debug print in game
    enable-debug-print=false
    
    # Tools items group. (Shovels, Pickaxes, Axes, Hoes and Fishing Rod)
    @tools=1
    
    # Weapons items group. (Swords and Bow)
    @weapons=1
    
    # Armors items group. (Helmets, Chestplates, Leggings and Boots)
    @armors=64
    
    # Foods items group. (Apple, Mushroom Soup, Bread, Raw Porkchop, Cooked Porkchop, Golden Apple, Raw Fish, Cooked Fish and Cake)
    @foods=32
    
    # Vehicles items group. (Boat and Minecarts)
    @vehicles=32
    
    # Sign
    sign=64
    
    # Wooden Door and Iron Door
    wood_door=64
    iron_door=64
    
    # Wool
    wool=32
    
    # Empty bucket
    bucket=16
    
    # Storage Minecart and Powered Minecart
    storage_minecart=16
    powered_minecart=16
    

    Changelog:
    See changelog (open)
    Code:
    Stackable - Version 0.5.1
    ----------------------------
        * Build with Bukkit #681
        * Tested with CraftBukkit #766
        
        Minor features changes
        -----------------------
        * Armors is now the stacks group for armor-like items and will replace amors stacks group
        * Amors stacks group now is deprecated and will be remove permantly in the next version
        
        Bug fixes/development issues
        -----------------------------
        * Fix code for the new Bukkit version
        
        Know bug
        ---------
        * Double chest are not supported
        * When using a bucket on a triggerable block, both event are execute
        * Mushroom Soup: http://getsatisfaction.com/mojang/topics/no_bowl_from_mushroom_soup
    
    Stackable - Version 0.5
    ----------------------------
        * Build with Bukkit #652
        * Tested with CraftBukkit #670
        
        Major features changes
        -----------------------
        * Pickup event rebuilded
        * Chest inventory can be rebuilded by aiming it when using the /stackable command
        
        Minor features changes
        -----------------------
        * Add aliases /s and /stack for /stackable
        
        Bug fixes/development issues
        -----------------------------
        * Fix code for the new Bukkit version
        
        Know bug
        ---------
        * Double chest are not supported
        * When using a bucket on a triggerable block, both event are execute
        * Mushroom Soup: http://getsatisfaction.com/mojang/topics/no_bowl_from_mushroom_soup
    
    Stackable - Version 0.4.6
    ----------------------------
        * Build with Bukkit #417
        * Tested with CraftBukkit #455
        
        Bug fixes/development issues
        -----------------------------
        * Fix code for the new Bukkit version
        
        Know bug
        ---------
        * Mushroom Soup: http://getsatisfaction.com/mojang/topics/no_bowl_from_mushroom_soup
    
    Stackable - Version 0.4.5
    ----------------------------
        * Build with Bukkit #412
        * Tested with CraftBukkit #432
        
        Bug fixes/development issues
        -----------------------------
        * A lot of fix code for the new Bukkit version
        
        Know bug
        ---------
        * Mushroom Soup: http://getsatisfaction.com/mojang/topics/no_bowl_from_mushroom_soup
    
    Stackable - Version 0.4.4
    ----------------------------
        * Build with Bukkit #144
        * Tested with CraftBukkit #323
        
        Major features changes
        -----------------------
        * Added Stack Protection feature
        
        Minor features changes
        -----------------------
        * Switch to new onCommand method
        * Property enable-short-command is now unused
        
        Bug fixes/development issues
        -----------------------------
        * Fix code for the new Bukkit version
        
        Know bug
        ---------
        * Mushroom Soup: http://getsatisfaction.com/mojang/topics/no_bowl_from_mushroom_soup
        * Stack protection is sometime buggin
    
    Stackable - Version 0.4.3
    ----------------------------
        * Build with Bukkit #102
        * Tested with CraftBukkit #210
        
        Bug fixes/development issues
        -----------------------------
        * Fix code for the new Bukkit version
    
    Stackable - Version 0.4.2
    ----------------------------
        * Build with Bukkit #82
        * Tested with CraftBukkit #161
        
        Minor features changes
        -----------------------
        * Code design improved
        
        Bug fixes/development issues
        -----------------------------
        * Forgot to add bow to the weapon items group
    
    Stackable - Version 0.4.1
    ----------------------------
        * Build with Bukkit #71
        * Tested with CraftBukkit #135
        
        Bug fixes/development issues
        -----------------------------
        * Properly disable the plugin when initialization error occurred
        * Forgot to add fish to the food items group
    
    Stackable - Version 0.4
    ----------------------------
        * Build with Bukkit #68
        * Tested with CraftBukkit #128
        
        Major features changes
        -----------------------
        * Add five general items group
        * Sources now available.
        
        Minor features changes
        -----------------------
        * Default configuration file update
        * Javadoc added to all source files
        
        Bug fixes/development issues
        -----------------------------
        * Made damaged tools unestackable to avoid auto repared tools
        * MaterialData is now keep for Wools and Dyes
    
    Stackable - Version 0.3.1
    ----------------------------
        * Build with Bukkit #57
        * Tested with CraftBukkit #89
        
        Bug fixes/development issues
        -----------------------------
        * Forgot to update the default configuration file
    
    Stackable - Version 0.3
    ----------------------------
        * Build with Bukkit #57
        * Tested with CraftBukkit #89
        
        Major features changes
        -----------------------
        * Configuration file completely redesigned
        * Possibility to choose the stack size
        * Possibility to limit the stackability of already stackable item
        * Item groups removed
        
        Minor features changes
        -----------------------
        * Server log improved
        * Code design improved
        
        Bug fixes/development issues
        -----------------------------
        * Stability improved
    
    Stackable - Version 0.2
    ----------------------------
        * Build with Bukkit #56
        * Tested with CraftBukkit #86
        
        Major features changes
        -----------------------
        * Added configuration file 
        * Added groups of item stack
        
        Minor features changes
        -----------------------
        * Server log improved
    
    Stackable - Version 0.1
    ----------------------------
        * First release
        * Build with Bukkit #56
        * Tested with CraftBukkit #80
        
        Major features changes
        -----------------------
        * Added /stackable command
        * Sign, Wooden door and Iron door are now stackable

    Download Stackable Version 0.5.1 (zip)
    Download Stackable sources version 0.5.1
    Thanks to you for supporting my plugin ! ;P
     
    wassilij, Jef Elrod, harakiwi and 2 others like this.
  2. Offline

    digidi

    Very nice plugin!:)
    Could you please update this plugin to 1.0.0?
    I want to stack bottles
    Why dont you change all the items?
    Like this
    ID Stack
    1 = 64
    2 = 64
     
  3. Offline

    Strebelschneck

    i want to stack all potions, is that possible?
     
  4. Offline

    Neillithan

    Is this plugin still active? If not, can someone take over and release an updated version of this so that it works with Minecraft 1.0.0?

    Thanks,
    -Neil
     
  5. Offline

    Celtic Minstrel

    If no-one else ever does, I'll maybe remake this plugin once the inventory hooks are in Bukkit. When that'll be, I'm not sure. Maybe in another month or two, with luck.
     
    Darkhand81 likes this.
  6. Offline

    Muchoman1

    will this actually work with new bukkit (1.0.0/1.1.0)?

    cause this is needed for my server
     
  7. Offline

    Nuinbot

    I would like to see this updated or redone, so if you work on it please let me know. I just want to add stacking capabilites to signs, doors, etc. Thanks!
     
  8. Offline

    anthonyc39

    is there a permission so only i, the admin, can use it?
     
  9. Offline

    Celtic Minstrel

    I'll make this as part of the testing of the new inventory hooks; it shouldn't be too hard (especially compared to some of the other things that will need to be tested <_< ).

    As for when we'll get inventory hooks... I suspect the next recommended build is a good bet, or possibly the one after the next one.
     
  10. Offline

    Epyk

    Highly needed for my server,please remake!
    Thanks
     
  11. Offline

    ray landers

    how about in the config file an option to just have EVERYTHING stack.
    like this;

    *=64

    or maybe could just go for a Boolean value like this;

    stack all items to max stack value = true


    and this way there is no need to list EVERY ITEM in the game to get them all to stack.
     
  12. Offline

    haveric

    Seeing as it didn't look like anybody had started working on a replacement for this, I went ahead and started it last night. I have the basic functionality down of being able to set all items to one max and overriding that number for individual items. I'll try to work on it some more to get the other features into it. You can find the latest version here: https://github.com/haveric/StackableItems/tree/master/versions/latest I also provided an example config that sets the max value for all items to 10 and overrides snowballs to be 100.

    There is one problem that I can't figure out though, so I'm hoping someone can take a look at my code, maybe @Celtic_Minstrel seeing as he offered to work on this before? The problem is any amount higher than the default max value does not like to stack properly and in order to make it work, it will create a phantom piece of dirt on the cursor. It still works, but the phantom item is annoying.

    Any help would be appreciated,
    Haveric
     
  13. Offline

    Celtic Minstrel

    Scheduling an inventory update might fix that, something like this:
    Code:
    private void scheduleUpdate(final Player player) {
      Bukkit.getScheduler().scheduleSyncDelayedTask(
        @Override public void run() {
          player.updateInventory();
        }
      );
    }
    
    That's written from memory, so there might be errors, but I think that's the basic idea of what you would need to do at the end of your click handler.

    EDIT: Oh, instead of event.setCancelled(true) you should probably use event.setResult(Result.ALLOW). Also you'll only need the above code in the cases where you do that.
     
  14. Offline

    haveric

    Thanks! The scheduleUpdate doesn't seem to do anything extra, but I never combined the setResult(Result.ALLOW) with setting the cursor to AIR before. That fixed it.

    Edit: For anyone that wants to try it, I've added it to BukkitDev: http://dev.bukkit.org/server-mods/stackableitems/

    Note that there are several bugs/improvements that still need to be made, such as chests destroying any items above 64, so it's not quite complete, but please check it out anyway.

    Also, if anybody wants to contribute, all of the code is on github and I'm open to suggestions for improvements.
     
  15. Offline

    Celtic Minstrel

    It's possible the scheduleUpdate isn't necessary; I'm not really sure. It shouldn't hurt, though. It's supposed to fix issues where the client doesn't correctly update in general, but not needing it within the click event wouldn't surprise me (since once the event is processed it normally informs the client of the result anyway... but I think I've experienced this not working properly sometimes).
     
  16. Offline

    jycs

    No alternative of this plugin?
     
  17. Offline

    Celtic Minstrel

    I'm pretty sure there is one somewhere. Try searching?
     
  18. Offline

    Asap477

    Perrmissions?
     
  19. Offline

    TheLord

    Hay,

    can you please update your plugin???
     
  20. Offline

    caseif

    Umm... they added this feature in 1.3...
     
  21. Offline

    Epixauce

    Could you get permission support for this? I would like it to be a perk on my server to loyal players.
     
  22. Offline

    Celtic Minstrel

    Since when?
     

Share This Page