mirror of
https://github.com/darksaid98/HuskHomes.git
synced 2026-12-01 22:16:08 +00:00
Fixup config map reading inconsistencies, close #471
This commit is contained in:
9 files changed
+114
-58
No files matched your search
@@ -26,8 +26,8 @@ import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.time.Duration;
|
||||
import java.time.Instant;
|
||||
import java.util.Optional;
|
||||
import java.util.StringJoiner;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* Class for validating and performing economy and cooldown transactions involving {@link Action}s.
|
||||
@@ -229,5 +229,27 @@ public interface TransactionResolver {
|
||||
return defaultCooldown;
|
||||
}
|
||||
|
||||
// Get the default economy action cost map for the config
|
||||
@NotNull
|
||||
public static Map<String, Double> getEconomyCostsConfigMap() {
|
||||
return Arrays.stream(values())
|
||||
.filter(action -> action.getDefaultCost() > 0)
|
||||
.collect(Collectors.toMap(
|
||||
action -> action.name().toLowerCase(Locale.ENGLISH),
|
||||
Action::getDefaultCost
|
||||
));
|
||||
}
|
||||
|
||||
// Get the default cooldown action time map for the config
|
||||
@NotNull
|
||||
public static Map<String, Integer> getCooldownsConfigMap() {
|
||||
return Arrays.stream(values())
|
||||
.filter(action -> action.getDefaultCooldown() > 0)
|
||||
.collect(Collectors.toMap(
|
||||
action -> action.name().toLowerCase(Locale.ENGLISH),
|
||||
Action::getDefaultCooldown
|
||||
));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user