Fixed EconomyManager and ListUtils

This commit is contained in:
Auxilor
2021-11-02 09:24:16 +00:00
parent 6decc68d1b
commit ed4f0b2ab6
2 changed files with 19 additions and 10 deletions

View File

@@ -26,6 +26,15 @@ public class EconomyManager {
registered.add(integration);
}
/**
* Get if any economy registrations are registered.
*
* @return If any economy.
*/
public boolean hasRegistrations() {
return !registered.isEmpty();
}
/**
* Get if a player has a certain amount.
*
@@ -33,8 +42,8 @@ public class EconomyManager {
* @param amount The amount.
* @return If the player has the amount.
*/
boolean hasAmount(@NotNull final OfflinePlayer player,
final double amount) {
public boolean hasAmount(@NotNull final OfflinePlayer player,
final double amount) {
for (EconomyWrapper wrapper : registered) {
return wrapper.hasAmount(player, amount);
}
@@ -49,8 +58,8 @@ public class EconomyManager {
* @param amount The amount to give.
* @return If the transaction was a success.
*/
boolean giveMoney(@NotNull final OfflinePlayer player,
final double amount) {
public boolean giveMoney(@NotNull final OfflinePlayer player,
final double amount) {
for (EconomyWrapper wrapper : registered) {
return wrapper.giveMoney(player, amount);
}
@@ -65,8 +74,8 @@ public class EconomyManager {
* @param amount The amount to remove.
* @return If the transaction was a success.
*/
boolean removeMoney(@NotNull final OfflinePlayer player,
final double amount) {
public boolean removeMoney(@NotNull final OfflinePlayer player,
final double amount) {
for (EconomyWrapper wrapper : registered) {
return wrapper.removeMoney(player, amount);
}
@@ -80,7 +89,7 @@ public class EconomyManager {
* @param player The player.
* @return The balance.
*/
double getBalance(@NotNull final OfflinePlayer player) {
public double getBalance(@NotNull final OfflinePlayer player) {
for (EconomyWrapper wrapper : registered) {
return wrapper.getBalance(player);
}

View File

@@ -23,8 +23,8 @@ public class ListUtils {
* @return The list, filled will null objects.
*/
@NotNull
public <@Nullable T> List<List<T>> create2DList(final int rows,
final int columns) {
public static <@Nullable T> List<List<T>> create2DList(final int rows,
final int columns) {
List<List<T>> list = new ArrayList<>(rows);
while (list.size() < rows) {
List<T> row = new ArrayList<>(columns);
@@ -45,7 +45,7 @@ public class ListUtils {
* @return The frequency map.
*/
@NotNull
private static <T> Map<T, Integer> listToFrequencyMap(@NotNull final List<T> list) {
public static <T> Map<T, Integer> listToFrequencyMap(@NotNull final List<T> list) {
Map<T, Integer> frequencyMap = new HashMap<>();
for (T object : list) {
if (frequencyMap.containsKey(object)) {