Search in sources :

Example 1 with Favicon

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());
}
Also used : MiniMOTDConfig(xyz.jpenilla.minimotd.common.config.MiniMOTDConfig) Favicon(com.velocitypowered.api.util.Favicon) ServerPing(com.velocitypowered.api.proxy.server.ServerPing)

Aggregations

ServerPing (com.velocitypowered.api.proxy.server.ServerPing)1 Favicon (com.velocitypowered.api.util.Favicon)1 MiniMOTDConfig (xyz.jpenilla.minimotd.common.config.MiniMOTDConfig)1