Mirror von
https://github.com/ViaVersion/ViaVersion.git
synchronisiert 2024-12-28 17:10:13 +01:00
Add subplatform versions to dumps
Dieser Commit ist enthalten in:
Ursprung
e3821e1741
Commit
0f90efa05f
@ -14,6 +14,7 @@ import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.TabCompleteThread;
|
||||
import us.myles.ViaVersion.protocols.protocol1_9to1_8.ViaIdleThread;
|
||||
import us.myles.ViaVersion.update.UpdateUtil;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
@ -25,6 +26,7 @@ public class ViaManager {
|
||||
private final ViaInjector injector;
|
||||
private final ViaCommandHandler commandHandler;
|
||||
private final ViaPlatformLoader loader;
|
||||
private final Set<String> subPlatforms = new HashSet<>();
|
||||
private boolean debug;
|
||||
|
||||
@Builder
|
||||
@ -170,6 +172,16 @@ public class ViaManager {
|
||||
return loader;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a mutable set of self-added subplatform version strings.
|
||||
* This set is expanded by the subplatform itself (e.g. ViaBackwards), and may not contain all running ones.
|
||||
*
|
||||
* @return mutable set of subplatform versions
|
||||
*/
|
||||
public Set<String> getSubPlatforms() {
|
||||
return subPlatforms;
|
||||
}
|
||||
|
||||
public UserConnection getConnection(UUID playerUUID) {
|
||||
return platform.getConnectionManager().getConnectedClient(playerUUID);
|
||||
}
|
||||
|
@ -18,7 +18,7 @@ import java.io.InvalidObjectException;
|
||||
import java.io.OutputStream;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.net.URL;
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.Map;
|
||||
import java.util.logging.Level;
|
||||
|
||||
@ -34,10 +34,9 @@ public class DumpSubCmd extends ViaSubCommand {
|
||||
return "Dump information about your server, this is helpful if you report bugs.";
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean execute(final ViaCommandSender sender, String[] args) {
|
||||
final VersionInfo version = new VersionInfo(
|
||||
public boolean execute(ViaCommandSender sender, String[] args) {
|
||||
VersionInfo version = new VersionInfo(
|
||||
System.getProperty("java.version"),
|
||||
System.getProperty("os.name"),
|
||||
ProtocolRegistry.SERVER_PROTOCOL,
|
||||
@ -45,12 +44,13 @@ public class DumpSubCmd extends ViaSubCommand {
|
||||
Via.getPlatform().getPlatformName(),
|
||||
Via.getPlatform().getPlatformVersion(),
|
||||
Via.getPlatform().getPluginVersion(),
|
||||
ViaManager.class.getPackage().getImplementationVersion()
|
||||
ViaManager.class.getPackage().getImplementationVersion(),
|
||||
Via.getManager().getSubPlatforms()
|
||||
);
|
||||
|
||||
Map<String, Object> configuration = Via.getPlatform().getConfigurationProvider().getValues();
|
||||
|
||||
final DumpTemplate template = new DumpTemplate(version, configuration, Via.getPlatform().getDump(), Via.getManager().getInjector().getDump());
|
||||
DumpTemplate template = new DumpTemplate(version, configuration, Via.getPlatform().getDump(), Via.getManager().getInjector().getDump());
|
||||
|
||||
Via.getPlatform().runAsync(new Runnable() {
|
||||
@Override
|
||||
@ -71,7 +71,7 @@ public class DumpSubCmd extends ViaSubCommand {
|
||||
con.setDoOutput(true);
|
||||
|
||||
OutputStream out = con.getOutputStream();
|
||||
out.write(GsonUtil.getGsonBuilder().setPrettyPrinting().create().toJson(template).getBytes(Charset.forName("UTF-8")));
|
||||
out.write(GsonUtil.getGsonBuilder().setPrettyPrinting().create().toJson(template).getBytes(StandardCharsets.UTF_8));
|
||||
out.close();
|
||||
|
||||
if (con.getResponseCode() == 429) {
|
||||
|
@ -11,9 +11,10 @@ public class VersionInfo {
|
||||
private final String platformVersion;
|
||||
private final String pluginVersion;
|
||||
private final String implementationVersion;
|
||||
private final Set<String> subPlatforms;
|
||||
|
||||
public VersionInfo(String javaVersion, String operatingSystem, int serverProtocol, Set<Integer> enabledProtocols,
|
||||
String platformName, String platformVersion, String pluginVersion, String implementationVersion) {
|
||||
String platformName, String platformVersion, String pluginVersion, String implementationVersion, Set<String> subPlatforms) {
|
||||
this.javaVersion = javaVersion;
|
||||
this.operatingSystem = operatingSystem;
|
||||
this.serverProtocol = serverProtocol;
|
||||
@ -22,6 +23,7 @@ public class VersionInfo {
|
||||
this.platformVersion = platformVersion;
|
||||
this.pluginVersion = pluginVersion;
|
||||
this.implementationVersion = implementationVersion;
|
||||
this.subPlatforms = subPlatforms;
|
||||
}
|
||||
|
||||
public String getJavaVersion() {
|
||||
@ -55,5 +57,9 @@ public class VersionInfo {
|
||||
public String getImplementationVersion() {
|
||||
return implementationVersion;
|
||||
}
|
||||
|
||||
public Set<String> getSubPlatforms() {
|
||||
return subPlatforms;
|
||||
}
|
||||
}
|
||||
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren