Suggestion/Enhancement: Add a /searchchest #113

Closed
opened 2019-10-01 00:29:23 -04:00 by Kobe024 · 3 comments
Kobe024 commented 2019-10-01 00:29:23 -04:00 (Migrated from github.com)

Is there any possibility of adding a /seachchest which works similar to /searchinv and /seachender? Seems like it would fit in nicely and complete the set. Or even a /searchcontainer which would include things like hoppers/droppers/dispensers etc...

While I am not a plugin dev myself, it seems you would have to loop through each chest placed in a world and check if it contains the item like you do for the other 2 search commands. If matches are found you could include the co-ords of the chest so staff could tp to it and manually check who owns it via coreprotect or lwc or you could maybe build in supoort for lwc and coreprotect so it automatically shows who placed it or the lwc owner as well as the chest co-ords when a match is found.

I will try this myself since I've been wanting to get into plugin development but I thought I should suggest it so that it could be done properly lol

Is there any possibility of adding a /seachchest which works similar to /searchinv and /seachender? Seems like it would fit in nicely and complete the set. Or even a /searchcontainer which would include things like hoppers/droppers/dispensers etc... While I am not a plugin dev myself, it seems you would have to loop through each chest placed in a world and check if it contains the item like you do for the other 2 search commands. If matches are found you could include the co-ords of the chest so staff could tp to it and manually check who owns it via coreprotect or lwc or you could maybe build in supoort for lwc and coreprotect so it automatically shows who placed it or the lwc owner as well as the chest co-ords when a match is found. I will try this myself since I've been wanting to get into plugin development but I thought I should suggest it so that it could be done properly lol
RoboMWM commented 2019-10-01 01:26:18 -04:00 (Migrated from github.com)

it seems you would have to loop through each chest placed in a world

that's the problem.

> it seems you would have to loop through each chest placed in a world that's the problem.
Kobe024 commented 2019-10-01 03:40:25 -04:00 (Migrated from github.com)

Would adding a radius help in any way? Example "/searchchest radius item" so if you are near a players storage area, you can use /searchchest 20 cobble and it will look in any chests within that radius? Maybe have a configurable default radius in case a radius is not specified?

Would adding a radius help in any way? Example "/searchchest radius item" so if you are near a players storage area, you can use /searchchest 20 cobble and it will look in any chests within that radius? Maybe have a configurable default radius in case a radius is not specified?
Jikoo commented 2019-10-01 08:20:05 -04:00 (Migrated from github.com)

The best way to go about it would be iterating through tile entities. A radius would be hugely helpful for performance, but for simplicity's sake I would make it a chunk radius.

Entire world check:

// Nonfunctional: A lot of the returns are arrays, not collections, but I don't remember which.
world.getLoadedChunks().flatmap(Chunk::getTileEntities).forEach(tile -> {
    if (!(tile instanceof InventoryHolder)) {
       return;
    }
    Inventory inventory = ((InventoryHolder) tile).getInventory();
    // Handle search
}

I guess it would fit in with OpenInv's existing functions, I'm not opposed to it. I'm continuously surprised by how many people use the search commands regularly.

The best way to go about it would be iterating through tile entities. A radius would be hugely helpful for performance, but for simplicity's sake I would make it a chunk radius. Entire world check: ```Java // Nonfunctional: A lot of the returns are arrays, not collections, but I don't remember which. world.getLoadedChunks().flatmap(Chunk::getTileEntities).forEach(tile -> { if (!(tile instanceof InventoryHolder)) { return; } Inventory inventory = ((InventoryHolder) tile).getInventory(); // Handle search } ``` I guess it would fit in with OpenInv's existing functions, I'm not opposed to it. I'm continuously surprised by how many people use the search commands regularly.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: minster586/OpenInv#113
No description provided.