Merge pull request #28 from Mineplex-LLC/bugfix/admin-command-npe

Fix NPE in AdminCommand from IncognitoManager being null
This commit is contained in:
Shaun Bennett 2016-04-22 10:54:20 +10:00
commit 86df07123c
2 changed files with 8 additions and 7 deletions

View File

@ -94,7 +94,7 @@ public class MessageManager extends MiniClientPlugin<ClientMessage>
addCommand(new AnnounceCommand(this)); addCommand(new AnnounceCommand(this));
//addCommand(new GlobalCommand(this)); //addCommand(new GlobalCommand(this));
addCommand(new AdminCommand(this, _incognitoManager)); addCommand(new AdminCommand(this));
} }
@Override @Override
@ -616,4 +616,9 @@ public class MessageManager extends MiniClientPlugin<ClientMessage>
} }
} }
} }
public IncognitoManager getIncognitoManager()
{
return _incognitoManager;
}
} }

View File

@ -14,13 +14,9 @@ import mineplex.core.message.MessageManager;
public class AdminCommand extends CommandBase<MessageManager> public class AdminCommand extends CommandBase<MessageManager>
{ {
private IncognitoManager _incognitoManager; public AdminCommand(MessageManager plugin)
public AdminCommand(MessageManager plugin, IncognitoManager incognitoManager)
{ {
super(plugin, Rank.ALL, "a","admin"); super(plugin, Rank.ALL, "a","admin");
_incognitoManager = incognitoManager;
} }
@Override @Override
@ -55,7 +51,7 @@ public class AdminCommand extends CommandBase<MessageManager>
{ {
if (Plugin.GetClientManager().Get(to).GetRank().has(Rank.HELPER)) if (Plugin.GetClientManager().Get(to).GetRank().has(Rank.HELPER))
{ {
if (_incognitoManager.Get(to).Status) if (Plugin.getIncognitoManager().Get(to).Status)
{ {
continue; continue;
} }