Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@
<groupId>su.nightexpress.nightcore</groupId>
<artifactId>main</artifactId>
<version>2.9.4</version>
<classifier>shaded</classifier>
<scope>provided</scope>
</dependency>

Expand Down Expand Up @@ -108,7 +109,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>3.3.0</version>
<version>3.3.1</version>
<executions>
<execution>
<id>attach-sources</id>
Expand All @@ -121,4 +122,4 @@
</plugins>
</build>

</project>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public void enable() {
}

if (Plugins.isInstalled(HookPlugin.DELUXE_COINFLIP)) {
this.runTask(task -> DeluxeCoinflipHook.setup(this));
this.runTask(() -> DeluxeCoinflipHook.setup(this));
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,6 @@ public static void unregsiterCurrency(@NotNull Currency currency) {
getCurrencyManager().unregisterCurrency(currency);
}



public static double getBalance(@NotNull UUID playerId, @NotNull String currencyName) {
Currency currency = getCurrency(currencyName);

Expand All @@ -108,8 +106,6 @@ public static double getBalance(@NotNull Player player, @NotNull Currency curren
return getUserData(player).getBalance(currency);
}



public static boolean addBalance(@NotNull UUID playerId, @NotNull String currencyName, double amount) {
Currency currency = getCurrency(currencyName);
return currency != null && addBalance(playerId, currency, amount);
Expand Down Expand Up @@ -188,7 +184,6 @@ private static OperationContext operationContext() {
return OperationContext.custom("API").silentFor(NotificationTarget.USER, NotificationTarget.EXECUTOR, NotificationTarget.CONSOLE_LOGGER);
}


@NotNull
public static CoinsUser getUserData(@NotNull Player player) {
return getUserManager().getOrFetch(player);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,4 +162,3 @@ default CompactNumber formatCompactValue(double balance) {

boolean isLeaderboardEnabled();
}

17 changes: 0 additions & 17 deletions src/main/java/su/nightexpress/coinsengine/config/Lang.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,6 @@ public class Lang implements LangContainer {
public static final MessageLocale COMMAND_SYNTAX_INVALID_CURRENCY = LangEntry.builder("Command.Syntax.InvalidCurrency").chatMessage(
GRAY.wrap(SOFT_RED.wrap(GENERIC_INPUT) + " is not a valid currency!"));



public static final MessageLocale CURRENCY_OPERATION_DISABLED = LangEntry.builder("Currency.Operation.Disabled").chatMessage(
SOFT_RED.wrap("Currency operations are temporarily disabled.")
);
Expand All @@ -50,8 +48,6 @@ public class Lang implements LangContainer {
public static final MessageLocale CURRENCY_OPERATION_RESET_NOTIFY = LangEntry.builder("Currency.Operation.Reset.Notify").chatMessage(
GRAY.wrap("Your balance has been reset to " + SOFT_YELLOW.wrap(GENERIC_BALANCE) + "."));



public static final MessageLocale MIGRATION_START_BLOCKED = LangEntry.builder("Migration.Start.Blocked").chatMessage(
SOFT_RED.wrap("Could not start migration due to background tasks already running!"));

Expand Down Expand Up @@ -83,8 +79,6 @@ public class Lang implements LangContainer {
DARK_GRAY.wrap(STRIKETHROUGH.wrap("-".repeat(32)))
);



public static final MessageLocale RESET_ALL_START_BLOCKED = LangEntry.builder("ResetAll.Start.Blocked").chatMessage(
SOFT_RED.wrap("Could not start balance reset due to background tasks already running!"));

Expand Down Expand Up @@ -145,33 +139,28 @@ public class Lang implements LangContainer {
GRAY.wrap("Created new currency: " + GREEN.wrap(CURRENCY_NAME) + " (ID: " + WHITE.wrap(CURRENCY_ID) + ")")
);


public static final MessageLocale COMMAND_CURRENCY_GIVE_DONE = LangEntry.builder("Command.Currency.Give.Done").chatMessage(
GRAY.wrap("Added " + SOFT_YELLOW.wrap(GENERIC_AMOUNT) + " to " + SOFT_YELLOW.wrap(PLAYER_NAME) + "'s balance. New balance: " + SOFT_YELLOW.wrap(GENERIC_BALANCE) + "."));

public static final MessageLocale COMMAND_CURRENCY_GIVE_NOTIFY = LangEntry.builder("Command.Currency.Give.Notify").chatMessage(
GRAY.wrap(SOFT_YELLOW.wrap(GENERIC_AMOUNT) + " has been added to your account!"));


public static final MessageLocale COMMAND_CURRENCY_GIVE_ALL_DONE = LangEntry.builder("Command.Currency.GiveAll.Done").chatMessage(
GRAY.wrap("Added " + SOFT_YELLOW.wrap(GENERIC_AMOUNT) + " to " + SOFT_YELLOW.wrap("All Online") + " players.")
);


public static final MessageLocale COMMAND_CURRENCY_TAKE_DONE = LangEntry.builder("Command.Currency.Take.Done").chatMessage(
GRAY.wrap("Taken " + SOFT_YELLOW.wrap(GENERIC_AMOUNT) + " from " + SOFT_YELLOW.wrap(PLAYER_NAME) + "'s balance. New balance: " + SOFT_YELLOW.wrap(GENERIC_BALANCE) + "."));

public static final MessageLocale COMMAND_CURRENCY_TAKE_NOTIFY = LangEntry.builder("Command.Currency.Take.Notify").chatMessage(
GRAY.wrap(SOFT_YELLOW.wrap(GENERIC_AMOUNT) + " has been taken from your account!"));


public static final MessageLocale COMMAND_CURRENCY_SET_DONE = LangEntry.builder("Command.Currency.Set.Done").chatMessage(
GRAY.wrap("Set " + SOFT_YELLOW.wrap(PLAYER_NAME) + "'s " + SOFT_YELLOW.wrap(CURRENCY_NAME) + " balance to " + SOFT_YELLOW.wrap(GENERIC_BALANCE) + "."));

public static final MessageLocale COMMAND_CURRENCY_SET_NOTIFY = LangEntry.builder("Command.Currency.Set.Notify").chatMessage(
GRAY.wrap("Your " + SOFT_YELLOW.wrap(CURRENCY_NAME) + " balance has been set to " + SOFT_YELLOW.wrap(GENERIC_AMOUNT) + "."));


public static final MessageLocale CURRENCY_SEND_ERROR_NOT_ENOUGH = LangEntry.builder("Command.Currency.Send.Error.NotEnough").chatMessage(
GRAY.wrap("You don't have enough " + SOFT_RED.wrap(CURRENCY_NAME) + "!"));

Expand All @@ -187,7 +176,6 @@ public class Lang implements LangContainer {
public static final MessageLocale CURRENCY_SEND_DONE_NOTIFY = LangEntry.builder("Command.Currency.Send.Done.Notify").chatMessage(
GRAY.wrap("You received " + SOFT_YELLOW.wrap(GENERIC_AMOUNT) + " from " + SOFT_YELLOW.wrap(PLAYER_NAME) + "!"));


public static final MessageLocale COMMAND_CURRENCY_PAYMENTS_TOGGLE = LangEntry.builder("Command.Currency.Payments.Toggle").chatMessage(
GRAY.wrap(SOFT_YELLOW.wrap(CURRENCY_NAME) + " payments acception: " + SOFT_YELLOW.wrap(GENERIC_STATE) + "."));

Expand Down Expand Up @@ -234,14 +222,12 @@ public class Lang implements LangContainer {
SHOW_TEXT.with(GRAY.wrap("There are no more pages.")).wrap(GRAY.wrap("[←]"))
);


public static final MessageLocale CURRENCY_BALANCE_DISPLAY_OWN = LangEntry.builder("Currency.Balance.Display.Own").chatMessage(
GRAY.wrap("Balance: " + SOFT_YELLOW.wrap(GENERIC_BALANCE) + "."));

public static final MessageLocale CURRENCY_BALANCE_DISPLAY_OTHERS = LangEntry.builder("Currency.Balance.Display.Others").chatMessage(
GRAY.wrap(SOFT_YELLOW.wrap(PLAYER_NAME) + "'s balance: " + SOFT_YELLOW.wrap(GENERIC_BALANCE) + "."));


public static final MessageLocale CURRENCY_WALLET_OWN = LangEntry.builder("Currency.Wallet.Own").message(
MessageData.CHAT_NO_PREFIX,
DARK_GRAY.wrap(STRIKETHROUGH.wrap("-".repeat(32))),
Expand All @@ -264,7 +250,6 @@ public class Lang implements LangContainer {
YELLOW.wrap("•") + " " + WHITE.wrap(CURRENCY_NAME + ":") + " " + GREEN.wrap(GENERIC_BALANCE)
);


public static final MessageLocale CURRENCY_EXCHANGE_ERROR_DISABLED = LangEntry.builder("Currency.Exchange.Error.Disabled").chatMessage(
GRAY.wrap(SOFT_RED.wrap(CURRENCY_NAME) + " can not be exchanged!"));

Expand All @@ -283,10 +268,8 @@ public class Lang implements LangContainer {
public static final MessageLocale CURRENCY_EXCHANGE_SUCCESS = LangEntry.builder("Currency.Exchange.Success").chatMessage(
GRAY.wrap("You exchanged " + SOFT_YELLOW.wrap(GENERIC_BALANCE) + " for " + SOFT_YELLOW.wrap(GENERIC_AMOUNT) + "!"));


public static final TextLocale ECONOMY_ERROR_INVALID_PLAYER = LangEntry.builder("VaultEconomy.Error.InvalidPlayer").text("Player not found.");
public static final TextLocale ECONOMY_ERROR_INSUFFICIENT_FUNDS = LangEntry.builder("VaultEconomy.Error.InsufficientFunds").text("Insufficient Funds!");


public static final TextLocale OTHER_NO_TOP_ENTRY = LangEntry.builder("Other.NoTopEntry").text("<none>");
}
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ public void resetBalances(@NotNull CommandSender sender, @Nullable Currency curr
return;
}

this.plugin.runTaskAsync(task -> {
this.plugin.runTaskAsync(() -> {
this.disableOperations();
if (currency == null) {
Collection<Currency> currencies = this.registry.getCurrencies();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,6 @@ public String currencyNameSingular() {
return this.getName();
}



@Override
public boolean createPlayerAccount(OfflinePlayer player) {
return false;
Expand All @@ -104,8 +102,6 @@ public boolean createPlayerAccount(String playerName) {
return false;
}



@Override
public double getBalance(OfflinePlayer player, String world) {
return this.getBalance(player);
Expand All @@ -132,8 +128,6 @@ private double getBalance(@Nullable CoinsUser user) {
return user == null ? 0D : user.getBalance(this);
}



@Override
public boolean hasAccount(OfflinePlayer player, String worldName) {
return this.hasAccount(player);
Expand All @@ -154,8 +148,6 @@ public boolean hasAccount(String playerName) {
return this.plugin.getDataHandler().isUserExists(playerName);
}



@Override
public boolean has(OfflinePlayer player, String worldName, double amount) {
return this.has(player, amount);
Expand All @@ -182,8 +174,6 @@ private boolean has(@Nullable CoinsUser user, double amount) {
return user != null && user.hasEnough(this, amount);
}



@Override
public EconomyResponse depositPlayer(OfflinePlayer player, String worldName, double amount) {
return this.depositPlayer(player, amount);
Expand Down Expand Up @@ -218,8 +208,6 @@ private EconomyResponse depositUser(@Nullable CoinsUser user, double amount) {
return new EconomyResponse(amount, user.getBalance(this), type, null);
}



@Override
public EconomyResponse withdrawPlayer(OfflinePlayer player, String worldName, double amount) {
return this.withdrawPlayer(player, amount);
Expand Down Expand Up @@ -263,8 +251,6 @@ private OperationContext operationContext() {
return OperationContext.custom("Vault Eco - " + this.name).silentFor(NotificationTarget.EXECUTOR, NotificationTarget.USER, NotificationTarget.CONSOLE_LOGGER);
}



@Override
public EconomyResponse createBank(String name, String player) {
return NO_BANKS;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,33 +111,19 @@ private void loadTopPlaceholders() {
}

private void loadPlayerPlaceholders() {
this.playerPlaceholders.put("server_balance_short_clean", (player, user, currency) -> {
return NightMessage.stripTags(currency.formatCompact(plugin.getTopManager().orElseThrow().getTotalBalance(currency)));
});
this.playerPlaceholders.put("server_balance_short_clean", (player, user, currency) -> NightMessage.stripTags(currency.formatCompact(plugin.getTopManager().orElseThrow().getTotalBalance(currency))));

this.playerPlaceholders.put("server_balance_short_legacy", (player, user, currency) -> {
return NightMessage.asLegacy(currency.formatCompact(plugin.getTopManager().orElseThrow().getTotalBalance(currency)));
});
this.playerPlaceholders.put("server_balance_short_legacy", (player, user, currency) -> NightMessage.asLegacy(currency.formatCompact(plugin.getTopManager().orElseThrow().getTotalBalance(currency))));

this.playerPlaceholders.put("server_balance_short", (player, user, currency) -> {
return currency.formatCompact(plugin.getTopManager().orElseThrow().getTotalBalance(currency));
});
this.playerPlaceholders.put("server_balance_short", (player, user, currency) -> currency.formatCompact(plugin.getTopManager().orElseThrow().getTotalBalance(currency)));

this.playerPlaceholders.put("server_balance_clean", (player, user, currency) -> {
return NightMessage.stripTags(currency.format(plugin.getTopManager().orElseThrow().getTotalBalance(currency)));
});
this.playerPlaceholders.put("server_balance_clean", (player, user, currency) -> NightMessage.stripTags(currency.format(plugin.getTopManager().orElseThrow().getTotalBalance(currency))));

this.playerPlaceholders.put("server_balance_legacy", (player, user, currency) -> {
return NightMessage.asLegacy(currency.format(plugin.getTopManager().orElseThrow().getTotalBalance(currency)));
});
this.playerPlaceholders.put("server_balance_legacy", (player, user, currency) -> NightMessage.asLegacy(currency.format(plugin.getTopManager().orElseThrow().getTotalBalance(currency))));

this.playerPlaceholders.put("server_balance_raw", (player, user, currency) -> {
return RAW_FORMAT.format(plugin.getTopManager().orElseThrow().getTotalBalance(currency));
});
this.playerPlaceholders.put("server_balance_raw", (player, user, currency) -> RAW_FORMAT.format(plugin.getTopManager().orElseThrow().getTotalBalance(currency)));

this.playerPlaceholders.put("server_balance", (player, user, currency) -> {
return currency.format(plugin.getTopManager().orElseThrow().getTotalBalance(currency));
});
this.playerPlaceholders.put("server_balance", (player, user, currency) -> currency.format(plugin.getTopManager().orElseThrow().getTotalBalance(currency)));

this.playerPlaceholders.put("payments_state", (player, user, currency) -> NightMessage.asLegacy(CoreLang.STATE_ENABLED_DISALBED.get(user.getSettings(currency).isPaymentsEnabled())));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ public boolean startMigration(@NotNull CommandSender sender, @NotNull String nam
return false;
}

this.plugin.runTaskAsync(task -> {
this.plugin.runTaskAsync(() -> {
this.currencyManager.disableOperations();
Lang.MIGRATION_STARTED.message().send(sender, replacer -> replacer.replace(Placeholders.GENERIC_NAME, migrator.getName()));
this.migrate(migrator, currency);
Expand Down
22 changes: 10 additions & 12 deletions src/main/java/su/nightexpress/coinsengine/tops/menu/TopMenu.java
Original file line number Diff line number Diff line change
Expand Up @@ -52,18 +52,16 @@ public MenuFiller<TopEntry> createFiller(@NotNull MenuViewer viewer) {
return MenuFiller.builder(this)
.setSlots(this.entrySlots)
.setItems(this.topManager.getTopEntries(currency))
.setItemCreator(entry -> {
return NightItem.fromType(Material.PLAYER_HEAD)
.hideAllComponents()
.setDisplayName(this.entryName)
.setLore(this.entryLore)
.setPlayerProfile(entry.getProfile().query())
.replacement(replacer -> replacer
.replace(GENERIC_POS, entry.getPosition())
.replace(PLAYER_NAME, entry.getName())
.replace(GENERIC_BALANCE, currency.format(entry.getBalance()))
);
})
.setItemCreator(entry -> NightItem.fromType(Material.PLAYER_HEAD)
.hideAllComponents()
.setDisplayName(this.entryName)
.setLore(this.entryLore)
.setPlayerProfile(entry.getProfile().query())
.replacement(replacer -> replacer
.replace(GENERIC_POS, entry.getPosition())
.replace(PLAYER_NAME, entry.getName())
.replace(GENERIC_BALANCE, currency.format(entry.getBalance()))
))
.build();
}

Expand Down
5 changes: 3 additions & 2 deletions src/main/resources/paper-plugin.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
main: su.nightexpress.coinsengine.CoinsEnginePlugin
version: '${project.version}'
api-version: 1.21
folia-supported: true
name: CoinsEngine
author: NightExpress
desciption: Unlimited virtual currencies and server economy.
load: STARTUP
api-version: 1.21
dependencies:
server:
nightcore:
Expand All @@ -17,4 +18,4 @@ dependencies:
PlayerPoints:
required: false
DeluxeCoinflip:
required: false
required: false
2 changes: 1 addition & 1 deletion src/main/resources/plugin.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
main: su.nightexpress.coinsengine.CoinsEnginePlugin
version: '${project.version}'
api-version: 1.20
name: CoinsEngine
author: NightExpress
desciption: A lightweight and modern plugin for virtual currencies and server economy.
Expand All @@ -10,4 +11,3 @@ softdepend:
- PlayerPoints
- DeluxeCoinflip
load: STARTUP
api-version: 1.20