Wrong message being returned for no permissionSolved

The "/lights" command does not return the correct language data when a player does not have permission. No matter what the "nopermission" language is set to in the lang/en/LightsOn.json file, the plugin will still return this message:

You do not have permission to use the command 'lights'!

Change 1 - starting on line 382:

permission.RegisterPermission(perm_freelights,this);

 

Suggested changes:

permission.RegisterPermission(perm_lightson,this);
permission.RegisterPermission(perm_freelights,this);



Change 2 - starting on line 1601:

		[Command("lights"), Permission(perm_lightson)]
		private void ChatCommandlo(IPlayer player, string cmd, string[] args)
		{
			bool   state		= false;
			string statestring	= null;
			string prefabName	= null;


Suggested changes:

		[Command("lights")]
		private void ChatCommandlo(IPlayer player, string cmd, string[] args)
		{
			if (!permission.UserHasPermission(player.Id, perm_lightson))
			{
				player.Message(String.Concat(Lang("prefix", player.Id), Lang("nopermission", player.Id)));
				return;
			}

			bool   state		= false;
			string statestring	= null;
			string prefabName	= null;

 

These new lines of code will allow the plugin to return the correct language file messages while still maintaining all of the original function and intended permissions. I took the liberty of patching it on my end already, but please do feel free to use this for the next released version, as I am sure other server owners would appreciate it as well. Cheers mspeedie!

I will do a review of language support based on this good feedback. Thank you for letting me know and being extra nice and giving a code example.
Awesome. I will keep my eyes open for the next version. +1 <3
Locked automatically