Fetch saved user from database when creating home if not cached

This commit is contained in:
William committed 2023-06-03 19:44:45 +01:00
1 parent 8b27726bc7
commit 5c068855ff
1 file changed
+1
@@ -170,6 +170,7 @@ public class HomesManager {
// Validate against user home slots
final SavedUser savedOwner = plugin.getSavedUser(owner)
.or(() -> plugin.getDatabase().getUserData(owner.getUuid()))
.orElseThrow(() -> new IllegalStateException("User data not found for " + owner.getUuid()));
if (plugin.getSettings().doEconomy() && homes > getFreeHomes(owner) && homes > savedOwner.getHomeSlots()) {
if (!buyAdditionalSlots || plugin.getEconomyHook().isEmpty() || !(owner instanceof OnlineUser online)) {