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

@ -11,7 +11,7 @@ namespace TShockAPI
{
public class TShock : TerrariaPlugin
{
TSPlayer[] players = new TSPlayer[Main.maxPlayers];
public static TSPlayer[] players = new TSPlayer[Main.maxPlayers];
public static string saveDir = "./tshock/";
@ -228,7 +228,7 @@ namespace TShockAPI
Main.player[who].hostile = true;
NetMessage.SendData(30, -1, -1, "", who);
}
if (Tools.IsAdmin(who) && ConfigurationManager.infiniteInvasion && !ConfigurationManager.startedInvasion)
if (TShock.players[who].IsAdmin() && ConfigurationManager.infiniteInvasion && !ConfigurationManager.startedInvasion)
{
StartInvasion();
}
@ -246,7 +246,7 @@ namespace TShockAPI
{
Commands.CommandArgs args = new Commands.CommandArgs(msg, x, y, ply);
var commands = commandList;
if (Tools.IsAdmin(ply))
if (TShock.players[ply].IsAdmin())
commands = admincommandList;
Commands.CommandDelegate command;