Fix using landlordName setting without using landlord (uuid) setting

This commit is contained in:
Thijs Wiefferink 2017-02-02 17:20:26 +01:00
parent 6b8e161e43
commit 40d45c7786
1 changed files with 8 additions and 1 deletions

View File

@ -398,13 +398,20 @@ public abstract class GeneralRegion implements GeneralRegionInterface, Comparabl
*/
public UUID getLandlord() {
String landlord = getStringSetting("general.landlord");
if(landlord != null) {
if(landlord != null && !landlord.isEmpty()) {
try {
return UUID.fromString(landlord);
} catch(IllegalArgumentException e) {
// Incorrect UUID
}
}
String landlordName = getStringSetting("general.landlordName");
if(landlordName != null && !landlordName.isEmpty()) {
OfflinePlayer offlinePlayer = Bukkit.getOfflinePlayer(landlordName);
if(offlinePlayer != null) {
return offlinePlayer.getUniqueId();
}
}
return null;
}