MaxStack - Do you have too many items on the ground? 2.6.2

This is just a utility tool to pickup those special items on the ground with the large amount.

  1. vk2gpz
    Tested Minecraft Versions:
    • 1.7
    • 1.8
    • 1.9
    • 1.10
    • 1.11
    • 1.12
    • 1.13
    • 1.14
    • 1.15
    Contributors:
    vk2gpz
    NOTE: use of maven repository and other dev related information is now available at its github page.

    Some of my plugins (such as MergedMob, TokenEnchant), which may drop a large amount of items on the ground. Based on users request, those plugins will be updated to have option to significantly reduce the items on the ground using a special dropped item.

    This plugin can now handle any dropped Items. There are three different merging mode:

    Code (Text):

    # MergeMode
    # MAX : only max stack items will be merged, (default)
    # MAX_VANILLA : items (including non max stack items) can only merged into a max stack item
    # ALL : merge all.
    MergeMode: MAX
     
    Items are merged into one dropped item, and when you pick it up merged items are expanded into your inventory (or other inventory such as a hopper). If expanded items do not fit into the inventory, the dropped item will be left on the ground but the number of merged item will be updated to reflect the remainder.

    This plugin provides the basic Item Pickup behaviour to handle those special items.

    The plugin comes with a command to test the feature. You can spawn an item and you can see how the item is actually representing a large amount of the material by picking it up. You can spawn an item as
    Code (Text):
    /maxstack spawn WOOL 3000
    , for instance.

    Code (Text):

    Messages:
      ErrorMsg: "&c[MaxStack] : Some error occured."
      StackMsg: "&a[MaxStack] : x%leftover% %item% still left"
      ToggleOnMsg: "&a[MaxStack] : You've turned on the left over message."
      ToggleOffMsg: "&a[MaxStack] : You've turned off the left over message."

    HelpMessages:
      banner:
        msg: "=== &e[&aMaxStack Commands List (%version%)&e] &r==="
      help:
        msg: "&a/maxstack help : displays this help menu."
      reload:
        msg: "&a/maxstack reload : reloads config file."
        permission: "maxstack.reload"
      debug:
        msg: "&a/maxstack debug <true|false> : turn on / off the debug mode."
        permission: "maxstack.debug"
      spawn:
        msg: "&a/maxstack spawn <material_type> <amount> : spawns an item with the specified amount. (this command is for testing)"
        permission: "maxstack.spawn"
      toggle:
        msg: "&a/maxstack toggle : toggles the leftover message in the chat."


    # default is LOW, you can have LOWEST, LOW, NORMAL, HIGH, HIGHEST or MONITOR
    # adjust these event priority if those event processes from this plugin
    # interfere with other plugins' event processes.
    EventPriorityMap:
      EntityPickupItemEvent: "LOWEST"
      InventoryPickupItemEvent: "LOWEST"
      PlayerPickupItemEvent: "LOWEST"

    # if this option is fale, this plugin will not handle picking up of special item on the ground.
    # if you have another plugin (such as VKAutoPickup, VKBackPack) which supports picking up of special item
    # you should set this option to false
    EntityPickup: true

    # if this option is a positive value, the plugin will try to "merge" the MaxStack item on the ground in the
    # specified radius.
    MergeSearchRadius: 3  # in blocks.

    # this option define how often this plugin will try to merge already spawned maxstack item on the ground.
    MergeInterval: 20      #in ticks.

    # if this option is true, regular items, which are not max stack item could also be considered for merging
    # @Removed.  Please use MergeMode: option instead.  IncludeVanillaItems: true == MergeMode: MAX_VANILLA
    #IncludeVanillaItems: false

    # MergeMode
    # MAX : only max stack items will be merged, (default)
    # MAX_VANILLA : items (including non max stack items) can only merged into a max stack item
    # ALL : merge all.
    MergeMode: MAX

    # if this option is "true", when a player looks at a dropped item, a private hologram will be displayed.
    LookToInspect: false

    NumberRegex: "([0-9]+)(X)"     #this corresponds to %number%X in CustomNameFormat
    CustomNameFormat: "&d%number%X &6%type%"
     

    APIs:
    Is you wish to utilise max stack items in your plugin, you can use publicly released APIs (whose javadoc is now included in the distributed .zip file).

    /**
    * This method will return true if the specified item is associated with ItemStack
    * object, which represents more than max stack size.
    *
    * @Param item The item object to be examined.
    * @Return true if the specified item is associated with ItemStack
    * object, which represents more than max stack size.
    */
    public static boolean isMaxStack(Item item)

    /**
    * This method will return the amount of ItemStack objects represented by this item.
    *
    * @Param item The item to be examined.
    * @Return the amount of ItemStack objects represented by this item.
    */
    public static int getAmount(Item item)

    /**
    * This method will return an array of ItemStack objects represented by the specified item.
    *
    * @Param item The item to be examined.
    * @Return An array of ItemStack objects represented by the specified item.
    */
    public static ItemStack[] getStacks(Item item)

    /**
    * This method will pickup as many itemstack objects as it can into the specified inventory.
    * Whatever left over will remain in the specifed item object.
    *
    * @Param item The item to be pickedup.
    * @Param inv The inventory to which the item stack objects are picked up.
    * @Return Item object to be left on the ground if all ItemStack objects were not picked up, otherwise null.
    */
    public static Item pickup(Item item, Inventory inv)

    /**
    * This method will drop an item at the specified location in natural fashion. If the amount
    * is greater than itemstack's max stack size, the dropped item will be a max stack item
    * representing more than max stack size ItemStack objects,
    *
    * @Param location The location to be dropped at
    * @Param itemstack The base ItemStack object to drop.
    * @Param amount The total number of ItemStack object to be dropped.
    * @Return The spawned (dropped) item representing the specifed amount of ItemStack objects.
    */
    public static Item dropItemNaturally(Location location, ItemStack itemstack, int amount)

    /**
    * This method will drop an item at the specified location. If the amount
    * is greater than itemstack's max stack size, the dropped item will be a max stack item
    * representing more than max stack size ItemStack objects,
    *
    * @Param location The location to be dropped at
    * @Param itemstack The base ItemStack object to drop.
    * @Param amount The total number of ItemStack object to be dropped.
    * @Return The spawned (dropped) item representing the specifed amount of ItemStack objects.
    */
    public static Item dropItem(Location location, ItemStack itemstack, int amount)
    CustomWorldYT and GabTM like this.