Fixed NPE on API#getPlayerInspectPageLink #456

This commit is contained in:
Rsl1122 2017-12-06 15:46:11 +02:00
parent 8d3afc9286
commit 7f8f67845a
2 changed files with 11 additions and 5 deletions

View File

@ -82,8 +82,10 @@ public class API {
* @return {@code ../player/PlayerName}
*/
public String getPlayerInspectPageLink(String name) {
String link = "../player/" + name.replace(" ", "%20").replace(".", "%2E");
return link;
if (name == null) {
return "#";
}
return "../player/" + name.replace(" ", "%20").replace(".", "%2E");
}
/**

View File

@ -116,9 +116,7 @@ public class Analysis {
profile.addActiveSessions(new HashMap<>(SessionCache.getActiveSessions()));
serverProfile = profile;
for (PlayerProfile player : profile.getPlayers()) {
dataCache.updateNames(player.getUuid(), player.getName(), null);
}
updatePlayerNameCache(profile, dataCache);
long fetchPhaseLength = Benchmark.stop("Analysis", "Fetch Phase");
setBannedByPlugins(profile);
@ -150,6 +148,12 @@ public class Analysis {
return true;
}
private void updatePlayerNameCache(ServerProfile profile, DataCache dataCache) {
for (PlayerProfile player : profile.getPlayers()) {
dataCache.updateNames(player.getUuid(), player.getName(), null);
}
}
private void setBannedByPlugins(ServerProfile profile) {
UUID serverUUID = Plan.getServerUUID();
List<BanData> banPlugins = plugin.getHookHandler().getAdditionalDataSources().stream()