From 2547c46099539783db12f85cf4961b981650eaf8 Mon Sep 17 00:00:00 2001 From: Dinnerbone Date: Sat, 3 Sep 2011 00:49:10 +0100 Subject: [PATCH] Actually push the CraftOfflinePlayer implementation! --- .../craftbukkit/CraftOfflinePlayer.java | 40 +++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 src/main/java/org/bukkit/craftbukkit/CraftOfflinePlayer.java diff --git a/src/main/java/org/bukkit/craftbukkit/CraftOfflinePlayer.java b/src/main/java/org/bukkit/craftbukkit/CraftOfflinePlayer.java new file mode 100644 index 0000000000..01a9ec1cb7 --- /dev/null +++ b/src/main/java/org/bukkit/craftbukkit/CraftOfflinePlayer.java @@ -0,0 +1,40 @@ +package org.bukkit.craftbukkit; + +import org.bukkit.OfflinePlayer; +import org.bukkit.Server; + +public class CraftOfflinePlayer implements OfflinePlayer { + private final String name; + private final CraftServer server; + + protected CraftOfflinePlayer(CraftServer server, String name) { + this.server = server; + this.name = name; + } + + public boolean isOnline() { + return false; + } + + public String getName() { + return name; + } + + public Server getServer() { + return server; + } + + public boolean isOp() { + return server.getHandle().isOp(getName()); + } + + public void setOp(boolean value) { + if (value == isOp()) return; + + if (value) { + server.getHandle().e(getName()); + } else { + server.getHandle().f(getName()); + } + } +}