Consider deactivating admin mode each time we check it. Fixes people getting stuck in admin mode that no longer has permissions for it.

This commit is contained in:
Olof Larsson 2013-08-23 08:10:44 +02:00
parent 04aca214e1
commit 844dc6c420

View File

@ -1,5 +1,6 @@
package com.massivecraft.factions.entity;
import com.massivecraft.factions.Perm;
import com.massivecraft.mcore.store.SenderEntity;
public class MPlayer extends SenderEntity<MPlayer>
@ -44,7 +45,15 @@ public class MPlayer extends SenderEntity<MPlayer>
public void setMapAutoUpdating(boolean mapAutoUpdating) { this.mapAutoUpdating = mapAutoUpdating; this.changed(); }
private boolean usingAdminMode = false;
public boolean isUsingAdminMode() { return this.usingAdminMode; }
public boolean isUsingAdminMode()
{
if (this.usingAdminMode && this.getSender() != null && !Perm.ADMIN.has(this.getSender(), false))
{
// If we are using admin mode but don't have permissions for it we deactivate it.
this.setUsingAdminMode(false);
}
return this.usingAdminMode;
}
public void setUsingAdminMode(boolean usingAdminMode) { this.usingAdminMode = usingAdminMode; this.changed(); }
}