13
0
geforkt von Mirrors/Paper

Implemented new ban and unban methods

By: Dinnerbone <dinnerbone@dinnerbone.com>
Dieser Commit ist enthalten in:
CraftBukkit/Spigot 2011-09-03 02:13:07 +01:00
Ursprung df08315cf4
Commit 4ec3915949
3 geänderte Dateien mit 37 neuen und 3 gelöschten Zeilen

Datei anzeigen

@ -25,16 +25,28 @@ public class CraftOfflinePlayer implements OfflinePlayer {
}
public boolean isOp() {
return server.getHandle().isOp(getName());
return server.getHandle().isOp(getName().toLowerCase());
}
public void setOp(boolean value) {
if (value == isOp()) return;
if (value) {
server.getHandle().e(getName());
server.getHandle().e(getName().toLowerCase());
} else {
server.getHandle().f(getName());
server.getHandle().f(getName().toLowerCase());
}
}
public boolean isBanned() {
return server.getHandle().banByName.contains(name.toLowerCase());
}
public void setBanned(boolean value) {
if (value) {
server.getHandle().a(name.toLowerCase());
} else {
server.getHandle().b(name.toLowerCase());
}
}
}

Datei anzeigen

@ -829,4 +829,14 @@ public final class CraftServer implements Server {
public void unbanIP(String address) {
server.d(address);
}
public Set<OfflinePlayer> getBannedPlayers() {
Set<OfflinePlayer> result = new HashSet<OfflinePlayer>();
for (Object name : server.banByName) {
result.add(getOfflinePlayer((String)name));
}
return result;
}
}

Datei anzeigen

@ -354,4 +354,16 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
public void resetPlayerTime() {
setPlayerTime(0, true);
}
public boolean isBanned() {
return server.getHandle().banByName.contains(getName().toLowerCase());
}
public void setBanned(boolean value) {
if (value) {
server.getHandle().a(getName().toLowerCase());
} else {
server.getHandle().b(getName().toLowerCase());
}
}
}