From 02067570299cbaed0d8274ab532ad228e7e845a5 Mon Sep 17 00:00:00 2001 From: Dinnerbone Date: Sat, 3 Sep 2011 00:41:48 +0100 Subject: [PATCH] Implemented OfflinePlayer --- src/main/java/org/bukkit/craftbukkit/CraftServer.java | 10 ++++++++++ .../bukkit/craftbukkit/entity/CraftHumanEntity.java | 5 +++-- .../org/bukkit/craftbukkit/entity/CraftPlayer.java | 3 +++ 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java index 30959af211..8821739b0b 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java @@ -806,4 +806,14 @@ public final class CraftServer implements Server { return count; } + + public OfflinePlayer getOfflinePlayer(String name) { + OfflinePlayer result = getPlayer(name); + + if (result == null) { + result = new CraftOfflinePlayer(this, name); + } + + return result; + } } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java index 2e7ee5f56c..fae0d80326 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java @@ -16,7 +16,7 @@ import org.bukkit.plugin.Plugin; public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity { private CraftInventoryPlayer inventory; - private final PermissibleBase perm = new PermissibleBase(this); + protected final PermissibleBase perm = new PermissibleBase(this); private boolean op; public CraftHumanEntity(final CraftServer server, final EntityHuman entity) { @@ -110,7 +110,8 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity { public void setOp(boolean value) { this.op = value; - recalculatePermissions(); + perm.recalculatePermissions(); + perm.calculatePermissions(); } public Set getEffectivePermissions() { diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java index 01cf763f24..76eefc3401 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -47,6 +47,9 @@ public class CraftPlayer extends CraftHumanEntity implements Player { } else { server.getHandle().f(getName()); } + + perm.recalculatePermissions(); + perm.calculatePermissions(); } public boolean isPlayer() {