1
mirror of https://github.com/StarWishsama/Slimefun4.git synced 2024-09-19 19:25:48 +00:00

Added placeholder for unloaded profiles to PlaceholderAPI integration

This commit is contained in:
TheBusyBiscuit 2021-01-28 18:21:22 +01:00
parent 2d244420a9
commit 8cf0f61f3e
3 changed files with 12 additions and 0 deletions

View File

@ -53,6 +53,7 @@
* Fixed #2460
* Fixed #2760
* Fixed #2771
* Fixed placeholders that did not get loaded yet not having a label
## Release Candidate 19 (11 Jan 2021)

View File

@ -76,6 +76,8 @@ class PlaceholderAPIIntegration extends PlaceholderExpansion {
if (profile.isPresent()) {
Stream<Research> stream = profile.get().getResearches().stream();
return String.valueOf(stream.mapToInt(Research::getCost).sum());
} else if (p instanceof Player) {
return SlimefunPlugin.getLocalization().getMessage((Player) p, "placeholderapi.profile-loading");
}
}
@ -85,6 +87,8 @@ class PlaceholderAPIIntegration extends PlaceholderExpansion {
if (profile.isPresent()) {
Set<Research> set = profile.get().getResearches();
return String.valueOf(set.size());
} else if (p instanceof Player) {
return SlimefunPlugin.getLocalization().getMessage((Player) p, "placeholderapi.profile-loading");
}
}
@ -98,6 +102,8 @@ class PlaceholderAPIIntegration extends PlaceholderExpansion {
if (profile.isPresent()) {
Set<Research> set = profile.get().getResearches();
return String.valueOf(Math.round(((set.size() * 100.0F) / SlimefunPlugin.getRegistry().getResearches().size()) * 100.0F) / 100.0F);
} else if (p instanceof Player) {
return SlimefunPlugin.getLocalization().getMessage((Player) p, "placeholderapi.profile-loading");
}
}
@ -106,6 +112,8 @@ class PlaceholderAPIIntegration extends PlaceholderExpansion {
if (profile.isPresent()) {
return profile.get().getTitle();
} else if (p instanceof Player) {
return SlimefunPlugin.getLocalization().getMessage((Player) p, "placeholderapi.profile-loading");
}
}

View File

@ -32,6 +32,9 @@ commands:
verbose-player: '&4The verbose flag cannot be used by a Player!'
unknown-flag: '&4Unknown flag: &c%flag%'
placeholderapi:
profile-loading: 'Loading...'
guide:
locked: 'LOCKED'
work-in-progress: 'This feature is not fully finished yet!'