Open decaprime opened 2 years ago
While we're at it, how about support for manipulating any BepInEx.Configuration
right out of the box. For example with LeadAHorseToWater Settings you could have some attribute or method to register the mods config command where like the above example you could then set up .horse config set DistanceRequired 12
.
As this with above, these commands themselves should be configurable because I could readily imagine not trusting just anyone with adminauth on the server to be able to manipulate server config files.
I want to be able to tag a command with role(s) which can then be assigned to users. Ideally I'd like to have it somewhat configurable for mod users to manage, but want to be able to set up some general sensible defaults to start with.
adminOnly: true
) to be able to give themselves permission/reset permissions (as you alluded to above)admin
contains poweruser
contains user
)Something like this would be good:
[CommandGroup("horse")]
public class HorseCommands
{
[Command("whistle", description:"Sets the horse to you")]
[CommandRole("user")]
public void Whistle(ICommandCtx ctx){/*...*/}
[Command("whistle", description:"Sets the horse to you")]
[CommandRole("admin")]
[CommandRole("poweruser")]
public void AdminWhistle(ICommandCtx ctx){/*...*/}
}
Currently, I am using a middleware in XPRising to manager permissions there. Middleware basically needs to have access to a database of users to "privilege" level and commands to "privilege" level and just compares the the number. This change would check to ensure that a user has the required role instead of some arbitrary number. I would expect that VCF would store files/database to manage the permissions so I don't have to manage basically the same config in every mod that I use this in.
It would also be great to have something that will generate a Commands.md
file from the mod. I have some code that generates this: https://github.com/aontas/XPRising/blob/main/Command.md
Perhaps this option of adding configuration to commands will work. https://github.com/Rianaid/VampireCommandFramework/commit/bf26369d755327f6c291805d55cb34a5e4f26c32
That just seems to bind the configuration for the command to a file? I'm not sure that is what I am after.
That just seems to bind the configuration for the command to a file? I'm not sure that is what I am after.
Yes, this is for setting up commands. I just wanted to add this setting as stated at the beginning of the topic. I don’t understand how Middleware works, so I can’t yet offer a solution to your problem. I have roles in another solution but it is not compatible with VCF. I'm currently trying to figure out how to merge them together and see what Deca says.
Server operators will want to configure and modify aspects of VCF. Some simple examples are: Disabling a command, changing the adminOnly status of a command, or adding an alias. You could imagine more complete features like managing middleware, remapping to resolve conflicts, localizing commands, and updating more contextualized details/usage.
Simple worked example
Given this class from upcoming 0.6 release of LeadAHorseToWater
You should be able to canonically refer to this command as
horse.whistle
.Let's say you want to set this to be a public command you could either run something like:
or in a file like
vcf.cfg
Middleware
This will likely be split into it's own issue but ultimately could be handled by this system. Some considerations:
int priority
value where-1
is aliased to disabled