From 844dc6c42075e8e732358b2f942863bce6df8c25 Mon Sep 17 00:00:00 2001 From: Olof Larsson Date: Fri, 23 Aug 2013 08:10:44 +0200 Subject: [PATCH] Consider deactivating admin mode each time we check it. Fixes people getting stuck in admin mode that no longer has permissions for it. --- src/com/massivecraft/factions/entity/MPlayer.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/com/massivecraft/factions/entity/MPlayer.java b/src/com/massivecraft/factions/entity/MPlayer.java index eb67daa6..7b18fd26 100644 --- a/src/com/massivecraft/factions/entity/MPlayer.java +++ b/src/com/massivecraft/factions/entity/MPlayer.java @@ -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 @@ -44,7 +45,15 @@ public class MPlayer extends SenderEntity 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(); } }