2011-09-03 01:49:10 +02:00
|
|
|
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() {
|
2011-09-03 03:13:07 +02:00
|
|
|
return server.getHandle().isOp(getName().toLowerCase());
|
2011-09-03 01:49:10 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
public void setOp(boolean value) {
|
|
|
|
if (value == isOp()) return;
|
|
|
|
|
|
|
|
if (value) {
|
2011-09-24 23:03:31 +02:00
|
|
|
server.getHandle().addOp(getName().toLowerCase());
|
2011-09-03 01:49:10 +02:00
|
|
|
} else {
|
2011-09-24 23:03:31 +02:00
|
|
|
server.getHandle().removeOp(getName().toLowerCase());
|
2011-09-03 03:13:07 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public boolean isBanned() {
|
|
|
|
return server.getHandle().banByName.contains(name.toLowerCase());
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setBanned(boolean value) {
|
|
|
|
if (value) {
|
2011-09-24 23:03:31 +02:00
|
|
|
server.getHandle().addUserBan(name.toLowerCase());
|
2011-09-03 03:13:07 +02:00
|
|
|
} else {
|
2011-09-24 23:03:31 +02:00
|
|
|
server.getHandle().removeUserBan(name.toLowerCase());
|
2011-09-03 01:49:10 +02:00
|
|
|
}
|
|
|
|
}
|
2011-09-03 16:57:54 +02:00
|
|
|
|
|
|
|
public boolean isWhitelisted() {
|
2011-09-24 23:03:31 +02:00
|
|
|
return server.getHandle().getWhitelisted().contains(name.toLowerCase());
|
2011-09-03 16:57:54 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
public void setWhitelisted(boolean value) {
|
|
|
|
if (value) {
|
2011-09-24 23:03:31 +02:00
|
|
|
server.getHandle().addWhitelist(name.toLowerCase());
|
2011-09-03 16:57:54 +02:00
|
|
|
} else {
|
2011-09-24 23:03:31 +02:00
|
|
|
server.getHandle().removeWhitelist(name.toLowerCase());
|
2011-09-03 16:57:54 +02:00
|
|
|
}
|
|
|
|
}
|
2011-09-03 01:49:10 +02:00
|
|
|
}
|