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
10 changes: 5 additions & 5 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ plugins {
}

group = 'at.helpch.placeholderapi.expansion'
version = '1.8.3'
version = '1.8.4-dev'

repositories {
mavenCentral()
Expand All @@ -23,10 +23,10 @@ repositories {
}

dependencies {
compileOnly 'org.spigotmc:spigot-api:1.16.3-R0.1-SNAPSHOT'
compileOnly 'me.clip:placeholderapi:2.11.1'
compileOnly 'org.jetbrains:annotations:23.0.0'
compileOnly 'com.github.MilkBowl:VaultAPI:1.7'
compileOnly 'org.spigotmc:spigot-api:1.21.8-R0.1-SNAPSHOT'
compileOnly 'me.clip:placeholderapi:2.11.6'
compileOnly 'org.jetbrains:annotations:26.0.2'
compileOnly 'com.github.MilkBowl:VaultAPI:1.7.1'
}

compileJava {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,15 @@ private double getBalance(@NotNull final OfflinePlayer player) {
final Long divideBy = e.getKey();
final String suffix = e.getValue();

if (divideBy == null || divideBy <= 0) {
return Long.toString(balance); //no suffix found, return as is
}

long truncated = balance / (divideBy / 10); //the number part of the output times 10
boolean hasDecimal = truncated < 100 && (truncated / 10d) != (truncated / 10);
return hasDecimal ? (truncated / 10d) + suffix : (truncated / 10) + suffix;
long decimal = truncated % 10;
truncated /= 10; //remove the decimal part

return decimal == 0 ? truncated + suffix : truncated + "." + decimal + suffix;
}

@Override
Expand Down