Caching IsAdmin as to optimize load on file system

This commit is contained in:
Maverick Motherfucker 2011-06-02 21:59:33 -07:00
parent 79c0bddf5e
commit 818348a445
4 changed files with 22 additions and 9 deletions

View file

@ -5,10 +5,12 @@ using System.Text;
namespace TShockAPI
{
class TSPlayer
public class TSPlayer
{
public uint tileThreshold;
private int player;
private bool admin;
private bool adminSet;
public TSPlayer(int ply)
{
@ -19,5 +21,16 @@ namespace TShockAPI
{
return Terraria.Main.player[player];
}
public bool IsAdmin()
{
if (adminSet)
{
return admin;
}
admin = Tools.IsAdmin(player);
adminSet = true;
return admin;
}
}
}