chestsort, sortsource and sortdest - Details, Permissions and Usage
Overview
Chest-sorting is probably the most complex beast included so far.
The theory is simple though:
One Chest, defined as SortSource gets filled with about anything a player finds in their inventory that needs to be sorted into that players storage room.
This storage room is defined as SortDestination.
When the command to actually do the sorting is issued, KLH takes each ItemStack contained in SortSource and check the Chests in SortDestination whether they already contain an ItemStack of the same material. If so, as many Items as possible are transferred to that chest. Remaining Items are matched against the other chests and placed when possible - or put back into SortSource when not.
/chestsort
The actual sorting is the easiest part of it: /chestsort [SourceName] [DestinationName] does the trick. Source and Destination need to have the same owner, and the issuing user needs to be granted kittyslilhelpers.chestsort. No permissions are checked when issued by a CommandBlock.
It gets a bit more complicated when all these Sources and Destinations are being set up - there's two commands to do that:
/sortsource
Everything to get your sources up and running. To execute it, a user needs to be granted kittyslilhelpers.sortsource
Just issueing /sortsource or /sortsource help will display a brief overview, and here's what else is possible:
/sortsource add [Name] Creates a SortSource with Name [Name] for the issuing player, located at the chest they are currently targeting.
/sortsource update [Name] Updates an existing SortSource - Again, you need to target the chest to be used as SortSource when issuing the command.
/sortsource setowner [Name] [PlayerName or UUID] Changes the owner of SortSource [Name] to the Player identified by [PlayerName or UUID].
/sortsource delete [Name] Removes SortSource [Name].
/sortsource list Lists all known SortSources as well as their Location and Owner.
All options that modify an existing SortSource can only be used by the player owning it or an operator.
/sortdest
Very much the same as /sortsource, /sortdest allows players to manage SortDestinations - if they are granted kittyslilhelpers.sortdest. The options are very similar, too:
/sortdest or /sortdest help shows a short overview
/sortdest add [Name] [X1] [Y1] [Z1] [X2] [Y2] [Z2] defines the a new SortDestination with name [Name] in the range [X1]/[Y1]/[Z1] - [X2]/[Y2]/[Z2], owned by the player who issued the command.
/sortdest update [Name] [X1] [Y1] [Z1] [X2] [Y2] [Z2] updates the range of SortDestination [Name] to the new coordinates.
/sortdest setowner [Name] [PlayerName or UUID] changes the owner,
/sortdest list displays known SortDestinations with their ranges and owners, and finally
/sortdest info [Name] shows some information on a specific SortDestination.
Again, to use options that modify an existing SortDestination, a player needs to own it or be an operator.
So, imagine we have a little storage room like this:

Pointing our crosshair to the Chest labelled "Drop Stuff Here", we issue /sortsource add MySortSource. The server comes back to us with
![]()
Using the Debug Screen, we find out the range of our Storage Room - it's roughly [35/64/10] - [48/68/15]. We don't need to be too picky here - Chests defined as SortSources will not be used as targets. So we issue /sortdest add MySortDest 35 64 10 48 68 15:
![]()
All we need to do now to keep our storage room nice and tidy is to drop everything where it says "Drop Stuff Here":
![]()
Then we issue /chestsort MySortSource MySortDest (Or have it done automatically with a CommandBlock, when the Source is Trapped Chest ;) ), and - magic:
![]()
Items that have no appropriate place in Destination remain within the (Source)chest, so nothing is lost. Well, that's about it for now ;)
Comments