1
mirror of https://github.com/StarWishsama/Slimefun4.git synced 2024-09-20 11:45:51 +00:00

Merge pull request #1258 from NiekWilting/fix-titles

Fixed the getTitle method.
This commit is contained in:
TheBusyBiscuit 2019-11-24 14:28:10 +01:00 committed by GitHub
commit 85227f0814
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -186,8 +186,9 @@ public final class PlayerProfile {
public String getTitle() { public String getTitle() {
List<String> titles = SlimefunPlugin.getSettings().researchesTitles; List<String> titles = SlimefunPlugin.getSettings().researchesTitles;
int index = Math.round(Float.valueOf(String.valueOf(Math.round(((researches.size() * 100.0F) / Research.list().size()) * 100.0F) / 100.0F)) / 100.0F) * titles.size(); float fraction = (float) researches.size() / Research.list().size();
if (index > 0) index--; int index = (int) (fraction * (titles.size() -1));
return titles.get(index); return titles.get(index);
} }