GeorgH93 / Minepacks

Free and reliable backpack plugin for Bukkit/Spigot/Paper
https://www.spigotmc.org/resources/19286/
GNU General Public License v3.0
170 stars 75 forks source link

Pickup item collection toggle command #234

Closed MartenM closed 1 year ago

MartenM commented 1 year ago

This PR adds the functionality where people can toggle on/off the automatic pickup feature.

Relevant config section change:

# Controls for the auto pickup on full inventory function
FullInventory:
  # If items should be collected to the backpack if the players inventory is full.
  # This is also the default if 'IsToggleAllowed' is enabled.
  CollectItems: false
  # Interval in seconds how often items around the player should be collected, increase it if it lags the server
  CheckInterval: 1
  # Radius in which items get collected, in meter/blocks, allow decimals
  CollectRadius: 1.5
  # If this feature may be toggled.
  IsToggleAllowed: false

Permission added:

  backpack.fullpickup.toggle:
    description: Allows the player to toggle the automatic pickup feature.
    default: true

Either backpack.fullpickup or backpack.fullpickup.toggle is required for the item collector to work.

Additionally, this PR removes a bit of nested code in the ItemsCollector. Changes have been tested, but probably require additional testing from someone else.

Kind of out of the blue this PR, but maybe it's of use.

MartenM commented 1 year ago

Closes: #199

GeorgH93 commented 1 year ago

Thanks for sharing