Issue
When using Server.Command() it gives an error of Command '' not found
Platform
It seems to be Carbon specific. Lot of plugins use this, for example SkillTree (which is where we found the issue). Below is a quick test plugin I made to reproduce the issue
using UnityEngine;
namespace Oxide.Plugins
{
[Info("Test", "mjmfighter", "1.0.0")]
[Description("Test plugin")]
public class Test : RustPlugin
{
private void OnServerInitialized()
{
permission.RegisterPermission("test.perm", this);
}
[ConsoleCommand("testaddperm")]
private void AddPerm(ConsoleSystem.Arg arg)
{
if (!arg.IsAdmin)
{
arg.ReplyWith("You do not have permission to use this command.");
return;
}
var player = arg.GetPlayerOrSleeper(0);
Puts($"Adding permission to {player.displayName}");
Server.Command($"c.grant user {player.UserIDString} test.perm");
}
[ConsoleCommand("testremoveperm")]
private void RemovePerm(ConsoleSystem.Arg arg)
{
if (!arg.IsAdmin)
{
arg.ReplyWith("You do not have permission to use this command.");
return;
}
var player = arg.GetPlayerOrSleeper(0);
Puts($"Revoking permission to {player.displayName}");
Server.Command($"c.revoke user {player.UserIDString} test.perm");
}
}
}
This is the error you get (along with me copy and pasting the command to show it works as expected when run manually):
testaddperm mjmfighter
[Test] Adding permission to mjmfighter -OML-
Command 'c.grant user 76561197999436353 test.perm' not found
c.grant user 76561197999436353 test.perm
Granted user 'mjmfighter -OML-' permission 'test.perm'