summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsnowleo <schneeleo@gmail.com>2011-08-31 12:51:59 +0200
committersnowleo <schneeleo@gmail.com>2011-08-31 12:51:59 +0200
commitd3dd4980a40f3fb378dc4e5b7525cdb25b780b50 (patch)
tree621cb703a7e80b235a90c7d051e080ecca5d678c
parent057c9cb3f5e53535d8124326a4bb783dd24700a2 (diff)
downloadEssentials-d3dd4980a40f3fb378dc4e5b7525cdb25b780b50.tar
Essentials-d3dd4980a40f3fb378dc4e5b7525cdb25b780b50.tar.gz
Essentials-d3dd4980a40f3fb378dc4e5b7525cdb25b780b50.tar.lz
Essentials-d3dd4980a40f3fb378dc4e5b7525cdb25b780b50.tar.xz
Essentials-d3dd4980a40f3fb378dc4e5b7525cdb25b780b50.zip
Using base instead of our wrapped player for permission check.
-rw-r--r--Essentials/src/com/earth2me/essentials/User.java21
-rw-r--r--Essentials/src/com/earth2me/essentials/perm/Permissions2Handler.java2
2 files changed, 15 insertions, 8 deletions
diff --git a/Essentials/src/com/earth2me/essentials/User.java b/Essentials/src/com/earth2me/essentials/User.java
index 918f0f128..fa5c7bd2d 100644
--- a/Essentials/src/com/earth2me/essentials/User.java
+++ b/Essentials/src/com/earth2me/essentials/User.java
@@ -17,7 +17,7 @@ public class User extends UserData implements Comparable<User>, IReplyTo, IUser
private transient User teleportRequester;
private transient boolean teleportRequestHere;
private transient final Teleport teleport;
- private transient long lastOnlineActivity ;
+ private transient long lastOnlineActivity;
private transient long lastActivity = System.currentTimeMillis();
private boolean hidden = false;
private transient boolean godStateBeforeAfk;
@@ -50,6 +50,11 @@ public class User extends UserData implements Comparable<User>, IReplyTo, IUser
@Override
public boolean isAuthorized(final String node)
{
+ if (base instanceof OfflinePlayer)
+ {
+ return false;
+ }
+
if (isOp())
{
return true;
@@ -60,7 +65,7 @@ public class User extends UserData implements Comparable<User>, IReplyTo, IUser
return false;
}
- return ess.getPermissionsHandler().hasPermission(this, node);
+ return ess.getPermissionsHandler().hasPermission(base, node);
}
public void healCooldown() throws Exception
@@ -264,8 +269,8 @@ public class User extends UserData implements Comparable<User>, IReplyTo, IUser
if (ess.getSettings().addPrefixSuffix())
{
- final String prefix = ess.getPermissionsHandler().getPrefix(this).replace('&', '§').replace("{WORLDNAME}", this.getWorld().getName());
- final String suffix = ess.getPermissionsHandler().getSuffix(this).replace('&', '§').replace("{WORLDNAME}", this.getWorld().getName());
+ final String prefix = ess.getPermissionsHandler().getPrefix(base).replace('&', '§').replace("{WORLDNAME}", this.getWorld().getName());
+ final String suffix = ess.getPermissionsHandler().getSuffix(base).replace('&', '§').replace("{WORLDNAME}", this.getWorld().getName());
nickname.insert(0, prefix);
nickname.append(suffix);
@@ -341,11 +346,13 @@ 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()) {
+ if (set && !isAfk() && ess.getSettings().getFreezeAfkPlayers())
+ {
godStateBeforeAfk = isGodModeEnabled();
setGodModeEnabled(true);
}
- if (!set && isAfk() && ess.getSettings().getFreezeAfkPlayers()) {
+ if (!set && isAfk() && ess.getSettings().getFreezeAfkPlayers())
+ {
setGodModeEnabled(godStateBeforeAfk);
}
super.setAfk(set);
@@ -423,7 +430,7 @@ public class User extends UserData implements Comparable<User>, IReplyTo, IUser
if (autoafkkick > 0 && lastActivity + autoafkkick * 1000 < System.currentTimeMillis()
&& !isAuthorized("essentials.kick.exempt") && !isAuthorized("essentials.afk.kickexempt"))
{
- final String kickReason = Util.format("autoAfkKickReason", autoafkkick/60.0);
+ final String kickReason = Util.format("autoAfkKickReason", autoafkkick / 60.0);
kickPlayer(kickReason);
diff --git a/Essentials/src/com/earth2me/essentials/perm/Permissions2Handler.java b/Essentials/src/com/earth2me/essentials/perm/Permissions2Handler.java
index 6b5ff5b73..c501369d0 100644
--- a/Essentials/src/com/earth2me/essentials/perm/Permissions2Handler.java
+++ b/Essentials/src/com/earth2me/essentials/perm/Permissions2Handler.java
@@ -44,7 +44,7 @@ public class Permissions2Handler implements IPermissionsHandler
@Override
public boolean hasPermission(final Player base, final String node)
{
- return permissionHandler.permission(base, node);
+ return permissionHandler.permission(base.getWorld().getName(), base.getName(), node);
}
@Override