mirror of
https://github.com/darksaid98/HuskHomes.git
synced 2026-12-02 06:28:49 +00:00
fix: economy checks being used even if no hook loaded
This commit is contained in:
4 files changed
+17
-4
No files matched your search
@@ -221,9 +221,9 @@ public class HomesManager {
|
||||
final SavedUser savedOwner = plugin.getSavedUser(owner)
|
||||
.or(() -> plugin.getDatabase().getUser(owner.getUuid()))
|
||||
.orElseThrow(() -> new IllegalStateException("User data not found for " + owner.getUuid()));
|
||||
if (!ignoreHomeSlots && plugin.getSettings().getEconomy().isEnabled()
|
||||
&& homes > getFreeHomes(owner) && homes > savedOwner.getHomeSlots()) {
|
||||
if (!buyAdditionalSlots || plugin.getEconomyHook().isEmpty() || !(owner instanceof OnlineUser online)) {
|
||||
if (plugin.isUsingEconomy() && !ignoreHomeSlots && homes > getFreeHomes(owner)
|
||||
&& homes > savedOwner.getHomeSlots()) {
|
||||
if (!buyAdditionalSlots || !(owner instanceof OnlineUser online)) {
|
||||
throw new ValidationException(ValidationException.Type.NOT_ENOUGH_HOME_SLOTS);
|
||||
}
|
||||
|
||||
|
||||
@@ -168,6 +168,15 @@ public interface TransactionResolver {
|
||||
return getPlugin().getHook(EconomyHook.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return whether to use the economy hook
|
||||
*
|
||||
* @return {@code true} if the economy hook is in use
|
||||
*/
|
||||
default boolean isUsingEconomy() {
|
||||
return getPlugin().getSettings().getEconomy().isEnabled() && getEconomyHook().isPresent();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
HuskHomes getPlugin();
|
||||
|
||||
|
||||
Reference in new issue
Block a user