mirror of
https://github.com/darksaid98/HuskHomes.git
synced 2026-12-02 06:28:49 +00:00
Fix placeholder on home slots economy warning, close #278
This commit is contained in:
1 parent
b3db9de64f
commit
7c01b434e6
2 files changed
+34
-12
No files matched your search
@@ -71,18 +71,23 @@ public class SetHomeCommand extends CommandBase {
|
||||
final int freeHomes = onlineUser.getFreeHomes(plugin.getSettings().freeHomeSlots,
|
||||
plugin.getSettings().stackPermissionLimits);
|
||||
if (fetchedData.isPresent()) {
|
||||
final Settings.EconomyAction action = Settings.EconomyAction.ADDITIONAL_HOME_SLOT;
|
||||
newSlotNeeded.set((currentHomes.size() + 1) > (freeHomes + fetchedData.get().homeSlots()));
|
||||
|
||||
// If a new slot is needed, validate the user has enough funds to purchase one
|
||||
if (newSlotNeeded.get()) {
|
||||
if (!plugin.validateEconomyCheck(onlineUser, Settings.EconomyAction.ADDITIONAL_HOME_SLOT)) {
|
||||
if (!plugin.validateEconomyCheck(onlineUser, action)) {
|
||||
return;
|
||||
}
|
||||
userDataToUpdate.set(new UserData(onlineUser, (currentHomes.size() + 1) - freeHomes,
|
||||
fetchedData.get().ignoringTeleports(), fetchedData.get().rtpCooldown()));
|
||||
} else {
|
||||
if (currentHomes.size() == freeHomes) {
|
||||
plugin.getLocales().getLocale("set_home_used_free_slots", Integer.toString(freeHomes))
|
||||
plugin.getEconomyHook()
|
||||
.flatMap(economyHook -> plugin.getSettings().getEconomyCost(action)
|
||||
.map(economyHook::formatCurrency))
|
||||
.flatMap(formatted -> plugin.getLocales().getLocale("set_home_used_free_slots",
|
||||
Integer.toString(freeHomes), formatted))
|
||||
.ifPresent(onlineUser::sendMessage);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user