Skip to content

Instantly share code, notes, and snippets.

@git-init-wesley
Created March 22, 2020 14:31
Show Gist options
  • Select an option

  • Save git-init-wesley/e3584c9e4d2f76783a7b8f324d48d9e3 to your computer and use it in GitHub Desktop.

Select an option

Save git-init-wesley/e3584c9e4d2f76783a7b8f324d48d9e3 to your computer and use it in GitHub Desktop.
ServeurPing builder. (BungeeCord)
package net.makiru.bungee.builders;
import net.md_5.bungee.api.Favicon;
import net.md_5.bungee.api.ServerPing;
import net.md_5.bungee.api.chat.BaseComponent;
import org.jetbrains.annotations.NotNull;
/**
* Copyright © LEVASSEUR Wesley
*
* @author LEVASSEUR Wesley
*/
public class ServerPing_B {
private final ServerPing serverPing;
public ServerPing_B(@NotNull final ServerPing serverPing) {
this.serverPing = serverPing;
}
public ServerPing_B(@NotNull final ServerPing serverPing, @NotNull final ServerPing.Protocol version, @NotNull final ServerPing.Players players, @NotNull final BaseComponent descriptionComponent, @NotNull final Favicon favicon) {
this(serverPing);
this.serverPing.setVersion(version);
this.serverPing.setPlayers(players);
this.serverPing.setDescriptionComponent(descriptionComponent);
this.serverPing.setFavicon(favicon);
}
public ServerPing_B(@NotNull final ServerPing serverPing, @NotNull final ServerPing.Protocol version, @NotNull final ServerPing.Players players, @NotNull final BaseComponent descriptionComponent) {
this(serverPing, version, players, descriptionComponent, serverPing.getFaviconObject());
}
public ServerPing_B(@NotNull final ServerPing serverPing, @NotNull final Protocol_B version, @NotNull final ServerPing.Players players, @NotNull final BaseComponent descriptionComponent, @NotNull final Favicon favicon) {
this(serverPing, version.toProtocol(), players, descriptionComponent, favicon);
}
public ServerPing_B(@NotNull final ServerPing serverPing, @NotNull final Protocol_B version, @NotNull final ServerPing.Players players, @NotNull final BaseComponent descriptionComponent) {
this(serverPing, version.toProtocol(), players, descriptionComponent, serverPing.getFaviconObject());
}
public ServerPing_B(@NotNull final ServerPing serverPing, @NotNull final String version, @NotNull final ServerPing.Players players, @NotNull final BaseComponent descriptionComponent, @NotNull final Favicon favicon) {
this(serverPing, new ServerPing.Protocol(version, serverPing.getVersion().getProtocol()), players, descriptionComponent, favicon);
}
public ServerPing_B(@NotNull final ServerPing serverPing, @NotNull final String version, @NotNull final ServerPing.Players players, @NotNull final BaseComponent descriptionComponent) {
this(serverPing, new ServerPing.Protocol(version, serverPing.getVersion().getProtocol()), players, descriptionComponent, serverPing.getFaviconObject());
}
public ServerPing_B(@NotNull final ServerPing serverPing, @NotNull final ServerPing.Protocol version, @NotNull final Players_B players, @NotNull final BaseComponent descriptionComponent, @NotNull final Favicon favicon) {
this(serverPing, version, players.toPlayers(), descriptionComponent, favicon);
}
public ServerPing_B(@NotNull final ServerPing serverPing, @NotNull final ServerPing.Protocol version, @NotNull final Players_B players, @NotNull final BaseComponent descriptionComponent) {
this(serverPing, version, players.toPlayers(), descriptionComponent, serverPing.getFaviconObject());
}
public ServerPing_B(@NotNull final ServerPing serverPing, @NotNull final ServerPing.Protocol version, final int max, final int online, @NotNull final BaseComponent descriptionComponent, @NotNull final Favicon favicon) {
this(serverPing, version, new ServerPing.Players(max, online, serverPing.getPlayers().getSample()), descriptionComponent, favicon);
}
public ServerPing_B(@NotNull final ServerPing serverPing, @NotNull final ServerPing.Protocol version, final int max, final int online, @NotNull final BaseComponent descriptionComponent) {
this(serverPing, version, new ServerPing.Players(max, online, serverPing.getPlayers().getSample()), descriptionComponent, serverPing.getFaviconObject());
}
public ServerPing_B(@NotNull final ServerPing serverPing, @NotNull final String version, final int max, final int online, @NotNull final BaseComponent descriptionComponent, @NotNull final Favicon favicon) {
this(serverPing, new ServerPing.Protocol(version, serverPing.getVersion().getProtocol()), new ServerPing.Players(max, online, serverPing.getPlayers().getSample()), descriptionComponent, favicon);
}
public ServerPing_B(@NotNull final ServerPing serverPing, @NotNull final String version, final int max, final int online, @NotNull final BaseComponent descriptionComponent) {
this(serverPing, new ServerPing.Protocol(version, serverPing.getVersion().getProtocol()), new ServerPing.Players(max, online, serverPing.getPlayers().getSample()), descriptionComponent, serverPing.getFaviconObject());
}
@Deprecated
public ServerPing_B(@NotNull final ServerPing serverPing, @NotNull final ServerPing.Protocol version, @NotNull final ServerPing.Players players, @NotNull final String description, @NotNull final String favicon) {
this(serverPing);
this.serverPing.setVersion(version);
this.serverPing.setPlayers(players);
this.serverPing.setDescription(description);
this.serverPing.setFavicon(favicon);
}
@Deprecated
public ServerPing_B(@NotNull final ServerPing serverPing, @NotNull final ServerPing.Protocol version, @NotNull final ServerPing.Players players, @NotNull final String description) {
this(serverPing, version, players, description, serverPing.getFavicon());
}
@Deprecated
public ServerPing_B(@NotNull final ServerPing serverPing, @NotNull final Protocol_B version, @NotNull final ServerPing.Players players, @NotNull final String description, @NotNull final String favicon) {
this(serverPing, version.toProtocol(), players, description, favicon);
}
@Deprecated
public ServerPing_B(@NotNull final ServerPing serverPing, @NotNull final Protocol_B version, @NotNull final ServerPing.Players players, @NotNull final String description) {
this(serverPing, version.toProtocol(), players, description, serverPing.getFavicon());
}
@Deprecated
public ServerPing_B(@NotNull final ServerPing serverPing, @NotNull final String version, @NotNull final ServerPing.Players players, @NotNull final String description, @NotNull final String favicon) {
this(serverPing, new ServerPing.Protocol(version, serverPing.getVersion().getProtocol()), players, description, favicon);
}
@Deprecated
public ServerPing_B(@NotNull final ServerPing serverPing, @NotNull final String version, @NotNull final ServerPing.Players players, @NotNull final String description) {
this(serverPing, new ServerPing.Protocol(version, serverPing.getVersion().getProtocol()), players, description, serverPing.getFavicon());
}
@Deprecated
public ServerPing_B(@NotNull final ServerPing serverPing, @NotNull final ServerPing.Protocol version, @NotNull final Players_B players, @NotNull final String description, @NotNull final String favicon) {
this(serverPing, version, players.toPlayers(), description, favicon);
}
@Deprecated
public ServerPing_B(@NotNull final ServerPing serverPing, @NotNull final ServerPing.Protocol version, @NotNull final Players_B players, @NotNull final String description) {
this(serverPing, version, players.toPlayers(), description, serverPing.getFavicon());
}
@Deprecated
public ServerPing_B(@NotNull final ServerPing serverPing, @NotNull final ServerPing.Protocol version, final int max, final int online, @NotNull final String description, @NotNull final String favicon) {
this(serverPing, version, new ServerPing.Players(max, online, serverPing.getPlayers().getSample()), description, favicon);
}
@Deprecated
public ServerPing_B(@NotNull final ServerPing serverPing, @NotNull final ServerPing.Protocol version, final int max, final int online, @NotNull final String description) {
this(serverPing, version, new ServerPing.Players(max, online, serverPing.getPlayers().getSample()), description, serverPing.getFavicon());
}
@Deprecated
public ServerPing_B(@NotNull final ServerPing serverPing, @NotNull final String version, final int max, final int online, @NotNull final String description, @NotNull final String favicon) {
this(serverPing, new ServerPing.Protocol(version, serverPing.getVersion().getProtocol()), new ServerPing.Players(max, online, serverPing.getPlayers().getSample()), description, favicon);
}
@Deprecated
public ServerPing_B(@NotNull final ServerPing serverPing, @NotNull final String version, final int max, final int online, @NotNull final String description) {
this(serverPing, new ServerPing.Protocol(version, serverPing.getVersion().getProtocol()), new ServerPing.Players(max, online, serverPing.getPlayers().getSample()), description, serverPing.getFavicon());
}
public ServerPing_B setVersion(@NotNull final ServerPing.Protocol version) {
this.serverPing.setVersion(version);
return this;
}
public ServerPing_B setPlayers(@NotNull final ServerPing.Players players) {
this.serverPing.setPlayers(players);
return this;
}
public ServerPing_B setPlayers(@NotNull final Players_B players) {
this.serverPing.setPlayers(players.toPlayers());
return this;
}
public ServerPing_B setDescriptionComponent(@NotNull final BaseComponent descriptionComponent) {
this.serverPing.setDescriptionComponent(descriptionComponent);
return this;
}
@Deprecated
public ServerPing_B setDescription(@NotNull final String description) {
this.serverPing.setDescription(description);
return this;
}
public ServerPing_B setFavicon(@NotNull final Favicon favicon) {
this.serverPing.setFavicon(favicon);
return this;
}
@Deprecated
public ServerPing_B setFavicon(@NotNull final String favicon) {
this.serverPing.setFavicon(favicon);
return this;
}
public ServerPing toServerPing() {
return this.serverPing;
}
public static class Protocol_B {
private final ServerPing.Protocol protocol;
public Protocol_B(ServerPing.Protocol protocol) {
this.protocol = protocol;
}
public Protocol_B(@NotNull final String name, final int protocol) {
this(new ServerPing.Protocol(name, protocol));
}
public Protocol_B setName(@NotNull final String name) {
this.protocol.setName(name);
return this;
}
public Protocol_B setProtocol(final int protocol) {
this.protocol.setProtocol(protocol);
return this;
}
public ServerPing.Protocol toProtocol() {
return protocol;
}
}
public static class Players_B {
private final ServerPing.Players players;
public Players_B(@NotNull final ServerPing.Players players) {
this.players = players;
}
public Players_B(final int max, final int online, @NotNull final ServerPing.PlayerInfo[] sample) {
this.players = new ServerPing.Players(max, online, sample);
}
public Players_B setMax(final int max) {
this.players.setMax(max);
return this;
}
public Players_B setOnline(final int online) {
this.players.setOnline(online);
return this;
}
public Players_B setSample(@NotNull final ServerPing.PlayerInfo[] sample) {
this.players.setSample(sample);
return this;
}
public ServerPing.Players toPlayers() {
return players;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment