use of com.velocitypowered.api.util.Favicon in project MiniMOTD by jpenilla.
the class PingListener method handle.
private void handle(final ProxyPingEvent event) {
final MiniMOTDConfig config = this.miniMOTD.configManager().resolveConfig(event.getConnection().getVirtualHost().orElse(null));
final ServerPing.Builder pong = event.getPing().asBuilder();
final PingResponse<Favicon> response = this.miniMOTD.createMOTD(config, pong.getOnlinePlayers(), pong.getMaximumPlayers());
response.icon(pong::favicon);
response.motd(pong::description);
response.playerCount().applyCount(pong::onlinePlayers, pong::maximumPlayers);
if (response.disablePlayerListHover()) {
pong.clearSamplePlayers();
}
if (response.hidePlayerCount()) {
pong.nullPlayers();
}
event.setPing(pong.build());
}
Aggregations