Permalink
Browse files

Simplified code for .IsAdmin check.

  • Loading branch information...
1 parent d498e02 commit ab6fb3f004cb1261984c93639720a40c1671ff33 @cartman-2000 cartman-2000 committed Jul 30, 2015
Showing with 11 additions and 14 deletions.
  1. +11 −14 CommandShop.cs
View
@@ -55,17 +55,11 @@ public List<string> Permissions
public void Execute(IRocketPlayer caller, string[] msg)
{
bool console = (caller is ConsolePlayer);
- UnturnedPlayer playerid = null;
- if (!console)
- {
- playerid = (UnturnedPlayer)caller;
- }
string[] permnames = { "shop.*", "shop.add", "shop.rem", "shop.chng", "shop.buy" };
bool[] perms = { false, false, false, false, false };
bool anyuse = false;
string message;
- List<string> permlist = (console) ? new List<string>() : caller.GetPermissions();
- foreach (string s in permlist)
+ foreach (string s in caller.GetPermissions())
{
switch (s)
{
@@ -99,14 +93,17 @@ public void Execute(IRocketPlayer caller, string[] msg)
break;
}
}
- if (console || playerid.IsAdmin)
+ if (!console)
{
- perms[0] = true;
- perms[1] = true;
- perms[2] = true;
- perms[3] = true;
- perms[4] = true;
- anyuse = true;
+ if (((UnturnedPlayer)caller).IsAdmin)
+ {
+ perms[0] = true;
+ perms[1] = true;
+ perms[2] = true;
+ perms[3] = true;
+ perms[4] = true;
+ anyuse = true;
+ }
}
if (!anyuse)
{

0 comments on commit ab6fb3f

Please sign in to comment.