summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsnowleo <schneeleo@gmail.com>2011-09-30 00:09:48 +0200
committersnowleo <schneeleo@gmail.com>2011-09-30 00:09:48 +0200
commit458068ae87978e19d82a39558cc31f79815fa690 (patch)
treef5a58b0e1f8e1f810cb06ee8f57eeb7b49bd88b6
parent44e920e44125f1a05fe4bd0d899e0eb797d5cda7 (diff)
downloadEssentials-458068ae87978e19d82a39558cc31f79815fa690.tar
Essentials-458068ae87978e19d82a39558cc31f79815fa690.tar.gz
Essentials-458068ae87978e19d82a39558cc31f79815fa690.tar.lz
Essentials-458068ae87978e19d82a39558cc31f79815fa690.tar.xz
Essentials-458068ae87978e19d82a39558cc31f79815fa690.zip
Fix god mode enabled after afk player quit the game
-rw-r--r--Essentials/src/com/earth2me/essentials/User.java19
1 files changed, 7 insertions, 12 deletions
diff --git a/Essentials/src/com/earth2me/essentials/User.java b/Essentials/src/com/earth2me/essentials/User.java
index d5aa197e7..b68e93656 100644
--- a/Essentials/src/com/earth2me/essentials/User.java
+++ b/Essentials/src/com/earth2me/essentials/User.java
@@ -20,14 +20,12 @@ public class User extends UserData implements Comparable<User>, IReplyTo, IUser
private transient long lastOnlineActivity;
private transient long lastActivity = System.currentTimeMillis();
private boolean hidden = false;
- private transient boolean godStateBeforeAfk;
private transient Location afkPosition;
User(final Player base, final IEssentials ess)
{
super(base, ess);
teleport = new Teleport(this, ess);
- godStateBeforeAfk = isGodModeEnabled();
afkPosition = getLocation();
}
@@ -348,15 +346,6 @@ public class User extends UserData implements Comparable<User>, IReplyTo, IUser
public void setAfk(final boolean set)
{
this.setSleepingIgnored(this.isAuthorized("essentials.sleepingignored") ? true : set);
- if (set && !isAfk() && ess.getSettings().getFreezeAfkPlayers())
- {
- godStateBeforeAfk = isGodModeEnabled();
- setGodModeEnabled(true);
- }
- if (!set && isAfk() && ess.getSettings().getFreezeAfkPlayers())
- {
- setGodModeEnabled(godStateBeforeAfk);
- }
if (set && !isAfk()) {
afkPosition = getLocation();
}
@@ -481,5 +470,11 @@ public class User extends UserData implements Comparable<User>, IReplyTo, IUser
setFoodLevel(20);
}
return super.toggleGodModeEnabled();
- }
+ }
+
+ @Override
+ public boolean isGodModeEnabled()
+ {
+ return super.isGodModeEnabled() || (isAfk() && ess.getSettings().getFreezeAfkPlayers());
+ }
}