Store server name (in addition to address) in replays (closes #324)
This commit is contained in:
@@ -15,6 +15,7 @@ import com.replaymod.replaystudio.replay.ReplayMetaData;
|
||||
import io.netty.channel.Channel;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.network.ServerInfo;
|
||||
import net.minecraft.client.resource.language.I18n;
|
||||
import net.minecraft.network.ClientConnection;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
@@ -89,6 +90,7 @@ public class ConnectionEventHandler {
|
||||
}
|
||||
|
||||
String worldName;
|
||||
String serverName = null;
|
||||
boolean autoStart = core.getSettingsRegistry().get(Setting.AUTO_START_RECORDING);
|
||||
if (local) {
|
||||
//#if MC>=11600
|
||||
@@ -96,9 +98,13 @@ public class ConnectionEventHandler {
|
||||
//#else
|
||||
//$$ worldName = mc.getServer().getLevelName();
|
||||
//#endif
|
||||
serverName = worldName;
|
||||
} else if (mc.getCurrentServerEntry() != null) {
|
||||
ServerInfo serverInfo = mc.getCurrentServerEntry();
|
||||
worldName = serverInfo.address;
|
||||
if (!I18n.translate("selectServer.defaultName").equals(serverInfo.name)) {
|
||||
serverName = serverInfo.name;
|
||||
}
|
||||
|
||||
Boolean autoStartServer = ServerInfoExt.from(serverInfo).getAutoRecording();
|
||||
if (autoStartServer != null) {
|
||||
@@ -128,6 +134,7 @@ public class ConnectionEventHandler {
|
||||
ReplayMetaData metaData = new ReplayMetaData();
|
||||
metaData.setSingleplayer(local);
|
||||
metaData.setServerName(worldName);
|
||||
metaData.setCustomServerName(serverName);
|
||||
metaData.setGenerator("ReplayMod v" + ReplayMod.instance.getVersion());
|
||||
metaData.setDate(System.currentTimeMillis());
|
||||
metaData.setMcVersion(ReplayMod.getMinecraftVersion());
|
||||
|
||||
@@ -531,7 +531,9 @@ public class GuiReplayViewer extends GuiScreen {
|
||||
this.renderQueue = renderQueue;
|
||||
|
||||
name.setText(Formatting.UNDERLINE + Utils.fileNameToReplayName(file.getName()));
|
||||
if (StringUtils.isEmpty(metaData.getServerName())
|
||||
if (!StringUtils.isEmpty(metaData.getCustomServerName())) {
|
||||
server.setText(metaData.getCustomServerName());
|
||||
} else if (StringUtils.isEmpty(metaData.getServerName())
|
||||
|| !ReplayMod.instance.getSettingsRegistry().get(Setting.SHOW_SERVER_IPS)) {
|
||||
server.setI18nText("replaymod.gui.iphidden").setColor(Colors.DARK_RED);
|
||||
} else {
|
||||
|
||||
@@ -305,7 +305,7 @@ dependencies {
|
||||
|
||||
shadow 'com.github.ReplayMod.JavaBlend:2.79.0:a0696f8'
|
||||
|
||||
shadow "com.github.ReplayMod:ReplayStudio:bcffd46", shadeExclusions
|
||||
shadow "com.github.ReplayMod:ReplayStudio:9558f9e", shadeExclusions
|
||||
|
||||
implementation(jGui){
|
||||
transitive = false // FG 1.2 puts all MC deps into the compile configuration and we don't want to shade those
|
||||
|
||||
Reference in New Issue
Block a user