Fix client-side commands working when they shouldn't
This commit is contained in:
@@ -1956,8 +1956,8 @@ namespace Barotrauma
|
||||
#if DEBUG
|
||||
AddWarning($"You're not permitted to use the command \"{splitCommand[0].ToLowerInvariant()}\". Executing the command anyway because this is a debug build.");
|
||||
#else
|
||||
//ThrowError($"You're not permitted to use the command \"{splitCommand[0].ToLowerInvariant()}\"!");
|
||||
//return;
|
||||
ThrowError($"You're not permitted to use the command \"{splitCommand[0].ToLowerInvariant()}\"!");
|
||||
return;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@@ -388,6 +388,27 @@ namespace Barotrauma
|
||||
}
|
||||
|
||||
private List<DebugConsole.Command> luaAddedCommand = new List<DebugConsole.Command>();
|
||||
public IEnumerable<DebugConsole.Command> LuaAddedCommand { get { return luaAddedCommand; } }
|
||||
|
||||
public bool IsCustomCommandPermitted(string command)
|
||||
{
|
||||
DebugConsole.Command[] permitted = new DebugConsole.Command[]
|
||||
{
|
||||
DebugConsole.FindCommand("cl_reloadluacs"),
|
||||
DebugConsole.FindCommand("cl_lua"),
|
||||
DebugConsole.FindCommand("cl_cs"),
|
||||
};
|
||||
|
||||
foreach (var consoleCommand in LuaAddedCommand.Concat(permitted.AsEnumerable()))
|
||||
{
|
||||
if (consoleCommand.names.Contains(command))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public void RemoveCommand(string name)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user