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

View File

@ -398,13 +398,20 @@ public abstract class GeneralRegion implements GeneralRegionInterface, Comparabl
*/ */
public UUID getLandlord() { public UUID getLandlord() {
String landlord = getStringSetting("general.landlord"); String landlord = getStringSetting("general.landlord");
if(landlord != null) { if(landlord != null && !landlord.isEmpty()) {
try { try {
return UUID.fromString(landlord); return UUID.fromString(landlord);
} catch(IllegalArgumentException e) { } catch(IllegalArgumentException e) {
// Incorrect UUID // 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; return null;
} }