Skip to content

Commit

Permalink
oops
Browse files Browse the repository at this point in the history
  • Loading branch information
astei committed May 14, 2023
1 parent 02f0ed7 commit eca2767
Showing 1 changed file with 5 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
import com.electronwill.nightconfig.core.CommentedConfig;
import com.electronwill.nightconfig.core.UnmodifiableConfig;
import com.electronwill.nightconfig.core.file.CommentedFileConfig;
import com.electronwill.nightconfig.toml.TomlFormat;
import com.google.common.base.MoreObjects;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
Expand All @@ -29,15 +28,13 @@
import com.velocitypowered.api.util.Favicon;
import com.velocitypowered.proxy.util.AddressUtil;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.net.InetSocketAddress;
import java.net.SocketAddress;
import java.net.URL;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.StandardCopyOption;
import java.security.SecureRandom;
import java.util.HashMap;
import java.util.List;
Expand Down Expand Up @@ -451,17 +448,6 @@ public static VelocityConfiguration read(Path path) throws IOException {
.build();
config.load();

// Create temporary default configuration
File tmpFile = File.createTempFile("default-config", null);
tmpFile.deleteOnExit();

// Copy over default file to tmp location
try (InputStream in = defaultConfigLocation.openStream()) {
Files.copy(in, tmpFile.toPath(), StandardCopyOption.REPLACE_EXISTING);
}
CommentedFileConfig defaultConfig = CommentedFileConfig.of(tmpFile, TomlFormat.instance());
defaultConfig.load();

// TODO: migrate this on Velocity Polymer
double configVersion;
try {
Expand Down Expand Up @@ -537,19 +523,19 @@ public static VelocityConfiguration read(Path path) throws IOException {
if (motd.strip().startsWith("{")) {
migratedMotd = MiniMessage.miniMessage().serialize(
GsonComponentSerializer.gson().deserialize(motd))
.replace("\\", "");
.replace("\\", "");
} else {
// Legacy '&' Format Migration
migratedMotd = MiniMessage.miniMessage().serialize(
LegacyComponentSerializer.legacyAmpersand().deserialize(motd));
LegacyComponentSerializer.legacyAmpersand().deserialize(motd));
}

config.set("motd", migratedMotd);
motd = migratedMotd;

config.setComment("motd",
" What should be the MOTD? This gets displayed when the player adds your server to\n"
+ " their server list. Only MiniMessage format is accepted.");
" What should be the MOTD? This gets displayed when the player adds your server to\n"
+ " their server list. Only MiniMessage format is accepted.");
config.set("config-version", "2.6");
mustResave = true;
}
Expand Down

0 comments on commit eca2767

Please sign in to comment.