Fixes some minor issues
Uses Economy.format to display currency correctly Fixes Vault repo using http Updates Spigot version to 1.19.2 Fixes formatting of README tables
This commit is contained in:
@ -1,6 +1,5 @@
|
||||
package net.knarcraft.permissionsigns.container;
|
||||
|
||||
import net.knarcraft.permissionsigns.formatting.StringFormatter;
|
||||
import net.knarcraft.permissionsigns.formatting.TranslatableMessage;
|
||||
import net.knarcraft.permissionsigns.formatting.Translator;
|
||||
import net.knarcraft.permissionsigns.manager.EconomyManager;
|
||||
@ -198,11 +197,7 @@ public class PermissionSign {
|
||||
if (cost == 0) {
|
||||
return Translator.getTranslatedMessage(TranslatableMessage.SIGN_COST_FREE);
|
||||
} else {
|
||||
String currency = EconomyManager.getCurrency(cost != 1);
|
||||
String format = Translator.getTranslatedMessage(TranslatableMessage.SIGN_COST_FORMAT);
|
||||
String formatted = StringFormatter.replacePlaceholders(format, new String[]{"{cost}", "{currency}"},
|
||||
new String[]{"%.2f", currency});
|
||||
return String.format(formatted, cost);
|
||||
return EconomyManager.format(cost);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -70,11 +70,6 @@ public enum TranslatableMessage {
|
||||
*/
|
||||
SIGN_NAME_FORMAT,
|
||||
|
||||
/**
|
||||
* The format for displaying the cost unit on a permission sign
|
||||
*/
|
||||
SIGN_COST_FORMAT,
|
||||
|
||||
/**
|
||||
* The format for displaying the duration on a permission sign
|
||||
*/
|
||||
|
@ -36,17 +36,13 @@ public final class EconomyManager {
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the name of the used currency
|
||||
* Formats the given amount of currency according to the used economy plugin
|
||||
*
|
||||
* @param plural <p>Whether to get the plural name or the singular name</p>
|
||||
* @return <p>The name of the used currency</p>
|
||||
* @param amount <p>The amount of currency to format</p>
|
||||
* @return <p>The formatted amount of currency</p>
|
||||
*/
|
||||
public static String getCurrency(boolean plural) {
|
||||
if (plural) {
|
||||
return economy.currencyNamePlural();
|
||||
} else {
|
||||
return economy.currencyNameSingular();
|
||||
}
|
||||
public static String format(double amount) {
|
||||
return economy.format(amount);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -14,7 +14,6 @@ en:
|
||||
SIGN_DURATION_FORMAT: "{duration} {unit}"
|
||||
SIGN_PERMANENT: "Permanent"
|
||||
SIGN_COST_FREE: "Free"
|
||||
SIGN_COST_FORMAT: "{cost}{currency}"
|
||||
COST_INVALID_NUMBER: "&7The given cost is not a valid number"
|
||||
DURATION_INVALID_NUMBER: "&7The given duration is not a valid number"
|
||||
COMMAND_PLAYER_ONLY: "&7This command is only available to players"
|
||||
@ -58,7 +57,6 @@ nb-no:
|
||||
SIGN_DURATION_FORMAT: "{duration} {unit}"
|
||||
SIGN_PERMANENT: "Permanent"
|
||||
SIGN_COST_FREE: "Gratis"
|
||||
SIGN_COST_FORMAT: "{cost}{currency}"
|
||||
COST_INVALID_NUMBER: "&7Den gitte kostnaden er ikke et gyldig nummer"
|
||||
DURATION_INVALID_NUMBER: "&7Den gitte varigheten er ikke et gyldig nummer"
|
||||
COMMAND_PLAYER_ONLY: "&7Denne kommandoen kan bare brukes av spillere"
|
||||
|
Reference in New Issue
Block a user