Fixed EconomyManager and ListUtils
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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)) {
|
||||
|
||||
Reference in New Issue
Block a user