diff --git a/README.md b/README.md index 3f6c438..2d69db0 100644 --- a/README.md +++ b/README.md @@ -14,12 +14,12 @@ permission permanently by another cause) when they expire. ## Commands -| Command | Permission | Description | -| -------- | -------- | -------- | -| /ps about | None | Displays information about the plugin | -| /ps create | permissionsigns.admin.create | Used for creating a new permission sign | +| Command | Permission | Description | +|------------|------------------------------|-----------------------------------------------------------------| +| /ps about | None | Displays information about the plugin | +| /ps create | permissionsigns.admin.create | Used for creating a new permission sign | | /ps cancel | permissionsigns.admin.create | Used for manually cancelling a permission sign creation request | -| /ps reload | permissionsigns.admin.reload | Used for reloading data and config values from disk | +| /ps reload | permissionsigns.admin.reload | Used for reloading data and config values from disk | ### The create command @@ -47,22 +47,22 @@ this: `world:essentials.gamemode.creatice,any:essentials.gamemode.survival,world ## Permissions -| Node | Description | -| -------- | -------- | -| permissionsigns.* | Grants all permissions | -| --permissionsigns.use | Allows the usage of permission signs | -| --permissionsigns.admin | Allows the creation of permission signs and access to the /reload command | -| ----permissionsigns.admin.reload | Allows the usage of the /reload command | -| ----permissionsigns.admin.create | Allows the creation of permission signs | +| Node | Description | +|----------------------------------|---------------------------------------------------------------------------| +| permissionsigns.* | Grants all permissions | +| --permissionsigns.use | Allows the usage of permission signs | +| --permissionsigns.admin | Allows the creation of permission signs and access to the /reload command | +| ----permissionsigns.admin.reload | Allows the usage of the /reload command | +| ----permissionsigns.admin.create | Allows the creation of permission signs | ## Configuration options -| Option | Description | -| -------- | -------- | -| language | The language used for the plugin (en, nb-no) | -| perWorldPermissions | Sets permissions for the current world instead of setting them globally | +| Option | Description | +|-------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| language | The language used for the plugin (en, nb-no) | +| perWorldPermissions | Sets permissions for the current world instead of setting them globally | | removePermissionSignIfMissing | If enabled, permission signs that have lost their physical sign will be removed during startup. This prevents permission signs from staying in a broken state until the sign is replaced. | -| enableIndirectSignProtection | Protects permission signs against indirect sources such as pistons and explosions. Only disable this if your permission signs are protected by another plugin. | +| enableIndirectSignProtection | Protects permission signs against indirect sources such as pistons and explosions. Only disable this if your permission signs are protected by another plugin. | | enableExtensiveSignProtection | Whether to protect signs on "unstable" blocks such as sand or anvils. Does not protect signs on "lag pyramids" or similar, but protects signs on top of, or attached to a pillar of sand. | ## Language customization diff --git a/pom.xml b/pom.xml index 064e798..a45b94e 100644 --- a/pom.xml +++ b/pom.xml @@ -51,7 +51,7 @@ vault-repo - http://nexus.hc.to/content/repositories/pub_releases + https://nexus.hc.to/content/repositories/pub_releases @@ -59,7 +59,7 @@ org.spigotmc spigot-api - 1.19.1-R0.1-SNAPSHOT + 1.19.2-R0.1-SNAPSHOT provided diff --git a/src/main/java/net/knarcraft/permissionsigns/container/PermissionSign.java b/src/main/java/net/knarcraft/permissionsigns/container/PermissionSign.java index e2208ef..0e9bdd6 100644 --- a/src/main/java/net/knarcraft/permissionsigns/container/PermissionSign.java +++ b/src/main/java/net/knarcraft/permissionsigns/container/PermissionSign.java @@ -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); } } diff --git a/src/main/java/net/knarcraft/permissionsigns/formatting/TranslatableMessage.java b/src/main/java/net/knarcraft/permissionsigns/formatting/TranslatableMessage.java index ea27560..d39726d 100644 --- a/src/main/java/net/knarcraft/permissionsigns/formatting/TranslatableMessage.java +++ b/src/main/java/net/knarcraft/permissionsigns/formatting/TranslatableMessage.java @@ -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 */ diff --git a/src/main/java/net/knarcraft/permissionsigns/manager/EconomyManager.java b/src/main/java/net/knarcraft/permissionsigns/manager/EconomyManager.java index f0b88ac..8dae776 100644 --- a/src/main/java/net/knarcraft/permissionsigns/manager/EconomyManager.java +++ b/src/main/java/net/knarcraft/permissionsigns/manager/EconomyManager.java @@ -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

Whether to get the plural name or the singular name

- * @return

The name of the used currency

+ * @param amount

The amount of currency to format

+ * @return

The formatted amount of currency

*/ - 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); } /** diff --git a/src/main/resources/strings.yml b/src/main/resources/strings.yml index 3f29918..d657677 100644 --- a/src/main/resources/strings.yml +++ b/src/main/resources/strings.yml @@ -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"