How to disable door keys?

As simple as that, tried craft controller and added the key ID (door.key) to the config but I still can craft it, also tried the console command.
Disabled the code lock and it worked (can't craft it), maybe because the door key isn't an item you can craft from inventory.
Doing this so I allow only one player per base for my solo server.

I'll be thankful for and suggestion.

I just glanced at the game code for crafting a key from key locks. It looks like it should be calling the CanCraft hook. Something like this should do the trick, though I have not tested it.

bool? CanCraft(ItemCrafter itemCrafter, ItemBlueprint bp, int amount)​
{
    if (bp.targetItem.shortname == "door.key")
        return false;

    return null;
}

 

In which file should I add this code?

You should make a plugin with this code.

I see, thank you for the help, hope someone can create it because it helps making the server solo without having to punish rule breakers.

tbh could add it to group limit ig? what you think

I did limited groups to 1, but players still can allow others to share base with them, the best solution I found is to disable the code lock and the ability to create keys.
It is also possible to limit 1 player per TC but that also solves half of the problem.

as ive said it doesnt block keys yet, but it could be a feature in group limit. should i add it?

Sorry I haven't thought you're talking about the Group Limit plugin, sure add the ability to block keys, such feature enforce team limits.