I was able to hack NoEscape integration into the plugin to respect Raid/Combat block and block backpack access, but I don't want to maintain my own weird version indefinitely. Would <3 this ability in the main stream plugin.
Support for No Escape pluginSuggestion
private object CanAcceptItem(ItemContainer container, Item item)
{
if (!_config.UseBlacklist)
return null;
if (_backpacks.Values.Any(b => b.IsUnderlyingContainer(container)))
{
var player = item.GetOwnerPlayer();
if ((BasePlayer)player)
{
var success = NoEscape?.Call("IsBlocked", player);
if (success is bool && (bool)success)
{
PrintToChat(player, "<color=orange>Backpack cannot accept items while combat or raid blocked!</color>");
return ItemContainer.CanAcceptResult.CannotAccept;
}
}
}
// Is the Item blacklisted and the target container is a backpack?
if (_config.BlacklistedItems.Any(shortName => shortName == item.info.shortname) &&
_backpacks.Values.Any(b => b.IsUnderlyingContainer(container)))
return ItemContainer.CanAcceptResult.CannotAccept;
return null;
}
I feel like this is a quite specific way to have it work. Not everyone might want it to work that way.
Since Backpacks offers a "CanBackpackAcceptItem" hook (see https://umod.org/plugins/backpacks#hooks), I would recommend to make a simple third plugin which does this.
I think your most common consumers of this plugin are battlefield type servers where this is less of an issue. My hope was to see this as an option you could toggle in the config file, vs. hardcoding it in like me. But you make a good point - I hadn't considered the hooks, which looks like the right way to handle this.