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:
parent
2d244420a9
commit
8cf0f61f3e
@ -53,6 +53,7 @@
|
|||||||
* Fixed #2460
|
* Fixed #2460
|
||||||
* Fixed #2760
|
* Fixed #2760
|
||||||
* Fixed #2771
|
* Fixed #2771
|
||||||
|
* Fixed placeholders that did not get loaded yet not having a label
|
||||||
|
|
||||||
## Release Candidate 19 (11 Jan 2021)
|
## Release Candidate 19 (11 Jan 2021)
|
||||||
|
|
||||||
|
@ -76,6 +76,8 @@ class PlaceholderAPIIntegration extends PlaceholderExpansion {
|
|||||||
if (profile.isPresent()) {
|
if (profile.isPresent()) {
|
||||||
Stream<Research> stream = profile.get().getResearches().stream();
|
Stream<Research> stream = profile.get().getResearches().stream();
|
||||||
return String.valueOf(stream.mapToInt(Research::getCost).sum());
|
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()) {
|
if (profile.isPresent()) {
|
||||||
Set<Research> set = profile.get().getResearches();
|
Set<Research> set = profile.get().getResearches();
|
||||||
return String.valueOf(set.size());
|
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()) {
|
if (profile.isPresent()) {
|
||||||
Set<Research> set = profile.get().getResearches();
|
Set<Research> set = profile.get().getResearches();
|
||||||
return String.valueOf(Math.round(((set.size() * 100.0F) / SlimefunPlugin.getRegistry().getResearches().size()) * 100.0F) / 100.0F);
|
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()) {
|
if (profile.isPresent()) {
|
||||||
return profile.get().getTitle();
|
return profile.get().getTitle();
|
||||||
|
} else if (p instanceof Player) {
|
||||||
|
return SlimefunPlugin.getLocalization().getMessage((Player) p, "placeholderapi.profile-loading");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -32,6 +32,9 @@ commands:
|
|||||||
verbose-player: '&4The verbose flag cannot be used by a Player!'
|
verbose-player: '&4The verbose flag cannot be used by a Player!'
|
||||||
unknown-flag: '&4Unknown flag: &c%flag%'
|
unknown-flag: '&4Unknown flag: &c%flag%'
|
||||||
|
|
||||||
|
placeholderapi:
|
||||||
|
profile-loading: 'Loading...'
|
||||||
|
|
||||||
guide:
|
guide:
|
||||||
locked: 'LOCKED'
|
locked: 'LOCKED'
|
||||||
work-in-progress: 'This feature is not fully finished yet!'
|
work-in-progress: 'This feature is not fully finished yet!'
|
||||||
|
Loading…
Reference in New Issue
Block a user