geforkt von Mirrors/Velocity
Allow ping passthrough for descriptions too
Dieser Commit ist enthalten in:
Ursprung
c63bd4cd02
Commit
3e053d63b4
@ -3,5 +3,6 @@ package com.velocitypowered.proxy.config;
|
||||
public enum PingPassthroughMode {
|
||||
DISABLED,
|
||||
MODS,
|
||||
DESCRIPTION,
|
||||
ALL
|
||||
}
|
||||
|
@ -96,6 +96,9 @@ public class VelocityConfiguration extends AnnotatedConfig implements ProxyConfi
|
||||
" The first server in your try list (or forced host) with a mod list will be",
|
||||
" used. If no backend servers can be contacted, Velocity will not display any",
|
||||
" mod information.",
|
||||
"- \"description\": Uses the description and mod list from the backend server. The first",
|
||||
" server in the try (or forced host) list that responds is used for the",
|
||||
" description and mod list.",
|
||||
"- \"all\": Passes everything from the backend server into the response. The Velocity",
|
||||
" configuration is used if no servers could be contacted."
|
||||
})
|
||||
|
@ -97,6 +97,24 @@ public class StatusSessionHandler implements MinecraftSessionHandler {
|
||||
}
|
||||
return fallback;
|
||||
});
|
||||
case DESCRIPTION:
|
||||
return pingResponses.thenApply(responses -> {
|
||||
// Find the first non-fallback. If it includes a modlist, add it too.
|
||||
for (ServerPing response : responses) {
|
||||
if (response == fallback) {
|
||||
continue;
|
||||
}
|
||||
|
||||
return new ServerPing(
|
||||
fallback.getVersion(),
|
||||
fallback.getPlayers().orElse(null),
|
||||
response.getDescription(),
|
||||
fallback.getFavicon().orElse(null),
|
||||
response.getModinfo().orElse(null)
|
||||
);
|
||||
}
|
||||
return fallback;
|
||||
});
|
||||
default:
|
||||
// Not possible, but covered for completeness.
|
||||
return CompletableFuture.completedFuture(fallback);
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren