Mirror von
https://github.com/ViaVersion/ViaVersion.git
synchronisiert 2024-12-24 23:30:15 +01:00
Allow servers to manually be probed with API
Dieser Commit ist enthalten in:
Ursprung
f4eeb94a2e
Commit
1209beb47d
@ -2,6 +2,7 @@ package us.myles.ViaVersion.bungee.platform;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import lombok.NonNull;
|
||||
import net.md_5.bungee.api.config.ServerInfo;
|
||||
import net.md_5.bungee.api.connection.ProxiedPlayer;
|
||||
import us.myles.ViaVersion.api.Via;
|
||||
import us.myles.ViaVersion.api.ViaAPI;
|
||||
@ -10,6 +11,7 @@ import us.myles.ViaVersion.api.boss.BossColor;
|
||||
import us.myles.ViaVersion.api.boss.BossStyle;
|
||||
import us.myles.ViaVersion.api.data.UserConnection;
|
||||
import us.myles.ViaVersion.api.protocol.ProtocolRegistry;
|
||||
import us.myles.ViaVersion.bungee.service.ProtocolDetectorService;
|
||||
import us.myles.ViaVersion.protocols.base.ProtocolInfo;
|
||||
|
||||
import java.util.Map;
|
||||
@ -75,4 +77,13 @@ public class BungeeViaAPI implements ViaAPI<ProxiedPlayer> {
|
||||
public Map<UUID, UserConnection> getPortedPlayers() {
|
||||
return Via.getManager().getPortedPlayers();
|
||||
}
|
||||
|
||||
/**
|
||||
* Forces ViaVersion to probe a server
|
||||
*
|
||||
* @param serverInfo The serverinfo to probe
|
||||
*/
|
||||
public void probeServer(ServerInfo serverInfo) {
|
||||
ProtocolDetectorService.probeServer(serverInfo);
|
||||
}
|
||||
}
|
||||
|
@ -45,12 +45,13 @@ public class ProtocolDetectorService implements Runnable {
|
||||
@Override
|
||||
public void run() {
|
||||
for (final Map.Entry<String, ServerInfo> lists : plugin.getProxy().getServers().entrySet()) {
|
||||
updateProtocolInfo(lists.getKey(), lists.getValue());
|
||||
probeServer(lists.getValue());
|
||||
}
|
||||
}
|
||||
|
||||
private void updateProtocolInfo(final String key, ServerInfo value) {
|
||||
value.ping(new Callback<ServerPing>() {
|
||||
public static void probeServer(final ServerInfo serverInfo) {
|
||||
final String key = serverInfo.getName();
|
||||
serverInfo.ping(new Callback<ServerPing>() {
|
||||
@Override
|
||||
public void done(ServerPing serverPing, Throwable throwable) {
|
||||
if (throwable == null) {
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren