Fix memory leak in legacy ping passthrough (Fixes #674, #813)

This commit is contained in:
RednedEpic 2020-07-04 16:35:48 -05:00
parent cc2bbc675f
commit 8ac5d6e13d
8 changed files with 152 additions and 53 deletions

View file

@ -60,14 +60,15 @@ public class GeyserBungeePingPassthrough implements IGeyserPingPassthrough, List
else future.complete(event);
}));
ProxyPingEvent event = future.join();
ServerPing response = event.getResponse();
GeyserPingInfo geyserPingInfo = new GeyserPingInfo(
event.getResponse().getDescription(),
event.getResponse().getPlayers().getOnline(),
event.getResponse().getPlayers().getMax()
response.getDescriptionComponent().toLegacyText(),
new GeyserPingInfo.Players(response.getPlayers().getMax(), response.getPlayers().getOnline()),
new GeyserPingInfo.Version(response.getVersion().getName(), response.getVersion().getProtocol())
);
if (event.getResponse().getPlayers().getSample() != null) {
Arrays.stream(event.getResponse().getPlayers().getSample()).forEach(proxiedPlayer -> {
geyserPingInfo.addPlayer(proxiedPlayer.getName());
geyserPingInfo.getPlayerList().add(proxiedPlayer.getName());
});
}
return geyserPingInfo;