Compare commits

..

2 Commits

Author SHA1 Message Date
Auxilor
db2ea7daa9 Updated to 6.12.2 2021-11-02 09:24:23 +00:00
Auxilor
ed4f0b2ab6 Fixed EconomyManager and ListUtils 2021-11-02 09:24:16 +00:00
3 changed files with 20 additions and 11 deletions

View File

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

View File

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

View File

@@ -1,2 +1,2 @@
version = 6.12.1 version = 6.12.2
plugin-name = eco plugin-name = eco