Make bans pretend to use names like before 1.7.8.
Bans require a name and UUID but our API only allows for a single string identifier for a ban entry. Until this is sorted out go back to the old name based setup since we can always get a UUID given a name. By: Travis Watkins <amaranth@ubuntu.com>
This commit is contained in:
@@ -90,14 +90,22 @@ public class CraftOfflinePlayer implements OfflinePlayer, ConfigurationSerializa
|
||||
}
|
||||
|
||||
public boolean isBanned() {
|
||||
return server.getBanList(BanList.Type.UUID).isBanned(getUniqueId().toString());
|
||||
if (getName() == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return server.getBanList(BanList.Type.NAME).isBanned(getName());
|
||||
}
|
||||
|
||||
public void setBanned(boolean value) {
|
||||
if (getName() == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (value) {
|
||||
server.getBanList(BanList.Type.UUID).addBan(getUniqueId().toString(), null, null, null);
|
||||
server.getBanList(BanList.Type.NAME).addBan(getName(), null, null, null);
|
||||
} else {
|
||||
server.getBanList(BanList.Type.UUID).pardon(getUniqueId().toString());
|
||||
server.getBanList(BanList.Type.NAME).pardon(getName());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user