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:
Kristian Knarvik 2022-11-14 02:17:06 +01:00
parent 3d2194e627
commit 5c927b5607
6 changed files with 25 additions and 41 deletions

View File

@ -15,7 +15,7 @@ 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 |
| /ps cancel | permissionsigns.admin.create | Used for manually cancelling a permission sign creation request |
@ -48,7 +48,7 @@ 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 |
@ -58,7 +58,7 @@ this: `world:essentials.gamemode.creatice,any:essentials.gamemode.survival,world
## 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 |
| 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. |

View File

@ -51,7 +51,7 @@
</repository>
<repository>
<id>vault-repo</id>
<url>http://nexus.hc.to/content/repositories/pub_releases</url>
<url>https://nexus.hc.to/content/repositories/pub_releases</url>
</repository>
</repositories>
@ -59,7 +59,7 @@
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.19.1-R0.1-SNAPSHOT</version>
<version>1.19.2-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>

View File

@ -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);
}
}

View File

@ -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
*/

View File

@ -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);
}
/**

View File

@ -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"